n8n-nodes-smartsuite 2.0.6
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/LICENSE +21 -0
- package/README.md +163 -0
- package/dist/credentials/SmartSuiteApi.credentials.d.ts +8 -0
- package/dist/credentials/SmartSuiteApi.credentials.js +38 -0
- package/dist/credentials/SmartSuiteApi.credentials.js.map +1 -0
- package/dist/credentials/SmartSuiteApi.svg +6 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/nodes/SmartSuite/SmartSuite.node.d.ts +27 -0
- package/dist/nodes/SmartSuite/SmartSuite.node.js +108 -0
- package/dist/nodes/SmartSuite/SmartSuite.node.js.map +1 -0
- package/dist/nodes/SmartSuite/SmartSuite.node.json +48 -0
- package/dist/nodes/SmartSuite/SmartSuiteTrigger.node.d.ts +23 -0
- package/dist/nodes/SmartSuite/SmartSuiteTrigger.node.js +173 -0
- package/dist/nodes/SmartSuite/SmartSuiteTrigger.node.js.map +1 -0
- package/dist/nodes/SmartSuite/SmartSuiteTrigger.node.json +14 -0
- package/dist/nodes/SmartSuite/__tests__/actions/api/makeApiRequest.test.d.ts +1 -0
- package/dist/nodes/SmartSuite/__tests__/actions/api/makeApiRequest.test.js +74 -0
- package/dist/nodes/SmartSuite/__tests__/actions/api/makeApiRequest.test.js.map +1 -0
- package/dist/nodes/SmartSuite/__tests__/actions/orgManagement/getCurrentUser.test.d.ts +1 -0
- package/dist/nodes/SmartSuite/__tests__/actions/orgManagement/getCurrentUser.test.js +22 -0
- package/dist/nodes/SmartSuite/__tests__/actions/orgManagement/getCurrentUser.test.js.map +1 -0
- package/dist/nodes/SmartSuite/__tests__/actions/orgManagement/listMembers.test.d.ts +1 -0
- package/dist/nodes/SmartSuite/__tests__/actions/orgManagement/listMembers.test.js +70 -0
- package/dist/nodes/SmartSuite/__tests__/actions/orgManagement/listMembers.test.js.map +1 -0
- package/dist/nodes/SmartSuite/__tests__/actions/orgManagement/listTeams.test.d.ts +1 -0
- package/dist/nodes/SmartSuite/__tests__/actions/orgManagement/listTeams.test.js +43 -0
- package/dist/nodes/SmartSuite/__tests__/actions/orgManagement/listTeams.test.js.map +1 -0
- package/dist/nodes/SmartSuite/__tests__/actions/record/createRecord.test.d.ts +1 -0
- package/dist/nodes/SmartSuite/__tests__/actions/record/createRecord.test.js +178 -0
- package/dist/nodes/SmartSuite/__tests__/actions/record/createRecord.test.js.map +1 -0
- package/dist/nodes/SmartSuite/__tests__/actions/record/deleteRecord.test.d.ts +1 -0
- package/dist/nodes/SmartSuite/__tests__/actions/record/deleteRecord.test.js +159 -0
- package/dist/nodes/SmartSuite/__tests__/actions/record/deleteRecord.test.js.map +1 -0
- package/dist/nodes/SmartSuite/__tests__/actions/record/getRecord.test.d.ts +1 -0
- package/dist/nodes/SmartSuite/__tests__/actions/record/getRecord.test.js +127 -0
- package/dist/nodes/SmartSuite/__tests__/actions/record/getRecord.test.js.map +1 -0
- package/dist/nodes/SmartSuite/__tests__/actions/record/listRecord.test.d.ts +1 -0
- package/dist/nodes/SmartSuite/__tests__/actions/record/listRecord.test.js +162 -0
- package/dist/nodes/SmartSuite/__tests__/actions/record/listRecord.test.js.map +1 -0
- package/dist/nodes/SmartSuite/__tests__/actions/record/searchRecord.test.d.ts +1 -0
- package/dist/nodes/SmartSuite/__tests__/actions/record/searchRecord.test.js +210 -0
- package/dist/nodes/SmartSuite/__tests__/actions/record/searchRecord.test.js.map +1 -0
- package/dist/nodes/SmartSuite/__tests__/actions/record/updateRecord.test.d.ts +1 -0
- package/dist/nodes/SmartSuite/__tests__/actions/record/updateRecord.test.js +198 -0
- package/dist/nodes/SmartSuite/__tests__/actions/record/updateRecord.test.js.map +1 -0
- package/dist/nodes/SmartSuite/__tests__/actions/record/upsertRecord.test.d.ts +1 -0
- package/dist/nodes/SmartSuite/__tests__/actions/record/upsertRecord.test.js +138 -0
- package/dist/nodes/SmartSuite/__tests__/actions/record/upsertRecord.test.js.map +1 -0
- package/dist/nodes/SmartSuite/__tests__/actions/solution/getSolution.test.d.ts +1 -0
- package/dist/nodes/SmartSuite/__tests__/actions/solution/getSolution.test.js +57 -0
- package/dist/nodes/SmartSuite/__tests__/actions/solution/getSolution.test.js.map +1 -0
- package/dist/nodes/SmartSuite/__tests__/actions/solution/listSolution.test.d.ts +1 -0
- package/dist/nodes/SmartSuite/__tests__/actions/solution/listSolution.test.js +48 -0
- package/dist/nodes/SmartSuite/__tests__/actions/solution/listSolution.test.js.map +1 -0
- package/dist/nodes/SmartSuite/__tests__/actions/table/createTable.test.d.ts +1 -0
- package/dist/nodes/SmartSuite/__tests__/actions/table/createTable.test.js +50 -0
- package/dist/nodes/SmartSuite/__tests__/actions/table/createTable.test.js.map +1 -0
- package/dist/nodes/SmartSuite/__tests__/actions/table/createTableField.test.d.ts +1 -0
- package/dist/nodes/SmartSuite/__tests__/actions/table/createTableField.test.js +93 -0
- package/dist/nodes/SmartSuite/__tests__/actions/table/createTableField.test.js.map +1 -0
- package/dist/nodes/SmartSuite/__tests__/actions/table/getTable.test.d.ts +1 -0
- package/dist/nodes/SmartSuite/__tests__/actions/table/getTable.test.js +70 -0
- package/dist/nodes/SmartSuite/__tests__/actions/table/getTable.test.js.map +1 -0
- package/dist/nodes/SmartSuite/__tests__/actions/table/listTable.test.d.ts +1 -0
- package/dist/nodes/SmartSuite/__tests__/actions/table/listTable.test.js +78 -0
- package/dist/nodes/SmartSuite/__tests__/actions/table/listTable.test.js.map +1 -0
- package/dist/nodes/SmartSuite/__tests__/helpers/mockResourceInputs.d.ts +10 -0
- package/dist/nodes/SmartSuite/__tests__/helpers/mockResourceInputs.js +26 -0
- package/dist/nodes/SmartSuite/__tests__/helpers/mockResourceInputs.js.map +1 -0
- package/dist/nodes/SmartSuite/actions/api/ApiRequestDescription.d.ts +2 -0
- package/dist/nodes/SmartSuite/actions/api/ApiRequestDescription.js +185 -0
- package/dist/nodes/SmartSuite/actions/api/ApiRequestDescription.js.map +1 -0
- package/dist/nodes/SmartSuite/actions/api/makeApiRequest.operation.d.ts +3 -0
- package/dist/nodes/SmartSuite/actions/api/makeApiRequest.operation.js +65 -0
- package/dist/nodes/SmartSuite/actions/api/makeApiRequest.operation.js.map +1 -0
- package/dist/nodes/SmartSuite/actions/orgManagement/OrgManagementDescription.d.ts +2 -0
- package/dist/nodes/SmartSuite/actions/orgManagement/OrgManagementDescription.js +21 -0
- package/dist/nodes/SmartSuite/actions/orgManagement/OrgManagementDescription.js.map +1 -0
- package/dist/nodes/SmartSuite/actions/orgManagement/getCurrentUser.operation.d.ts +18 -0
- package/dist/nodes/SmartSuite/actions/orgManagement/getCurrentUser.operation.js +39 -0
- package/dist/nodes/SmartSuite/actions/orgManagement/getCurrentUser.operation.js.map +1 -0
- package/dist/nodes/SmartSuite/actions/orgManagement/listMembers.operation.d.ts +18 -0
- package/dist/nodes/SmartSuite/actions/orgManagement/listMembers.operation.js +41 -0
- package/dist/nodes/SmartSuite/actions/orgManagement/listMembers.operation.js.map +1 -0
- package/dist/nodes/SmartSuite/actions/orgManagement/listTeams.operation.d.ts +18 -0
- package/dist/nodes/SmartSuite/actions/orgManagement/listTeams.operation.js +41 -0
- package/dist/nodes/SmartSuite/actions/orgManagement/listTeams.operation.js.map +1 -0
- package/dist/nodes/SmartSuite/actions/record/RecordDescription.d.ts +2 -0
- package/dist/nodes/SmartSuite/actions/record/RecordDescription.js +370 -0
- package/dist/nodes/SmartSuite/actions/record/RecordDescription.js.map +1 -0
- package/dist/nodes/SmartSuite/actions/record/createRecord.operation.d.ts +87 -0
- package/dist/nodes/SmartSuite/actions/record/createRecord.operation.js +55 -0
- package/dist/nodes/SmartSuite/actions/record/createRecord.operation.js.map +1 -0
- package/dist/nodes/SmartSuite/actions/record/deleteRecord.operation.d.ts +24 -0
- package/dist/nodes/SmartSuite/actions/record/deleteRecord.operation.js +49 -0
- package/dist/nodes/SmartSuite/actions/record/deleteRecord.operation.js.map +1 -0
- package/dist/nodes/SmartSuite/actions/record/getRecord.operation.d.ts +2 -0
- package/dist/nodes/SmartSuite/actions/record/getRecord.operation.js +31 -0
- package/dist/nodes/SmartSuite/actions/record/getRecord.operation.js.map +1 -0
- package/dist/nodes/SmartSuite/actions/record/listRecord.operation.d.ts +2 -0
- package/dist/nodes/SmartSuite/actions/record/listRecord.operation.js +52 -0
- package/dist/nodes/SmartSuite/actions/record/listRecord.operation.js.map +1 -0
- package/dist/nodes/SmartSuite/actions/record/searchRecord.operation.d.ts +2 -0
- package/dist/nodes/SmartSuite/actions/record/searchRecord.operation.js +77 -0
- package/dist/nodes/SmartSuite/actions/record/searchRecord.operation.js.map +1 -0
- package/dist/nodes/SmartSuite/actions/record/updateRecord.operation.d.ts +2 -0
- package/dist/nodes/SmartSuite/actions/record/updateRecord.operation.js +42 -0
- package/dist/nodes/SmartSuite/actions/record/updateRecord.operation.js.map +1 -0
- package/dist/nodes/SmartSuite/actions/record/upsertRecord.operation.d.ts +2 -0
- package/dist/nodes/SmartSuite/actions/record/upsertRecord.operation.js +66 -0
- package/dist/nodes/SmartSuite/actions/record/upsertRecord.operation.js.map +1 -0
- package/dist/nodes/SmartSuite/actions/solution/SolutionDescription.d.ts +2 -0
- package/dist/nodes/SmartSuite/actions/solution/SolutionDescription.js +54 -0
- package/dist/nodes/SmartSuite/actions/solution/SolutionDescription.js.map +1 -0
- package/dist/nodes/SmartSuite/actions/solution/getSolution.operation.d.ts +3 -0
- package/dist/nodes/SmartSuite/actions/solution/getSolution.operation.js +25 -0
- package/dist/nodes/SmartSuite/actions/solution/getSolution.operation.js.map +1 -0
- package/dist/nodes/SmartSuite/actions/solution/listSolution.operation.d.ts +3 -0
- package/dist/nodes/SmartSuite/actions/solution/listSolution.operation.js +54 -0
- package/dist/nodes/SmartSuite/actions/solution/listSolution.operation.js.map +1 -0
- package/dist/nodes/SmartSuite/actions/table/TableDescription.d.ts +6 -0
- package/dist/nodes/SmartSuite/actions/table/TableDescription.js +153 -0
- package/dist/nodes/SmartSuite/actions/table/TableDescription.js.map +1 -0
- package/dist/nodes/SmartSuite/actions/table/createTable.operation.d.ts +2 -0
- package/dist/nodes/SmartSuite/actions/table/createTable.operation.js +45 -0
- package/dist/nodes/SmartSuite/actions/table/createTable.operation.js.map +1 -0
- package/dist/nodes/SmartSuite/actions/table/createTableField.operation.d.ts +2 -0
- package/dist/nodes/SmartSuite/actions/table/createTableField.operation.js +49 -0
- package/dist/nodes/SmartSuite/actions/table/createTableField.operation.js.map +1 -0
- package/dist/nodes/SmartSuite/actions/table/getTable.operation.d.ts +2 -0
- package/dist/nodes/SmartSuite/actions/table/getTable.operation.js +23 -0
- package/dist/nodes/SmartSuite/actions/table/getTable.operation.js.map +1 -0
- package/dist/nodes/SmartSuite/actions/table/listTable.operation.d.ts +2 -0
- package/dist/nodes/SmartSuite/actions/table/listTable.operation.js +42 -0
- package/dist/nodes/SmartSuite/actions/table/listTable.operation.js.map +1 -0
- package/dist/nodes/SmartSuite/helpers/getFilterOptions.d.ts +11 -0
- package/dist/nodes/SmartSuite/helpers/getFilterOptions.js +376 -0
- package/dist/nodes/SmartSuite/helpers/getFilterOptions.js.map +1 -0
- package/dist/nodes/SmartSuite/helpers/getValidFilters.d.ts +6 -0
- package/dist/nodes/SmartSuite/helpers/getValidFilters.js +47 -0
- package/dist/nodes/SmartSuite/helpers/getValidFilters.js.map +1 -0
- package/dist/nodes/SmartSuite/helpers/utils.d.ts +21 -0
- package/dist/nodes/SmartSuite/helpers/utils.js +62 -0
- package/dist/nodes/SmartSuite/helpers/utils.js.map +1 -0
- package/dist/nodes/SmartSuite/helpers/validation.d.ts +9 -0
- package/dist/nodes/SmartSuite/helpers/validation.js +41 -0
- package/dist/nodes/SmartSuite/helpers/validation.js.map +1 -0
- package/dist/nodes/SmartSuite/index.d.ts +2 -0
- package/dist/nodes/SmartSuite/index.js +12 -0
- package/dist/nodes/SmartSuite/index.js.map +1 -0
- package/dist/nodes/SmartSuite/methods/listSearch.d.ts +11 -0
- package/dist/nodes/SmartSuite/methods/listSearch.js +81 -0
- package/dist/nodes/SmartSuite/methods/listSearch.js.map +1 -0
- package/dist/nodes/SmartSuite/methods/loadOptions.d.ts +30 -0
- package/dist/nodes/SmartSuite/methods/loadOptions.js +133 -0
- package/dist/nodes/SmartSuite/methods/loadOptions.js.map +1 -0
- package/dist/nodes/SmartSuite/methods/resourceMapping.d.ts +48 -0
- package/dist/nodes/SmartSuite/methods/resourceMapping.js +122 -0
- package/dist/nodes/SmartSuite/methods/resourceMapping.js.map +1 -0
- package/dist/nodes/SmartSuite/methods/router.d.ts +2 -0
- package/dist/nodes/SmartSuite/methods/router.js +65 -0
- package/dist/nodes/SmartSuite/methods/router.js.map +1 -0
- package/dist/nodes/SmartSuite/shared/__testHelpers__/mockExecuteFunctions.d.ts +9 -0
- package/dist/nodes/SmartSuite/shared/__testHelpers__/mockExecuteFunctions.js +84 -0
- package/dist/nodes/SmartSuite/shared/__testHelpers__/mockExecuteFunctions.js.map +1 -0
- package/dist/nodes/SmartSuite/shared/resourceInputs.d.ts +15 -0
- package/dist/nodes/SmartSuite/shared/resourceInputs.js +112 -0
- package/dist/nodes/SmartSuite/shared/resourceInputs.js.map +1 -0
- package/dist/nodes/SmartSuite/smartsuite.svg +6 -0
- package/dist/nodes/SmartSuite/transport/smartSuiteApi.d.ts +12 -0
- package/dist/nodes/SmartSuite/transport/smartSuiteApi.js +111 -0
- package/dist/nodes/SmartSuite/transport/smartSuiteApi.js.map +1 -0
- package/dist/nodes/SmartSuite/types.d.ts +11 -0
- package/dist/nodes/SmartSuite/types.js +4 -0
- package/dist/nodes/SmartSuite/types.js.map +1 -0
- package/package.json +99 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// src/nodes/SmartSuite/methods/listSearch.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.listSearch = exports.searchTableFieldsMutable = exports.searchTableFields = exports.tableSearch = exports.solutionSearch = void 0;
|
|
5
|
+
const utils_1 = require("../helpers/utils");
|
|
6
|
+
const smartSuiteApi_1 = require("../transport/smartSuiteApi");
|
|
7
|
+
// Helper to map fields for resourceLocator (supports description property)
|
|
8
|
+
const serializeField = (f) => ({
|
|
9
|
+
name: `${f.label} (${f.field_type})`,
|
|
10
|
+
value: f.slug,
|
|
11
|
+
description: `Type: ${f.field_type}`,
|
|
12
|
+
});
|
|
13
|
+
const solutionSearch = async function (filter = '') {
|
|
14
|
+
const all = [];
|
|
15
|
+
let offset = 0;
|
|
16
|
+
const limit = 100;
|
|
17
|
+
while (true) {
|
|
18
|
+
const resp = (await smartSuiteApi_1.apiRequest.call(this, 'GET', '/solutions/', {}, { limit, offset }));
|
|
19
|
+
const page = Array.isArray(resp) ? resp : resp.results || [];
|
|
20
|
+
if (!page.length)
|
|
21
|
+
break;
|
|
22
|
+
all.push(...page);
|
|
23
|
+
if (page.length < limit)
|
|
24
|
+
break;
|
|
25
|
+
offset += limit;
|
|
26
|
+
}
|
|
27
|
+
const filtered = all.filter((s) => !filter || s.name.toLowerCase().includes(filter.toLowerCase()));
|
|
28
|
+
const results = filtered
|
|
29
|
+
.sort((a, b) => a.name.localeCompare(b.name))
|
|
30
|
+
.map((s) => ({ name: s.name, value: s.id }));
|
|
31
|
+
return { results };
|
|
32
|
+
};
|
|
33
|
+
exports.solutionSearch = solutionSearch;
|
|
34
|
+
const tableSearch = async function (filter = '') {
|
|
35
|
+
const solutionId = (0, utils_1.asIdString)(this.getNodeParameter('solutionId', 0));
|
|
36
|
+
if (!solutionId)
|
|
37
|
+
return { results: [] };
|
|
38
|
+
const resp = (await smartSuiteApi_1.apiRequest.call(this, 'GET', `/applications/?solution=${solutionId}`));
|
|
39
|
+
const filtered = resp.filter((t) => !filter || t.name.toLowerCase().includes(filter.toLowerCase()));
|
|
40
|
+
const results = filtered
|
|
41
|
+
.sort((a, b) => a.name.localeCompare(b.name))
|
|
42
|
+
.map((t) => ({ name: t.name, value: t.id }));
|
|
43
|
+
return { results };
|
|
44
|
+
};
|
|
45
|
+
exports.tableSearch = tableSearch;
|
|
46
|
+
const searchTableFields = async function (filter = '') {
|
|
47
|
+
const tableId = (0, utils_1.asIdString)(this.getNodeParameter('tableId', 0));
|
|
48
|
+
if (!tableId)
|
|
49
|
+
return { results: [] };
|
|
50
|
+
const { structure = [] } = (await smartSuiteApi_1.apiRequest.call(this, 'GET', `/applications/${tableId}/`));
|
|
51
|
+
const filtered = structure.filter((f) => !filter ||
|
|
52
|
+
f.label.toLowerCase().includes(filter.toLowerCase()) ||
|
|
53
|
+
f.slug.toLowerCase().includes(filter.toLowerCase()));
|
|
54
|
+
const results = filtered.map(serializeField);
|
|
55
|
+
return { results };
|
|
56
|
+
};
|
|
57
|
+
exports.searchTableFields = searchTableFields;
|
|
58
|
+
const searchTableFieldsMutable = async function (filter = '') {
|
|
59
|
+
const tableId = (0, utils_1.asIdString)(this.getNodeParameter('tableId', 0));
|
|
60
|
+
if (!tableId)
|
|
61
|
+
return { results: [] };
|
|
62
|
+
const { structure = [] } = (await smartSuiteApi_1.apiRequest.call(this, 'GET', `/applications/${tableId}/`));
|
|
63
|
+
// Exclude reserved fields
|
|
64
|
+
const withoutReserved = structure.filter((f) => !(0, utils_1.isReservedField)(f.slug));
|
|
65
|
+
// Exclude record ID fields
|
|
66
|
+
const withoutRecordId = withoutReserved.filter((f) => f.field_type !== 'recordidfield');
|
|
67
|
+
// Apply search filter
|
|
68
|
+
const filtered = withoutRecordId.filter((f) => !filter ||
|
|
69
|
+
f.label.toLowerCase().includes(filter.toLowerCase()) ||
|
|
70
|
+
f.slug.toLowerCase().includes(filter.toLowerCase()));
|
|
71
|
+
const results = filtered.map(serializeField);
|
|
72
|
+
return { results };
|
|
73
|
+
};
|
|
74
|
+
exports.searchTableFieldsMutable = searchTableFieldsMutable;
|
|
75
|
+
exports.listSearch = {
|
|
76
|
+
solutionSearch: exports.solutionSearch,
|
|
77
|
+
tableSearch: exports.tableSearch,
|
|
78
|
+
searchTableFields: exports.searchTableFields,
|
|
79
|
+
searchTableFieldsMutable: exports.searchTableFieldsMutable,
|
|
80
|
+
};
|
|
81
|
+
//# sourceMappingURL=listSearch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listSearch.js","sourceRoot":"","sources":["../../../../src/nodes/SmartSuite/methods/listSearch.ts"],"names":[],"mappings":";AAAA,6CAA6C;;;AAG7C,4CAA+D;AAC/D,8DAAwD;AAExD,2EAA2E;AAC3E,MAAM,cAAc,GAAG,CAAC,CAAsD,EAAE,EAAE,CAAC,CAAC;IAClF,IAAI,EAAS,GAAG,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,UAAU,GAAG;IAC3C,KAAK,EAAQ,CAAC,CAAC,IAAI;IACnB,WAAW,EAAE,SAAS,CAAC,CAAC,UAAU,EAAE;CACrC,CAAC,CAAC;AAEI,MAAM,cAAc,GAAG,KAAK,WAEjC,MAAM,GAAG,EAAE;IAEX,MAAM,GAAG,GAAwC,EAAE,CAAC;IACpD,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,MAAM,KAAK,GAAG,GAAG,CAAC;IAElB,OAAO,IAAI,EAAE,CAAC;QACZ,MAAM,IAAI,GAAG,CAAC,MAAM,0BAAU,CAAC,IAAI,CACjC,IAAI,EACJ,KAAK,EACL,aAAa,EACb,EAAE,EACF,EAAE,KAAK,EAAE,MAAM,EAAE,CAClB,CAAQ,CAAC;QACV,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;QAC7D,IAAI,CAAC,IAAI,CAAC,MAAM;YAAE,MAAM;QACxB,GAAG,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;QAClB,IAAI,IAAI,CAAC,MAAM,GAAG,KAAK;YAAE,MAAM;QAC/B,MAAM,IAAI,KAAK,CAAC;IAClB,CAAC;IAED,MAAM,Q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yOptions } from 'n8n-workflow';
|
|
2
|
+
/**
|
|
3
|
+
* 1) Operations picker
|
|
4
|
+
*/
|
|
5
|
+
export declare function getOperations(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
6
|
+
/**
|
|
7
|
+
* 2) Load ALL table fields (including reserved and record-ID fields)
|
|
8
|
+
*/
|
|
9
|
+
export declare function getTableFields(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
10
|
+
/**
|
|
11
|
+
* 3) Load only mutable table fields (exclude reserved and record-ID fields)
|
|
12
|
+
*/
|
|
13
|
+
export declare function getMutableTableFields(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
14
|
+
/**
|
|
15
|
+
* 4) Get filter operators for a given field type (supports upsert and search)
|
|
16
|
+
*/
|
|
17
|
+
export declare function getFilterOptionsForFieldType(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
18
|
+
/**
|
|
19
|
+
* 5) Dynamic search methods
|
|
20
|
+
*/
|
|
21
|
+
export declare function searchTableFields(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
22
|
+
export declare function searchTableFieldsMutable(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
23
|
+
export declare const loadOptions: {
|
|
24
|
+
getOperations: typeof getOperations;
|
|
25
|
+
getTableFields: typeof getTableFields;
|
|
26
|
+
getMutableTableFields: typeof getMutableTableFields;
|
|
27
|
+
getFilterOptionsForFieldType: typeof getFilterOptionsForFieldType;
|
|
28
|
+
searchTableFields: typeof searchTableFields;
|
|
29
|
+
searchTableFieldsMutable: typeof searchTableFieldsMutable;
|
|
30
|
+
};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.loadOptions = void 0;
|
|
4
|
+
exports.getOperations = getOperations;
|
|
5
|
+
exports.getTableFields = getTableFields;
|
|
6
|
+
exports.getMutableTableFields = getMutableTableFields;
|
|
7
|
+
exports.getFilterOptionsForFieldType = getFilterOptionsForFieldType;
|
|
8
|
+
exports.searchTableFields = searchTableFields;
|
|
9
|
+
exports.searchTableFieldsMutable = searchTableFieldsMutable;
|
|
10
|
+
const smartSuiteApi_1 = require("../transport/smartSuiteApi");
|
|
11
|
+
const utils_1 = require("../helpers/utils");
|
|
12
|
+
const getFilterOptions_1 = require("../helpers/getFilterOptions");
|
|
13
|
+
const listSearch_1 = require("./listSearch");
|
|
14
|
+
/**
|
|
15
|
+
* 1) Operations picker
|
|
16
|
+
*/
|
|
17
|
+
async function getOperations() {
|
|
18
|
+
(0, utils_1.debugLog)('[LoadOptions] getOperations called', this.getNodeParameter('resource'), 2);
|
|
19
|
+
const resource = this.getNodeParameter('resource', 'record');
|
|
20
|
+
const map = {
|
|
21
|
+
record: [
|
|
22
|
+
{ name: 'Search Records', value: 'searchRecord', action: 'Search Records' },
|
|
23
|
+
{ name: 'Get Record', value: 'getRecord', action: 'Get Record' },
|
|
24
|
+
{ name: 'List Records', value: 'listRecord', action: 'List Records' },
|
|
25
|
+
{ name: 'Create Record', value: 'createRecord', action: 'Create Record' },
|
|
26
|
+
{ name: 'Update Record', value: 'updateRecord', action: 'Update Record' },
|
|
27
|
+
{ name: 'Delete Record', value: 'deleteRecord', action: 'Delete Record' },
|
|
28
|
+
{ name: 'Upsert Record', value: 'upsertRecord', action: 'Upsert Record' },
|
|
29
|
+
],
|
|
30
|
+
table: [
|
|
31
|
+
{ name: 'List Tables', value: 'listTable', action: 'List Tables' },
|
|
32
|
+
{ name: 'Get Table', value: 'getTable', action: 'Get Table' },
|
|
33
|
+
{ name: 'Create Table', value: 'createTable', action: 'Create Table' },
|
|
34
|
+
{ name: 'Create Table Field', value: 'createTableField', action: 'Create Table Field' },
|
|
35
|
+
],
|
|
36
|
+
solution: [
|
|
37
|
+
{ name: 'List Solutions', value: 'listSolution', action: 'List Solutions' },
|
|
38
|
+
{ name: 'Get Solution', value: 'getSolution', action: 'Get Solution' },
|
|
39
|
+
],
|
|
40
|
+
orgManagement: [
|
|
41
|
+
{ name: 'List Members', value: 'listMembers', action: 'List Members' },
|
|
42
|
+
{ name: 'List Teams', value: 'listTeams', action: 'List Teams' },
|
|
43
|
+
{ name: 'Get Current User', value: 'getCurrentUser', action: 'Get Current User' },
|
|
44
|
+
],
|
|
45
|
+
};
|
|
46
|
+
return map[resource] ?? [];
|
|
47
|
+
}
|
|
48
|
+
// Cache each table's structure so we only fetch it once per editor session
|
|
49
|
+
const tableStructureCache = new Map();
|
|
50
|
+
/**
|
|
51
|
+
* 2) Load ALL table fields (including reserved and record-ID fields)
|
|
52
|
+
*/
|
|
53
|
+
async function getTableFields() {
|
|
54
|
+
(0, utils_1.debugLog)('[LoadOptions] getTableFields called', undefined, 2);
|
|
55
|
+
const { results } = await listSearch_1.searchTableFields.call(this);
|
|
56
|
+
(0, utils_1.debugLog)('[LoadOptions] getTableFields raw', results, 2);
|
|
57
|
+
return results.map(({ name, value }) => ({ name: String(name), value: String(value) }));
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* 3) Load only mutable table fields (exclude reserved and record-ID fields)
|
|
61
|
+
*/
|
|
62
|
+
async function getMutableTableFields() {
|
|
63
|
+
(0, utils_1.debugLog)('[LoadOptions] getMutableTableFields called', undefined, 2);
|
|
64
|
+
const { results } = await listSearch_1.searchTableFieldsMutable.call(this);
|
|
65
|
+
(0, utils_1.debugLog)('[LoadOptions] getMutableTableFields raw', results, 2);
|
|
66
|
+
const filtered = results.filter((f) => !(0, utils_1.isReservedField)(String(f.value)) &&
|
|
67
|
+
!(f.description ?? '').toLowerCase().includes('recordidfield'));
|
|
68
|
+
(0, utils_1.debugLog)('[LoadOptions] getMutableTableFields filtered', filtered, 2);
|
|
69
|
+
return filtered.map(({ name, value }) => ({ name: String(name), value: String(value) }));
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* 4) Get filter operators for a given field type (supports upsert and search)
|
|
73
|
+
*/
|
|
74
|
+
async function getFilterOptionsForFieldType() {
|
|
75
|
+
// Determine operation context
|
|
76
|
+
const operation = this.getNodeParameter('operation');
|
|
77
|
+
let rawField;
|
|
78
|
+
if (operation === 'upsertRecord') {
|
|
79
|
+
rawField = this.getCurrentNodeParameter('matchingField');
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
rawField = this.getCurrentNodeParameter('filters.filter[0].field');
|
|
83
|
+
}
|
|
84
|
+
(0, utils_1.debugLog)('[LoadOptions] getFilterOptionsForFieldType called', { operation, rawField }, 2);
|
|
85
|
+
let slug = '';
|
|
86
|
+
if (rawField &&
|
|
87
|
+
typeof rawField === 'object' &&
|
|
88
|
+
'value' in rawField) {
|
|
89
|
+
slug = (0, utils_1.asIdString)(rawField.value);
|
|
90
|
+
}
|
|
91
|
+
else if (typeof rawField === 'string') {
|
|
92
|
+
slug = (0, utils_1.asIdString)(rawField);
|
|
93
|
+
}
|
|
94
|
+
if (!slug)
|
|
95
|
+
return [];
|
|
96
|
+
const tableId = (0, utils_1.asIdString)(this.getNodeParameter('tableId', 0));
|
|
97
|
+
if (!tableId)
|
|
98
|
+
return [];
|
|
99
|
+
(0, utils_1.debugLog)('[LoadOptions] getFilterOptionsForFieldType slug', slug, 2);
|
|
100
|
+
let structure = tableStructureCache.get(tableId);
|
|
101
|
+
if (!structure) {
|
|
102
|
+
const resp = (await smartSuiteApi_1.apiRequest.call(this, 'GET', `/applications/${tableId}/`));
|
|
103
|
+
structure = resp.structure || [];
|
|
104
|
+
tableStructureCache.set(tableId, structure);
|
|
105
|
+
}
|
|
106
|
+
const def = structure.find((f) => f.slug === slug);
|
|
107
|
+
const ops = def ? getFilterOptions_1.filterOptionsByFieldType[def.field_type] : [];
|
|
108
|
+
(0, utils_1.debugLog)('[LoadOptions] getFilterOptionsForFieldType ops', ops, 2);
|
|
109
|
+
return ops.map((op) => ({
|
|
110
|
+
name: op.replace(/_/g, ' ').replace(/\b\w/g, (l) => l.toUpperCase()),
|
|
111
|
+
value: op,
|
|
112
|
+
}));
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* 5) Dynamic search methods
|
|
116
|
+
*/
|
|
117
|
+
async function searchTableFields() {
|
|
118
|
+
(0, utils_1.debugLog)('[LoadOptions] searchTableFields called', undefined, 2);
|
|
119
|
+
return getTableFields.call(this);
|
|
120
|
+
}
|
|
121
|
+
async function searchTableFieldsMutable() {
|
|
122
|
+
(0, utils_1.debugLog)('[LoadOptions] searchTableFieldsMutable called', undefined, 2);
|
|
123
|
+
return getMutableTableFields.call(this);
|
|
124
|
+
}
|
|
125
|
+
exports.loadOptions = {
|
|
126
|
+
getOperations,
|
|
127
|
+
getTableFields,
|
|
128
|
+
getMutableTableFields,
|
|
129
|
+
getFilterOptionsForFieldType,
|
|
130
|
+
searchTableFields,
|
|
131
|
+
searchTableFieldsMutable,
|
|
132
|
+
};
|
|
133
|
+
//# sourceMappingURL=loadOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loadOptions.js","sourceRoot":"","sources":["../../../../src/nodes/SmartSuite/methods/loadOptions.ts"],"names":[],"mappings":";;;AAqBA,sCAgCC;AAWD,wCAOC;AAKD,sDAaC;AAKD,oEAmDC;AAKD,8CAKC;AAED,4DAKC;AA5JD,8DAAwD;AACxD,4CAI0B;AAC1B,kEAAuE;AACvE,6CAGsB;AAEtB;;GAEG;AACI,KAAK,UAAU,aAAa;IAGjC,IAAA,gBAAQ,EAAC,oCAAoC,EAAE,IAAI,CAAC,gBAAgB,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC;IACrF,MAAM,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,QAAQ,CAAW,CAAC;IACvE,MAAM,GAAG,GAA2C;QAClD,MAAM,EAAE;YACN,EAAE,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,gBAAgB,EAAE;YAC3E,EAAE,IAAI,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AAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC;AAEM,KAAK,UAAU,wBAAwB;IAG5C,IAAA,gBAAQ,EAAC,+CAA+C,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;IACxE,OAAO,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1C,CAAC;AAEY,QAAA,WAAW,GAAG;IACzB,aAAa;IACb,cAAc;IACd,qBAAqB;IACrB,4BAA4B;IAC5B,iBAAiB;IACjB,wBAAwB;CACzB,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
|
|
2
|
+
import * as recordCreate from '../actions/record/createRecord.operation';
|
|
3
|
+
import * as recordList from '../actions/record/listRecord.operation';
|
|
4
|
+
import * as recordSearch from '../actions/record/searchRecord.operation';
|
|
5
|
+
import * as recordGet from '../actions/record/getRecord.operation';
|
|
6
|
+
import * as recordUpdate from '../actions/record/updateRecord.operation';
|
|
7
|
+
import * as recordUpsert from '../actions/record/upsertRecord.operation';
|
|
8
|
+
import * as recordDelete from '../actions/record/deleteRecord.operation';
|
|
9
|
+
import * as tableList from '../actions/table/listTable.operation';
|
|
10
|
+
import * as tableGet from '../actions/table/getTable.operation';
|
|
11
|
+
import * as tableCreateField from '../actions/table/createTableField.operation';
|
|
12
|
+
import * as tableCreate from '../actions/table/createTable.operation';
|
|
13
|
+
import * as solutionList from '../actions/solution/listSolution.operation';
|
|
14
|
+
import * as solutionGet from '../actions/solution/getSolution.operation';
|
|
15
|
+
import * as orgListMembers from '../actions/orgManagement/listMembers.operation';
|
|
16
|
+
import * as orgListTeams from '../actions/orgManagement/listTeams.operation';
|
|
17
|
+
import * as orgGetCurrent from '../actions/orgManagement/getCurrentUser.operation';
|
|
18
|
+
import makeApiRequest from '../actions/api/makeApiRequest.operation';
|
|
19
|
+
export declare const resourceMapping: {
|
|
20
|
+
readonly record: {
|
|
21
|
+
readonly createRecord: typeof recordCreate.execute;
|
|
22
|
+
readonly listRecord: typeof recordList.execute;
|
|
23
|
+
readonly searchRecord: typeof recordSearch.execute;
|
|
24
|
+
readonly getRecord: typeof recordGet.execute;
|
|
25
|
+
readonly updateRecord: typeof recordUpdate.execute;
|
|
26
|
+
readonly upsertRecord: typeof recordUpsert.execute;
|
|
27
|
+
readonly deleteRecord: typeof recordDelete.execute;
|
|
28
|
+
};
|
|
29
|
+
readonly table: {
|
|
30
|
+
readonly listTable: typeof tableList.execute;
|
|
31
|
+
readonly getTable: typeof tableGet.execute;
|
|
32
|
+
readonly createTableField: typeof tableCreateField.execute;
|
|
33
|
+
readonly createTable: typeof tableCreate.execute;
|
|
34
|
+
};
|
|
35
|
+
readonly solution: {
|
|
36
|
+
readonly listSolution: typeof solutionList.execute;
|
|
37
|
+
readonly getSolution: typeof solutionGet.execute;
|
|
38
|
+
};
|
|
39
|
+
readonly orgManagement: {
|
|
40
|
+
readonly listMembers: typeof orgListMembers.execute;
|
|
41
|
+
readonly listTeams: typeof orgListTeams.execute;
|
|
42
|
+
readonly getCurrentUser: typeof orgGetCurrent.execute;
|
|
43
|
+
};
|
|
44
|
+
readonly apiRequest: {
|
|
45
|
+
readonly make: typeof makeApiRequest;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
export declare function callResource(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// src/nodes/SmartSuite/methods/resourceMapping.ts
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.resourceMapping = void 0;
|
|
41
|
+
exports.callResource = callResource;
|
|
42
|
+
/* ---------- Record ---------- */
|
|
43
|
+
const recordCreate = __importStar(require("../actions/record/createRecord.operation"));
|
|
44
|
+
const recordList = __importStar(require("../actions/record/listRecord.operation"));
|
|
45
|
+
const recordSearch = __importStar(require("../actions/record/searchRecord.operation"));
|
|
46
|
+
const recordGet = __importStar(require("../actions/record/getRecord.operation"));
|
|
47
|
+
const recordUpdate = __importStar(require("../actions/record/updateRecord.operation"));
|
|
48
|
+
const recordUpsert = __importStar(require("../actions/record/upsertRecord.operation"));
|
|
49
|
+
const recordDelete = __importStar(require("../actions/record/deleteRecord.operation"));
|
|
50
|
+
/* ---------- Table ---------- */
|
|
51
|
+
const tableList = __importStar(require("../actions/table/listTable.operation"));
|
|
52
|
+
const tableGet = __importStar(require("../actions/table/getTable.operation"));
|
|
53
|
+
const tableCreateField = __importStar(require("../actions/table/createTableField.operation"));
|
|
54
|
+
const tableCreate = __importStar(require("../actions/table/createTable.operation"));
|
|
55
|
+
/* ---------- Solution ---------- */
|
|
56
|
+
const solutionList = __importStar(require("../actions/solution/listSolution.operation"));
|
|
57
|
+
const solutionGet = __importStar(require("../actions/solution/getSolution.operation"));
|
|
58
|
+
/* ---------- Org Management ---------- */
|
|
59
|
+
const orgListMembers = __importStar(require("../actions/orgManagement/listMembers.operation"));
|
|
60
|
+
const orgListTeams = __importStar(require("../actions/orgManagement/listTeams.operation"));
|
|
61
|
+
const orgGetCurrent = __importStar(require("../actions/orgManagement/getCurrentUser.operation"));
|
|
62
|
+
/* ---------- API Request ---------- */
|
|
63
|
+
const makeApiRequest_operation_1 = __importDefault(require("../actions/api/makeApiRequest.operation"));
|
|
64
|
+
exports.resourceMapping = {
|
|
65
|
+
record: {
|
|
66
|
+
createRecord: recordCreate.execute,
|
|
67
|
+
listRecord: recordList.execute,
|
|
68
|
+
searchRecord: recordSearch.execute,
|
|
69
|
+
getRecord: recordGet.execute,
|
|
70
|
+
updateRecord: recordUpdate.execute,
|
|
71
|
+
upsertRecord: recordUpsert.execute,
|
|
72
|
+
deleteRecord: recordDelete.execute,
|
|
73
|
+
},
|
|
74
|
+
table: {
|
|
75
|
+
listTable: tableList.execute,
|
|
76
|
+
getTable: tableGet.execute,
|
|
77
|
+
createTableField: tableCreateField.execute,
|
|
78
|
+
createTable: tableCreate.execute,
|
|
79
|
+
},
|
|
80
|
+
solution: {
|
|
81
|
+
listSolution: solutionList.execute,
|
|
82
|
+
getSolution: solutionGet.execute,
|
|
83
|
+
},
|
|
84
|
+
orgManagement: {
|
|
85
|
+
listMembers: orgListMembers.execute,
|
|
86
|
+
listTeams: orgListTeams.execute,
|
|
87
|
+
getCurrentUser: orgGetCurrent.execute,
|
|
88
|
+
},
|
|
89
|
+
apiRequest: {
|
|
90
|
+
make: makeApiRequest_operation_1.default,
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
async function callResource() {
|
|
94
|
+
// 1) Which resource did the user pick?
|
|
95
|
+
const resource = this.getNodeParameter('resource', 0);
|
|
96
|
+
// 2) Pick the correct handler function
|
|
97
|
+
let handlerFn;
|
|
98
|
+
if (resource === 'apiRequest') {
|
|
99
|
+
// For API Request, always call `make`
|
|
100
|
+
handlerFn = exports.resourceMapping.apiRequest.make;
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
// For other resources, use the "<resource>Operation" parameter
|
|
104
|
+
const operationParam = `${resource}Operation`;
|
|
105
|
+
const operation = this.getNodeParameter(operationParam, 0);
|
|
106
|
+
handlerFn = exports.resourceMapping[resource][operation];
|
|
107
|
+
}
|
|
108
|
+
if (typeof handlerFn !== 'function') {
|
|
109
|
+
throw new Error(`No handler found for resource "${resource}"`);
|
|
110
|
+
}
|
|
111
|
+
// 3) Execute per incoming item and collect results
|
|
112
|
+
const items = this.getInputData();
|
|
113
|
+
const returnData = [];
|
|
114
|
+
for (let i = 0; i < items.length; i++) {
|
|
115
|
+
const result = await handlerFn.call(this, i);
|
|
116
|
+
if (Array.isArray(result)) {
|
|
117
|
+
returnData.push(...result);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return [returnData];
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=resourceMapping.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resourceMapping.js","sourceRoot":"","sources":["../../../../src/nodes/SmartSuite/methods/resourceMapping.ts"],"names":[],"mappings":";AAAA,kDAAkD;;;;;;;;;;;;;;;;;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E,CAAC,CAAiC,CAAC;IAEtF,uCAAuC;IACvC,IAAI,SAAwF,CAAC;IAE7F,IAAI,QAAQ,KAAK,YAAY,EAAE,CAAC;QAC9B,sCAAsC;QACtC,SAAS,GAAG,uBAAe,CAAC,UAAU,CAAC,IAAI,CAAC;IAC9C,CAAC;SAAM,CAAC;QACN,+DAA+D;QAC/D,MAAM,cAAc,GAAG,GAAG,QAAQ,WAAoB,CAAC;QACvD,MAAM,SAAS,GAAQ,IAAI,CAAC,gBAAgB,CAAC,cAAc,EAAE,CAAC,CAAW,CAAC;QAC1E,SAAS,GAAI,uBAAuB,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAkF,CAAC;IAC7I,CAAC;IAED,IAAI,OAAO,SAAS,KAAK,UAAU,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,kCAAkC,QAAQ,GAAG,CAAC,CAAC;IACjE,CAAC;IAED,mDAAmD;IACnD,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;IAClC,MAAM,UAAU,GAAyB,EAAE,CAAC;IAE5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QAC7C,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAC1B,UAAU,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IAED,OAAO,CAAC,UAAU,CAAC,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// src/nodes/SmartSuite/methods/router.ts
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.router = router;
|
|
38
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
39
|
+
const utils_1 = require("../helpers/utils");
|
|
40
|
+
async function router() {
|
|
41
|
+
// 1) Pull resource & operation
|
|
42
|
+
const resource = this.getNodeParameter('resource', 0);
|
|
43
|
+
const operation = this.getNodeParameter('operation', 0);
|
|
44
|
+
// log for debugging
|
|
45
|
+
(0, utils_1.debugLog)(`📝 router: resource=${resource}, operation=${operation}`, undefined, 1);
|
|
46
|
+
// 2) Dynamically import the module
|
|
47
|
+
let actionModule;
|
|
48
|
+
try {
|
|
49
|
+
actionModule = await Promise.resolve(`${
|
|
50
|
+
/* webpackIgnore: true */
|
|
51
|
+
`../actions/${resource}/${operation}.operation`}`).then(s => __importStar(require(s)));
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
(0, utils_1.debugLog)('❌ Failed to import action module:', err, 3);
|
|
55
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Could not load actions/${resource}/${operation}.operation.ts`);
|
|
56
|
+
}
|
|
57
|
+
// 3) Validate it has an execute()
|
|
58
|
+
if (typeof actionModule.execute !== 'function') {
|
|
59
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Missing execute() in actions/${resource}/${operation}.operation.ts`);
|
|
60
|
+
}
|
|
61
|
+
// 4) Execute it and return
|
|
62
|
+
const result = await actionModule.execute.call(this);
|
|
63
|
+
return [result];
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=router.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router.js","sourceRoot":"","sources":["../../../../src/nodes/SmartSuite/methods/router.ts"],"names":[],"mappings":";AAAA,yCAAyC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMzC,wBAoCC;AAvCD,+CAAkD;AAClD,4CAA4C;AAErC,KAAK,UAAU,MAAM;IAG1B,+BAA+B;IAC/B,MAAM,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,CAAC,CAAW,CAAC;IAChE,MAAM,SAAS,GAAG,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,CAAC,CAAW,CAAC;IAElE,oBAAoB;IACpB,IAAA,gBAAQ,EAAC,uBAAuB,QAAQ,eAAe,SAAS,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;IAElF,mCAAmC;IACnC,IAAI,YAA+D,CAAC;IACpE,IAAI,CAAC;QACH,YAAY,GAAG;QACb,yBAAyB;QACzB,cAAc,QAAQ,IAAI,SAAS,YAAY,uCAChD,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAA,gBAAQ,EAAC,mCAAmC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;QACtD,MAAM,IAAI,iCAAkB,CAC1B,IAAI,CAAC,OAAO,EAAE,EACd,0BAA0B,QAAQ,IAAI,SAAS,eAAe,CAC/D,CAAC;IACJ,CAAC;IAED,kCAAkC;IAClC,IAAI,OAAO,YAAY,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;QAC/C,MAAM,IAAI,iCAAkB,CAC1B,IAAI,CAAC,OAAO,EAAE,EACd,gCAAgC,QAAQ,IAAI,SAAS,eAAe,CACrE,CAAC;IACJ,CAAC;IAED,2BAA2B;IAC3B,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrD,OAAO,CAAC,MAAM,CAAC,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
|
|
2
|
+
/**
|
|
3
|
+
* Provides a mocked IExecuteFunctions context for n8n nodes.
|
|
4
|
+
*/
|
|
5
|
+
export declare function mockExecuteFunctions(overrides: {
|
|
6
|
+
apiRequestResponse: any;
|
|
7
|
+
inputData?: INodeExecutionData[];
|
|
8
|
+
parameters?: Record<string, any>;
|
|
9
|
+
}): IExecuteFunctions;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// src/shared/__testHelpers__/mockExecuteFunctions.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.mockExecuteFunctions = mockExecuteFunctions;
|
|
5
|
+
// A minimal INode stub for NodeOperationError
|
|
6
|
+
const mockNode = {
|
|
7
|
+
id: '1',
|
|
8
|
+
name: 'mockNode',
|
|
9
|
+
type: 'mockType',
|
|
10
|
+
typeVersion: 1,
|
|
11
|
+
position: [0, 0],
|
|
12
|
+
parameters: {},
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Provides a mocked IExecuteFunctions context for n8n nodes.
|
|
16
|
+
*/
|
|
17
|
+
function mockExecuteFunctions(overrides) {
|
|
18
|
+
return {
|
|
19
|
+
getNode() {
|
|
20
|
+
return mockNode;
|
|
21
|
+
},
|
|
22
|
+
getInputData() {
|
|
23
|
+
return overrides.inputData ?? [];
|
|
24
|
+
},
|
|
25
|
+
getNodeParameter(name, itemIndex = 0) {
|
|
26
|
+
// 1) Handle nested parameters like 'filters.filter'
|
|
27
|
+
if (overrides.parameters) {
|
|
28
|
+
const keys = name.split('.');
|
|
29
|
+
let value = overrides.parameters;
|
|
30
|
+
for (const key of keys) {
|
|
31
|
+
value = value?.[key];
|
|
32
|
+
if (value === undefined)
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
if (value !== undefined)
|
|
36
|
+
return value;
|
|
37
|
+
}
|
|
38
|
+
// 2) Default dummy values for non-nested parameters
|
|
39
|
+
switch (name) {
|
|
40
|
+
case 'solution':
|
|
41
|
+
return 'dummy-solution-id';
|
|
42
|
+
case 'tableName':
|
|
43
|
+
return 'Test Table';
|
|
44
|
+
case 'tableDescription':
|
|
45
|
+
return 'Test Description';
|
|
46
|
+
case 'icon':
|
|
47
|
+
return 'Test Icon';
|
|
48
|
+
case 'returnAll':
|
|
49
|
+
return false;
|
|
50
|
+
case 'limit':
|
|
51
|
+
return 50;
|
|
52
|
+
case 'hydrated':
|
|
53
|
+
return false;
|
|
54
|
+
case 'searchOperator':
|
|
55
|
+
return 'and'; // Ensure this is always returned
|
|
56
|
+
case 'filters.filter':
|
|
57
|
+
return []; // Default to an empty array if not set
|
|
58
|
+
case 'fieldsUiUpdate.fieldsValues': // Ensure fieldsUiUpdate fields are always an empty array or valid value
|
|
59
|
+
return overrides.parameters?.['fieldsUiUpdate.fieldsValues'] || [];
|
|
60
|
+
default:
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
getCredentials(_credentialName) {
|
|
65
|
+
return {
|
|
66
|
+
apiKey: 'dummy',
|
|
67
|
+
accountId: 'dummy',
|
|
68
|
+
baseUrl: 'https://dummy',
|
|
69
|
+
};
|
|
70
|
+
},
|
|
71
|
+
helpers: {
|
|
72
|
+
makeApiRequest(_method, _path, _body, _query, _headers) {
|
|
73
|
+
return Promise.resolve(overrides.apiRequestResponse);
|
|
74
|
+
},
|
|
75
|
+
httpRequest(_opts) {
|
|
76
|
+
return Promise.resolve(overrides.apiRequestResponse);
|
|
77
|
+
},
|
|
78
|
+
returnJsonArray(data) {
|
|
79
|
+
return data.map((d) => ({ json: d }));
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=mockExecuteFunctions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mockExecuteFunctions.js","sourceRoot":"","sources":["../../../../../src/nodes/SmartSuite/shared/__testHelpers__/mockExecuteFunctions.ts"],"names":[],"mappings":";AAAA,qDAAqD;;AAiBrD,oDAiFC;AA9FD,8CAA8C;AAC9C,MAAM,QAAQ,GAAU;IACtB,EAAE,EAAE,GAAG;IACP,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE,CAAC;IACd,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IAChB,UAAU,EAAE,EAAE;CACf,CAAC;AAEF;;GAEG;AACH,SAAgB,oBAAoB,CAAC,SAIpC;IACC,OAAO;QACL,OAAO;YACL,OAAO,QAAQ,CAAC;QAClB,CAAC;QAED,YAAY;YACV,OAAO,SAAS,CAAC,SAAS,IAAI,EAAE,CAAC;QACnC,CAA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ED,OAAO,EAAE;YACP,cAAc,CACZ,OAAe,EACf,KAAa,EACb,KAAW,EACX,MAAY,EACZ,QAAc;gBAEd,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC;YACvD,CAAC;YAED,WAAW,CAAC,KAAW;gBACrB,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC;YACvD,CAAC;YAED,eAAe,CAAC,IAAW;gBACzB,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAyB,CAAA,CAAC,CAAC;YAC9D,CAAC;SACF;KAC8B,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { INodeProperties } from 'n8n-workflow';
|
|
2
|
+
/**
|
|
3
|
+
* Re-usable “Solution” input with Fixed | Expression toggle enabled.
|
|
4
|
+
*/
|
|
5
|
+
export declare const solutionInput: INodeProperties;
|
|
6
|
+
/**
|
|
7
|
+
* Re-usable “Table” input with Fixed | Expression toggle enabled.
|
|
8
|
+
* Clears & reloads whenever `solutionId.value` changes.
|
|
9
|
+
*/
|
|
10
|
+
export declare const tableInput: INodeProperties;
|
|
11
|
+
/**
|
|
12
|
+
* Re-usable “Fields” input for record-create/update operations.
|
|
13
|
+
* Clears & reloads whenever `solutionId.value` or `tableId.value` changes.
|
|
14
|
+
*/
|
|
15
|
+
export declare const fieldsInput: INodeProperties;
|