@pvass24/n8n-nodes-twenty-crm 1.0.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/LICENSE.md +21 -0
- package/README.md +297 -0
- package/dist/credentials/TwentyCrmApi.credentials.d.ts +10 -0
- package/dist/credentials/TwentyCrmApi.credentials.js +47 -0
- package/dist/credentials/TwentyCrmApi.credentials.js.map +1 -0
- package/dist/nodes/TwentyCrm/GenericFunctions.d.ts +7 -0
- package/dist/nodes/TwentyCrm/GenericFunctions.js +96 -0
- package/dist/nodes/TwentyCrm/GenericFunctions.js.map +1 -0
- package/dist/nodes/TwentyCrm/TwentyCrm.node.d.ts +5 -0
- package/dist/nodes/TwentyCrm/TwentyCrm.node.js +113 -0
- package/dist/nodes/TwentyCrm/TwentyCrm.node.js.map +1 -0
- package/dist/nodes/TwentyCrm/TwentyCrm.node.json +17 -0
- package/dist/nodes/TwentyCrm/resources/company/company.description.d.ts +3 -0
- package/dist/nodes/TwentyCrm/resources/company/company.description.js +296 -0
- package/dist/nodes/TwentyCrm/resources/company/company.description.js.map +1 -0
- package/dist/nodes/TwentyCrm/resources/company/company.handler.d.ts +2 -0
- package/dist/nodes/TwentyCrm/resources/company/company.handler.js +147 -0
- package/dist/nodes/TwentyCrm/resources/company/company.handler.js.map +1 -0
- package/dist/nodes/TwentyCrm/resources/note/note.description.d.ts +3 -0
- package/dist/nodes/TwentyCrm/resources/note/note.description.js +78 -0
- package/dist/nodes/TwentyCrm/resources/note/note.description.js.map +1 -0
- package/dist/nodes/TwentyCrm/resources/note/note.handler.d.ts +2 -0
- package/dist/nodes/TwentyCrm/resources/note/note.handler.js +57 -0
- package/dist/nodes/TwentyCrm/resources/note/note.handler.js.map +1 -0
- package/dist/nodes/TwentyCrm/resources/opportunity/opportunity.description.d.ts +3 -0
- package/dist/nodes/TwentyCrm/resources/opportunity/opportunity.description.js +102 -0
- package/dist/nodes/TwentyCrm/resources/opportunity/opportunity.description.js.map +1 -0
- package/dist/nodes/TwentyCrm/resources/opportunity/opportunity.handler.d.ts +2 -0
- package/dist/nodes/TwentyCrm/resources/opportunity/opportunity.handler.js +83 -0
- package/dist/nodes/TwentyCrm/resources/opportunity/opportunity.handler.js.map +1 -0
- package/dist/nodes/TwentyCrm/resources/person/person.description.d.ts +3 -0
- package/dist/nodes/TwentyCrm/resources/person/person.description.js +127 -0
- package/dist/nodes/TwentyCrm/resources/person/person.description.js.map +1 -0
- package/dist/nodes/TwentyCrm/resources/person/person.handler.d.ts +2 -0
- package/dist/nodes/TwentyCrm/resources/person/person.handler.js +106 -0
- package/dist/nodes/TwentyCrm/resources/person/person.handler.js.map +1 -0
- package/dist/nodes/TwentyCrm/resources/task/task.description.d.ts +3 -0
- package/dist/nodes/TwentyCrm/resources/task/task.description.js +96 -0
- package/dist/nodes/TwentyCrm/resources/task/task.description.js.map +1 -0
- package/dist/nodes/TwentyCrm/resources/task/task.handler.d.ts +2 -0
- package/dist/nodes/TwentyCrm/resources/task/task.handler.js +79 -0
- package/dist/nodes/TwentyCrm/resources/task/task.handler.js.map +1 -0
- package/dist/nodes/TwentyCrm/types.d.ts +29 -0
- package/dist/nodes/TwentyCrm/types.js +3 -0
- package/dist/nodes/TwentyCrm/types.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +62 -0
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.companyFields = exports.companyOperations = void 0;
|
|
4
|
+
const resource = 'company';
|
|
5
|
+
exports.companyOperations = [
|
|
6
|
+
{
|
|
7
|
+
displayName: 'Operation',
|
|
8
|
+
name: 'operation',
|
|
9
|
+
type: 'options',
|
|
10
|
+
noDataExpression: true,
|
|
11
|
+
displayOptions: { show: { resource: [resource] } },
|
|
12
|
+
options: [
|
|
13
|
+
{
|
|
14
|
+
name: 'Create',
|
|
15
|
+
value: 'create',
|
|
16
|
+
description: 'Create a company',
|
|
17
|
+
action: 'Create a company',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: 'Delete',
|
|
21
|
+
value: 'delete',
|
|
22
|
+
description: 'Delete a company',
|
|
23
|
+
action: 'Delete a company',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: 'Get',
|
|
27
|
+
value: 'get',
|
|
28
|
+
description: 'Get a company by ID',
|
|
29
|
+
action: 'Get a company',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: 'Get Many',
|
|
33
|
+
value: 'getAll',
|
|
34
|
+
description: 'Get many companies',
|
|
35
|
+
action: 'Get many companies',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: 'Update',
|
|
39
|
+
value: 'update',
|
|
40
|
+
description: 'Update a company',
|
|
41
|
+
action: 'Update a company',
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
default: 'getAll',
|
|
45
|
+
},
|
|
46
|
+
];
|
|
47
|
+
exports.companyFields = [
|
|
48
|
+
{
|
|
49
|
+
displayName: 'Company ID',
|
|
50
|
+
name: 'companyId',
|
|
51
|
+
type: 'string',
|
|
52
|
+
required: true,
|
|
53
|
+
default: '',
|
|
54
|
+
displayOptions: { show: { resource: [resource], operation: ['get', 'update', 'delete'] } },
|
|
55
|
+
description: 'The ID of the company',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
displayName: 'Name',
|
|
59
|
+
name: 'name',
|
|
60
|
+
type: 'string',
|
|
61
|
+
required: true,
|
|
62
|
+
default: '',
|
|
63
|
+
displayOptions: { show: { resource: [resource], operation: ['create'] } },
|
|
64
|
+
description: 'The company name',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
displayName: 'Additional Fields',
|
|
68
|
+
name: 'additionalFields',
|
|
69
|
+
type: 'collection',
|
|
70
|
+
placeholder: 'Add Field',
|
|
71
|
+
default: {},
|
|
72
|
+
displayOptions: { show: { resource: [resource], operation: ['create'] } },
|
|
73
|
+
options: [
|
|
74
|
+
{
|
|
75
|
+
displayName: 'Domain URL',
|
|
76
|
+
name: 'domainUrl',
|
|
77
|
+
type: 'string',
|
|
78
|
+
default: '',
|
|
79
|
+
description: 'The company website URL (used to fetch the company icon)',
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
displayName: 'LinkedIn URL',
|
|
83
|
+
name: 'linkedinUrl',
|
|
84
|
+
type: 'string',
|
|
85
|
+
default: '',
|
|
86
|
+
description: 'The company LinkedIn profile URL',
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
displayName: 'Street Address 1',
|
|
90
|
+
name: 'addressStreet1',
|
|
91
|
+
type: 'string',
|
|
92
|
+
default: '',
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
displayName: 'Street Address 2',
|
|
96
|
+
name: 'addressStreet2',
|
|
97
|
+
type: 'string',
|
|
98
|
+
default: '',
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
displayName: 'City',
|
|
102
|
+
name: 'addressCity',
|
|
103
|
+
type: 'string',
|
|
104
|
+
default: '',
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
displayName: 'State',
|
|
108
|
+
name: 'addressState',
|
|
109
|
+
type: 'string',
|
|
110
|
+
default: '',
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
displayName: 'Postal Code',
|
|
114
|
+
name: 'addressPostcode',
|
|
115
|
+
type: 'string',
|
|
116
|
+
default: '',
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
displayName: 'Country',
|
|
120
|
+
name: 'addressCountry',
|
|
121
|
+
type: 'string',
|
|
122
|
+
default: '',
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
displayName: 'Annual Revenue (Micros)',
|
|
126
|
+
name: 'annualRevenueMicros',
|
|
127
|
+
type: 'number',
|
|
128
|
+
default: 0,
|
|
129
|
+
description: 'Revenue in micros (e.g. 1000000 = $1.00)',
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
displayName: 'Currency Code',
|
|
133
|
+
name: 'currencyCode',
|
|
134
|
+
type: 'string',
|
|
135
|
+
default: 'USD',
|
|
136
|
+
description: 'ISO 4217 currency code',
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
displayName: 'Account Owner ID',
|
|
140
|
+
name: 'accountOwnerId',
|
|
141
|
+
type: 'string',
|
|
142
|
+
default: '',
|
|
143
|
+
description: 'The workspace member who owns this company',
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
displayName: 'Update Fields',
|
|
149
|
+
name: 'updateFields',
|
|
150
|
+
type: 'collection',
|
|
151
|
+
placeholder: 'Add Field',
|
|
152
|
+
default: {},
|
|
153
|
+
displayOptions: { show: { resource: [resource], operation: ['update'] } },
|
|
154
|
+
options: [
|
|
155
|
+
{
|
|
156
|
+
displayName: 'Name',
|
|
157
|
+
name: 'name',
|
|
158
|
+
type: 'string',
|
|
159
|
+
default: '',
|
|
160
|
+
description: 'The company name',
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
displayName: 'Domain URL',
|
|
164
|
+
name: 'domainUrl',
|
|
165
|
+
type: 'string',
|
|
166
|
+
default: '',
|
|
167
|
+
description: 'The company website URL',
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
displayName: 'LinkedIn URL',
|
|
171
|
+
name: 'linkedinUrl',
|
|
172
|
+
type: 'string',
|
|
173
|
+
default: '',
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
displayName: 'Street Address 1',
|
|
177
|
+
name: 'addressStreet1',
|
|
178
|
+
type: 'string',
|
|
179
|
+
default: '',
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
displayName: 'Street Address 2',
|
|
183
|
+
name: 'addressStreet2',
|
|
184
|
+
type: 'string',
|
|
185
|
+
default: '',
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
displayName: 'City',
|
|
189
|
+
name: 'addressCity',
|
|
190
|
+
type: 'string',
|
|
191
|
+
default: '',
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
displayName: 'State',
|
|
195
|
+
name: 'addressState',
|
|
196
|
+
type: 'string',
|
|
197
|
+
default: '',
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
displayName: 'Postal Code',
|
|
201
|
+
name: 'addressPostcode',
|
|
202
|
+
type: 'string',
|
|
203
|
+
default: '',
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
displayName: 'Country',
|
|
207
|
+
name: 'addressCountry',
|
|
208
|
+
type: 'string',
|
|
209
|
+
default: '',
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
displayName: 'Annual Revenue (Micros)',
|
|
213
|
+
name: 'annualRevenueMicros',
|
|
214
|
+
type: 'number',
|
|
215
|
+
default: 0,
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
displayName: 'Currency Code',
|
|
219
|
+
name: 'currencyCode',
|
|
220
|
+
type: 'string',
|
|
221
|
+
default: 'USD',
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
displayName: 'Account Owner ID',
|
|
225
|
+
name: 'accountOwnerId',
|
|
226
|
+
type: 'string',
|
|
227
|
+
default: '',
|
|
228
|
+
},
|
|
229
|
+
],
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
displayName: 'Return All',
|
|
233
|
+
name: 'returnAll',
|
|
234
|
+
type: 'boolean',
|
|
235
|
+
default: false,
|
|
236
|
+
displayOptions: { show: { resource: [resource], operation: ['getAll'] } },
|
|
237
|
+
description: 'Whether to return all results or only up to a given limit',
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
displayName: 'Limit',
|
|
241
|
+
name: 'limit',
|
|
242
|
+
type: 'number',
|
|
243
|
+
default: 50,
|
|
244
|
+
typeOptions: { minValue: 1, maxValue: 60 },
|
|
245
|
+
displayOptions: { show: { resource: [resource], operation: ['getAll'], returnAll: [false] } },
|
|
246
|
+
description: 'Max number of results to return',
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
displayName: 'Filters',
|
|
250
|
+
name: 'filters',
|
|
251
|
+
type: 'collection',
|
|
252
|
+
placeholder: 'Add Filter',
|
|
253
|
+
default: {},
|
|
254
|
+
displayOptions: { show: { resource: [resource], operation: ['getAll'] } },
|
|
255
|
+
options: [
|
|
256
|
+
{
|
|
257
|
+
displayName: 'Name Contains',
|
|
258
|
+
name: 'nameContains',
|
|
259
|
+
type: 'string',
|
|
260
|
+
default: '',
|
|
261
|
+
description: 'Filter by company name (case-insensitive substring match)',
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
displayName: 'Created After',
|
|
265
|
+
name: 'createdAfter',
|
|
266
|
+
type: 'dateTime',
|
|
267
|
+
default: '',
|
|
268
|
+
description: 'Return only companies created after this date',
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
displayName: 'Updated After',
|
|
272
|
+
name: 'updatedAfter',
|
|
273
|
+
type: 'dateTime',
|
|
274
|
+
default: '',
|
|
275
|
+
description: 'Return only companies updated after this date',
|
|
276
|
+
},
|
|
277
|
+
],
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
displayName: 'Order By',
|
|
281
|
+
name: 'orderBy',
|
|
282
|
+
type: 'options',
|
|
283
|
+
default: '',
|
|
284
|
+
displayOptions: { show: { resource: [resource], operation: ['getAll'] } },
|
|
285
|
+
options: [
|
|
286
|
+
{ name: 'None', value: '' },
|
|
287
|
+
{ name: 'Created At (Newest First)', value: 'createdAt[DescNullsLast]' },
|
|
288
|
+
{ name: 'Created At (Oldest First)', value: 'createdAt[AscNullsFirst]' },
|
|
289
|
+
{ name: 'Name (A-Z)', value: 'name[AscNullsFirst]' },
|
|
290
|
+
{ name: 'Name (Z-A)', value: 'name[DescNullsLast]' },
|
|
291
|
+
{ name: 'Updated At (Newest First)', value: 'updatedAt[DescNullsLast]' },
|
|
292
|
+
],
|
|
293
|
+
description: 'How to order results',
|
|
294
|
+
},
|
|
295
|
+
];
|
|
296
|
+
//# sourceMappingURL=company.description.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"company.description.js","sourceRoot":"","sources":["../../../../../nodes/TwentyCrm/resources/company/company.description.ts"],"names":[],"mappings":";;;AAEA,MAAM,QAAQ,GAAG,SAAS,CAAC;AAEd,QAAA,iBAAiB,GAAsB;IACnD;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE;QAClD,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,kBAAkB;gBAC/B,MAAM,EAAE,kBAAkB;aAC1B;YACD;gBACC,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,kBAAkB;gBAC/B,MAAM,EAAE,kBAAkB;aAC1B;YACD;gBACC,IAAI,EAAE,KAAK;gBACX,KAAK,EAAE,KAAK;gBACZ,WAAW,EAAE,qBAAqB;gBAClC,MAAM,EAAE,eAAe;aACvB;YACD;gBACC,IAAI,EAAE,UAAU;gBAChB,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,oBAAoB;gBACjC,MAAM,EAAE,oBAAoB;aAC5B;YACD;gBACC,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,kBAAkB;gBAC/B,MAAM,EAAE,kBAAkB;aAC1B;SACD;QACD,OAAO,EAAE,QAAQ;KACjB;CACD,CAAC;AAEW,QAAA,aAAa,GAAsB;IAI/C;QACC,WAAW,EAAE,YAAY;QACzB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,OAA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AO,EAAE,EAAE;gBACX,WAAW,EAAE,+CAA+C;aAC5D;YACD;gBACC,WAAW,EAAE,eAAe;gBAC5B,IAAI,EAAE,cAAc;gBACpB,IAAI,EAAE,UAAU;gBAChB,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,+CAA+C;aAC5D;SACD;KACD;IACD;QACC,WAAW,EAAE,UAAU;QACvB,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,EAAE;QACX,cAAc,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE;QACzE,OAAO,EAAE;YACR,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE;YAC3B,EAAE,IAAI,EAAE,2BAA2B,EAAE,KAAK,EAAE,0BAA0B,EAAE;YACxE,EAAE,IAAI,EAAE,2BAA2B,EAAE,KAAK,EAAE,0BAA0B,EAAE;YACxE,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,qBAAqB,EAAE;YACpD,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,qBAAqB,EAAE;YACpD,EAAE,IAAI,EAAE,2BAA2B,EAAE,KAAK,EAAE,0BAA0B,EAAE;SACxE;QACD,WAAW,EAAE,sBAAsB;KACnC;CACD,CAAC"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleCompanyOperation = handleCompanyOperation;
|
|
4
|
+
const GenericFunctions_1 = require("../../GenericFunctions");
|
|
5
|
+
async function handleCompanyOperation(operation, i) {
|
|
6
|
+
if (operation === 'create') {
|
|
7
|
+
return companyCreate.call(this, i);
|
|
8
|
+
}
|
|
9
|
+
else if (operation === 'get') {
|
|
10
|
+
return companyGet.call(this, i);
|
|
11
|
+
}
|
|
12
|
+
else if (operation === 'getAll') {
|
|
13
|
+
return companyGetAll.call(this);
|
|
14
|
+
}
|
|
15
|
+
else if (operation === 'update') {
|
|
16
|
+
return companyUpdate.call(this, i);
|
|
17
|
+
}
|
|
18
|
+
else if (operation === 'delete') {
|
|
19
|
+
return companyDelete.call(this, i);
|
|
20
|
+
}
|
|
21
|
+
throw new Error(`Unsupported operation: ${operation}`);
|
|
22
|
+
}
|
|
23
|
+
async function companyCreate(i) {
|
|
24
|
+
const name = this.getNodeParameter('name', i);
|
|
25
|
+
const additionalFields = this.getNodeParameter('additionalFields', i);
|
|
26
|
+
const body = { name };
|
|
27
|
+
if (additionalFields.domainUrl) {
|
|
28
|
+
body.domainName = { primaryLinkUrl: additionalFields.domainUrl, primaryLinkLabel: '' };
|
|
29
|
+
}
|
|
30
|
+
if (additionalFields.linkedinUrl) {
|
|
31
|
+
body.linkedinLink = { primaryLinkUrl: additionalFields.linkedinUrl, primaryLinkLabel: '' };
|
|
32
|
+
}
|
|
33
|
+
const addressFields = [
|
|
34
|
+
'addressStreet1',
|
|
35
|
+
'addressStreet2',
|
|
36
|
+
'addressCity',
|
|
37
|
+
'addressState',
|
|
38
|
+
'addressPostcode',
|
|
39
|
+
'addressCountry',
|
|
40
|
+
];
|
|
41
|
+
const address = {};
|
|
42
|
+
let hasAddress = false;
|
|
43
|
+
for (const field of addressFields) {
|
|
44
|
+
if (additionalFields[field]) {
|
|
45
|
+
address[field] = additionalFields[field];
|
|
46
|
+
hasAddress = true;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (hasAddress) {
|
|
50
|
+
body.address = address;
|
|
51
|
+
}
|
|
52
|
+
if (additionalFields.annualRevenueMicros || additionalFields.currencyCode) {
|
|
53
|
+
body.annualRevenue = {
|
|
54
|
+
amountMicros: additionalFields.annualRevenueMicros || null,
|
|
55
|
+
currencyCode: additionalFields.currencyCode || null,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
if (additionalFields.accountOwnerId) {
|
|
59
|
+
body.accountOwnerId = additionalFields.accountOwnerId;
|
|
60
|
+
}
|
|
61
|
+
const response = await GenericFunctions_1.twentyApiRequest.call(this, 'POST', 'companies', body);
|
|
62
|
+
const data = response.data;
|
|
63
|
+
return (data.createCompany || data.createCompanies);
|
|
64
|
+
}
|
|
65
|
+
async function companyGet(i) {
|
|
66
|
+
const companyId = this.getNodeParameter('companyId', i);
|
|
67
|
+
const response = await GenericFunctions_1.twentyApiRequest.call(this, 'GET', 'companies', undefined, undefined, companyId);
|
|
68
|
+
const data = response.data;
|
|
69
|
+
return (data.company || response);
|
|
70
|
+
}
|
|
71
|
+
async function companyGetAll() {
|
|
72
|
+
const returnAll = this.getNodeParameter('returnAll', 0);
|
|
73
|
+
const limit = returnAll ? undefined : this.getNodeParameter('limit', 0);
|
|
74
|
+
const filters = this.getNodeParameter('filters', 0, {});
|
|
75
|
+
const orderBy = this.getNodeParameter('orderBy', 0, '');
|
|
76
|
+
const query = {};
|
|
77
|
+
const filterParts = [];
|
|
78
|
+
if (filters.nameContains) {
|
|
79
|
+
filterParts.push({ field: 'name', comparator: 'ilike', value: `%${filters.nameContains}%` });
|
|
80
|
+
}
|
|
81
|
+
if (filters.createdAfter) {
|
|
82
|
+
filterParts.push({ field: 'createdAt', comparator: 'gte', value: filters.createdAfter });
|
|
83
|
+
}
|
|
84
|
+
if (filters.updatedAfter) {
|
|
85
|
+
filterParts.push({ field: 'updatedAt', comparator: 'gte', value: filters.updatedAfter });
|
|
86
|
+
}
|
|
87
|
+
const filterString = (0, GenericFunctions_1.buildFilterString)(filterParts);
|
|
88
|
+
if (filterString) {
|
|
89
|
+
query.filter = filterString;
|
|
90
|
+
}
|
|
91
|
+
if (orderBy) {
|
|
92
|
+
query.order_by = orderBy;
|
|
93
|
+
}
|
|
94
|
+
return GenericFunctions_1.twentyApiRequestAllItems.call(this, 'companies', query, limit);
|
|
95
|
+
}
|
|
96
|
+
async function companyUpdate(i) {
|
|
97
|
+
const companyId = this.getNodeParameter('companyId', i);
|
|
98
|
+
const updateFields = this.getNodeParameter('updateFields', i);
|
|
99
|
+
const body = {};
|
|
100
|
+
if (updateFields.name) {
|
|
101
|
+
body.name = updateFields.name;
|
|
102
|
+
}
|
|
103
|
+
if (updateFields.domainUrl) {
|
|
104
|
+
body.domainName = { primaryLinkUrl: updateFields.domainUrl, primaryLinkLabel: '' };
|
|
105
|
+
}
|
|
106
|
+
if (updateFields.linkedinUrl) {
|
|
107
|
+
body.linkedinLink = { primaryLinkUrl: updateFields.linkedinUrl, primaryLinkLabel: '' };
|
|
108
|
+
}
|
|
109
|
+
const addressFields = [
|
|
110
|
+
'addressStreet1',
|
|
111
|
+
'addressStreet2',
|
|
112
|
+
'addressCity',
|
|
113
|
+
'addressState',
|
|
114
|
+
'addressPostcode',
|
|
115
|
+
'addressCountry',
|
|
116
|
+
];
|
|
117
|
+
const address = {};
|
|
118
|
+
let hasAddress = false;
|
|
119
|
+
for (const field of addressFields) {
|
|
120
|
+
if (updateFields[field]) {
|
|
121
|
+
address[field] = updateFields[field];
|
|
122
|
+
hasAddress = true;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (hasAddress) {
|
|
126
|
+
body.address = address;
|
|
127
|
+
}
|
|
128
|
+
if (updateFields.annualRevenueMicros || updateFields.currencyCode) {
|
|
129
|
+
body.annualRevenue = {
|
|
130
|
+
amountMicros: updateFields.annualRevenueMicros || null,
|
|
131
|
+
currencyCode: updateFields.currencyCode || null,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
if (updateFields.accountOwnerId) {
|
|
135
|
+
body.accountOwnerId = updateFields.accountOwnerId;
|
|
136
|
+
}
|
|
137
|
+
const response = await GenericFunctions_1.twentyApiRequest.call(this, 'PATCH', 'companies', body, undefined, companyId);
|
|
138
|
+
const data = response.data;
|
|
139
|
+
return (data.updateCompany || response);
|
|
140
|
+
}
|
|
141
|
+
async function companyDelete(i) {
|
|
142
|
+
const companyId = this.getNodeParameter('companyId', i);
|
|
143
|
+
const response = await GenericFunctions_1.twentyApiRequest.call(this, 'DELETE', 'companies', undefined, undefined, companyId);
|
|
144
|
+
const data = response.data;
|
|
145
|
+
return (data.deleteCompany || { id: companyId, deleted: true });
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=company.handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"company.handler.js","sourceRoot":"","sources":["../../../../../nodes/TwentyCrm/resources/company/company.handler.ts"],"names":[],"mappings":";;AAIA,wDAiBC;AApBD,6DAAuG;AAGhG,KAAK,UAAU,sBAAsB,CAE3C,SAAiB,EACjB,CAAS;IAET,IAAI,SAAS,KAAK,QAAQ,EAAE,CAAC;QAC5B,OAAO,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACpC,CAAC;SAAM,IAAI,SAAS,KAAK,KAAK,EAAE,CAAC;QAChC,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACjC,CAAC;SAAM,IAAI,SAAS,KAAK,QAAQ,EAAE,CAAC;QACnC,OAAO,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;SAAM,IAAI,SAAS,KAAK,QAAQ,EAAE,CAAC;QACnC,OAAO,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACpC,CAAC;SAAM,IAAI,SAAS,KAAK,QAAQ,EAAE,CAAC;QACnC,OAAO,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACpC,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,0BAA0B,SAAS,EAAE,CAAC,CAAC;AACxD,CAAC;AAED,KAAK,UAAU,aAAa,CAA0B,CAAS;IAC9D,MAAM,IAAI,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC,CAAW,CAAC;IACxD,MAAM,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,C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;IAC1C,OAAO,CAAC,IAAI,CAAC,aAAa,IAAI,QAAQ,CAAgB,CAAC;AACxD,CAAC;AAED,KAAK,UAAU,aAAa,CAA0B,CAAS;IAC9D,MAAM,SAAS,GAAG,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,CAAC,CAAW,CAAC;IAClE,MAAM,QAAQ,GAAG,MAAM,mCAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;IAC3G,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAmB,CAAC;IAC1C,OAAO,CAAC,IAAI,CAAC,aAAa,IAAI,EAAE,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,CAAgB,CAAC;AAChF,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.noteFields = exports.noteOperations = void 0;
|
|
4
|
+
const resource = 'note';
|
|
5
|
+
exports.noteOperations = [
|
|
6
|
+
{
|
|
7
|
+
displayName: 'Operation',
|
|
8
|
+
name: 'operation',
|
|
9
|
+
type: 'options',
|
|
10
|
+
noDataExpression: true,
|
|
11
|
+
displayOptions: { show: { resource: [resource] } },
|
|
12
|
+
options: [
|
|
13
|
+
{ name: 'Create', value: 'create', description: 'Create a note', action: 'Create a note' },
|
|
14
|
+
{ name: 'Delete', value: 'delete', description: 'Delete a note', action: 'Delete a note' },
|
|
15
|
+
{ name: 'Get', value: 'get', description: 'Get a note by ID', action: 'Get a note' },
|
|
16
|
+
{ name: 'Get Many', value: 'getAll', description: 'Get many notes', action: 'Get many notes' },
|
|
17
|
+
{ name: 'Update', value: 'update', description: 'Update a note', action: 'Update a note' },
|
|
18
|
+
],
|
|
19
|
+
default: 'getAll',
|
|
20
|
+
},
|
|
21
|
+
];
|
|
22
|
+
exports.noteFields = [
|
|
23
|
+
{
|
|
24
|
+
displayName: 'Note ID',
|
|
25
|
+
name: 'noteId',
|
|
26
|
+
type: 'string',
|
|
27
|
+
required: true,
|
|
28
|
+
default: '',
|
|
29
|
+
displayOptions: { show: { resource: [resource], operation: ['get', 'update', 'delete'] } },
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
displayName: 'Title',
|
|
33
|
+
name: 'title',
|
|
34
|
+
type: 'string',
|
|
35
|
+
required: true,
|
|
36
|
+
default: '',
|
|
37
|
+
displayOptions: { show: { resource: [resource], operation: ['create'] } },
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
displayName: 'Additional Fields',
|
|
41
|
+
name: 'additionalFields',
|
|
42
|
+
type: 'collection',
|
|
43
|
+
placeholder: 'Add Field',
|
|
44
|
+
default: {},
|
|
45
|
+
displayOptions: { show: { resource: [resource], operation: ['create'] } },
|
|
46
|
+
options: [
|
|
47
|
+
{ displayName: 'Body', name: 'body', type: 'string', default: '', typeOptions: { rows: 4 }, description: 'Note content (plain text or markdown)' },
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
displayName: 'Update Fields',
|
|
52
|
+
name: 'updateFields',
|
|
53
|
+
type: 'collection',
|
|
54
|
+
placeholder: 'Add Field',
|
|
55
|
+
default: {},
|
|
56
|
+
displayOptions: { show: { resource: [resource], operation: ['update'] } },
|
|
57
|
+
options: [
|
|
58
|
+
{ displayName: 'Title', name: 'title', type: 'string', default: '' },
|
|
59
|
+
{ displayName: 'Body', name: 'body', type: 'string', default: '', typeOptions: { rows: 4 } },
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
displayName: 'Return All',
|
|
64
|
+
name: 'returnAll',
|
|
65
|
+
type: 'boolean',
|
|
66
|
+
default: false,
|
|
67
|
+
displayOptions: { show: { resource: [resource], operation: ['getAll'] } },
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
displayName: 'Limit',
|
|
71
|
+
name: 'limit',
|
|
72
|
+
type: 'number',
|
|
73
|
+
default: 50,
|
|
74
|
+
typeOptions: { minValue: 1, maxValue: 60 },
|
|
75
|
+
displayOptions: { show: { resource: [resource], operation: ['getAll'], returnAll: [false] } },
|
|
76
|
+
},
|
|
77
|
+
];
|
|
78
|
+
//# sourceMappingURL=note.description.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"note.description.js","sourceRoot":"","sources":["../../../../../nodes/TwentyCrm/resources/note/note.description.ts"],"names":[],"mappings":";;;AAEA,MAAM,QAAQ,GAAG,MAAM,CAAC;AAEX,QAAA,cAAc,GAAsB;IAChD;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE;QAClD,OAAO,EAAE;YACR,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,EAAE,eAAe,EAAE;YAC1F,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,EAAE,eAAe,EAAE;YAC1F,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,EAAE,YAAY,EAAE;YACpF,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,EAAE,gBAAgB,EAAE;YAC9F,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,EAAE,eAAe,EAAE;SAC1F;QACD,OAAO,EAAE,QAAQ;KACjB;CACD,CAAC;AAEW,QAAA,UAAU,GAAsB;IAC5C;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E,EAAE;QACzE,OAAO,EAAE;YACR,EAAE,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;YACpE,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE;SAC5F;KACD;IAKD;QACC,WAAW,EAAE,YAAY;QACzB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;QACd,cAAc,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE;KACzE;IACD;QACC,WAAW,EAAE,OAAO;QACpB,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;QAC1C,cAAc,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAC,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE;KAC7F;CACD,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleNoteOperation = handleNoteOperation;
|
|
4
|
+
const GenericFunctions_1 = require("../../GenericFunctions");
|
|
5
|
+
async function handleNoteOperation(operation, i) {
|
|
6
|
+
if (operation === 'create')
|
|
7
|
+
return noteCreate.call(this, i);
|
|
8
|
+
if (operation === 'get')
|
|
9
|
+
return noteGet.call(this, i);
|
|
10
|
+
if (operation === 'getAll')
|
|
11
|
+
return noteGetAll.call(this);
|
|
12
|
+
if (operation === 'update')
|
|
13
|
+
return noteUpdate.call(this, i);
|
|
14
|
+
if (operation === 'delete')
|
|
15
|
+
return noteDelete.call(this, i);
|
|
16
|
+
throw new Error(`Unsupported operation: ${operation}`);
|
|
17
|
+
}
|
|
18
|
+
async function noteCreate(i) {
|
|
19
|
+
const title = this.getNodeParameter('title', i);
|
|
20
|
+
const additionalFields = this.getNodeParameter('additionalFields', i);
|
|
21
|
+
const body = { title };
|
|
22
|
+
if (additionalFields.body)
|
|
23
|
+
body.body = additionalFields.body;
|
|
24
|
+
const response = await GenericFunctions_1.twentyApiRequest.call(this, 'POST', 'notes', body);
|
|
25
|
+
const data = response.data;
|
|
26
|
+
return (data.createNote || data.createNotes);
|
|
27
|
+
}
|
|
28
|
+
async function noteGet(i) {
|
|
29
|
+
const noteId = this.getNodeParameter('noteId', i);
|
|
30
|
+
const response = await GenericFunctions_1.twentyApiRequest.call(this, 'GET', 'notes', undefined, undefined, noteId);
|
|
31
|
+
const data = response.data;
|
|
32
|
+
return (data.note || response);
|
|
33
|
+
}
|
|
34
|
+
async function noteGetAll() {
|
|
35
|
+
const returnAll = this.getNodeParameter('returnAll', 0);
|
|
36
|
+
const limit = returnAll ? undefined : this.getNodeParameter('limit', 0);
|
|
37
|
+
return GenericFunctions_1.twentyApiRequestAllItems.call(this, 'notes', {}, limit);
|
|
38
|
+
}
|
|
39
|
+
async function noteUpdate(i) {
|
|
40
|
+
const noteId = this.getNodeParameter('noteId', i);
|
|
41
|
+
const updateFields = this.getNodeParameter('updateFields', i);
|
|
42
|
+
const body = {};
|
|
43
|
+
if (updateFields.title)
|
|
44
|
+
body.title = updateFields.title;
|
|
45
|
+
if (updateFields.body)
|
|
46
|
+
body.body = updateFields.body;
|
|
47
|
+
const response = await GenericFunctions_1.twentyApiRequest.call(this, 'PATCH', 'notes', body, undefined, noteId);
|
|
48
|
+
const data = response.data;
|
|
49
|
+
return (data.updateNote || response);
|
|
50
|
+
}
|
|
51
|
+
async function noteDelete(i) {
|
|
52
|
+
const noteId = this.getNodeParameter('noteId', i);
|
|
53
|
+
const response = await GenericFunctions_1.twentyApiRequest.call(this, 'DELETE', 'notes', undefined, undefined, noteId);
|
|
54
|
+
const data = response.data;
|
|
55
|
+
return (data.deleteNote || { id: noteId, deleted: true });
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=note.handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"note.handler.js","sourceRoot":"","sources":["../../../../../nodes/TwentyCrm/resources/note/note.handler.ts"],"names":[],"mappings":";;AAGA,kDAWC;AAbD,6DAAoF;AAE7E,KAAK,UAAU,mBAAmB,CAExC,SAAiB,EACjB,CAAS;IAET,IAAI,SAAS,KAAK,QAAQ;QAAE,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAC5D,IAAI,SAAS,KAAK,KAAK;QAAE,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACtD,IAAI,SAAS,KAAK,QAAQ;QAAE,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzD,IAAI,SAAS,KAAK,QAAQ;QAAE,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAC5D,IAAI,SAAS,KAAK,QAAQ;QAAE,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAC5D,MAAM,IAAI,KAAK,CAAC,0BAA0B,SAAS,EAAE,CAAC,CAAC;AACxD,CAAC;AAED,KAAK,UAAU,UAAU,CAA0B,CAAS;IAC3D,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAW,CAAC;IAC1D,MAAM,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,CAAC,CAAgB,CAAC;IAErF,MAAM,IAAI,GA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