@respond-io/n8n-nodes-respond-io 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/nodes/Respondio/classMethods/loadOptions.js +0 -1
- package/dist/nodes/Respondio/classMethods/loadOptions.js.map +1 -1
- package/dist/nodes/Respondio/handlers/channels/index.d.ts +4 -5
- package/dist/nodes/Respondio/handlers/channels/index.js +11 -4
- package/dist/nodes/Respondio/handlers/channels/index.js.map +1 -1
- package/dist/nodes/Respondio/handlers/closing_notes/index.d.ts +4 -5
- package/dist/nodes/Respondio/handlers/closing_notes/index.js +11 -4
- package/dist/nodes/Respondio/handlers/closing_notes/index.js.map +1 -1
- package/dist/nodes/Respondio/handlers/comments/index.d.ts +3 -1
- package/dist/nodes/Respondio/handlers/comments/index.js +20 -16
- package/dist/nodes/Respondio/handlers/comments/index.js.map +1 -1
- package/dist/nodes/Respondio/handlers/contact_fields/index.d.ts +3 -1
- package/dist/nodes/Respondio/handlers/contact_fields/index.js +60 -35
- package/dist/nodes/Respondio/handlers/contact_fields/index.js.map +1 -1
- package/dist/nodes/Respondio/handlers/contacts/index.d.ts +3 -1
- package/dist/nodes/Respondio/handlers/contacts/index.js +95 -83
- package/dist/nodes/Respondio/handlers/contacts/index.js.map +1 -1
- package/dist/nodes/Respondio/handlers/conversations/index.d.ts +3 -1
- package/dist/nodes/Respondio/handlers/conversations/index.js +31 -22
- package/dist/nodes/Respondio/handlers/conversations/index.js.map +1 -1
- package/dist/nodes/Respondio/handlers/index.d.ts +10 -14
- package/dist/nodes/Respondio/handlers/lifecycles/index.d.ts +3 -1
- package/dist/nodes/Respondio/handlers/lifecycles/index.js +26 -17
- package/dist/nodes/Respondio/handlers/lifecycles/index.js.map +1 -1
- package/dist/nodes/Respondio/handlers/messages/index.d.ts +3 -1
- package/dist/nodes/Respondio/handlers/messages/index.js +58 -39
- package/dist/nodes/Respondio/handlers/messages/index.js.map +1 -1
- package/dist/nodes/Respondio/handlers/tags/index.d.ts +3 -1
- package/dist/nodes/Respondio/handlers/tags/index.js +26 -20
- package/dist/nodes/Respondio/handlers/tags/index.js.map +1 -1
- package/dist/nodes/Respondio/handlers/users/index.d.ts +3 -1
- package/dist/nodes/Respondio/handlers/users/index.js +37 -16
- package/dist/nodes/Respondio/handlers/users/index.js.map +1 -1
- package/dist/nodes/Respondio/types/index.d.ts +5 -0
- package/dist/nodes/Respondio/types/index.js.map +1 -1
- package/dist/nodes/Respondio/utils/index.d.ts +2 -3
- package/dist/nodes/Respondio/utils/index.js +7 -9
- package/dist/nodes/Respondio/utils/index.js.map +1 -1
- package/dist/nodes/Respondio/v1/RespondioTriggerV1.node.js +3 -3
- package/dist/nodes/Respondio/v1/RespondioTriggerV1.node.js.map +1 -1
- package/dist/nodes/Respondio/v1/RespondioV1.node.js.map +1 -1
- package/dist/package.json +2 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadOptions.js","sourceRoot":"","sources":["../../../../nodes/Respondio/classMethods/loadOptions.ts"],"names":[],"mappings":";;AAYA,
|
|
1
|
+
{"version":3,"file":"loadOptions.js","sourceRoot":"","sources":["../../../../nodes/Respondio/classMethods/loadOptions.ts"],"names":[],"mappings":";;AAYA,8CAsBC;AAED,sCAYC;AAED,0CAaC;AAED,4CAaC;AAED,oDAEC;AAED,4EAWC;AAED,8DAsCC;AAED,4CAoCC;AAED,0CAmBC;AAjMD,oCAA6I;AAS7I,4CAAgF;AAEzE,KAAK,UAAU,iBAAiB;IACrC,MAAM,UAAU,GAAG,IAAA,2BAAmB,EAAC,IAAI,CAAC,CAAC;IAE7C,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAgB,EAAqB,IAAI,EAAE;YAChE,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,YAAY,UAAU,EAAE;SAC/B,CAAC,CAAA;QAEF,OAAO,QAA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AU,eAAe;IACnC,MAAM,SAAS,GAAG,IAAI,CAAC,gBAAgB,CACrC,kBAAkB,EAClB,4BAAgB,CAAC,oBAAoB,CAAC,KAAK,CAClC,CAAC;IAEZ,IAAI,MAAM,GAAG,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;IAEvC,IAAI,SAAS,KAAK,4BAAgB,CAAC,mBAAmB,CAAC,KAAK,EAAE,CAAC;QAC7D,MAAM,CAAC,IAAI,CAAC,GAAG,0CAA8B,CAAC,mBAAmB,CAAC,CAAC;IACrE,CAAC;IACD,IAAI,SAAS,KAAK,4BAAgB,CAAC,mBAAmB,CAAC,KAAK,EAAE,CAAC;QAC7D,MAAM,CAAC,IAAI,CAAC,GAAG,0CAA8B,CAAC,mBAAmB,CAAC,CAAC;IACrE,CAAC;IACD,IAAI,SAAS,KAAK,4BAAgB,CAAC,oBAAoB,CAAC,KAAK,EAAE,CAAC;QAC9D,MAAM,CAAC,IAAI,CAAC,GAAG,0CAA8B,CAAC,oBAAoB,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { IExecuteFunctions } from "n8n-workflow";
|
|
1
|
+
import { IExecuteFunctions, INodeExecutionData } from "n8n-workflow";
|
|
2
2
|
import { ACTION_NAMES } from "../../constants/actions/action_names";
|
|
3
|
-
|
|
3
|
+
declare const ALLOWED_CHANNEL_ACTIONS: readonly [ACTION_NAMES.GET_ALL_CHANNELS];
|
|
4
|
+
type VALID_CHANNEL_ACTIONS = typeof ALLOWED_CHANNEL_ACTIONS[number];
|
|
4
5
|
declare const _default: {
|
|
5
|
-
execute: (action:
|
|
6
|
-
json: Channel;
|
|
7
|
-
}[][]>;
|
|
6
|
+
execute: (action: VALID_CHANNEL_ACTIONS, executionContext: IExecuteFunctions) => Promise<INodeExecutionData[][]>;
|
|
8
7
|
};
|
|
9
8
|
export default _default;
|
|
@@ -2,18 +2,25 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const action_names_1 = require("../../constants/actions/action_names");
|
|
4
4
|
const utils_1 = require("../../utils");
|
|
5
|
+
const ALLOWED_CHANNEL_ACTIONS = [
|
|
6
|
+
action_names_1.ACTION_NAMES.GET_ALL_CHANNELS,
|
|
7
|
+
];
|
|
5
8
|
const execute = async (action, executionContext) => {
|
|
6
|
-
if (action
|
|
9
|
+
if (!ALLOWED_CHANNEL_ACTIONS.includes(action))
|
|
7
10
|
return [];
|
|
8
|
-
const
|
|
11
|
+
const results = [];
|
|
12
|
+
const limit = executionContext.getNodeParameter('limit', 0, 10);
|
|
9
13
|
const { raw } = await (0, utils_1.fetchPaginatedOptions)(executionContext, 'respondIoApi', '/space/channel', undefined, {
|
|
10
14
|
maxResults: limit,
|
|
11
15
|
includeRaw: true,
|
|
12
16
|
limit: 20,
|
|
13
17
|
includeTransformed: false
|
|
14
18
|
});
|
|
15
|
-
|
|
16
|
-
|
|
19
|
+
results.push(...raw.map(d => ({
|
|
20
|
+
json: d,
|
|
21
|
+
pairedItem: { item: 0 },
|
|
22
|
+
})));
|
|
23
|
+
return [results];
|
|
17
24
|
};
|
|
18
25
|
exports.default = { execute };
|
|
19
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/Respondio/handlers/channels/index.ts"],"names":[],"mappings":";;AACA,uEAAoE;AACpE,uCAAoD;AAGpD,MAAM,OAAO,GAAG,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/Respondio/handlers/channels/index.ts"],"names":[],"mappings":";;AACA,uEAAoE;AACpE,uCAAoD;AAGpD,MAAM,uBAAuB,GAAG;IAC9B,2BAAY,CAAC,gBAAgB;CACrB,CAAC;AAIX,MAAM,OAAO,GAAG,KAAK,EAAE,MAA6B,EAAE,gBAAmC,EAAE,EAAE;IAC3F,IAAI,CAAC,uBAAuB,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,EAAE,CAAA;IAExD,MAAM,OAAO,GAAyB,EAAE,CAAC;IAEzC,MAAM,KAAK,GAAG,gBAAgB,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE,CAAW,CAAC;IAE1E,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,IAAA,6BAAqB,EACzC,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,SAAS,EACT;QACE,UAAU,EAAE,KAAK;QACjB,UAAU,EAAE,IAAI;QAChB,KAAK,EAAE,EAAE;QACT,kBAAkB,EAAE,KAAK;KAC1B,CACF,CAAA;IAED,OAAO,CAAC,IAAI,CACV,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACf,IAAI,EAAE,CAAC;QACP,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;KACxB,CAAC,CAAC,CACJ,CAAC;IAEF,OAAO,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC,CAAA;AAED,kBAAe,EAAE,OAAO,EAAE,CAAA"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { IExecuteFunctions } from "n8n-workflow";
|
|
1
|
+
import { IExecuteFunctions, INodeExecutionData } from "n8n-workflow";
|
|
2
2
|
import { ACTION_NAMES } from "../../constants/actions/action_names";
|
|
3
|
-
|
|
3
|
+
declare const ALLOWED_CLOSING_NOTE_ACTIONS: readonly [ACTION_NAMES.GET_ALL_CLOSING_NOTES];
|
|
4
|
+
type VALID_CLOSING_NOTES_ACTIONS = typeof ALLOWED_CLOSING_NOTE_ACTIONS[number];
|
|
4
5
|
declare const _default: {
|
|
5
|
-
execute: (action:
|
|
6
|
-
json: ClosingNote;
|
|
7
|
-
}[][]>;
|
|
6
|
+
execute: (action: VALID_CLOSING_NOTES_ACTIONS, executionContext: IExecuteFunctions) => Promise<INodeExecutionData[][]>;
|
|
8
7
|
};
|
|
9
8
|
export default _default;
|
|
@@ -2,18 +2,25 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const action_names_1 = require("../../constants/actions/action_names");
|
|
4
4
|
const utils_1 = require("../../utils");
|
|
5
|
+
const ALLOWED_CLOSING_NOTE_ACTIONS = [
|
|
6
|
+
action_names_1.ACTION_NAMES.GET_ALL_CLOSING_NOTES,
|
|
7
|
+
];
|
|
5
8
|
const execute = async (action, executionContext) => {
|
|
6
|
-
if (action
|
|
9
|
+
if (!ALLOWED_CLOSING_NOTE_ACTIONS.includes(action))
|
|
7
10
|
return [];
|
|
8
|
-
const
|
|
11
|
+
const results = [];
|
|
12
|
+
const limit = executionContext.getNodeParameter('limit', 0, 10);
|
|
9
13
|
const { raw } = await (0, utils_1.fetchPaginatedOptions)(executionContext, 'respondIoApi', '/space/closing_notes', undefined, {
|
|
10
14
|
maxResults: limit,
|
|
11
15
|
includeRaw: true,
|
|
12
16
|
limit: 20,
|
|
13
17
|
includeTransformed: false
|
|
14
18
|
});
|
|
15
|
-
|
|
16
|
-
|
|
19
|
+
results.push(...raw.map(d => ({
|
|
20
|
+
json: d,
|
|
21
|
+
pairedItem: { item: 0 },
|
|
22
|
+
})));
|
|
23
|
+
return [results];
|
|
17
24
|
};
|
|
18
25
|
exports.default = { execute };
|
|
19
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/Respondio/handlers/closing_notes/index.ts"],"names":[],"mappings":";;AACA,uEAAoE;AACpE,uCAAoD;AAGpD,MAAM,OAAO,GAAG,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/Respondio/handlers/closing_notes/index.ts"],"names":[],"mappings":";;AACA,uEAAoE;AACpE,uCAAoD;AAGpD,MAAM,4BAA4B,GAAG;IACnC,2BAAY,CAAC,qBAAqB;CAC1B,CAAC;AAIX,MAAM,OAAO,GAAG,KAAK,EAAE,MAAmC,EAAE,gBAAmC,EAAE,EAAE;IACjG,IAAI,CAAC,4BAA4B,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,EAAE,CAAA;IAC7D,MAAM,OAAO,GAAyB,EAAE,CAAC;IAEzC,MAAM,KAAK,GAAG,gBAAgB,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE,CAAW,CAAC;IAE1E,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,IAAA,6BAAqB,EACzC,gBAAgB,EAChB,cAAc,EACd,sBAAsB,EACtB,SAAS,EACT;QACE,UAAU,EAAE,KAAK;QACjB,UAAU,EAAE,IAAI;QAChB,KAAK,EAAE,EAAE;QACT,kBAAkB,EAAE,KAAK;KAC1B,CACF,CAAA;IAED,OAAO,CAAC,IAAI,CACV,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACf,IAAI,EAAE,CAAC;QACP,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;KACxB,CAAC,CAAC,CACJ,CAAC;IAEF,OAAO,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC,CAAA;AAED,kBAAe,EAAE,OAAO,EAAE,CAAA"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { IExecuteFunctions, INodeExecutionData, NodeExecutionWithMetadata } from "n8n-workflow";
|
|
2
2
|
import { ACTION_NAMES } from "../../constants/actions/action_names";
|
|
3
|
+
declare const ALLOWED_COMMENT_ACTIONS: readonly [ACTION_NAMES.ADD_COMMENT];
|
|
4
|
+
type VALID_COMMENT_ACTIONS = typeof ALLOWED_COMMENT_ACTIONS[number];
|
|
3
5
|
declare const _default: {
|
|
4
|
-
execute: (action:
|
|
6
|
+
execute: (action: VALID_COMMENT_ACTIONS, executionContext: IExecuteFunctions) => Promise<INodeExecutionData[][] | NodeExecutionWithMetadata[][] | null>;
|
|
5
7
|
};
|
|
6
8
|
export default _default;
|
|
@@ -3,25 +3,29 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const n8n_workflow_1 = require("n8n-workflow");
|
|
4
4
|
const action_names_1 = require("../../constants/actions/action_names");
|
|
5
5
|
const utils_1 = require("../../utils");
|
|
6
|
+
const ALLOWED_COMMENT_ACTIONS = [
|
|
7
|
+
action_names_1.ACTION_NAMES.ADD_COMMENT,
|
|
8
|
+
];
|
|
6
9
|
const execute = async (action, executionContext) => {
|
|
7
|
-
if (action
|
|
10
|
+
if (!ALLOWED_COMMENT_ACTIONS.includes(action))
|
|
8
11
|
return [];
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
const items = executionContext.getInputData();
|
|
13
|
+
const results = [];
|
|
14
|
+
for (let i = 0; i < items.length; i++) {
|
|
15
|
+
const identifier = (0, utils_1.constructIdentifier)(executionContext, i);
|
|
16
|
+
const commentContent = executionContext.getNodeParameter('comment', i, '');
|
|
17
|
+
if (!commentContent) {
|
|
18
|
+
const error = new n8n_workflow_1.NodeOperationError(executionContext.getNode(), 'Comment content is required');
|
|
19
|
+
results.push({ json: {}, error, pairedItem: { item: i } });
|
|
20
|
+
}
|
|
21
|
+
const response = await (0, utils_1.callDeveloperApi)(executionContext, {
|
|
22
|
+
method: 'POST',
|
|
23
|
+
path: `/contact/${identifier}/comment`,
|
|
24
|
+
body: { text: commentContent },
|
|
25
|
+
});
|
|
26
|
+
results.push({ json: response, pairedItem: { item: i } });
|
|
18
27
|
}
|
|
19
|
-
|
|
20
|
-
method: 'POST',
|
|
21
|
-
path: `/contact/${identifier}/comment`,
|
|
22
|
-
body: { text: commentContent },
|
|
23
|
-
});
|
|
24
|
-
return [[{ json: response }]];
|
|
28
|
+
return [results];
|
|
25
29
|
};
|
|
26
30
|
exports.default = { execute };
|
|
27
31
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/Respondio/handlers/comments/index.ts"],"names":[],"mappings":";;AAAA,+CAAoH;AACpH,uEAAoE;AACpE,uCAAoE;AAGpE,MAAM,OAAO,GAAG,KAAK,EACnB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/Respondio/handlers/comments/index.ts"],"names":[],"mappings":";;AAAA,+CAAoH;AACpH,uEAAoE;AACpE,uCAAoE;AAGpE,MAAM,uBAAuB,GAAG;IAC9B,2BAAY,CAAC,WAAW;CAChB,CAAC;AAIX,MAAM,OAAO,GAAG,KAAK,EACnB,MAA6B,EAC7B,gBAAmC,EACqC,EAAE;IAC1E,IAAI,CAAC,uBAAuB,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,EAAE,CAAA;IACxD,MAAM,KAAK,GAAG,gBAAgB,CAAC,YAAY,EAAE,CAAC;IAC9C,MAAM,OAAO,GAAyB,EAAE,CAAC;IAEzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,UAAU,GAAG,IAAA,2BAAmB,EAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC;QAC5D,MAAM,cAAc,GAAG,gBAAgB,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC,EAAE,EAAE,CAAW,CAAC;QAErF,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,MAAM,KAAK,GAAG,IAAI,iCAAkB,CAAC,gBAAgB,CAAC,OAAO,EAAE,EAAE,6BAA6B,CAAC,CAAC;YAEhG,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QAC7D,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAgB,EAAwB,gBAAgB,EAAE;YAC/E,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,YAAY,UAAU,UAAU;YACtC,IAAI,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE;SAC/B,CAAC,CAAA;QAEF,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IAC5D,CAAC;IAED,OAAO,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC,CAAA;AAED,kBAAe,EAAE,OAAO,EAAE,CAAA"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { IExecuteFunctions, INodeExecutionData, NodeExecutionWithMetadata } from "n8n-workflow";
|
|
2
2
|
import { ACTION_NAMES } from "../../constants/actions/action_names";
|
|
3
|
+
declare const ALLOWED_CONTACT_FIELD_ACTIONS: readonly [ACTION_NAMES.GET_ALL_CUSTOM_FIELDS, ACTION_NAMES.FIND_CUSTOM_FIELD, ACTION_NAMES.CREATE_CUSTOM_FIELD];
|
|
4
|
+
type VALID_CONTACT_FIELD_ACTIONS = typeof ALLOWED_CONTACT_FIELD_ACTIONS[number];
|
|
3
5
|
declare const _default: {
|
|
4
|
-
execute: (action:
|
|
6
|
+
execute: (action: VALID_CONTACT_FIELD_ACTIONS, executionContext: IExecuteFunctions) => Promise<INodeExecutionData[][] | NodeExecutionWithMetadata[][] | null>;
|
|
5
7
|
};
|
|
6
8
|
export default _default;
|
|
@@ -2,51 +2,76 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const action_names_1 = require("../../constants/actions/action_names");
|
|
4
4
|
const utils_1 = require("../../utils");
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
action_names_1.ACTION_NAMES.FIND_CUSTOM_FIELD,
|
|
9
|
-
action_names_1.ACTION_NAMES.CREATE_CUSTOM_FIELD,
|
|
10
|
-
];
|
|
11
|
-
if (!allowedActions.includes(action))
|
|
12
|
-
return [];
|
|
13
|
-
if (action === action_names_1.ACTION_NAMES.GET_ALL_CUSTOM_FIELDS) {
|
|
14
|
-
const limit = executionContext.getNodeParameter('limit', 0, 10);
|
|
5
|
+
const actionHandlers = {
|
|
6
|
+
[action_names_1.ACTION_NAMES.GET_ALL_CUSTOM_FIELDS]: async (executionContext, itemIndex) => {
|
|
7
|
+
const limit = executionContext.getNodeParameter('limit', itemIndex, 10);
|
|
15
8
|
const { raw } = await (0, utils_1.fetchPaginatedOptions)(executionContext, 'respondIoApi', '/space/custom_field', undefined, {
|
|
16
9
|
maxResults: limit,
|
|
17
10
|
includeRaw: true,
|
|
18
11
|
limit: 20,
|
|
19
12
|
includeTransformed: false
|
|
20
13
|
});
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const response = await (0, utils_1.callDeveloperApi)(executionContext, {
|
|
14
|
+
return raw;
|
|
15
|
+
},
|
|
16
|
+
[action_names_1.ACTION_NAMES.FIND_CUSTOM_FIELD]: async (executionContext, itemIndex) => {
|
|
17
|
+
const customFieldId = executionContext.getNodeParameter('customFieldId', itemIndex, undefined);
|
|
18
|
+
return (0, utils_1.callDeveloperApi)(executionContext, {
|
|
27
19
|
method: 'GET',
|
|
28
20
|
path: `/space/custom_field/${customFieldId}`,
|
|
29
21
|
});
|
|
30
|
-
|
|
22
|
+
},
|
|
23
|
+
[action_names_1.ACTION_NAMES.CREATE_CUSTOM_FIELD]: async (executionContext, itemIndex) => {
|
|
24
|
+
const name = executionContext.getNodeParameter('name', itemIndex, '');
|
|
25
|
+
const description = executionContext.getNodeParameter('description', itemIndex, '');
|
|
26
|
+
const slug = executionContext.getNodeParameter('slug', itemIndex, '');
|
|
27
|
+
const dataType = executionContext.getNodeParameter('dataType', itemIndex, 'text');
|
|
28
|
+
const allowedValues = executionContext.getNodeParameter('allowedValues', itemIndex, []);
|
|
29
|
+
const payload = {
|
|
30
|
+
name,
|
|
31
|
+
description,
|
|
32
|
+
dataType,
|
|
33
|
+
allowedValues,
|
|
34
|
+
slug
|
|
35
|
+
};
|
|
36
|
+
return (0, utils_1.callDeveloperApi)(executionContext, {
|
|
37
|
+
method: 'POST',
|
|
38
|
+
path: `/space/custom_field`,
|
|
39
|
+
body: payload
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
const ALLOWED_CONTACT_FIELD_ACTIONS = [
|
|
44
|
+
action_names_1.ACTION_NAMES.GET_ALL_CUSTOM_FIELDS,
|
|
45
|
+
action_names_1.ACTION_NAMES.FIND_CUSTOM_FIELD,
|
|
46
|
+
action_names_1.ACTION_NAMES.CREATE_CUSTOM_FIELD,
|
|
47
|
+
];
|
|
48
|
+
const execute = async (action, executionContext) => {
|
|
49
|
+
if (!ALLOWED_CONTACT_FIELD_ACTIONS.includes(action))
|
|
50
|
+
return [];
|
|
51
|
+
const items = executionContext.getInputData();
|
|
52
|
+
const results = [];
|
|
53
|
+
const handler = actionHandlers[action];
|
|
54
|
+
if (!handler)
|
|
55
|
+
return [[{ json: { message: 'No action executed' }, pairedItem: 0 }]];
|
|
56
|
+
const isSingularAction = [
|
|
57
|
+
action_names_1.ACTION_NAMES.GET_ALL_CUSTOM_FIELDS,
|
|
58
|
+
action_names_1.ACTION_NAMES.CREATE_CUSTOM_FIELD,
|
|
59
|
+
].includes(action);
|
|
60
|
+
for (let i = 0; i < items.length; i++) {
|
|
61
|
+
if (isSingularAction && i > 0)
|
|
62
|
+
continue;
|
|
63
|
+
const data = await handler(executionContext, i);
|
|
64
|
+
if (Array.isArray(data)) {
|
|
65
|
+
results.push(...data.map(d => ({
|
|
66
|
+
json: d,
|
|
67
|
+
pairedItem: { item: i },
|
|
68
|
+
})));
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
results.push({ json: data, pairedItem: { item: i } });
|
|
72
|
+
}
|
|
31
73
|
}
|
|
32
|
-
|
|
33
|
-
const description = executionContext.getNodeParameter('description', 0, '');
|
|
34
|
-
const slug = executionContext.getNodeParameter('slug', 0, '');
|
|
35
|
-
const dataType = executionContext.getNodeParameter('dataType', 0, 'text');
|
|
36
|
-
const allowedValues = executionContext.getNodeParameter('allowedValues', 0, []);
|
|
37
|
-
const payload = {
|
|
38
|
-
name,
|
|
39
|
-
description,
|
|
40
|
-
dataType,
|
|
41
|
-
allowedValues,
|
|
42
|
-
slug
|
|
43
|
-
};
|
|
44
|
-
const response = await (0, utils_1.callDeveloperApi)(executionContext, {
|
|
45
|
-
method: 'POST',
|
|
46
|
-
path: `/space/custom_field`,
|
|
47
|
-
body: payload
|
|
48
|
-
});
|
|
49
|
-
return [[{ json: response }]];
|
|
74
|
+
return [results];
|
|
50
75
|
};
|
|
51
76
|
exports.default = { execute };
|
|
52
77
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/Respondio/handlers/contact_fields/index.ts"],"names":[],"mappings":";;AACA,uEAAoE;AACpE,uCAAsE;AAGtE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/Respondio/handlers/contact_fields/index.ts"],"names":[],"mappings":";;AACA,uEAAoE;AACpE,uCAAsE;AAGtE,MAAM,cAAc,GAAG;IACrB,CAAC,2BAAY,CAAC,qBAAqB,CAAC,EAAE,KAAK,EAAE,gBAAmC,EAAE,SAAiB,EAAE,EAAE;QACrG,MAAM,KAAK,GAAG,gBAAgB,CAAC,gBAAgB,CAAC,OAAO,EAAE,SAAS,EAAE,EAAE,CAAW,CAAC;QAElF,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,IAAA,6BAAqB,EACzC,gBAAgB,EAChB,cAAc,EACd,qBAAqB,EACrB,SAAS,EACT;YACE,UAAU,EAAE,KAAK;YACjB,UAA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AM,CAAC;YACN,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QACxD,CAAC;IACH,CAAC;IAED,OAAO,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC,CAAA;AAED,kBAAe,EAAE,OAAO,EAAE,CAAA"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { IExecuteFunctions, INodeExecutionData, NodeExecutionWithMetadata } from "n8n-workflow";
|
|
2
2
|
import { ACTION_NAMES } from "../../constants/actions/action_names";
|
|
3
|
+
declare const ALLOWED_CONTACT_ACTIONS: readonly [ACTION_NAMES.REMOVE_TAGS, ACTION_NAMES.DELETE_CONTACT, ACTION_NAMES.FIND_CONTACT_CHANNELS, ACTION_NAMES.FIND_CONTACT, ACTION_NAMES.ADD_TAGS, ACTION_NAMES.GET_MANY_CONTACTS, ACTION_NAMES.UPDATE_CONTACT, ACTION_NAMES.CREATE_OR_UPDATE_CONTACT, ACTION_NAMES.CREATE_CONTACT];
|
|
4
|
+
type VALID_CONTACT_ACTIONS = typeof ALLOWED_CONTACT_ACTIONS[number];
|
|
3
5
|
declare const _default: {
|
|
4
|
-
execute: (action:
|
|
6
|
+
execute: (action: VALID_CONTACT_ACTIONS, executionContext: IExecuteFunctions) => Promise<INodeExecutionData[][] | NodeExecutionWithMetadata[][] | null>;
|
|
5
7
|
};
|
|
6
8
|
export default _default;
|
|
@@ -2,72 +2,52 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const action_names_1 = require("../../constants/actions/action_names");
|
|
4
4
|
const utils_1 = require("../../utils");
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
action_names_1.ACTION_NAMES.REMOVE_TAGS,
|
|
11
|
-
action_names_1.ACTION_NAMES.DELETE_CONTACT,
|
|
12
|
-
action_names_1.ACTION_NAMES.FIND_CONTACT_CHANNELS,
|
|
13
|
-
action_names_1.ACTION_NAMES.FIND_CONTACT,
|
|
14
|
-
action_names_1.ACTION_NAMES.ADD_TAGS,
|
|
15
|
-
action_names_1.ACTION_NAMES.GET_MANY_CONTACTS,
|
|
16
|
-
action_names_1.ACTION_NAMES.UPDATE_CONTACT,
|
|
17
|
-
action_names_1.ACTION_NAMES.CREATE_OR_UPDATE_CONTACT,
|
|
18
|
-
action_names_1.ACTION_NAMES.CREATE_CONTACT,
|
|
19
|
-
];
|
|
20
|
-
if (!allowedActions.includes(action))
|
|
21
|
-
return [];
|
|
22
|
-
if (action === action_names_1.ACTION_NAMES.REMOVE_TAGS) {
|
|
23
|
-
const identifier = (0, utils_1.constructIdentifier)(executionContext);
|
|
24
|
-
const tags = executionContext.getNodeParameter('tagIds', 0, []);
|
|
25
|
-
const response = await (0, utils_1.callDeveloperApi)(executionContext, {
|
|
5
|
+
const actionHandlers = {
|
|
6
|
+
[action_names_1.ACTION_NAMES.REMOVE_TAGS]: async (executionContext, itemIndex) => {
|
|
7
|
+
const identifier = (0, utils_1.constructIdentifier)(executionContext, itemIndex);
|
|
8
|
+
const tags = executionContext.getNodeParameter('tagIds', itemIndex, []);
|
|
9
|
+
return (0, utils_1.callDeveloperApi)(executionContext, {
|
|
26
10
|
method: 'DELETE',
|
|
27
11
|
path: `/contact/${identifier}/tag`,
|
|
28
12
|
body: tags
|
|
29
13
|
});
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const response = await (0, utils_1.callDeveloperApi)(executionContext, {
|
|
14
|
+
},
|
|
15
|
+
[action_names_1.ACTION_NAMES.DELETE_CONTACT]: async (executionContext, itemIndex) => {
|
|
16
|
+
const identifier = (0, utils_1.constructIdentifier)(executionContext, itemIndex);
|
|
17
|
+
return (0, utils_1.callDeveloperApi)(executionContext, {
|
|
35
18
|
method: 'DELETE',
|
|
36
19
|
path: `/contact/${identifier}`,
|
|
37
20
|
});
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const identifier = (0, utils_1.constructIdentifier)(executionContext);
|
|
21
|
+
},
|
|
22
|
+
[action_names_1.ACTION_NAMES.FIND_CONTACT_CHANNELS]: async (executionContext, itemIndex) => {
|
|
23
|
+
const identifier = (0, utils_1.constructIdentifier)(executionContext, itemIndex);
|
|
42
24
|
const { raw } = await (0, utils_1.fetchPaginatedOptions)(executionContext, 'respondIoApi', `/contact/${identifier}/channels`, undefined, {
|
|
43
25
|
includeTransformed: false,
|
|
44
26
|
limit: 100,
|
|
45
27
|
includeRaw: true,
|
|
46
28
|
maxResults: Infinity,
|
|
47
29
|
});
|
|
48
|
-
return
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const identifier = (0, utils_1.constructIdentifier)(executionContext);
|
|
52
|
-
|
|
30
|
+
return raw;
|
|
31
|
+
},
|
|
32
|
+
[action_names_1.ACTION_NAMES.FIND_CONTACT]: async (executionContext, itemIndex) => {
|
|
33
|
+
const identifier = (0, utils_1.constructIdentifier)(executionContext, itemIndex);
|
|
34
|
+
return (0, utils_1.callDeveloperApi)(executionContext, {
|
|
53
35
|
method: 'GET',
|
|
54
36
|
path: `/contact/${identifier}`,
|
|
55
37
|
});
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
const response = await (0, utils_1.callDeveloperApi)(executionContext, {
|
|
38
|
+
},
|
|
39
|
+
[action_names_1.ACTION_NAMES.ADD_TAGS]: async (executionContext, itemIndex) => {
|
|
40
|
+
const identifier = (0, utils_1.constructIdentifier)(executionContext, itemIndex);
|
|
41
|
+
const tags = executionContext.getNodeParameter('tags', itemIndex, '');
|
|
42
|
+
return (0, utils_1.callDeveloperApi)(executionContext, {
|
|
62
43
|
method: 'POST',
|
|
63
44
|
path: `/contact/${identifier}/tag`,
|
|
64
45
|
body: tags
|
|
65
46
|
});
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
const limit = executionContext.getNodeParameter('limit', 0, 10);
|
|
47
|
+
},
|
|
48
|
+
[action_names_1.ACTION_NAMES.GET_MANY_CONTACTS]: async (executionContext, itemIndex) => {
|
|
49
|
+
const search = executionContext.getNodeParameter('search', itemIndex, '');
|
|
50
|
+
const limit = executionContext.getNodeParameter('limit', itemIndex, 10);
|
|
71
51
|
const response = await (0, utils_1.callDeveloperApi)(executionContext, {
|
|
72
52
|
method: 'POST',
|
|
73
53
|
path: `/contact/list?limit=${limit}`,
|
|
@@ -77,16 +57,16 @@ const execute = async (action, executionContext) => {
|
|
|
77
57
|
filter: { $or: [] }
|
|
78
58
|
}
|
|
79
59
|
});
|
|
80
|
-
return
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const identifier = (0, utils_1.constructIdentifier)(executionContext);
|
|
84
|
-
const firstName = executionContext.getNodeParameter('firstName',
|
|
85
|
-
const lastName = executionContext.getNodeParameter('lastName',
|
|
86
|
-
const language = executionContext.getNodeParameter('language',
|
|
87
|
-
const profilePic = executionContext.getNodeParameter('profilePic',
|
|
88
|
-
const countryCode = executionContext.getNodeParameter('countryCode',
|
|
89
|
-
const customFieldMapper = executionContext.getNodeParameter('customFields',
|
|
60
|
+
return response.items;
|
|
61
|
+
},
|
|
62
|
+
[action_names_1.ACTION_NAMES.UPDATE_CONTACT]: async (executionContext, itemIndex) => {
|
|
63
|
+
const identifier = (0, utils_1.constructIdentifier)(executionContext, itemIndex);
|
|
64
|
+
const firstName = executionContext.getNodeParameter('firstName', itemIndex, '');
|
|
65
|
+
const lastName = executionContext.getNodeParameter('lastName', itemIndex, '');
|
|
66
|
+
const language = executionContext.getNodeParameter('language', itemIndex, '');
|
|
67
|
+
const profilePic = executionContext.getNodeParameter('profilePic', itemIndex, '');
|
|
68
|
+
const countryCode = executionContext.getNodeParameter('countryCode', itemIndex, '');
|
|
69
|
+
const customFieldMapper = executionContext.getNodeParameter('customFields', itemIndex, []);
|
|
90
70
|
const customFields = (0, utils_1.constructCustomFieldFromResourceMapper)(customFieldMapper);
|
|
91
71
|
const payload = {
|
|
92
72
|
...(firstName && { firstName }),
|
|
@@ -96,21 +76,20 @@ const execute = async (action, executionContext) => {
|
|
|
96
76
|
...(countryCode && { countryCode }),
|
|
97
77
|
...(customFields.length && { custom_fields: customFields }),
|
|
98
78
|
};
|
|
99
|
-
|
|
79
|
+
return (0, utils_1.callDeveloperApi)(executionContext, {
|
|
100
80
|
method: 'PUT',
|
|
101
81
|
path: `/contact/${identifier}`,
|
|
102
82
|
body: payload,
|
|
103
83
|
});
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
const
|
|
108
|
-
const
|
|
109
|
-
const
|
|
110
|
-
const
|
|
111
|
-
const
|
|
112
|
-
const
|
|
113
|
-
const customFieldMapper = executionContext.getNodeParameter('customFields', 0, []);
|
|
84
|
+
},
|
|
85
|
+
[action_names_1.ACTION_NAMES.CREATE_OR_UPDATE_CONTACT]: async (executionContext, itemIndex) => {
|
|
86
|
+
const identifier = (0, utils_1.constructIdentifier)(executionContext, itemIndex);
|
|
87
|
+
const firstName = executionContext.getNodeParameter('firstName', itemIndex, '');
|
|
88
|
+
const lastName = executionContext.getNodeParameter('lastName', itemIndex, '');
|
|
89
|
+
const language = executionContext.getNodeParameter('language', itemIndex, '');
|
|
90
|
+
const profilePic = executionContext.getNodeParameter('profilePic', itemIndex, '');
|
|
91
|
+
const countryCode = executionContext.getNodeParameter('countryCode', itemIndex, '');
|
|
92
|
+
const customFieldMapper = executionContext.getNodeParameter('customFields', itemIndex, []);
|
|
114
93
|
const customFields = (0, utils_1.constructCustomFieldFromResourceMapper)(customFieldMapper);
|
|
115
94
|
const payload = {
|
|
116
95
|
...(firstName && { firstName }),
|
|
@@ -120,23 +99,22 @@ const execute = async (action, executionContext) => {
|
|
|
120
99
|
...(countryCode && { countryCode }),
|
|
121
100
|
...(customFields.length && { custom_fields: customFields }),
|
|
122
101
|
};
|
|
123
|
-
|
|
102
|
+
return (0, utils_1.callDeveloperApi)(executionContext, {
|
|
124
103
|
method: 'POST',
|
|
125
104
|
path: `/contact/create_or_update/${identifier}`,
|
|
126
105
|
body: payload,
|
|
127
106
|
});
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
const
|
|
132
|
-
const
|
|
133
|
-
const
|
|
134
|
-
const
|
|
135
|
-
const
|
|
136
|
-
const
|
|
137
|
-
const
|
|
138
|
-
const
|
|
139
|
-
const customFieldMapper = executionContext.getNodeParameter('customFields', 0, []);
|
|
107
|
+
},
|
|
108
|
+
[action_names_1.ACTION_NAMES.CREATE_CONTACT]: async (executionContext, itemIndex) => {
|
|
109
|
+
const identifier = (0, utils_1.constructIdentifier)(executionContext, itemIndex);
|
|
110
|
+
const firstName = executionContext.getNodeParameter('firstName', itemIndex, '');
|
|
111
|
+
const lastName = executionContext.getNodeParameter('lastName', itemIndex, '');
|
|
112
|
+
const language = executionContext.getNodeParameter('language', itemIndex, '');
|
|
113
|
+
const profilePic = executionContext.getNodeParameter('profilePic', itemIndex, '');
|
|
114
|
+
const countryCode = executionContext.getNodeParameter('countryCode', itemIndex, '');
|
|
115
|
+
const email = executionContext.getNodeParameter('email', itemIndex, '');
|
|
116
|
+
const phone = executionContext.getNodeParameter('phone', itemIndex, '');
|
|
117
|
+
const customFieldMapper = executionContext.getNodeParameter('customFields', itemIndex, []);
|
|
140
118
|
const customFields = (0, utils_1.constructCustomFieldFromResourceMapper)(customFieldMapper);
|
|
141
119
|
const payload = {
|
|
142
120
|
...(firstName && { firstName }),
|
|
@@ -150,14 +128,48 @@ const execute = async (action, executionContext) => {
|
|
|
150
128
|
payload.email = email;
|
|
151
129
|
if (phone.length)
|
|
152
130
|
payload.phone = phone;
|
|
153
|
-
|
|
131
|
+
return (0, utils_1.callDeveloperApi)(executionContext, {
|
|
154
132
|
method: 'POST',
|
|
155
133
|
path: `/contact/${identifier}`,
|
|
156
134
|
body: payload,
|
|
157
135
|
});
|
|
158
|
-
return [[{ json: response }]];
|
|
159
136
|
}
|
|
160
|
-
|
|
137
|
+
};
|
|
138
|
+
const ALLOWED_CONTACT_ACTIONS = [
|
|
139
|
+
action_names_1.ACTION_NAMES.REMOVE_TAGS,
|
|
140
|
+
action_names_1.ACTION_NAMES.DELETE_CONTACT,
|
|
141
|
+
action_names_1.ACTION_NAMES.FIND_CONTACT_CHANNELS,
|
|
142
|
+
action_names_1.ACTION_NAMES.FIND_CONTACT,
|
|
143
|
+
action_names_1.ACTION_NAMES.ADD_TAGS,
|
|
144
|
+
action_names_1.ACTION_NAMES.GET_MANY_CONTACTS,
|
|
145
|
+
action_names_1.ACTION_NAMES.UPDATE_CONTACT,
|
|
146
|
+
action_names_1.ACTION_NAMES.CREATE_OR_UPDATE_CONTACT,
|
|
147
|
+
action_names_1.ACTION_NAMES.CREATE_CONTACT,
|
|
148
|
+
];
|
|
149
|
+
const execute = async (action, executionContext) => {
|
|
150
|
+
if (!ALLOWED_CONTACT_ACTIONS.includes(action))
|
|
151
|
+
return [];
|
|
152
|
+
const items = executionContext.getInputData();
|
|
153
|
+
const results = [];
|
|
154
|
+
const handler = actionHandlers[action];
|
|
155
|
+
if (!handler)
|
|
156
|
+
return [[{ json: { message: 'No action executed' }, pairedItem: 0 }]];
|
|
157
|
+
const isSingularAction = action === action_names_1.ACTION_NAMES.GET_MANY_CONTACTS;
|
|
158
|
+
for (let i = 0; i < items.length; i++) {
|
|
159
|
+
if (isSingularAction && i > 0)
|
|
160
|
+
continue;
|
|
161
|
+
const data = await handler(executionContext, i);
|
|
162
|
+
if (Array.isArray(data)) {
|
|
163
|
+
results.push(...data.map(d => ({
|
|
164
|
+
json: d,
|
|
165
|
+
pairedItem: { item: i },
|
|
166
|
+
})));
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
results.push({ json: data, pairedItem: { item: i } });
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return [results];
|
|
161
173
|
};
|
|
162
174
|
exports.default = { execute };
|
|
163
175
|
//# sourceMappingURL=index.js.map
|