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