@fsai-flow/workflow 0.0.3 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/dist/src/index.d.ts +21 -20
  2. package/dist/src/index.d.ts.map +1 -0
  3. package/dist/src/index.js +58 -23
  4. package/dist/src/index.js.map +1 -1
  5. package/dist/src/lib/Constants.d.ts +2 -1
  6. package/dist/src/lib/Constants.d.ts.map +1 -0
  7. package/dist/src/lib/Constants.js +60 -60
  8. package/dist/src/lib/Constants.js.map +1 -1
  9. package/dist/src/lib/DeferredPromise.d.ts +1 -0
  10. package/dist/src/lib/DeferredPromise.d.ts.map +1 -0
  11. package/dist/src/lib/Expression.d.ts +2 -1
  12. package/dist/src/lib/Expression.d.ts.map +1 -0
  13. package/dist/src/lib/Expression.js +47 -15
  14. package/dist/src/lib/Expression.js.map +1 -1
  15. package/dist/src/lib/Interfaces.d.ts +193 -149
  16. package/dist/src/lib/Interfaces.d.ts.map +1 -0
  17. package/dist/src/lib/Interfaces.js +12 -12
  18. package/dist/src/lib/Interfaces.js.map +1 -1
  19. package/dist/src/lib/LoggerProxy.d.ts +2 -1
  20. package/dist/src/lib/LoggerProxy.d.ts.map +1 -0
  21. package/dist/src/lib/LoggerProxy.js +6 -6
  22. package/dist/src/lib/MetadataUtils.d.ts +3 -2
  23. package/dist/src/lib/MetadataUtils.d.ts.map +1 -0
  24. package/dist/src/lib/MetadataUtils.js +2 -2
  25. package/dist/src/lib/MetadataUtils.js.map +1 -1
  26. package/dist/src/lib/NodeErrors.d.ts +3 -2
  27. package/dist/src/lib/NodeErrors.d.ts.map +1 -0
  28. package/dist/src/lib/NodeErrors.js +61 -66
  29. package/dist/src/lib/NodeErrors.js.map +1 -1
  30. package/dist/src/lib/NodeHelpers.d.ts +4 -3
  31. package/dist/src/lib/NodeHelpers.d.ts.map +1 -0
  32. package/dist/src/lib/NodeHelpers.js +226 -239
  33. package/dist/src/lib/NodeHelpers.js.map +1 -1
  34. package/dist/src/lib/ObservableObject.d.ts +2 -1
  35. package/dist/src/lib/ObservableObject.d.ts.map +1 -0
  36. package/dist/src/lib/ObservableObject.js +3 -3
  37. package/dist/src/lib/RoutingNode.d.ts +8 -2
  38. package/dist/src/lib/RoutingNode.d.ts.map +1 -0
  39. package/dist/src/lib/RoutingNode.js +87 -67
  40. package/dist/src/lib/RoutingNode.js.map +1 -1
  41. package/dist/src/lib/TelemetryHelpers.d.ts +2 -1
  42. package/dist/src/lib/TelemetryHelpers.d.ts.map +1 -0
  43. package/dist/src/lib/TelemetryHelpers.js +9 -11
  44. package/dist/src/lib/TelemetryHelpers.js.map +1 -1
  45. package/dist/src/lib/TypeValidation.d.ts +3 -2
  46. package/dist/src/lib/TypeValidation.d.ts.map +1 -0
  47. package/dist/src/lib/TypeValidation.js +85 -94
  48. package/dist/src/lib/TypeValidation.js.map +1 -1
  49. package/dist/src/lib/VersionedNodeType.d.ts +4 -3
  50. package/dist/src/lib/VersionedNodeType.d.ts.map +1 -0
  51. package/dist/src/lib/VersionedNodeType.js +1 -3
  52. package/dist/src/lib/VersionedNodeType.js.map +1 -1
  53. package/dist/src/lib/Workflow.d.ts +3 -2
  54. package/dist/src/lib/Workflow.d.ts.map +1 -0
  55. package/dist/src/lib/Workflow.js +54 -59
  56. package/dist/src/lib/Workflow.js.map +1 -1
  57. package/dist/src/lib/WorkflowDataProxy.d.ts +2 -1
  58. package/dist/src/lib/WorkflowDataProxy.d.ts.map +1 -0
  59. package/dist/src/lib/WorkflowDataProxy.js +96 -69
  60. package/dist/src/lib/WorkflowDataProxy.js.map +1 -1
  61. package/dist/src/lib/WorkflowErrors.d.ts +2 -1
  62. package/dist/src/lib/WorkflowErrors.d.ts.map +1 -0
  63. package/dist/src/lib/WorkflowHooks.d.ts +3 -2
  64. package/dist/src/lib/WorkflowHooks.d.ts.map +1 -0
  65. package/dist/src/lib/WorkflowHooks.js +0 -2
  66. package/dist/src/lib/WorkflowHooks.js.map +1 -1
  67. package/dist/src/lib/errors/base/base.error.d.ts +3 -3
  68. package/dist/src/lib/errors/base/base.error.d.ts.map +1 -0
  69. package/dist/src/lib/errors/base/base.error.js +9 -7
  70. package/dist/src/lib/errors/base/base.error.js.map +1 -1
  71. package/dist/src/lib/errors/base/operational.error.d.ts +5 -4
  72. package/dist/src/lib/errors/base/operational.error.d.ts.map +1 -0
  73. package/dist/src/lib/errors/base/operational.error.js +1 -1
  74. package/dist/src/lib/errors/error.types.d.ts +7 -4
  75. package/dist/src/lib/errors/error.types.d.ts.map +1 -0
  76. package/dist/src/lib/errors/index.d.ts +2 -1
  77. package/dist/src/lib/errors/index.d.ts.map +1 -0
  78. package/dist/src/lib/result.d.ts +1 -0
  79. package/dist/src/lib/result.d.ts.map +1 -0
  80. package/dist/src/lib/result.js +1 -1
  81. package/dist/src/lib/result.js.map +1 -1
  82. package/dist/src/lib/utils.d.ts +3 -2
  83. package/dist/src/lib/utils.d.ts.map +1 -0
  84. package/dist/src/lib/utils.js +6 -6
  85. package/dist/src/lib/utils.js.map +1 -1
  86. package/package.json +49 -39
  87. package/.eslintrc.json +0 -33
  88. package/eslint.config.js +0 -19
  89. package/jest.config.ts +0 -10
  90. package/project.json +0 -19
  91. package/src/index.ts +0 -33
  92. package/src/lib/Constants.ts +0 -124
  93. package/src/lib/DeferredPromise.ts +0 -14
  94. package/src/lib/Expression.ts +0 -375
  95. package/src/lib/Interfaces.ts +0 -2257
  96. package/src/lib/LoggerProxy.ts +0 -43
  97. package/src/lib/MetadataUtils.ts +0 -34
  98. package/src/lib/NodeErrors.ts +0 -332
  99. package/src/lib/NodeHelpers.ts +0 -1666
  100. package/src/lib/ObservableObject.ts +0 -77
  101. package/src/lib/RoutingNode.ts +0 -862
  102. package/src/lib/TelemetryHelpers.ts +0 -86
  103. package/src/lib/TypeValidation.ts +0 -431
  104. package/src/lib/VersionedNodeType.ts +0 -30
  105. package/src/lib/Workflow.ts +0 -1270
  106. package/src/lib/WorkflowDataProxy.ts +0 -708
  107. package/src/lib/WorkflowErrors.ts +0 -18
  108. package/src/lib/WorkflowHooks.ts +0 -51
  109. package/src/lib/errors/base/base.error.ts +0 -68
  110. package/src/lib/errors/base/operational.error.ts +0 -21
  111. package/src/lib/errors/error.types.ts +0 -14
  112. package/src/lib/errors/index.ts +0 -1
  113. package/src/lib/result.ts +0 -34
  114. package/src/lib/utils.ts +0 -145
  115. package/tests/Helpers.ts +0 -667
  116. package/tests/NodeHelpers.test.ts +0 -3053
  117. package/tests/ObservableObject.test.ts +0 -171
  118. package/tests/RoutingNode.test.ts +0 -1680
  119. package/tests/Workflow.test.ts +0 -1284
  120. package/tests/WorkflowDataProxy.test.ts +0 -199
  121. package/tsconfig.json +0 -27
  122. package/tsconfig.lib.json +0 -11
  123. package/tsconfig.spec.json +0 -14
