@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.
- package/dist/index.d.ts +17 -0
- package/dist/index.js +61 -0
- package/dist/{src/lib → lib}/ActiveWebhooks.d.ts +1 -1
- package/dist/lib/ActiveWebhooks.js +177 -0
- package/dist/{src/lib → lib}/ActiveWorkflows.d.ts +3 -3
- package/dist/lib/ActiveWorkflows.js +465 -0
- package/dist/{src/lib → lib}/BinaryDataManager/FileSystem.d.ts +1 -1
- package/dist/lib/BinaryDataManager/FileSystem.js +180 -0
- package/dist/{src/lib → lib}/BinaryDataManager/index.d.ts +2 -2
- package/dist/lib/BinaryDataManager/index.js +129 -0
- package/dist/{src/lib → lib}/ChangeCase.js +11 -11
- package/dist/lib/Constants.js +18 -0
- package/dist/{src/lib → lib}/Credentials.d.ts +1 -1
- package/dist/{src/lib → lib}/Credentials.js +7 -8
- package/dist/{src/lib → lib}/FileSystem.d.ts +1 -1
- package/dist/lib/FileSystem.js +180 -0
- package/dist/{src/lib → lib}/InputConnectionDataLegacy.d.ts +1 -1
- package/dist/lib/InputConnectionDataLegacy.js +72 -0
- package/dist/{src/lib → lib}/Interfaces.d.ts +47 -48
- package/dist/{src/lib → lib}/Interfaces.js +0 -1
- package/dist/{src/lib → lib}/LoadNodeParameterOptions.d.ts +1 -1
- package/dist/lib/LoadNodeParameterOptions.js +152 -0
- package/dist/{src/lib → lib}/NodeExecuteFunctions.d.ts +9 -10
- package/dist/lib/NodeExecuteFunctions.js +2467 -0
- package/dist/{src/lib → lib}/NodesLoader/constants.d.ts +1 -1
- package/dist/lib/NodesLoader/constants.js +105 -0
- package/dist/{src/lib → lib}/NodesLoader/custom-directory-loader.d.ts +1 -1
- package/dist/lib/NodesLoader/custom-directory-loader.js +35 -0
- package/dist/{src/lib → lib}/NodesLoader/directory-loader.d.ts +1 -1
- package/dist/{src/lib → lib}/NodesLoader/directory-loader.js +80 -38
- package/dist/lib/NodesLoader/index.d.ts +5 -0
- package/dist/{src/lib → lib}/NodesLoader/index.js +5 -6
- package/dist/{src/lib → lib}/NodesLoader/lazy-package-directory-loader.d.ts +1 -1
- package/dist/lib/NodesLoader/lazy-package-directory-loader.js +44 -0
- package/dist/{src/lib → lib}/NodesLoader/load-class-in-isolation.js +6 -11
- package/dist/{src/lib → lib}/NodesLoader/package-directory-loader.d.ts +2 -2
- package/dist/{src/lib → lib}/NodesLoader/package-directory-loader.js +28 -36
- package/dist/{src/lib → lib}/NodesLoader/types.js +0 -1
- package/dist/{src/lib → lib}/RedisLeaderElectionManager.d.ts +1 -1
- package/dist/lib/RedisLeaderElectionManager.js +279 -0
- package/dist/lib/RequestTypes.d.ts +58 -0
- package/dist/lib/RequestTypes.js +8 -0
- package/dist/{src/lib → lib}/UserSettings.d.ts +1 -1
- package/dist/lib/UserSettings.js +269 -0
- package/dist/{src/lib → lib}/WorkflowExecute.d.ts +4 -4
- package/dist/{src/lib → lib}/WorkflowExecute.js +230 -178
- package/dist/{src/lib → lib}/index.d.ts +2 -2
- package/dist/lib/index.js +129 -0
- package/dist/{src/utils → utils}/crypto.js +2 -3
- package/package.json +59 -52
- package/dist/README.md +0 -31
- package/dist/package.json +0 -54
- package/dist/src/index.d.ts +0 -16
- package/dist/src/index.js +0 -30
- package/dist/src/index.js.map +0 -1
- package/dist/src/lib/ActiveWebhooks.js +0 -184
- package/dist/src/lib/ActiveWebhooks.js.map +0 -1
- package/dist/src/lib/ActiveWorkflows.js +0 -456
- package/dist/src/lib/ActiveWorkflows.js.map +0 -1
- package/dist/src/lib/BinaryDataManager/FileSystem.js +0 -179
- package/dist/src/lib/BinaryDataManager/FileSystem.js.map +0 -1
- package/dist/src/lib/BinaryDataManager/index.js +0 -146
- package/dist/src/lib/BinaryDataManager/index.js.map +0 -1
- package/dist/src/lib/ChangeCase.js.map +0 -1
- package/dist/src/lib/Constants.js +0 -19
- package/dist/src/lib/Constants.js.map +0 -1
- package/dist/src/lib/Credentials.js.map +0 -1
- package/dist/src/lib/FileSystem.js +0 -179
- package/dist/src/lib/FileSystem.js.map +0 -1
- package/dist/src/lib/InputConnectionDataLegacy.js +0 -79
- package/dist/src/lib/InputConnectionDataLegacy.js.map +0 -1
- package/dist/src/lib/Interfaces.js.map +0 -1
- package/dist/src/lib/LoadNodeParameterOptions.js +0 -150
- package/dist/src/lib/LoadNodeParameterOptions.js.map +0 -1
- package/dist/src/lib/NodeExecuteFunctions.js +0 -2479
- package/dist/src/lib/NodeExecuteFunctions.js.map +0 -1
- package/dist/src/lib/NodesLoader/constants.js +0 -106
- package/dist/src/lib/NodesLoader/constants.js.map +0 -1
- package/dist/src/lib/NodesLoader/custom-directory-loader.js +0 -36
- package/dist/src/lib/NodesLoader/custom-directory-loader.js.map +0 -1
- package/dist/src/lib/NodesLoader/directory-loader.js.map +0 -1
- package/dist/src/lib/NodesLoader/index.d.ts +0 -5
- package/dist/src/lib/NodesLoader/index.js.map +0 -1
- package/dist/src/lib/NodesLoader/lazy-package-directory-loader.js +0 -52
- package/dist/src/lib/NodesLoader/lazy-package-directory-loader.js.map +0 -1
- package/dist/src/lib/NodesLoader/load-class-in-isolation.js.map +0 -1
- package/dist/src/lib/NodesLoader/package-directory-loader.js.map +0 -1
- package/dist/src/lib/NodesLoader/types.js.map +0 -1
- package/dist/src/lib/RedisLeaderElectionManager.js +0 -294
- package/dist/src/lib/RedisLeaderElectionManager.js.map +0 -1
- package/dist/src/lib/UserSettings.js +0 -261
- package/dist/src/lib/UserSettings.js.map +0 -1
- package/dist/src/lib/WorkflowExecute.js.map +0 -1
- package/dist/src/lib/index.js +0 -146
- package/dist/src/lib/index.js.map +0 -1
- package/dist/src/utils/crypto.js.map +0 -1
- package/eslint.config.js +0 -19
- package/jest.config.ts +0 -10
- package/project.json +0 -19
- package/src/index.ts +0 -28
- package/src/lib/ActiveWebhooks.ts +0 -245
- package/src/lib/ActiveWorkflows.ts +0 -575
- package/src/lib/BinaryDataManager/FileSystem.ts +0 -214
- package/src/lib/BinaryDataManager/index.ts +0 -187
- package/src/lib/ChangeCase.ts +0 -45
- package/src/lib/Constants.ts +0 -16
- package/src/lib/Credentials.ts +0 -108
- package/src/lib/FileSystem.ts +0 -214
- package/src/lib/InputConnectionDataLegacy.ts +0 -123
- package/src/lib/Interfaces.ts +0 -338
- package/src/lib/LoadNodeParameterOptions.ts +0 -235
- package/src/lib/NodeExecuteFunctions.ts +0 -3700
- package/src/lib/NodesLoader/constants.ts +0 -112
- package/src/lib/NodesLoader/custom-directory-loader.ts +0 -31
- package/src/lib/NodesLoader/directory-loader.ts +0 -458
- package/src/lib/NodesLoader/index.ts +0 -5
- package/src/lib/NodesLoader/lazy-package-directory-loader.ts +0 -55
- package/src/lib/NodesLoader/load-class-in-isolation.ts +0 -19
- package/src/lib/NodesLoader/package-directory-loader.ts +0 -107
- package/src/lib/NodesLoader/types.ts +0 -14
- package/src/lib/RedisLeaderElectionManager.ts +0 -334
- package/src/lib/UserSettings.ts +0 -292
- package/src/lib/WorkflowExecute.ts +0 -1128
- package/src/lib/index.ts +0 -187
- package/src/utils/crypto.ts +0 -5
- package/tests/Credentials.test.ts +0 -88
- package/tests/Helpers.ts +0 -808
- package/tests/WorkflowExecute.test.ts +0 -1242
- package/tsconfig.json +0 -41
- package/tsconfig.lib.json +0 -10
- package/tsconfig.spec.json +0 -14
- /package/dist/{src/lib → lib}/ChangeCase.d.ts +0 -0
- /package/dist/{src/lib → lib}/Constants.d.ts +0 -0
- /package/dist/{src/lib → lib}/NodesLoader/load-class-in-isolation.d.ts +0 -0
- /package/dist/{src/lib → lib}/NodesLoader/types.d.ts +0 -0
- /package/dist/{src/utils → utils}/crypto.d.ts +0 -0
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-restricted-syntax */
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
3
|
-
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
4
|
-
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
|
5
|
-
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
6
|
-
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
7
|
-
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
ILoadOptions,
|
|
11
|
-
INode,
|
|
12
|
-
INodeCredentials,
|
|
13
|
-
INodeExecutionData,
|
|
14
|
-
INodeParameters,
|
|
15
|
-
INodeProperties,
|
|
16
|
-
INodePropertyOptions,
|
|
17
|
-
INodeType,
|
|
18
|
-
INodeTypeNameVersion,
|
|
19
|
-
INodeTypes,
|
|
20
|
-
IRunExecutionData,
|
|
21
|
-
ITaskDataConnections,
|
|
22
|
-
IWorkflowExecuteAdditionalData,
|
|
23
|
-
RoutingNode,
|
|
24
|
-
Workflow,
|
|
25
|
-
} from '@fsai-flow/workflow';
|
|
26
|
-
|
|
27
|
-
// eslint-disable-next-line import/no-cycle
|
|
28
|
-
import { NodeExecuteFunctions } from '..';
|
|
29
|
-
|
|
30
|
-
const TEMP_NODE_NAME = 'Temp-Node';
|
|
31
|
-
const TEMP_WORKFLOW_NAME = 'Temp-Workflow';
|
|
32
|
-
|
|
33
|
-
export class LoadNodeParameterOptions {
|
|
34
|
-
currentNodeParameters: INodeParameters;
|
|
35
|
-
|
|
36
|
-
path: string;
|
|
37
|
-
|
|
38
|
-
workflow: Workflow;
|
|
39
|
-
|
|
40
|
-
constructor(
|
|
41
|
-
nodeTypeNameAndVersion: INodeTypeNameVersion,
|
|
42
|
-
nodeTypes: INodeTypes,
|
|
43
|
-
path: string,
|
|
44
|
-
currentNodeParameters: INodeParameters,
|
|
45
|
-
credentials?: INodeCredentials,
|
|
46
|
-
) {
|
|
47
|
-
const nodeType = nodeTypes.getByNameAndVersion(
|
|
48
|
-
nodeTypeNameAndVersion.name,
|
|
49
|
-
nodeTypeNameAndVersion.version,
|
|
50
|
-
);
|
|
51
|
-
this.currentNodeParameters = currentNodeParameters;
|
|
52
|
-
this.path = path;
|
|
53
|
-
if (nodeType === undefined) {
|
|
54
|
-
throw new Error(
|
|
55
|
-
`The node-type "${nodeTypeNameAndVersion.name} v${nodeTypeNameAndVersion.version}" is not known!`,
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const nodeData: INode = {
|
|
60
|
-
parameters: currentNodeParameters,
|
|
61
|
-
name: TEMP_NODE_NAME,
|
|
62
|
-
type: nodeTypeNameAndVersion.name,
|
|
63
|
-
typeVersion: nodeTypeNameAndVersion.version,
|
|
64
|
-
position: [0, 0],
|
|
65
|
-
id: '',
|
|
66
|
-
};
|
|
67
|
-
if (credentials) {
|
|
68
|
-
nodeData.credentials = credentials;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
const workflowData = {
|
|
72
|
-
nodes: [nodeData],
|
|
73
|
-
connections: {},
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
this.workflow = new Workflow({
|
|
77
|
-
nodes: workflowData.nodes,
|
|
78
|
-
connections: workflowData.connections,
|
|
79
|
-
active: false,
|
|
80
|
-
nodeTypes,
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Returns data of a fake workflow
|
|
86
|
-
*
|
|
87
|
-
* @returns
|
|
88
|
-
* @memberof LoadNodeParameterOptions
|
|
89
|
-
*/
|
|
90
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
91
|
-
getWorkflowData() {
|
|
92
|
-
return {
|
|
93
|
-
name: TEMP_WORKFLOW_NAME,
|
|
94
|
-
active: false,
|
|
95
|
-
connections: {},
|
|
96
|
-
nodes: Object.values(this.workflow.nodes),
|
|
97
|
-
createdAt: new Date(),
|
|
98
|
-
updatedAt: new Date(),
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Returns the available options via a predefined method
|
|
104
|
-
*
|
|
105
|
-
* @param {string} methodName The name of the method of which to get the data from
|
|
106
|
-
* @param {IWorkflowExecuteAdditionalData} additionalData
|
|
107
|
-
* @returns {Promise<INodePropertyOptions[]>}
|
|
108
|
-
* @memberof LoadNodeParameterOptions
|
|
109
|
-
*/
|
|
110
|
-
async getOptionsViaMethodName(
|
|
111
|
-
methodName: string,
|
|
112
|
-
additionalData: IWorkflowExecuteAdditionalData,
|
|
113
|
-
): Promise<INodePropertyOptions[]> {
|
|
114
|
-
const node = this.workflow.getNode(TEMP_NODE_NAME);
|
|
115
|
-
|
|
116
|
-
const nodeType = this.workflow.nodeTypes.getByNameAndVersion(node!.type, node?.typeVersion);
|
|
117
|
-
|
|
118
|
-
if (
|
|
119
|
-
!nodeType ||
|
|
120
|
-
nodeType.methods === undefined ||
|
|
121
|
-
nodeType.methods.loadOptions === undefined ||
|
|
122
|
-
nodeType.methods.loadOptions[methodName] === undefined
|
|
123
|
-
) {
|
|
124
|
-
throw new Error(
|
|
125
|
-
`The node-type "${node!.type}" does not have the method "${methodName}" defined!`,
|
|
126
|
-
);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
const thisArgs = NodeExecuteFunctions.getLoadOptionsFunctions(
|
|
130
|
-
this.workflow,
|
|
131
|
-
node!,
|
|
132
|
-
this.path,
|
|
133
|
-
additionalData,
|
|
134
|
-
);
|
|
135
|
-
|
|
136
|
-
try {
|
|
137
|
-
return await nodeType.methods.loadOptions[methodName].call(thisArgs);
|
|
138
|
-
} catch (error) {
|
|
139
|
-
return [{
|
|
140
|
-
name: 'Error trying to load options',
|
|
141
|
-
value: '',
|
|
142
|
-
description: (error as Error).message || 'Error trying to load options.'
|
|
143
|
-
}];
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Returns the available options via a load request informatoin
|
|
149
|
-
*
|
|
150
|
-
* @param {ILoadOptions} loadOptions The load options which also contain the request information
|
|
151
|
-
* @param {IWorkflowExecuteAdditionalData} additionalData
|
|
152
|
-
* @returns {Promise<INodePropertyOptions[]>}
|
|
153
|
-
* @memberof LoadNodeParameterOptions
|
|
154
|
-
*/
|
|
155
|
-
async getOptionsViaRequestProperty(
|
|
156
|
-
loadOptions: ILoadOptions,
|
|
157
|
-
additionalData: IWorkflowExecuteAdditionalData,
|
|
158
|
-
): Promise<INodePropertyOptions[]> {
|
|
159
|
-
const node = this.workflow.getNode(TEMP_NODE_NAME);
|
|
160
|
-
|
|
161
|
-
const nodeType = this.workflow.nodeTypes.getByNameAndVersion(node!.type, node?.typeVersion);
|
|
162
|
-
|
|
163
|
-
if (
|
|
164
|
-
nodeType === undefined ||
|
|
165
|
-
!nodeType.description.requestDefaults ||
|
|
166
|
-
!nodeType.description.requestDefaults.baseURL
|
|
167
|
-
) {
|
|
168
|
-
// This in in here for now for security reasons.
|
|
169
|
-
// Background: As the full data for the request to make does get send, and the auth data
|
|
170
|
-
// will then be applied, would it be possible to retrieve that data like that. By at least
|
|
171
|
-
// requiring a baseURL to be defined can at least not a random server be called.
|
|
172
|
-
// In the future this code has to get improved that it does not use the request information from
|
|
173
|
-
// the request rather resolves it via the parameter-path and nodeType data.
|
|
174
|
-
throw new Error(
|
|
175
|
-
`The node-type "${
|
|
176
|
-
node!.type
|
|
177
|
-
}" does not exist or does not have "requestDefaults.baseURL" defined!`,
|
|
178
|
-
);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
const mode = 'internal';
|
|
182
|
-
const runIndex = 0;
|
|
183
|
-
const connectionInputData: INodeExecutionData[] = [];
|
|
184
|
-
const runExecutionData: IRunExecutionData = { resultData: { runData: {} } };
|
|
185
|
-
|
|
186
|
-
const routingNode = new RoutingNode(
|
|
187
|
-
this.workflow,
|
|
188
|
-
node!,
|
|
189
|
-
connectionInputData,
|
|
190
|
-
runExecutionData ?? null,
|
|
191
|
-
additionalData,
|
|
192
|
-
mode,
|
|
193
|
-
);
|
|
194
|
-
|
|
195
|
-
// Create copy of node-type with the single property we want to get the data off
|
|
196
|
-
const tempNode: INodeType = {
|
|
197
|
-
...nodeType,
|
|
198
|
-
...{
|
|
199
|
-
description: {
|
|
200
|
-
...nodeType.description,
|
|
201
|
-
properties: [
|
|
202
|
-
{
|
|
203
|
-
displayName: '',
|
|
204
|
-
type: 'string',
|
|
205
|
-
name: '',
|
|
206
|
-
default: '',
|
|
207
|
-
routing: loadOptions.routing,
|
|
208
|
-
} as INodeProperties,
|
|
209
|
-
],
|
|
210
|
-
},
|
|
211
|
-
},
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
const inputData: ITaskDataConnections = {
|
|
215
|
-
main: [[{ json: {} }]],
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
const optionsData = await routingNode.runNode(
|
|
219
|
-
inputData,
|
|
220
|
-
runIndex,
|
|
221
|
-
tempNode,
|
|
222
|
-
NodeExecuteFunctions,
|
|
223
|
-
);
|
|
224
|
-
|
|
225
|
-
if (optionsData?.length === 0) {
|
|
226
|
-
return [];
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
if (!Array.isArray(optionsData)) {
|
|
230
|
-
throw new Error('The returned data is not an array!');
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
return optionsData[0].map((item) => item.json) as unknown as INodePropertyOptions[];
|
|
234
|
-
}
|
|
235
|
-
}
|