@atom8n/n8n-workflow 2.4.2 → 2.5.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.
@@ -0,0 +1,4 @@
1
+ import { ExpressionError } from './expression.error';
2
+ export declare class ExpressionClassExtensionError extends ExpressionError {
3
+ constructor(baseClass: string);
4
+ }
@@ -0,0 +1,20 @@
1
+ (function (factory) {
2
+ if (typeof module === "object" && typeof module.exports === "object") {
3
+ var v = factory(require, exports);
4
+ if (v !== undefined) module.exports = v;
5
+ }
6
+ else if (typeof define === "function" && define.amd) {
7
+ define(["require", "exports", "./expression.error"], factory);
8
+ }
9
+ })(function (require, exports) {
10
+ "use strict";
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ExpressionClassExtensionError = void 0;
13
+ const expression_error_1 = require("./expression.error");
14
+ class ExpressionClassExtensionError extends expression_error_1.ExpressionError {
15
+ constructor(baseClass) {
16
+ super(`Cannot extend "${baseClass}" due to security concerns`);
17
+ }
18
+ }
19
+ exports.ExpressionClassExtensionError = ExpressionClassExtensionError;
20
+ });
@@ -0,0 +1,4 @@
1
+ import { ExpressionError } from './expression.error';
2
+ export declare class ExpressionComputedDestructuringError extends ExpressionError {
3
+ constructor();
4
+ }
@@ -0,0 +1,20 @@
1
+ (function (factory) {
2
+ if (typeof module === "object" && typeof module.exports === "object") {
3
+ var v = factory(require, exports);
4
+ if (v !== undefined) module.exports = v;
5
+ }
6
+ else if (typeof define === "function" && define.amd) {
7
+ define(["require", "exports", "./expression.error"], factory);
8
+ }
9
+ })(function (require, exports) {
10
+ "use strict";
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ExpressionComputedDestructuringError = void 0;
13
+ const expression_error_1 = require("./expression.error");
14
+ class ExpressionComputedDestructuringError extends expression_error_1.ExpressionError {
15
+ constructor() {
16
+ super('Computed property names in destructuring are not allowed due to security concerns');
17
+ }
18
+ }
19
+ exports.ExpressionComputedDestructuringError = ExpressionComputedDestructuringError;
20
+ });
@@ -0,0 +1,4 @@
1
+ import { ExpressionError } from './expression.error';
2
+ export declare class ExpressionDestructuringError extends ExpressionError {
3
+ constructor(property: string);
4
+ }
@@ -0,0 +1,20 @@
1
+ (function (factory) {
2
+ if (typeof module === "object" && typeof module.exports === "object") {
3
+ var v = factory(require, exports);
4
+ if (v !== undefined) module.exports = v;
5
+ }
6
+ else if (typeof define === "function" && define.amd) {
7
+ define(["require", "exports", "./expression.error"], factory);
8
+ }
9
+ })(function (require, exports) {
10
+ "use strict";
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ExpressionDestructuringError = void 0;
13
+ const expression_error_1 = require("./expression.error");
14
+ class ExpressionDestructuringError extends expression_error_1.ExpressionError {
15
+ constructor(property) {
16
+ super(`Cannot destructure "${property}" due to security concerns`);
17
+ }
18
+ }
19
+ exports.ExpressionDestructuringError = ExpressionDestructuringError;
20
+ });
@@ -0,0 +1,48 @@
1
+ import type { AssignmentCollectionValue, INodeParameters, NodeParameterValue, NodeParameterValueType } from '../interfaces';
2
+ /**
3
+ * Type guard for primitive NodeParameterValue types.
4
+ * Checks if a value is string, number, boolean, undefined, or null.
5
+ */
6
+ export declare function isNodeParameterValue(value: unknown): value is NodeParameterValue;
7
+ /**
8
+ * Type guard for AssignmentCollectionValue.
9
+ * Checks if a value has the structure of an assignment collection.
10
+ */
11
+ export declare function isAssignmentCollectionValue(value: unknown): value is AssignmentCollectionValue;
12
+ /**
13
+ * Type guard for INodeParameters.
14
+ * Recursively validates that all values in the object are valid NodeParameterValueType.
15
+ */
16
+ export declare function isNodeParameters(value: unknown): value is INodeParameters;
17
+ /**
18
+ * Comprehensive type guard for NodeParameterValueType.
19
+ * Validates that a value matches any of the valid node parameter value types.
20
+ *
21
+ * @param value - The value to check
22
+ * @returns true if the value is a valid NodeParameterValueType
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * const value: unknown = { foo: 'bar' };
27
+ * if (isValidNodeParameterValueType(value)) {
28
+ * // value is now typed as NodeParameterValueType
29
+ * }
30
+ * ```
31
+ */
32
+ export declare function isValidNodeParameterValueType(value: unknown): value is NodeParameterValueType;
33
+ /**
34
+ * Assertion function that throws if the value is not a valid NodeParameterValueType.
35
+ * Useful for runtime validation with TypeScript type narrowing.
36
+ *
37
+ * @param value - The value to validate
38
+ * @param errorMessage - Optional custom error message
39
+ * @throws Error if the value is not a valid NodeParameterValueType
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * const value: unknown = getData();
44
+ * assertIsValidNodeParameterValueType(value);
45
+ * // value is now typed as NodeParameterValueType
46
+ * ```
47
+ */
48
+ export declare function assertIsValidNodeParameterValueType(value: unknown, errorMessage?: string): asserts value is NodeParameterValueType;
@@ -0,0 +1,120 @@
1
+ (function (factory) {
2
+ if (typeof module === "object" && typeof module.exports === "object") {
3
+ var v = factory(require, exports);
4
+ if (v !== undefined) module.exports = v;
5
+ }
6
+ else if (typeof define === "function" && define.amd) {
7
+ define(["require", "exports", "../type-guards"], factory);
8
+ }
9
+ })(function (require, exports) {
10
+ "use strict";
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.isNodeParameterValue = isNodeParameterValue;
13
+ exports.isAssignmentCollectionValue = isAssignmentCollectionValue;
14
+ exports.isNodeParameters = isNodeParameters;
15
+ exports.isValidNodeParameterValueType = isValidNodeParameterValueType;
16
+ exports.assertIsValidNodeParameterValueType = assertIsValidNodeParameterValueType;
17
+ const type_guards_1 = require("../type-guards");
18
+ /**
19
+ * Type guard for primitive NodeParameterValue types.
20
+ * Checks if a value is string, number, boolean, undefined, or null.
21
+ */
22
+ function isNodeParameterValue(value) {
23
+ return (typeof value === 'string' ||
24
+ typeof value === 'number' ||
25
+ typeof value === 'boolean' ||
26
+ value === undefined ||
27
+ value === null);
28
+ }
29
+ /**
30
+ * Type guard for AssignmentCollectionValue.
31
+ * Checks if a value has the structure of an assignment collection.
32
+ */
33
+ function isAssignmentCollectionValue(value) {
34
+ if (typeof value !== 'object' || value === null || !('assignments' in value)) {
35
+ return false;
36
+ }
37
+ const assignments = value.assignments;
38
+ if (!Array.isArray(assignments)) {
39
+ return false;
40
+ }
41
+ return assignments.every((assignment) => typeof assignment === 'object' &&
42
+ assignment !== null &&
43
+ 'id' in assignment &&
44
+ 'name' in assignment &&
45
+ 'value' in assignment &&
46
+ typeof assignment.id === 'string' &&
47
+ typeof assignment.name === 'string' &&
48
+ isNodeParameterValue(assignment.value));
49
+ }
50
+ /**
51
+ * Type guard for INodeParameters.
52
+ * Recursively validates that all values in the object are valid NodeParameterValueType.
53
+ */
54
+ function isNodeParameters(value) {
55
+ if (typeof value !== 'object' || value === null || Array.isArray(value)) {
56
+ return false;
57
+ }
58
+ // Reject built-in class instances (Date, RegExp, etc.)
59
+ // Only accept plain objects created with {} or Object.create(null)
60
+ if (Object.prototype.toString.call(value) !== '[object Object]') {
61
+ return false;
62
+ }
63
+ // Recursively validate all values
64
+ return Object.values(value).every((val) => isValidNodeParameterValueType(val));
65
+ }
66
+ /**
67
+ * Comprehensive type guard for NodeParameterValueType.
68
+ * Validates that a value matches any of the valid node parameter value types.
69
+ *
70
+ * @param value - The value to check
71
+ * @returns true if the value is a valid NodeParameterValueType
72
+ *
73
+ * @example
74
+ * ```typescript
75
+ * const value: unknown = { foo: 'bar' };
76
+ * if (isValidNodeParameterValueType(value)) {
77
+ * // value is now typed as NodeParameterValueType
78
+ * }
79
+ * ```
80
+ */
81
+ function isValidNodeParameterValueType(value) {
82
+ return (
83
+ // Primitives (most common case)
84
+ isNodeParameterValue(value) ||
85
+ // Special object types
86
+ (0, type_guards_1.isResourceLocatorValue)(value) ||
87
+ (0, type_guards_1.isResourceMapperValue)(value) ||
88
+ (0, type_guards_1.isFilterValue)(value) ||
89
+ isAssignmentCollectionValue(value) ||
90
+ // Arrays - all items should be valid NodeParameterValueType
91
+ (Array.isArray(value) &&
92
+ (value.length === 0 ||
93
+ value.every(isNodeParameterValue) ||
94
+ value.every(isNodeParameters) ||
95
+ value.every(type_guards_1.isResourceLocatorValue) ||
96
+ value.every(type_guards_1.isResourceMapperValue))) ||
97
+ // INodeParameters (must be last to avoid infinite recursion on first check)
98
+ isNodeParameters(value));
99
+ }
100
+ /**
101
+ * Assertion function that throws if the value is not a valid NodeParameterValueType.
102
+ * Useful for runtime validation with TypeScript type narrowing.
103
+ *
104
+ * @param value - The value to validate
105
+ * @param errorMessage - Optional custom error message
106
+ * @throws Error if the value is not a valid NodeParameterValueType
107
+ *
108
+ * @example
109
+ * ```typescript
110
+ * const value: unknown = getData();
111
+ * assertIsValidNodeParameterValueType(value);
112
+ * // value is now typed as NodeParameterValueType
113
+ * ```
114
+ */
115
+ function assertIsValidNodeParameterValueType(value, errorMessage = 'Value is not a valid NodeParameterValueType') {
116
+ if (!isValidNodeParameterValueType(value)) {
117
+ throw new Error(errorMessage);
118
+ }
119
+ }
120
+ });
@@ -0,0 +1,4 @@
1
+ import { ExpressionError } from './expression.error';
2
+ export declare class ExpressionClassExtensionError extends ExpressionError {
3
+ constructor(baseClass: string);
4
+ }
@@ -0,0 +1,6 @@
1
+ import { ExpressionError } from './expression.error';
2
+ export class ExpressionClassExtensionError extends ExpressionError {
3
+ constructor(baseClass) {
4
+ super(`Cannot extend "${baseClass}" due to security concerns`);
5
+ }
6
+ }
@@ -0,0 +1,4 @@
1
+ import { ExpressionError } from './expression.error';
2
+ export declare class ExpressionComputedDestructuringError extends ExpressionError {
3
+ constructor();
4
+ }
@@ -0,0 +1,6 @@
1
+ import { ExpressionError } from './expression.error';
2
+ export class ExpressionComputedDestructuringError extends ExpressionError {
3
+ constructor() {
4
+ super('Computed property names in destructuring are not allowed due to security concerns');
5
+ }
6
+ }
@@ -0,0 +1,4 @@
1
+ import { ExpressionError } from './expression.error';
2
+ export declare class ExpressionDestructuringError extends ExpressionError {
3
+ constructor(property: string);
4
+ }
@@ -0,0 +1,6 @@
1
+ import { ExpressionError } from './expression.error';
2
+ export class ExpressionDestructuringError extends ExpressionError {
3
+ constructor(property) {
4
+ super(`Cannot destructure "${property}" due to security concerns`);
5
+ }
6
+ }
@@ -0,0 +1,48 @@
1
+ import type { AssignmentCollectionValue, INodeParameters, NodeParameterValue, NodeParameterValueType } from '../interfaces';
2
+ /**
3
+ * Type guard for primitive NodeParameterValue types.
4
+ * Checks if a value is string, number, boolean, undefined, or null.
5
+ */
6
+ export declare function isNodeParameterValue(value: unknown): value is NodeParameterValue;
7
+ /**
8
+ * Type guard for AssignmentCollectionValue.
9
+ * Checks if a value has the structure of an assignment collection.
10
+ */
11
+ export declare function isAssignmentCollectionValue(value: unknown): value is AssignmentCollectionValue;
12
+ /**
13
+ * Type guard for INodeParameters.
14
+ * Recursively validates that all values in the object are valid NodeParameterValueType.
15
+ */
16
+ export declare function isNodeParameters(value: unknown): value is INodeParameters;
17
+ /**
18
+ * Comprehensive type guard for NodeParameterValueType.
19
+ * Validates that a value matches any of the valid node parameter value types.
20
+ *
21
+ * @param value - The value to check
22
+ * @returns true if the value is a valid NodeParameterValueType
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * const value: unknown = { foo: 'bar' };
27
+ * if (isValidNodeParameterValueType(value)) {
28
+ * // value is now typed as NodeParameterValueType
29
+ * }
30
+ * ```
31
+ */
32
+ export declare function isValidNodeParameterValueType(value: unknown): value is NodeParameterValueType;
33
+ /**
34
+ * Assertion function that throws if the value is not a valid NodeParameterValueType.
35
+ * Useful for runtime validation with TypeScript type narrowing.
36
+ *
37
+ * @param value - The value to validate
38
+ * @param errorMessage - Optional custom error message
39
+ * @throws Error if the value is not a valid NodeParameterValueType
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * const value: unknown = getData();
44
+ * assertIsValidNodeParameterValueType(value);
45
+ * // value is now typed as NodeParameterValueType
46
+ * ```
47
+ */
48
+ export declare function assertIsValidNodeParameterValueType(value: unknown, errorMessage?: string): asserts value is NodeParameterValueType;
@@ -0,0 +1,103 @@
1
+ import { isResourceLocatorValue, isResourceMapperValue, isFilterValue } from '../type-guards';
2
+ /**
3
+ * Type guard for primitive NodeParameterValue types.
4
+ * Checks if a value is string, number, boolean, undefined, or null.
5
+ */
6
+ export function isNodeParameterValue(value) {
7
+ return (typeof value === 'string' ||
8
+ typeof value === 'number' ||
9
+ typeof value === 'boolean' ||
10
+ value === undefined ||
11
+ value === null);
12
+ }
13
+ /**
14
+ * Type guard for AssignmentCollectionValue.
15
+ * Checks if a value has the structure of an assignment collection.
16
+ */
17
+ export function isAssignmentCollectionValue(value) {
18
+ if (typeof value !== 'object' || value === null || !('assignments' in value)) {
19
+ return false;
20
+ }
21
+ const assignments = value.assignments;
22
+ if (!Array.isArray(assignments)) {
23
+ return false;
24
+ }
25
+ return assignments.every((assignment) => typeof assignment === 'object' &&
26
+ assignment !== null &&
27
+ 'id' in assignment &&
28
+ 'name' in assignment &&
29
+ 'value' in assignment &&
30
+ typeof assignment.id === 'string' &&
31
+ typeof assignment.name === 'string' &&
32
+ isNodeParameterValue(assignment.value));
33
+ }
34
+ /**
35
+ * Type guard for INodeParameters.
36
+ * Recursively validates that all values in the object are valid NodeParameterValueType.
37
+ */
38
+ export function isNodeParameters(value) {
39
+ if (typeof value !== 'object' || value === null || Array.isArray(value)) {
40
+ return false;
41
+ }
42
+ // Reject built-in class instances (Date, RegExp, etc.)
43
+ // Only accept plain objects created with {} or Object.create(null)
44
+ if (Object.prototype.toString.call(value) !== '[object Object]') {
45
+ return false;
46
+ }
47
+ // Recursively validate all values
48
+ return Object.values(value).every((val) => isValidNodeParameterValueType(val));
49
+ }
50
+ /**
51
+ * Comprehensive type guard for NodeParameterValueType.
52
+ * Validates that a value matches any of the valid node parameter value types.
53
+ *
54
+ * @param value - The value to check
55
+ * @returns true if the value is a valid NodeParameterValueType
56
+ *
57
+ * @example
58
+ * ```typescript
59
+ * const value: unknown = { foo: 'bar' };
60
+ * if (isValidNodeParameterValueType(value)) {
61
+ * // value is now typed as NodeParameterValueType
62
+ * }
63
+ * ```
64
+ */
65
+ export function isValidNodeParameterValueType(value) {
66
+ return (
67
+ // Primitives (most common case)
68
+ isNodeParameterValue(value) ||
69
+ // Special object types
70
+ isResourceLocatorValue(value) ||
71
+ isResourceMapperValue(value) ||
72
+ isFilterValue(value) ||
73
+ isAssignmentCollectionValue(value) ||
74
+ // Arrays - all items should be valid NodeParameterValueType
75
+ (Array.isArray(value) &&
76
+ (value.length === 0 ||
77
+ value.every(isNodeParameterValue) ||
78
+ value.every(isNodeParameters) ||
79
+ value.every(isResourceLocatorValue) ||
80
+ value.every(isResourceMapperValue))) ||
81
+ // INodeParameters (must be last to avoid infinite recursion on first check)
82
+ isNodeParameters(value));
83
+ }
84
+ /**
85
+ * Assertion function that throws if the value is not a valid NodeParameterValueType.
86
+ * Useful for runtime validation with TypeScript type narrowing.
87
+ *
88
+ * @param value - The value to validate
89
+ * @param errorMessage - Optional custom error message
90
+ * @throws Error if the value is not a valid NodeParameterValueType
91
+ *
92
+ * @example
93
+ * ```typescript
94
+ * const value: unknown = getData();
95
+ * assertIsValidNodeParameterValueType(value);
96
+ * // value is now typed as NodeParameterValueType
97
+ * ```
98
+ */
99
+ export function assertIsValidNodeParameterValueType(value, errorMessage = 'Value is not a valid NodeParameterValueType') {
100
+ if (!isValidNodeParameterValueType(value)) {
101
+ throw new Error(errorMessage);
102
+ }
103
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atom8n/n8n-workflow",
3
- "version": "2.4.2",
3
+ "version": "2.5.0",
4
4
  "description": "Workflow base code of n8n",
5
5
  "types": "dist/esm/index.d.ts",
6
6
  "module": "dist/esm/index.js",
@@ -38,9 +38,9 @@
38
38
  ],
39
39
  "devDependencies": {
40
40
  "@langchain/core": "1.1.0",
41
- "@n8n/config": "npm:@atom8n/config@2.3.2",
42
- "@n8n/typescript-config": "npm:@atom8n/typescript-config@1.5.2",
43
- "@n8n/vitest-config": "npm:@atom8n/vitest-config@1.7.2",
41
+ "@n8n/config": "npm:@atom8n/config@2.4.0",
42
+ "@n8n/typescript-config": "npm:@atom8n/typescript-config@1.6.0",
43
+ "@n8n/vitest-config": "npm:@atom8n/vitest-config@1.8.0",
44
44
  "@types/express": "^5.0.1",
45
45
  "@types/jmespath": "^0.15.0",
46
46
  "@types/lodash": "4.17.17",
@@ -51,7 +51,7 @@
51
51
  "vitest-mock-extended": "^3.1.0"
52
52
  },
53
53
  "dependencies": {
54
- "@n8n/errors": "npm:@atom8n/errors@0.7.2",
54
+ "@n8n/errors": "npm:@atom8n/errors@0.8.0",
55
55
  "@n8n/tournament": "1.0.6",
56
56
  "ast-types": "0.16.1",
57
57
  "callsites": "3.1.0",