n8n-workflow 2.0.0-rc.2 → 2.0.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/cjs/index.d.ts +1 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/interfaces.d.ts +13 -1
- package/dist/cjs/interfaces.d.ts.map +1 -1
- package/dist/cjs/interfaces.js.map +1 -1
- package/dist/cjs/typecheck.tsbuildinfo +1 -1
- package/dist/cjs/workflow-validation.d.ts +18 -0
- package/dist/cjs/workflow-validation.d.ts.map +1 -0
- package/dist/cjs/workflow-validation.js +53 -0
- package/dist/cjs/workflow-validation.js.map +1 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/interfaces.d.ts +13 -1
- package/dist/esm/interfaces.d.ts.map +1 -1
- package/dist/esm/interfaces.js.map +1 -1
- package/dist/esm/typecheck.tsbuildinfo +1 -1
- package/dist/esm/workflow-validation.d.ts +18 -0
- package/dist/esm/workflow-validation.d.ts.map +1 -0
- package/dist/esm/workflow-validation.js +40 -0
- package/dist/esm/workflow-validation.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { INodes, INodeType } from './interfaces';
|
|
2
|
+
export interface INodeTypesGetter {
|
|
3
|
+
getByNameAndVersion(nodeType: string, version?: number): INodeType | undefined;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Validates that a workflow has at least one trigger-like node (trigger, webhook, or polling node).
|
|
7
|
+
* A workflow can only be activated if it has a node that can start the workflow execution.
|
|
8
|
+
*
|
|
9
|
+
* @param nodes - The workflow nodes to validate
|
|
10
|
+
* @param nodeTypes - Node types getter to retrieve node definitions
|
|
11
|
+
* @param ignoreNodeTypes - Optional array of node types to ignore (e.g., manual trigger, start node)
|
|
12
|
+
* @returns Object with isValid flag and error message if invalid
|
|
13
|
+
*/
|
|
14
|
+
export declare function validateWorkflowHasTriggerLikeNode(nodes: INodes, nodeTypes: INodeTypesGetter, ignoreNodeTypes?: string[]): {
|
|
15
|
+
isValid: boolean;
|
|
16
|
+
error?: string;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=workflow-validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-validation.d.ts","sourceRoot":"","sources":["../../src/workflow-validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAS,MAAM,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE7D,MAAM,WAAW,gBAAgB;IAChC,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;CAC/E;AAED;;;;;;;;GAQG;AACH,wBAAgB,kCAAkC,CACjD,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,gBAAgB,EAC3B,eAAe,CAAC,EAAE,MAAM,EAAE,GACxB;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAuCtC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validates that a workflow has at least one trigger-like node (trigger, webhook, or polling node).
|
|
3
|
+
* A workflow can only be activated if it has a node that can start the workflow execution.
|
|
4
|
+
*
|
|
5
|
+
* @param nodes - The workflow nodes to validate
|
|
6
|
+
* @param nodeTypes - Node types getter to retrieve node definitions
|
|
7
|
+
* @param ignoreNodeTypes - Optional array of node types to ignore (e.g., manual trigger, start node)
|
|
8
|
+
* @returns Object with isValid flag and error message if invalid
|
|
9
|
+
*/
|
|
10
|
+
export function validateWorkflowHasTriggerLikeNode(nodes, nodeTypes, ignoreNodeTypes) {
|
|
11
|
+
let node;
|
|
12
|
+
let nodeType;
|
|
13
|
+
for (const nodeName of Object.keys(nodes)) {
|
|
14
|
+
node = nodes[nodeName];
|
|
15
|
+
// Skip disabled nodes - they cannot trigger a run
|
|
16
|
+
if (node.disabled === true) {
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
// Skip ignored node types (e.g., manual trigger, start node)
|
|
20
|
+
if (ignoreNodeTypes?.includes(node.type)) {
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
nodeType = nodeTypes.getByNameAndVersion(node.type, node.typeVersion);
|
|
24
|
+
if (nodeType === undefined) {
|
|
25
|
+
// Type is not known, skip validation
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
if (nodeType.poll !== undefined ||
|
|
29
|
+
nodeType.trigger !== undefined ||
|
|
30
|
+
nodeType.webhook !== undefined) {
|
|
31
|
+
// Is a trigger node. So workflow can be activated.
|
|
32
|
+
return { isValid: true };
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
isValid: false,
|
|
37
|
+
error: 'Workflow cannot be activated because it has no trigger node. At least one trigger, webhook, or polling node is required.',
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=workflow-validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-validation.js","sourceRoot":"","sources":["../../src/workflow-validation.ts"],"names":[],"mappings":"AAMA;;;;;;;;GAQG;AACH,MAAM,UAAU,kCAAkC,CACjD,KAAa,EACb,SAA2B,EAC3B,eAA0B;IAE1B,IAAI,IAAW,CAAC;IAChB,IAAI,QAA+B,CAAC;IAEpC,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3C,IAAI,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;QAEvB,kDAAkD;QAClD,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,EAAE,CAAC;YAC5B,SAAS;QACV,CAAC;QAED,6DAA6D;QAC7D,IAAI,eAAe,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1C,SAAS;QACV,CAAC;QAED,QAAQ,GAAG,SAAS,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAEtE,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC5B,qCAAqC;YACrC,SAAS;QACV,CAAC;QAED,IACC,QAAQ,CAAC,IAAI,KAAK,SAAS;YAC3B,QAAQ,CAAC,OAAO,KAAK,SAAS;YAC9B,QAAQ,CAAC,OAAO,KAAK,SAAS,EAC7B,CAAC;YACF,mDAAmD;YACnD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QAC1B,CAAC;IACF,CAAC;IAED,OAAO;QACN,OAAO,EAAE,KAAK;QACd,KAAK,EACJ,0HAA0H;KAC3H,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-workflow",
|
|
3
|
-
"version": "2.0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Workflow base code of n8n",
|
|
5
5
|
"types": "dist/esm/index.d.ts",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"@types/xml2js": "^0.4.14",
|
|
34
34
|
"vitest": "^3.1.3",
|
|
35
35
|
"vitest-mock-extended": "^3.1.0",
|
|
36
|
-
"@n8n/config": "
|
|
36
|
+
"@n8n/typescript-config": "1.3.0",
|
|
37
37
|
"@n8n/vitest-config": "1.5.0",
|
|
38
|
-
"@n8n/
|
|
38
|
+
"@n8n/config": "2.0.0-rc.1"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@n8n/tournament": "1.0.6",
|