@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.
- package/dist/README.md +31 -0
- package/dist/package.json +42 -0
- package/dist/src/index.d.ts +22 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +68 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/lib/Constants.d.ts +69 -0
- package/dist/src/lib/Constants.d.ts.map +1 -0
- package/dist/src/lib/Constants.js +106 -0
- package/dist/src/lib/Constants.js.map +1 -0
- package/dist/src/lib/DeferredPromise.d.ts +7 -0
- package/dist/src/lib/DeferredPromise.d.ts.map +1 -0
- package/dist/src/lib/DeferredPromise.js +11 -0
- package/dist/src/lib/DeferredPromise.js.map +1 -0
- package/dist/src/lib/Expression.d.ts +66 -0
- package/dist/src/lib/Expression.d.ts.map +1 -0
- package/dist/src/lib/Expression.js +247 -0
- package/dist/src/lib/Expression.js.map +1 -0
- package/dist/src/lib/Interfaces.d.ts +1623 -0
- package/dist/src/lib/Interfaces.d.ts.map +1 -0
- package/dist/src/lib/Interfaces.js +44 -0
- package/dist/src/lib/Interfaces.js.map +1 -0
- package/dist/src/lib/LoggerProxy.d.ts +10 -0
- package/dist/src/lib/LoggerProxy.d.ts.map +1 -0
- package/dist/src/lib/LoggerProxy.js +40 -0
- package/dist/src/lib/LoggerProxy.js.map +1 -0
- package/dist/src/lib/MetadataUtils.d.ts +5 -0
- package/dist/src/lib/MetadataUtils.d.ts.map +1 -0
- package/dist/src/lib/MetadataUtils.js +27 -0
- package/dist/src/lib/MetadataUtils.js.map +1 -0
- package/dist/src/lib/NodeErrors.d.ts +83 -0
- package/dist/src/lib/NodeErrors.d.ts.map +1 -0
- package/dist/src/lib/NodeErrors.js +284 -0
- package/dist/src/lib/NodeErrors.js.map +1 -0
- package/dist/src/lib/NodeHelpers.d.ts +199 -0
- package/dist/src/lib/NodeHelpers.d.ts.map +1 -0
- package/dist/src/lib/NodeHelpers.js +1335 -0
- package/dist/src/lib/NodeHelpers.js.map +1 -0
- package/dist/src/lib/ObservableObject.d.ts +6 -0
- package/dist/src/lib/ObservableObject.d.ts.map +1 -0
- package/dist/src/lib/ObservableObject.js +61 -0
- package/dist/src/lib/ObservableObject.js.map +1 -0
- package/dist/src/lib/RoutingNode.d.ts +24 -0
- package/dist/src/lib/RoutingNode.d.ts.map +1 -0
- package/dist/src/lib/RoutingNode.js +528 -0
- package/dist/src/lib/RoutingNode.js.map +1 -0
- package/dist/src/lib/TelemetryHelpers.d.ts +4 -0
- package/dist/src/lib/TelemetryHelpers.d.ts.map +1 -0
- package/dist/src/lib/TelemetryHelpers.js +67 -0
- package/dist/src/lib/TelemetryHelpers.js.map +1 -0
- package/dist/src/lib/TypeValidation.d.ts +22 -0
- package/dist/src/lib/TypeValidation.d.ts.map +1 -0
- package/dist/src/lib/TypeValidation.js +376 -0
- package/dist/src/lib/TypeValidation.js.map +1 -0
- package/dist/src/lib/VersionedNodeType.d.ts +10 -0
- package/dist/src/lib/VersionedNodeType.d.ts.map +1 -0
- package/dist/src/lib/VersionedNodeType.js +24 -0
- package/dist/src/lib/VersionedNodeType.js.map +1 -0
- package/dist/src/lib/Workflow.d.ts +249 -0
- package/dist/src/lib/Workflow.d.ts.map +1 -0
- package/dist/src/lib/Workflow.js +899 -0
- package/dist/src/lib/Workflow.js.map +1 -0
- package/dist/src/lib/WorkflowDataProxy.d.ts +88 -0
- package/dist/src/lib/WorkflowDataProxy.d.ts.map +1 -0
- package/dist/src/lib/WorkflowDataProxy.js +583 -0
- package/dist/src/lib/WorkflowDataProxy.js.map +1 -0
- package/dist/src/lib/WorkflowErrors.d.ts +10 -0
- package/dist/src/lib/WorkflowErrors.d.ts.map +1 -0
- package/dist/src/lib/WorkflowErrors.js +18 -0
- package/dist/src/lib/WorkflowErrors.js.map +1 -0
- package/dist/src/lib/WorkflowHooks.d.ts +12 -0
- package/dist/src/lib/WorkflowHooks.d.ts.map +1 -0
- package/dist/src/lib/WorkflowHooks.js +32 -0
- package/dist/src/lib/WorkflowHooks.js.map +1 -0
- package/dist/src/lib/errors/base/base.error.d.ts +30 -0
- package/dist/src/lib/errors/base/base.error.d.ts.map +1 -0
- package/dist/src/lib/errors/base/base.error.js +47 -0
- package/dist/src/lib/errors/base/base.error.js.map +1 -0
- package/dist/src/lib/errors/base/operational.error.d.ts +16 -0
- package/dist/src/lib/errors/base/operational.error.d.ts.map +1 -0
- package/dist/src/lib/errors/base/operational.error.js +19 -0
- package/dist/src/lib/errors/base/operational.error.js.map +1 -0
- package/dist/src/lib/errors/error.types.d.ts +14 -0
- package/dist/src/lib/errors/error.types.d.ts.map +1 -0
- package/dist/src/lib/errors/error.types.js +3 -0
- package/dist/src/lib/errors/error.types.js.map +1 -0
- package/dist/src/lib/errors/index.d.ts +2 -0
- package/dist/src/lib/errors/index.d.ts.map +1 -0
- package/dist/src/lib/errors/index.js +6 -0
- package/dist/src/lib/errors/index.js.map +1 -0
- package/dist/src/lib/result.d.ts +20 -0
- package/dist/src/lib/result.d.ts.map +1 -0
- package/dist/src/lib/result.js +36 -0
- package/dist/src/lib/result.js.map +1 -0
- package/dist/src/lib/utils.d.ts +51 -0
- package/dist/src/lib/utils.d.ts.map +1 -0
- package/dist/src/lib/utils.js +119 -0
- package/dist/src/lib/utils.js.map +1 -0
- package/package.json +49 -35
- package/.eslintrc.json +0 -33
- package/eslint.config.js +0 -19
- package/jest.config.ts +0 -10
- package/project.json +0 -19
- package/src/index.ts +0 -33
- package/src/lib/Constants.ts +0 -124
- package/src/lib/DeferredPromise.ts +0 -14
- package/src/lib/Expression.ts +0 -375
- package/src/lib/Interfaces.ts +0 -2262
- package/src/lib/LoggerProxy.ts +0 -43
- package/src/lib/MetadataUtils.ts +0 -34
- package/src/lib/NodeErrors.ts +0 -332
- package/src/lib/NodeHelpers.ts +0 -1666
- package/src/lib/ObservableObject.ts +0 -77
- package/src/lib/RoutingNode.ts +0 -862
- package/src/lib/TelemetryHelpers.ts +0 -86
- package/src/lib/TypeValidation.ts +0 -431
- package/src/lib/VersionedNodeType.ts +0 -30
- package/src/lib/Workflow.ts +0 -1270
- package/src/lib/WorkflowDataProxy.ts +0 -708
- package/src/lib/WorkflowErrors.ts +0 -18
- package/src/lib/WorkflowHooks.ts +0 -51
- package/src/lib/errors/base/base.error.ts +0 -68
- package/src/lib/errors/base/operational.error.ts +0 -21
- package/src/lib/errors/error.types.ts +0 -14
- package/src/lib/errors/index.ts +0 -1
- package/src/lib/result.ts +0 -34
- package/src/lib/utils.ts +0 -166
- package/tests/Helpers.ts +0 -667
- package/tests/NodeHelpers.test.ts +0 -3053
- package/tests/ObservableObject.test.ts +0 -171
- package/tests/RoutingNode.test.ts +0 -1680
- package/tests/Workflow.test.ts +0 -1284
- package/tests/WorkflowDataProxy.test.ts +0 -199
- package/tsconfig.json +0 -27
- package/tsconfig.lib.json +0 -11
- package/tsconfig.spec.json +0 -14
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
import { Workflow, WorkflowDataProxy } from '..';
|
|
2
|
-
import * as Helpers from './Helpers';
|
|
3
|
-
import {
|
|
4
|
-
IConnections,
|
|
5
|
-
INode,
|
|
6
|
-
INodeExecutionData,
|
|
7
|
-
IRunExecutionData,
|
|
8
|
-
} from '../src/lib/Interfaces';
|
|
9
|
-
|
|
10
|
-
describe('WorkflowDataProxy', () => {
|
|
11
|
-
describe('test data proxy', () => {
|
|
12
|
-
const nodes: INode[] = [
|
|
13
|
-
{
|
|
14
|
-
parameters: {},
|
|
15
|
-
name: 'Start',
|
|
16
|
-
type: 'test.set',
|
|
17
|
-
typeVersion: 1,
|
|
18
|
-
position: [100, 200],
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
parameters: {
|
|
22
|
-
functionCode:
|
|
23
|
-
'// Code here will run only once, no matter how many input items there are.\n// More info and help: https://docs.n8n.io/nodes/n8n-nodes-base.function\nconst { DateTime, Duration, Interval } = require("luxon");\n\nconst data = [\n {\n "length": 105\n },\n {\n "length": 160\n },\n {\n "length": 121\n },\n {\n "length": 275\n },\n {\n "length": 950\n },\n];\n\nreturn data.map(fact => ({json: fact}));',
|
|
24
|
-
},
|
|
25
|
-
name: 'Function',
|
|
26
|
-
type: 'test.set',
|
|
27
|
-
typeVersion: 1,
|
|
28
|
-
position: [280, 200],
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
parameters: {
|
|
32
|
-
keys: {
|
|
33
|
-
key: [
|
|
34
|
-
{
|
|
35
|
-
currentKey: 'length',
|
|
36
|
-
newKey: 'data',
|
|
37
|
-
},
|
|
38
|
-
],
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
name: 'Rename',
|
|
42
|
-
type: 'test.set',
|
|
43
|
-
typeVersion: 1,
|
|
44
|
-
position: [460, 200],
|
|
45
|
-
},
|
|
46
|
-
];
|
|
47
|
-
|
|
48
|
-
const connections: IConnections = {
|
|
49
|
-
Start: {
|
|
50
|
-
main: [
|
|
51
|
-
[
|
|
52
|
-
{
|
|
53
|
-
node: 'Function',
|
|
54
|
-
type: 'main',
|
|
55
|
-
index: 0,
|
|
56
|
-
},
|
|
57
|
-
],
|
|
58
|
-
],
|
|
59
|
-
},
|
|
60
|
-
Function: {
|
|
61
|
-
main: [
|
|
62
|
-
[
|
|
63
|
-
{
|
|
64
|
-
node: 'Rename',
|
|
65
|
-
type: 'main',
|
|
66
|
-
index: 0,
|
|
67
|
-
},
|
|
68
|
-
],
|
|
69
|
-
],
|
|
70
|
-
},
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const runExecutionData: IRunExecutionData = {
|
|
74
|
-
resultData: {
|
|
75
|
-
runData: {
|
|
76
|
-
Function: [
|
|
77
|
-
{
|
|
78
|
-
startTime: 1,
|
|
79
|
-
executionTime: 1,
|
|
80
|
-
data: {
|
|
81
|
-
main: [
|
|
82
|
-
[
|
|
83
|
-
{
|
|
84
|
-
json: { length: 105 },
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
json: { length: 160 },
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
json: { length: 121 },
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
json: { length: 275 },
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
json: { length: 950 },
|
|
97
|
-
},
|
|
98
|
-
],
|
|
99
|
-
],
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
],
|
|
103
|
-
Rename: [
|
|
104
|
-
{
|
|
105
|
-
startTime: 1,
|
|
106
|
-
executionTime: 1,
|
|
107
|
-
data: {
|
|
108
|
-
main: [
|
|
109
|
-
[
|
|
110
|
-
{
|
|
111
|
-
json: { data: 105 },
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
json: { data: 160 },
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
json: { data: 121 },
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
json: { data: 275 },
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
json: { data: 950 },
|
|
124
|
-
},
|
|
125
|
-
],
|
|
126
|
-
],
|
|
127
|
-
},
|
|
128
|
-
},
|
|
129
|
-
],
|
|
130
|
-
},
|
|
131
|
-
},
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
const renameNodeConnectionInputData: INodeExecutionData[] = [
|
|
135
|
-
{ json: { length: 105 } },
|
|
136
|
-
{ json: { length: 160 } },
|
|
137
|
-
{ json: { length: 121 } },
|
|
138
|
-
{ json: { length: 275 } },
|
|
139
|
-
{ json: { length: 950 } }
|
|
140
|
-
]
|
|
141
|
-
|
|
142
|
-
const nodeTypes = Helpers.NodeTypes();
|
|
143
|
-
const workflow = new Workflow({ nodes, connections, active: false, nodeTypes });
|
|
144
|
-
|
|
145
|
-
const dataProxy = new WorkflowDataProxy(
|
|
146
|
-
workflow,
|
|
147
|
-
runExecutionData,
|
|
148
|
-
0,
|
|
149
|
-
0,
|
|
150
|
-
'Rename',
|
|
151
|
-
renameNodeConnectionInputData || [],
|
|
152
|
-
{},
|
|
153
|
-
'manual',
|
|
154
|
-
{},
|
|
155
|
-
);
|
|
156
|
-
const proxy = dataProxy.getDataProxy();
|
|
157
|
-
|
|
158
|
-
test('test $("NodeName").all()', () => {
|
|
159
|
-
expect(proxy.$('Rename').all()[1].json.data).toEqual(160);
|
|
160
|
-
});
|
|
161
|
-
test('test $("NodeName").all() length', () => {
|
|
162
|
-
expect(proxy.$('Rename').all().length).toEqual(5);
|
|
163
|
-
});
|
|
164
|
-
test('test $("NodeName").item()', () => {
|
|
165
|
-
expect(proxy.$('Rename').item().json.data).toEqual(105);
|
|
166
|
-
});
|
|
167
|
-
test('test $("NodeName").item(2)', () => {
|
|
168
|
-
expect(proxy.$('Rename').item(2).json.data).toEqual(121);
|
|
169
|
-
});
|
|
170
|
-
test('test $("NodeName").first()', () => {
|
|
171
|
-
expect(proxy.$('Rename').first().json.data).toEqual(105);
|
|
172
|
-
});
|
|
173
|
-
test('test $("NodeName").last()', () => {
|
|
174
|
-
expect(proxy.$('Rename').last().json.data).toEqual(950);
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
test('test $input.all()', () => {
|
|
178
|
-
expect(proxy.$input.all()[1].json.length).toEqual(160);
|
|
179
|
-
});
|
|
180
|
-
test('test $input.all() length', () => {
|
|
181
|
-
expect(proxy.$input.all().length).toEqual(5);
|
|
182
|
-
});
|
|
183
|
-
test('test $input.item()', () => {
|
|
184
|
-
expect(proxy.$input.item().json.length).toEqual(105);
|
|
185
|
-
});
|
|
186
|
-
test('test $thisItem', () => {
|
|
187
|
-
expect(proxy.$thisItem.json.length).toEqual(105);
|
|
188
|
-
});
|
|
189
|
-
test('test $input.item(2)', () => {
|
|
190
|
-
expect(proxy.$input.item(2).json.length).toEqual(121);
|
|
191
|
-
});
|
|
192
|
-
test('test $input.first()', () => {
|
|
193
|
-
expect(proxy.$input.first().json.length).toEqual(105);
|
|
194
|
-
});
|
|
195
|
-
test('test $input.last()', () => {
|
|
196
|
-
expect(proxy.$input.last().json.length).toEqual(950);
|
|
197
|
-
});
|
|
198
|
-
});
|
|
199
|
-
});
|
package/tsconfig.json
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../tsconfig.base.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"module": "commonjs",
|
|
5
|
-
"moduleResolution": "node",
|
|
6
|
-
"forceConsistentCasingInFileNames": true,
|
|
7
|
-
"strict": true,
|
|
8
|
-
"noImplicitOverride": true,
|
|
9
|
-
"noImplicitReturns": true,
|
|
10
|
-
"noFallthroughCasesInSwitch": true,
|
|
11
|
-
"noPropertyAccessFromIndexSignature": true,
|
|
12
|
-
"esModuleInterop": true,
|
|
13
|
-
"skipLibCheck": true,
|
|
14
|
-
"allowSyntheticDefaultImports": true,
|
|
15
|
-
"target": "ESNext",
|
|
16
|
-
},
|
|
17
|
-
"files": [],
|
|
18
|
-
"include": [],
|
|
19
|
-
"references": [
|
|
20
|
-
{
|
|
21
|
-
"path": "./tsconfig.lib.json"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"path": "./tsconfig.spec.json"
|
|
25
|
-
}
|
|
26
|
-
]
|
|
27
|
-
}
|
package/tsconfig.lib.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "../../dist/out-tsc",
|
|
5
|
-
"declaration": true,
|
|
6
|
-
"types": ["node"],
|
|
7
|
-
"composite": true
|
|
8
|
-
},
|
|
9
|
-
"include": ["src/**/*.ts"],
|
|
10
|
-
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
|
|
11
|
-
}
|
package/tsconfig.spec.json
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "../../dist/out-tsc",
|
|
5
|
-
"module": "commonjs",
|
|
6
|
-
"types": ["jest", "node"]
|
|
7
|
-
},
|
|
8
|
-
"include": [
|
|
9
|
-
"jest.config.ts",
|
|
10
|
-
"src/**/*.test.ts",
|
|
11
|
-
"src/**/*.spec.ts",
|
|
12
|
-
"src/**/*.d.ts"
|
|
13
|
-
]
|
|
14
|
-
}
|