n8n-nodes-airprocess 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,881 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AirProcess = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ const AIRPROCESS_BASE_URL = 'https://app.airprocess.com';
6
+ const AIRPROCESS_MODELS_URL = `${AIRPROCESS_BASE_URL}/model`;
7
+ const CREATE_RECORD_BODY_EXPRESSION = '={{ (() => { const generatedId = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => { const r = Math.floor(Math.random() * 16); const v = c === "x" ? r : (r & 0x3) | 0x8; return v.toString(16); }); if ($parameter.createBodyMode === "fields") { const selectedFields = ($parameter.createFields && $parameter.createFields.field) ? $parameter.createFields.field : []; const payloadFromFields = selectedFields.reduce((acc, current) => { if (current.fieldId) { acc[current.fieldId] = current.value; } return acc; }, {}); return { ...payloadFromFields, id: generatedId }; } const payload = typeof $parameter.bodyCreate === "string" ? JSON.parse($parameter.bodyCreate) : $parameter.bodyCreate; return { ...payload, id: generatedId }; })() }}';
8
+ const FIND_RECORDS_MONGO_BODY_EXPRESSION = '={{ (() => { const selectedFields = ($parameter.findFields && $parameter.findFields.field) ? $parameter.findFields.field : []; const filter = selectedFields.reduce((acc, current) => { if (current.fieldId) { acc[current.fieldId] = current.value; } return acc; }, {}); return { operation: "search", filterSyntax: "mongo", skip: Number($parameter.findSkip ?? 0), limit: Number($parameter.findLimit ?? 10), filter }; })() }}';
9
+ function toModelOption(item) {
10
+ var _a, _b, _c, _d;
11
+ const modelId = (_b = (_a = item.modelID) !== null && _a !== void 0 ? _a : item.modelId) !== null && _b !== void 0 ? _b : item.id;
12
+ const modelName = (_d = (_c = item.ModelName) !== null && _c !== void 0 ? _c : item.modelName) !== null && _d !== void 0 ? _d : item.name;
13
+ if (typeof modelId !== 'string' || modelId.length === 0) {
14
+ return null;
15
+ }
16
+ if (typeof modelName !== 'string' || modelName.length === 0) {
17
+ return null;
18
+ }
19
+ return {
20
+ name: modelName,
21
+ value: modelId,
22
+ };
23
+ }
24
+ function toFieldOption(item) {
25
+ var _a, _b, _c, _d;
26
+ const fieldId = (_b = (_a = item.id) !== null && _a !== void 0 ? _a : item.fieldID) !== null && _b !== void 0 ? _b : item.fieldId;
27
+ const fieldName = (_d = (_c = item.label) !== null && _c !== void 0 ? _c : item.name) !== null && _d !== void 0 ? _d : fieldId;
28
+ if (typeof fieldId !== 'string' || fieldId.length === 0) {
29
+ return null;
30
+ }
31
+ if (typeof fieldName !== 'string' || fieldName.length === 0) {
32
+ return null;
33
+ }
34
+ return {
35
+ name: fieldName.trim().length > 0 ? fieldName : `Field ${fieldId}`,
36
+ value: fieldId,
37
+ };
38
+ }
39
+ function flattenPanelFields(items) {
40
+ const output = [];
41
+ for (const item of items) {
42
+ if ((item === null || item === void 0 ? void 0 : item.type) === 'panel' && Array.isArray(item.items)) {
43
+ output.push(...flattenPanelFields(item.items));
44
+ continue;
45
+ }
46
+ output.push(item);
47
+ }
48
+ return output;
49
+ }
50
+ function extractFieldsFromModelDetail(modelData) {
51
+ var _a;
52
+ const rootItems = Array.isArray(modelData === null || modelData === void 0 ? void 0 : modelData.items) ? modelData.items : [];
53
+ const fieldsFromPanelItems = flattenPanelFields(rootItems).filter((item) => (item === null || item === void 0 ? void 0 : item.type) !== 'panel');
54
+ const panelItems = Array.isArray(modelData === null || modelData === void 0 ? void 0 : modelData.panel)
55
+ ? modelData.panel.flatMap((panel) => (Array.isArray(panel === null || panel === void 0 ? void 0 : panel.items) ? flattenPanelFields(panel.items) : []))
56
+ : Array.isArray((_a = modelData === null || modelData === void 0 ? void 0 : modelData.panel) === null || _a === void 0 ? void 0 : _a.items)
57
+ ? flattenPanelFields(modelData.panel.items)
58
+ : [];
59
+ return [...fieldsFromPanelItems, ...panelItems];
60
+ }
61
+ function extractListFromResponse(response) {
62
+ if (Array.isArray(response)) {
63
+ return response;
64
+ }
65
+ if (response && typeof response === 'object') {
66
+ const objectResponse = response;
67
+ for (const key of ['data', 'models', 'items']) {
68
+ const value = objectResponse[key];
69
+ if (Array.isArray(value)) {
70
+ return value;
71
+ }
72
+ }
73
+ }
74
+ return [];
75
+ }
76
+ function extractSingleFromResponse(response) {
77
+ if (Array.isArray(response)) {
78
+ return response[0];
79
+ }
80
+ if (response && typeof response === 'object') {
81
+ const objectResponse = response;
82
+ if (objectResponse.data && typeof objectResponse.data === 'object') {
83
+ return objectResponse.data;
84
+ }
85
+ return response;
86
+ }
87
+ return undefined;
88
+ }
89
+ function resolveModelId(models, selectedModelId) {
90
+ var _a;
91
+ const matchingModel = models.find((model) => model.modelID === selectedModelId || model.modelId === selectedModelId || model.id === selectedModelId);
92
+ return (_a = matchingModel === null || matchingModel === void 0 ? void 0 : matchingModel.id) !== null && _a !== void 0 ? _a : selectedModelId;
93
+ }
94
+ async function fetchModels(loadOptions) {
95
+ const response = await loadOptions.helpers.httpRequestWithAuthentication.call(loadOptions, 'airProcessApi', {
96
+ method: 'GET',
97
+ url: AIRPROCESS_MODELS_URL,
98
+ json: true,
99
+ });
100
+ return extractListFromResponse(response);
101
+ }
102
+ async function getModelFieldOptions(loadOptions, modelIdParameterName, selectedFieldsParameterName) {
103
+ var _a;
104
+ const modelId = loadOptions.getCurrentNodeParameter(modelIdParameterName);
105
+ if (!modelId) {
106
+ return [];
107
+ }
108
+ const models = await fetchModels(loadOptions);
109
+ const resolvedModelId = resolveModelId(models, modelId);
110
+ const response = await loadOptions.helpers.httpRequestWithAuthentication.call(loadOptions, 'airProcessApi', {
111
+ method: 'GET',
112
+ url: `${AIRPROCESS_MODELS_URL}/${resolvedModelId}`,
113
+ json: true,
114
+ });
115
+ const modelData = extractSingleFromResponse(response);
116
+ const fields = extractFieldsFromModelDetail(modelData !== null && modelData !== void 0 ? modelData : {});
117
+ let selectedFields = [];
118
+ try {
119
+ selectedFields = (_a = loadOptions.getCurrentNodeParameter(selectedFieldsParameterName)) !== null && _a !== void 0 ? _a : [];
120
+ }
121
+ catch {
122
+ selectedFields = [];
123
+ }
124
+ const selectedFieldIds = new Set(selectedFields
125
+ .map((field) => field.fieldId)
126
+ .filter((fieldId) => typeof fieldId === 'string' && fieldId.length > 0));
127
+ const seen = new Set();
128
+ return fields
129
+ .map(toFieldOption)
130
+ .filter((option) => option !== null)
131
+ .filter((option) => !selectedFieldIds.has(option.value))
132
+ .filter((option) => {
133
+ if (seen.has(option.value)) {
134
+ return false;
135
+ }
136
+ seen.add(option.value);
137
+ return true;
138
+ });
139
+ }
140
+ class AirProcess {
141
+ constructor() {
142
+ this.methods = {
143
+ loadOptions: {
144
+ async getModels() {
145
+ const records = await fetchModels(this);
146
+ return records
147
+ .map(toModelOption)
148
+ .filter((option) => option !== null);
149
+ },
150
+ async getModelFields() {
151
+ return await getModelFieldOptions(this, 'modelIdCreate', 'createFields.field');
152
+ },
153
+ async getModelFieldsForFind() {
154
+ return await getModelFieldOptions(this, 'modelIdFind', 'findFields.field');
155
+ },
156
+ },
157
+ };
158
+ this.description = {
159
+ displayName: 'AirProcess',
160
+ name: 'airProcess',
161
+ icon: { light: 'file:../../icons/airprocess.svg', dark: 'file:../../icons/airprocess.dark.svg' },
162
+ group: ['input'],
163
+ version: 1,
164
+ subtitle: '={{$parameter["routeType"] + ": " + ($parameter["modelIdGet"] || $parameter["modelIdCreate"] || $parameter["modelIdFind"] || $parameter["modelIdPatch"] || $parameter["modelIdDelete"] || "")}}',
165
+ description: 'Interact with the AirProcess API grouped by HTTP method',
166
+ defaults: {
167
+ name: 'AirProcess',
168
+ },
169
+ usableAsTool: true,
170
+ inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
171
+ outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
172
+ credentials: [
173
+ {
174
+ name: 'airProcessApi',
175
+ required: true,
176
+ },
177
+ ],
178
+ requestDefaults: {
179
+ baseURL: AIRPROCESS_BASE_URL,
180
+ headers: {
181
+ Accept: 'application/json',
182
+ },
183
+ },
184
+ properties: [
185
+ {
186
+ displayName: 'Route',
187
+ name: 'routeType',
188
+ type: 'options',
189
+ noDataExpression: true,
190
+ options: [
191
+ {
192
+ name: 'Custom',
193
+ value: 'custom',
194
+ },
195
+ {
196
+ name: 'DELETE',
197
+ value: 'delete',
198
+ },
199
+ {
200
+ name: 'GET',
201
+ value: 'get',
202
+ },
203
+ {
204
+ name: 'PATCH',
205
+ value: 'patch',
206
+ },
207
+ {
208
+ name: 'POST',
209
+ value: 'post',
210
+ },
211
+ ],
212
+ default: 'get',
213
+ },
214
+ {
215
+ displayName: 'Operation',
216
+ name: 'getOperation',
217
+ type: 'options',
218
+ noDataExpression: true,
219
+ displayOptions: {
220
+ show: {
221
+ routeType: ['get'],
222
+ },
223
+ },
224
+ options: [
225
+ {
226
+ name: 'Get a Record',
227
+ value: 'getRecord',
228
+ action: 'Get a record',
229
+ routing: {
230
+ request: {
231
+ method: 'GET',
232
+ url: '=/{{$parameter.modelIdGet}}/{{$parameter.recordIdGet}}',
233
+ },
234
+ },
235
+ },
236
+ {
237
+ name: 'Get Applications',
238
+ value: 'getApplications',
239
+ action: 'Get applications',
240
+ routing: {
241
+ request: {
242
+ method: 'GET',
243
+ url: '/application',
244
+ },
245
+ },
246
+ },
247
+ {
248
+ name: 'Get Groups',
249
+ value: 'getGroups',
250
+ action: 'Get groups',
251
+ routing: {
252
+ request: {
253
+ method: 'GET',
254
+ url: '/group',
255
+ },
256
+ },
257
+ },
258
+ {
259
+ name: 'Get Models',
260
+ value: 'getModelsRoute',
261
+ action: 'Get models',
262
+ routing: {
263
+ request: {
264
+ method: 'GET',
265
+ url: '/model',
266
+ },
267
+ },
268
+ },
269
+ {
270
+ name: 'Get Records',
271
+ value: 'getRecords',
272
+ action: 'Get all records',
273
+ routing: {
274
+ request: {
275
+ method: 'GET',
276
+ url: '=/{{$parameter.modelIdGet}}',
277
+ },
278
+ },
279
+ },
280
+ {
281
+ name: 'Get Users',
282
+ value: 'getUsers',
283
+ action: 'Get users',
284
+ routing: {
285
+ request: {
286
+ method: 'GET',
287
+ url: '/account',
288
+ },
289
+ },
290
+ },
291
+ {
292
+ name: 'Get Workspaces',
293
+ value: 'getWorkspaces',
294
+ action: 'Get workspaces',
295
+ routing: {
296
+ request: {
297
+ method: 'GET',
298
+ url: '/workspace',
299
+ },
300
+ },
301
+ },
302
+ ],
303
+ default: 'getRecords',
304
+ },
305
+ {
306
+ displayName: 'Operation',
307
+ name: 'postOperation',
308
+ type: 'options',
309
+ noDataExpression: true,
310
+ displayOptions: {
311
+ show: {
312
+ routeType: ['post'],
313
+ },
314
+ },
315
+ options: [
316
+ {
317
+ name: 'Create a Record',
318
+ value: 'createRecord',
319
+ action: 'Create a record',
320
+ routing: {
321
+ request: {
322
+ method: 'POST',
323
+ url: '=/{{$parameter.modelIdCreate}}',
324
+ body: CREATE_RECORD_BODY_EXPRESSION,
325
+ headers: {
326
+ 'Content-Type': 'application/json',
327
+ },
328
+ },
329
+ },
330
+ },
331
+ {
332
+ name: 'Find Records (Mongo)',
333
+ value: 'findRecordsMongo',
334
+ action: 'Find records with mongo syntax',
335
+ routing: {
336
+ request: {
337
+ method: 'POST',
338
+ url: '=/{{$parameter.modelIdFind}}',
339
+ body: FIND_RECORDS_MONGO_BODY_EXPRESSION,
340
+ headers: {
341
+ 'Content-Type': 'application/json',
342
+ },
343
+ },
344
+ },
345
+ },
346
+ {
347
+ name: 'Login',
348
+ value: 'login',
349
+ action: 'Login',
350
+ routing: {
351
+ request: {
352
+ method: 'POST',
353
+ url: '/login',
354
+ body: '={{ { username: $parameter.username, password: $parameter.password } }}',
355
+ headers: {
356
+ 'Content-Type': 'application/json',
357
+ },
358
+ },
359
+ },
360
+ },
361
+ ],
362
+ default: 'createRecord',
363
+ },
364
+ {
365
+ displayName: 'Operation',
366
+ name: 'patchOperation',
367
+ type: 'options',
368
+ noDataExpression: true,
369
+ displayOptions: {
370
+ show: {
371
+ routeType: ['patch'],
372
+ },
373
+ },
374
+ options: [
375
+ {
376
+ name: 'Update a Record',
377
+ value: 'updateRecord',
378
+ action: 'Update a record',
379
+ routing: {
380
+ request: {
381
+ method: 'PATCH',
382
+ url: '=/{{$parameter.modelIdPatch}}/{{$parameter.recordIdPatch}}',
383
+ body: '={{ typeof $parameter.bodyUpdate === "string" ? JSON.parse($parameter.bodyUpdate) : $parameter.bodyUpdate }}',
384
+ headers: {
385
+ 'Content-Type': 'application/json',
386
+ },
387
+ },
388
+ },
389
+ },
390
+ ],
391
+ default: 'updateRecord',
392
+ },
393
+ {
394
+ displayName: 'Operation',
395
+ name: 'deleteOperation',
396
+ type: 'options',
397
+ noDataExpression: true,
398
+ displayOptions: {
399
+ show: {
400
+ routeType: ['delete'],
401
+ },
402
+ },
403
+ options: [
404
+ {
405
+ name: 'Delete a Record',
406
+ value: 'deleteRecord',
407
+ action: 'Delete a record',
408
+ routing: {
409
+ request: {
410
+ method: 'DELETE',
411
+ url: '=/{{$parameter.modelIdDelete}}/{{$parameter.recordIdDelete}}',
412
+ },
413
+ },
414
+ },
415
+ {
416
+ name: 'Send to Trash',
417
+ value: 'sendToTrash',
418
+ action: 'Send a record to trash',
419
+ routing: {
420
+ request: {
421
+ method: 'DELETE',
422
+ url: '=/{{$parameter.modelIdDelete}}/{{$parameter.recordIdDelete}}',
423
+ body: '={{ { sendToTrash: true } }}',
424
+ headers: {
425
+ 'Content-Type': 'application/json',
426
+ },
427
+ },
428
+ },
429
+ },
430
+ ],
431
+ default: 'deleteRecord',
432
+ },
433
+ {
434
+ displayName: 'Method',
435
+ name: 'customOperation',
436
+ type: 'options',
437
+ noDataExpression: true,
438
+ displayOptions: {
439
+ show: {
440
+ routeType: ['custom'],
441
+ },
442
+ },
443
+ options: [
444
+ {
445
+ name: 'GET',
446
+ value: 'customGet',
447
+ action: 'Call a custom GET route',
448
+ routing: {
449
+ request: {
450
+ method: 'GET',
451
+ url: '={{ $parameter.customUrl.startsWith("http") ? $parameter.customUrl : ($parameter.customUrl.startsWith("/") ? $parameter.customUrl : "/" + $parameter.customUrl) }}',
452
+ body: '={{ $parameter.customSendBody ? (typeof $parameter.customBody === "string" ? JSON.parse($parameter.customBody) : $parameter.customBody) : undefined }}',
453
+ headers: {
454
+ 'Content-Type': 'application/json',
455
+ },
456
+ },
457
+ },
458
+ },
459
+ {
460
+ name: 'POST',
461
+ value: 'customPost',
462
+ action: 'Call a custom POST route',
463
+ routing: {
464
+ request: {
465
+ method: 'POST',
466
+ url: '={{ $parameter.customUrl.startsWith("http") ? $parameter.customUrl : ($parameter.customUrl.startsWith("/") ? $parameter.customUrl : "/" + $parameter.customUrl) }}',
467
+ body: '={{ $parameter.customSendBody ? (typeof $parameter.customBody === "string" ? JSON.parse($parameter.customBody) : $parameter.customBody) : undefined }}',
468
+ headers: {
469
+ 'Content-Type': 'application/json',
470
+ },
471
+ },
472
+ },
473
+ },
474
+ {
475
+ name: 'PATCH',
476
+ value: 'customPatch',
477
+ action: 'Call a custom PATCH route',
478
+ routing: {
479
+ request: {
480
+ method: 'PATCH',
481
+ url: '={{ $parameter.customUrl.startsWith("http") ? $parameter.customUrl : ($parameter.customUrl.startsWith("/") ? $parameter.customUrl : "/" + $parameter.customUrl) }}',
482
+ body: '={{ $parameter.customSendBody ? (typeof $parameter.customBody === "string" ? JSON.parse($parameter.customBody) : $parameter.customBody) : undefined }}',
483
+ headers: {
484
+ 'Content-Type': 'application/json',
485
+ },
486
+ },
487
+ },
488
+ },
489
+ {
490
+ name: 'DELETE',
491
+ value: 'customDelete',
492
+ action: 'Call a custom DELETE route',
493
+ routing: {
494
+ request: {
495
+ method: 'DELETE',
496
+ url: '={{ $parameter.customUrl.startsWith("http") ? $parameter.customUrl : ($parameter.customUrl.startsWith("/") ? $parameter.customUrl : "/" + $parameter.customUrl) }}',
497
+ body: '={{ $parameter.customSendBody ? (typeof $parameter.customBody === "string" ? JSON.parse($parameter.customBody) : $parameter.customBody) : undefined }}',
498
+ headers: {
499
+ 'Content-Type': 'application/json',
500
+ },
501
+ },
502
+ },
503
+ },
504
+ ],
505
+ default: 'customGet',
506
+ },
507
+ {
508
+ displayName: 'URL',
509
+ name: 'customUrl',
510
+ type: 'string',
511
+ required: true,
512
+ default: '',
513
+ placeholder: '/your/custom/path',
514
+ displayOptions: {
515
+ show: {
516
+ routeType: ['custom'],
517
+ customOperation: ['customGet', 'customPost', 'customPatch', 'customDelete'],
518
+ },
519
+ },
520
+ description: 'Custom route path or full URL',
521
+ },
522
+ {
523
+ displayName: 'Send Body',
524
+ name: 'customSendBody',
525
+ type: 'boolean',
526
+ default: false,
527
+ displayOptions: {
528
+ show: {
529
+ routeType: ['custom'],
530
+ customOperation: ['customGet', 'customPost', 'customPatch', 'customDelete'],
531
+ },
532
+ },
533
+ description: 'Whether to include a request body',
534
+ },
535
+ {
536
+ displayName: 'Body',
537
+ name: 'customBody',
538
+ type: 'json',
539
+ default: '{}',
540
+ displayOptions: {
541
+ show: {
542
+ routeType: ['custom'],
543
+ customOperation: ['customGet', 'customPost', 'customPatch', 'customDelete'],
544
+ customSendBody: [true],
545
+ },
546
+ },
547
+ description: 'JSON body sent to AirProcess',
548
+ },
549
+ {
550
+ displayName: 'Model Name or ID',
551
+ name: 'modelIdGet',
552
+ type: 'options',
553
+ required: true,
554
+ typeOptions: {
555
+ loadOptionsMethod: 'getModels',
556
+ },
557
+ default: '',
558
+ displayOptions: {
559
+ show: {
560
+ routeType: ['get'],
561
+ getOperation: ['getRecord', 'getRecords'],
562
+ },
563
+ },
564
+ description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
565
+ },
566
+ {
567
+ displayName: 'Model Name or ID',
568
+ name: 'modelIdCreate',
569
+ type: 'options',
570
+ required: true,
571
+ typeOptions: {
572
+ loadOptionsMethod: 'getModels',
573
+ },
574
+ default: '',
575
+ displayOptions: {
576
+ show: {
577
+ routeType: ['post'],
578
+ postOperation: ['createRecord'],
579
+ },
580
+ },
581
+ description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
582
+ },
583
+ {
584
+ displayName: 'Model Name or ID',
585
+ name: 'modelIdFind',
586
+ type: 'options',
587
+ required: true,
588
+ typeOptions: {
589
+ loadOptionsMethod: 'getModels',
590
+ },
591
+ default: '',
592
+ displayOptions: {
593
+ show: {
594
+ routeType: ['post'],
595
+ postOperation: ['findRecordsMongo'],
596
+ },
597
+ },
598
+ description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
599
+ },
600
+ {
601
+ displayName: 'Model Name or ID',
602
+ name: 'modelIdPatch',
603
+ type: 'options',
604
+ required: true,
605
+ typeOptions: {
606
+ loadOptionsMethod: 'getModels',
607
+ },
608
+ default: '',
609
+ displayOptions: {
610
+ show: {
611
+ routeType: ['patch'],
612
+ patchOperation: ['updateRecord'],
613
+ },
614
+ },
615
+ description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
616
+ },
617
+ {
618
+ displayName: 'Model Name or ID',
619
+ name: 'modelIdDelete',
620
+ type: 'options',
621
+ required: true,
622
+ typeOptions: {
623
+ loadOptionsMethod: 'getModels',
624
+ },
625
+ default: '',
626
+ displayOptions: {
627
+ show: {
628
+ routeType: ['delete'],
629
+ deleteOperation: ['deleteRecord', 'sendToTrash'],
630
+ },
631
+ },
632
+ description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
633
+ },
634
+ {
635
+ displayName: 'Record ID',
636
+ name: 'recordIdGet',
637
+ type: 'string',
638
+ required: true,
639
+ default: '',
640
+ displayOptions: {
641
+ show: {
642
+ routeType: ['get'],
643
+ getOperation: ['getRecord'],
644
+ },
645
+ },
646
+ description: 'Record identifier used in the path',
647
+ },
648
+ {
649
+ displayName: 'Record ID',
650
+ name: 'recordIdPatch',
651
+ type: 'string',
652
+ required: true,
653
+ default: '',
654
+ displayOptions: {
655
+ show: {
656
+ routeType: ['patch'],
657
+ patchOperation: ['updateRecord'],
658
+ },
659
+ },
660
+ description: 'Record identifier used in the path',
661
+ },
662
+ {
663
+ displayName: 'Record ID',
664
+ name: 'recordIdDelete',
665
+ type: 'string',
666
+ required: true,
667
+ default: '',
668
+ displayOptions: {
669
+ show: {
670
+ routeType: ['delete'],
671
+ deleteOperation: ['deleteRecord', 'sendToTrash'],
672
+ },
673
+ },
674
+ description: 'Record identifier used in the path',
675
+ },
676
+ {
677
+ displayName: 'Specify Body',
678
+ name: 'createBodyMode',
679
+ type: 'options',
680
+ options: [
681
+ {
682
+ name: 'JSON',
683
+ value: 'json',
684
+ },
685
+ {
686
+ name: 'Using Fields Below',
687
+ value: 'fields',
688
+ },
689
+ ],
690
+ default: 'json',
691
+ displayOptions: {
692
+ show: {
693
+ routeType: ['post'],
694
+ postOperation: ['createRecord'],
695
+ },
696
+ },
697
+ description: 'Choose whether to send raw JSON or build the body from fields',
698
+ },
699
+ {
700
+ displayName: 'Body',
701
+ name: 'bodyCreate',
702
+ type: 'json',
703
+ required: true,
704
+ default: '{\n "kdx42bqx": "Bob wilson",\n "id": "34be8047-4652-4685-808d-85df6a80ddb7"\n}',
705
+ displayOptions: {
706
+ show: {
707
+ routeType: ['post'],
708
+ postOperation: ['createRecord'],
709
+ createBodyMode: ['json'],
710
+ },
711
+ },
712
+ description: 'JSON body sent to AirProcess',
713
+ },
714
+ {
715
+ displayName: 'Fields',
716
+ name: 'createFields',
717
+ type: 'fixedCollection',
718
+ typeOptions: {
719
+ multipleValues: true,
720
+ },
721
+ placeholder: 'Add Field',
722
+ default: {
723
+ field: [],
724
+ },
725
+ displayOptions: {
726
+ show: {
727
+ routeType: ['post'],
728
+ postOperation: ['createRecord'],
729
+ createBodyMode: ['fields'],
730
+ },
731
+ },
732
+ options: [
733
+ {
734
+ name: 'field',
735
+ displayName: 'Field',
736
+ values: [
737
+ {
738
+ displayName: 'Field Name or ID',
739
+ name: 'fieldId',
740
+ type: 'options',
741
+ typeOptions: {
742
+ loadOptionsMethod: 'getModelFields',
743
+ loadOptionsDependsOn: ['modelIdCreate', 'createFields.field'],
744
+ },
745
+ default: '',
746
+ description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
747
+ },
748
+ {
749
+ displayName: 'Value',
750
+ name: 'value',
751
+ type: 'string',
752
+ default: '',
753
+ },
754
+ ],
755
+ },
756
+ ],
757
+ description: 'Build the body by selecting model fields and values',
758
+ },
759
+ {
760
+ displayName: 'Body',
761
+ name: 'bodyUpdate',
762
+ type: 'json',
763
+ required: true,
764
+ default: '{\n "kdx42bqx": "Bob wilson"\n}',
765
+ displayOptions: {
766
+ show: {
767
+ routeType: ['patch'],
768
+ patchOperation: ['updateRecord'],
769
+ },
770
+ },
771
+ description: 'JSON body sent to AirProcess',
772
+ },
773
+ {
774
+ displayName: 'Skip',
775
+ name: 'findSkip',
776
+ type: 'number',
777
+ required: true,
778
+ default: 0,
779
+ displayOptions: {
780
+ show: {
781
+ routeType: ['post'],
782
+ postOperation: ['findRecordsMongo'],
783
+ },
784
+ },
785
+ description: 'Number of records to skip',
786
+ },
787
+ {
788
+ displayName: 'Limit',
789
+ name: 'findLimit',
790
+ type: 'number',
791
+ required: true,
792
+ default: 10,
793
+ displayOptions: {
794
+ show: {
795
+ routeType: ['post'],
796
+ postOperation: ['findRecordsMongo'],
797
+ },
798
+ },
799
+ description: 'Maximum number of records to return',
800
+ },
801
+ {
802
+ displayName: 'Filters',
803
+ name: 'findFields',
804
+ type: 'fixedCollection',
805
+ typeOptions: {
806
+ multipleValues: true,
807
+ },
808
+ placeholder: 'Add Filter',
809
+ default: {
810
+ field: [],
811
+ },
812
+ displayOptions: {
813
+ show: {
814
+ routeType: ['post'],
815
+ postOperation: ['findRecordsMongo'],
816
+ },
817
+ },
818
+ options: [
819
+ {
820
+ name: 'field',
821
+ displayName: 'Field',
822
+ values: [
823
+ {
824
+ displayName: 'Field Name or ID',
825
+ name: 'fieldId',
826
+ type: 'options',
827
+ typeOptions: {
828
+ loadOptionsMethod: 'getModelFieldsForFind',
829
+ loadOptionsDependsOn: ['modelIdFind', 'findFields.field'],
830
+ },
831
+ default: '',
832
+ description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
833
+ },
834
+ {
835
+ displayName: 'Value',
836
+ name: 'value',
837
+ type: 'string',
838
+ default: '',
839
+ },
840
+ ],
841
+ },
842
+ ],
843
+ description: 'Build the mongo filter by selecting model fields and values',
844
+ },
845
+ {
846
+ displayName: 'Username',
847
+ name: 'username',
848
+ type: 'string',
849
+ required: true,
850
+ default: '',
851
+ displayOptions: {
852
+ show: {
853
+ routeType: ['post'],
854
+ postOperation: ['login'],
855
+ },
856
+ },
857
+ description: 'Username used to authenticate',
858
+ },
859
+ {
860
+ displayName: 'Password',
861
+ name: 'password',
862
+ type: 'string',
863
+ typeOptions: {
864
+ password: true,
865
+ },
866
+ required: true,
867
+ default: '',
868
+ displayOptions: {
869
+ show: {
870
+ routeType: ['post'],
871
+ postOperation: ['login'],
872
+ },
873
+ },
874
+ description: 'Password used to authenticate',
875
+ },
876
+ ],
877
+ };
878
+ }
879
+ }
880
+ exports.AirProcess = AirProcess;
881
+ //# sourceMappingURL=AirProcess.node.js.map