@fsai-flow/workflow 0.0.2 → 0.0.3

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 (79) hide show
  1. package/dist/README.md +31 -0
  2. package/dist/package.json +42 -0
  3. package/dist/src/index.d.ts +21 -0
  4. package/dist/src/index.js +33 -0
  5. package/dist/src/index.js.map +1 -0
  6. package/dist/src/lib/Constants.d.ts +68 -0
  7. package/dist/src/lib/Constants.js +106 -0
  8. package/dist/src/lib/Constants.js.map +1 -0
  9. package/dist/src/lib/DeferredPromise.d.ts +6 -0
  10. package/dist/src/lib/DeferredPromise.js +11 -0
  11. package/dist/src/lib/DeferredPromise.js.map +1 -0
  12. package/dist/src/lib/Expression.d.ts +65 -0
  13. package/dist/src/lib/Expression.js +215 -0
  14. package/dist/src/lib/Expression.js.map +1 -0
  15. package/dist/src/lib/Interfaces.d.ts +1579 -0
  16. package/dist/src/lib/Interfaces.js +44 -0
  17. package/dist/src/lib/Interfaces.js.map +1 -0
  18. package/dist/src/lib/LoggerProxy.d.ts +9 -0
  19. package/dist/src/lib/LoggerProxy.js +40 -0
  20. package/dist/src/lib/LoggerProxy.js.map +1 -0
  21. package/dist/src/lib/MetadataUtils.d.ts +4 -0
  22. package/dist/src/lib/MetadataUtils.js +27 -0
  23. package/dist/src/lib/MetadataUtils.js.map +1 -0
  24. package/dist/src/lib/NodeErrors.d.ts +82 -0
  25. package/dist/src/lib/NodeErrors.js +289 -0
  26. package/dist/src/lib/NodeErrors.js.map +1 -0
  27. package/dist/src/lib/NodeHelpers.d.ts +198 -0
  28. package/dist/src/lib/NodeHelpers.js +1348 -0
  29. package/dist/src/lib/NodeHelpers.js.map +1 -0
  30. package/dist/src/lib/ObservableObject.d.ts +5 -0
  31. package/dist/src/lib/ObservableObject.js +61 -0
  32. package/dist/src/lib/ObservableObject.js.map +1 -0
  33. package/dist/src/lib/RoutingNode.d.ts +18 -0
  34. package/dist/src/lib/RoutingNode.js +508 -0
  35. package/dist/src/lib/RoutingNode.js.map +1 -0
  36. package/dist/src/lib/TelemetryHelpers.d.ts +3 -0
  37. package/dist/src/lib/TelemetryHelpers.js +69 -0
  38. package/dist/src/lib/TelemetryHelpers.js.map +1 -0
  39. package/dist/src/lib/TypeValidation.d.ts +21 -0
  40. package/dist/src/lib/TypeValidation.js +385 -0
  41. package/dist/src/lib/TypeValidation.js.map +1 -0
  42. package/dist/src/lib/VersionedNodeType.d.ts +9 -0
  43. package/dist/src/lib/VersionedNodeType.js +26 -0
  44. package/dist/src/lib/VersionedNodeType.js.map +1 -0
  45. package/dist/src/lib/Workflow.d.ts +248 -0
  46. package/dist/src/lib/Workflow.js +904 -0
  47. package/dist/src/lib/Workflow.js.map +1 -0
  48. package/dist/src/lib/WorkflowDataProxy.d.ts +87 -0
  49. package/dist/src/lib/WorkflowDataProxy.js +556 -0
  50. package/dist/src/lib/WorkflowDataProxy.js.map +1 -0
  51. package/dist/src/lib/WorkflowErrors.d.ts +9 -0
  52. package/dist/src/lib/WorkflowErrors.js +18 -0
  53. package/dist/src/lib/WorkflowErrors.js.map +1 -0
  54. package/dist/src/lib/WorkflowHooks.d.ts +11 -0
  55. package/dist/src/lib/WorkflowHooks.js +34 -0
  56. package/dist/src/lib/WorkflowHooks.js.map +1 -0
  57. package/dist/src/lib/errors/base/base.error.d.ts +30 -0
  58. package/dist/src/lib/errors/base/base.error.js +45 -0
  59. package/dist/src/lib/errors/base/base.error.js.map +1 -0
  60. package/dist/src/lib/errors/base/operational.error.d.ts +15 -0
  61. package/dist/src/lib/errors/base/operational.error.js +19 -0
  62. package/dist/src/lib/errors/base/operational.error.js.map +1 -0
  63. package/dist/src/lib/errors/error.types.d.ts +11 -0
  64. package/dist/src/lib/errors/error.types.js +3 -0
  65. package/dist/src/lib/errors/error.types.js.map +1 -0
  66. package/dist/src/lib/errors/index.d.ts +1 -0
  67. package/dist/src/lib/errors/index.js +6 -0
  68. package/dist/src/lib/errors/index.js.map +1 -0
  69. package/dist/src/lib/result.d.ts +19 -0
  70. package/dist/src/lib/result.js +36 -0
  71. package/dist/src/lib/result.js.map +1 -0
  72. package/dist/src/lib/utils.d.ts +50 -0
  73. package/dist/src/lib/utils.js +119 -0
  74. package/dist/src/lib/utils.js.map +1 -0
  75. package/package.json +5 -1
  76. package/src/lib/Interfaces.ts +28 -33
  77. package/src/lib/Workflow.ts +1 -1
  78. package/src/lib/WorkflowDataProxy.ts +1 -1
  79. package/src/lib/utils.ts +99 -120
