@atom8n/n8n-workflow 2.4.3 → 2.5.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.
@@ -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
+ }
File without changes
@@ -742,6 +742,7 @@ export interface ILoadOptionsFunctions extends FunctionsBase {
742
742
  export type FieldValueOption = {
743
743
  name: string;
744
744
  type: FieldType | 'any';
745
+ defaultValue?: string;
745
746
  };
746
747
  export type IWorkflowNodeContext = ExecuteFunctions.GetNodeParameterFn & Pick<FunctionsBase, 'getNode' | 'getWorkflow'>;
747
748
  export interface ILocalLoadOptionsFunctions {
@@ -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
+ }