n8n-nodes-synca 1.0.18 → 1.0.21

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.
@@ -0,0 +1,10 @@
1
+ import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription, ILoadOptionsFunctions, INodePropertyOptions } from 'n8n-workflow';
2
+ export declare class SyncaPriorityAPI implements INodeType {
3
+ description: INodeTypeDescription;
4
+ methods: {
5
+ loadOptions: {
6
+ getCredentials(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
7
+ };
8
+ };
9
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
10
+ }
@@ -0,0 +1,391 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SyncaPriorityAPI = void 0;
4
+ class SyncaPriorityAPI {
5
+ constructor() {
6
+ this.description = {
7
+ displayName: 'Synca Priority ERP API',
8
+ name: 'customSyncaPriorityAPI',
9
+ icon: 'fa:api',
10
+ group: ['transform'],
11
+ version: 1,
12
+ description: 'Interact with Custom API for Orders, Items, Customers, and Purchase Orders',
13
+ defaults: {
14
+ name: 'Synca Priority ERP API',
15
+ },
16
+ inputs: ["main"],
17
+ outputs: ["main"],
18
+ credentials: [
19
+ {
20
+ name: 'customSyncaApiCredentials',
21
+ required: true,
22
+ },
23
+ ],
24
+ properties: [
25
+ {
26
+ displayName: 'Credentials',
27
+ name: 'credentials',
28
+ type: 'options',
29
+ typeOptions: {
30
+ loadOptionsMethod: 'getCredentials',
31
+ },
32
+ default: '',
33
+ required: true,
34
+ description: 'Select the credentials to use',
35
+ },
36
+ {
37
+ displayName: 'Resource',
38
+ name: 'resource',
39
+ type: 'options',
40
+ noDataExpression: true,
41
+ options: [
42
+ {
43
+ name: 'Order',
44
+ value: 'order',
45
+ },
46
+ {
47
+ name: 'Item',
48
+ value: 'item',
49
+ },
50
+ {
51
+ name: 'Customer',
52
+ value: 'customer',
53
+ },
54
+ {
55
+ name: 'Purchase Order',
56
+ value: 'purchaseOrder',
57
+ },
58
+ ],
59
+ default: 'order',
60
+ },
61
+ {
62
+ displayName: 'Operation',
63
+ name: 'operation',
64
+ type: 'options',
65
+ noDataExpression: true,
66
+ displayOptions: {
67
+ show: {
68
+ resource: ['order'],
69
+ },
70
+ },
71
+ options: [
72
+ {
73
+ name: 'Get Many',
74
+ value: 'getMany',
75
+ action: 'Get many orders',
76
+ },
77
+ {
78
+ name: 'Get',
79
+ value: 'get',
80
+ action: 'Get an order',
81
+ },
82
+ {
83
+ name: 'Create',
84
+ value: 'create',
85
+ action: 'Create an order',
86
+ },
87
+ {
88
+ name: 'Update',
89
+ value: 'update',
90
+ action: 'Update an order',
91
+ },
92
+ ],
93
+ default: 'getMany',
94
+ },
95
+ {
96
+ displayName: 'Operation',
97
+ name: 'operation',
98
+ type: 'options',
99
+ noDataExpression: true,
100
+ displayOptions: {
101
+ show: {
102
+ resource: ['item'],
103
+ },
104
+ },
105
+ options: [
106
+ {
107
+ name: 'Get Many',
108
+ value: 'getMany',
109
+ action: 'Get many items',
110
+ },
111
+ {
112
+ name: 'Get',
113
+ value: 'get',
114
+ action: 'Get a item',
115
+ },
116
+ {
117
+ name: 'Create',
118
+ value: 'create',
119
+ action: 'Create a item',
120
+ },
121
+ {
122
+ name: 'Update',
123
+ value: 'update',
124
+ action: 'Update a item',
125
+ },
126
+ ],
127
+ default: 'getMany',
128
+ },
129
+ {
130
+ displayName: 'Operation',
131
+ name: 'operation',
132
+ type: 'options',
133
+ noDataExpression: true,
134
+ displayOptions: {
135
+ show: {
136
+ resource: ['customer'],
137
+ },
138
+ },
139
+ options: [
140
+ {
141
+ name: 'Get Many',
142
+ value: 'getMany',
143
+ action: 'Get many customers',
144
+ },
145
+ {
146
+ name: 'Get',
147
+ value: 'get',
148
+ action: 'Get a customer',
149
+ },
150
+ {
151
+ name: 'Create',
152
+ value: 'create',
153
+ action: 'Create a customer',
154
+ },
155
+ {
156
+ name: 'Update',
157
+ value: 'update',
158
+ action: 'Update a customer',
159
+ },
160
+ ],
161
+ default: 'getMany',
162
+ },
163
+ {
164
+ displayName: 'Operation',
165
+ name: 'operation',
166
+ type: 'options',
167
+ noDataExpression: true,
168
+ displayOptions: {
169
+ show: {
170
+ resource: ['purchaseOrder'],
171
+ },
172
+ },
173
+ options: [
174
+ {
175
+ name: 'Get Many',
176
+ value: 'getMany',
177
+ action: 'Get many purchase orders',
178
+ },
179
+ {
180
+ name: 'Get',
181
+ value: 'get',
182
+ action: 'Get a purchase order',
183
+ },
184
+ {
185
+ name: 'Create',
186
+ value: 'create',
187
+ action: 'Create a purchase order',
188
+ },
189
+ {
190
+ name: 'Update',
191
+ value: 'update',
192
+ action: 'Update a purchase order',
193
+ },
194
+ ],
195
+ default: 'getMany',
196
+ },
197
+ {
198
+ displayName: 'Additional Fields',
199
+ name: 'additionalFields',
200
+ type: 'collection',
201
+ placeholder: 'Add Field',
202
+ default: {},
203
+ options: [
204
+ {
205
+ displayName: 'Top',
206
+ name: 'top',
207
+ type: 'number',
208
+ default: 100,
209
+ description: 'Number of records to return',
210
+ },
211
+ {
212
+ displayName: 'Skip',
213
+ name: 'skip',
214
+ type: 'number',
215
+ default: 50,
216
+ description: 'The amount of record to skip',
217
+ },
218
+ {
219
+ displayName: 'Filter',
220
+ name: 'filter',
221
+ type: 'string',
222
+ default: '',
223
+ description: 'Filter expression to apply to the results',
224
+ },
225
+ {
226
+ displayName: 'Select',
227
+ name: 'select',
228
+ type: 'string',
229
+ default: '',
230
+ description: 'Comma-separated list of fields to select',
231
+ },
232
+ ],
233
+ },
234
+ {
235
+ displayName: 'ID',
236
+ name: 'id',
237
+ type: 'string',
238
+ default: '',
239
+ required: true,
240
+ displayOptions: {
241
+ show: {
242
+ operation: ['get', 'update'],
243
+ },
244
+ },
245
+ description: 'ID of the record to get or update',
246
+ },
247
+ {
248
+ displayName: 'Data',
249
+ name: 'data',
250
+ type: 'json',
251
+ default: '{}',
252
+ displayOptions: {
253
+ show: {
254
+ operation: ['create', 'update'],
255
+ },
256
+ },
257
+ description: 'JSON data for creating or updating the record',
258
+ },
259
+ ],
260
+ };
261
+ this.methods = {
262
+ loadOptions: {
263
+ async getCredentials() {
264
+ try {
265
+ const credentials = await this.getCredentials('customSyncaApiCredentials');
266
+ const options = {
267
+ method: 'GET',
268
+ url: `${credentials.baseUrl}/v1/invoke/get-credentials`,
269
+ headers: {
270
+ 'x-api-token': credentials === null || credentials === void 0 ? void 0 : credentials.apiToken,
271
+ },
272
+ };
273
+ console.log({ options });
274
+ const response = await this.helpers.httpRequest(options);
275
+ if (Array.isArray(response)) {
276
+ return response.map((cred) => ({
277
+ name: cred.name || cred.id,
278
+ value: cred.id,
279
+ }));
280
+ }
281
+ return [];
282
+ }
283
+ catch (error) {
284
+ return [
285
+ {
286
+ name: 'Default Credentials',
287
+ value: 'default',
288
+ },
289
+ ];
290
+ }
291
+ },
292
+ },
293
+ };
294
+ }
295
+ async execute() {
296
+ const items = this.getInputData();
297
+ const returnData = [];
298
+ for (let i = 0; i < items.length; i++) {
299
+ try {
300
+ const resource = this.getNodeParameter('resource', i);
301
+ const operation = this.getNodeParameter('operation', i);
302
+ const credentialsId = this.getNodeParameter('credentials', i);
303
+ const additionalFields = this.getNodeParameter('additionalFields', i);
304
+ const credentials = await this.getCredentials('customSyncaApiCredentials');
305
+ const apiToken = credentials.apiToken;
306
+ const baseURL = credentials.baseUrl;
307
+ let actionName = '';
308
+ switch (operation) {
309
+ case 'getMany':
310
+ actionName = `get_${resource}s`;
311
+ break;
312
+ case 'get':
313
+ actionName = `get_${resource}`;
314
+ break;
315
+ case 'create':
316
+ actionName = `create_${resource}`;
317
+ break;
318
+ case 'update':
319
+ actionName = `update_${resource}`;
320
+ break;
321
+ }
322
+ const queryParams = {};
323
+ if (additionalFields.top !== undefined) {
324
+ queryParams.top = additionalFields.top.toString();
325
+ }
326
+ if (additionalFields.skip !== undefined) {
327
+ queryParams.skip = additionalFields.skip.toString();
328
+ }
329
+ if (additionalFields.filter) {
330
+ queryParams.filter = additionalFields.filter;
331
+ }
332
+ if (additionalFields.select) {
333
+ queryParams.select = additionalFields.select;
334
+ }
335
+ if (operation === 'get' || operation === 'update') {
336
+ const id = this.getNodeParameter('id', i);
337
+ queryParams.id = id;
338
+ }
339
+ if (operation === 'create' || operation === 'update') {
340
+ let data = this.getNodeParameter('data', i);
341
+ if (data) {
342
+ data = JSON.parse(data);
343
+ }
344
+ queryParams.data = data;
345
+ }
346
+ const baseUrl = `${baseURL}/v1/invoke/${credentialsId}/${actionName}`;
347
+ const options = {
348
+ method: 'POST',
349
+ url: baseUrl,
350
+ headers: {
351
+ 'x-api-token': apiToken,
352
+ 'Content-Type': 'application/json',
353
+ },
354
+ body: queryParams
355
+ };
356
+ console.log({ executeOptions: options });
357
+ const responseData = await this.helpers.httpRequest(options);
358
+ if (Array.isArray(responseData)) {
359
+ responseData.forEach((item) => {
360
+ returnData.push({
361
+ json: item,
362
+ pairedItem: { item: i },
363
+ });
364
+ });
365
+ }
366
+ else {
367
+ returnData.push({
368
+ json: responseData,
369
+ pairedItem: { item: i },
370
+ });
371
+ }
372
+ }
373
+ catch (error) {
374
+ console.log({ error });
375
+ if (this.continueOnFail()) {
376
+ returnData.push({
377
+ json: {
378
+ error: error.message,
379
+ },
380
+ pairedItem: { item: i },
381
+ });
382
+ continue;
383
+ }
384
+ throw error;
385
+ }
386
+ }
387
+ return [returnData];
388
+ }
389
+ }
390
+ exports.SyncaPriorityAPI = SyncaPriorityAPI;
391
+ //# sourceMappingURL=SyncaPriorityAPI.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SyncaPriorityAPI.node.js","sourceRoot":"","sources":["../../../nodes/PriorityAPI/SyncaPriorityAPI.node.ts"],"names":[],"mappings":";;;AAWA,MAAa,gBAAgB;IAA7B;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,wBAAwB;YACrC,IAAI,EAAE,wBAAwB;YAC9B,IAAI,EAAE,QAAQ;YACd,KAA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I,CAAC,cAAc,EAAE,EAAE;oBAC1B,UAAU,CAAC,IAAI,CAAC;wBACf,IAAI,EAAE;4BACL,KAAK,EAAE,KAAK,CAAC,OAAO;yBACpB;wBACD,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;qBACvB,CAAC,CAAC;oBACH,SAAS;iBACT;gBACD,MAAM,KAAK,CAAC;aACZ;SACD;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC;CACD;AAzZD,4CAyZC"}
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SyncaSuperpharm = void 0;
4
4
  function addResourceSpecificParams(requestParams, resource, operation, itemIndex, getNodeParameter) {
5
- const idFields = ['order_id', 'offer_id', 'return_id', 'tracking_id', 'thread_id'];
5
+ const idFields = ['order_id', 'offer_id', 'return_id', 'tracking_id', 'thread_id', 'documentType', 'documentUrl', 'carrier_code', 'carrier_name', 'carrier_standard_code', 'tracking_number', 'carrier_url'];
6
6
  for (const field of idFields) {
7
7
  try {
8
8
  const value = getNodeParameter(field, itemIndex, '');
@@ -217,6 +217,18 @@ class SyncaSuperpharm {
217
217
  action: 'Update order status',
218
218
  description: 'Update the status of order lines',
219
219
  },
220
+ {
221
+ name: 'Attach Documents To Order',
222
+ value: 'attach_document_to_order',
223
+ action: 'Attach documents to order',
224
+ description: 'Attach documents to an order by file or URL',
225
+ },
226
+ {
227
+ name: 'Update Order Tracking',
228
+ value: 'update_order_tracking',
229
+ action: 'Update Order Tracking',
230
+ description: 'Update the tracking information of an order',
231
+ },
220
232
  {
221
233
  name: 'Export Orders',
222
234
  value: 'export_orders',
@@ -467,12 +479,117 @@ class SyncaSuperpharm {
467
479
  displayOptions: {
468
480
  show: {
469
481
  resource: ['orders'],
470
- operation: ['get_order', 'accept_order', 'cancel_order', 'refund_order', 'ship_order'],
482
+ operation: ['get_order', 'accept_order', 'cancel_order', 'refund_order', 'ship_order', 'attach_document_to_order'],
471
483
  },
472
484
  },
473
485
  description: 'The unique identifier of the order',
474
486
  placeholder: 'ORD-12345-A',
475
487
  },
488
+ {
489
+ displayName: 'Document Type',
490
+ name: 'documentType',
491
+ type: 'string',
492
+ default: '',
493
+ required: true,
494
+ displayOptions: {
495
+ show: {
496
+ resource: ['orders'],
497
+ operation: ['attach_document_to_order'],
498
+ },
499
+ },
500
+ description: 'Type of document being attached',
501
+ placeholder: 'CUSTOMER_INVOICE',
502
+ },
503
+ {
504
+ displayName: 'Document URL',
505
+ name: 'documentUrl',
506
+ type: 'string',
507
+ default: '',
508
+ required: true,
509
+ displayOptions: {
510
+ show: {
511
+ resource: ['orders'],
512
+ operation: ['attach_document_to_order'],
513
+ },
514
+ },
515
+ description: 'URL of the document to attach',
516
+ placeholder: 'https://example.com/document.pdf',
517
+ },
518
+ {
519
+ displayName: 'Carrier Code',
520
+ name: 'carrier_code',
521
+ type: 'string',
522
+ default: '',
523
+ required: true,
524
+ displayOptions: {
525
+ show: {
526
+ resource: ['orders'],
527
+ operation: ['update_order_tracking'],
528
+ },
529
+ },
530
+ description: 'Order tracking carrier code',
531
+ placeholder: 'UPS',
532
+ },
533
+ {
534
+ displayName: 'Carrier Name',
535
+ name: 'carrier_name',
536
+ type: 'string',
537
+ default: '',
538
+ required: true,
539
+ displayOptions: {
540
+ show: {
541
+ resource: ['orders'],
542
+ operation: ['update_order_tracking'],
543
+ },
544
+ },
545
+ description: 'Order tracking carrier name',
546
+ placeholder: 'UPS',
547
+ },
548
+ {
549
+ displayName: 'Carrier Standard Code',
550
+ name: 'carrier_standard_code',
551
+ type: 'string',
552
+ default: '',
553
+ required: true,
554
+ displayOptions: {
555
+ show: {
556
+ resource: ['orders'],
557
+ operation: ['update_order_tracking'],
558
+ },
559
+ },
560
+ description: 'Order tracking carrier standard code',
561
+ placeholder: 'UPS',
562
+ },
563
+ {
564
+ displayName: 'Tracking Number',
565
+ name: 'tracking_number',
566
+ type: 'string',
567
+ default: '',
568
+ required: true,
569
+ displayOptions: {
570
+ show: {
571
+ resource: ['orders'],
572
+ operation: ['update_order_tracking'],
573
+ },
574
+ },
575
+ description: 'Order tracking tracking number',
576
+ placeholder: '1Z999AA1234567890',
577
+ },
578
+ {
579
+ displayName: 'Carrier URL',
580
+ name: 'carrier_url',
581
+ type: 'string',
582
+ default: '',
583
+ required: true,
584
+ displayOptions: {
585
+ show: {
586
+ resource: ['orders'],
587
+ operation: ['update_order_tracking'],
588
+ },
589
+ },
590
+ description: 'Order tracking tracking URL',
591
+ placeholder: 'https://example.com/tracking',
592
+ },
476
593
  {
477
594
  displayName: 'Offer ID',
478
595
  name: 'offer_id',