@@ -0,0 +1,248 @@
1
+ import { Expression, IConnections, IGetExecuteTriggerFunctions, INode, INodeExecuteFunctions, INodeExecutionData, INodeParameters, INodes, INodeType, INodeTypes, IPollFunctions, IRunExecutionData, ITaskDataConnections, ITriggerResponse, IWebhookData, IWebhookResponseData, IWorfklowIssues, IWorkflowExecuteAdditionalData, IWorkflowSettings, NodeParameterValue, WebhookSetupMethodNames, WorkflowActivateMode, WorkflowExecuteMode } from '..';
2
+ import { IDataObject } from './Interfaces';
3
+ export declare class Workflow {
4
+ id: string | undefined;
5
+ name: string | undefined;
6
+ nodes: INodes;
7
+ connectionsBySourceNode: IConnections;
8
+ connectionsByDestinationNode: IConnections;
9
+ nodeTypes: INodeTypes;
10
+ expression: Expression;
11
+ active: boolean;
12
+ settings: IWorkflowSettings;
13
+ staticData: IDataObject;
14
+ constructor(parameters: {
15
+ id?: string;
16
+ name?: string;
17
+ nodes: INode[];
18
+ connections: IConnections;
19
+ active: boolean;
20
+ nodeTypes: INodeTypes;
21
+ staticData?: IDataObject;
22
+ settings?: IWorkflowSettings;
23
+ });
24
+ /**
25
+ * The default connections are by source node. This function rewrites them by destination nodes
26
+ * to easily find parent nodes.
27
+ *
28
+ * @param {IConnections} connections
29
+ * @returns {IConnections}
30
+ * @memberof Workflow
31
+ */
32
+ __getConnectionsByDestination(connections: IConnections): IConnections;
33
+ /**
34
+ * A workflow can only be activated if it has a node which has either triggers
35
+ * or webhooks defined.
36
+ *
37
+ * @param {string[]} [ignoreNodeTypes] Node-types to ignore in the check
38
+ * @returns {boolean}
39
+ * @memberof Workflow
40
+ */
41
+ checkIfWorkflowCanBeActivated(ignoreNodeTypes?: string[]): boolean;
42
+ /**
43
+ * Checks if everything in the workflow is complete
44
+ * and ready to be executed. If it returns null everything
45
+ * is fine. If there are issues it returns the issues
46
+ * which have been found for the different nodes.
47
+ * TODO: Does currently not check for credential issues!
48
+ *
49
+ * @returns {(IWorfklowIssues | null)}
50
+ * @memberof Workflow
51
+ */
52
+ checkReadyForExecution(inputData: {
53
+ startNode?: string;
54
+ destinationNode?: string;
55
+ }): IWorfklowIssues | null;
56
+ /**
57
+ * Returns the static data of the workflow.
58
+ * It gets saved with the workflow and will be the same for
59
+ * all workflow-executions.
60
+ *
61
+ * @param {string} type The type of data to return ("global"|"node")
62
+ * @param {INode} [node] If type is set to "node" then the node has to be provided
63
+ * @returns {IDataObject}
64
+ * @memberof Workflow
65
+ */
66
+ getStaticData(type: string, node?: INode): IDataObject;
67
+ /**
68
+ * Returns all the trigger nodes in the workflow.
69
+ *
70
+ * @returns {INode[]}
71
+ * @memberof Workflow
72
+ */
73
+ getTriggerNodes(): INode[];
74
+ /**
75
+ * Returns all the poll nodes in the workflow
76
+ *
77
+ * @returns {INode[]}
78
+ * @memberof Workflow
79
+ */
80
+ getPollNodes(): INode[];
81
+ /**
82
+ * Returns all the nodes in the workflow for which the given
83
+ * checkFunction return true
84
+ *
85
+ * @param {(nodeType: INodeType) => boolean} checkFunction
86
+ * @returns {INode[]}
87
+ * @memberof Workflow
88
+ */
89
+ queryNodes(checkFunction: (nodeType: INodeType) => boolean): INode[];
90
+ /**
91
+ * Returns the node with the given name if it exists else null
92
+ *
93
+ * @param {string} nodeName Name of the node to return
94
+ * @returns {(INode | null)}
95
+ * @memberof Workflow
96
+ */
97
+ getNode(nodeName: string): INode | null;
98
+ /**
99
+ * Renames nodes in expressions
100
+ *
101
+ * @param {(NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[])} parameterValue The parameters to check for expressions
102
+ * @param {string} currentName The current name of the node
103
+ * @param {string} newName The new name
104
+ * @returns {(NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[])}
105
+ * @memberof Workflow
106
+ */
107
+ renameNodeInExpressions(parameterValue: NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[], currentName: string, newName: string): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[];
108
+ /**
109
+ * Rename a node in the workflow
110
+ *
111
+ * @param {string} currentName The current name of the node
112
+ * @param {string} newName The new name
113
+ * @memberof Workflow
114
+ */
115
+ renameNode(currentName: string, newName: string): void;
116
+ /**
117
+ * Finds the highest parent nodes of the node with the given name
118
+ *
119
+ * @param {string} nodeName
120
+ * @param {string} [type='main']
121
+ * @param {number} [nodeConnectionIndex]
122
+ * @returns {string[]}
123
+ * @memberof Workflow
124
+ */
125
+ getHighestNode(nodeName: string, type?: string, nodeConnectionIndex?: number, checkedNodes?: string[]): string[];
126
+ /**
127
+ * Returns all the after the given one
128
+ *
129
+ * @param {string} nodeName
130
+ * @param {string} [type='main']
131
+ * @param {*} [depth=-1]
132
+ * @returns {string[]}
133
+ * @memberof Workflow
134
+ */
135
+ getChildNodes(nodeName: string, type?: string, depth?: number): string[];
136
+ /**
137
+ * Returns all the nodes before the given one
138
+ *
139
+ * @param {string} nodeName
140
+ * @param {string} [type='main']
141
+ * @param {*} [depth=-1]
142
+ * @returns {string[]}
143
+ * @memberof Workflow
144
+ */
145
+ getParentNodes(nodeName: string, type?: string, depth?: number): string[];
146
+ /**
147
+ * Gets all the nodes which are connected nodes starting from
148
+ * the given one
149
+ *
150
+ * @param {IConnections} connections
151
+ * @param {string} nodeName
152
+ * @param {string} [type='main']
153
+ * @param {*} [depth=-1]
154
+ * @param {string[]} [checkedNodes]
155
+ * @returns {string[]}
156
+ * @memberof Workflow
157
+ */
158
+ getConnectedNodes(connections: IConnections, nodeName: string, type?: string, depth?: number, checkedNodes?: string[]): string[];
159
+ /**
160
+ * Returns via which output of the parent-node the node
161
+ * is connected to.
162
+ *
163
+ * @param {string} nodeName The node to check how it is connected with parent node
164
+ * @param {string} parentNodeName The parent node to get the output index of
165
+ * @param {string} [type='main']
166
+ * @param {*} [depth=-1]
167
+ * @param {string[]} [checkedNodes]
168
+ * @returns {(number | undefined)}
169
+ * @memberof Workflow
170
+ */
171
+ getNodeConnectionOutputIndex(nodeName: string, parentNodeName: string, type?: string, depth?: number, checkedNodes?: string[]): number | undefined;
172
+ /**
173
+ * Returns from which of the given nodes the workflow should get started from
174
+ *
175
+ * @param {string[]} nodeNames The potential start nodes
176
+ * @returns {(INode | undefined)}
177
+ * @memberof Workflow
178
+ */
179
+ __getStartNode(nodeNames: string[]): INode | undefined;
180
+ /**
181
+ * Returns the start node to start the worfklow from
182
+ *
183
+ * @param {string} [destinationNode]
184
+ * @returns {(INode | undefined)}
185
+ * @memberof Workflow
186
+ */
187
+ getStartNode(destinationNode?: string): INode | undefined;
188
+ /**
189
+ * Executes the Webhooks method of the node
190
+ *
191
+ * @param {WebhookSetupMethodNames} method The name of the method to execute
192
+ * @param {IWebhookData} webhookData
193
+ * @param {INodeExecuteFunctions} nodeExecuteFunctions
194
+ * @param {WorkflowExecuteMode} mode
195
+ * @returns {(Promise<boolean | undefined>)}
196
+ * @memberof Workflow
197
+ */
198
+ runWebhookMethod(method: WebhookSetupMethodNames, webhookData: IWebhookData, nodeExecuteFunctions: INodeExecuteFunctions, mode: WorkflowExecuteMode, activation: WorkflowActivateMode, isTest?: boolean): Promise<boolean | undefined>;
199
+ /**
200
+ * Runs the given trigger node so that it can trigger the workflow
201
+ * when the node has data.
202
+ *
203
+ * @param {INode} node
204
+ * @param {IGetExecuteTriggerFunctions} getTriggerFunctions
205
+ * @param {IWorkflowExecuteAdditionalData} additionalData
206
+ * @param {WorkflowExecuteMode} mode
207
+ * @returns {(Promise<ITriggerResponse | undefined>)}
208
+ * @memberof Workflow
209
+ */
210
+ runTrigger(node: INode, getTriggerFunctions: IGetExecuteTriggerFunctions, additionalData: IWorkflowExecuteAdditionalData, mode: WorkflowExecuteMode, activation: WorkflowActivateMode): Promise<ITriggerResponse | undefined>;
211
+ /**
212
+ * Runs the given trigger node so that it can trigger the workflow
213
+ * when the node has data.
214
+ *
215
+ * @param {INode} node
216
+ * @param {IPollFunctions} pollFunctions
217
+ * @returns
218
+ * @memberof Workflow
219
+ */
220
+ runPoll(node: INode, pollFunctions: IPollFunctions): Promise<INodeExecutionData[][] | null>;
221
+ /**
222
+ * Executes the webhook data to see what it should return and if the
223
+ * workflow should be started or not
224
+ *
225
+ * @param {INode} node
226
+ * @param {IWorkflowExecuteAdditionalData} additionalData
227
+ * @param {INodeExecuteFunctions} nodeExecuteFunctions
228
+ * @param {WorkflowExecuteMode} mode
229
+ * @param {IRunExecutionData | undefined} runExecutionData
230
+ * @returns {Promise<IWebhookResponseData>}
231
+ * @memberof Workflow
232
+ */
233
+ runWebhook(webhookData: IWebhookData, node: INode, additionalData: IWorkflowExecuteAdditionalData, nodeExecuteFunctions: INodeExecuteFunctions, mode: WorkflowExecuteMode, runExecutionData: IRunExecutionData | undefined, workflow?: Workflow): Promise<IWebhookResponseData>;
234
+ /**
235
+ * Executes the given node.
236
+ *
237
+ * @param {INode} node
238
+ * @param {ITaskDataConnections} inputData
239
+ * @param {IRunExecutionData} runExecutionData
240
+ * @param {number} runIndex
241
+ * @param {IWorkflowExecuteAdditionalData} additionalData
242
+ * @param {INodeExecuteFunctions} nodeExecuteFunctions
243
+ * @param {WorkflowExecuteMode} mode
244
+ * @returns {(Promise<INodeExecutionData[][] | null>)}
245
+ * @memberof Workflow
246
+ */
247
+ runNode(node: INode, inputData: ITaskDataConnections, runExecutionData: IRunExecutionData, runIndex: number, additionalData: IWorkflowExecuteAdditionalData, nodeExecuteFunctions: INodeExecuteFunctions, mode: WorkflowExecuteMode): Promise<INodeExecutionData[][] | null | undefined>;
248
+ }