n8n-workflow 2.20.1 → 2.21.1
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/cjs/execution-context.d.ts +3 -1
- package/dist/cjs/execution-context.d.ts.map +1 -1
- package/dist/cjs/execution-context.js +1 -0
- package/dist/cjs/execution-context.js.map +1 -1
- package/dist/cjs/execution-status.d.ts +3 -0
- package/dist/cjs/execution-status.d.ts.map +1 -1
- package/dist/cjs/execution-status.js +6 -1
- package/dist/cjs/execution-status.js.map +1 -1
- package/dist/cjs/expression.d.ts.map +1 -1
- package/dist/cjs/expression.js +14 -3
- package/dist/cjs/expression.js.map +1 -1
- package/dist/cjs/extensions/expression-parser.d.ts.map +1 -1
- package/dist/cjs/extensions/expression-parser.js +5 -0
- package/dist/cjs/extensions/expression-parser.js.map +1 -1
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/interfaces.d.ts +85 -2
- package/dist/cjs/interfaces.d.ts.map +1 -1
- package/dist/cjs/interfaces.js.map +1 -1
- package/dist/cjs/node-helpers.d.ts +4 -0
- package/dist/cjs/node-helpers.d.ts.map +1 -1
- package/dist/cjs/node-helpers.js +25 -6
- package/dist/cjs/node-helpers.js.map +1 -1
- package/dist/cjs/observable-object.d.ts.map +1 -1
- package/dist/cjs/observable-object.js +2 -0
- package/dist/cjs/observable-object.js.map +1 -1
- package/dist/cjs/trimmed-task-data.d.ts +10 -0
- package/dist/cjs/trimmed-task-data.d.ts.map +1 -0
- package/dist/cjs/trimmed-task-data.js +32 -0
- package/dist/cjs/trimmed-task-data.js.map +1 -0
- package/dist/cjs/typecheck.tsbuildinfo +1 -1
- package/dist/cjs/utils.d.ts +1 -0
- package/dist/cjs/utils.d.ts.map +1 -1
- package/dist/cjs/workflow-structure-validation.d.ts +99 -0
- package/dist/cjs/workflow-structure-validation.d.ts.map +1 -0
- package/dist/cjs/workflow-structure-validation.js +162 -0
- package/dist/cjs/workflow-structure-validation.js.map +1 -0
- package/dist/esm/execution-context.d.ts +3 -1
- package/dist/esm/execution-context.d.ts.map +1 -1
- package/dist/esm/execution-context.js +1 -0
- package/dist/esm/execution-context.js.map +1 -1
- package/dist/esm/execution-status.d.ts +3 -0
- package/dist/esm/execution-status.d.ts.map +1 -1
- package/dist/esm/execution-status.js +4 -0
- package/dist/esm/execution-status.js.map +1 -1
- package/dist/esm/expression.d.ts.map +1 -1
- package/dist/esm/expression.js +14 -3
- package/dist/esm/expression.js.map +1 -1
- package/dist/esm/extensions/expression-parser.d.ts.map +1 -1
- package/dist/esm/extensions/expression-parser.js +5 -0
- package/dist/esm/extensions/expression-parser.js.map +1 -1
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/interfaces.d.ts +85 -2
- package/dist/esm/interfaces.d.ts.map +1 -1
- package/dist/esm/interfaces.js.map +1 -1
- package/dist/esm/node-helpers.d.ts +4 -0
- package/dist/esm/node-helpers.d.ts.map +1 -1
- package/dist/esm/node-helpers.js +24 -6
- package/dist/esm/node-helpers.js.map +1 -1
- package/dist/esm/observable-object.d.ts.map +1 -1
- package/dist/esm/observable-object.js +2 -0
- package/dist/esm/observable-object.js.map +1 -1
- package/dist/esm/trimmed-task-data.d.ts +10 -0
- package/dist/esm/trimmed-task-data.d.ts.map +1 -0
- package/dist/esm/trimmed-task-data.js +18 -0
- package/dist/esm/trimmed-task-data.js.map +1 -0
- package/dist/esm/typecheck.tsbuildinfo +1 -1
- package/dist/esm/utils.d.ts +1 -0
- package/dist/esm/utils.d.ts.map +1 -1
- package/dist/esm/workflow-structure-validation.d.ts +99 -0
- package/dist/esm/workflow-structure-validation.d.ts.map +1 -0
- package/dist/esm/workflow-structure-validation.js +145 -0
- package/dist/esm/workflow-structure-validation.js.map +1 -0
- package/package.json +5 -5
package/dist/esm/utils.d.ts
CHANGED
|
@@ -66,6 +66,7 @@ export declare function updateDisplayOptions(displayOptions: IDisplayOptions, pr
|
|
|
66
66
|
hint?: string;
|
|
67
67
|
builderHint?: import("./interfaces").IParameterBuilderHint;
|
|
68
68
|
disabledOptions?: IDisplayOptions;
|
|
69
|
+
envFeatureFlag?: Uppercase<string>;
|
|
69
70
|
options?: Array<import("./interfaces").INodePropertyOptions | INodeProperties | import("./interfaces").INodePropertyCollection>;
|
|
70
71
|
placeholder?: string;
|
|
71
72
|
isNodeSetting?: boolean;
|
package/dist/esm/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAWjG;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAMzE;AAED,eAAO,MAAM,aAAa,GAAI,KAAK,MAAM,GAAG,IAAI,GAAG,SAAS,KAAG,OAW9D,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAGxF,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,CAAC,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,MAAM,CAAA;CAAE,CAAC,GAAG,UAAU,EAC5F,QAAQ,CAAC,EACT,2BAAoB,EACpB,aAAS,KACP,CAgCF,CAAC;AA2CF,KAAK,iBAAiB,CAAC,CAAC,EAAE,CAAC,IACxB,CAAC,CAAC,GAAG;KAAG,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,EAA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AM,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAEvC;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAgBzD;AAED,8EAA8E;AAC9E,wBAAgB,mBAAmB,IAAI,MAAM,CAI5C"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const workflowStructureSchema: z.ZodObject<{
|
|
3
|
+
nodes: z.ZodArray<z.ZodObject<{
|
|
4
|
+
name: z.ZodString;
|
|
5
|
+
type: z.ZodString;
|
|
6
|
+
position: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
7
|
+
parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
8
|
+
id: z.ZodOptional<z.ZodString>;
|
|
9
|
+
typeVersion: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
11
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
12
|
+
name: z.ZodString;
|
|
13
|
+
type: z.ZodString;
|
|
14
|
+
position: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
15
|
+
parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
16
|
+
id: z.ZodOptional<z.ZodString>;
|
|
17
|
+
typeVersion: z.ZodOptional<z.ZodNumber>;
|
|
18
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
19
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
20
|
+
name: z.ZodString;
|
|
21
|
+
type: z.ZodString;
|
|
22
|
+
position: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
23
|
+
parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
24
|
+
id: z.ZodOptional<z.ZodString>;
|
|
25
|
+
typeVersion: z.ZodOptional<z.ZodNumber>;
|
|
26
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
27
|
+
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
28
|
+
connections: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodArray<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
29
|
+
node: z.ZodString;
|
|
30
|
+
type: z.ZodString;
|
|
31
|
+
index: z.ZodNumber;
|
|
32
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
33
|
+
node: z.ZodString;
|
|
34
|
+
type: z.ZodString;
|
|
35
|
+
index: z.ZodNumber;
|
|
36
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
37
|
+
node: z.ZodString;
|
|
38
|
+
type: z.ZodString;
|
|
39
|
+
index: z.ZodNumber;
|
|
40
|
+
}, z.ZodTypeAny, "passthrough">>, "many">>>, "many">>>;
|
|
41
|
+
}, "strip", z.ZodTypeAny, {
|
|
42
|
+
nodes: z.objectOutputType<{
|
|
43
|
+
name: z.ZodString;
|
|
44
|
+
type: z.ZodString;
|
|
45
|
+
position: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
46
|
+
parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
47
|
+
id: z.ZodOptional<z.ZodString>;
|
|
48
|
+
typeVersion: z.ZodOptional<z.ZodNumber>;
|
|
49
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
50
|
+
}, z.ZodTypeAny, "passthrough">[];
|
|
51
|
+
connections: Record<string, Record<string, (z.objectOutputType<{
|
|
52
|
+
node: z.ZodString;
|
|
53
|
+
type: z.ZodString;
|
|
54
|
+
index: z.ZodNumber;
|
|
55
|
+
}, z.ZodTypeAny, "passthrough">[] | null | undefined)[]>>;
|
|
56
|
+
}, {
|
|
57
|
+
nodes: z.objectInputType<{
|
|
58
|
+
name: z.ZodString;
|
|
59
|
+
type: z.ZodString;
|
|
60
|
+
position: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
61
|
+
parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
62
|
+
id: z.ZodOptional<z.ZodString>;
|
|
63
|
+
typeVersion: z.ZodOptional<z.ZodNumber>;
|
|
64
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
65
|
+
}, z.ZodTypeAny, "passthrough">[];
|
|
66
|
+
connections: Record<string, Record<string, (z.objectInputType<{
|
|
67
|
+
node: z.ZodString;
|
|
68
|
+
type: z.ZodString;
|
|
69
|
+
index: z.ZodNumber;
|
|
70
|
+
}, z.ZodTypeAny, "passthrough">[] | null | undefined)[]>>;
|
|
71
|
+
}>;
|
|
72
|
+
type WorkflowStructureData = z.infer<typeof workflowStructureSchema>;
|
|
73
|
+
type WorkflowStructureGraphIssueCode = 'duplicate_node_name' | 'unknown_connection_source' | 'unknown_connection_target';
|
|
74
|
+
type WorkflowStructureGraphIssue = {
|
|
75
|
+
code: WorkflowStructureGraphIssueCode;
|
|
76
|
+
path: Array<string | number>;
|
|
77
|
+
message: string;
|
|
78
|
+
};
|
|
79
|
+
export type WorkflowStructureIssue = z.ZodIssue | WorkflowStructureGraphIssue;
|
|
80
|
+
type WorkflowStructureValidationSuccess = {
|
|
81
|
+
success: true;
|
|
82
|
+
data: WorkflowStructureData;
|
|
83
|
+
};
|
|
84
|
+
type WorkflowStructureValidationFailure = {
|
|
85
|
+
success: false;
|
|
86
|
+
issues: WorkflowStructureIssue[];
|
|
87
|
+
};
|
|
88
|
+
export type WorkflowStructureValidationResult = WorkflowStructureValidationSuccess | WorkflowStructureValidationFailure;
|
|
89
|
+
export declare const formatWorkflowStructureIssuePath: (path: Array<string | number>) => string;
|
|
90
|
+
export declare class WorkflowStructureValidationError extends Error {
|
|
91
|
+
readonly issues: WorkflowStructureIssue[];
|
|
92
|
+
name: string;
|
|
93
|
+
readonly description: string;
|
|
94
|
+
constructor(issues: WorkflowStructureIssue[]);
|
|
95
|
+
}
|
|
96
|
+
export declare function safeParseWorkflowStructure(input: unknown): WorkflowStructureValidationResult;
|
|
97
|
+
export declare function parseWorkflowStructure(input: unknown): WorkflowStructureData;
|
|
98
|
+
export {};
|
|
99
|
+
//# sourceMappingURL=workflow-structure-validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-structure-validation.d.ts","sourceRoot":"","sources":["../../src/workflow-structure-validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA2DxB,QAAA,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAG3B,CAAC;AAEH,KAAK,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAErE,KAAK,+BAA+B,GACjC,qBAAqB,GACrB,2BAA2B,GAC3B,2BAA2B,CAAC;AAE/B,KAAK,2BAA2B,GAAG;IAClC,IAAI,EAAE,+BAA+B,CAAC;IACtC,IAAI,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,QAAQ,GAAG,2BAA2B,CAAC;AAE9E,KAAK,kCAAkC,GAAG;IACzC,OAAO,EAAE,IAAI,CAAC;IACd,IAAI,EAAE,qBAAqB,CAAC;CAC5B,CAAC;AAEF,KAAK,kCAAkC,GAAG;IACzC,OAAO,EAAE,KAAK,CAAC;IACf,MAAM,EAAE,sBAAsB,EAAE,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAC1C,kCAAkC,GAClC,kCAAkC,CAAC;AAEtC,eAAO,MAAM,gCAAgC,GAAI,MAAM,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,KAAG,MAO/E,CAAC;AAOF,qBAAa,gCAAiC,SAAQ,KAAK;IAK9C,QAAQ,CAAC,MAAM,EAAE,sBAAsB,EAAE;IAJ5C,IAAI,SAAsC;IAEnD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;gBAER,MAAM,EAAE,sBAAsB,EAAE;CAIrD;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,iCAAiC,CAqE5F;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,qBAAqB,CAQ5E"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Workflow Structure Validation
|
|
4
|
+
*
|
|
5
|
+
* Single source of truth for validating workflow **structure** — the minimum
|
|
6
|
+
* shape that the editor and runtime assume is always present and correctly
|
|
7
|
+
* formed. Intentionally separate from activation/publish validation
|
|
8
|
+
* (WorkflowValidationService) which checks semantic correctness (trigger
|
|
9
|
+
* presence, known node types, credential issues, etc.).
|
|
10
|
+
*
|
|
11
|
+
* Lives in n8n-workflow so it can be shared by:
|
|
12
|
+
* - Backend: create/update/import reject malformed payloads (400)
|
|
13
|
+
* - Frontend: open path warns but still renders; import path blocks
|
|
14
|
+
*
|
|
15
|
+
* Validates:
|
|
16
|
+
* - Required node fields (name, type, position)
|
|
17
|
+
* - Position is a 2-number tuple
|
|
18
|
+
* - Connection entries have valid node/type/index
|
|
19
|
+
* - No duplicate node names
|
|
20
|
+
* - Connection source/target keys reference existing nodes
|
|
21
|
+
*
|
|
22
|
+
* Does NOT validate:
|
|
23
|
+
* - Whether a node type is installed
|
|
24
|
+
* - Node parameter correctness
|
|
25
|
+
* - Credential validity
|
|
26
|
+
* - Activation readiness
|
|
27
|
+
*
|
|
28
|
+
*/
|
|
29
|
+
const workflowNodeStructureSchema = z
|
|
30
|
+
.object({
|
|
31
|
+
name: z.string().min(1),
|
|
32
|
+
type: z.string().min(1),
|
|
33
|
+
position: z.tuple([z.number(), z.number()]),
|
|
34
|
+
parameters: z.record(z.string(), z.unknown()).optional(),
|
|
35
|
+
id: z.string().optional(),
|
|
36
|
+
typeVersion: z.number().optional(),
|
|
37
|
+
disabled: z.boolean().optional(),
|
|
38
|
+
})
|
|
39
|
+
.passthrough();
|
|
40
|
+
const connectionEntrySchema = z
|
|
41
|
+
.object({
|
|
42
|
+
node: z.string().min(1),
|
|
43
|
+
type: z.string().min(1),
|
|
44
|
+
index: z.number().int().min(0),
|
|
45
|
+
})
|
|
46
|
+
.passthrough();
|
|
47
|
+
// Buckets can be null when a multi-output node has unused output slots.
|
|
48
|
+
// Matches NodeInputConnections type.
|
|
49
|
+
const connectionBucketSchema = z.array(connectionEntrySchema).nullable().optional();
|
|
50
|
+
const workflowConnectionsStructureSchema = z.record(z.string(), z.record(z.string(), z.array(connectionBucketSchema)));
|
|
51
|
+
const workflowStructureSchema = z.object({
|
|
52
|
+
nodes: z.array(workflowNodeStructureSchema),
|
|
53
|
+
connections: workflowConnectionsStructureSchema,
|
|
54
|
+
});
|
|
55
|
+
export const formatWorkflowStructureIssuePath = (path) => {
|
|
56
|
+
if (path.length === 0)
|
|
57
|
+
return 'workflow';
|
|
58
|
+
return path.reduce((acc, segment) => {
|
|
59
|
+
if (typeof segment === 'number')
|
|
60
|
+
return `${acc}[${segment}]`;
|
|
61
|
+
return acc ? `${acc}.${segment}` : segment;
|
|
62
|
+
}, '');
|
|
63
|
+
};
|
|
64
|
+
const formatIssuesDescription = (issues) => issues
|
|
65
|
+
.map(({ path, message }) => `${formatWorkflowStructureIssuePath(path)}: ${message}`)
|
|
66
|
+
.join('\n');
|
|
67
|
+
export class WorkflowStructureValidationError extends Error {
|
|
68
|
+
issues;
|
|
69
|
+
name = 'WorkflowStructureValidationError';
|
|
70
|
+
description;
|
|
71
|
+
constructor(issues) {
|
|
72
|
+
super('Invalid workflow structure');
|
|
73
|
+
this.issues = issues;
|
|
74
|
+
this.description = formatIssuesDescription(issues);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
export function safeParseWorkflowStructure(input) {
|
|
78
|
+
const parsed = workflowStructureSchema.safeParse(input);
|
|
79
|
+
if (!parsed.success) {
|
|
80
|
+
return {
|
|
81
|
+
success: false,
|
|
82
|
+
issues: parsed.error.issues,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
const { nodes, connections } = parsed.data;
|
|
86
|
+
const issues = [];
|
|
87
|
+
const nodeNames = new Set();
|
|
88
|
+
for (const [index, node] of nodes.entries()) {
|
|
89
|
+
if (nodeNames.has(node.name)) {
|
|
90
|
+
issues.push({
|
|
91
|
+
path: ['nodes', index, 'name'],
|
|
92
|
+
message: `Duplicate node name "${node.name}"`,
|
|
93
|
+
code: 'duplicate_node_name',
|
|
94
|
+
});
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
nodeNames.add(node.name);
|
|
98
|
+
}
|
|
99
|
+
for (const sourceNodeName of Object.keys(connections)) {
|
|
100
|
+
if (!nodeNames.has(sourceNodeName)) {
|
|
101
|
+
issues.push({
|
|
102
|
+
path: ['connections', sourceNodeName],
|
|
103
|
+
message: `Connection source "${sourceNodeName}" does not reference an existing node`,
|
|
104
|
+
code: 'unknown_connection_source',
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
const connectionTypes = connections[sourceNodeName];
|
|
108
|
+
for (const connectionType of Object.keys(connectionTypes)) {
|
|
109
|
+
const buckets = connectionTypes[connectionType];
|
|
110
|
+
for (const [sourceIndex, bucket] of buckets.entries()) {
|
|
111
|
+
for (const [targetIndex, connection] of (bucket ?? []).entries()) {
|
|
112
|
+
if (!nodeNames.has(connection.node)) {
|
|
113
|
+
issues.push({
|
|
114
|
+
path: [
|
|
115
|
+
'connections',
|
|
116
|
+
sourceNodeName,
|
|
117
|
+
connectionType,
|
|
118
|
+
sourceIndex,
|
|
119
|
+
targetIndex,
|
|
120
|
+
'node',
|
|
121
|
+
],
|
|
122
|
+
message: `Connection target "${connection.node}" does not reference an existing node`,
|
|
123
|
+
code: 'unknown_connection_target',
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if (issues.length > 0) {
|
|
131
|
+
return { success: false, issues };
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
success: true,
|
|
135
|
+
data: parsed.data,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
export function parseWorkflowStructure(input) {
|
|
139
|
+
const result = safeParseWorkflowStructure(input);
|
|
140
|
+
if (!result.success) {
|
|
141
|
+
throw new WorkflowStructureValidationError(result.issues);
|
|
142
|
+
}
|
|
143
|
+
return result.data;
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=workflow-structure-validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-structure-validation.js","sourceRoot":"","sources":["../../src/workflow-structure-validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,MAAM,2BAA2B,GAAG,CAAC;KACnC,MAAM,CAAC;IACP,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;IAC3C,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;IACxD,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACzB,WAAW,EAAE,CAAC,CAAC,MAA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AAU,CAAC,IAAI,uCAAuC;4BACrF,IAAI,EAAE,2BAA2B;yBACjC,CAAC,CAAC;oBACJ,CAAC;gBACF,CAAC;YACF,CAAC;QACF,CAAC;IACF,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IACnC,CAAC;IAED,OAAO;QACN,OAAO,EAAE,IAAI;QACb,IAAI,EAAE,MAAM,CAAC,IAAI;KACjB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,KAAc;IACpD,MAAM,MAAM,GAAG,0BAA0B,CAAC,KAAK,CAAC,CAAC;IAEjD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACrB,MAAM,IAAI,gCAAgC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC3D,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC;AACpB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-workflow",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.21.1",
|
|
4
4
|
"description": "Workflow base code of n8n",
|
|
5
5
|
"types": "dist/esm/index.d.ts",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"vitest": "^4.1.1",
|
|
35
35
|
"vitest-mock-extended": "^3.1.0",
|
|
36
36
|
"zod": "3.25.67",
|
|
37
|
-
"@n8n/config": "2.19.1",
|
|
38
37
|
"@n8n/typescript-config": "1.4.0",
|
|
39
|
-
"@n8n/vitest-config": "1.10.0"
|
|
38
|
+
"@n8n/vitest-config": "1.10.0",
|
|
39
|
+
"@n8n/config": "2.20.0"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"ast-types": "0.16.1",
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
"xml2js": "0.6.2",
|
|
57
57
|
"jsonrepair": "3.13.2",
|
|
58
58
|
"@n8n/errors": "0.8.0",
|
|
59
|
-
"@n8n/
|
|
60
|
-
"@n8n/
|
|
59
|
+
"@n8n/expression-runtime": "0.13.1",
|
|
60
|
+
"@n8n/tournament": "1.1.1"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"zod": ">=3.25.0 <4"
|