@limetech/n8n-nodes-lime 0.1.0
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/.eslintrc.js +58 -0
- package/.github/copilot-instructions.md +20 -0
- package/.github/workflows/publish.yml +34 -0
- package/README.md +79 -0
- package/credentials/LimeCrmApi.credentials.ts +57 -0
- package/credentials/LimeGoApi.credentials.ts +31 -0
- package/dist/credentials/LimeCrmApi.credentials.d.ts +9 -0
- package/dist/credentials/LimeCrmApi.credentials.js +53 -0
- package/dist/credentials/LimeCrmApi.credentials.js.map +1 -0
- package/dist/credentials/LimeGoApi.credentials.d.ts +15 -0
- package/dist/credentials/LimeGoApi.credentials.js +32 -0
- package/dist/credentials/LimeGoApi.credentials.js.map +1 -0
- package/dist/nodes/lime-crm/GenericTypes.d.ts +80 -0
- package/dist/nodes/lime-crm/GenericTypes.js +7 -0
- package/dist/nodes/lime-crm/GenericTypes.js.map +1 -0
- package/dist/nodes/lime-crm/LimeCrm.node.json +18 -0
- package/dist/nodes/lime-crm/LimeCrmNode.node.d.ts +17 -0
- package/dist/nodes/lime-crm/LimeCrmNode.node.js +114 -0
- package/dist/nodes/lime-crm/LimeCrmNode.node.js.map +1 -0
- package/dist/nodes/lime-crm/LimeCrmTrigger/LimeCrmTrigger.node.d.ts +17 -0
- package/dist/nodes/lime-crm/LimeCrmTrigger/LimeCrmTrigger.node.js +408 -0
- package/dist/nodes/lime-crm/LimeCrmTrigger/LimeCrmTrigger.node.js.map +1 -0
- package/dist/nodes/lime-crm/LimeCrmTrigger.node.d.ts +17 -0
- package/dist/nodes/lime-crm/LimeCrmTrigger.node.js +439 -0
- package/dist/nodes/lime-crm/LimeCrmTrigger.node.js.map +1 -0
- package/dist/nodes/lime-crm/lime-crm.svg +1 -0
- package/dist/nodes/lime-crm/methods/getAllSortableFields.d.ts +7 -0
- package/dist/nodes/lime-crm/methods/getAllSortableFields.js +53 -0
- package/dist/nodes/lime-crm/methods/getAllSortableFields.js.map +1 -0
- package/dist/nodes/lime-crm/methods/getLimeTypeProperties.d.ts +3 -0
- package/dist/nodes/lime-crm/methods/getLimeTypeProperties.js +40 -0
- package/dist/nodes/lime-crm/methods/getLimeTypeProperties.js.map +1 -0
- package/dist/nodes/lime-crm/methods/getLimeTypeRelations.d.ts +7 -0
- package/dist/nodes/lime-crm/methods/getLimeTypeRelations.js +30 -0
- package/dist/nodes/lime-crm/methods/getLimeTypeRelations.js.map +1 -0
- package/dist/nodes/lime-crm/methods/getLimeTypes.d.ts +3 -0
- package/dist/nodes/lime-crm/methods/getLimeTypes.js +33 -0
- package/dist/nodes/lime-crm/methods/getLimeTypes.js.map +1 -0
- package/dist/nodes/lime-crm/methods/getRelatedTypeProperties.d.ts +7 -0
- package/dist/nodes/lime-crm/methods/getRelatedTypeProperties.js +39 -0
- package/dist/nodes/lime-crm/methods/getRelatedTypeProperties.js.map +1 -0
- package/dist/nodes/lime-crm/methods/index.d.ts +5 -0
- package/dist/nodes/lime-crm/methods/index.js +14 -0
- package/dist/nodes/lime-crm/methods/index.js.map +1 -0
- package/dist/nodes/lime-crm/resources/limeObject/commonFields.d.ts +4 -0
- package/dist/nodes/lime-crm/resources/limeObject/commonFields.js +165 -0
- package/dist/nodes/lime-crm/resources/limeObject/commonFields.js.map +1 -0
- package/dist/nodes/lime-crm/resources/limeObject/index.d.ts +6 -0
- package/dist/nodes/lime-crm/resources/limeObject/index.js +79 -0
- package/dist/nodes/lime-crm/resources/limeObject/index.js.map +1 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/common.operation.d.ts +2 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/common.operation.js +36 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/common.operation.js.map +1 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/create.operation.d.ts +9 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/create.operation.js +234 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/create.operation.js.map +1 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/delete.operation.d.ts +9 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/delete.operation.js +136 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/delete.operation.js.map +1 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/get.operation.d.ts +9 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/get.operation.js +125 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/get.operation.js.map +1 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/getAll.operation.d.ts +3 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/getAll.operation.js +212 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/getAll.operation.js.map +1 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/search.operation.d.ts +9 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/search.operation.js +232 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/search.operation.js.map +1 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/update.operation.d.ts +9 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/update.operation.js +186 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/update.operation.js.map +1 -0
- package/dist/nodes/lime-crm/resources/limeType/index.d.ts +6 -0
- package/dist/nodes/lime-crm/resources/limeType/index.js +81 -0
- package/dist/nodes/lime-crm/resources/limeType/index.js.map +1 -0
- package/dist/nodes/lime-crm/resources/limeType/operations/getProperties.operation.d.ts +9 -0
- package/dist/nodes/lime-crm/resources/limeType/operations/getProperties.operation.js +112 -0
- package/dist/nodes/lime-crm/resources/limeType/operations/getProperties.operation.js.map +1 -0
- package/dist/nodes/lime-crm/resources/limeType/operations/getRelations.operation.d.ts +9 -0
- package/dist/nodes/lime-crm/resources/limeType/operations/getRelations.operation.js +112 -0
- package/dist/nodes/lime-crm/resources/limeType/operations/getRelations.operation.js.map +1 -0
- package/dist/nodes/lime-crm/resources/limeType/operations/getType.operation.d.ts +9 -0
- package/dist/nodes/lime-crm/resources/limeType/operations/getType.operation.js +70 -0
- package/dist/nodes/lime-crm/resources/limeType/operations/getType.operation.js.map +1 -0
- package/dist/nodes/lime-crm/resources/limeType/operations/listTypes.operation.d.ts +9 -0
- package/dist/nodes/lime-crm/resources/limeType/operations/listTypes.operation.js +86 -0
- package/dist/nodes/lime-crm/resources/limeType/operations/listTypes.operation.js.map +1 -0
- package/dist/nodes/lime-crm/resources/queryApi/index.d.ts +6 -0
- package/dist/nodes/lime-crm/resources/queryApi/index.js +57 -0
- package/dist/nodes/lime-crm/resources/queryApi/index.js.map +1 -0
- package/dist/nodes/lime-crm/resources/queryApi/operations/executeQuery.operation.d.ts +9 -0
- package/dist/nodes/lime-crm/resources/queryApi/operations/executeQuery.operation.js +559 -0
- package/dist/nodes/lime-crm/resources/queryApi/operations/executeQuery.operation.js.map +1 -0
- package/dist/nodes/lime-crm/transport/index.d.ts +2 -0
- package/dist/nodes/lime-crm/transport/index.js +50 -0
- package/dist/nodes/lime-crm/transport/index.js.map +1 -0
- package/dist/nodes/lime-go/LimeGo.node.d.ts +8 -0
- package/dist/nodes/lime-go/LimeGo.node.js +123 -0
- package/dist/nodes/lime-go/LimeGo.node.js.map +1 -0
- package/dist/nodes/lime-go/actions/organization/get.operation.d.ts +5 -0
- package/dist/nodes/lime-go/actions/organization/get.operation.js +39 -0
- package/dist/nodes/lime-go/actions/organization/get.operation.js.map +1 -0
- package/dist/nodes/lime-go/actions/organization/getByExternalKey.operation.d.ts +5 -0
- package/dist/nodes/lime-go/actions/organization/getByExternalKey.operation.js +54 -0
- package/dist/nodes/lime-go/actions/organization/getByExternalKey.operation.js.map +1 -0
- package/dist/nodes/lime-go/actions/organization/index.d.ts +7 -0
- package/dist/nodes/lime-go/actions/organization/index.js +92 -0
- package/dist/nodes/lime-go/actions/organization/index.js.map +1 -0
- package/dist/nodes/lime-go/actions/organization/organizationFields.d.ts +2 -0
- package/dist/nodes/lime-go/actions/organization/organizationFields.js +162 -0
- package/dist/nodes/lime-go/actions/organization/organizationFields.js.map +1 -0
- package/dist/nodes/lime-go/actions/organization/search.operation.d.ts +5 -0
- package/dist/nodes/lime-go/actions/organization/search.operation.js +70 -0
- package/dist/nodes/lime-go/actions/organization/search.operation.js.map +1 -0
- package/dist/nodes/lime-go/actions/organization/update.operation.d.ts +5 -0
- package/dist/nodes/lime-go/actions/organization/update.operation.js +125 -0
- package/dist/nodes/lime-go/actions/organization/update.operation.js.map +1 -0
- package/dist/nodes/lime-go/actions/person/createMail.operation.d.ts +7 -0
- package/dist/nodes/lime-go/actions/person/createMail.operation.js +130 -0
- package/dist/nodes/lime-go/actions/person/createMail.operation.js.map +1 -0
- package/dist/nodes/lime-go/actions/person/get.operation.d.ts +7 -0
- package/dist/nodes/lime-go/actions/person/get.operation.js +45 -0
- package/dist/nodes/lime-go/actions/person/get.operation.js.map +1 -0
- package/dist/nodes/lime-go/actions/person/index.d.ts +7 -0
- package/dist/nodes/lime-go/actions/person/index.js +92 -0
- package/dist/nodes/lime-go/actions/person/index.js.map +1 -0
- package/dist/nodes/lime-go/actions/person/personFields.d.ts +2 -0
- package/dist/nodes/lime-go/actions/person/personFields.js +134 -0
- package/dist/nodes/lime-go/actions/person/personFields.js.map +1 -0
- package/dist/nodes/lime-go/actions/person/search.operation.d.ts +7 -0
- package/dist/nodes/lime-go/actions/person/search.operation.js +81 -0
- package/dist/nodes/lime-go/actions/person/search.operation.js.map +1 -0
- package/dist/nodes/lime-go/actions/person/update.operation.d.ts +7 -0
- package/dist/nodes/lime-go/actions/person/update.operation.js +104 -0
- package/dist/nodes/lime-go/actions/person/update.operation.js.map +1 -0
- package/dist/nodes/lime-go/lime-go.svg +1 -0
- package/dist/nodes/lime-go/transport/graphqlRequest.d.ts +2 -0
- package/dist/nodes/lime-go/transport/graphqlRequest.js +23 -0
- package/dist/nodes/lime-go/transport/graphqlRequest.js.map +1 -0
- package/dist/nodes/lime-go/transport/transport.d.ts +3 -0
- package/dist/nodes/lime-go/transport/transport.js +58 -0
- package/dist/nodes/lime-go/transport/transport.js.map +1 -0
- package/dist/nodes/lime-go/triggers/webhook.d.ts +10 -0
- package/dist/nodes/lime-go/triggers/webhook.js +92 -0
- package/dist/nodes/lime-go/triggers/webhook.js.map +1 -0
- package/dist/package.json +49 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/docker-compose.yml +44 -0
- package/index.js +3 -0
- package/nodes/lime-crm/GenericTypes.ts +114 -0
- package/nodes/lime-crm/LimeCrm.node.json +18 -0
- package/nodes/lime-crm/LimeCrmNode.node.ts +154 -0
- package/nodes/lime-crm/LimeCrmTrigger/LimeCrmTrigger.node.ts +461 -0
- package/nodes/lime-crm/LimeCrmTrigger.node.ts +505 -0
- package/nodes/lime-crm/lime-crm.svg +1 -0
- package/nodes/lime-crm/methods/getAllSortableFields.ts +73 -0
- package/nodes/lime-crm/methods/getLimeTypeProperties.ts +48 -0
- package/nodes/lime-crm/methods/getLimeTypeRelations.ts +32 -0
- package/nodes/lime-crm/methods/getLimeTypes.ts +33 -0
- package/nodes/lime-crm/methods/getRelatedTypeProperties.ts +47 -0
- package/nodes/lime-crm/methods/index.ts +5 -0
- package/nodes/lime-crm/resources/limeObject/commonFields.ts +179 -0
- package/nodes/lime-crm/resources/limeObject/index.ts +64 -0
- package/nodes/lime-crm/resources/limeObject/operations/common.operation.ts +35 -0
- package/nodes/lime-crm/resources/limeObject/operations/create.operation.ts +234 -0
- package/nodes/lime-crm/resources/limeObject/operations/delete.operation.ts +136 -0
- package/nodes/lime-crm/resources/limeObject/operations/get.operation.ts +124 -0
- package/nodes/lime-crm/resources/limeObject/operations/getAll.operation.ts +242 -0
- package/nodes/lime-crm/resources/limeObject/operations/search.operation.ts +242 -0
- package/nodes/lime-crm/resources/limeObject/operations/update.operation.ts +201 -0
- package/nodes/lime-crm/resources/limeType/index.ts +66 -0
- package/nodes/lime-crm/resources/limeType/operations/getProperties.operation.ts +105 -0
- package/nodes/lime-crm/resources/limeType/operations/getRelations.operation.ts +105 -0
- package/nodes/lime-crm/resources/limeType/operations/getType.operation.ts +58 -0
- package/nodes/lime-crm/resources/limeType/operations/listTypes.operation.ts +76 -0
- package/nodes/lime-crm/resources/queryApi/index.ts +42 -0
- package/nodes/lime-crm/resources/queryApi/operations/executeQuery.operation.ts +605 -0
- package/nodes/lime-crm/transport/index.ts +74 -0
- package/nodes/lime-go/LimeGo.node.ts +146 -0
- package/nodes/lime-go/actions/organization/get.operation.ts +42 -0
- package/nodes/lime-go/actions/organization/getByExternalKey.operation.ts +57 -0
- package/nodes/lime-go/actions/organization/index.ts +69 -0
- package/nodes/lime-go/actions/organization/organizationFields.ts +160 -0
- package/nodes/lime-go/actions/organization/search.operation.ts +73 -0
- package/nodes/lime-go/actions/organization/update.operation.ts +140 -0
- package/nodes/lime-go/actions/person/createMail.operation.ts +140 -0
- package/nodes/lime-go/actions/person/get.operation.ts +51 -0
- package/nodes/lime-go/actions/person/index.ts +69 -0
- package/nodes/lime-go/actions/person/personFields.ts +132 -0
- package/nodes/lime-go/actions/person/search.operation.ts +88 -0
- package/nodes/lime-go/actions/person/update.operation.ts +122 -0
- package/nodes/lime-go/lime-go.svg +1 -0
- package/nodes/lime-go/transport/graphqlRequest.ts +30 -0
- package/package.json +50 -0
- package/tsconfig.json +30 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.execute = exports.description = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const transport_1 = require("../../../transport");
|
|
6
|
+
exports.description = [
|
|
7
|
+
{
|
|
8
|
+
displayName: 'Return All',
|
|
9
|
+
name: 'returnAll',
|
|
10
|
+
type: 'boolean',
|
|
11
|
+
displayOptions: {
|
|
12
|
+
show: {
|
|
13
|
+
resource: [
|
|
14
|
+
'limeObject',
|
|
15
|
+
],
|
|
16
|
+
operation: [
|
|
17
|
+
'getAll',
|
|
18
|
+
],
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
default: false,
|
|
22
|
+
description: 'Whether to return all results or only up to a limit',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
displayName: 'Limit',
|
|
26
|
+
name: 'limit',
|
|
27
|
+
type: 'number',
|
|
28
|
+
displayOptions: {
|
|
29
|
+
show: {
|
|
30
|
+
resource: [
|
|
31
|
+
'limeObject',
|
|
32
|
+
],
|
|
33
|
+
operation: [
|
|
34
|
+
'getAll',
|
|
35
|
+
],
|
|
36
|
+
returnAll: [
|
|
37
|
+
false,
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
typeOptions: {
|
|
42
|
+
minValue: 1,
|
|
43
|
+
maxValue: 1000,
|
|
44
|
+
},
|
|
45
|
+
default: 100,
|
|
46
|
+
description: 'Max number of results to return',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
displayName: 'Sort By',
|
|
50
|
+
name: 'sortField',
|
|
51
|
+
type: 'options',
|
|
52
|
+
typeOptions: {
|
|
53
|
+
loadOptionsMethod: 'getLimeTypeProperties',
|
|
54
|
+
loadOptionsDependsOn: ['limeType'],
|
|
55
|
+
},
|
|
56
|
+
default: '',
|
|
57
|
+
description: 'Field to sort by',
|
|
58
|
+
displayOptions: {
|
|
59
|
+
show: {
|
|
60
|
+
resource: [
|
|
61
|
+
'limeObject',
|
|
62
|
+
],
|
|
63
|
+
operation: [
|
|
64
|
+
'getAll',
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
displayName: 'Sort Direction',
|
|
71
|
+
name: 'sortDirection',
|
|
72
|
+
type: 'options',
|
|
73
|
+
options: [
|
|
74
|
+
{
|
|
75
|
+
name: 'Ascending',
|
|
76
|
+
value: 'asc',
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: 'Descending',
|
|
80
|
+
value: 'desc',
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
default: 'asc',
|
|
84
|
+
description: 'Direction to sort in',
|
|
85
|
+
displayOptions: {
|
|
86
|
+
show: {
|
|
87
|
+
resource: [
|
|
88
|
+
'limeObject',
|
|
89
|
+
],
|
|
90
|
+
operation: [
|
|
91
|
+
'getAll',
|
|
92
|
+
],
|
|
93
|
+
sortField: [],
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
displayName: 'Use Filter',
|
|
99
|
+
name: 'useFilter',
|
|
100
|
+
type: 'boolean',
|
|
101
|
+
default: false,
|
|
102
|
+
description: 'Whether to use a filter',
|
|
103
|
+
displayOptions: {
|
|
104
|
+
show: {
|
|
105
|
+
resource: [
|
|
106
|
+
'limeObject',
|
|
107
|
+
],
|
|
108
|
+
operation: [
|
|
109
|
+
'getAll',
|
|
110
|
+
],
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
displayName: 'Filter',
|
|
116
|
+
name: 'advancedFilter',
|
|
117
|
+
type: 'json',
|
|
118
|
+
default: '{\n "property": "name",\n "value": "search term",\n "operator": "contains"\n}',
|
|
119
|
+
description: 'Filter in JSON format',
|
|
120
|
+
typeOptions: {
|
|
121
|
+
alwaysOpenEditWindow: true,
|
|
122
|
+
},
|
|
123
|
+
displayOptions: {
|
|
124
|
+
show: {
|
|
125
|
+
resource: [
|
|
126
|
+
'limeObject',
|
|
127
|
+
],
|
|
128
|
+
operation: [
|
|
129
|
+
'getAll',
|
|
130
|
+
],
|
|
131
|
+
useFilter: [
|
|
132
|
+
true,
|
|
133
|
+
],
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
];
|
|
138
|
+
async function execute(i) {
|
|
139
|
+
var _a, _b;
|
|
140
|
+
const limeType = this.getNodeParameter('limeType', i);
|
|
141
|
+
const returnAll = this.getNodeParameter('returnAll', i);
|
|
142
|
+
const limit = returnAll ? 0 : this.getNodeParameter('limit', i, 100);
|
|
143
|
+
const sortField = this.getNodeParameter('sortField', i, '');
|
|
144
|
+
const useFilter = this.getNodeParameter('useFilter', i, false);
|
|
145
|
+
const options = this.getNodeParameter('options', i, {});
|
|
146
|
+
const rawResponse = options.rawResponse || false;
|
|
147
|
+
const qs = {};
|
|
148
|
+
if (!returnAll) {
|
|
149
|
+
qs._limit = limit;
|
|
150
|
+
}
|
|
151
|
+
if (sortField) {
|
|
152
|
+
const sortDirection = this.getNodeParameter('sortDirection', i, 'asc');
|
|
153
|
+
qs._sort = `${sortField}:${sortDirection}`;
|
|
154
|
+
}
|
|
155
|
+
if (useFilter) {
|
|
156
|
+
try {
|
|
157
|
+
const advancedFilter = this.getNodeParameter('advancedFilter', i);
|
|
158
|
+
const filterObject = typeof advancedFilter === 'string'
|
|
159
|
+
? JSON.parse(advancedFilter)
|
|
160
|
+
: advancedFilter;
|
|
161
|
+
qs._filter = JSON.stringify(filterObject);
|
|
162
|
+
}
|
|
163
|
+
catch (error) {
|
|
164
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Invalid JSON filter: ' + error.message);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if (options.includeRelated) {
|
|
168
|
+
qs._embed = 'all';
|
|
169
|
+
}
|
|
170
|
+
const endpoint = `/api/v1/limeobject/${limeType}/`;
|
|
171
|
+
if (returnAll) {
|
|
172
|
+
const returnData = [];
|
|
173
|
+
let hasMoreData = true;
|
|
174
|
+
let offset = 0;
|
|
175
|
+
const pageLimit = 100;
|
|
176
|
+
while (hasMoreData) {
|
|
177
|
+
qs._limit = pageLimit;
|
|
178
|
+
qs._offset = offset;
|
|
179
|
+
const response = await transport_1.apiRequest.call(this, {
|
|
180
|
+
method: 'GET',
|
|
181
|
+
url: endpoint,
|
|
182
|
+
qs,
|
|
183
|
+
});
|
|
184
|
+
const items = ((_a = response._embedded) === null || _a === void 0 ? void 0 : _a.limeobjects) || [];
|
|
185
|
+
if (items.length === 0) {
|
|
186
|
+
hasMoreData = false;
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
returnData.push(...items);
|
|
190
|
+
offset += items.length;
|
|
191
|
+
if (items.length < pageLimit) {
|
|
192
|
+
hasMoreData = false;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return rawResponse
|
|
197
|
+
? { _embedded: { limeobjects: returnData } }
|
|
198
|
+
: returnData;
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
const response = await transport_1.apiRequest.call(this, {
|
|
202
|
+
method: 'GET',
|
|
203
|
+
url: endpoint,
|
|
204
|
+
qs,
|
|
205
|
+
});
|
|
206
|
+
return rawResponse
|
|
207
|
+
? response
|
|
208
|
+
: ((_b = response._embedded) === null || _b === void 0 ? void 0 : _b.limeobjects) || [];
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
exports.execute = execute;
|
|
212
|
+
//# sourceMappingURL=getAll.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getAll.operation.js","sourceRoot":"","sources":["../../../../../../nodes/lime-crm/resources/limeObject/operations/getAll.operation.ts"],"names":[],"mappings":";;;AAAA,+CAKsB;AACtB,kDAAgD;AAGnC,QAAA,WAAW,GAAsB;IAC1C;QACI,WAAW,EAAE,YAAY;QACzB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,cAAc,EAAE;YACZ,IAAI,EAAE;gBACF,QAAQ,EAAE;oBACN,YAAY;iBACf;gBACD,SAAS,EAAE;oBACP,QAAQ;iBACX;aACJ;SACJ;QACD,OAAO,EAAE,KAAK;QACd,WAAW,EAAE,qDAAqD;KACrE;IACD;QACI,WAAW,EAAE,OAAO;QACpB,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,QAAQ;QACd,cAAc,EAAE;YACZ,IAAI,EAAE;gBACF,QAAQ,EAAE;oBACN,YAAY;iBACf;gBACD,SAAS,EAAE;oBACP,QAAQ;iBACX;gBACD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AM,KAAK,CAAC,EAAE;gBACpB,WAAW,GAAG,KAAK,CAAC;aACvB;iBAAM;gBACH,UAAU,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC;gBAC1B,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC;gBAGvB,IAAI,KAAK,CAAC,MAAM,GAAG,SAAS,EAAE;oBAC1B,WAAW,GAAG,KAAK,CAAC;iBACvB;aACJ;SACJ;QAED,OAAO,WAAW;YACd,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,EAAE;YAC5C,CAAC,CAAC,UAAU,CAAC;KAEpB;SAAM;QAEH,MAAM,QAAQ,GAAG,MAAM,sBAAU,CAAC,IAAI,CAClC,IAAI,EACJ;YACI,MAAM,EAAE,KAAK;YACb,GAAG,EAAE,QAAQ;YACb,EAAE;SACL,CACJ,CAAC;QAEF,OAAO,WAAW;YACd,CAAC,CAAC,QAAQ;YACV,CAAC,CAAC,CAAA,MAAA,QAAQ,CAAC,SAAS,0CAAE,WAAW,KAAI,EAAE,CAAC;KAC/C;AACL,CAAC;AAhGD,0BAgGC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IExecuteFunctions, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare const description: {
|
|
3
|
+
name: string;
|
|
4
|
+
value: string;
|
|
5
|
+
description: string;
|
|
6
|
+
action: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const properties: INodeProperties[];
|
|
9
|
+
export declare function execute(this: IExecuteFunctions, i: number): Promise<any>;
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.execute = exports.properties = exports.description = void 0;
|
|
27
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
28
|
+
exports.description = {
|
|
29
|
+
name: 'Search',
|
|
30
|
+
value: 'search',
|
|
31
|
+
description: 'Search for objects',
|
|
32
|
+
action: 'Search for objects',
|
|
33
|
+
};
|
|
34
|
+
exports.properties = [
|
|
35
|
+
{
|
|
36
|
+
displayName: 'Lime Type',
|
|
37
|
+
name: 'limeType',
|
|
38
|
+
type: 'options',
|
|
39
|
+
typeOptions: {
|
|
40
|
+
loadOptionsMethod: 'getLimeTypes',
|
|
41
|
+
},
|
|
42
|
+
required: true,
|
|
43
|
+
default: '',
|
|
44
|
+
description: 'The type of entity to search for',
|
|
45
|
+
displayOptions: {
|
|
46
|
+
show: {
|
|
47
|
+
resource: [
|
|
48
|
+
'limeObject',
|
|
49
|
+
],
|
|
50
|
+
operation: [
|
|
51
|
+
'search',
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
displayName: 'Search Term',
|
|
58
|
+
name: 'searchTerm',
|
|
59
|
+
type: 'string',
|
|
60
|
+
default: '',
|
|
61
|
+
description: 'Term to search for',
|
|
62
|
+
displayOptions: {
|
|
63
|
+
show: {
|
|
64
|
+
resource: [
|
|
65
|
+
'limeObject',
|
|
66
|
+
],
|
|
67
|
+
operation: [
|
|
68
|
+
'search',
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
displayName: 'Search Fields',
|
|
75
|
+
name: 'searchFields',
|
|
76
|
+
type: 'multiOptions',
|
|
77
|
+
typeOptions: {
|
|
78
|
+
loadOptionsMethod: 'getLimeTypeProperties',
|
|
79
|
+
loadOptionsDependsOn: ['limeType'],
|
|
80
|
+
},
|
|
81
|
+
default: [],
|
|
82
|
+
description: 'Fields to search in. If none selected, searches across all searchable fields',
|
|
83
|
+
displayOptions: {
|
|
84
|
+
show: {
|
|
85
|
+
resource: [
|
|
86
|
+
'limeObject',
|
|
87
|
+
],
|
|
88
|
+
operation: [
|
|
89
|
+
'search',
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
displayName: 'Return All',
|
|
96
|
+
name: 'returnAll',
|
|
97
|
+
type: 'boolean',
|
|
98
|
+
default: false,
|
|
99
|
+
description: 'Whether to return all results or only up to a limit',
|
|
100
|
+
displayOptions: {
|
|
101
|
+
show: {
|
|
102
|
+
resource: [
|
|
103
|
+
'limeObject',
|
|
104
|
+
],
|
|
105
|
+
operation: [
|
|
106
|
+
'search',
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
displayName: 'Limit',
|
|
113
|
+
name: 'limit',
|
|
114
|
+
type: 'number',
|
|
115
|
+
default: 50,
|
|
116
|
+
description: 'Max number of results to return',
|
|
117
|
+
typeOptions: {
|
|
118
|
+
minValue: 1,
|
|
119
|
+
},
|
|
120
|
+
displayOptions: {
|
|
121
|
+
show: {
|
|
122
|
+
resource: [
|
|
123
|
+
'limeObject',
|
|
124
|
+
],
|
|
125
|
+
operation: [
|
|
126
|
+
'search',
|
|
127
|
+
],
|
|
128
|
+
returnAll: [
|
|
129
|
+
false,
|
|
130
|
+
],
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
displayName: 'Options',
|
|
136
|
+
name: 'options',
|
|
137
|
+
type: 'collection',
|
|
138
|
+
placeholder: 'Add Option',
|
|
139
|
+
default: {},
|
|
140
|
+
displayOptions: {
|
|
141
|
+
show: {
|
|
142
|
+
resource: [
|
|
143
|
+
'limeObject',
|
|
144
|
+
],
|
|
145
|
+
operation: [
|
|
146
|
+
'search',
|
|
147
|
+
],
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
options: [
|
|
151
|
+
{
|
|
152
|
+
displayName: 'Include Related Objects',
|
|
153
|
+
name: 'includeRelated',
|
|
154
|
+
type: 'boolean',
|
|
155
|
+
default: false,
|
|
156
|
+
description: 'Whether to include related objects in the response',
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
displayName: 'Sort Field',
|
|
160
|
+
name: 'sortField',
|
|
161
|
+
type: 'options',
|
|
162
|
+
typeOptions: {
|
|
163
|
+
loadOptionsMethod: 'getLimeTypeProperties',
|
|
164
|
+
loadOptionsDependsOn: ['limeType'],
|
|
165
|
+
},
|
|
166
|
+
default: '',
|
|
167
|
+
description: 'Field to sort results by',
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
displayName: 'Sort Direction',
|
|
171
|
+
name: 'sortDirection',
|
|
172
|
+
type: 'options',
|
|
173
|
+
options: [
|
|
174
|
+
{
|
|
175
|
+
name: 'Ascending',
|
|
176
|
+
value: 'asc',
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
name: 'Descending',
|
|
180
|
+
value: 'desc',
|
|
181
|
+
},
|
|
182
|
+
],
|
|
183
|
+
default: 'asc',
|
|
184
|
+
description: 'Direction to sort results',
|
|
185
|
+
},
|
|
186
|
+
],
|
|
187
|
+
},
|
|
188
|
+
];
|
|
189
|
+
async function execute(i) {
|
|
190
|
+
var _a;
|
|
191
|
+
const { apiRequest } = await Promise.resolve().then(() => __importStar(require('../../../transport')));
|
|
192
|
+
const limeType = this.getNodeParameter('limeType', i);
|
|
193
|
+
const searchTerm = this.getNodeParameter('searchTerm', i, '');
|
|
194
|
+
const searchFields = this.getNodeParameter('searchFields', i, []);
|
|
195
|
+
const returnAll = this.getNodeParameter('returnAll', i);
|
|
196
|
+
const limit = returnAll ? 0 : this.getNodeParameter('limit', i, 50);
|
|
197
|
+
const options = this.getNodeParameter('options', i, {});
|
|
198
|
+
if (!limeType) {
|
|
199
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Lime type must be provided');
|
|
200
|
+
}
|
|
201
|
+
const endpoint = `/api/v1/limeobject/${encodeURIComponent(limeType)}/search/`;
|
|
202
|
+
const queryParams = {};
|
|
203
|
+
if (searchTerm) {
|
|
204
|
+
queryParams.q = searchTerm;
|
|
205
|
+
}
|
|
206
|
+
if (searchFields && searchFields.length > 0) {
|
|
207
|
+
queryParams.fields = searchFields.join(',');
|
|
208
|
+
}
|
|
209
|
+
if (!returnAll && limit > 0) {
|
|
210
|
+
queryParams._limit = limit;
|
|
211
|
+
}
|
|
212
|
+
if (options.sortField) {
|
|
213
|
+
const sortDirection = options.sortDirection || 'asc';
|
|
214
|
+
queryParams._sort = `${options.sortField}:${sortDirection}`;
|
|
215
|
+
}
|
|
216
|
+
if (options.includeRelated === true) {
|
|
217
|
+
queryParams._embed = 'all';
|
|
218
|
+
}
|
|
219
|
+
try {
|
|
220
|
+
const response = await apiRequest.call(this, {
|
|
221
|
+
method: 'GET',
|
|
222
|
+
endpoint,
|
|
223
|
+
qs: queryParams,
|
|
224
|
+
});
|
|
225
|
+
return ((_a = response._embedded) === null || _a === void 0 ? void 0 : _a.limeobjects) || [];
|
|
226
|
+
}
|
|
227
|
+
catch (error) {
|
|
228
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Failed to search for ${limeType} objects: ${error.message}`);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
exports.execute = execute;
|
|
232
|
+
//# sourceMappingURL=search.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.operation.js","sourceRoot":"","sources":["../../../../../../nodes/lime-crm/resources/limeObject/operations/search.operation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAKsB;AAET,QAAA,WAAW,GAAG;IACvB,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,QAAQ;IACf,WAAW,EAAE,oBAAoB;IACjC,MAAM,EAAE,oBAAoB;CAC/B,CAAC;AAEW,QAAA,UAAU,GAAsB;IAEzC;QACI,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,SAAS;QACf,WAAW,EAAE;YACT,iBAAiB,EAAE,cAAc;SACpC;QACD,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,kCAAkC;QAC/C,cAAc,EAAE;YACZ,IAAI,EAAE;gBACF,QAAQ,EAAE;oBACN,YAAY;iBACf;gBACD,SAAS,EAAE;oBACP,QAAQ;iBACX;aACJ;SACJ;KACJ;IAGD;QACI,WAAW,EAAE,aAAa;QAC1B,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,oBAAoB;QACjC,cAAc,EAAE;YACZ,IAAI,EAAE;gBACF,QAAQ,EAAE;oBACN,YAAY;iBACf;gBACD,SAAS,EAAE;oBACP,QAAQ;iBACX;aACJ;SACJ;KACJ;IAGD;QACI,WAAW,EAAE,eAAe;QAC5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B,QAAQ,aAAa,KAAK,CAAC,OAAO,EAAE,CAC/D,CAAC;KACL;AACL,CAAC;AA7DD,0BA6DC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IExecuteFunctions, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare const description: {
|
|
3
|
+
name: string;
|
|
4
|
+
value: string;
|
|
5
|
+
description: string;
|
|
6
|
+
action: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const properties: INodeProperties[];
|
|
9
|
+
export declare function execute(this: IExecuteFunctions, i: number): Promise<any>;
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.execute = exports.properties = exports.description = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const transport_1 = require("../../../transport");
|
|
6
|
+
exports.description = {
|
|
7
|
+
name: 'Update',
|
|
8
|
+
value: 'update',
|
|
9
|
+
description: 'Update an existing record',
|
|
10
|
+
action: 'Update a record',
|
|
11
|
+
};
|
|
12
|
+
exports.properties = [
|
|
13
|
+
{
|
|
14
|
+
displayName: 'LimeType',
|
|
15
|
+
name: 'limeType',
|
|
16
|
+
type: 'options',
|
|
17
|
+
typeOptions: {
|
|
18
|
+
loadOptionsMethod: 'getLimeTypes',
|
|
19
|
+
},
|
|
20
|
+
required: true,
|
|
21
|
+
default: '',
|
|
22
|
+
description: 'The type of entity to update',
|
|
23
|
+
displayOptions: {
|
|
24
|
+
show: {
|
|
25
|
+
resource: [
|
|
26
|
+
'limeObject',
|
|
27
|
+
],
|
|
28
|
+
operation: [
|
|
29
|
+
'update',
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
displayName: 'Record ID',
|
|
36
|
+
name: 'id',
|
|
37
|
+
type: 'string',
|
|
38
|
+
required: true,
|
|
39
|
+
default: '',
|
|
40
|
+
description: 'ID of the record to update',
|
|
41
|
+
displayOptions: {
|
|
42
|
+
show: {
|
|
43
|
+
resource: [
|
|
44
|
+
'limeObject',
|
|
45
|
+
],
|
|
46
|
+
operation: [
|
|
47
|
+
'update',
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
displayName: 'Input Type',
|
|
54
|
+
name: 'inputType',
|
|
55
|
+
type: 'options',
|
|
56
|
+
options: [
|
|
57
|
+
{
|
|
58
|
+
name: 'Simple Fields',
|
|
59
|
+
value: 'simple',
|
|
60
|
+
description: 'Define fields using the UI',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: 'JSON Object',
|
|
64
|
+
value: 'json',
|
|
65
|
+
description: 'Define fields using JSON',
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
default: 'simple',
|
|
69
|
+
description: 'How to input the data',
|
|
70
|
+
displayOptions: {
|
|
71
|
+
show: {
|
|
72
|
+
resource: [
|
|
73
|
+
'limeObject',
|
|
74
|
+
],
|
|
75
|
+
operation: [
|
|
76
|
+
'update',
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
displayName: 'Data',
|
|
83
|
+
name: 'jsonData',
|
|
84
|
+
type: 'json',
|
|
85
|
+
default: '{\n "name": "Updated Company Name",\n "phone": "+987654321"\n}',
|
|
86
|
+
description: 'Key-value pairs for fields to update. Property names must match the Lime CRM field names.',
|
|
87
|
+
typeOptions: {
|
|
88
|
+
alwaysOpenEditWindow: true,
|
|
89
|
+
},
|
|
90
|
+
displayOptions: {
|
|
91
|
+
show: {
|
|
92
|
+
resource: [
|
|
93
|
+
'limeObject',
|
|
94
|
+
],
|
|
95
|
+
operation: [
|
|
96
|
+
'update',
|
|
97
|
+
],
|
|
98
|
+
inputType: [
|
|
99
|
+
'json',
|
|
100
|
+
],
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
displayName: 'Fields',
|
|
106
|
+
name: 'simpleFields',
|
|
107
|
+
placeholder: 'Add Field',
|
|
108
|
+
type: 'fixedCollection',
|
|
109
|
+
typeOptions: {
|
|
110
|
+
multipleValues: true,
|
|
111
|
+
sortable: true,
|
|
112
|
+
},
|
|
113
|
+
default: {},
|
|
114
|
+
displayOptions: {
|
|
115
|
+
show: {
|
|
116
|
+
resource: [
|
|
117
|
+
'limeObject',
|
|
118
|
+
],
|
|
119
|
+
operation: [
|
|
120
|
+
'update',
|
|
121
|
+
],
|
|
122
|
+
inputType: [
|
|
123
|
+
'simple',
|
|
124
|
+
],
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
options: [
|
|
128
|
+
{
|
|
129
|
+
name: 'field',
|
|
130
|
+
displayName: 'Field',
|
|
131
|
+
values: [
|
|
132
|
+
{
|
|
133
|
+
displayName: 'Field Name',
|
|
134
|
+
name: 'fieldName',
|
|
135
|
+
type: 'options',
|
|
136
|
+
typeOptions: {
|
|
137
|
+
loadOptionsMethod: 'getLimeTypeProperties',
|
|
138
|
+
loadOptionsDependsOn: ['limeType'],
|
|
139
|
+
},
|
|
140
|
+
default: '',
|
|
141
|
+
description: 'The name of the field',
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
displayName: 'Field Value',
|
|
145
|
+
name: 'fieldValue',
|
|
146
|
+
type: 'string',
|
|
147
|
+
default: '',
|
|
148
|
+
description: 'The value of the field',
|
|
149
|
+
},
|
|
150
|
+
],
|
|
151
|
+
},
|
|
152
|
+
],
|
|
153
|
+
},
|
|
154
|
+
];
|
|
155
|
+
async function execute(i) {
|
|
156
|
+
const limeType = this.getNodeParameter('limeType', i);
|
|
157
|
+
const id = this.getNodeParameter('id', i);
|
|
158
|
+
const inputType = this.getNodeParameter('inputType', i);
|
|
159
|
+
const options = this.getNodeParameter('options', i, {});
|
|
160
|
+
const rawResponse = options.rawResponse || false;
|
|
161
|
+
let body = {};
|
|
162
|
+
if (inputType === 'json') {
|
|
163
|
+
const jsonData = this.getNodeParameter('jsonData', i);
|
|
164
|
+
try {
|
|
165
|
+
body = typeof jsonData === 'string' ? JSON.parse(jsonData) : jsonData;
|
|
166
|
+
}
|
|
167
|
+
catch (error) {
|
|
168
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Invalid JSON: ' + error.message);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
const simpleFields = this.getNodeParameter('simpleFields.field', i, []);
|
|
173
|
+
simpleFields.forEach(field => {
|
|
174
|
+
body[field.fieldName] = field.fieldValue;
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
const endpoint = `/api/v1/limeobject/${limeType}/${id}/`;
|
|
178
|
+
const response = await transport_1.apiRequest.call(this, {
|
|
179
|
+
method: 'PATCH',
|
|
180
|
+
url: endpoint,
|
|
181
|
+
body
|
|
182
|
+
});
|
|
183
|
+
return rawResponse ? response : response;
|
|
184
|
+
}
|
|
185
|
+
exports.execute = execute;
|
|
186
|
+
//# sourceMappingURL=update.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.operation.js","sourceRoot":"","sources":["../../../../../../nodes/lime-crm/resources/limeObject/operations/update.operation.ts"],"names":[],"mappings":";;;AAAA,+CAKsB;AACtB,kDAAgD;AAGnC,QAAA,WAAW,GAAG;IACvB,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,QAAQ;IACf,WAAW,EAAE,2BAA2B;IACxC,MAAM,EAAE,iBAAiB;CAC5B,CAAC;AAEW,QAAA,UAAU,GAAsB;IACzC;QACI,WAAW,EAAE,UAAU;QACvB,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,SAAS;QACf,WAAW,EAAE;YACT,iBAAiB,EAAE,cAAc;SACpC;QACD,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,8BAA8B;QAC3C,cAAc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