@n8n/expression-runtime 0.22.1 → 0.23.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/bridge/bridge-messages.d.ts +8 -8
- package/dist/cjs/bridge/bridge-messages.js +234 -244
- package/dist/cjs/bridge/bridge-messages.js.map +1 -1
- package/dist/cjs/bridge/isolated-vm-bridge.d.ts.map +1 -1
- package/dist/cjs/bridge/isolated-vm-bridge.js +644 -654
- package/dist/cjs/bridge/isolated-vm-bridge.js.map +1 -1
- package/dist/cjs/build.tsbuildinfo +1 -1
- package/dist/cjs/evaluator/error-classification.js +15 -25
- package/dist/cjs/evaluator/error-classification.js.map +1 -1
- package/dist/cjs/evaluator/expression-evaluator.d.ts.map +1 -1
- package/dist/cjs/evaluator/expression-evaluator.js +152 -162
- package/dist/cjs/evaluator/expression-evaluator.js.map +1 -1
- package/dist/cjs/evaluator/lru-cache.d.ts.map +1 -1
- package/dist/cjs/evaluator/lru-cache.js +35 -45
- package/dist/cjs/evaluator/lru-cache.js.map +1 -1
- package/dist/cjs/extensions/array-extensions.js +589 -599
- package/dist/cjs/extensions/array-extensions.js.map +1 -1
- package/dist/cjs/extensions/boolean-extensions.js +38 -48
- package/dist/cjs/extensions/boolean-extensions.js.map +1 -1
- package/dist/cjs/extensions/date-extensions.js +500 -510
- package/dist/cjs/extensions/date-extensions.js.map +1 -1
- package/dist/cjs/extensions/expression-extension-error.d.ts.map +1 -1
- package/dist/cjs/extensions/expression-extension-error.js +12 -22
- package/dist/cjs/extensions/expression-extension-error.js.map +1 -1
- package/dist/cjs/extensions/extend.js +162 -172
- package/dist/cjs/extensions/extend.js.map +1 -1
- package/dist/cjs/extensions/extensions.js +2 -12
- package/dist/cjs/extensions/function-extensions.d.ts +10 -18
- package/dist/cjs/extensions/function-extensions.d.ts.map +1 -1
- package/dist/cjs/extensions/function-extensions.js +78 -88
- package/dist/cjs/extensions/function-extensions.js.map +1 -1
- package/dist/cjs/extensions/number-extensions.js +225 -235
- package/dist/cjs/extensions/number-extensions.js.map +1 -1
- package/dist/cjs/extensions/object-extensions.js +286 -296
- package/dist/cjs/extensions/object-extensions.js.map +1 -1
- package/dist/cjs/extensions/string-extensions.d.ts +1 -1
- package/dist/cjs/extensions/string-extensions.d.ts.map +1 -1
- package/dist/cjs/extensions/string-extensions.js +758 -768
- package/dist/cjs/extensions/string-extensions.js.map +1 -1
- package/dist/cjs/extensions/utils.d.ts.map +1 -1
- package/dist/cjs/extensions/utils.js +28 -38
- package/dist/cjs/extensions/utils.js.map +1 -1
- package/dist/cjs/index.js +32 -42
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/observability/metrics.d.ts +27 -27
- package/dist/cjs/observability/metrics.d.ts.map +1 -1
- package/dist/cjs/observability/metrics.js +59 -69
- package/dist/cjs/observability/metrics.js.map +1 -1
- package/dist/cjs/observability/noop-provider.js +28 -38
- package/dist/cjs/observability/noop-provider.js.map +1 -1
- package/dist/cjs/pool/idle-scaling-pool.d.ts.map +1 -1
- package/dist/cjs/pool/idle-scaling-pool.js +134 -144
- package/dist/cjs/pool/idle-scaling-pool.js.map +1 -1
- package/dist/cjs/pool/isolate-pool.d.ts.map +1 -1
- package/dist/cjs/pool/isolate-pool.js +101 -111
- package/dist/cjs/pool/isolate-pool.js.map +1 -1
- package/dist/cjs/runtime/context.js +418 -428
- package/dist/cjs/runtime/context.js.map +1 -1
- package/dist/cjs/runtime/index.js +26 -36
- package/dist/cjs/runtime/index.js.map +1 -1
- package/dist/cjs/runtime/jmespath.js +72 -82
- package/dist/cjs/runtime/jmespath.js.map +1 -1
- package/dist/cjs/runtime/lazy-proxy.js +238 -248
- package/dist/cjs/runtime/lazy-proxy.js.map +1 -1
- package/dist/cjs/runtime/safe-globals.d.ts.map +1 -1
- package/dist/cjs/runtime/safe-globals.js +134 -144
- package/dist/cjs/runtime/safe-globals.js.map +1 -1
- package/dist/cjs/runtime/serialize.js +54 -64
- package/dist/cjs/runtime/serialize.js.map +1 -1
- package/dist/cjs/runtime/utils.js +20 -30
- package/dist/cjs/runtime/utils.js.map +1 -1
- package/dist/cjs/types/bridge.js +15 -25
- package/dist/cjs/types/bridge.js.map +1 -1
- package/dist/cjs/types/evaluator.d.ts.map +1 -1
- package/dist/cjs/types/evaluator.js +35 -45
- package/dist/cjs/types/evaluator.js.map +1 -1
- package/dist/cjs/types/index.js +14 -24
- package/dist/cjs/types/index.js.map +1 -1
- package/dist/cjs/types/runtime.d.ts.map +1 -1
- package/dist/cjs/types/runtime.js +27 -37
- package/dist/cjs/types/runtime.js.map +1 -1
- package/dist/esm/bridge/bridge-messages.d.ts +8 -8
- package/dist/esm/bridge/isolated-vm-bridge.d.ts.map +1 -1
- package/dist/esm/bridge/isolated-vm-bridge.js.map +1 -1
- package/dist/esm/build.tsbuildinfo +1 -1
- package/dist/esm/evaluator/expression-evaluator.d.ts.map +1 -1
- package/dist/esm/evaluator/lru-cache.d.ts.map +1 -1
- package/dist/esm/evaluator/lru-cache.js.map +1 -1
- package/dist/esm/extensions/expression-extension-error.d.ts.map +1 -1
- package/dist/esm/extensions/function-extensions.d.ts +10 -18
- package/dist/esm/extensions/function-extensions.d.ts.map +1 -1
- package/dist/esm/extensions/number-extensions.js.map +1 -1
- package/dist/esm/extensions/string-extensions.d.ts +1 -1
- package/dist/esm/extensions/string-extensions.d.ts.map +1 -1
- package/dist/esm/extensions/string-extensions.js.map +1 -1
- package/dist/esm/extensions/utils.d.ts.map +1 -1
- package/dist/esm/observability/metrics.d.ts +27 -27
- package/dist/esm/observability/metrics.d.ts.map +1 -1
- package/dist/esm/pool/idle-scaling-pool.d.ts.map +1 -1
- package/dist/esm/pool/idle-scaling-pool.js.map +1 -1
- package/dist/esm/pool/isolate-pool.d.ts.map +1 -1
- package/dist/esm/pool/isolate-pool.js.map +1 -1
- package/dist/esm/runtime/lazy-proxy.js.map +1 -1
- package/dist/esm/runtime/safe-globals.d.ts.map +1 -1
- package/dist/esm/types/evaluator.d.ts.map +1 -1
- package/dist/esm/types/evaluator.js.map +1 -1
- package/dist/esm/types/runtime.d.ts.map +1 -1
- package/dist/esm/types/runtime.js.map +1 -1
- package/package.json +7 -6
|
@@ -126,13 +126,13 @@ export declare const getItemsMessage: z.ZodObject<{
|
|
|
126
126
|
}, "strict", z.ZodTypeAny, {
|
|
127
127
|
type: "getItems";
|
|
128
128
|
nodeName?: string | undefined;
|
|
129
|
-
runIndex?: number | undefined;
|
|
130
129
|
outputIndex?: number | undefined;
|
|
130
|
+
runIndex?: number | undefined;
|
|
131
131
|
}, {
|
|
132
132
|
type: "getItems";
|
|
133
133
|
nodeName?: string | undefined;
|
|
134
|
-
runIndex?: number | undefined;
|
|
135
134
|
outputIndex?: number | undefined;
|
|
135
|
+
runIndex?: number | undefined;
|
|
136
136
|
}>;
|
|
137
137
|
/**
|
|
138
138
|
* `$fromAI(name, description?, type?, defaultValue?)` — the AI-builder
|
|
@@ -252,12 +252,12 @@ export declare const evaluateExpressionMessage: z.ZodObject<{
|
|
|
252
252
|
expression: z.ZodString;
|
|
253
253
|
itemIndex: z.ZodOptional<z.ZodNumber>;
|
|
254
254
|
}, "strict", z.ZodTypeAny, {
|
|
255
|
-
expression: string;
|
|
256
255
|
type: "evaluateExpression";
|
|
256
|
+
expression: string;
|
|
257
257
|
itemIndex?: number | undefined;
|
|
258
258
|
}, {
|
|
259
|
-
expression: string;
|
|
260
259
|
type: "evaluateExpression";
|
|
260
|
+
expression: string;
|
|
261
261
|
itemIndex?: number | undefined;
|
|
262
262
|
}>;
|
|
263
263
|
/**
|
|
@@ -436,13 +436,13 @@ export declare const bridgeMessageSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
|
|
|
436
436
|
}, "strict", z.ZodTypeAny, {
|
|
437
437
|
type: "getItems";
|
|
438
438
|
nodeName?: string | undefined;
|
|
439
|
-
runIndex?: number | undefined;
|
|
440
439
|
outputIndex?: number | undefined;
|
|
440
|
+
runIndex?: number | undefined;
|
|
441
441
|
}, {
|
|
442
442
|
type: "getItems";
|
|
443
443
|
nodeName?: string | undefined;
|
|
444
|
-
runIndex?: number | undefined;
|
|
445
444
|
outputIndex?: number | undefined;
|
|
445
|
+
runIndex?: number | undefined;
|
|
446
446
|
}>, z.ZodObject<{
|
|
447
447
|
type: z.ZodLiteral<"fromAi">;
|
|
448
448
|
name: z.ZodOptional<z.ZodString>;
|
|
@@ -499,12 +499,12 @@ export declare const bridgeMessageSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
|
|
|
499
499
|
expression: z.ZodString;
|
|
500
500
|
itemIndex: z.ZodOptional<z.ZodNumber>;
|
|
501
501
|
}, "strict", z.ZodTypeAny, {
|
|
502
|
-
expression: string;
|
|
503
502
|
type: "evaluateExpression";
|
|
503
|
+
expression: string;
|
|
504
504
|
itemIndex?: number | undefined;
|
|
505
505
|
}, {
|
|
506
|
-
expression: string;
|
|
507
506
|
type: "evaluateExpression";
|
|
507
|
+
expression: string;
|
|
508
508
|
itemIndex?: number | undefined;
|
|
509
509
|
}>, z.ZodObject<{
|
|
510
510
|
type: z.ZodLiteral<"getPairedItem">;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* Schemas for messages the in-isolate runtime sends to the host via the
|
|
3
4
|
* `callHost` typed-RPC dispatcher.
|
|
@@ -16,248 +17,237 @@
|
|
|
16
17
|
* Each additional typed RPC lands as a new schema here plus a new `case`
|
|
17
18
|
* in the bridge's dispatcher switch.
|
|
18
19
|
*/
|
|
19
|
-
(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
exports.
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
exports.getInputLastMessage,
|
|
253
|
-
exports.getInputAllMessage,
|
|
254
|
-
exports.getItemsMessage,
|
|
255
|
-
exports.fromAiMessage,
|
|
256
|
-
exports.getNodePairedItemMessage,
|
|
257
|
-
exports.getNodeItemMatchingMessage,
|
|
258
|
-
exports.getNodeItemMessage,
|
|
259
|
-
exports.evaluateExpressionMessage,
|
|
260
|
-
exports.getPairedItemMessage,
|
|
261
|
-
]);
|
|
262
|
-
});
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.bridgeMessageSchema = exports.getPairedItemMessage = exports.evaluateExpressionMessage = exports.getNodeItemMessage = exports.getNodeItemMatchingMessage = exports.getNodePairedItemMessage = exports.fromAiMessage = exports.getItemsMessage = exports.getInputAllMessage = exports.getInputLastMessage = exports.getInputFirstMessage = exports.getNodeAllMessage = exports.getNodeLastMessage = exports.getNodeFirstMessage = void 0;
|
|
22
|
+
const zod_1 = require("zod");
|
|
23
|
+
/**
|
|
24
|
+
* `$('NodeName').first(branchIndex?, runIndex?)` — fetch the first item of
|
|
25
|
+
* a named node's most recent execution data.
|
|
26
|
+
*/
|
|
27
|
+
exports.getNodeFirstMessage = zod_1.z
|
|
28
|
+
.object({
|
|
29
|
+
type: zod_1.z.literal('getNodeFirst'),
|
|
30
|
+
nodeName: zod_1.z.string(),
|
|
31
|
+
branchIndex: zod_1.z.number().int().nonnegative().optional(),
|
|
32
|
+
runIndex: zod_1.z.number().int().nonnegative().optional(),
|
|
33
|
+
})
|
|
34
|
+
.strict();
|
|
35
|
+
/**
|
|
36
|
+
* `$('NodeName').last(branchIndex?, runIndex?)` — fetch the last item of
|
|
37
|
+
* a named node's most recent execution data.
|
|
38
|
+
*/
|
|
39
|
+
exports.getNodeLastMessage = zod_1.z
|
|
40
|
+
.object({
|
|
41
|
+
type: zod_1.z.literal('getNodeLast'),
|
|
42
|
+
nodeName: zod_1.z.string(),
|
|
43
|
+
branchIndex: zod_1.z.number().int().nonnegative().optional(),
|
|
44
|
+
runIndex: zod_1.z.number().int().nonnegative().optional(),
|
|
45
|
+
})
|
|
46
|
+
.strict();
|
|
47
|
+
/**
|
|
48
|
+
* `$('NodeName').all(branchIndex?, runIndex?)` — fetch every item of a
|
|
49
|
+
* named node's most recent execution data as an array.
|
|
50
|
+
*/
|
|
51
|
+
exports.getNodeAllMessage = zod_1.z
|
|
52
|
+
.object({
|
|
53
|
+
type: zod_1.z.literal('getNodeAll'),
|
|
54
|
+
nodeName: zod_1.z.string(),
|
|
55
|
+
branchIndex: zod_1.z.number().int().nonnegative().optional(),
|
|
56
|
+
runIndex: zod_1.z.number().int().nonnegative().optional(),
|
|
57
|
+
})
|
|
58
|
+
.strict();
|
|
59
|
+
/**
|
|
60
|
+
* `$input.first()` — fetch the first item of the current node's input.
|
|
61
|
+
* Host enforces zero arguments; the schema has no fields besides `type`.
|
|
62
|
+
*/
|
|
63
|
+
exports.getInputFirstMessage = zod_1.z.object({ type: zod_1.z.literal('getInputFirst') }).strict();
|
|
64
|
+
/**
|
|
65
|
+
* `$input.last()` — fetch the last item of the current node's input.
|
|
66
|
+
*/
|
|
67
|
+
exports.getInputLastMessage = zod_1.z.object({ type: zod_1.z.literal('getInputLast') }).strict();
|
|
68
|
+
/**
|
|
69
|
+
* `$input.all()` — fetch every item of the current node's input.
|
|
70
|
+
*/
|
|
71
|
+
exports.getInputAllMessage = zod_1.z.object({ type: zod_1.z.literal('getInputAll') }).strict();
|
|
72
|
+
/**
|
|
73
|
+
* `$items(nodeName?, outputIndex?, runIndex?)` — fetch the execution data of
|
|
74
|
+
* a node by name (or the current node's input if `nodeName` is omitted).
|
|
75
|
+
*
|
|
76
|
+
* `runIndex` accepts negative values: the host uses `-1` as a sentinel for
|
|
77
|
+
* "latest run" (see `WorkflowDataProxy.$items` —
|
|
78
|
+
* `runIndex === undefined ? -1 : runIndex`). The schema uses
|
|
79
|
+
* `z.number().int()` without `.nonnegative()` so expressions can pass `-1`
|
|
80
|
+
* explicitly if they need to.
|
|
81
|
+
*/
|
|
82
|
+
exports.getItemsMessage = zod_1.z
|
|
83
|
+
.object({
|
|
84
|
+
type: zod_1.z.literal('getItems'),
|
|
85
|
+
nodeName: zod_1.z.string().optional(),
|
|
86
|
+
outputIndex: zod_1.z.number().int().nonnegative().optional(),
|
|
87
|
+
runIndex: zod_1.z.number().int().optional(),
|
|
88
|
+
})
|
|
89
|
+
.strict();
|
|
90
|
+
/**
|
|
91
|
+
* `$fromAI(name, description?, type?, defaultValue?)` — the AI-builder
|
|
92
|
+
* placeholder accessor (aliases: `$fromAi`, `$fromai`).
|
|
93
|
+
*
|
|
94
|
+
* Two deliberate looseness points in this schema, both to preserve host
|
|
95
|
+
* contract / parity:
|
|
96
|
+
*
|
|
97
|
+
* 1. `name` is `z.string().optional()` (not required) so a call missing
|
|
98
|
+
* the argument or passing an empty string reaches the host, which
|
|
99
|
+
* throws the user-friendly `ExpressionError("Add a key, e.g. $fromAI('placeholder_name')")`.
|
|
100
|
+
* Requiring it here would replace that error with a generic zod
|
|
101
|
+
* message. The host also validates the regex `[a-zA-Z0-9_-]{0,64}`;
|
|
102
|
+
* we don't pre-empt that either.
|
|
103
|
+
* 2. `defaultValue` is `z.unknown()` because the host accepts any value
|
|
104
|
+
* as the fallback return (`handleFromAi` returns it directly via
|
|
105
|
+
* `??`). Structured-clone at the bridge boundary still prevents
|
|
106
|
+
* functions and other non-cloneable values from crossing.
|
|
107
|
+
*
|
|
108
|
+
* `description` and `type` are forwarded even though the host currently
|
|
109
|
+
* ignores them (`_description`, `_type`), so the protocol matches the
|
|
110
|
+
* documented call signature.
|
|
111
|
+
*/
|
|
112
|
+
exports.fromAiMessage = zod_1.z
|
|
113
|
+
.object({
|
|
114
|
+
type: zod_1.z.literal('fromAi'),
|
|
115
|
+
name: zod_1.z.string().optional(),
|
|
116
|
+
description: zod_1.z.string().optional(),
|
|
117
|
+
valueType: zod_1.z.string().optional(),
|
|
118
|
+
// `z.unknown()` already accepts `undefined`, so no `.optional()` needed.
|
|
119
|
+
defaultValue: zod_1.z.unknown(),
|
|
120
|
+
})
|
|
121
|
+
.strict();
|
|
122
|
+
/**
|
|
123
|
+
* `$('NodeName').pairedItem(itemIndex?)` / `.itemMatching(itemIndex)` /
|
|
124
|
+
* `.item` — resolve the paired item for a referenced node.
|
|
125
|
+
*
|
|
126
|
+
* All three host-side surface forms share one internal resolver
|
|
127
|
+
* (`pairedItemMethod` in `WorkflowDataProxy`), but the resolver closes
|
|
128
|
+
* over the literal property name the bridge accessed on the host proxy
|
|
129
|
+
* — so the error message and getter-vs-method form depend on *which*
|
|
130
|
+
* property the bridge reads. Three separate discriminators, each
|
|
131
|
+
* mapping a handler to a fixed literal property name, are the only way
|
|
132
|
+
* to preserve the host's friendly errors (e.g. "Missing item index for
|
|
133
|
+
* .itemMatching()") and the `.item` getter semantics without
|
|
134
|
+
* duplicating logic in-isolate.
|
|
135
|
+
*
|
|
136
|
+
* `itemIndex` is optional on all three at the schema level; the host
|
|
137
|
+
* throws the appropriate `ExpressionError` when it's missing for
|
|
138
|
+
* `.itemMatching()`, and applies the current-itemIndex default for
|
|
139
|
+
* `.pairedItem` and `.item`.
|
|
140
|
+
*/
|
|
141
|
+
exports.getNodePairedItemMessage = zod_1.z
|
|
142
|
+
.object({
|
|
143
|
+
type: zod_1.z.literal('getNodePairedItem'),
|
|
144
|
+
nodeName: zod_1.z.string(),
|
|
145
|
+
itemIndex: zod_1.z.number().int().nonnegative().optional(),
|
|
146
|
+
})
|
|
147
|
+
.strict();
|
|
148
|
+
/**
|
|
149
|
+
* `itemIndex` is `.optional()` even though `.itemMatching()` requires it
|
|
150
|
+
* at the host. The host's `pairedItemMethod` closure throws the friendly
|
|
151
|
+
* `"Missing item index for .itemMatching()"` error when the field is
|
|
152
|
+
* absent — keeping the schema permissive lets that host error surface
|
|
153
|
+
* verbatim instead of being replaced by a generic zod parse failure.
|
|
154
|
+
*/
|
|
155
|
+
exports.getNodeItemMatchingMessage = zod_1.z
|
|
156
|
+
.object({
|
|
157
|
+
type: zod_1.z.literal('getNodeItemMatching'),
|
|
158
|
+
nodeName: zod_1.z.string(),
|
|
159
|
+
itemIndex: zod_1.z.number().int().nonnegative().optional(),
|
|
160
|
+
})
|
|
161
|
+
.strict();
|
|
162
|
+
exports.getNodeItemMessage = zod_1.z
|
|
163
|
+
.object({
|
|
164
|
+
type: zod_1.z.literal('getNodeItem'),
|
|
165
|
+
nodeName: zod_1.z.string(),
|
|
166
|
+
})
|
|
167
|
+
.strict();
|
|
168
|
+
/**
|
|
169
|
+
* `$evaluateExpression(expression, itemIndex?)` — evaluate a nested
|
|
170
|
+
* expression string at runtime against the same execution context.
|
|
171
|
+
*
|
|
172
|
+
* The host recursively invokes the expression engine on the `expression`
|
|
173
|
+
* string — under the VM engine this re-enters the bridge with a fresh
|
|
174
|
+
* evaluation. `itemIndex` is optional and defaults to the current item;
|
|
175
|
+
* the schema mirrors the existing "nonnegative int" constraint used by
|
|
176
|
+
* the node-data RPCs.
|
|
177
|
+
*/
|
|
178
|
+
exports.evaluateExpressionMessage = zod_1.z
|
|
179
|
+
.object({
|
|
180
|
+
type: zod_1.z.literal('evaluateExpression'),
|
|
181
|
+
expression: zod_1.z.string(),
|
|
182
|
+
itemIndex: zod_1.z.number().int().nonnegative().optional(),
|
|
183
|
+
})
|
|
184
|
+
.strict();
|
|
185
|
+
/**
|
|
186
|
+
* `ISourceData` — the source record that accompanies a paired-item
|
|
187
|
+
* traversal step. Mirrors the host interface used by
|
|
188
|
+
* `WorkflowDataProxy.getPairedItem`.
|
|
189
|
+
*/
|
|
190
|
+
const sourceDataSchema = zod_1.z
|
|
191
|
+
.object({
|
|
192
|
+
previousNode: zod_1.z.string(),
|
|
193
|
+
previousNodeOutput: zod_1.z.number().int().nonnegative().optional(),
|
|
194
|
+
previousNodeRun: zod_1.z.number().int().nonnegative().optional(),
|
|
195
|
+
})
|
|
196
|
+
.strict();
|
|
197
|
+
/**
|
|
198
|
+
* `IPairedItemData` — one paired-item record. `sourceOverwrite` lets a
|
|
199
|
+
* node override the upstream source while the helper walks the ancestry
|
|
200
|
+
* chain; the field is optional and recurses through the same schema.
|
|
201
|
+
*/
|
|
202
|
+
const pairedItemDataSchema = zod_1.z
|
|
203
|
+
.object({
|
|
204
|
+
item: zod_1.z.number().int().nonnegative(),
|
|
205
|
+
input: zod_1.z.number().int().nonnegative().optional(),
|
|
206
|
+
sourceOverwrite: sourceDataSchema.optional(),
|
|
207
|
+
})
|
|
208
|
+
.strict();
|
|
209
|
+
/**
|
|
210
|
+
* `$getPairedItem(destinationNodeName, incomingSourceData, initialPairedItem)` —
|
|
211
|
+
* traverse the paired-item ancestry chain back to the named upstream node
|
|
212
|
+
* and return the matching execution item.
|
|
213
|
+
*
|
|
214
|
+
* Two host-side fields are deliberately omitted from the schema:
|
|
215
|
+
* - `usedMethodName` defaults to `$getPairedItem` on the host; the isolate
|
|
216
|
+
* has no reason to spoof a different method name in the error path.
|
|
217
|
+
* - `nodeBeforeLast` is an internal recursion argument; only the host
|
|
218
|
+
* itself sets it during the recursive walk.
|
|
219
|
+
*
|
|
220
|
+
* `incomingSourceData` is nullable because the host's signature accepts
|
|
221
|
+
* `ISourceData | null` (and throws a paired-item-not-found error when null).
|
|
222
|
+
*/
|
|
223
|
+
exports.getPairedItemMessage = zod_1.z
|
|
224
|
+
.object({
|
|
225
|
+
type: zod_1.z.literal('getPairedItem'),
|
|
226
|
+
destinationNodeName: zod_1.z.string(),
|
|
227
|
+
incomingSourceData: sourceDataSchema.nullable(),
|
|
228
|
+
initialPairedItem: pairedItemDataSchema,
|
|
229
|
+
})
|
|
230
|
+
.strict();
|
|
231
|
+
/**
|
|
232
|
+
* The full set of messages the bridge will accept. Discriminator is `type`.
|
|
233
|
+
*
|
|
234
|
+
* Use `.strict()` on each member so unknown fields are rejected rather than
|
|
235
|
+
* silently ignored — this catches typos in the runtime stubs and keeps the
|
|
236
|
+
* protocol surface tight.
|
|
237
|
+
*/
|
|
238
|
+
exports.bridgeMessageSchema = zod_1.z.discriminatedUnion('type', [
|
|
239
|
+
exports.getNodeFirstMessage,
|
|
240
|
+
exports.getNodeLastMessage,
|
|
241
|
+
exports.getNodeAllMessage,
|
|
242
|
+
exports.getInputFirstMessage,
|
|
243
|
+
exports.getInputLastMessage,
|
|
244
|
+
exports.getInputAllMessage,
|
|
245
|
+
exports.getItemsMessage,
|
|
246
|
+
exports.fromAiMessage,
|
|
247
|
+
exports.getNodePairedItemMessage,
|
|
248
|
+
exports.getNodeItemMatchingMessage,
|
|
249
|
+
exports.getNodeItemMessage,
|
|
250
|
+
exports.evaluateExpressionMessage,
|
|
251
|
+
exports.getPairedItemMessage,
|
|
252
|
+
]);
|
|
263
253
|
//# sourceMappingURL=bridge-messages.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bridge-messages.js","sourceRoot":"","sources":["../../../src/bridge/bridge-messages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG
|
|
1
|
+
{"version":3,"file":"bridge-messages.js","sourceRoot":"","sources":["../../../src/bridge/bridge-messages.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAEH,6BAAwB;AAExB;;;GAGG;AACU,QAAA,mBAAmB,GAAG,OAAC;KAClC,MAAM,CAAC;IACP,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,cAAc,CAAC;IAC/B,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE;IACpB,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;IACtD,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;CACnD,CAAC;KACD,MAAM,EAAE,CAAC;AAEX;;;GAGG;AACU,QAAA,kBAAkB,GAAG,OAAC;KAC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eAAe,EAAE,gBAAgB,CAAC,QAAQ,EAAE;CAC5C,CAAC;KACD,MAAM,EAAE,CAAC;AAEX;;;;;;;;;;;;;GAaG;AACU,QAAA,oBAAoB,GAAG,OAAC;KACnC,MAAM,CAAC;IACP,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,eAAe,CAAC;IAChC,mBAAmB,EAAE,OAAC,CAAC,MAAM,EAAE;IAC/B,kBAAkB,EAAE,gBAAgB,CAAC,QAAQ,EAAE;IAC/C,iBAAiB,EAAE,oBAAoB;CACvC,CAAC;KACD,MAAM,EAAE,CAAC;AAEX;;;;;;GAMG;AACU,QAAA,mBAAmB,GAAG,OAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IAC/D,QAAA,mBAAmB;IACnB,QAAA,kBAAkB;IAClB,QAAA,iBAAiB;IACjB,QAAA,oBAAoB;IACpB,QAAA,mBAAmB;IACnB,QAAA,kBAAkB;IAClB,QAAA,eAAe;IACf,QAAA,aAAa;IACb,QAAA,wBAAwB;IACxB,QAAA,0BAA0B;IAC1B,QAAA,kBAAkB;IAClB,QAAA,yBAAyB;IACzB,QAAA,oBAAoB;CACpB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isolated-vm-bridge.d.ts","sourceRoot":"","sources":["../../../src/bridge/isolated-vm-bridge.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AA2E1F;;;;;;;;;;GAUG;AACH,qBAAa,gBAAiB,YAAW,aAAa;IACrD,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,OAAO,CAAC,CAAc;IAC9B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,MAAM,CAAyB;IACvC,OAAO,CAAC,MAAM,CAAmC;
|
|
1
|
+
{"version":3,"file":"isolated-vm-bridge.d.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