@@ -1,2257 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- /* eslint-disable import/no-extraneous-dependencies */
3
- /* eslint-disable import/no-cycle */
4
- // eslint-disable-next-line import/no-extraneous-dependencies
5
- // eslint-disable-next-line max-classes-per-file
6
- import * as express from 'express';
7
- import * as FormData from 'form-data';
8
- import { URLSearchParams } from 'url';
9
- import { IDeferredPromise } from './DeferredPromise';
10
- import { WorkflowHooks } from './WorkflowHooks';
11
- import { WorkflowOperationError } from './WorkflowErrors';
12
- import { NodeApiError, NodeOperationError } from './NodeErrors';
13
- import { Workflow } from './Workflow';
14
- import { CODE_EXECUTION_MODES, CODE_LANGUAGES, LOG_LEVELS } from './Constants';
15
-
16
- import { OptionsWithUri, OptionsWithUrl } from 'request';
17
- import * as requestPromise from 'request-promise-native';
18
- export interface IAdditionalCredentialOptions {
19
- oauth2?: IOAuth2Options;
20
- credentialsDecrypted?: ICredentialsDecrypted;
21
- }
22
-
23
- export type IAllExecuteFunctions =
24
- | IExecuteFunctions
25
- | IExecutePaginationFunctions
26
- | IExecuteSingleFunctions
27
- | IHookFunctions
28
- | ILoadOptionsFunctions
29
- | IPollFunctions
30
- | ITriggerFunctions
31
- | IWebhookFunctions
32
- | ISupplyDataFunctions;
33
-
34
- export interface IBinaryData {
35
- [key: string]: string | undefined;
36
- data: string;
37
- mimeType: string;
38
- fileName?: string;
39
- directory?: string;
40
- fileExtension?: string;
41
- id?: string;
42
- }
43
-
44
- export interface IOAuth2Options {
45
- includeCredentialsOnRefreshOnBody?: boolean;
46
- property?: string;
47
- tokenType?: string;
48
- keepBearer?: boolean;
49
- tokenExpiredStatusCode?: number;
50
- }
51
-
52
- export interface IConnection {
53
- // The node the connection is to
54
- node: string;
55
-
56
- // The type of the input on destination node (for example "main")
57
- type: string;
58
-
59
- // The output/input-index of destination node (if node has multiple inputs/outputs of the same type)
60
- index: number;
61
- }
62
-
63
- export type ExecutionError = WorkflowOperationError | NodeOperationError | NodeApiError;
64
-
65
- // Get used to gives nodes access to credentials
66
- export interface IGetCredentials {
67
- get(type: string, id: string | null): Promise<ICredentialsEncrypted>;
68
- }
69
-
70
- export abstract class ICredentials {
71
- id?: string;
72
-
73
- name: string;
74
-
75
- type: string;
76
-
77
- data: string | undefined;
78
-
79
- nodesAccess: ICredentialNodeAccess[];
80
-
81
- constructor(
82
- nodeCredentials: INodeCredentialsDetails,
83
- type: string,
84
- nodesAccess: ICredentialNodeAccess[],
85
- data?: string,
86
- ) {
87
- // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
88
- this.id = nodeCredentials.id || undefined;
89
- this.name = nodeCredentials.name;
90
- this.type = type;
91
- this.nodesAccess = nodesAccess;
92
- this.data = data;
93
- }
94
-
95
- abstract getData(encryptionKey: string, nodeType?: string): ICredentialDataDecryptedObject;
96
-
97
- abstract getDataKey(key: string, encryptionKey: string, nodeType?: string): CredentialInformation;
98
-
99
- abstract getDataToSave(): ICredentialsEncrypted;
100
-
101
- abstract hasNodeAccess(nodeType: string): boolean;
102
-
103
- abstract setData(data: ICredentialDataDecryptedObject, encryptionKey: string): void;
104
-
105
- abstract setDataKey(key: string, data: CredentialInformation, encryptionKey: string): void;
106
- }
107
-
108
- // Defines which nodes are allowed to access the credentials and
109
- // when that access got grented from which user
110
- export interface ICredentialNodeAccess {
111
- nodeType: string;
112
- user?: string;
113
- date?: Date;
114
- }
115
-
116
- export interface ICredentialsDecrypted {
117
- id: string | number;
118
- name: string;
119
- type: string;
120
- nodesAccess: ICredentialNodeAccess[];
121
- data?: ICredentialDataDecryptedObject;
122
- }
123
-
124
- export interface ICredentialsEncrypted {
125
- id?: string | number;
126
- name: string;
127
- type: string;
128
- nodesAccess: ICredentialNodeAccess[];
129
- data?: string;
130
- }
131
-
132
- export type NodeTypeAndVersion = {
133
- name: string;
134
- type: string;
135
- typeVersion: number;
136
- disabled: boolean;
137
- parameters?: INodeParameters;
138
- };
139
-
140
- export interface ICredentialsExpressionResolveValues {
141
- connectionInputData: INodeExecutionData[];
142
- itemIndex: number;
143
- node: INode;
144
- runExecutionData: IRunExecutionData | null;
145
- runIndex: number;
146
- workflow: Workflow;
147
- }
148
-
149
- // Simplified options of request library
150
- export interface IRequestOptionsSimplified {
151
- auth?: {
152
- username: string;
153
- password: string;
154
- };
155
- body: IDataObject;
156
- headers: IDataObject;
157
- qs: IDataObject;
158
- }
159
-
160
- export abstract class ICredentialsHelper {
161
- encryptionKey: string;
162
-
163
- constructor(encryptionKey: string) {
164
- this.encryptionKey = encryptionKey;
165
- }
166
-
167
- abstract getParentTypes(name: string): string[];
168
-
169
- abstract authenticate(
170
- credentials: ICredentialDataDecryptedObject,
171
- typeName: string,
172
- requestOptions: IHttpRequestOptions | IRequestOptionsSimplified,
173
- workflow: Workflow,
174
- node: INode,
175
- ): Promise<IHttpRequestOptions>;
176
-
177
- abstract getCredentials(
178
- nodeCredentials: INodeCredentialsDetails,
179
- type: string,
180
- ): Promise<ICredentials>;
181
-
182
- abstract getDecrypted(
183
- nodeCredentials: INodeCredentialsDetails,
184
- type: string,
185
- mode: WorkflowExecuteMode,
186
- raw?: boolean,
187
- expressionResolveValues?: ICredentialsExpressionResolveValues,
188
- ): Promise<ICredentialDataDecryptedObject>;
189
-
190
- abstract updateCredentials(
191
- nodeCredentials: INodeCredentialsDetails,
192
- type: string,
193
- data: ICredentialDataDecryptedObject,
194
- ): Promise<void>;
195
- }
196
-
197
- export interface IAuthenticateBase {
198
- type: string;
199
- properties: {
200
- [key: string]: string;
201
- };
202
- }
203
-
204
- export abstract class Node {
205
- abstract description: INodeTypeDescription;
206
- execute?(context: IExecuteFunctions): Promise<INodeExecutionData[][]>;
207
- webhook?(context: IWebhookFunctions): Promise<IWebhookResponseData>;
208
- poll?(context: IPollFunctions): Promise<INodeExecutionData[][] | null>;
209
- }
210
-
211
- export interface IAuthenticateBasicAuth extends IAuthenticateBase {
212
- type: 'basicAuth';
213
- properties: {
214
- userPropertyName?: string;
215
- passwordPropertyName?: string;
216
- };
217
- }
218
-
219
- export interface IAuthenticateBearer extends IAuthenticateBase {
220
- type: 'bearer';
221
- properties: {
222
- tokenPropertyName?: string;
223
- };
224
- }
225
-
226
- export interface IAuthenticateHeaderAuth extends IAuthenticateBase {
227
- type: 'headerAuth';
228
- properties: {
229
- name: string;
230
- value: string;
231
- };
232
- }
233
-
234
- export interface IAuthenticateQueryAuth extends IAuthenticateBase {
235
- type: 'queryAuth';
236
- properties: {
237
- key: string;
238
- value: string;
239
- };
240
- }
241
-
242
- export type IAuthenticate =
243
- | ((
244
- credentials: ICredentialDataDecryptedObject,
245
- requestOptions: IHttpRequestOptions,
246
- ) => Promise<IHttpRequestOptions>)
247
- | IAuthenticateBasicAuth
248
- | IAuthenticateBearer
249
- | IAuthenticateHeaderAuth
250
- | IAuthenticateQueryAuth;
251
-
252
- export interface IAuthenticateRuleBase {
253
- type: string;
254
- properties: {
255
- [key: string]: string | number;
256
- };
257
- errorMessage?: string;
258
- }
259
-
260
- export interface IAuthenticateRuleResponseCode extends IAuthenticateRuleBase {
261
- type: 'responseCode';
262
- properties: {
263
- value: number;
264
- message: string;
265
- };
266
- }
267
-
268
- export interface ICredentialTestRequest {
269
- request: IHttpRequestOptions;
270
- rules?: IAuthenticateRuleResponseCode[];
271
- }
272
-
273
- export interface ICredentialTestRequestData {
274
- nodeType?: INodeType;
275
- testRequest: ICredentialTestRequest;
276
- }
277
-
278
- export type IconRef = `fa:${string}` | `node:${string}.${string}`;
279
- export type IconFile = `file:${string}.png` | `file:${string}.svg`;
280
- export type Icon = IconRef | Themed<IconFile>;
281
-
282
- type ICredentialHttpRequestNode = {
283
- name: string;
284
- docsUrl: string;
285
- hidden?: boolean;
286
- } & ({ apiBaseUrl: string } | { apiBaseUrlPlaceholder: string });
287
-
288
- export interface ICredentialType {
289
- name: string;
290
- displayName: string;
291
- icon?: Icon | string;
292
- iconColor?: ThemeIconColor;
293
- iconUrl?: Themed<string>;
294
- extends?: string[];
295
- properties: INodeProperties[];
296
- documentationUrl?: string;
297
- __overwrittenProperties?: string[];
298
- authenticate?: IAuthenticate;
299
- test?: ICredentialTestRequest;
300
- httpRequestNode?: ICredentialHttpRequestNode;
301
- supportedNodes?: string[];
302
- }
303
-
304
- export interface ICredentialTypes {
305
- credentialTypes?: ICredentialTypeData;
306
- init(credentialTypes?: ICredentialTypeData): Promise<void>;
307
- getAll(): ICredentialType[];
308
- getByName(credentialType: string): ICredentialType;
309
- }
310
-
311
- // The way the credentials get saved in the database (data encrypted)
312
- export interface ICredentialData {
313
- id?: string;
314
- name: string;
315
- data: string; // Contains the access data as encrypted JSON string
316
- nodesAccess: ICredentialNodeAccess[];
317
- }
318
-
319
- // The encrypted credentials which the nodes can access
320
- export type CredentialInformation = string | number | boolean | IDataObject;
321
-
322
- // The encrypted credentials which the nodes can access
323
- export interface ICredentialDataDecryptedObject {
324
- [key: string]: CredentialInformation;
325
- }
326
-
327
- // First array index: The output/input-index (if node has multiple inputs/outputs of the same type)
328
- // Second array index: The different connections (if one node is connected to multiple nodes)
329
- export type NodeInputConnections = IConnection[][];
330
-
331
- export interface INodeConnections {
332
- // Input name
333
- [key: string]: NodeInputConnections;
334
- }
335
-
336
- export interface IConnections {
337
- // Node name
338
- [key: string]: INodeConnections;
339
- }
340
-
341
- export type GenericValue = string | object | number | boolean | undefined | null;
342
-
343
- // export type IExecuteResponsePromiseData = IDataObject;
344
- export type IExecuteResponsePromiseData = IDataObject | IN8nHttpFullResponse;
345
-
346
- export interface INodeTypeNameVersion {
347
- name: string;
348
- version: number;
349
- }
350
-
351
- export interface IGetExecutePollFunctions {
352
- (
353
- workflow: Workflow,
354
- node: INode,
355
- additionalData: IWorkflowExecuteAdditionalData,
356
- mode: WorkflowExecuteMode,
357
- activation: WorkflowActivateMode,
358
- ): IPollFunctions;
359
- }
360
-
361
- export interface IGetExecuteTriggerFunctions {
362
- (
363
- workflow: Workflow,
364
- node: INode,
365
- additionalData: IWorkflowExecuteAdditionalData,
366
- mode: WorkflowExecuteMode,
367
- activation: WorkflowActivateMode,
368
- ): ITriggerFunctions;
369
- }
370
-
371
- export interface IGetExecuteFunctions {
372
- (
373
- workflow: Workflow,
374
- runExecutionData: IRunExecutionData,
375
- runIndex: number,
376
- connectionInputData: INodeExecutionData[],
377
- inputData: ITaskDataConnections,
378
- node: INode,
379
- additionalData: IWorkflowExecuteAdditionalData,
380
- mode: WorkflowExecuteMode,
381
- nodeTypeData: INodeType,
382
- closeFunctions: CloseFunction[],
383
- ): IExecuteFunctions;
384
- }
385
-
386
- export interface IGetExecuteSingleFunctions {
387
- (
388
- workflow: Workflow,
389
- runExecutionData: IRunExecutionData,
390
- runIndex: number,
391
- connectionInputData: INodeExecutionData[],
392
- inputData: ITaskDataConnections,
393
- node: INode,
394
- itemIndex: number,
395
- additionalData: IWorkflowExecuteAdditionalData,
396
- mode: WorkflowExecuteMode,
397
- ): IExecuteSingleFunctions;
398
- }
399
-
400
- export interface IGetExecuteHookFunctions {
401
- (
402
- workflow: Workflow,
403
- node: INode,
404
- additionalData: IWorkflowExecuteAdditionalData,
405
- mode: WorkflowExecuteMode,
406
- activation: WorkflowActivateMode,
407
- isTest?: boolean,
408
- webhookData?: IWebhookData,
409
- ): IHookFunctions;
410
- }
411
-
412
- export interface IGetExecuteWebhookFunctions {
413
- (
414
- workflow: Workflow,
415
- node: INode,
416
- additionalData: IWorkflowExecuteAdditionalData,
417
- mode: WorkflowExecuteMode,
418
- webhookData: IWebhookData,
419
- runExecutionData: IRunExecutionData | undefined,
420
- ): IWebhookFunctions;
421
- }
422
-
423
- export interface IExecuteData {
424
- data: ITaskDataConnections;
425
- node: INode;
426
- }
427
-
428
- export type IContextObject = {
429
- [key: string]: any;
430
- };
431
-
432
- export interface IExecuteContextData {
433
- // Keys are: "flow" | "node:<NODE_NAME>"
434
- [key: string]: IContextObject;
435
- }
436
-
437
- export type IHttpRequestMethods = 'DELETE' | 'GET' | 'HEAD' | 'PATCH' | 'POST' | 'PUT';
438
-
439
- export interface IHttpRequestOptions {
440
- url: string;
441
- baseURL?: string;
442
- headers?: IDataObject;
443
- method?: IHttpRequestMethods;
444
- body?: FormData | GenericValue | GenericValue[] | Buffer | URLSearchParams;
445
- qs?: IDataObject;
446
- arrayFormat?: 'indices' | 'brackets' | 'repeat' | 'comma';
447
- auth?: {
448
- username: string;
449
- password: string;
450
- };
451
- disableFollowRedirect?: boolean;
452
- encoding?: 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream';
453
- skipSslCertificateValidation?: boolean;
454
- returnFullResponse?: boolean;
455
- ignoreHttpStatusErrors?: boolean;
456
- proxy?: {
457
- host: string;
458
- port: number;
459
- auth?: {
460
- username: string;
461
- password: string;
462
- };
463
- protocol?: string;
464
- };
465
- timeout?: number;
466
- json?: boolean;
467
- }
468
-
469
- export type IN8nHttpResponse = IDataObject | Buffer | GenericValue | GenericValue[] | null;
470
-
471
- export interface IN8nHttpFullResponse {
472
- body: IN8nHttpResponse;
473
- headers: IDataObject;
474
- statusCode: number;
475
- statusMessage?: string;
476
- }
477
-
478
- export interface IN8nRequestOperations {
479
- pagination?:
480
- | IN8nRequestOperationPaginationOffset
481
- | ((
482
- this: IExecutePaginationFunctions,
483
- requestOptions: IRequestOptionsFromParameters,
484
- ) => Promise<INodeExecutionData[]>);
485
- }
486
-
487
- export interface IN8nRequestOperationPaginationBase {
488
- type: string;
489
- properties: {
490
- [key: string]: string | number;
491
- };
492
- }
493
-
494
- export interface IN8nRequestOperationPaginationOffset extends IN8nRequestOperationPaginationBase {
495
- type: 'offset';
496
- properties: {
497
- limitParameter: string;
498
- offsetParameter: string;
499
- pageSize: number;
500
- rootProperty?: string; // Optional Path to option array
501
- type: 'body' | 'query';
502
- };
503
- }
504
-
505
- export interface ITaskSubRunMetadata {
506
- node: string;
507
- runIndex: number;
508
- }
509
-
510
- export interface RelatedExecution {
511
- executionId: string;
512
- workflowId: string;
513
- }
514
-
515
- export interface ITaskMetadata {
516
- subRun?: ITaskSubRunMetadata[];
517
- parentExecution?: RelatedExecution;
518
- subExecution?: RelatedExecution;
519
- subExecutionsCount?: number;
520
- }
521
-
522
- export type AINodeConnectionType = Exclude<NodeConnectionType, typeof NodeConnectionTypes.Main>;
523
-
524
- namespace RecordReturning {
525
- export type NodeParameter = 'additionalFields' | 'filters' | 'options' | 'updateFields';
526
- }
527
-
528
- export interface IExecuteFunctions {
529
- continueOnFail(): boolean;
530
- evaluateExpression(
531
- expression: string,
532
- itemIndex: number,
533
- ): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[];
534
- executeWorkflow(
535
- workflowInfo: IExecuteWorkflowInfo,
536
- inputData?: INodeExecutionData[],
537
- ): Promise<any>;
538
- getContext(type: string): IContextObject;
539
- getCredentials(
540
- type: string,
541
- itemIndex?: number,
542
- ): Promise<ICredentialDataDecryptedObject | undefined>;
543
- getCredentials<T extends object = ICredentialDataDecryptedObject>(
544
- type: string,
545
- itemIndex?: number,
546
- ): Promise<T>;
547
- getInputData(inputIndex?: number, inputName?: string): INodeExecutionData[];
548
- getInstanceId(): string;
549
- getMode(): WorkflowExecuteMode;
550
- getNode(): INode;
551
- getNodeParameter<T extends { resource: string }>(
552
- parameterName: 'resource',
553
- itemIndex?: number,
554
- ): T['resource'];
555
- // getNodeParameter(parameterName: 'operation', itemIndex?: number): string;
556
- getNodeParameter(
557
- parameterName: string,
558
- itemIndex: number,
559
- fallbackValue?: any,
560
- options?: IGetNodeParameterOptions,
561
- ): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | object;
562
- getNodeParameter(
563
- parameterName: RecordReturning.NodeParameter,
564
- itemIndex: number,
565
- fallbackValue?: IDataObject,
566
- options?: IGetNodeParameterOptions,
567
- ): IDataObject;
568
- getExecutionCancelSignal(): AbortSignal | undefined;
569
- getWorkflowDataProxy(itemIndex: number): IWorkflowDataProxyData;
570
- getWorkflowStaticData(type: string): IDataObject;
571
- getRestApiUrl(): string;
572
- getTimezone(): string;
573
- getWorkflow(): IWorkflowMetadata;
574
- prepareOutputData(
575
- outputData: INodeExecutionData[],
576
- outputIndex?: number,
577
- ): Promise<INodeExecutionData[][]>;
578
- putExecutionToWait(waitTill: Date): Promise<void>;
579
- sendMessageToUI(message: any): void; // tslint:disable-line:no-any
580
- sendResponse(response: IExecuteResponsePromiseData): void; // tslint:disable-line:no-any
581
- addInputData(
582
- data: INodeExecutionData[][] | ExecutionError,
583
- node: INode,
584
- ): { index: number, inputExecutionData: IRunExecutionData };
585
- addOutputData(
586
- data: INodeExecutionData[][] | ExecutionError,
587
- node: INode,
588
- ): { outputExecutionData: IRunExecutionData };
589
- getInputConnectionData(
590
- connectionType: AINodeConnectionType,
591
- itemIndex: number,
592
- inputIndex?: number,
593
- ): Promise<unknown>;
594
- getNodeOutputs?(): INodeOutputConfiguration[];
595
- helpers: {
596
- httpRequest(
597
- requestOptions: IHttpRequestOptions,
598
- ): Promise<IN8nHttpResponse | IN8nHttpFullResponse>;
599
- httpRequestWithAuthentication(
600
- this: IAllExecuteFunctions,
601
- credentialsType: string,
602
- requestOptions: IHttpRequestOptions,
603
- additionalCredentialOptions?: IAdditionalCredentialOptions,
604
- ): Promise<IN8nHttpResponse | IN8nHttpFullResponse>;
605
- assertBinaryData(itemIndex: number, propertyName: string, inputIndex?: number): IBinaryData;
606
- getBinaryDataBuffer(itemIndex: number, propertyName: string, inputIndex?: number): Promise<Buffer>;
607
- [key: string]: (...args: any[]) => any; // tslint:disable-line:no-any
608
- };
609
- }
610
-
611
- export interface INodeInputFilter {
612
- nodes: string[];
613
- }
614
-
615
- export interface INodeInputConfiguration {
616
- category?: string;
617
- displayName?: string;
618
- required?: boolean;
619
- type: NodeConnectionType;
620
- filter?: INodeInputFilter;
621
- maxConnections?: number;
622
- }
623
-
624
- export interface INodeOutputConfiguration {
625
- category?: 'error';
626
- displayName?: string;
627
- maxConnections?: number;
628
- required?: boolean;
629
- type: NodeConnectionType;
630
- }
631
-
632
- export type ISupplyDataFunctions = {
633
- logger: Logger;
634
- continueOnFail(): boolean;
635
- evaluateExpression(
636
- expression: string,
637
- itemIndex: number,
638
- ): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[];
639
- executeWorkflow(
640
- workflowInfo: IExecuteWorkflowInfo,
641
- inputData?: INodeExecutionData[],
642
- ): Promise<any>;
643
- getContext(type: string): IContextObject;
644
- getCredentials(
645
- type: string,
646
- itemIndex?: number,
647
- ): Promise<ICredentialDataDecryptedObject | undefined>;
648
- getInputData(inputIndex?: number, inputName?: string): INodeExecutionData[];
649
- getInstanceId(): string;
650
- getMode(): WorkflowExecuteMode;
651
- getNode(): INode;
652
- getNodeParameter<T extends { resource: string }>(
653
- parameterName: 'resource',
654
- itemIndex?: number,
655
- ): T['resource'];
656
- getNodeParameter(
657
- parameterName: string,
658
- itemIndex: number,
659
- fallbackValue?: any,
660
- ): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | object;
661
- getWorkflowDataProxy(itemIndex: number): IWorkflowDataProxyData;
662
- getWorkflowStaticData(type: string): IDataObject;
663
- getRestApiUrl(): string;
664
- getTimezone(): string;
665
- getWorkflow(): IWorkflowMetadata;
666
- prepareOutputData(
667
- outputData: INodeExecutionData[],
668
- outputIndex?: number,
669
- ): Promise<INodeExecutionData[][]>;
670
- putExecutionToWait(waitTill: Date): Promise<void>;
671
- sendMessageToUI(message: any): void; // tslint:disable-line:no-any
672
- sendResponse(response: IExecuteResponsePromiseData): void; // tslint:disable-line:no-any
673
-
674
- getInputConnectionData(
675
- connectionType: NodeConnectionType,
676
- itemIndex: number,
677
- inputIndex?: number,
678
- ): Promise<unknown>;
679
- addInputData(
680
- data: INodeExecutionData[][] | ExecutionError,
681
- node: INode,
682
- ): { index: number, inputExecutionData: IRunExecutionData };
683
- addOutputData(
684
- data: INodeExecutionData[][] | ExecutionError,
685
- node: INode,
686
- ): { outputExecutionData: IRunExecutionData };
687
- helpers: {
688
- httpRequest(
689
- requestOptions: IHttpRequestOptions,
690
- ): Promise<IN8nHttpResponse | IN8nHttpFullResponse>;
691
- httpRequestWithAuthentication(
692
- this: IAllExecuteFunctions,
693
- credentialsType: string,
694
- requestOptions: IHttpRequestOptions,
695
- additionalCredentialOptions?: IAdditionalCredentialOptions,
696
- ): Promise<IN8nHttpResponse | IN8nHttpFullResponse>;
697
- request: (uriOrObject: string | IDataObject | any, options?: IDataObject) => Promise<any>; // tslint:disable-line:no-any
698
- requestWithAuthentication(
699
- this: IAllExecuteFunctions,
700
- credentialsType: string,
701
- requestOptions: OptionsWithUri | requestPromise.RequestPromiseOptions,
702
- additionalCredentialOptions?: IAdditionalCredentialOptions,
703
- ): Promise<any>;
704
- requestOAuth2(
705
- this: IAllExecuteFunctions,
706
- credentialsType: string,
707
- requestOptions: OptionsWithUri | requestPromise.RequestPromiseOptions,
708
- oAuth2Options?: IOAuth2Options,
709
- ): Promise<any>;
710
- requestOAuth1(
711
- this: IAllExecuteFunctions,
712
- credentialsType: string,
713
- requestOptions: OptionsWithUrl | requestPromise.RequestPromiseOptions,
714
- ): Promise<any>;
715
- prepareBinaryData(
716
- binaryData: Buffer,
717
- filePath?: string,
718
- mimeType?: string,
719
- ): Promise<IBinaryData>;
720
- assertBinaryData(itemIndex: number, propertyName: string, inputIndex?: number): IBinaryData;
721
- getBinaryDataBuffer(itemIndex: number, propertyName: string, inputIndex?: number): Promise<Buffer>;
722
- returnJsonArray(jsonData: IDataObject | IDataObject[]): INodeExecutionData[];
723
- normalizeItems(items: INodeExecutionData | INodeExecutionData[]): INodeExecutionData[];
724
- [key: string]: (...args: any[]) => any; // tslint:disable-line:no-any
725
- };
726
- }
727
-
728
- export interface IExecuteSingleFunctions {
729
- continueOnFail(): boolean;
730
- evaluateExpression(
731
- expression: string,
732
- itemIndex: number | undefined,
733
- ): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[];
734
- getContext(type: string): IContextObject;
735
- getCredentials(type: string): Promise<ICredentialDataDecryptedObject | undefined>;
736
- getInputData(inputIndex?: number, inputName?: string): INodeExecutionData;
737
- getMode(): WorkflowExecuteMode;
738
- getNode(): INode;
739
- getNodeParameter(
740
- parameterName: string,
741
- fallbackValue?: any,
742
- ): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | object;
743
- getRestApiUrl(): string;
744
- getTimezone(): string;
745
- getWorkflow(): IWorkflowMetadata;
746
- getWorkflowDataProxy(): IWorkflowDataProxyData;
747
- getWorkflowStaticData(type: string): IDataObject;
748
- helpers: {
749
- httpRequest(
750
- requestOptions: IHttpRequestOptions,
751
- ): Promise<IN8nHttpResponse | IN8nHttpFullResponse>;
752
- httpRequestWithAuthentication(
753
- this: IAllExecuteFunctions,
754
- credentialsType: string,
755
- requestOptions: IHttpRequestOptions,
756
- additionalCredentialOptions?: IAdditionalCredentialOptions,
757
- ): Promise<IN8nHttpResponse | IN8nHttpFullResponse>;
758
- [key: string]: (...args: any[]) => any; // tslint:disable-line:no-any
759
- };
760
- }
761
-
762
- export interface IExecutePaginationFunctions extends IExecuteSingleFunctions {
763
- makeRoutingRequest(
764
- this: IAllExecuteFunctions,
765
- requestOptions: IRequestOptionsFromParameters,
766
- ): Promise<INodeExecutionData[]>;
767
- }
768
- export interface IExecuteWorkflowInfo {
769
- code?: IWorkflowBase;
770
- id?: string;
771
- }
772
-
773
- export type ICredentialTestFunction = (
774
- this: ICredentialTestFunctions,
775
- credential: ICredentialsDecrypted,
776
- ) => Promise<INodeCredentialTestResult>;
777
-
778
- export interface ICredentialTestFunctions {
779
- helpers: {
780
- [key: string]: (...args: any[]) => any;
781
- };
782
- }
783
-
784
- export interface ILoadOptionsFunctions {
785
- getCredentials(type: string): Promise<ICredentialDataDecryptedObject | undefined>;
786
- getNode(): INode;
787
- getNodeParameter(
788
- parameterName: string,
789
- fallbackValue?: any,
790
- ): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | object;
791
- getCurrentNodeParameter(
792
- parameterName: string,
793
- ):
794
- | NodeParameterValue
795
- | INodeParameters
796
- | NodeParameterValue[]
797
- | INodeParameters[]
798
- | object
799
- | undefined;
800
- getCurrentNodeParameters(): INodeParameters | undefined;
801
- getTimezone(): string;
802
- getRestApiUrl(): string;
803
- helpers: {
804
- httpRequest(
805
- requestOptions: IHttpRequestOptions,
806
- ): Promise<IN8nHttpResponse | IN8nHttpFullResponse>;
807
- // TODO: Remove from here. Add it only now to LoadOptions as many nodes do import
808
- // from @fsai-flow/workflow instead of n8n-core
809
- requestWithAuthentication(
810
- this: IAllExecuteFunctions,
811
- credentialsType: string,
812
- requestOptions: any, // tslint:disable-line:no-any
813
- additionalCredentialOptions?: IAdditionalCredentialOptions,
814
- ): Promise<any>;
815
- httpRequestWithAuthentication(
816
- this: IAllExecuteFunctions,
817
- credentialsType: string,
818
- requestOptions: IHttpRequestOptions,
819
- additionalCredentialOptions?: IAdditionalCredentialOptions,
820
- ): Promise<IN8nHttpResponse | IN8nHttpFullResponse>;
821
- [key: string]: ((...args: any[]) => any) | undefined; // tslint:disable-line:no-any
822
- };
823
- }
824
-
825
- export interface IHookFunctions {
826
- getCredentials(type: string): Promise<ICredentialDataDecryptedObject | undefined>;
827
- getMode(): WorkflowExecuteMode;
828
- getActivationMode(): WorkflowActivateMode;
829
- getNode(): INode;
830
- getNodeWebhookUrl: (name: string) => string | undefined;
831
- getNodeParameter(
832
- parameterName: string,
833
- fallbackValue?: any,
834
- ): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | object;
835
- getTimezone(): string;
836
- getWebhookDescription(name: string): IWebhookDescription | undefined;
837
- getWebhookName(): string;
838
- getWorkflow(): IWorkflowMetadata;
839
- getWorkflowStaticData(type: string): IDataObject;
840
- helpers: {
841
- httpRequest(
842
- requestOptions: IHttpRequestOptions,
843
- ): Promise<IN8nHttpResponse | IN8nHttpFullResponse>;
844
- httpRequestWithAuthentication(
845
- this: IAllExecuteFunctions,
846
- credentialsType: string,
847
- requestOptions: IHttpRequestOptions,
848
- additionalCredentialOptions?: IAdditionalCredentialOptions,
849
- ): Promise<IN8nHttpResponse | IN8nHttpFullResponse>;
850
- [key: string]: (...args: any[]) => any; // tslint:disable-line:no-any
851
- };
852
- }
853
-
854
- export interface IPollFunctions {
855
- __emit(data: INodeExecutionData[][]): void;
856
- getCredentials(type: string): Promise<ICredentialDataDecryptedObject | undefined>;
857
- getMode(): WorkflowExecuteMode;
858
- getActivationMode(): WorkflowActivateMode;
859
- getNode(): INode;
860
- getNodeParameter(
861
- parameterName: string,
862
- fallbackValue?: any,
863
- ): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | object;
864
- getRestApiUrl(): string;
865
- getTimezone(): string;
866
- getWorkflow(): IWorkflowMetadata;
867
- getWorkflowStaticData(type: string): IDataObject;
868
- helpers: {
869
- httpRequest(
870
- requestOptions: IHttpRequestOptions,
871
- ): Promise<IN8nHttpResponse | IN8nHttpFullResponse>;
872
- httpRequestWithAuthentication(
873
- this: IAllExecuteFunctions,
874
- credentialsType: string,
875
- requestOptions: IHttpRequestOptions,
876
- additionalCredentialOptions?: IAdditionalCredentialOptions,
877
- ): Promise<IN8nHttpResponse | IN8nHttpFullResponse>;
878
- [key: string]: (...args: any[]) => any; // tslint:disable-line:no-any
879
- };
880
- }
881
-
882
- export interface ITriggerFunctions {
883
- emit(
884
- data: INodeExecutionData[][],
885
- responsePromise?: IDeferredPromise<IExecuteResponsePromiseData>,
886
- ): void;
887
- getCredentials(type: string): Promise<ICredentialDataDecryptedObject | undefined>;
888
- getMode(): WorkflowExecuteMode;
889
- getActivationMode(): WorkflowActivateMode;
890
- getNode(): INode;
891
- getNodeParameter(
892
- parameterName: string,
893
- fallbackValue?: any,
894
- ): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | object;
895
- getRestApiUrl(): string;
896
- getTimezone(): string;
897
- getWorkflow(): IWorkflowMetadata;
898
- getWorkflowStaticData(type: string): IDataObject;
899
- helpers: {
900
- httpRequest(
901
- requestOptions: IHttpRequestOptions,
902
- ): Promise<IN8nHttpResponse | IN8nHttpFullResponse>;
903
- httpRequestWithAuthentication(
904
- this: IAllExecuteFunctions,
905
- credentialsType: string,
906
- requestOptions: IHttpRequestOptions,
907
- additionalCredentialOptions?: IAdditionalCredentialOptions,
908
- ): Promise<IN8nHttpResponse | IN8nHttpFullResponse>;
909
- [key: string]: (...args: any[]) => any; // tslint:disable-line:no-any
910
- };
911
- }
912
-
913
-
914
- export type ResourceLocatorModes = 'id' | 'url' | 'list' | string;
915
- export interface INodeParameterResourceLocator {
916
- __rl: true;
917
- mode: ResourceLocatorModes;
918
- value: NodeParameterValue;
919
- cachedResultName?: string;
920
- cachedResultUrl?: string;
921
- __regex?: string;
922
- }
923
-
924
- export interface ResourceMapperField {
925
- id: string;
926
- displayName: string;
927
- defaultMatch: boolean;
928
- canBeUsedToMatch?: boolean;
929
- required: boolean;
930
- display: boolean;
931
- type?: FieldType;
932
- removed?: boolean;
933
- options?: INodePropertyOptions[];
934
- readOnly?: boolean;
935
- }
936
-
937
- export interface IDataObject {
938
- [key: string]: GenericValue | IDataObject | GenericValue[] | IDataObject[];
939
- }
940
-
941
- export type ResourceMapperValue = {
942
- mappingMode: string;
943
- value: { [key: string]: string | number | boolean | null } | null;
944
- matchingColumns: string[];
945
- schema: ResourceMapperField[];
946
- attemptToConvertTypes: boolean;
947
- convertFieldsToString: boolean;
948
- };
949
-
950
- export type FilterOperatorType =
951
- | 'string'
952
- | 'number'
953
- | 'boolean'
954
- | 'array'
955
- | 'object'
956
- | 'dateTime'
957
- | 'any';
958
-
959
- export interface FilterOperatorValue {
960
- type: FilterOperatorType;
961
- operation: string;
962
- rightType?: FilterOperatorType;
963
- singleValue?: boolean; // default = false
964
- }
965
-
966
- export type FilterOptionsValue = {
967
- caseSensitive: boolean;
968
- leftValue: string;
969
- typeValidation: 'strict' | 'loose';
970
- version: 1 | 2;
971
- };
972
-
973
- export type FilterConditionValue = {
974
- id: string;
975
- leftValue: NodeParameterValue | NodeParameterValue[];
976
- operator: FilterOperatorValue;
977
- rightValue: NodeParameterValue | NodeParameterValue[];
978
- };
979
-
980
- export type FilterTypeCombinator = 'and' | 'or';
981
-
982
- export type FilterValue = {
983
- options: FilterOptionsValue;
984
- conditions: FilterConditionValue[];
985
- combinator: FilterTypeCombinator;
986
- };
987
-
988
- export type AssignmentValue = {
989
- id: string;
990
- name: string;
991
- value: NodeParameterValue;
992
- type?: string;
993
- };
994
-
995
-
996
- export type AssignmentCollectionValue = {
997
- assignments: AssignmentValue[];
998
- };
999
-
1000
- export type NodeParameterValueType =
1001
- // TODO: Later also has to be possible to add multiple ones with the name name. So array has to be possible
1002
- | NodeParameterValue
1003
- | INodeParameters
1004
- | INodeParameterResourceLocator
1005
- | ResourceMapperValue
1006
- | FilterValue
1007
- | AssignmentCollectionValue
1008
- | NodeParameterValue[]
1009
- | INodeParameters[]
1010
- | INodeParameterResourceLocator[]
1011
- | ResourceMapperValue[];
1012
-
1013
- interface NodeHelperFunctions {
1014
- copyBinaryFile(filePath: string, fileName: string, mimeType?: string): Promise<IBinaryData>;
1015
- }
1016
-
1017
- export interface IWebhookFunctions {
1018
- logger: Logger;
1019
- getBodyData(): IDataObject;
1020
- getCredentials(type: string): Promise<ICredentialDataDecryptedObject | undefined>;
1021
- getHeaderData(): object;
1022
- getMode(): WorkflowExecuteMode;
1023
- getNode(): INode;
1024
- getNodeParameter(
1025
- parameterName: string,
1026
- fallbackValue?: any,
1027
- options?: IGetNodeParameterOptions,
1028
- ): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | object;
1029
- evaluateExpression(expression: string, itemIndex?: number): NodeParameterValueType;
1030
- getNodeWebhookUrl: (name: string) => string | undefined;
1031
- getParamsData(): object;
1032
- getQueryData(): object;
1033
- getRequestObject(): express.Request;
1034
- getResponseObject(): express.Response;
1035
- getParentNodes(nodeName: string): NodeTypeAndVersion[];
1036
- getInstanceId(): string;
1037
- getTimezone(): string;
1038
- getWebhookName(): string;
1039
- getWorkflowStaticData(type: string): IDataObject;
1040
- getWorkflow(): IWorkflowMetadata;
1041
- getChildNodes(
1042
- nodeName: string,
1043
- options?: { includeNodeParameters?: boolean },
1044
- ): NodeTypeAndVersion[];
1045
- prepareOutputData(
1046
- outputData: INodeExecutionData[],
1047
- outputIndex?: number,
1048
- ): Promise<INodeExecutionData[][]>;
1049
- nodeHelpers: NodeHelperFunctions;
1050
- helpers: {
1051
- httpRequest(
1052
- requestOptions: IHttpRequestOptions,
1053
- ): Promise<IN8nHttpResponse | IN8nHttpFullResponse>;
1054
- httpRequestWithAuthentication(
1055
- this: IAllExecuteFunctions,
1056
- credentialsType: string,
1057
- requestOptions: IHttpRequestOptions,
1058
- additionalCredentialOptions?: IAdditionalCredentialOptions,
1059
- ): Promise<IN8nHttpResponse | IN8nHttpFullResponse>;
1060
- [key: string]: (...args: any[]) => any; // tslint:disable-line:no-any
1061
- };
1062
- addInputData(
1063
- data: INodeExecutionData[][] | ExecutionError,
1064
- node?: INode,
1065
- ): { index: number, inputExecutionData: IRunExecutionData };
1066
- addOutputData(
1067
- data: INodeExecutionData[][] | ExecutionError,
1068
- node?: INode,
1069
- ): { outputExecutionData: IRunExecutionData };
1070
- logAiEvent(event: AiEvent, data?: string): void;
1071
- }
1072
-
1073
- export interface INodeCredentialsDetails {
1074
- id: string | null;
1075
- name: string;
1076
- }
1077
-
1078
- export interface INodeCredentials {
1079
- [key: string]: INodeCredentialsDetails;
1080
- }
1081
- export type OnError = 'continueErrorOutput' | 'continueRegularOutput' | 'stopWorkflow';
1082
- export interface INode {
1083
- id: string;
1084
- name: string;
1085
- typeVersion: number | number[];
1086
- type: string;
1087
- position: [number, number];
1088
- disabled?: boolean;
1089
- notes?: string;
1090
- notesInFlow?: boolean;
1091
- retryOnFail?: boolean;
1092
- maxTries?: number;
1093
- waitBetweenTries?: number;
1094
- alwaysOutputData?: boolean;
1095
- executeOnce?: boolean;
1096
- onError?: OnError;
1097
- continueOnFail?: boolean;
1098
- parameters: INodeParameters;
1099
- credentials?: INodeCredentials;
1100
- webhookId?: string;
1101
- extendsCredential?: string;
1102
- rewireOutputLogTo?: NodeConnectionType;
1103
- }
1104
-
1105
- export interface INodes {
1106
- [key: string]: INode;
1107
- }
1108
-
1109
- export interface IObservableObject {
1110
- [key: string]: any;
1111
- __dataChanged: boolean;
1112
- }
1113
-
1114
- export interface IBinaryKeyData {
1115
- [key: string]: IBinaryData;
1116
- }
1117
-
1118
- export interface INodeExecutionData {
1119
- [key: string]: IDataObject | IBinaryKeyData | NodeApiError | NodeOperationError | undefined;
1120
- json: IDataObject;
1121
- binary?: IBinaryKeyData;
1122
- error?: NodeApiError | NodeOperationError;
1123
- }
1124
-
1125
- export interface INodeExecuteFunctions {
1126
- getExecutePollFunctions: IGetExecutePollFunctions;
1127
- getExecuteTriggerFunctions: IGetExecuteTriggerFunctions;
1128
- getExecuteFunctions: IGetExecuteFunctions;
1129
- getExecuteSingleFunctions: IGetExecuteSingleFunctions;
1130
- getExecuteHookFunctions: IGetExecuteHookFunctions;
1131
- getExecuteWebhookFunctions: IGetExecuteWebhookFunctions;
1132
- }
1133
-
1134
- // The values a node property can have
1135
- export type NodeParameterValue = string | number | boolean | undefined | null;
1136
-
1137
- export interface INodeParameters {
1138
- // TODO: Later also has to be possible to add multiple ones with the name name. So array has to be possible
1139
- [key: string]: NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[];
1140
- }
1141
-
1142
- export type NodePropertyTypes =
1143
- | 'boolean'
1144
- | 'button'
1145
- | 'collection'
1146
- | 'color'
1147
- | 'dateTime'
1148
- | 'fixedCollection'
1149
- | 'hidden'
1150
- | 'json'
1151
- | 'notice'
1152
- | 'multiOptions'
1153
- | 'number'
1154
- | 'options'
1155
- | 'string'
1156
- | 'credentialsSelect'
1157
- | 'resourceLocator'
1158
- | 'curlImport'
1159
- | 'resourceMapper'
1160
- | 'filter'
1161
- | 'assignmentCollection'
1162
- | 'credentials'
1163
- | 'workflowSelector';
1164
-
1165
- export type CodeAutocompleteTypes = 'function' | 'functionItem';
1166
-
1167
- export type EditorTypes = 'code' | 'json' | 'htmlEditor';
1168
- export type CodeNodeEditorLanguage = (typeof CODE_LANGUAGES)[number];
1169
- export type CodeExecutionMode = (typeof CODE_EXECUTION_MODES)[number];
1170
-
1171
- export interface ILoadOptions {
1172
- routing?: {
1173
- operations?: IN8nRequestOperations;
1174
- output?: INodeRequestOutput;
1175
- request?: IHttpRequestOptionsFromParameters;
1176
- };
1177
- }
1178
-
1179
- export interface INodePropertyTypeOptions {
1180
- alwaysOpenEditWindow?: boolean; // Supported by: string
1181
- codeAutocomplete?: CodeAutocompleteTypes; // Supported by: string
1182
- editor?: EditorTypes; // Supported by: string
1183
- loadOptionsDependsOn?: string[]; // Supported by: options
1184
- loadOptionsMethod?: string; // Supported by: options
1185
- loadOptions?: ILoadOptions; // Supported by: options
1186
- maxValue?: number; // Supported by: number
1187
- minValue?: number; // Supported by: number
1188
- multipleValues?: boolean; // Supported by: <All>
1189
- multipleValueButtonText?: string; // Supported when "multipleValues" set to true
1190
- numberPrecision?: number; // Supported by: number
1191
- password?: boolean; // Supported by: string
1192
- rows?: number; // Supported by: string
1193
- showAlpha?: boolean; // Supported by: color
1194
- sortable?: boolean; // Supported when "multipleValues" set to true
1195
- [key: string]: any;
1196
- }
1197
-
1198
- export type DisplayCondition =
1199
- | { _cnd: { eq: NodeParameterValue } }
1200
- | { _cnd: { not: NodeParameterValue } }
1201
- | { _cnd: { gte: number | string } }
1202
- | { _cnd: { lte: number | string } }
1203
- | { _cnd: { gt: number | string } }
1204
- | { _cnd: { lt: number | string } }
1205
- | { _cnd: { between: { from: number | string; to: number | string } } }
1206
- | { _cnd: { startsWith: string } }
1207
- | { _cnd: { endsWith: string } }
1208
- | { _cnd: { includes: string } }
1209
- | { _cnd: { regex: string } }
1210
- | { _cnd: { exists: true } };
1211
-
1212
-
1213
- export interface IDisplayOptions {
1214
- hide?: {
1215
- [key: string]: Array<NodeParameterValue | DisplayCondition> | NodeParameterValue[] | undefined;
1216
- };
1217
- show?: {
1218
- [key: string]: Array<NodeParameterValue | DisplayCondition> | NodeParameterValue[] | undefined;
1219
- };
1220
- }
1221
-
1222
- export type FieldTypeMap = {
1223
- // eslint-disable-next-line id-denylist
1224
- boolean: boolean;
1225
- // eslint-disable-next-line id-denylist
1226
- number: number;
1227
- // eslint-disable-next-line id-denylist
1228
- string: string;
1229
- 'string-alphanumeric': string;
1230
- dateTime: string;
1231
- time: string;
1232
- array: unknown[];
1233
- object: object;
1234
- options: any;
1235
- url: string;
1236
- jwt: string;
1237
- 'form-fields': FormFieldsParameter;
1238
- };
1239
-
1240
- export type ValidationResult<T extends FieldType = FieldType> =
1241
- | { valid: false; errorMessage: string }
1242
- | {
1243
- valid: true;
1244
- newValue?: FieldTypeMap[T];
1245
- };
1246
-
1247
- export type FieldType = keyof FieldTypeMap;
1248
-
1249
- export namespace MultiPartFormData {
1250
- export interface File {
1251
- filepath: string;
1252
- mimetype?: string;
1253
- originalFilename?: string;
1254
- newFilename: string;
1255
- size?: number;
1256
- }
1257
-
1258
- export type Request = express.Request<
1259
- {},
1260
- {},
1261
- {
1262
- data: Record<string, string | string[]>;
1263
- files: Record<string, File | File[]>;
1264
- }
1265
- >;
1266
- }
1267
-
1268
- export interface IVersionedNodeType {
1269
- nodeVersions: {
1270
- [key: number]: INodeType;
1271
- };
1272
- currentVersion: number;
1273
- description: INodeTypeBaseDescription;
1274
- getNodeType: (version?: number) => INodeType;
1275
- }
1276
-
1277
- export interface INodePropertyModeValidation {
1278
- type: string;
1279
- properties: {};
1280
- }
1281
-
1282
- export interface INodePropertyValueExtractorFunction {
1283
- (
1284
- this: IExecuteSingleFunctions,
1285
- value: string | NodeParameterValue,
1286
- ): Promise<string | NodeParameterValue> | (string | NodeParameterValue);
1287
- }
1288
-
1289
- export interface INodePropertyValueExtractorBase {
1290
- type: string;
1291
- }
1292
-
1293
- export interface INodePropertyValueExtractorRegex extends INodePropertyValueExtractorBase {
1294
- type: 'regex';
1295
- regex: string | RegExp;
1296
- }
1297
-
1298
- export type INodePropertyValueExtractor = INodePropertyValueExtractorRegex;
1299
-
1300
- export interface INodePropertyModeTypeOptions {
1301
- searchListMethod?: string; // Supported by: options
1302
- searchFilterRequired?: boolean;
1303
- searchable?: boolean;
1304
- }
1305
-
1306
-
1307
- export interface INodePropertyMode {
1308
- displayName: string;
1309
- name: string;
1310
- type: 'string' | 'list';
1311
- hint?: string;
1312
- validation?: Array<
1313
- INodePropertyModeValidation | { (this: IExecuteSingleFunctions, value: string): void }
1314
- >;
1315
- placeholder?: string;
1316
- url?: string;
1317
- extractValue?: INodePropertyValueExtractor;
1318
- initType?: string;
1319
- entryTypes?: {
1320
- [name: string]: {
1321
- selectable?: boolean;
1322
- hidden?: boolean;
1323
- queryable?: boolean;
1324
- data?: {
1325
- request?: IHttpRequestOptions;
1326
- output?: INodeRequestOutput;
1327
- };
1328
- };
1329
- };
1330
- search?: INodePropertyRouting;
1331
- typeOptions?: INodePropertyModeTypeOptions;
1332
- }
1333
-
1334
- export interface INodeProperties {
1335
- displayName: string;
1336
- name: string;
1337
- type: NodePropertyTypes;
1338
- typeOptions?: INodePropertyTypeOptions;
1339
- default: NodeParameterValue | INodeParameters | INodeParameters[] | NodeParameterValue[];
1340
- description?: string;
1341
- hint?: string;
1342
- displayOptions?: IDisplayOptions;
1343
- options?: Array<INodePropertyOptions | INodeProperties | INodePropertyCollection>;
1344
- placeholder?: string;
1345
- isNodeSetting?: boolean;
1346
- noDataExpression?: boolean;
1347
- required?: boolean;
1348
- routing?: INodePropertyRouting;
1349
- modes?: INodePropertyMode[];
1350
- validateType?: FieldType;
1351
- ignoreValidationDuringExecution?: boolean;
1352
- disabledOptions?: {
1353
- show?: {
1354
- [key: string]: Array<NodeParameterValue | DisplayCondition> | NodeParameterValue[] | undefined;
1355
- };
1356
- };
1357
- }
1358
- export interface INodePropertyOptions {
1359
- name: string;
1360
- value: string | number | boolean;
1361
- action?: string;
1362
- description?: string;
1363
- routing?: INodePropertyRouting;
1364
- outputConnectionType?: NodeConnectionType;
1365
- }
1366
-
1367
- export interface INodePropertyCollection {
1368
- displayName: string;
1369
- name: string;
1370
- values: INodeProperties[];
1371
- }
1372
-
1373
- export interface IParameterDependencies {
1374
- [key: string]: string[];
1375
- }
1376
-
1377
- export interface IPollResponse {
1378
- closeFunction?: () => Promise<void>;
1379
- }
1380
-
1381
- export interface ITriggerResponse {
1382
- closeFunction?: () => Promise<void>;
1383
- // To manually trigger the run
1384
- manualTriggerFunction?: () => Promise<void>;
1385
- // Gets added automatically at manual workflow runs resolves with
1386
- // the first emitted data
1387
- manualTriggerResponse?: Promise<INodeExecutionData[][]>;
1388
- }
1389
-
1390
- export interface SupplyData {
1391
- metadata?: IDataObject;
1392
- response: unknown;
1393
- closeFunction?: () => Promise<void>;
1394
- }
1395
-
1396
- namespace ExecuteFunctions {
1397
- namespace StringReturning {
1398
- export type NodeParameter =
1399
- | 'binaryProperty'
1400
- | 'binaryPropertyName'
1401
- | 'binaryPropertyOutput'
1402
- | 'dataPropertyName'
1403
- | 'dataBinaryProperty'
1404
- | 'resource'
1405
- | 'operation'
1406
- | 'filePath'
1407
- | 'encodingType';
1408
- }
1409
-
1410
- namespace NumberReturning {
1411
- export type NodeParameter = 'limit';
1412
- }
1413
-
1414
- namespace BooleanReturning {
1415
- export type NodeParameter =
1416
- | 'binaryData'
1417
- | 'download'
1418
- | 'jsonParameters'
1419
- | 'returnAll'
1420
- | 'rawData'
1421
- | 'resolveData';
1422
- }
1423
-
1424
- namespace RecordReturning {
1425
- export type NodeParameter = 'additionalFields' | 'filters' | 'options' | 'updateFields';
1426
- }
1427
-
1428
- export type GetNodeParameterFn = {
1429
- // @TECH_DEBT: Refactor to remove this barely used overload - N8N-5632
1430
- getNodeParameter<T extends { resource: string }>(
1431
- parameterName: 'resource',
1432
- itemIndex?: number,
1433
- ): T['resource'];
1434
-
1435
- getNodeParameter(
1436
- parameterName: StringReturning.NodeParameter,
1437
- itemIndex: number,
1438
- fallbackValue?: string,
1439
- options?: IGetNodeParameterOptions,
1440
- ): string;
1441
- getNodeParameter(
1442
- parameterName: RecordReturning.NodeParameter,
1443
- itemIndex: number,
1444
- fallbackValue?: IDataObject,
1445
- options?: IGetNodeParameterOptions,
1446
- ): IDataObject;
1447
- getNodeParameter(
1448
- parameterName: BooleanReturning.NodeParameter,
1449
- itemIndex: number,
1450
- fallbackValue?: boolean,
1451
- options?: IGetNodeParameterOptions,
1452
- ): boolean;
1453
- getNodeParameter(
1454
- parameterName: NumberReturning.NodeParameter,
1455
- itemIndex: number,
1456
- fallbackValue?: number,
1457
- options?: IGetNodeParameterOptions,
1458
- ): number;
1459
- getNodeParameter(
1460
- parameterName: string,
1461
- itemIndex: number,
1462
- fallbackValue?: any,
1463
- options?: IGetNodeParameterOptions,
1464
- ): NodeParameterValueType | object;
1465
- };
1466
- }
1467
-
1468
- export interface INodeListSearchItems extends INodePropertyOptions {
1469
- icon?: string;
1470
- url?: string;
1471
- }
1472
-
1473
- export interface INodeListSearchResult {
1474
- results: INodeListSearchItems[];
1475
- paginationToken?: unknown;
1476
- }
1477
-
1478
- export type IWorkflowNodeContext = ExecuteFunctions.GetNodeParameterFn &
1479
- Pick<FunctionsBase, 'getNode' | 'getWorkflow'>;
1480
-
1481
- export interface ILocalLoadOptionsFunctions {
1482
- getWorkflowNodeContext(nodeType: string): Promise<IWorkflowNodeContext | null>;
1483
- }
1484
-
1485
- export type LogLevel = (typeof LOG_LEVELS)[number];
1486
- export type LogMetadata = {
1487
- [key: string]: unknown;
1488
- scopes?: unknown[];
1489
- file?: string;
1490
- function?: string;
1491
- };
1492
- export type Logger = Record<
1493
- Exclude<LogLevel, 'silent'>,
1494
- (message: string, metadata?: LogMetadata) => void
1495
- >;
1496
-
1497
- export interface FunctionsBase {
1498
- logger: Logger;
1499
- getCredentials<T extends object = ICredentialDataDecryptedObject>(
1500
- type: string,
1501
- itemIndex?: number,
1502
- ): Promise<T>;
1503
- getCredentialsProperties(type: string): INodeProperties[];
1504
- getExecutionId(): string;
1505
- getNode(): INode;
1506
- getWorkflow(): IWorkflowMetadata;
1507
- getWorkflowStaticData(type: string): IDataObject;
1508
- getTimezone(): string;
1509
- getRestApiUrl(): string;
1510
- getInstanceBaseUrl(): string;
1511
- getInstanceId(): string;
1512
- getChildNodes(
1513
- nodeName: string,
1514
- options?: { includeNodeParameters?: boolean },
1515
- ): NodeTypeAndVersion[];
1516
- getParentNodes(nodeName: string): NodeTypeAndVersion[];
1517
- getKnownNodeTypes(): IDataObject;
1518
- getMode?: () => WorkflowExecuteMode;
1519
- getActivationMode?: () => WorkflowActivateMode;
1520
-
1521
- /** @deprecated */
1522
- prepareOutputData(outputData: INodeExecutionData[]): Promise<INodeExecutionData[][]>;
1523
- }
1524
-
1525
- export interface ResourceMapperFields {
1526
- fields: ResourceMapperField[];
1527
- emptyFieldsNotice?: string;
1528
- }
1529
-
1530
- export interface INodeType {
1531
- description: INodeTypeDescription;
1532
- supplyData?(this: ISupplyDataFunctions | IWebhookFunctions, itemIndex: number): Promise<SupplyData>;
1533
- execute?(this: IExecuteFunctions): Promise<INodeExecutionData[][] | null>;
1534
- executeSingle?(this: IExecuteSingleFunctions): Promise<INodeExecutionData>;
1535
- poll?(this: IPollFunctions): Promise<INodeExecutionData[][] | null>;
1536
- trigger?(this: ITriggerFunctions): Promise<ITriggerResponse | undefined>;
1537
- webhook?(this: IWebhookFunctions, workflow?: Workflow): Promise<IWebhookResponseData>;
1538
- hooks?: {
1539
- [key: string]: (this: IHookFunctions) => Promise<boolean>;
1540
- };
1541
- methods?: {
1542
- loadOptions?: {
1543
- [key: string]: (this: ILoadOptionsFunctions) => Promise<INodePropertyOptions[]>;
1544
- };
1545
- listSearch?: {
1546
- [key: string]: (
1547
- this: ILoadOptionsFunctions,
1548
- filter?: string,
1549
- paginationToken?: string,
1550
- ) => Promise<INodeListSearchResult>;
1551
- };
1552
- credentialTest?: {
1553
- // Contains a group of functins that test credentials.
1554
- [functionName: string]: ICredentialTestFunction;
1555
- };
1556
- resourceMapping?: {
1557
- [functionName: string]: (this: ILoadOptionsFunctions) => Promise<ResourceMapperFields>;
1558
- };
1559
- localResourceMapping?: {
1560
- [functionName: string]: (this: ILocalLoadOptionsFunctions) => Promise<ResourceMapperFields>;
1561
- };
1562
- actionHandler?: {
1563
- [functionName: string]: (
1564
- this: ILoadOptionsFunctions,
1565
- payload: IDataObject | string | undefined,
1566
- ) => Promise<NodeParameterValueType>;
1567
- };
1568
- };
1569
- webhookMethods?: {
1570
- [key: string]: IWebhookSetupMethods;
1571
- };
1572
- }
1573
-
1574
- export interface INodeVersionedType {
1575
- nodeVersions: {
1576
- [key: number]: INodeType;
1577
- };
1578
- currentVersion: number;
1579
- description: INodeTypeBaseDescription;
1580
- getNodeType: (version?: number) => INodeType;
1581
- }
1582
- export interface INodeCredentialTestResult {
1583
- status: 'OK' | 'Error';
1584
- message: string;
1585
- }
1586
-
1587
- export interface INodeCredentialTestRequest {
1588
- nodeToTestWith?: string; // node name i.e. slack
1589
- credentials: ICredentialsDecrypted;
1590
- }
1591
-
1592
- export type WebhookSetupMethodNames = 'checkExists' | 'create' | 'delete';
1593
-
1594
- export interface IWebhookSetupMethods {
1595
- [key: string]: ((this: IHookFunctions) => Promise<boolean>) | undefined;
1596
- checkExists?: (this: IHookFunctions) => Promise<boolean>;
1597
- create?: (this: IHookFunctions) => Promise<boolean>;
1598
- delete?: (this: IHookFunctions) => Promise<boolean>;
1599
- }
1600
-
1601
- export interface INodeCredentialDescription {
1602
- name: string;
1603
- required?: boolean;
1604
- displayOptions?: IDisplayOptions;
1605
- testedBy?: ICredentialTestRequest | string; // Name of a function inside `loadOptions.credentialTest`
1606
- }
1607
-
1608
- export type FormFieldsParameter = Array<{
1609
- fieldLabel: string;
1610
- elementName?: string;
1611
- fieldType?: string;
1612
- requiredField?: boolean;
1613
- fieldOptions?: { values: Array<{ option: string }> };
1614
- multiselect?: boolean;
1615
- multipleFiles?: boolean;
1616
- acceptFileTypes?: string;
1617
- formatDate?: string;
1618
- html?: string;
1619
- placeholder?: string;
1620
- fieldName?: string;
1621
- fieldValue?: string;
1622
- }>;
1623
-
1624
- export const NodeConnectionTypes = {
1625
- AiAgent: 'ai_agent',
1626
- AiChain: 'ai_chain',
1627
- AiDocument: 'ai_document',
1628
- AiEmbedding: 'ai_embedding',
1629
- AiLanguageModel: 'ai_languageModel',
1630
- AiMemory: 'ai_memory',
1631
- AiOutputParser: 'ai_outputParser',
1632
- AiRetriever: 'ai_retriever',
1633
- AiTextSplitter: 'ai_textSplitter',
1634
- AiTool: 'ai_tool',
1635
- AiVectorStore: 'ai_vectorStore',
1636
- Main: 'main',
1637
- } as const;
1638
-
1639
- export type NodeConnectionType = (typeof NodeConnectionTypes)[keyof typeof NodeConnectionTypes];
1640
-
1641
- export type INodeIssueTypes = 'credentials' | 'execution' | 'parameters' | 'typeUnknown';
1642
-
1643
- export interface INodeIssueObjectProperty {
1644
- [key: string]: string[];
1645
- }
1646
-
1647
- export interface INodeIssueData {
1648
- node: string;
1649
- type: INodeIssueTypes;
1650
- value: boolean | string | string[] | INodeIssueObjectProperty;
1651
- }
1652
-
1653
- export interface INodeIssues {
1654
- execution?: boolean;
1655
- credentials?: INodeIssueObjectProperty;
1656
- parameters?: INodeIssueObjectProperty;
1657
- typeUnknown?: boolean;
1658
- [key: string]: undefined | boolean | INodeIssueObjectProperty;
1659
- }
1660
-
1661
- export interface IWorfklowIssues {
1662
- [key: string]: INodeIssues;
1663
- }
1664
-
1665
- export type ThemeIconColor =
1666
- | 'gray'
1667
- | 'black'
1668
- | 'blue'
1669
- | 'light-blue'
1670
- | 'dark-blue'
1671
- | 'orange'
1672
- | 'orange-red'
1673
- | 'pink-red'
1674
- | 'red'
1675
- | 'light-green'
1676
- | 'green'
1677
- | 'dark-green'
1678
- | 'azure'
1679
- | 'purple'
1680
- | 'crimson';
1681
-
1682
- export type Themed<T> = T | { light: T; dark: T };
1683
-
1684
- export interface INodeTypeBaseDescription {
1685
- displayName: string;
1686
- name: string;
1687
- icon?: string | Icon;
1688
- iconColor?: ThemeIconColor;
1689
- iconUrl?: Themed<string>;
1690
- group: string[];
1691
- description: string;
1692
- documentationUrl?: string;
1693
- subtitle?: string;
1694
- defaultVersion?: number;
1695
- codex?: CodexData;
1696
- }
1697
-
1698
- export interface INodePropertyRouting {
1699
- operations?: IN8nRequestOperations; // Should be changed, does not sound right
1700
- output?: INodeRequestOutput;
1701
- request?: IHttpRequestOptionsFromParameters;
1702
- send?: INodeRequestSend;
1703
- }
1704
-
1705
- export interface IPostReceiveBase {
1706
- type: string;
1707
- enabled?: boolean | string;
1708
- properties: {
1709
- [key: string]: string | number | boolean | IDataObject;
1710
- };
1711
- errorMessage?: string;
1712
- }
1713
-
1714
- export interface IPostReceiveFilter extends IPostReceiveBase {
1715
- type: 'filter';
1716
- properties: {
1717
- pass: boolean | string;
1718
- };
1719
- }
1720
-
1721
- export interface IPostReceiveLimit extends IPostReceiveBase {
1722
- type: 'limit';
1723
- properties: {
1724
- maxResults: number | string;
1725
- };
1726
- }
1727
-
1728
- export type PostReceiveAction =
1729
- | ((
1730
- this: IExecuteSingleFunctions,
1731
- items: INodeExecutionData[],
1732
- response: IN8nHttpFullResponse,
1733
- ) => Promise<INodeExecutionData[]>)
1734
- | IPostReceiveBinaryData
1735
- | IPostReceiveFilter
1736
- | IPostReceiveLimit
1737
- | IPostReceiveRootProperty
1738
- | IPostReceiveSet
1739
- | IPostReceiveSetKeyValue
1740
- | IPostReceiveSort;
1741
-
1742
- export type PreSendAction = (
1743
- this: IExecuteSingleFunctions,
1744
- requestOptions: IHttpRequestOptions,
1745
- ) => Promise<IHttpRequestOptions>;
1746
-
1747
- export interface INodeRequestOutput {
1748
- maxResults?: number | string;
1749
- postReceive?: PostReceiveAction[];
1750
- }
1751
-
1752
- export interface INodeRequestSend {
1753
- preSend?: PreSendAction[];
1754
- paginate?: boolean | string; // Where should this life?
1755
- property?: string; // Maybe: propertyName, destinationProperty?
1756
- propertyInDotNotation?: boolean; // Enabled by default
1757
- type?: 'body' | 'query';
1758
- value?: string;
1759
- }
1760
-
1761
- export interface IPostReceiveBinaryData extends IPostReceiveBase {
1762
- type: 'binaryData';
1763
- properties: {
1764
- destinationProperty: string;
1765
- };
1766
- }
1767
-
1768
- export interface IPostReceiveRootProperty extends IPostReceiveBase {
1769
- type: 'rootProperty';
1770
- properties: {
1771
- property: string;
1772
- };
1773
- }
1774
-
1775
- export interface IPostReceiveSet extends IPostReceiveBase {
1776
- type: 'set';
1777
- properties: {
1778
- value: string;
1779
- };
1780
- }
1781
-
1782
- export interface IPostReceiveSetKeyValue extends IPostReceiveBase {
1783
- type: 'setKeyValue';
1784
- properties: {
1785
- [key: string]: string | number;
1786
- };
1787
- }
1788
-
1789
- export interface IPostReceiveSort extends IPostReceiveBase {
1790
- type: 'sort';
1791
- properties: {
1792
- key: string;
1793
- };
1794
- }
1795
-
1796
- export interface IHttpRequestOptionsFromParameters extends Partial<IHttpRequestOptions> {
1797
- url?: string;
1798
- }
1799
-
1800
- export interface IRequestOptionsFromParameters {
1801
- maxResults?: number | string;
1802
- options: IHttpRequestOptionsFromParameters;
1803
- paginate?: boolean | string;
1804
- preSend: PreSendAction[];
1805
- postReceive: Array<{
1806
- data: {
1807
- parameterValue: string | IDataObject | undefined;
1808
- };
1809
- actions: PostReceiveAction[];
1810
- }>;
1811
- requestOperations?: IN8nRequestOperations;
1812
- }
1813
-
1814
- export type TriggerPanelDefinition = {
1815
- hideContent?: boolean | string;
1816
- header?: string;
1817
- executionsHelp?: string | { active: string; inactive: string };
1818
- activationHint?: string | { active: string; inactive: string };
1819
- };
1820
-
1821
-
1822
- export type ExpressionString = `={{${string}}}`;
1823
-
1824
- export interface INodeTypeDescription extends INodeTypeBaseDescription {
1825
- version: number | number[];
1826
- defaults: INodeParameters;
1827
- triggerPanel?: TriggerPanelDefinition | boolean;
1828
- eventTriggerDescription?: string;
1829
- activationMessage?: string;
1830
- inputs: Array<NodeConnectionType | INodeInputConfiguration>;
1831
- inputNames?: string[];
1832
- outputs: Array<NodeConnectionType | INodeOutputConfiguration>;
1833
- outputNames?: string[];
1834
- properties: INodeProperties[];
1835
- credentials?: INodeCredentialDescription[];
1836
- maxNodes?: number; // How many nodes of that type can be created in a workflow
1837
- polling?: boolean;
1838
- requestDefaults?: IHttpRequestOptionsFromParameters;
1839
- requestOperations?: IN8nRequestOperations;
1840
- hooks?: {
1841
- [key: string]: INodeHookDescription[] | undefined;
1842
- activate?: INodeHookDescription[];
1843
- deactivate?: INodeHookDescription[];
1844
- };
1845
- webhooks?: IWebhookDescription[];
1846
- translation?: { [key: string]: object };
1847
- supportsCORS?: true | undefined;
1848
- __loadOptionsMethods?: string[]; // only for validation during build
1849
- }
1850
-
1851
- export interface INodeHookDescription {
1852
- method: string;
1853
- }
1854
-
1855
- export interface IWebhookData {
1856
- httpMethod: WebhookHttpMethod;
1857
- node: string;
1858
- path: string;
1859
- webhookDescription: IWebhookDescription;
1860
- workflowId: string;
1861
- workflowExecuteAdditionalData: IWorkflowExecuteAdditionalData;
1862
- webhookId?: string;
1863
- }
1864
-
1865
- export interface IWebhookDescription {
1866
- [key: string]: WebhookHttpMethod | WebhookResponseMode | boolean | string | undefined;
1867
- httpMethod: WebhookHttpMethod | string;
1868
- isFullPath?: boolean;
1869
- name: string;
1870
- path: string;
1871
- responseBinaryPropertyName?: string;
1872
- responseContentType?: string;
1873
- responsePropertyName?: string;
1874
- responseMode?: WebhookResponseMode | string;
1875
- responseData?: WebhookResponseData | string;
1876
- restartWebhook?: boolean;
1877
- }
1878
-
1879
- export interface IWorkflowDataProxyData {
1880
- [key: string]: any;
1881
- $binary: any;
1882
- $data: any;
1883
- $env: any;
1884
- $evaluateExpression: any;
1885
- $item: any;
1886
- $items: any;
1887
- $json: any;
1888
- $node: any;
1889
- $parameter: any;
1890
- $position: any;
1891
- $workflow: any;
1892
- $: any;
1893
- $input: any;
1894
- $thisItem: any;
1895
- $thisRunIndex: number;
1896
- $thisItemIndex: number;
1897
- $now: any;
1898
- $today: any;
1899
- }
1900
-
1901
- export type IWorkflowDataProxyAdditionalKeys = IDataObject;
1902
-
1903
- export interface IWorkflowMetadata {
1904
- id?: number | string;
1905
- name?: string;
1906
- active: boolean;
1907
- }
1908
-
1909
- export type WebhookHttpMethod = 'DELETE' | 'GET' | 'HEAD' | 'PATCH' | 'POST' | 'PUT' | 'OPTIONS';
1910
-
1911
- export interface IWebhookResponseData {
1912
- workflowData?: INodeExecutionData[][];
1913
- webhookResponse?: any;
1914
- noWebhookResponse?: boolean;
1915
- }
1916
-
1917
- export type WebhookResponseData = 'allEntries' | 'firstEntryJson' | 'firstEntryBinary' | 'noData';
1918
- export type WebhookResponseMode = 'onReceived' | 'lastNode';
1919
-
1920
- export interface INodeTypes {
1921
- nodeTypes: INodeTypeData;
1922
- init(nodeTypes?: INodeTypeData): Promise<void>;
1923
- getAll(): Array<INodeType | INodeVersionedType>;
1924
- getByNameAndVersion(nodeType: string, version?: number | number[]): INodeType | undefined;
1925
- }
1926
-
1927
- export interface ICredentialTypeData {
1928
- [key: string]: {
1929
- type: ICredentialType;
1930
- sourcePath: string;
1931
- };
1932
- }
1933
-
1934
- export interface INodeTypeData {
1935
- [key: string]: {
1936
- type: INodeType | INodeVersionedType;
1937
- sourcePath: string;
1938
- };
1939
- }
1940
-
1941
- export interface IRun {
1942
- data: IRunExecutionData;
1943
- finished?: boolean;
1944
- mode: WorkflowExecuteMode;
1945
- waitTill?: Date;
1946
- startedAt: Date;
1947
- stoppedAt?: Date;
1948
- }
1949
-
1950
-
1951
- export type EnsureTypeOptions = 'string' | 'number' | 'boolean' | 'object' | 'array' | 'json';
1952
- export interface IGetNodeParameterOptions {
1953
- contextNode?: INode;
1954
- // make sure that returned value would be of specified type, converts it if needed
1955
- ensureType?: EnsureTypeOptions;
1956
- // extract value from regex, works only when parameter type is resourceLocator
1957
- extractValue?: boolean;
1958
- // get raw value of parameter with unresolved expressions
1959
- rawExpressions?: boolean;
1960
- }
1961
-
1962
- // Contains all the data which is needed to execute a workflow and so also to
1963
- // start restart it again after it did fail.
1964
- // The RunData, ExecuteData and WaitForExecution contain often the same data.
1965
- export interface IRunExecutionData {
1966
- startData?: {
1967
- destinationNode?: string;
1968
- runNodeFilter?: string[];
1969
- };
1970
- resultData: {
1971
- error?: ExecutionError;
1972
- runData: IRunData;
1973
- lastNodeExecuted?: string;
1974
- };
1975
- executionData?: {
1976
- contextData: IExecuteContextData;
1977
- nodeExecutionStack: IExecuteData[];
1978
- waitingExecution: IWaitingForExecution;
1979
- };
1980
- waitTill?: Date;
1981
- }
1982
-
1983
- export interface IRunData {
1984
- // node-name: result-data
1985
- [key: string]: ITaskData[];
1986
- }
1987
-
1988
- // The data that gets returned when a node runs
1989
- export interface ITaskData {
1990
- startTime: number;
1991
- executionTime: number;
1992
- data?: ITaskDataConnections;
1993
- error?: ExecutionError;
1994
- }
1995
-
1996
- // The data for al the different kind of connectons (like main) and all the indexes
1997
- export interface ITaskDataConnections {
1998
- // Key for each input type and because there can be multiple inputs of the same type it is an array
1999
- // null is also allowed because if we still need data for a later while executing the workflow set teompoary to null
2000
- // the nodes get as input TaskDataConnections which is identical to this one except that no null is allowed.
2001
- [key: string]: Array<INodeExecutionData[] | null>;
2002
- }
2003
-
2004
- // Keeps data while workflow gets executed and allows when provided to restart execution
2005
- export interface IWaitingForExecution {
2006
- // Node name
2007
- [key: string]: {
2008
- // Run index
2009
- [key: number]: ITaskDataConnections;
2010
- };
2011
- }
2012
-
2013
- export interface IWorkflowBase {
2014
- id?: number | string | any;
2015
- name: string;
2016
- active: boolean;
2017
- createdAt: Date;
2018
- updatedAt: Date;
2019
- nodes: INode[];
2020
- connections: IConnections;
2021
- settings?: IWorkflowSettings;
2022
- staticData?: IDataObject;
2023
- teamId?: string | null;
2024
- }
2025
-
2026
- export interface IWorkflowCredentials {
2027
- [credentialType: string]: {
2028
- [id: string]: ICredentialsEncrypted;
2029
- };
2030
- }
2031
-
2032
- export interface IWorkflowExecuteHooks {
2033
- [key: string]: Array<(...args: any[]) => Promise<void>> | undefined;
2034
- nodeExecuteAfter?: Array<
2035
- (nodeName: string, data: ITaskData, executionData: IRunExecutionData) => Promise<void>
2036
- >;
2037
- nodeExecuteBefore?: Array<(nodeName: string) => Promise<void>>;
2038
- workflowExecuteAfter?: Array<(data: IRun, newStaticData: IDataObject) => Promise<void>>;
2039
- workflowExecuteBefore?: Array<(workflow: Workflow, data: IRunExecutionData) => Promise<void>>;
2040
- sendResponse?: Array<(response: IExecuteResponsePromiseData) => Promise<void>>;
2041
- }
2042
-
2043
- export interface IWorkflowExecuteAdditionalData {
2044
- credentialsHelper: ICredentialsHelper;
2045
- encryptionKey: string;
2046
- executeWorkflow: (
2047
- workflowInfo: IExecuteWorkflowInfo,
2048
- additionalData: IWorkflowExecuteAdditionalData,
2049
- inputData?: INodeExecutionData[],
2050
- parentExecutionId?: string,
2051
- loadedWorkflowData?: IWorkflowBase,
2052
- loadedRunData?: any,
2053
- ) => Promise<any>;
2054
- // hooks?: IWorkflowExecuteHooks;
2055
- executionId?: string;
2056
- hooks?: WorkflowHooks;
2057
- httpResponse?: express.Response;
2058
- httpRequest?: express.Request;
2059
- restApiUrl: string;
2060
- sendMessageToUI?: (source: string, message: any) => void;
2061
- timezone: string;
2062
- webhookBaseUrl: string;
2063
- webhookWaitingBaseUrl: string;
2064
- webhookTestBaseUrl: string;
2065
- currentNodeParameters?: INodeParameters;
2066
- executionTimeoutTimestamp?: number;
2067
- userId: string;
2068
- }
2069
-
2070
- export type WorkflowExecuteMode =
2071
- | 'cli'
2072
- | 'error'
2073
- | 'integrated'
2074
- | 'internal'
2075
- | 'manual'
2076
- | 'retry'
2077
- | 'trigger'
2078
- | 'webhook';
2079
- export type WorkflowActivateMode = 'init' | 'create' | 'update' | 'activate' | 'manual';
2080
-
2081
- export interface IWorkflowHooksOptionalParameters {
2082
- parentProcessMode?: string;
2083
- retryOf?: string;
2084
- sessionId?: string;
2085
- }
2086
-
2087
- export interface IWorkflowSettings {
2088
- [key: string]: IDataObject | string | number | boolean | undefined;
2089
- }
2090
-
2091
- export type LogTypes = 'debug' | 'verbose' | 'info' | 'warn' | 'error';
2092
-
2093
- export interface ILogger {
2094
- log: (type: LogTypes, message: string, meta?: object) => void;
2095
- debug: (message: string, meta?: object) => void;
2096
- verbose: (message: string, meta?: object) => void;
2097
- info: (message: string, meta?: object) => void;
2098
- warn: (message: string, meta?: object) => void;
2099
- error: (message: string, meta?: object) => void;
2100
- }
2101
-
2102
- export interface IStatusCodeMessages {
2103
- [key: string]: string;
2104
- }
2105
-
2106
- export interface INodeInputFilter {
2107
- // TODO: Later add more filter options like categories, subcatogries,
2108
- // regex, allow to exclude certain nodes, ... ?
2109
- // Potentially change totally after alpha/beta. Is not a breaking change after all.
2110
- nodes: string[]; // Allowed nodes
2111
- }
2112
-
2113
- export interface INodeInputConfiguration {
2114
- category?: string;
2115
- displayName?: string;
2116
- required?: boolean;
2117
- type: NodeConnectionType;
2118
- filter?: INodeInputFilter;
2119
- maxConnections?: number;
2120
- }
2121
-
2122
- export interface INodeOutputConfiguration {
2123
- category?: 'error';
2124
- displayName?: string;
2125
- maxConnections?: number;
2126
- required?: boolean;
2127
- type: NodeConnectionType;
2128
- }
2129
-
2130
- export type NodeLoadingDetails = LoadingDetails;
2131
-
2132
- export type LoadingDetails = {
2133
- className: string;
2134
- sourcePath: string;
2135
- };
2136
-
2137
- export type CredentialLoadingDetails = LoadingDetails & {
2138
- supportedNodes?: string[];
2139
- extends?: string[];
2140
- };
2141
-
2142
- export type DocumentationLink = {
2143
- url: string;
2144
- };
2145
-
2146
- export type KnownNodesAndCredentials = {
2147
- nodes: Record<string, NodeLoadingDetails>;
2148
- credentials: Record<string, CredentialLoadingDetails>;
2149
- };
2150
-
2151
- export type CodexData = {
2152
- categories?: string[];
2153
- subcategories?: { [category: string]: string[] };
2154
- resources?: {
2155
- credentialDocumentation?: DocumentationLink[];
2156
- primaryDocumentation?: DocumentationLink[];
2157
- };
2158
- alias?: string[];
2159
- };
2160
-
2161
- export type JsonValue = string | number | boolean | null | JsonObject | JsonValue[];
2162
-
2163
- export type JsonObject = { [key: string]: JsonValue };
2164
-
2165
- export type AllEntities<M> = M extends { [key: string]: string } ? Entity<M, keyof M> : never;
2166
-
2167
- export type Entity<M, K> = K extends keyof M ? { resource: K; operation: M[K] } : never;
2168
-
2169
- export type PropertiesOf<M extends { resource: string; operation: string }> = Array<
2170
- Omit<INodeProperties, 'displayOptions'> & {
2171
- displayOptions?: {
2172
- [key in 'show' | 'hide']?: {
2173
- resource?: Array<M['resource']>;
2174
- operation?: Array<M['operation']>;
2175
- [otherKey: string]: NodeParameterValue[] | undefined;
2176
- };
2177
- };
2178
- }
2179
- >;
2180
-
2181
- // Telemetry
2182
-
2183
- export interface INodesGraph {
2184
- node_types: string[];
2185
- node_connections: IDataObject[];
2186
- nodes: INodesGraphNode;
2187
- }
2188
-
2189
- export interface INodesGraphNode {
2190
- [key: string]: INodeGraphItem;
2191
- }
2192
-
2193
- export interface INodeGraphItem {
2194
- type: string;
2195
- resource?: string;
2196
- operation?: string;
2197
- domain?: string;
2198
- position: [number, number];
2199
- mode?: string;
2200
- }
2201
-
2202
- export interface INodeNameIndex {
2203
- [name: string]: string;
2204
- }
2205
-
2206
- export interface INodesGraphResult {
2207
- nodeGraph: INodesGraph;
2208
- nameIndices: INodeNameIndex;
2209
- }
2210
-
2211
- export interface ITelemetryClientConfig {
2212
- url: string;
2213
- key: string;
2214
- }
2215
-
2216
- export interface ITelemetrySettings {
2217
- enabled: boolean;
2218
- config?: ITelemetryClientConfig;
2219
- }
2220
- export interface ISourceData {
2221
- previousNode: string;
2222
- previousNodeOutput?: number; // If undefined "0" gets used
2223
- previousNodeRun?: number; // If undefined "0" gets used
2224
- }
2225
- export interface IPairedItemData {
2226
- item: number;
2227
- input?: number; // If undefined "0" gets used
2228
- sourceOverwrite?: ISourceData;
2229
- }
2230
-
2231
- export type CloseFunction = () => Promise<void>;
2232
-
2233
- export interface SupplyData {
2234
- metadata?: IDataObject;
2235
- response: unknown;
2236
- closeFunction?: CloseFunction;
2237
- }
2238
-
2239
- type FunctionsBaseWithRequiredKeys<Keys extends keyof FunctionsBase> = FunctionsBase & {
2240
- [K in Keys]: NonNullable<FunctionsBase[K]>;
2241
- };
2242
-
2243
- export type AiEvent =
2244
- | 'ai-messages-retrieved-from-memory'
2245
- | 'ai-message-added-to-memory'
2246
- | 'ai-output-parsed'
2247
- | 'ai-documents-retrieved'
2248
- | 'ai-document-embedded'
2249
- | 'ai-query-embedded'
2250
- | 'ai-document-processed'
2251
- | 'ai-text-split'
2252
- | 'ai-tool-called'
2253
- | 'ai-vector-store-searched'
2254
- | 'ai-llm-generated-output'
2255
- | 'ai-llm-errored'
2256
- | 'ai-vector-store-populated'
2257
- | 'ai-vector-store-updated';