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,87 @@
|
|
|
1
|
+
import type { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
|
|
2
|
+
export declare const description: readonly [{
|
|
3
|
+
readonly displayOptions: {
|
|
4
|
+
readonly show: {
|
|
5
|
+
readonly resource: readonly ["record"];
|
|
6
|
+
readonly operation: readonly ["createRecord"];
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
readonly displayName: string;
|
|
10
|
+
readonly name: string;
|
|
11
|
+
readonly type: import("n8n-workflow").NodePropertyTypes;
|
|
12
|
+
readonly typeOptions?: import("n8n-workflow").INodePropertyTypeOptions;
|
|
13
|
+
readonly default: import("n8n-workflow").NodeParameterValueType;
|
|
14
|
+
readonly description?: string;
|
|
15
|
+
readonly hint?: string;
|
|
16
|
+
readonly disabledOptions?: import("n8n-workflow").IDisplayOptions;
|
|
17
|
+
readonly options?: Array<import("n8n-workflow").INodePropertyOptions | import("n8n-workflow").INodeProperties | import("n8n-workflow").INodePropertyCollection>;
|
|
18
|
+
readonly placeholder?: string;
|
|
19
|
+
readonly isNodeSetting?: boolean;
|
|
20
|
+
readonly noDataExpression?: boolean;
|
|
21
|
+
readonly required?: boolean;
|
|
22
|
+
readonly routing?: import("n8n-workflow").INodePropertyRouting;
|
|
23
|
+
readonly credentialTypes?: Array<"extends:oAuth2Api" | "extends:oAuth1Api" | "has:authenticate" | "has:genericAuth">;
|
|
24
|
+
readonly extractValue?: import("n8n-workflow").INodePropertyValueExtractor;
|
|
25
|
+
readonly modes?: import("n8n-workflow").INodePropertyMode[];
|
|
26
|
+
readonly requiresDataPath?: "single" | "multiple";
|
|
27
|
+
readonly doNotInherit?: boolean;
|
|
28
|
+
readonly validateType?: import("n8n-workflow").FieldType;
|
|
29
|
+
readonly ignoreValidationDuringExecution?: boolean;
|
|
30
|
+
}, {
|
|
31
|
+
readonly displayOptions: {
|
|
32
|
+
readonly show: {
|
|
33
|
+
readonly resource: readonly ["record"];
|
|
34
|
+
readonly operation: readonly ["createRecord"];
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
readonly displayName: string;
|
|
38
|
+
readonly name: string;
|
|
39
|
+
readonly type: import("n8n-workflow").NodePropertyTypes;
|
|
40
|
+
readonly typeOptions?: import("n8n-workflow").INodePropertyTypeOptions;
|
|
41
|
+
readonly default: import("n8n-workflow").NodeParameterValueType;
|
|
42
|
+
readonly description?: string;
|
|
43
|
+
readonly hint?: string;
|
|
44
|
+
readonly disabledOptions?: import("n8n-workflow").IDisplayOptions;
|
|
45
|
+
readonly options?: Array<import("n8n-workflow").INodePropertyOptions | import("n8n-workflow").INodeProperties | import("n8n-workflow").INodePropertyCollection>;
|
|
46
|
+
readonly placeholder?: string;
|
|
47
|
+
readonly isNodeSetting?: boolean;
|
|
48
|
+
readonly noDataExpression?: boolean;
|
|
49
|
+
readonly required?: boolean;
|
|
50
|
+
readonly routing?: import("n8n-workflow").INodePropertyRouting;
|
|
51
|
+
readonly credentialTypes?: Array<"extends:oAuth2Api" | "extends:oAuth1Api" | "has:authenticate" | "has:genericAuth">;
|
|
52
|
+
readonly extractValue?: import("n8n-workflow").INodePropertyValueExtractor;
|
|
53
|
+
readonly modes?: import("n8n-workflow").INodePropertyMode[];
|
|
54
|
+
readonly requiresDataPath?: "single" | "multiple";
|
|
55
|
+
readonly doNotInherit?: boolean;
|
|
56
|
+
readonly validateType?: import("n8n-workflow").FieldType;
|
|
57
|
+
readonly ignoreValidationDuringExecution?: boolean;
|
|
58
|
+
}, {
|
|
59
|
+
readonly displayOptions: {
|
|
60
|
+
readonly show: {
|
|
61
|
+
readonly resource: readonly ["record"];
|
|
62
|
+
readonly operation: readonly ["createRecord"];
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
readonly displayName: string;
|
|
66
|
+
readonly name: string;
|
|
67
|
+
readonly type: import("n8n-workflow").NodePropertyTypes;
|
|
68
|
+
readonly typeOptions?: import("n8n-workflow").INodePropertyTypeOptions;
|
|
69
|
+
readonly default: import("n8n-workflow").NodeParameterValueType;
|
|
70
|
+
readonly description?: string;
|
|
71
|
+
readonly hint?: string;
|
|
72
|
+
readonly disabledOptions?: import("n8n-workflow").IDisplayOptions;
|
|
73
|
+
readonly options?: Array<import("n8n-workflow").INodePropertyOptions | import("n8n-workflow").INodeProperties | import("n8n-workflow").INodePropertyCollection>;
|
|
74
|
+
readonly placeholder?: string;
|
|
75
|
+
readonly isNodeSetting?: boolean;
|
|
76
|
+
readonly noDataExpression?: boolean;
|
|
77
|
+
readonly required?: boolean;
|
|
78
|
+
readonly routing?: import("n8n-workflow").INodePropertyRouting;
|
|
79
|
+
readonly credentialTypes?: Array<"extends:oAuth2Api" | "extends:oAuth1Api" | "has:authenticate" | "has:genericAuth">;
|
|
80
|
+
readonly extractValue?: import("n8n-workflow").INodePropertyValueExtractor;
|
|
81
|
+
readonly modes?: import("n8n-workflow").INodePropertyMode[];
|
|
82
|
+
readonly requiresDataPath?: "single" | "multiple";
|
|
83
|
+
readonly doNotInherit?: boolean;
|
|
84
|
+
readonly validateType?: import("n8n-workflow").FieldType;
|
|
85
|
+
readonly ignoreValidationDuringExecution?: boolean;
|
|
86
|
+
}];
|
|
87
|
+
export declare function execute(this: IExecuteFunctions): Promise<INodeExecutionData[]>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// src/nodes/SmartSuite/actions/record/createRecord.operation.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.description = void 0;
|
|
5
|
+
exports.execute = execute;
|
|
6
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
7
|
+
const utils_1 = require("../../helpers/utils");
|
|
8
|
+
const smartSuiteApi_1 = require("../../transport/smartSuiteApi");
|
|
9
|
+
const validation_1 = require("../../helpers/validation");
|
|
10
|
+
const resourceInputs_1 = require("../../shared/resourceInputs");
|
|
11
|
+
exports.description = [
|
|
12
|
+
{
|
|
13
|
+
...resourceInputs_1.solutionInput,
|
|
14
|
+
displayOptions: { show: { resource: ['record'], operation: ['createRecord'] } },
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
...resourceInputs_1.tableInput,
|
|
18
|
+
displayOptions: { show: { resource: ['record'], operation: ['createRecord'] } },
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
...resourceInputs_1.fieldsInput,
|
|
22
|
+
displayOptions: { show: { resource: ['record'], operation: ['createRecord'] } },
|
|
23
|
+
},
|
|
24
|
+
];
|
|
25
|
+
async function execute() {
|
|
26
|
+
const solutionId = await validation_1.getSolutionId.call(this, 0);
|
|
27
|
+
const tableId = await validation_1.getTableId.call(this, 0);
|
|
28
|
+
(0, utils_1.debugLog)('[Record] createRecord.execute called', this.getNode().parameters);
|
|
29
|
+
const items = this.getInputData();
|
|
30
|
+
const returnData = [];
|
|
31
|
+
for (let i = 0; i < items.length; i++) {
|
|
32
|
+
const fieldsArr = this.getNodeParameter('fieldsUi.fieldsValues', i, []);
|
|
33
|
+
if (!fieldsArr.length) {
|
|
34
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'You must provide at least one field to create a record.', { itemIndex: i });
|
|
35
|
+
}
|
|
36
|
+
// Prevent setting system fields
|
|
37
|
+
for (const { field } of fieldsArr) {
|
|
38
|
+
const slug = (0, utils_1.asIdString)(field);
|
|
39
|
+
if ((0, utils_1.isReservedField)(slug)) {
|
|
40
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Cannot set system field “${slug}”.`, { itemIndex: i });
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const payload = fieldsArr.reduce((obj, { field, value }) => {
|
|
44
|
+
obj[(0, utils_1.asIdString)(field)] = value;
|
|
45
|
+
return obj;
|
|
46
|
+
}, {});
|
|
47
|
+
(0, utils_1.debugLog)('[Record] createRecord.request', { solutionId, tableId, payload });
|
|
48
|
+
const response = await smartSuiteApi_1.apiRequest.call(this, 'POST', `/applications/${tableId}/records/`, payload);
|
|
49
|
+
(0, utils_1.debugLog)('[Record] createRecord.response', response);
|
|
50
|
+
const result = (response && typeof response === 'object') ? response : {};
|
|
51
|
+
returnData.push(...this.helpers.returnJsonArray([result]));
|
|
52
|
+
}
|
|
53
|
+
return returnData;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=createRecord.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createRecord.operation.js","sourceRoot":"","sources":["../../../../../src/nodes/SmartSuite/actions/record/createRecord.operation.ts"],"names":[],"mappings":";AAAA,gEAAgE;;;AAwBhE,0BAqDC;AA1ED,+CAAkD;AAClD,+CAA4E;AAC5E,iEAA2D;AAC3D,yDAAqE;AACrE,gEAAqF;AAExE,QAAA,WAAW,GAAG;IACzB;QACE,GAAG,8BAAa;QAChB,cAAc,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAC,cAAc,CAAC,EAAE,EAAE;KAChF;IACD;QACE,GAAG,2BAAU;QACb,cAAc,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAC,cAAc,CAAC,EAAE,EAAE;KAChF;IACD;QACE,GAAG,4BAAW;QACd,cAAc,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAC,cAAc,CAAC,EAAE,EAAE;KAChF;CACO,CAAC;AAEJ,KAAK,UAAU,OAAO;IAC3B,MAAM,UAAU,GAAG,MAAM,0BAAa,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACrD,MAAM,OAAO,GAAM,MAAM,uBAAU,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAElD,IAAA,gBAAQ,EAAC,sCAAsC,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,UAAU,CAAC,CAAC;IAC5E,MAAM,KAAK,GAAQ,IAAI,CAAC,YAAY,EAAE,CAAC;IACvC,MAAM,UAAU,GAAyB,EAAE,CAAC;IAE5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,SAAS,GAAG,IAAI,CAAC,gBAAgB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AC1E,UAAU,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,MAAqB,CAAC,CAAC,CAAC,CAAC;IAC5E,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
|
|
2
|
+
export declare const description: readonly [{
|
|
3
|
+
readonly tableInput: import("n8n-workflow").INodeProperties;
|
|
4
|
+
readonly displayOptions: {
|
|
5
|
+
readonly show: {
|
|
6
|
+
readonly resource: readonly ["record"];
|
|
7
|
+
readonly operation: readonly ["deleteRecord"];
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
}, {
|
|
11
|
+
readonly displayName: "Record ID";
|
|
12
|
+
readonly name: "recordId";
|
|
13
|
+
readonly type: "string";
|
|
14
|
+
readonly default: "";
|
|
15
|
+
readonly required: true;
|
|
16
|
+
readonly displayOptions: {
|
|
17
|
+
readonly show: {
|
|
18
|
+
readonly resource: readonly ["record"];
|
|
19
|
+
readonly operation: readonly ["deleteRecord"];
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
readonly description: "The SmartSuite Record ID to delete";
|
|
23
|
+
}];
|
|
24
|
+
export declare function execute(this: IExecuteFunctions): Promise<INodeExecutionData[]>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// src/nodes/SmartSuite/actions/record/deleteRecord.operation.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.description = void 0;
|
|
5
|
+
exports.execute = execute;
|
|
6
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
7
|
+
const utils_1 = require("../../helpers/utils");
|
|
8
|
+
const smartSuiteApi_1 = require("../../transport/smartSuiteApi");
|
|
9
|
+
const validation_1 = require("../../helpers/validation");
|
|
10
|
+
const resourceInputs_1 = require("../../shared/resourceInputs");
|
|
11
|
+
exports.description = [
|
|
12
|
+
{
|
|
13
|
+
tableInput: resourceInputs_1.tableInput,
|
|
14
|
+
displayOptions: { show: { resource: ['record'], operation: ['deleteRecord'] } },
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
displayName: 'Record ID',
|
|
18
|
+
name: 'recordId',
|
|
19
|
+
type: 'string',
|
|
20
|
+
default: '',
|
|
21
|
+
required: true,
|
|
22
|
+
displayOptions: { show: { resource: ['record'], operation: ['deleteRecord'] } },
|
|
23
|
+
description: 'The SmartSuite Record ID to delete',
|
|
24
|
+
},
|
|
25
|
+
];
|
|
26
|
+
async function execute() {
|
|
27
|
+
const tableId = await validation_1.getTableId.call(this, 0);
|
|
28
|
+
(0, utils_1.debugLog)('[Record] deleteRecord.execute called', this.getNode().parameters);
|
|
29
|
+
const items = this.getInputData();
|
|
30
|
+
const returnData = [];
|
|
31
|
+
for (let i = 0; i < items.length; i++) {
|
|
32
|
+
const recordId = this.getNodeParameter('recordId', i);
|
|
33
|
+
if (!recordId.trim()) {
|
|
34
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Record ID is required for Delete Record operation.', { itemIndex: i });
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
await smartSuiteApi_1.apiRequest.call(this, 'DELETE', `/applications/${tableId}/records/${recordId}/`);
|
|
38
|
+
returnData.push(...this.helpers.returnJsonArray([{ success: true }]));
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
if (error.status === 404 || error.message?.includes('Not found')) {
|
|
42
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Record ID is not valid', { itemIndex: i });
|
|
43
|
+
}
|
|
44
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), error.message, { itemIndex: i });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return returnData;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=deleteRecord.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deleteRecord.operation.js","sourceRoot":"","sources":["../../../../../src/nodes/SmartSuite/actions/record/deleteRecord.operation.ts"],"names":[],"mappings":";AAAA,gEAAgE;;;AAyBhE,0BAqCC;AA3DD,+CAAkD;AAClD,+CAA+C;AAC/C,iEAA2D;AAC3D,yDAAsD;AACtD,gEAAyD;AAE5C,QAAA,WAAW,GAAG;IACzB;QACE,UAAU,EAAV,2BAAU;QACV,cAAc,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAC,cAAc,CAAC,EAAE,EAAE;KAChF;IACD;QACE,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;QACX,QAAQ,EAAE,IAAI;QACd,cAAc,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAC,cAAc,CAAC,EAAE,EAAE;QAC/E,WAAW,EAAE,oCAAoC;KAClD;CACO,CAAC;AAEJ,KAAK,UAAU,OAAO;IAC3B,MAAM,OAAO,GAAG,MAAM,uBAAU,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAE/C,IAAA,gBAAQ,EAAC,sCAAsC,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,UAAU,CAAC,CAAC;IAC5E,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,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,CAAC,CAAW,CAAC;QAChE,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC;YACrB,MAAM,IAAI,iCAAkB,CAC1B,IAAI,CAAC,OAAO,EAAE,EACd,oDAAoD,EACpD,EAAE,SAAS,EAAE,CAAC,EAAE,CACjB,CAAC;QACJ,CAAC;QAED,IAAI,CAAC;YACH,MAAM,0BAAU,CAAC,IAAI,CACnB,IAAI,EACJ,QAAQ,EACR,iBAAiB,OAAO,YAAY,QAAQ,GAAG,CAChD,CAAC;YACF,UAAU,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QACxE,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,IAAI,KAAK,CAAC,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;gBACjE,MAAM,IAAI,iCAAkB,CAC1B,IAAI,CAAC,OAAO,EAAE,EACd,wBAAwB,EACxB,EAAE,SAAS,EAAE,CAAC,EAAE,CACjB,CAAC;YACJ,CAAC;YACD,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC;QAChF,CAAC;IACH,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.execute = execute;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const utils_1 = require("../../helpers/utils");
|
|
6
|
+
const smartSuiteApi_1 = require("../../transport/smartSuiteApi");
|
|
7
|
+
const validation_1 = require("../../helpers/validation");
|
|
8
|
+
async function execute() {
|
|
9
|
+
const solutionId = await validation_1.getSolutionId.call(this, 0);
|
|
10
|
+
const tableId = await validation_1.getTableId.call(this, 0);
|
|
11
|
+
(0, utils_1.debugLog)('[Record] getRecord.execute called', this.getNode().parameters, 2);
|
|
12
|
+
const items = this.getInputData();
|
|
13
|
+
const returnData = [];
|
|
14
|
+
for (let i = 0; i < items.length; i++) {
|
|
15
|
+
const recordId = this.getNodeParameter('recordId', i);
|
|
16
|
+
if (!recordId.trim()) {
|
|
17
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Record ID is required for Get Record operation.', { itemIndex: i });
|
|
18
|
+
}
|
|
19
|
+
const hydrated = this.getNodeParameter('hydrated', i);
|
|
20
|
+
const qs = {};
|
|
21
|
+
if (hydrated) {
|
|
22
|
+
qs.hydrated = true;
|
|
23
|
+
}
|
|
24
|
+
(0, utils_1.debugLog)('[Record] getRecord.request', { solutionId, tableId, recordId, hydrated }, 2);
|
|
25
|
+
const response = (await smartSuiteApi_1.apiRequest.call(this, 'GET', `/applications/${tableId}/records/${recordId}`, {}, qs));
|
|
26
|
+
(0, utils_1.debugLog)('[Record] getRecord.response', response, 2);
|
|
27
|
+
returnData.push(...this.helpers.returnJsonArray([response]));
|
|
28
|
+
}
|
|
29
|
+
return returnData;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=getRecord.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getRecord.operation.js","sourceRoot":"","sources":["../../../../../src/nodes/SmartSuite/actions/record/getRecord.operation.ts"],"names":[],"mappings":";;AAOA,0BAwCC;AA7CD,+CAAkD;AAClD,+CAA+C;AAC/C,iEAA2D;AAC3D,yDAAqE;AAE9D,KAAK,UAAU,OAAO;IAG3B,MAAM,UAAU,GAAG,MAAM,0BAAa,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACrD,MAAM,OAAO,GAAM,MAAM,uBAAU,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAElD,IAAA,gBAAQ,EAAC,mCAAmC,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,UAAU,EAAE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|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.execute = execute;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const utils_1 = require("../../helpers/utils");
|
|
6
|
+
const smartSuiteApi_1 = require("../../transport/smartSuiteApi");
|
|
7
|
+
const validation_1 = require("../../helpers/validation");
|
|
8
|
+
async function execute() {
|
|
9
|
+
const solutionId = await validation_1.getSolutionId.call(this, 0);
|
|
10
|
+
const tableId = await validation_1.getTableId.call(this, 0);
|
|
11
|
+
(0, utils_1.debugLog)('[Record] listRecord.execute called', this.getNode().parameters, 2);
|
|
12
|
+
const items = this.getInputData();
|
|
13
|
+
const returnData = [];
|
|
14
|
+
for (let i = 0; i < items.length; i++) {
|
|
15
|
+
const hydrated = this.getNodeParameter('hydrated', i);
|
|
16
|
+
const returnAll = this.getNodeParameter('returnAll', i);
|
|
17
|
+
const limit = returnAll ? undefined : this.getNodeParameter('limit', i);
|
|
18
|
+
(0, utils_1.debugLog)('[Record] listRecord.request', { solutionId, tableId, hydrated, returnAll, limit }, 2);
|
|
19
|
+
let recordsArray = [];
|
|
20
|
+
try {
|
|
21
|
+
const body = { hydrated };
|
|
22
|
+
if (returnAll) {
|
|
23
|
+
// fetch all pages
|
|
24
|
+
recordsArray = await smartSuiteApi_1.paginatedRequest.call(this, 'POST', `/applications/${tableId}/records/list/`, body);
|
|
25
|
+
returnData.push(...this.helpers.returnJsonArray(recordsArray));
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
// single‐page case
|
|
29
|
+
body.limit = limit;
|
|
30
|
+
const resp = (await smartSuiteApi_1.apiRequest.call(this, 'POST', `/applications/${tableId}/records/list/`, body));
|
|
31
|
+
if (Array.isArray(resp)) {
|
|
32
|
+
recordsArray = resp;
|
|
33
|
+
}
|
|
34
|
+
else if (resp && typeof resp === 'object') {
|
|
35
|
+
recordsArray = resp.data ?? resp.items ?? resp.results ?? [];
|
|
36
|
+
}
|
|
37
|
+
// enforce client‐side limit
|
|
38
|
+
if (limit !== undefined && recordsArray.length > limit) {
|
|
39
|
+
const sliced = recordsArray.slice(0, limit);
|
|
40
|
+
returnData.push(...this.helpers.returnJsonArray(sliced));
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
returnData.push(...this.helpers.returnJsonArray(recordsArray));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), error.message, { itemIndex: i });
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return returnData;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=listRecord.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listRecord.operation.js","sourceRoot":"","sources":["../../../../../src/nodes/SmartSuite/actions/record/listRecord.operation.ts"],"names":[],"mappings":";;AAQA,0BAkEC;AAxED,+CAAkD;AAClD,+CAA+C;AAC/C,iEAA6E;AAE7E,yDAAqE;AAE9D,KAAK,UAAU,OAAO;IAG3B,MAAM,UAAU,GAAG,MAAM,0BAAa,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACrD,MAAM,OAAO,GAAM,MAAM,uBAAU,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAElD,IAAA,gBAAQ,EAAC,oCAAoC,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;IAC7E,MAAM,KAAK,GAAQ,IAAI,CAAC,YAAY,EAAE,CAAC;IACvC,MAAM,UAAU,GAAyB,EAAE,CAAC;IAE5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,QAAQ,GAAI,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,CAAC,CAAY,CAAC;QAClE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KAAK,KAAK,SAAS,IAAI,YAAY,CAAC,MAAM,GAAG,KAAK,EAAE,CAAC;gBACvD,MAAM,MAAM,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;gBAC5C,UAAU,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC;YAC3D,CAAC;iBAAM,CAAC;gBACN,UAAU,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC;YACjE,CAAC;QACH,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC;QAChF,CAAC;IACH,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// src/nodes/SmartSuite/actions/record/searchRecord.operation.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.execute = execute;
|
|
5
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
6
|
+
const utils_1 = require("../../helpers/utils");
|
|
7
|
+
const smartSuiteApi_1 = require("../../transport/smartSuiteApi");
|
|
8
|
+
const validation_1 = require("../../helpers/validation");
|
|
9
|
+
async function execute() {
|
|
10
|
+
// Read parameters
|
|
11
|
+
const returnAll = this.getNodeParameter('returnAll', 0);
|
|
12
|
+
const limit = this.getNodeParameter('limit', 0, 50);
|
|
13
|
+
const searchOp = this.getNodeParameter('searchOperator', 0).toLowerCase();
|
|
14
|
+
const hydrated = this.getNodeParameter('hydrated', 0);
|
|
15
|
+
const tableId = await validation_1.getTableId.call(this, 0);
|
|
16
|
+
// Build filters
|
|
17
|
+
const uiFilters = this.getNodeParameter('filters.filter', 0, []);
|
|
18
|
+
const apiFilters = uiFilters.map(f => ({
|
|
19
|
+
field: (0, utils_1.asIdString)(f.field),
|
|
20
|
+
comparison: f.condition,
|
|
21
|
+
value: f.value,
|
|
22
|
+
}));
|
|
23
|
+
let recordsArray = [];
|
|
24
|
+
try {
|
|
25
|
+
// First page
|
|
26
|
+
const body = { hydrated, offset: 0, limit };
|
|
27
|
+
if (apiFilters.length) {
|
|
28
|
+
body.filter = { operator: searchOp, fields: apiFilters };
|
|
29
|
+
}
|
|
30
|
+
(0, utils_1.debugLog)('[Record] apiRequest →', { method: 'POST', endpoint: `/tables/${tableId}/records/list/`, body }, 3);
|
|
31
|
+
const resp = (await smartSuiteApi_1.apiRequest.call(this, 'POST', `/tables/${tableId}/records/list/`, body));
|
|
32
|
+
(0, utils_1.debugLog)('[Record] apiResponse ←', resp, 3);
|
|
33
|
+
// Normalize
|
|
34
|
+
recordsArray = Array.isArray(resp)
|
|
35
|
+
? resp
|
|
36
|
+
: resp.data ?? resp.items ?? resp.results ?? [];
|
|
37
|
+
// If Return All is on, page through
|
|
38
|
+
if (returnAll) {
|
|
39
|
+
let offset = recordsArray.length;
|
|
40
|
+
while (recordsArray.length % limit === 0) {
|
|
41
|
+
const nextBody = { hydrated, offset, limit, filter: body.filter };
|
|
42
|
+
(0, utils_1.debugLog)('[Record] apiRequest (next page) →', { nextBody }, 3);
|
|
43
|
+
const nextResp = (await smartSuiteApi_1.apiRequest.call(this, 'POST', `/tables/${tableId}/records/list/`, nextBody));
|
|
44
|
+
(0, utils_1.debugLog)('[Record] apiResponse (next page) ←', nextResp, 3);
|
|
45
|
+
const pageItems = Array.isArray(nextResp)
|
|
46
|
+
? nextResp
|
|
47
|
+
: nextResp.data ?? nextResp.items ?? nextResp.results ?? [];
|
|
48
|
+
if (!pageItems.length) {
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
recordsArray.push(...pageItems);
|
|
52
|
+
offset += pageItems.length;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
(0, utils_1.debugLog)('[Record] caught error', error, 3);
|
|
58
|
+
if (error.statusCode === 400 &&
|
|
59
|
+
error.message?.toLowerCase().includes('not allowed comparison')) {
|
|
60
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Invalid comparison for that field type.', {
|
|
61
|
+
description: '[See valid operators](https://developers.smartsuite.com/docs/solution-data/records/sort-filter#operators-by-field-type)',
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), error.message);
|
|
65
|
+
}
|
|
66
|
+
// Enforce client-side limit
|
|
67
|
+
if (!returnAll && recordsArray.length > limit) {
|
|
68
|
+
recordsArray = recordsArray.slice(0, limit);
|
|
69
|
+
}
|
|
70
|
+
// If no records found
|
|
71
|
+
if (recordsArray.length === 0) {
|
|
72
|
+
return this.helpers.returnJsonArray([{ search: 'No records match' }]);
|
|
73
|
+
}
|
|
74
|
+
// Emit records
|
|
75
|
+
return this.helpers.returnJsonArray(recordsArray);
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=searchRecord.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"searchRecord.operation.js","sourceRoot":"","sources":["../../../../../src/nodes/SmartSuite/actions/record/searchRecord.operation.ts"],"names":[],"mappings":";AAAA,gEAAgE;;AAQhE,0BAuGC;AA5GD,+CAAkD;AAClD,+CAA2D;AAC3D,iEAA2D;AAC3D,yDAAsD;AAE/C,KAAK,UAAU,OAAO;IAG3B,kBAAkB;IAClB,MAAM,SAAS,GAAG,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,CAAC,CAAY,CAAC;IACnE,MAAM,KAAK,GAAO,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAM,CAAC,EAAE,EAAE,CAAW,CAAC;IACtE,MAAM,QAAQ,GAAK,IAAI,CAAC,gBAAgB,CAAC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C,CAAC,CAAC;QAC5C,IACE,KAAK,CAAC,UAAU,KAAK,GAAG;YACxB,KAAK,CAAC,OAAO,EAAE,WAAW,EAAE,CAAC,QAAQ,CAAC,wBAAwB,CAAC,EAC/D,CAAC;YACD,MAAM,IAAI,iCAAkB,CAC1B,IAAI,CAAC,OAAO,EAAE,EACd,yCAAyC,EACzC;gBACE,WAAW,EACT,yHAAyH;aAC5H,CACF,CAAC;QACJ,CAAC;QACD,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IAC9D,CAAC;IAED,4BAA4B;IAC5B,IAAI,CAAC,SAAS,IAAI,YAAY,CAAC,MAAM,GAAG,KAAK,EAAE,CAAC;QAC9C,YAAY,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IAC9C,CAAC;IAED,sBAAsB;IACtB,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9B,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAC,CAAC,CAAC;IACxE,CAAC;IAED,eAAe;IACf,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.execute = execute;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const utils_1 = require("../../helpers/utils");
|
|
6
|
+
const smartSuiteApi_1 = require("../../transport/smartSuiteApi");
|
|
7
|
+
const validation_1 = require("../../helpers/validation");
|
|
8
|
+
async function execute() {
|
|
9
|
+
const solutionId = await validation_1.getSolutionId.call(this, 0);
|
|
10
|
+
const tableId = await validation_1.getTableId.call(this, 0);
|
|
11
|
+
(0, utils_1.debugLog)('[Record] updateRecord.execute called', this.getNode().parameters, 2);
|
|
12
|
+
const items = this.getInputData();
|
|
13
|
+
const returnData = [];
|
|
14
|
+
for (let i = 0; i < items.length; i++) {
|
|
15
|
+
const recordId = this.getNodeParameter('recordId', i);
|
|
16
|
+
if (!recordId.trim()) {
|
|
17
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Record ID is required for Update Record operation.', { itemIndex: i });
|
|
18
|
+
}
|
|
19
|
+
const fieldsArr = this.getNodeParameter('fieldsUiUpdate.fieldsValues', i, []);
|
|
20
|
+
if (!fieldsArr.length) {
|
|
21
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'You must provide at least one field to update a record.', { itemIndex: i });
|
|
22
|
+
}
|
|
23
|
+
// Prevent updating system fields
|
|
24
|
+
for (const { field } of fieldsArr) {
|
|
25
|
+
const slug = (0, utils_1.asIdString)(field);
|
|
26
|
+
if ((0, utils_1.isReservedField)(slug)) {
|
|
27
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Cannot update system field “${slug}”.`, { itemIndex: i });
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
// Build request payload
|
|
31
|
+
const payload = fieldsArr.reduce((obj, { field, value }) => {
|
|
32
|
+
obj[(0, utils_1.asIdString)(field)] = value;
|
|
33
|
+
return obj;
|
|
34
|
+
}, {});
|
|
35
|
+
(0, utils_1.debugLog)('[Record] updateRecord.request', { solutionId, tableId, recordId, payload }, 2);
|
|
36
|
+
const response = (await smartSuiteApi_1.apiRequest.call(this, 'PATCH', `/applications/${tableId}/records/${recordId}/`, payload));
|
|
37
|
+
(0, utils_1.debugLog)('[Record] updateRecord.response', response, 2);
|
|
38
|
+
returnData.push(...this.helpers.returnJsonArray([response]));
|
|
39
|
+
}
|
|
40
|
+
return returnData;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=updateRecord.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updateRecord.operation.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,EAAE,IAAI,SAAS,EAAE,CAAC;YAClC,MAAM,IAAI,GAAG,IAAA,kBAAU,EAAC,KAAK,CAAC,CAAC;YAC/B,IAAI,IAAA,uBAAe,EAAC,IAAI,CAAC,EAAE,CAAC;gBAC1B,MAAM,IAAI,iCAAkB,CAC1B,IAAI,CAAC,OAAO,EAAE,EACd,+BAA+B,IAAI,IAAI,EACvC,EAAE,SAAS,EAAE,CAAC,EAAE,CACjB,CAAC;YACJ,CAAC;QACH,CAAC;QAED,wBAAwB;QACxB,MAAM,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,GAAgB,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE;YACtE,GAAG,CAAC,IAAA,kBAAU,EAAC,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC;YAC/B,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,IAAA,gBAAQ,EACN,+BAA+B,EAC/B,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,EAC1C,CAAC,CACF,CAAC;QACF,MAAM,QAAQ,GAAG,CAAC,MAAM,0BAAU,CAAC,IAAI,CACrC,IAAI,EACJ,OAAO,EACP,iBAAiB,OAAO,YAAY,QAAQ,GAAG,EAC/C,OAAO,CACR,CAAgB,CAAC;QAClB,IAAA,gBAAQ,EAAC,gCAAgC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;QAExD,UAAU,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC/D,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.execute = execute;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const utils_1 = require("../../helpers/utils");
|
|
6
|
+
const smartSuiteApi_1 = require("../../transport/smartSuiteApi");
|
|
7
|
+
const validation_1 = require("../../helpers/validation");
|
|
8
|
+
async function execute() {
|
|
9
|
+
// Get the table ID (application ID)
|
|
10
|
+
const tableId = await validation_1.getTableId.call(this, 0);
|
|
11
|
+
(0, utils_1.debugLog)('[UpsertRecord] execute', { tableId }, 2);
|
|
12
|
+
const items = this.getInputData();
|
|
13
|
+
const returnData = [];
|
|
14
|
+
for (let i = 0; i < items.length; i++) {
|
|
15
|
+
// 1) Matching criteria
|
|
16
|
+
const matchingField = this.getNodeParameter('matchingField', i);
|
|
17
|
+
const condition = this.getNodeParameter('condition', i);
|
|
18
|
+
const matchValue = this.getNodeParameter('matchValue', i);
|
|
19
|
+
if (!matchingField || !condition || !matchValue) {
|
|
20
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Matching Field, Condition, and Match Value are required for Upsert Record', { itemIndex: i });
|
|
21
|
+
}
|
|
22
|
+
// 2) Fields to upsert
|
|
23
|
+
const fieldsArr = this.getNodeParameter('fieldsUiUpdate.fieldsValues', i, []);
|
|
24
|
+
if (!fieldsArr.length) {
|
|
25
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'You must provide at least one field to upsert', { itemIndex: i });
|
|
26
|
+
}
|
|
27
|
+
// 3) Prevent reserved fields
|
|
28
|
+
for (const { field } of fieldsArr) {
|
|
29
|
+
const slug = (0, utils_1.asIdString)(field);
|
|
30
|
+
if ((0, utils_1.isReservedField)(slug)) {
|
|
31
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Cannot upsert system field “${slug}”.`, { itemIndex: i });
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
// 4) Build filter for existing-record lookup
|
|
35
|
+
const filter = {
|
|
36
|
+
operator: 'and',
|
|
37
|
+
fields: [{ field: matchingField, comparison: condition, value: matchValue }],
|
|
38
|
+
};
|
|
39
|
+
(0, utils_1.debugLog)('[UpsertRecord] searching for existing record', filter, 3);
|
|
40
|
+
// 5) List with limit=1 to find an existing record
|
|
41
|
+
const query = { limit: 1, offset: 0 };
|
|
42
|
+
const listResponse = (await smartSuiteApi_1.apiRequest.call(this, 'POST', `/applications/${tableId}/records/list/`, { filter }, query));
|
|
43
|
+
const results = listResponse.items || [];
|
|
44
|
+
// 6) Prepare payload
|
|
45
|
+
const payload = fieldsArr.reduce((obj, { field, value }) => {
|
|
46
|
+
obj[(0, utils_1.asIdString)(field)] = value;
|
|
47
|
+
return obj;
|
|
48
|
+
}, {});
|
|
49
|
+
let response;
|
|
50
|
+
if (results.length > 0) {
|
|
51
|
+
// 7a) Update existing
|
|
52
|
+
const existingId = results[0].id;
|
|
53
|
+
(0, utils_1.debugLog)(`[UpsertRecord] updating record ${existingId}`, payload, 2);
|
|
54
|
+
response = (await smartSuiteApi_1.apiRequest.call(this, 'PATCH', `/applications/${tableId}/records/${existingId}/`, payload));
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
// 7b) Create new
|
|
58
|
+
(0, utils_1.debugLog)('[UpsertRecord] creating new record', payload, 2);
|
|
59
|
+
response = (await smartSuiteApi_1.apiRequest.call(this, 'POST', `/applications/${tableId}/records/`, payload));
|
|
60
|
+
}
|
|
61
|
+
(0, utils_1.debugLog)('[UpsertRecord] response', response, 2);
|
|
62
|
+
returnData.push(...this.helpers.returnJsonArray([response]));
|
|
63
|
+
}
|
|
64
|
+
return returnData;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=upsertRecord.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upsertRecord.operation.js","sourceRoot":"","sources":["../../../../../src/nodes/SmartSuite/actions/record/upsertRecord.operation.ts"],"names":[],"mappings":";;AAOA,0BAqGC;AA1GD,+CAAkD;AAClD,+CAA4E;AAC5E,iEAA2D;AAC3D,yDAAsD;AAE/C,KAAK,UAAU,OAAO;IAG3B,oCAAoC;IACpC,MAAM,OAAO,GA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BAAQ,EAAC,kCAAkC,UAAU,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;YACrE,QAAQ,GAAG,CAAC,MAAM,0BAAU,CAAC,IAAI,CAC/B,IAAI,EACJ,OAAO,EACP,iBAAiB,OAAO,YAAY,UAAU,GAAG,EACjD,OAAO,CACR,CAAgB,CAAC;QACpB,CAAC;aAAM,CAAC;YACN,iBAAiB;YACjB,IAAA,gBAAQ,EAAC,oCAAoC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;YAC3D,QAAQ,GAAG,CAAC,MAAM,0BAAU,CAAC,IAAI,CAC/B,IAAI,EACJ,MAAM,EACN,iBAAiB,OAAO,WAAW,EACnC,OAAO,CACR,CAAgB,CAAC;QACpB,CAAC;QAED,IAAA,gBAAQ,EAAC,yBAAyB,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;QACjD,UAAU,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC/D,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// src/nodes/SmartSuite/actions/solution/SolutionDescription.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.solutionDescription = void 0;
|
|
5
|
+
const resourceInputs_1 = require("../../shared/resourceInputs");
|
|
6
|
+
exports.solutionDescription = [
|
|
7
|
+
{
|
|
8
|
+
displayName: 'Operation',
|
|
9
|
+
name: 'operation',
|
|
10
|
+
type: 'options',
|
|
11
|
+
noDataExpression: true,
|
|
12
|
+
displayOptions: { show: { resource: ['solution'] } },
|
|
13
|
+
options: [
|
|
14
|
+
{ name: 'List Solutions', value: 'listSolution', action: 'List Solutions', description: 'List all solutions' },
|
|
15
|
+
{ name: 'Get Solution', value: 'getSolution', action: 'Get Solution', description: 'Retrieve a solution by ID' },
|
|
16
|
+
],
|
|
17
|
+
default: 'listSolution',
|
|
18
|
+
description: 'The operation to perform on a Solution',
|
|
19
|
+
},
|
|
20
|
+
// List Solutions fields
|
|
21
|
+
{
|
|
22
|
+
displayName: 'Return All',
|
|
23
|
+
name: 'returnAll',
|
|
24
|
+
type: 'boolean',
|
|
25
|
+
default: false,
|
|
26
|
+
description: 'Return all solutions (paginated)',
|
|
27
|
+
displayOptions: {
|
|
28
|
+
show: { resource: ['solution'], operation: ['listSolution'] },
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
displayName: 'Limit',
|
|
33
|
+
name: 'limit',
|
|
34
|
+
type: 'number',
|
|
35
|
+
default: 50,
|
|
36
|
+
typeOptions: { minValue: 1, maxValue: 1000 },
|
|
37
|
+
description: 'Max number of results to return',
|
|
38
|
+
displayOptions: {
|
|
39
|
+
show: {
|
|
40
|
+
resource: ['solution'],
|
|
41
|
+
operation: ['listSolution'],
|
|
42
|
+
returnAll: [false],
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
// Get Solution field
|
|
47
|
+
{
|
|
48
|
+
...resourceInputs_1.solutionInput,
|
|
49
|
+
required: true,
|
|
50
|
+
displayOptions: { show: { resource: ['solution'], operation: ['getSolution'] } },
|
|
51
|
+
description: 'ID of the solution to retrieve',
|
|
52
|
+
},
|
|
53
|
+
];
|
|
54
|
+
//# sourceMappingURL=SolutionDescription.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SolutionDescription.js","sourceRoot":"","sources":["../../../../../src/nodes/SmartSuite/actions/solution/SolutionDescription.ts"],"names":[],"mappings":";AAAA,+DAA+D;;;AAG/D,gEAA4D;AAE/C,QAAA,mBAAmB,GAAsB;IACpD;QACE,WAAW,EAAO,WAAW;QAC7B,IAAI,EAAc,WAAW;QAC7B,IAAI,EAAc,SAAS;QAC3B,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAI,EAAE,IAAI,E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