n8n-nodes-synca 1.0.27 → 1.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/nodes/Konimbo/SyncaKonimbo.node.d.ts +10 -0
- package/dist/nodes/Konimbo/SyncaKonimbo.node.js +885 -0
- package/dist/nodes/Konimbo/SyncaKonimbo.node.js.map +1 -0
- package/dist/nodes/Konimbo/icon.svg +1 -0
- package/dist/package.json +3 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,885 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SyncaKonimbo = void 0;
|
|
4
|
+
class SyncaKonimbo {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.description = {
|
|
7
|
+
usableAsTool: true,
|
|
8
|
+
displayName: 'Synca Konimbo (Beta)',
|
|
9
|
+
name: 'customSyncaKonimbo',
|
|
10
|
+
documentationUrl: 'https://n8n.synca.co.il/docs',
|
|
11
|
+
icon: { light: 'file:icon.svg', dark: 'file:icon.svg' },
|
|
12
|
+
group: ['transform'],
|
|
13
|
+
version: 1,
|
|
14
|
+
description: 'Invoke Konimbo actions via the Synca backend - Items, Orders, Customers, Carts, Store Categories, and Webhooks management',
|
|
15
|
+
subtitle: '={{$parameter["resource"] + ": " + $parameter["operation"]}}',
|
|
16
|
+
defaults: { name: 'Synca Konimbo' },
|
|
17
|
+
inputs: ["main"],
|
|
18
|
+
outputs: ["main"],
|
|
19
|
+
credentials: [{ name: 'customSyncaApiCredentials', required: true }],
|
|
20
|
+
properties: [
|
|
21
|
+
{
|
|
22
|
+
displayName: 'Credentials',
|
|
23
|
+
name: 'credentials',
|
|
24
|
+
type: 'options',
|
|
25
|
+
typeOptions: { loadOptionsMethod: 'getCredentials' },
|
|
26
|
+
default: '',
|
|
27
|
+
required: true,
|
|
28
|
+
description: 'Select the Konimbo credentials to use',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
displayName: 'Resource',
|
|
32
|
+
name: 'resource',
|
|
33
|
+
type: 'options',
|
|
34
|
+
noDataExpression: true,
|
|
35
|
+
options: [
|
|
36
|
+
{
|
|
37
|
+
name: 'Items',
|
|
38
|
+
value: 'items',
|
|
39
|
+
description: 'Manage products/items in the store',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'Orders',
|
|
43
|
+
value: 'orders',
|
|
44
|
+
description: 'Manage orders',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: 'Customers',
|
|
48
|
+
value: 'customers',
|
|
49
|
+
description: 'Manage customers',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: 'Carts',
|
|
53
|
+
value: 'carts',
|
|
54
|
+
description: 'Manage shopping carts',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'Store Categories',
|
|
58
|
+
value: 'store_categories',
|
|
59
|
+
description: 'Manage store categories',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: 'Webhooks',
|
|
63
|
+
value: 'webhooks',
|
|
64
|
+
description: 'Manage webhooks',
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
default: 'items',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
displayName: 'Operation',
|
|
71
|
+
name: 'operation',
|
|
72
|
+
type: 'options',
|
|
73
|
+
noDataExpression: true,
|
|
74
|
+
displayOptions: { show: { resource: ['items'] } },
|
|
75
|
+
options: [
|
|
76
|
+
{
|
|
77
|
+
name: 'Get Item',
|
|
78
|
+
value: 'get_item',
|
|
79
|
+
description: 'Retrieve a single item by ID, code, or second_code',
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: 'Get Items',
|
|
83
|
+
value: 'get_items',
|
|
84
|
+
description: 'Retrieve multiple items with filtering and pagination',
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: 'Create Item',
|
|
88
|
+
value: 'create_item',
|
|
89
|
+
description: 'Create a new item',
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
name: 'Update Item',
|
|
93
|
+
value: 'update_item',
|
|
94
|
+
description: 'Update an existing item',
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: 'Delete Item',
|
|
98
|
+
value: 'delete_item',
|
|
99
|
+
description: 'Move item to trash (can be restored from admin panel)',
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
default: 'get_items',
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
displayName: 'Operation',
|
|
106
|
+
name: 'operation',
|
|
107
|
+
type: 'options',
|
|
108
|
+
noDataExpression: true,
|
|
109
|
+
displayOptions: { show: { resource: ['orders'] } },
|
|
110
|
+
options: [
|
|
111
|
+
{
|
|
112
|
+
name: 'Get Order',
|
|
113
|
+
value: 'get_order',
|
|
114
|
+
description: 'Retrieve a single order by ID',
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: 'Get Orders',
|
|
118
|
+
value: 'get_orders',
|
|
119
|
+
description: 'Retrieve multiple orders with filtering and pagination',
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
name: 'Create Order',
|
|
123
|
+
value: 'create_order',
|
|
124
|
+
description: 'Create a new order',
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
name: 'Update Order',
|
|
128
|
+
value: 'update_order',
|
|
129
|
+
description: 'Update an order (primarily used for adding statuses)',
|
|
130
|
+
},
|
|
131
|
+
],
|
|
132
|
+
default: 'get_orders',
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
displayName: 'Operation',
|
|
136
|
+
name: 'operation',
|
|
137
|
+
type: 'options',
|
|
138
|
+
noDataExpression: true,
|
|
139
|
+
displayOptions: { show: { resource: ['customers'] } },
|
|
140
|
+
options: [
|
|
141
|
+
{
|
|
142
|
+
name: 'Get Customer',
|
|
143
|
+
value: 'get_customer',
|
|
144
|
+
description: 'Retrieve a single customer by ID',
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: 'Get Customers',
|
|
148
|
+
value: 'get_customers',
|
|
149
|
+
description: 'Retrieve multiple customers with filtering and pagination',
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
name: 'Create Customer',
|
|
153
|
+
value: 'create_customer',
|
|
154
|
+
description: 'Create a new customer',
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
name: 'Update Customer',
|
|
158
|
+
value: 'update_customer',
|
|
159
|
+
description: 'Update an existing customer',
|
|
160
|
+
},
|
|
161
|
+
],
|
|
162
|
+
default: 'get_customers',
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
displayName: 'Operation',
|
|
166
|
+
name: 'operation',
|
|
167
|
+
type: 'options',
|
|
168
|
+
noDataExpression: true,
|
|
169
|
+
displayOptions: { show: { resource: ['carts'] } },
|
|
170
|
+
options: [
|
|
171
|
+
{
|
|
172
|
+
name: 'Get Cart',
|
|
173
|
+
value: 'get_cart',
|
|
174
|
+
description: 'Retrieve a single cart by ID',
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
name: 'Create Cart',
|
|
178
|
+
value: 'create_cart',
|
|
179
|
+
description: 'Create a new cart',
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
name: 'Update Cart',
|
|
183
|
+
value: 'update_cart',
|
|
184
|
+
description: 'Update an existing cart',
|
|
185
|
+
},
|
|
186
|
+
],
|
|
187
|
+
default: 'get_cart',
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
displayName: 'Operation',
|
|
191
|
+
name: 'operation',
|
|
192
|
+
type: 'options',
|
|
193
|
+
noDataExpression: true,
|
|
194
|
+
displayOptions: { show: { resource: ['store_categories'] } },
|
|
195
|
+
options: [
|
|
196
|
+
{
|
|
197
|
+
name: 'Get Store Categories',
|
|
198
|
+
value: 'get_store_categories',
|
|
199
|
+
description: 'Retrieve all store categories',
|
|
200
|
+
},
|
|
201
|
+
],
|
|
202
|
+
default: 'get_store_categories',
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
displayName: 'Operation',
|
|
206
|
+
name: 'operation',
|
|
207
|
+
type: 'options',
|
|
208
|
+
noDataExpression: true,
|
|
209
|
+
displayOptions: { show: { resource: ['webhooks'] } },
|
|
210
|
+
options: [
|
|
211
|
+
{
|
|
212
|
+
name: 'Get Webhooks',
|
|
213
|
+
value: 'get_webhooks',
|
|
214
|
+
description: 'Retrieve all webhooks',
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
name: 'Create Webhook',
|
|
218
|
+
value: 'create_webhook',
|
|
219
|
+
description: 'Create a new webhook',
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
name: 'Update Webhook',
|
|
223
|
+
value: 'update_webhook',
|
|
224
|
+
description: 'Update an existing webhook',
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
name: 'Delete Webhook',
|
|
228
|
+
value: 'delete_webhook',
|
|
229
|
+
description: 'Delete a webhook',
|
|
230
|
+
},
|
|
231
|
+
],
|
|
232
|
+
default: 'get_webhooks',
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
displayName: 'Identifier Type',
|
|
236
|
+
name: 'identifier_type',
|
|
237
|
+
type: 'options',
|
|
238
|
+
required: true,
|
|
239
|
+
default: 'id',
|
|
240
|
+
options: [
|
|
241
|
+
{ name: 'ID', value: 'id' },
|
|
242
|
+
{ name: 'Code', value: 'code' },
|
|
243
|
+
{ name: 'Second Code', value: 'second_code' },
|
|
244
|
+
],
|
|
245
|
+
displayOptions: {
|
|
246
|
+
show: {
|
|
247
|
+
resource: ['items'],
|
|
248
|
+
operation: ['get_item', 'update_item', 'delete_item'],
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
description: 'Type of identifier to use for the item',
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
displayName: 'Identifier Value',
|
|
255
|
+
name: 'identifier_value',
|
|
256
|
+
type: 'string',
|
|
257
|
+
required: true,
|
|
258
|
+
default: '',
|
|
259
|
+
displayOptions: {
|
|
260
|
+
show: {
|
|
261
|
+
resource: ['items'],
|
|
262
|
+
operation: ['get_item', 'update_item', 'delete_item'],
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
description: 'The value of the identifier (ID, code, or second_code)',
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
displayName: 'Attributes',
|
|
269
|
+
name: 'attributes',
|
|
270
|
+
type: 'string',
|
|
271
|
+
default: '',
|
|
272
|
+
displayOptions: {
|
|
273
|
+
show: {
|
|
274
|
+
resource: ['items', 'orders', 'customers', 'carts', 'store_categories', 'webhooks'],
|
|
275
|
+
operation: ['get_item', 'get_items', 'get_order', 'get_orders', 'get_customer', 'get_customers', 'get_cart', 'get_store_categories', 'get_webhooks'],
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
description: 'Comma-separated list of fields to return (e.g., "id,title,price")',
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
displayName: 'Item Data',
|
|
282
|
+
name: 'item_data',
|
|
283
|
+
type: 'json',
|
|
284
|
+
required: true,
|
|
285
|
+
default: '{}',
|
|
286
|
+
displayOptions: {
|
|
287
|
+
show: {
|
|
288
|
+
resource: ['items'],
|
|
289
|
+
operation: ['create_item', 'update_item'],
|
|
290
|
+
},
|
|
291
|
+
},
|
|
292
|
+
description: 'JSON object with item data. Required fields for create: title, store_category_title',
|
|
293
|
+
placeholder: '{"title": "Product Name", "store_category_title": "Category", "price": 100}',
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
displayName: 'Filters',
|
|
297
|
+
name: 'item_filters',
|
|
298
|
+
type: 'collection',
|
|
299
|
+
placeholder: 'Add Filter',
|
|
300
|
+
default: {},
|
|
301
|
+
displayOptions: {
|
|
302
|
+
show: {
|
|
303
|
+
resource: ['items'],
|
|
304
|
+
operation: ['get_items'],
|
|
305
|
+
},
|
|
306
|
+
},
|
|
307
|
+
options: [
|
|
308
|
+
{
|
|
309
|
+
displayName: 'Sort By',
|
|
310
|
+
name: 'sort_by',
|
|
311
|
+
type: 'options',
|
|
312
|
+
default: 'created_at',
|
|
313
|
+
options: [
|
|
314
|
+
{ name: 'Created At', value: 'created_at' },
|
|
315
|
+
{ name: 'Updated At', value: 'updated_at' },
|
|
316
|
+
{ name: 'Price', value: 'price' },
|
|
317
|
+
{ name: 'Title', value: 'title' },
|
|
318
|
+
],
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
displayName: 'Sort Order',
|
|
322
|
+
name: 'sort_order',
|
|
323
|
+
type: 'options',
|
|
324
|
+
default: 'desc',
|
|
325
|
+
options: [
|
|
326
|
+
{ name: 'Ascending', value: 'asc' },
|
|
327
|
+
{ name: 'Descending', value: 'desc' },
|
|
328
|
+
],
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
displayName: 'Page',
|
|
332
|
+
name: 'page',
|
|
333
|
+
type: 'number',
|
|
334
|
+
default: 1,
|
|
335
|
+
typeOptions: { minValue: 1 },
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
displayName: 'Visible',
|
|
339
|
+
name: 'visible',
|
|
340
|
+
type: 'boolean',
|
|
341
|
+
default: true,
|
|
342
|
+
description: 'Filter by visibility in store',
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
displayName: 'Min Price',
|
|
346
|
+
name: 'min_price',
|
|
347
|
+
type: 'number',
|
|
348
|
+
default: 0,
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
displayName: 'Max Price',
|
|
352
|
+
name: 'max_price',
|
|
353
|
+
type: 'number',
|
|
354
|
+
default: 0,
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
displayName: 'Tag ID',
|
|
358
|
+
name: 'tag_id',
|
|
359
|
+
type: 'string',
|
|
360
|
+
default: '',
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
displayName: 'Store Category ID',
|
|
364
|
+
name: 'store_category_id',
|
|
365
|
+
type: 'string',
|
|
366
|
+
default: '',
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
displayName: 'Created At Min',
|
|
370
|
+
name: 'created_at_min',
|
|
371
|
+
type: 'dateTime',
|
|
372
|
+
default: '',
|
|
373
|
+
description: 'Filter: created after this date (ISO-8601)',
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
displayName: 'Created At Max',
|
|
377
|
+
name: 'created_at_max',
|
|
378
|
+
type: 'dateTime',
|
|
379
|
+
default: '',
|
|
380
|
+
description: 'Filter: created before this date (ISO-8601)',
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
displayName: 'Updated At Min',
|
|
384
|
+
name: 'updated_at_min',
|
|
385
|
+
type: 'dateTime',
|
|
386
|
+
default: '',
|
|
387
|
+
description: 'Filter: updated after this date (ISO-8601)',
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
displayName: 'Updated At Max',
|
|
391
|
+
name: 'updated_at_max',
|
|
392
|
+
type: 'dateTime',
|
|
393
|
+
default: '',
|
|
394
|
+
description: 'Filter: updated before this date (ISO-8601)',
|
|
395
|
+
},
|
|
396
|
+
],
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
displayName: 'Order ID',
|
|
400
|
+
name: 'order_id',
|
|
401
|
+
type: 'string',
|
|
402
|
+
required: true,
|
|
403
|
+
default: '',
|
|
404
|
+
displayOptions: {
|
|
405
|
+
show: {
|
|
406
|
+
resource: ['orders'],
|
|
407
|
+
operation: ['get_order', 'update_order'],
|
|
408
|
+
},
|
|
409
|
+
},
|
|
410
|
+
description: 'The unique identifier of the order',
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
displayName: 'Order Data',
|
|
414
|
+
name: 'order_data',
|
|
415
|
+
type: 'json',
|
|
416
|
+
required: true,
|
|
417
|
+
default: '{}',
|
|
418
|
+
displayOptions: {
|
|
419
|
+
show: {
|
|
420
|
+
resource: ['orders'],
|
|
421
|
+
operation: ['create_order', 'update_order'],
|
|
422
|
+
},
|
|
423
|
+
},
|
|
424
|
+
description: 'JSON object with order data',
|
|
425
|
+
placeholder: '{"customer_id": "123", "items": [...]}',
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
displayName: 'Filters',
|
|
429
|
+
name: 'order_filters',
|
|
430
|
+
type: 'collection',
|
|
431
|
+
placeholder: 'Add Filter',
|
|
432
|
+
default: {},
|
|
433
|
+
displayOptions: {
|
|
434
|
+
show: {
|
|
435
|
+
resource: ['orders'],
|
|
436
|
+
operation: ['get_orders'],
|
|
437
|
+
},
|
|
438
|
+
},
|
|
439
|
+
options: [
|
|
440
|
+
{
|
|
441
|
+
displayName: 'Sort By',
|
|
442
|
+
name: 'sort_by',
|
|
443
|
+
type: 'options',
|
|
444
|
+
default: 'created_at',
|
|
445
|
+
options: [
|
|
446
|
+
{ name: 'Created At', value: 'created_at' },
|
|
447
|
+
{ name: 'Updated At', value: 'updated_at' },
|
|
448
|
+
],
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
displayName: 'Sort Order',
|
|
452
|
+
name: 'sort_order',
|
|
453
|
+
type: 'options',
|
|
454
|
+
default: 'desc',
|
|
455
|
+
options: [
|
|
456
|
+
{ name: 'Ascending', value: 'asc' },
|
|
457
|
+
{ name: 'Descending', value: 'desc' },
|
|
458
|
+
],
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
displayName: 'Page',
|
|
462
|
+
name: 'page',
|
|
463
|
+
type: 'number',
|
|
464
|
+
default: 1,
|
|
465
|
+
typeOptions: { minValue: 1 },
|
|
466
|
+
},
|
|
467
|
+
{
|
|
468
|
+
displayName: 'Payment Status',
|
|
469
|
+
name: 'payment_status',
|
|
470
|
+
type: 'string',
|
|
471
|
+
default: '',
|
|
472
|
+
description: 'Filter by payment status (Hebrew, e.g., "שולם")',
|
|
473
|
+
},
|
|
474
|
+
{
|
|
475
|
+
displayName: 'Status Option Title',
|
|
476
|
+
name: 'status_option_title',
|
|
477
|
+
type: 'string',
|
|
478
|
+
default: '',
|
|
479
|
+
},
|
|
480
|
+
{
|
|
481
|
+
displayName: 'Created At Min',
|
|
482
|
+
name: 'created_at_min',
|
|
483
|
+
type: 'dateTime',
|
|
484
|
+
default: '',
|
|
485
|
+
},
|
|
486
|
+
{
|
|
487
|
+
displayName: 'Created At Max',
|
|
488
|
+
name: 'created_at_max',
|
|
489
|
+
type: 'dateTime',
|
|
490
|
+
default: '',
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
displayName: 'Updated At Min',
|
|
494
|
+
name: 'updated_at_min',
|
|
495
|
+
type: 'dateTime',
|
|
496
|
+
default: '',
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
displayName: 'Updated At Max',
|
|
500
|
+
name: 'updated_at_max',
|
|
501
|
+
type: 'dateTime',
|
|
502
|
+
default: '',
|
|
503
|
+
},
|
|
504
|
+
],
|
|
505
|
+
},
|
|
506
|
+
{
|
|
507
|
+
displayName: 'Customer ID',
|
|
508
|
+
name: 'customer_id',
|
|
509
|
+
type: 'string',
|
|
510
|
+
required: true,
|
|
511
|
+
default: '',
|
|
512
|
+
displayOptions: {
|
|
513
|
+
show: {
|
|
514
|
+
resource: ['customers'],
|
|
515
|
+
operation: ['get_customer', 'update_customer'],
|
|
516
|
+
},
|
|
517
|
+
},
|
|
518
|
+
description: 'The unique identifier of the customer',
|
|
519
|
+
},
|
|
520
|
+
{
|
|
521
|
+
displayName: 'Customer Data',
|
|
522
|
+
name: 'customer_data',
|
|
523
|
+
type: 'json',
|
|
524
|
+
required: true,
|
|
525
|
+
default: '{}',
|
|
526
|
+
displayOptions: {
|
|
527
|
+
show: {
|
|
528
|
+
resource: ['customers'],
|
|
529
|
+
operation: ['create_customer', 'update_customer'],
|
|
530
|
+
},
|
|
531
|
+
},
|
|
532
|
+
description: 'JSON object with customer data',
|
|
533
|
+
placeholder: '{"email": "customer@example.com", "name": "John Doe"}',
|
|
534
|
+
},
|
|
535
|
+
{
|
|
536
|
+
displayName: 'Filters',
|
|
537
|
+
name: 'customer_filters',
|
|
538
|
+
type: 'collection',
|
|
539
|
+
placeholder: 'Add Filter',
|
|
540
|
+
default: {},
|
|
541
|
+
displayOptions: {
|
|
542
|
+
show: {
|
|
543
|
+
resource: ['customers'],
|
|
544
|
+
operation: ['get_customers'],
|
|
545
|
+
},
|
|
546
|
+
},
|
|
547
|
+
options: [
|
|
548
|
+
{
|
|
549
|
+
displayName: 'Sort By',
|
|
550
|
+
name: 'sort_by',
|
|
551
|
+
type: 'options',
|
|
552
|
+
default: 'created_at',
|
|
553
|
+
options: [
|
|
554
|
+
{ name: 'Created At', value: 'created_at' },
|
|
555
|
+
{ name: 'Updated At', value: 'updated_at' },
|
|
556
|
+
],
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
displayName: 'Sort Order',
|
|
560
|
+
name: 'sort_order',
|
|
561
|
+
type: 'options',
|
|
562
|
+
default: 'desc',
|
|
563
|
+
options: [
|
|
564
|
+
{ name: 'Ascending', value: 'asc' },
|
|
565
|
+
{ name: 'Descending', value: 'desc' },
|
|
566
|
+
],
|
|
567
|
+
},
|
|
568
|
+
{
|
|
569
|
+
displayName: 'Page',
|
|
570
|
+
name: 'page',
|
|
571
|
+
type: 'number',
|
|
572
|
+
default: 1,
|
|
573
|
+
typeOptions: { minValue: 1 },
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
displayName: 'Email',
|
|
577
|
+
name: 'email',
|
|
578
|
+
type: 'string',
|
|
579
|
+
default: '',
|
|
580
|
+
description: 'Filter by customer email',
|
|
581
|
+
},
|
|
582
|
+
{
|
|
583
|
+
displayName: 'Phone',
|
|
584
|
+
name: 'phone',
|
|
585
|
+
type: 'string',
|
|
586
|
+
default: '',
|
|
587
|
+
description: 'Filter by customer phone',
|
|
588
|
+
},
|
|
589
|
+
{
|
|
590
|
+
displayName: 'Created At Min',
|
|
591
|
+
name: 'created_at_min',
|
|
592
|
+
type: 'dateTime',
|
|
593
|
+
default: '',
|
|
594
|
+
},
|
|
595
|
+
{
|
|
596
|
+
displayName: 'Created At Max',
|
|
597
|
+
name: 'created_at_max',
|
|
598
|
+
type: 'dateTime',
|
|
599
|
+
default: '',
|
|
600
|
+
},
|
|
601
|
+
{
|
|
602
|
+
displayName: 'Updated At Min',
|
|
603
|
+
name: 'updated_at_min',
|
|
604
|
+
type: 'dateTime',
|
|
605
|
+
default: '',
|
|
606
|
+
},
|
|
607
|
+
{
|
|
608
|
+
displayName: 'Updated At Max',
|
|
609
|
+
name: 'updated_at_max',
|
|
610
|
+
type: 'dateTime',
|
|
611
|
+
default: '',
|
|
612
|
+
},
|
|
613
|
+
],
|
|
614
|
+
},
|
|
615
|
+
{
|
|
616
|
+
displayName: 'Cart ID',
|
|
617
|
+
name: 'cart_id',
|
|
618
|
+
type: 'string',
|
|
619
|
+
required: true,
|
|
620
|
+
default: '',
|
|
621
|
+
displayOptions: {
|
|
622
|
+
show: {
|
|
623
|
+
resource: ['carts'],
|
|
624
|
+
operation: ['get_cart', 'update_cart'],
|
|
625
|
+
},
|
|
626
|
+
},
|
|
627
|
+
description: 'The unique identifier of the cart',
|
|
628
|
+
},
|
|
629
|
+
{
|
|
630
|
+
displayName: 'Cart Data',
|
|
631
|
+
name: 'cart_data',
|
|
632
|
+
type: 'json',
|
|
633
|
+
required: true,
|
|
634
|
+
default: '{}',
|
|
635
|
+
displayOptions: {
|
|
636
|
+
show: {
|
|
637
|
+
resource: ['carts'],
|
|
638
|
+
operation: ['create_cart', 'update_cart'],
|
|
639
|
+
},
|
|
640
|
+
},
|
|
641
|
+
description: 'JSON object with cart data',
|
|
642
|
+
placeholder: '{"items": [{"item_id": "123", "quantity": 2}]}',
|
|
643
|
+
},
|
|
644
|
+
{
|
|
645
|
+
displayName: 'Webhook ID',
|
|
646
|
+
name: 'webhook_id',
|
|
647
|
+
type: 'string',
|
|
648
|
+
required: true,
|
|
649
|
+
default: '',
|
|
650
|
+
displayOptions: {
|
|
651
|
+
show: {
|
|
652
|
+
resource: ['webhooks'],
|
|
653
|
+
operation: ['update_webhook', 'delete_webhook'],
|
|
654
|
+
},
|
|
655
|
+
},
|
|
656
|
+
description: 'The unique identifier of the webhook',
|
|
657
|
+
},
|
|
658
|
+
{
|
|
659
|
+
displayName: 'Callback URL',
|
|
660
|
+
name: 'callback_url',
|
|
661
|
+
type: 'string',
|
|
662
|
+
required: true,
|
|
663
|
+
default: '',
|
|
664
|
+
displayOptions: {
|
|
665
|
+
show: {
|
|
666
|
+
resource: ['webhooks'],
|
|
667
|
+
operation: ['create_webhook'],
|
|
668
|
+
},
|
|
669
|
+
},
|
|
670
|
+
description: 'The URL to call when the webhook event occurs',
|
|
671
|
+
},
|
|
672
|
+
{
|
|
673
|
+
displayName: 'Event',
|
|
674
|
+
name: 'webhook_event',
|
|
675
|
+
type: 'options',
|
|
676
|
+
required: true,
|
|
677
|
+
default: 'order_created',
|
|
678
|
+
options: [
|
|
679
|
+
{ name: 'Order Created', value: 'order_created' },
|
|
680
|
+
],
|
|
681
|
+
displayOptions: {
|
|
682
|
+
show: {
|
|
683
|
+
resource: ['webhooks'],
|
|
684
|
+
operation: ['create_webhook'],
|
|
685
|
+
},
|
|
686
|
+
},
|
|
687
|
+
description: 'The event that triggers the webhook',
|
|
688
|
+
},
|
|
689
|
+
{
|
|
690
|
+
displayName: 'Webhook Data',
|
|
691
|
+
name: 'webhook_data',
|
|
692
|
+
type: 'json',
|
|
693
|
+
required: true,
|
|
694
|
+
default: '{}',
|
|
695
|
+
displayOptions: {
|
|
696
|
+
show: {
|
|
697
|
+
resource: ['webhooks'],
|
|
698
|
+
operation: ['update_webhook'],
|
|
699
|
+
},
|
|
700
|
+
},
|
|
701
|
+
description: 'JSON object with webhook data to update',
|
|
702
|
+
placeholder: '{"callback_url": "https://example.com/webhook"}',
|
|
703
|
+
},
|
|
704
|
+
],
|
|
705
|
+
};
|
|
706
|
+
this.methods = {
|
|
707
|
+
loadOptions: {
|
|
708
|
+
async getCredentials() {
|
|
709
|
+
try {
|
|
710
|
+
const { apiToken, baseUrl } = await this.getCredentials('customSyncaApiCredentials');
|
|
711
|
+
const res = await this.helpers.httpRequest({
|
|
712
|
+
method: 'GET',
|
|
713
|
+
url: `${baseUrl}/v1/invoke/get-credentials`,
|
|
714
|
+
headers: { 'x-api-token': apiToken },
|
|
715
|
+
});
|
|
716
|
+
return Array.isArray(res)
|
|
717
|
+
? res.map((c) => ({ name: c.name || c.id, value: c.id }))
|
|
718
|
+
: [];
|
|
719
|
+
}
|
|
720
|
+
catch {
|
|
721
|
+
return [{ name: 'Default', value: 'default' }];
|
|
722
|
+
}
|
|
723
|
+
},
|
|
724
|
+
},
|
|
725
|
+
};
|
|
726
|
+
}
|
|
727
|
+
async execute() {
|
|
728
|
+
const items = this.getInputData();
|
|
729
|
+
const out = [];
|
|
730
|
+
const { apiToken, baseUrl } = await this.getCredentials('customSyncaApiCredentials');
|
|
731
|
+
for (let i = 0; i < items.length; i++) {
|
|
732
|
+
try {
|
|
733
|
+
const credentialId = this.getNodeParameter('credentials', i);
|
|
734
|
+
const operation = this.getNodeParameter('operation', i);
|
|
735
|
+
const resource = this.getNodeParameter('resource', i);
|
|
736
|
+
let params = {};
|
|
737
|
+
try {
|
|
738
|
+
const attributes = this.getNodeParameter('attributes', i, '');
|
|
739
|
+
if (attributes) {
|
|
740
|
+
params.attributes = attributes;
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
catch {
|
|
744
|
+
}
|
|
745
|
+
if (resource === 'items') {
|
|
746
|
+
if (['get_item', 'update_item', 'delete_item'].includes(operation)) {
|
|
747
|
+
const idType = this.getNodeParameter('identifier_type', i);
|
|
748
|
+
const idValue = this.getNodeParameter('identifier_value', i);
|
|
749
|
+
params[idType] = idValue;
|
|
750
|
+
}
|
|
751
|
+
if (['create_item', 'update_item'].includes(operation)) {
|
|
752
|
+
const itemData = this.getNodeParameter('item_data', i, '{}');
|
|
753
|
+
try {
|
|
754
|
+
params.item = JSON.parse(itemData);
|
|
755
|
+
}
|
|
756
|
+
catch {
|
|
757
|
+
params.item = itemData;
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
if (operation === 'get_items') {
|
|
761
|
+
try {
|
|
762
|
+
const filters = this.getNodeParameter('item_filters', i, {});
|
|
763
|
+
Object.entries(filters).forEach(([key, value]) => {
|
|
764
|
+
if (value !== undefined && value !== null && value !== '') {
|
|
765
|
+
params[key] = value;
|
|
766
|
+
}
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
catch {
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
if (resource === 'orders') {
|
|
774
|
+
if (['get_order', 'update_order'].includes(operation)) {
|
|
775
|
+
const orderId = this.getNodeParameter('order_id', i);
|
|
776
|
+
params.order_id = orderId;
|
|
777
|
+
}
|
|
778
|
+
if (['create_order', 'update_order'].includes(operation)) {
|
|
779
|
+
const orderData = this.getNodeParameter('order_data', i, '{}');
|
|
780
|
+
try {
|
|
781
|
+
params.order = JSON.parse(orderData);
|
|
782
|
+
}
|
|
783
|
+
catch {
|
|
784
|
+
params.order = orderData;
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
if (operation === 'get_orders') {
|
|
788
|
+
try {
|
|
789
|
+
const filters = this.getNodeParameter('order_filters', i, {});
|
|
790
|
+
Object.entries(filters).forEach(([key, value]) => {
|
|
791
|
+
if (value !== undefined && value !== null && value !== '') {
|
|
792
|
+
params[key] = value;
|
|
793
|
+
}
|
|
794
|
+
});
|
|
795
|
+
}
|
|
796
|
+
catch {
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
if (resource === 'customers') {
|
|
801
|
+
if (['get_customer', 'update_customer'].includes(operation)) {
|
|
802
|
+
const customerId = this.getNodeParameter('customer_id', i);
|
|
803
|
+
params.customer_id = customerId;
|
|
804
|
+
}
|
|
805
|
+
if (['create_customer', 'update_customer'].includes(operation)) {
|
|
806
|
+
const customerData = this.getNodeParameter('customer_data', i, '{}');
|
|
807
|
+
try {
|
|
808
|
+
params.customer = JSON.parse(customerData);
|
|
809
|
+
}
|
|
810
|
+
catch {
|
|
811
|
+
params.customer = customerData;
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
if (operation === 'get_customers') {
|
|
815
|
+
try {
|
|
816
|
+
const filters = this.getNodeParameter('customer_filters', i, {});
|
|
817
|
+
Object.entries(filters).forEach(([key, value]) => {
|
|
818
|
+
if (value !== undefined && value !== null && value !== '') {
|
|
819
|
+
params[key] = value;
|
|
820
|
+
}
|
|
821
|
+
});
|
|
822
|
+
}
|
|
823
|
+
catch {
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
if (resource === 'carts') {
|
|
828
|
+
if (['get_cart', 'update_cart'].includes(operation)) {
|
|
829
|
+
const cartId = this.getNodeParameter('cart_id', i);
|
|
830
|
+
params.cart_id = cartId;
|
|
831
|
+
}
|
|
832
|
+
if (['create_cart', 'update_cart'].includes(operation)) {
|
|
833
|
+
const cartData = this.getNodeParameter('cart_data', i, '{}');
|
|
834
|
+
try {
|
|
835
|
+
params.cart = JSON.parse(cartData);
|
|
836
|
+
}
|
|
837
|
+
catch {
|
|
838
|
+
params.cart = cartData;
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
if (resource === 'webhooks') {
|
|
843
|
+
if (['update_webhook', 'delete_webhook'].includes(operation)) {
|
|
844
|
+
const webhookId = this.getNodeParameter('webhook_id', i);
|
|
845
|
+
params.webhook_id = webhookId;
|
|
846
|
+
}
|
|
847
|
+
if (operation === 'create_webhook') {
|
|
848
|
+
const callbackUrl = this.getNodeParameter('callback_url', i);
|
|
849
|
+
const event = this.getNodeParameter('webhook_event', i);
|
|
850
|
+
params.callback_url = callbackUrl;
|
|
851
|
+
params.event = event;
|
|
852
|
+
}
|
|
853
|
+
if (operation === 'update_webhook') {
|
|
854
|
+
const webhookData = this.getNodeParameter('webhook_data', i, '{}');
|
|
855
|
+
try {
|
|
856
|
+
params.webhook = JSON.parse(webhookData);
|
|
857
|
+
}
|
|
858
|
+
catch {
|
|
859
|
+
params.webhook = webhookData;
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
const req = {
|
|
864
|
+
method: 'POST',
|
|
865
|
+
url: `${baseUrl}/v1/invoke/${credentialId}/${operation}`,
|
|
866
|
+
headers: { 'x-api-token': apiToken, 'Content-Type': 'application/json' },
|
|
867
|
+
body: params,
|
|
868
|
+
json: true,
|
|
869
|
+
};
|
|
870
|
+
const response = await this.helpers.httpRequest(req);
|
|
871
|
+
out.push({ json: response, pairedItem: { item: i } });
|
|
872
|
+
}
|
|
873
|
+
catch (err) {
|
|
874
|
+
if (this.continueOnFail()) {
|
|
875
|
+
out.push({ json: { error: err.message }, pairedItem: { item: i } });
|
|
876
|
+
continue;
|
|
877
|
+
}
|
|
878
|
+
throw err;
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
return [out];
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
exports.SyncaKonimbo = SyncaKonimbo;
|
|
885
|
+
//# sourceMappingURL=SyncaKonimbo.node.js.map
|