@fsai-flow/core 0.0.4 → 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/index.d.ts +17 -0
  2. package/dist/index.js +61 -0
  3. package/dist/{src/lib → lib}/ActiveWebhooks.d.ts +1 -1
  4. package/dist/lib/ActiveWebhooks.js +177 -0
  5. package/dist/{src/lib → lib}/ActiveWorkflows.d.ts +3 -3
  6. package/dist/lib/ActiveWorkflows.js +465 -0
  7. package/dist/{src/lib → lib}/BinaryDataManager/FileSystem.d.ts +1 -1
  8. package/dist/lib/BinaryDataManager/FileSystem.js +180 -0
  9. package/dist/{src/lib → lib}/BinaryDataManager/index.d.ts +2 -2
  10. package/dist/lib/BinaryDataManager/index.js +129 -0
  11. package/dist/{src/lib → lib}/ChangeCase.js +11 -11
  12. package/dist/lib/Constants.js +18 -0
  13. package/dist/{src/lib → lib}/Credentials.d.ts +1 -1
  14. package/dist/{src/lib → lib}/Credentials.js +7 -8
  15. package/dist/{src/lib → lib}/FileSystem.d.ts +1 -1
  16. package/dist/lib/FileSystem.js +180 -0
  17. package/dist/{src/lib → lib}/InputConnectionDataLegacy.d.ts +1 -1
  18. package/dist/lib/InputConnectionDataLegacy.js +72 -0
  19. package/dist/{src/lib → lib}/Interfaces.d.ts +47 -48
  20. package/dist/{src/lib → lib}/Interfaces.js +0 -1
  21. package/dist/{src/lib → lib}/LoadNodeParameterOptions.d.ts +1 -1
  22. package/dist/lib/LoadNodeParameterOptions.js +152 -0
  23. package/dist/{src/lib → lib}/NodeExecuteFunctions.d.ts +9 -10
  24. package/dist/lib/NodeExecuteFunctions.js +2467 -0
  25. package/dist/{src/lib → lib}/NodesLoader/constants.d.ts +1 -1
  26. package/dist/lib/NodesLoader/constants.js +105 -0
  27. package/dist/{src/lib → lib}/NodesLoader/custom-directory-loader.d.ts +1 -1
  28. package/dist/lib/NodesLoader/custom-directory-loader.js +35 -0
  29. package/dist/{src/lib → lib}/NodesLoader/directory-loader.d.ts +1 -1
  30. package/dist/{src/lib → lib}/NodesLoader/directory-loader.js +80 -38
  31. package/dist/lib/NodesLoader/index.d.ts +5 -0
  32. package/dist/{src/lib → lib}/NodesLoader/index.js +5 -6
  33. package/dist/{src/lib → lib}/NodesLoader/lazy-package-directory-loader.d.ts +1 -1
  34. package/dist/lib/NodesLoader/lazy-package-directory-loader.js +44 -0
  35. package/dist/{src/lib → lib}/NodesLoader/load-class-in-isolation.js +6 -11
  36. package/dist/{src/lib → lib}/NodesLoader/package-directory-loader.d.ts +2 -2
  37. package/dist/{src/lib → lib}/NodesLoader/package-directory-loader.js +28 -36
  38. package/dist/{src/lib → lib}/NodesLoader/types.js +0 -1
  39. package/dist/{src/lib → lib}/RedisLeaderElectionManager.d.ts +1 -1
  40. package/dist/lib/RedisLeaderElectionManager.js +279 -0
  41. package/dist/lib/RequestTypes.d.ts +58 -0
  42. package/dist/lib/RequestTypes.js +8 -0
  43. package/dist/{src/lib → lib}/UserSettings.d.ts +1 -1
  44. package/dist/lib/UserSettings.js +269 -0
  45. package/dist/{src/lib → lib}/WorkflowExecute.d.ts +4 -4
  46. package/dist/{src/lib → lib}/WorkflowExecute.js +230 -178
  47. package/dist/{src/lib → lib}/index.d.ts +2 -2
  48. package/dist/lib/index.js +129 -0
  49. package/dist/{src/utils → utils}/crypto.js +2 -3
  50. package/package.json +59 -52
  51. package/dist/README.md +0 -31
  52. package/dist/package.json +0 -54
  53. package/dist/src/index.d.ts +0 -16
  54. package/dist/src/index.js +0 -30
  55. package/dist/src/index.js.map +0 -1
  56. package/dist/src/lib/ActiveWebhooks.js +0 -184
  57. package/dist/src/lib/ActiveWebhooks.js.map +0 -1
  58. package/dist/src/lib/ActiveWorkflows.js +0 -456
  59. package/dist/src/lib/ActiveWorkflows.js.map +0 -1
  60. package/dist/src/lib/BinaryDataManager/FileSystem.js +0 -179
  61. package/dist/src/lib/BinaryDataManager/FileSystem.js.map +0 -1
  62. package/dist/src/lib/BinaryDataManager/index.js +0 -146
  63. package/dist/src/lib/BinaryDataManager/index.js.map +0 -1
  64. package/dist/src/lib/ChangeCase.js.map +0 -1
  65. package/dist/src/lib/Constants.js +0 -19
  66. package/dist/src/lib/Constants.js.map +0 -1
  67. package/dist/src/lib/Credentials.js.map +0 -1
  68. package/dist/src/lib/FileSystem.js +0 -179
  69. package/dist/src/lib/FileSystem.js.map +0 -1
  70. package/dist/src/lib/InputConnectionDataLegacy.js +0 -79
  71. package/dist/src/lib/InputConnectionDataLegacy.js.map +0 -1
  72. package/dist/src/lib/Interfaces.js.map +0 -1
  73. package/dist/src/lib/LoadNodeParameterOptions.js +0 -150
  74. package/dist/src/lib/LoadNodeParameterOptions.js.map +0 -1
  75. package/dist/src/lib/NodeExecuteFunctions.js +0 -2479
  76. package/dist/src/lib/NodeExecuteFunctions.js.map +0 -1
  77. package/dist/src/lib/NodesLoader/constants.js +0 -106
  78. package/dist/src/lib/NodesLoader/constants.js.map +0 -1
  79. package/dist/src/lib/NodesLoader/custom-directory-loader.js +0 -36
  80. package/dist/src/lib/NodesLoader/custom-directory-loader.js.map +0 -1
  81. package/dist/src/lib/NodesLoader/directory-loader.js.map +0 -1
  82. package/dist/src/lib/NodesLoader/index.d.ts +0 -5
  83. package/dist/src/lib/NodesLoader/index.js.map +0 -1
  84. package/dist/src/lib/NodesLoader/lazy-package-directory-loader.js +0 -52
  85. package/dist/src/lib/NodesLoader/lazy-package-directory-loader.js.map +0 -1
  86. package/dist/src/lib/NodesLoader/load-class-in-isolation.js.map +0 -1
  87. package/dist/src/lib/NodesLoader/package-directory-loader.js.map +0 -1
  88. package/dist/src/lib/NodesLoader/types.js.map +0 -1
  89. package/dist/src/lib/RedisLeaderElectionManager.js +0 -294
  90. package/dist/src/lib/RedisLeaderElectionManager.js.map +0 -1
  91. package/dist/src/lib/UserSettings.js +0 -261
  92. package/dist/src/lib/UserSettings.js.map +0 -1
  93. package/dist/src/lib/WorkflowExecute.js.map +0 -1
  94. package/dist/src/lib/index.js +0 -146
  95. package/dist/src/lib/index.js.map +0 -1
  96. package/dist/src/utils/crypto.js.map +0 -1
  97. package/eslint.config.js +0 -19
  98. package/jest.config.ts +0 -10
  99. package/project.json +0 -19
  100. package/src/index.ts +0 -28
  101. package/src/lib/ActiveWebhooks.ts +0 -245
  102. package/src/lib/ActiveWorkflows.ts +0 -575
  103. package/src/lib/BinaryDataManager/FileSystem.ts +0 -214
  104. package/src/lib/BinaryDataManager/index.ts +0 -187
  105. package/src/lib/ChangeCase.ts +0 -45
  106. package/src/lib/Constants.ts +0 -16
  107. package/src/lib/Credentials.ts +0 -108
  108. package/src/lib/FileSystem.ts +0 -214
  109. package/src/lib/InputConnectionDataLegacy.ts +0 -123
  110. package/src/lib/Interfaces.ts +0 -338
  111. package/src/lib/LoadNodeParameterOptions.ts +0 -235
  112. package/src/lib/NodeExecuteFunctions.ts +0 -3700
  113. package/src/lib/NodesLoader/constants.ts +0 -112
  114. package/src/lib/NodesLoader/custom-directory-loader.ts +0 -31
  115. package/src/lib/NodesLoader/directory-loader.ts +0 -458
  116. package/src/lib/NodesLoader/index.ts +0 -5
  117. package/src/lib/NodesLoader/lazy-package-directory-loader.ts +0 -55
  118. package/src/lib/NodesLoader/load-class-in-isolation.ts +0 -19
  119. package/src/lib/NodesLoader/package-directory-loader.ts +0 -107
  120. package/src/lib/NodesLoader/types.ts +0 -14
  121. package/src/lib/RedisLeaderElectionManager.ts +0 -334
  122. package/src/lib/UserSettings.ts +0 -292
  123. package/src/lib/WorkflowExecute.ts +0 -1128
  124. package/src/lib/index.ts +0 -187
  125. package/src/utils/crypto.ts +0 -5
  126. package/tests/Credentials.test.ts +0 -88
  127. package/tests/Helpers.ts +0 -808
  128. package/tests/WorkflowExecute.test.ts +0 -1242
  129. package/tsconfig.json +0 -41
  130. package/tsconfig.lib.json +0 -10
  131. package/tsconfig.spec.json +0 -14
  132. /package/dist/{src/lib → lib}/ChangeCase.d.ts +0 -0
  133. /package/dist/{src/lib → lib}/Constants.d.ts +0 -0
  134. /package/dist/{src/lib → lib}/NodesLoader/load-class-in-isolation.d.ts +0 -0
  135. /package/dist/{src/lib → lib}/NodesLoader/types.d.ts +0 -0
  136. /package/dist/{src/utils → utils}/crypto.d.ts +0 -0
