Skip to content

Commit 6d3b991

Browse files
authored
Lookup by ID and Delete by ID actions
1 parent 5b47bf1 commit 6d3b991

File tree

20 files changed

+611
-62
lines changed

20 files changed

+611
-62
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# 1.1.0 (June 11, 2025)
2+
3+
* Added `Delete Object By ID` Action
4+
* Added `Lookup Object By ID` Action
5+
16
# 1.0.0 (June 03, 2025)
27

38
* Initial component release

README.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
* [Description](#description)
66
* [Credentials](#credentials)
77
* [Actions](#actions)
8+
* [Delete Object By ID](#delete-object-by-id)
9+
* [Lookup Object By ID](#lookup-object-by-id)
810
* [Make Raw Request](#make-raw-request)
911

1012
## Description
@@ -37,7 +39,41 @@ Now you can create new credentials for the component on the platform:
3739
* **Number of retries** (number, optional, 5 by default) - How many times component should retry to make request
3840
* **Delay between retries** (number ms, optional, 10000 by default) - How much time wait until new try
3941

40-
## Actions
42+
## Actions
43+
44+
### Delete Object By ID
45+
46+
Deletes a single object using its ID.
47+
48+
#### Configuration Fields
49+
50+
- **Object Type** - (dropdown, required): The type of the object to delete.
51+
52+
#### Input Metadata
53+
54+
- **ID Value** - (string, required): The ID of the object to delete.
55+
56+
#### Output Metadata
57+
58+
Returns the ID of the deleted object.
59+
60+
### Lookup Object By ID
61+
62+
Retrieves a single object using its ID.
63+
64+
#### Configuration Fields
65+
66+
- **Object Type** - (dropdown, required): The type of object to look up.
67+
68+
#### Input Metadata
69+
70+
- **ID Value** - (string, required): The ID of the object to look up.
71+
72+
#### Output Metadata
73+
74+
Returns an object with the result of the lookup.
75+
76+
**Known limitation**: Currently, the `Generate Stub Sample` button only allows generating generic metadata, without specific object type details.
4177

4278
### Make Raw Request
4379

component.json

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"title": "Podio component",
33
"description": "A smart connector for accessing Podio API",
4-
"version": "1.0.0",
4+
"version": "1.1.0",
55
"authClientTypes": [
66
"oauth2"
77
],
@@ -33,6 +33,50 @@
3333
}
3434
},
3535
"actions": {
36+
"deleteObjectById": {
37+
"main": "./src/actions/deleteObjectById.js",
38+
"title": "Delete Object By ID",
39+
"help": {
40+
"description": "Delete Object By ID",
41+
"link": "/components/podio/index.html#delete-object-by-id"
42+
},
43+
"fields": {
44+
"objectType": {
45+
"label": "Object Type",
46+
"viewClass": "SelectView",
47+
"prompt": "Please select the type of object to delete",
48+
"required": true,
49+
"order": 10,
50+
"model": "getDeleteByIdObjects"
51+
}
52+
},
53+
"metadata": {
54+
"in": "./src/schemas/metadata/deleteObjectById/in.json",
55+
"out": "./src/schemas/metadata/deleteObjectById/out.json"
56+
}
57+
},
58+
"lookupObjectById": {
59+
"main": "./src/actions/lookupObjectById.js",
60+
"title": "Lookup Object By ID",
61+
"help": {
62+
"description": "Lookup Object By ID",
63+
"link": "/components/podio/index.html#lookup-object-by-id"
64+
},
65+
"fields": {
66+
"objectType": {
67+
"label": "Object Type",
68+
"viewClass": "SelectView",
69+
"prompt": "Please select the type of object to lookup",
70+
"required": true,
71+
"order": 10,
72+
"model": "getLookupByIdObjects"
73+
}
74+
},
75+
"metadata": {
76+
"in": "src/schemas/metadata/lookupObjectById/in.json",
77+
"out": "src/schemas/metadata/lookupObjectById/out.json"
78+
}
79+
},
3680
"makeRawRequest": {
3781
"main": "./src/actions/rawRequest.js",
3882
"title": "Make Raw Request",

package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@
55
"scripts": {
66
"audit": "better-npm-audit audit --level high --production",
77
"lint": "eslint --ext .ts --quiet --fix",
8-
"pretest": "eslint --ext .ts --quiet --fix && find src spec spec-integration -name \\\"*.js\\\" -type f -delete && rm -f verifyCredentials.js",
8+
"pretest": "eslint --ext .ts --quiet --fix && find src spec -name \\\"*.js\\\" -type f -delete && rm -f verifyCredentials.js",
99
"test": "mocha --require ts-node/register \"spec/**/*test.ts\"",
10-
"integrationTest": "mocha --require ts-node/register --timeout 50000 \"spec-integration/**/*test.ts\" \"spec-integration/verifyCredentials.test.ts\"",
11-
"dev:test": "find src spec spec-integration -name \\\"*.js\\\" -type f -delete && rm -f verifyCredentials.js && tsc && npm run test",
12-
"dev:integrationTest": "env LOG_LEVEL=debug find src spec spec-integration -name \\\"*.js\\\" -type f -delete && rm -f verifyCredentials.js && tsc && npm run integrationTest",
10+
"dev:test": "find src spec -name \\\"*.js\\\" -type f -delete && rm -f verifyCredentials.js && tsc && npm run test",
1311
"posttest": "tsc"
1412
},
1513
"repository": {

spec-integration/actions/rawRequest.test.ts

Lines changed: 0 additions & 16 deletions
This file was deleted.

spec-integration/common.ts

Lines changed: 0 additions & 40 deletions
This file was deleted.

spec/actions/deleteObjectById.test.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import sinon from 'sinon';
2+
import chai, { expect } from 'chai';
3+
import { getContext, StatusCodeError } from '../common';
4+
import Client from '../../src/Client';
5+
import { processAction } from '../../src/actions/deleteObjectById';
6+
7+
const fakeResponse: any = {
8+
data: {},
9+
status: 200,
10+
headers: {},
11+
};
12+
13+
chai.use(require('chai-as-promised'));
14+
15+
describe('"Delete Object by ID" action', async () => {
16+
let execRequest;
17+
describe('One contact found', async () => {
18+
beforeEach(() => {
19+
execRequest = sinon.stub(Client.prototype, 'apiRequest').callsFake(async () => fakeResponse);
20+
});
21+
afterEach(() => {
22+
sinon.restore();
23+
});
24+
it('should successfully delete contact', async () => {
25+
const cfg = {
26+
objectType: 'task'
27+
};
28+
const msg = {
29+
body: { idValue: 'abc123' },
30+
};
31+
const { body } = await processAction.call(getContext(), msg, cfg);
32+
expect(execRequest.callCount).to.equal(1);
33+
expect(body).to.deep.equal({ id: msg.body.idValue });
34+
});
35+
});
36+
});

spec/actions/lookupObjectById.test.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import sinon from 'sinon';
2+
import chai, { expect } from 'chai';
3+
import { getContext, StatusCodeError } from '../common';
4+
import Client from '../../src/Client';
5+
import { processAction } from '../../src/actions/lookupObjectById';
6+
import task from '../resources/task.json';
7+
8+
const fakeResponse: any = {
9+
data: task,
10+
status: 200,
11+
headers: {},
12+
};
13+
14+
chai.use(require('chai-as-promised'));
15+
16+
describe('"Lookup Object by ID" action', async () => {
17+
let execRequest;
18+
describe('One contact found', async () => {
19+
beforeEach(() => {
20+
execRequest = sinon.stub(Client.prototype, 'apiRequest').callsFake(async () => fakeResponse);
21+
});
22+
afterEach(() => {
23+
sinon.restore();
24+
});
25+
it('should successfully emit contact', async () => {
26+
const cfg = {
27+
objectType: 'task'
28+
};
29+
const msg = {
30+
body: { idValue: '300975023' },
31+
};
32+
const { body } = await processAction.call(getContext(), msg, cfg);
33+
expect(execRequest.callCount).to.equal(1);
34+
expect(body).to.deep.equal(task);
35+
});
36+
});
37+
});

0 commit comments

Comments
 (0)