@@ -1,214 +0,0 @@
1
- import { promises as fs } from 'fs';
2
- import * as path from 'path';
3
- import { v4 as uuid } from 'uuid';
4
-
5
- import { IBinaryDataConfig, IBinaryDataManager } from './Interfaces';
6
-
7
- const PREFIX_METAFILE = 'binarymeta';
8
- const PREFIX_PERSISTED_METAFILE = 'persistedmeta';
9
-
10
- export class BinaryDataFileSystem implements IBinaryDataManager {
11
- private storagePath: string;
12
-
13
- private binaryDataTTL: number;
14
-
15
- private persistedBinaryDataTTL: number;
16
-
17
- constructor(config: IBinaryDataConfig) {
18
- this.storagePath = config.localStoragePath;
19
- this.binaryDataTTL = config.binaryDataTTL;
20
- this.persistedBinaryDataTTL = config.persistedBinaryDataTTL;
21
- }
22
-
23
- async init(startPurger = false): Promise<void> {
24
- if (startPurger) {
25
- setInterval(async () => {
26
- await this.deleteMarkedFiles();
27
- }, this.binaryDataTTL * 30000);
28
-
29
- setInterval(async () => {
30
- await this.deleteMarkedPersistedFiles();
31
- }, this.persistedBinaryDataTTL * 30000);
32
- }
33
-
34
- return fs
35
- .readdir(this.storagePath)
36
- .catch(async () => fs.mkdir(this.storagePath, { recursive: true }))
37
- .then(async () => fs.readdir(this.getBinaryDataMetaPath()))
38
- .catch(async () => fs.mkdir(this.getBinaryDataMetaPath(), { recursive: true }))
39
- .then(async () => fs.readdir(this.getBinaryDataPersistMetaPath()))
40
- .catch(async () => fs.mkdir(this.getBinaryDataPersistMetaPath(), { recursive: true }))
41
- .then(async () => this.deleteMarkedFiles())
42
- .then(async () => this.deleteMarkedPersistedFiles())
43
- .then(() => {});
44
- }
45
-
46
- async storeBinaryData(binaryBuffer: Buffer, executionId: string): Promise<string> {
47
- const binaryDataId = this.generateFileName(executionId);
48
- return this.addBinaryIdToPersistMeta(executionId, binaryDataId).then(async () =>
49
- this.saveToLocalStorage(binaryBuffer, binaryDataId).then(() => binaryDataId),
50
- );
51
- }
52
-
53
- async retrieveBinaryDataByIdentifier(identifier: string): Promise<Buffer> {
54
- return this.retrieveFromLocalStorage(identifier);
55
- }
56
-
57
- async markDataForDeletionByExecutionId(executionId: string): Promise<void> {
58
- const tt = new Date(new Date().getTime() + this.binaryDataTTL * 60000);
59
- return fs.writeFile(
60
- path.join(this.getBinaryDataMetaPath(), `${PREFIX_METAFILE}_${executionId}_${tt.valueOf()}`),
61
- '',
62
- );
63
- }
64
-
65
- async deleteMarkedFiles(): Promise<void> {
66
- return this.deleteMarkedFilesByMeta(this.getBinaryDataMetaPath(), PREFIX_METAFILE);
67
- }
68
-
69
- async deleteMarkedPersistedFiles(): Promise<void> {
70
- return this.deleteMarkedFilesByMeta(
71
- this.getBinaryDataPersistMetaPath(),
72
- PREFIX_PERSISTED_METAFILE,
73
- );
74
- }
75
-
76
- private async addBinaryIdToPersistMeta(executionId: string, identifier: string): Promise<void> {
77
- const currentTime = new Date().getTime();
78
- const timeAtNextHour = currentTime + 3600000 - (currentTime % 3600000);
79
- const timeoutTime = timeAtNextHour + this.persistedBinaryDataTTL * 60000;
80
-
81
- const filePath = path.join(
82
- this.getBinaryDataPersistMetaPath(),
83
- `${PREFIX_PERSISTED_METAFILE}_${executionId}_${timeoutTime}`,
84
- );
85
-
86
- return fs
87
- .readFile(filePath)
88
- .catch(async () => fs.writeFile(filePath, identifier))
89
- .then(() => {});
90
- }
91
-
92
- private async deleteMarkedFilesByMeta(metaPath: string, filePrefix: string): Promise<void> {
93
- const currentTimeValue = new Date().valueOf();
94
- const metaFileNames = await fs.readdir(metaPath);
95
-
96
- const execsAdded: { [key: string]: number } = {};
97
-
98
- const proms = metaFileNames.reduce(
99
- (prev, curr) => {
100
- const [prefix, executionId, ts] = curr.split('_');
101
-
102
- if (prefix !== filePrefix) {
103
- return prev;
104
- }
105
-
106
- const execTimestamp = parseInt(ts, 10);
107
-
108
- if (execTimestamp < currentTimeValue) {
109
- if (execsAdded[executionId]) {
110
- // do not delete data, only meta file
111
- prev.push(this.deleteMetaFileByPath(path.join(metaPath, curr)));
112
- return prev;
113
- }
114
-
115
- execsAdded[executionId] = 1;
116
- prev.push(
117
- this.deleteBinaryDataByExecutionId(executionId).then(async () =>
118
- this.deleteMetaFileByPath(path.join(metaPath, curr)),
119
- ),
120
- );
121
- }
122
-
123
- return prev;
124
- },
125
- [Promise.resolve()],
126
- );
127
-
128
- return Promise.all(proms).then(() => {});
129
- }
130
-
131
- async duplicateBinaryDataByIdentifier(binaryDataId: string, prefix: string): Promise<string> {
132
- const newBinaryDataId = this.generateFileName(prefix);
133
-
134
- return fs
135
- .copyFile(
136
- path.join(this.storagePath, binaryDataId),
137
- path.join(this.storagePath, newBinaryDataId),
138
- )
139
- .then(() => newBinaryDataId);
140
- }
141
-
142
- async deleteBinaryDataByExecutionId(executionId: string): Promise<void> {
143
- const regex = new RegExp(`${executionId}_*`);
144
- const filenames = await fs.readdir(path.join(this.storagePath));
145
-
146
- const proms = filenames.reduce(
147
- (allProms, filename) => {
148
- if (regex.test(filename)) {
149
- allProms.push(fs.rm(path.join(this.storagePath, filename)));
150
- }
151
-
152
- return allProms;
153
- },
154
- [Promise.resolve()],
155
- );
156
-
157
- return Promise.all(proms).then(async () => Promise.resolve());
158
- }
159
-
160
- async deleteBinaryDataByIdentifier(identifier: string): Promise<void> {
161
- return this.deleteFromLocalStorage(identifier);
162
- }
163
-
164
- async persistBinaryDataForExecutionId(executionId: string): Promise<void> {
165
- return fs.readdir(this.getBinaryDataPersistMetaPath()).then(async (metafiles) => {
166
- const proms = metafiles.reduce(
167
- (prev, curr) => {
168
- if (curr.startsWith(`${PREFIX_PERSISTED_METAFILE}_${executionId}_`)) {
169
- prev.push(fs.rm(path.join(this.getBinaryDataPersistMetaPath(), curr)));
170
- return prev;
171
- }
172
-
173
- return prev;
174
- },
175
- [Promise.resolve()],
176
- );
177
-
178
- return Promise.all(proms).then(() => {});
179
- });
180
- }
181
-
182
- private generateFileName(prefix: string): string {
183
- return `${prefix}_${uuid()}`;
184
- }
185
-
186
- private getBinaryDataMetaPath() {
187
- return path.join(this.storagePath, 'meta');
188
- }
189
-
190
- private getBinaryDataPersistMetaPath() {
191
- return path.join(this.storagePath, 'persistMeta');
192
- }
193
-
194
- private async deleteMetaFileByPath(metafilePath: string): Promise<void> {
195
- return fs.rm(metafilePath);
196
- }
197
-
198
- private async deleteFromLocalStorage(identifier: string) {
199
- return fs.rm(path.join(this.storagePath, identifier));
200
- }
201
-
202
- private async saveToLocalStorage(data: Buffer, identifier: string) {
203
- await fs.writeFile(path.join(this.storagePath, identifier), data);
204
- }
205
-
206
- private async retrieveFromLocalStorage(identifier: string): Promise<Buffer> {
207
- const filePath = path.join(this.storagePath, identifier);
208
- try {
209
- return await fs.readFile(filePath);
210
- } catch (e) {
211
- throw new Error(`Error finding file: ${filePath}`);
212
- }
213
- }
214
- }
@@ -1,123 +0,0 @@
1
- import {
2
- INode,
3
- INodeType,
4
- IExecuteFunctions,
5
- ISupplyDataFunctions,
6
- INodeInputConfiguration,
7
- INodeTypeDescription,
8
- Workflow,
9
- SupplyData,
10
- NodeConnectionType,
11
- NodeOperationError,
12
- IWebhookFunctions,
13
- } from '@fsai-flow/workflow';
14
-
15
- export async function getInputConnectionDataLegacy(
16
- this: ISupplyDataFunctions | IWebhookFunctions,
17
- workflow: Workflow,
18
- connectionType: NodeConnectionType,
19
- itemIndex: number,
20
- nodeTypeData: INodeType
21
- ): Promise<unknown> {
22
- const parentNode = this.getNode();
23
-
24
- const nodeInputs = getNodeInputs(workflow, parentNode, nodeTypeData.description).map(
25
- (input) => (typeof input === 'string' ? { type: input } : input),
26
- ) as INodeInputConfiguration[];
27
- const inputConfiguration = nodeInputs.find((input) => input.type === connectionType);
28
- if (inputConfiguration === undefined) {
29
- throw new NodeOperationError(
30
- parentNode,
31
- `Node does not have input of type`,
32
- {
33
- description: `Node ${parentNode.name} does not have input of type ${connectionType}`,
34
- }
35
- );
36
- }
37
-
38
- const connectedNodes = getConnectedNodes(workflow, parentNode, connectionType);
39
- if (connectedNodes.length === 0) {
40
- if (inputConfiguration.required) {
41
- throw new NodeOperationError(
42
- parentNode,
43
- `A ${inputConfiguration?.displayName ?? connectionType} sub-node must be connected and enabled`,
44
- );
45
- }
46
- return inputConfiguration.maxConnections === 1 ? undefined : [];
47
- }
48
-
49
- if (
50
- inputConfiguration.maxConnections !== undefined &&
51
- connectedNodes.length > inputConfiguration.maxConnections
52
- ) {
53
- throw new NodeOperationError(
54
- parentNode,
55
- `Only ${inputConfiguration.maxConnections} ${connectionType} sub-nodes are/is allowed to be connected`,
56
- );
57
- }
58
-
59
- const nodes: SupplyData[] = [];
60
- for (const connectedNode of connectedNodes) {
61
- const connectedNodeType = workflow.nodeTypes.getByNameAndVersion(
62
- connectedNode.type,
63
- connectedNode.typeVersion,
64
- );
65
-
66
- if (!connectedNodeType) {
67
- continue;
68
- }
69
-
70
- if (connectedNodeType && !connectedNodeType.supplyData) {
71
- throw new NodeOperationError(connectedNode, 'Node does not have a `supplyData` method defined', {
72
- itemIndex,
73
- });
74
- } else {
75
- try {
76
- const supplyData = await connectedNodeType.supplyData?.call(this, itemIndex);
77
- if (supplyData) {
78
- nodes.push(supplyData);
79
- }
80
- } catch (error: any) {
81
- throw new NodeOperationError(connectedNode, `Error in sub-node ${connectedNode.name}`, {
82
- itemIndex,
83
- description: error?.message ?? 'Unknown error',
84
- });
85
- }
86
- }
87
- }
88
-
89
- return inputConfiguration.maxConnections === 1
90
- ? (nodes || [])[0]?.response
91
- : nodes.map((node) => node.response);
92
- }
93
-
94
- function getNodeInputs(
95
- workflow: Workflow,
96
- node: INode,
97
- nodeTypeData: INodeTypeDescription,
98
- ): Array<NodeConnectionType | INodeInputConfiguration> {
99
- if (Array.isArray(nodeTypeData?.inputs)) {
100
- return nodeTypeData.inputs as Array<NodeConnectionType | INodeInputConfiguration>;
101
- }
102
-
103
- // Calculate the outputs dynamically
104
- try {
105
- return (workflow.expression.getSimpleParameterValue(
106
- node,
107
- nodeTypeData.inputs,
108
- 'internal',
109
- {},
110
- ) || []) as NodeConnectionType[];
111
- } catch (e) {
112
- console.warn('Could not calculate inputs dynamically for node: ', node.name);
113
- return [];
114
- }
115
- }
116
-
117
- function getConnectedNodes(workflow: Workflow, node: INode, connectionType: NodeConnectionType) {
118
- return workflow
119
- .getParentNodes(node.name, connectionType, 1)
120
- .map((nodeName) => workflow.getNode(nodeName))
121
- .filter((node) => !!node)
122
- .filter((node) => node.disabled !== true);
123
- }
@@ -1,338 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- import {
3
- IAdditionalCredentialOptions,
4
- IAllExecuteFunctions,
5
- IBinaryData,
6
- ICredentialTestFunctions as ICredentialTestFunctionsBase,
7
- ICredentialType,
8
- IDataObject,
9
- IExecuteFunctions as IExecuteFunctionsBase,
10
- IExecuteSingleFunctions as IExecuteSingleFunctionsBase,
11
- IHookFunctions as IHookFunctionsBase,
12
- IHttpRequestOptions,
13
- ILoadOptionsFunctions as ILoadOptionsFunctionsBase,
14
- INodeExecutionData,
15
- INodeType,
16
- IOAuth2Options,
17
- IPollFunctions as IPollFunctionsBase,
18
- IPollResponse,
19
- ITriggerFunctions as ITriggerFunctionsBase,
20
- ITriggerResponse,
21
- IWebhookFunctions as IWebhookFunctionsBase,
22
- IWorkflowSettings as IWorkflowSettingsWorkflow,
23
- } from '@fsai-flow/workflow';
24
-
25
- import { OptionsWithUri, OptionsWithUrl } from 'request';
26
- import * as requestPromise from 'request-promise-native';
27
-
28
- interface Constructable<T> {
29
- new (): T;
30
- }
31
-
32
- export interface IProcessMessage {
33
- data?: any;
34
- type: string;
35
- }
36
-
37
- export type Class<T = object, A extends unknown[] = unknown[]> = new (...args: A) => T;
38
-
39
- export interface IExecuteFunctions extends IExecuteFunctionsBase {
40
- helpers: {
41
- httpRequest(requestOptions: IHttpRequestOptions): Promise<any>; // tslint:disable-line:no-any
42
- prepareBinaryData(
43
- binaryData: Buffer,
44
- filePath?: string,
45
- mimeType?: string,
46
- ): Promise<IBinaryData>;
47
- assertBinaryData(itemIndex: number, propertyName: string, inputIndex?:number): IBinaryData;
48
- getBinaryDataBuffer(itemIndex: number, propertyName: string, inputIndex?:number): Promise<Buffer>;
49
- request: (uriOrObject: string | IDataObject | any, options?: IDataObject) => Promise<any>; // tslint:disable-line:no-any
50
- requestWithAuthentication(
51
- this: IAllExecuteFunctions,
52
- credentialsType: string,
53
- requestOptions: OptionsWithUri | requestPromise.RequestPromiseOptions,
54
- additionalCredentialOptions?: IAdditionalCredentialOptions,
55
- ): Promise<any>;
56
- requestOAuth2(
57
- this: IAllExecuteFunctions,
58
- credentialsType: string,
59
- requestOptions: OptionsWithUri | requestPromise.RequestPromiseOptions,
60
- oAuth2Options?: IOAuth2Options,
61
- ): Promise<any>; // tslint:disable-line:no-any
62
- requestOAuth1(
63
- this: IAllExecuteFunctions,
64
- credentialsType: string,
65
- requestOptions: OptionsWithUrl | requestPromise.RequestPromiseOptions,
66
- ): Promise<any>; // tslint:disable-line:no-any
67
- returnJsonArray(jsonData: IDataObject | IDataObject[]): INodeExecutionData[];
68
- normalizeItems(items: INodeExecutionData | INodeExecutionData[]): INodeExecutionData[];
69
- httpRequestWithAuthentication(
70
- this: IAllExecuteFunctions,
71
- credentialsType: string,
72
- requestOptions: IHttpRequestOptions,
73
- ): Promise<any>;
74
- };
75
- }
76
-
77
- export interface IExecuteSingleFunctions extends IExecuteSingleFunctionsBase {
78
- helpers: {
79
- httpRequest(requestOptions: IHttpRequestOptions): Promise<any>; // tslint:disable-line:no-any
80
- prepareBinaryData(
81
- binaryData: Buffer,
82
- filePath?: string,
83
- mimeType?: string,
84
- ): Promise<IBinaryData>;
85
- request: (uriOrObject: string | IDataObject | any, options?: IDataObject) => Promise<any>; // tslint:disable-line:no-any
86
- requestWithAuthentication(
87
- this: IAllExecuteFunctions,
88
- credentialsType: string,
89
- requestOptions: OptionsWithUri | requestPromise.RequestPromiseOptions,
90
- additionalCredentialOptions?: IAdditionalCredentialOptions,
91
- ): Promise<any>;
92
- requestOAuth2(
93
- this: IAllExecuteFunctions,
94
- credentialsType: string,
95
- requestOptions: OptionsWithUri | requestPromise.RequestPromiseOptions,
96
- oAuth2Options?: IOAuth2Options,
97
- ): Promise<any>; // tslint:disable-line:no-any
98
- requestOAuth1(
99
- this: IAllExecuteFunctions,
100
- credentialsType: string,
101
- requestOptions: OptionsWithUrl | requestPromise.RequestPromiseOptions,
102
- ): Promise<any>; // tslint:disable-line:no-any
103
- httpRequestWithAuthentication(
104
- this: IAllExecuteFunctions,
105
- credentialsType: string,
106
- requestOptions: IHttpRequestOptions,
107
- ): Promise<any>;
108
- };
109
- }
110
-
111
- export interface IPollFunctions extends IPollFunctionsBase {
112
- helpers: {
113
- httpRequest(requestOptions: IHttpRequestOptions): Promise<any>; // tslint:disable-line:no-any
114
- prepareBinaryData(
115
- binaryData: Buffer,
116
- filePath?: string,
117
- mimeType?: string,
118
- ): Promise<IBinaryData>;
119
- request: (uriOrObject: string | IDataObject | any, options?: IDataObject) => Promise<any>; // tslint:disable-line:no-any
120
- requestWithAuthentication(
121
- this: IAllExecuteFunctions,
122
- credentialsType: string,
123
- requestOptions: OptionsWithUri | requestPromise.RequestPromiseOptions,
124
- additionalCredentialOptions?: IAdditionalCredentialOptions,
125
- ): Promise<any>;
126
- requestOAuth2(
127
- this: IAllExecuteFunctions,
128
- credentialsType: string,
129
- requestOptions: OptionsWithUri | requestPromise.RequestPromiseOptions,
130
- oAuth2Options?: IOAuth2Options,
131
- ): Promise<any>; // tslint:disable-line:no-any
132
- requestOAuth1(
133
- this: IAllExecuteFunctions,
134
- credentialsType: string,
135
- requestOptions: OptionsWithUrl | requestPromise.RequestPromiseOptions,
136
- ): Promise<any>; // tslint:disable-line:no-any
137
- returnJsonArray(jsonData: IDataObject | IDataObject[]): INodeExecutionData[];
138
- httpRequestWithAuthentication(
139
- this: IAllExecuteFunctions,
140
- credentialsType: string,
141
- requestOptions: IHttpRequestOptions,
142
- ): Promise<any>;
143
- };
144
- }
145
-
146
- export interface IResponseError extends Error {
147
- statusCode?: number;
148
- }
149
-
150
- export interface ITriggerFunctions extends ITriggerFunctionsBase {
151
- helpers: {
152
- httpRequest(requestOptions: IHttpRequestOptions): Promise<any>; // tslint:disable-line:no-any
153
- prepareBinaryData(
154
- binaryData: Buffer,
155
- filePath?: string,
156
- mimeType?: string,
157
- ): Promise<IBinaryData>;
158
- request: (uriOrObject: string | IDataObject | any, options?: IDataObject) => Promise<any>; // tslint:disable-line:no-any
159
- requestWithAuthentication(
160
- this: IAllExecuteFunctions,
161
- credentialsType: string,
162
- requestOptions: OptionsWithUri | requestPromise.RequestPromiseOptions,
163
- additionalCredentialOptions?: IAdditionalCredentialOptions,
164
- ): Promise<any>;
165
- requestOAuth2(
166
- this: IAllExecuteFunctions,
167
- credentialsType: string,
168
- requestOptions: OptionsWithUri | requestPromise.RequestPromiseOptions,
169
- oAuth2Options?: IOAuth2Options,
170
- ): Promise<any>; // tslint:disable-line:no-any
171
- requestOAuth1(
172
- this: IAllExecuteFunctions,
173
- credentialsType: string,
174
- requestOptions: OptionsWithUrl | requestPromise.RequestPromiseOptions,
175
- ): Promise<any>; // tslint:disable-line:no-any
176
- returnJsonArray(jsonData: IDataObject | IDataObject[]): INodeExecutionData[];
177
- httpRequestWithAuthentication(
178
- this: IAllExecuteFunctions,
179
- credentialsType: string,
180
- requestOptions: IHttpRequestOptions,
181
- ): Promise<any>;
182
- };
183
- }
184
-
185
- export interface ITriggerTime {
186
- mode: string;
187
- hour: number;
188
- minute: number;
189
- dayOfMonth: number;
190
- weekeday: number;
191
- [key: string]: string | number;
192
- }
193
-
194
- export interface IUserSettings {
195
- encryptionKey?: string;
196
- tunnelSubdomain?: string;
197
- instanceId?: string;
198
- }
199
-
200
- export interface ILoadOptionsFunctions extends ILoadOptionsFunctionsBase {
201
- helpers: {
202
- httpRequest(requestOptions: IHttpRequestOptions): Promise<any>; // tslint:disable-line:no-any
203
- request?: (uriOrObject: string | IDataObject | any, options?: IDataObject) => Promise<any>; // tslint:disable-line:no-any
204
- requestWithAuthentication(
205
- this: IAllExecuteFunctions,
206
- credentialsType: string,
207
- requestOptions: OptionsWithUri | requestPromise.RequestPromiseOptions,
208
- additionalCredentialOptions?: IAdditionalCredentialOptions,
209
- ): Promise<any>;
210
- requestOAuth2?: (
211
- this: IAllExecuteFunctions,
212
- credentialsType: string,
213
- requestOptions: OptionsWithUri | requestPromise.RequestPromiseOptions,
214
- oAuth2Options?: IOAuth2Options,
215
- ) => Promise<any>; // tslint:disable-line:no-any
216
- requestOAuth1?(
217
- this: IAllExecuteFunctions,
218
- credentialsType: string,
219
- requestOptions: OptionsWithUrl | requestPromise.RequestPromiseOptions,
220
- ): Promise<any>; // tslint:disable-line:no-any
221
- httpRequestWithAuthentication(
222
- this: IAllExecuteFunctions,
223
- credentialsType: string,
224
- requestOptions: IHttpRequestOptions,
225
- ): Promise<any>;
226
- };
227
- }
228
-
229
- export interface ICredentialTestFunctions extends ICredentialTestFunctionsBase {
230
- helpers: {
231
- request?: (uriOrObject: string | IDataObject | any, options?: IDataObject) => Promise<any>; // tslint:disable-line:no-any
232
- };
233
- }
234
-
235
- export interface IHookFunctions extends IHookFunctionsBase {
236
- helpers: {
237
- httpRequest(requestOptions: IHttpRequestOptions): Promise<any>; // tslint:disable-line:no-any
238
- request: (uriOrObject: string | IDataObject | any, options?: IDataObject) => Promise<any>; // tslint:disable-line:no-any
239
- requestWithAuthentication(
240
- this: IAllExecuteFunctions,
241
- credentialsType: string,
242
- requestOptions: OptionsWithUri | requestPromise.RequestPromiseOptions,
243
- additionalCredentialOptions?: IAdditionalCredentialOptions,
244
- ): Promise<any>;
245
- requestOAuth2(
246
- this: IAllExecuteFunctions,
247
- credentialsType: string,
248
- requestOptions: OptionsWithUri | requestPromise.RequestPromiseOptions,
249
- oAuth2Options?: IOAuth2Options,
250
- ): Promise<any>; // tslint:disable-line:no-any
251
- requestOAuth1(
252
- this: IAllExecuteFunctions,
253
- credentialsType: string,
254
- requestOptions: OptionsWithUrl | requestPromise.RequestPromiseOptions,
255
- ): Promise<any>; // tslint:disable-line:no-any
256
- httpRequestWithAuthentication(
257
- this: IAllExecuteFunctions,
258
- credentialsType: string,
259
- requestOptions: IHttpRequestOptions,
260
- ): Promise<any>;
261
- };
262
- }
263
-
264
- export interface IWebhookFunctions extends IWebhookFunctionsBase {
265
- helpers: {
266
- httpRequest(requestOptions: IHttpRequestOptions): Promise<any>; // tslint:disable-line:no-any
267
- prepareBinaryData(
268
- binaryData: Buffer,
269
- filePath?: string,
270
- mimeType?: string,
271
- ): Promise<IBinaryData>;
272
- request: (uriOrObject: string | IDataObject | any, options?: IDataObject) => Promise<any>; // tslint:disable-line:no-any
273
- requestWithAuthentication(
274
- this: IAllExecuteFunctions,
275
- credentialsType: string,
276
- requestOptions: OptionsWithUri | requestPromise.RequestPromiseOptions,
277
- additionalCredentialOptions?: IAdditionalCredentialOptions,
278
- ): Promise<any>;
279
- requestOAuth2(
280
- this: IAllExecuteFunctions,
281
- credentialsType: string,
282
- requestOptions: OptionsWithUri | requestPromise.RequestPromiseOptions,
283
- oAuth2Options?: IOAuth2Options,
284
- ): Promise<any>; // tslint:disable-line:no-any
285
- requestOAuth1(
286
- this: IAllExecuteFunctions,
287
- credentialsType: string,
288
- requestOptions: OptionsWithUrl | requestPromise.RequestPromiseOptions,
289
- ): Promise<any>; // tslint:disable-line:no-any
290
- returnJsonArray(jsonData: IDataObject | IDataObject[]): INodeExecutionData[];
291
- httpRequestWithAuthentication(
292
- this: IAllExecuteFunctions,
293
- credentialsType: string,
294
- requestOptions: IHttpRequestOptions,
295
- ): Promise<any>;
296
- };
297
- }
298
-
299
- export interface IWorkflowSettings extends IWorkflowSettingsWorkflow {
300
- errorWorkflow?: string;
301
- timezone?: string;
302
- saveManualRuns?: boolean;
303
- }
304
-
305
- // New node definition in file
306
- export interface INodeDefinitionFile {
307
- [key: string]: Constructable<INodeType | ICredentialType>;
308
- }
309
-
310
- // Is identical to TaskDataConnections but does not allow null value to be used as input for nodes
311
- export interface INodeInputDataConnections {
312
- [key: string]: INodeExecutionData[][];
313
- }
314
-
315
- export interface IWorkflowData {
316
- pollResponses?: IPollResponse[];
317
- triggerResponses?: ITriggerResponse[];
318
- }
319
-
320
- export interface IBinaryDataConfig {
321
- mode: 'default' | 'filesystem';
322
- availableModes: string;
323
- localStoragePath: string;
324
- binaryDataTTL: number;
325
- persistedBinaryDataTTL: number;
326
- }
327
-
328
- export interface IBinaryDataManager {
329
- init(startPurger: boolean): Promise<void>;
330
- storeBinaryData(binaryBuffer: Buffer, executionId: string): Promise<string>;
331
- retrieveBinaryDataByIdentifier(identifier: string): Promise<Buffer>;
332
- markDataForDeletionByExecutionId(executionId: string): Promise<void>;
333
- deleteMarkedFiles(): Promise<unknown>;
334
- deleteBinaryDataByIdentifier(identifier: string): Promise<void>;
335
- duplicateBinaryDataByIdentifier(binaryDataId: string, prefix: string): Promise<string>;
336
- deleteBinaryDataByExecutionId(executionId: string): Promise<void>;
337
- persistBinaryDataForExecutionId(executionId: string): Promise<void>;
338
- }