@n8n/expression-runtime 0.7.0 → 0.9.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/bundle/runtime.esm.js +17 -17
- package/dist/bundle/runtime.esm.js.map +4 -4
- package/dist/bundle/runtime.iife.js +17 -17
- package/dist/bundle/runtime.iife.js.map +4 -4
- package/dist/cjs/bridge/isolated-vm-bridge.d.ts +48 -34
- package/dist/cjs/bridge/isolated-vm-bridge.d.ts.map +1 -1
- package/dist/cjs/bridge/isolated-vm-bridge.js +285 -236
- package/dist/cjs/bridge/isolated-vm-bridge.js.map +1 -1
- package/dist/cjs/build.tsbuildinfo +1 -1
- package/dist/cjs/evaluator/expression-evaluator.d.ts +8 -1
- package/dist/cjs/evaluator/expression-evaluator.d.ts.map +1 -1
- package/dist/cjs/evaluator/expression-evaluator.js +62 -6
- package/dist/cjs/evaluator/expression-evaluator.js.map +1 -1
- package/dist/cjs/extensions/boolean-extensions.d.ts +1 -1
- package/dist/cjs/extensions/object-extensions.d.ts.map +1 -1
- package/dist/cjs/extensions/object-extensions.js +8 -4
- package/dist/cjs/extensions/object-extensions.js.map +1 -1
- package/dist/cjs/index.d.ts +2 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +4 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/pool/isolate-pool.d.ts +35 -0
- package/dist/cjs/pool/isolate-pool.d.ts.map +1 -0
- package/dist/cjs/pool/isolate-pool.js +123 -0
- package/dist/cjs/pool/isolate-pool.js.map +1 -0
- package/dist/cjs/runtime/context.d.ts +18 -0
- package/dist/cjs/runtime/context.d.ts.map +1 -0
- package/dist/cjs/runtime/{reset.js → context.js} +95 -100
- package/dist/cjs/runtime/context.js.map +1 -0
- package/dist/cjs/runtime/index.d.ts +1 -19
- package/dist/cjs/runtime/index.d.ts.map +1 -1
- package/dist/cjs/runtime/index.js +3 -5
- package/dist/cjs/runtime/index.js.map +1 -1
- package/dist/cjs/runtime/lazy-proxy.d.ts +28 -3
- package/dist/cjs/runtime/lazy-proxy.d.ts.map +1 -1
- package/dist/cjs/runtime/lazy-proxy.js +84 -16
- package/dist/cjs/runtime/lazy-proxy.js.map +1 -1
- package/dist/cjs/types/bridge.d.ts +12 -7
- package/dist/cjs/types/bridge.d.ts.map +1 -1
- package/dist/cjs/types/bridge.js +7 -1
- package/dist/cjs/types/bridge.js.map +1 -1
- package/dist/cjs/types/evaluator.d.ts +24 -14
- package/dist/cjs/types/evaluator.d.ts.map +1 -1
- package/dist/cjs/types/evaluator.js.map +1 -1
- package/dist/cjs/types/index.d.ts +1 -1
- package/dist/cjs/types/index.d.ts.map +1 -1
- package/dist/esm/bridge/isolated-vm-bridge.d.ts +48 -34
- package/dist/esm/bridge/isolated-vm-bridge.d.ts.map +1 -1
- package/dist/esm/bridge/isolated-vm-bridge.js +285 -236
- 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 +8 -1
- package/dist/esm/evaluator/expression-evaluator.d.ts.map +1 -1
- package/dist/esm/evaluator/expression-evaluator.js +61 -5
- package/dist/esm/evaluator/expression-evaluator.js.map +1 -1
- package/dist/esm/extensions/object-extensions.d.ts.map +1 -1
- package/dist/esm/extensions/object-extensions.js +8 -4
- package/dist/esm/extensions/object-extensions.js.map +1 -1
- package/dist/esm/index.d.ts +2 -1
- 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/pool/isolate-pool.d.ts +35 -0
- package/dist/esm/pool/isolate-pool.d.ts.map +1 -0
- package/dist/esm/pool/isolate-pool.js +107 -0
- package/dist/esm/pool/isolate-pool.js.map +1 -0
- package/dist/esm/runtime/context.d.ts +18 -0
- package/dist/esm/runtime/context.d.ts.map +1 -0
- package/dist/esm/runtime/{reset.js → context.js} +95 -100
- package/dist/esm/runtime/context.js.map +1 -0
- package/dist/esm/runtime/index.d.ts +1 -19
- package/dist/esm/runtime/index.d.ts.map +1 -1
- package/dist/esm/runtime/index.js +2 -4
- package/dist/esm/runtime/index.js.map +1 -1
- package/dist/esm/runtime/lazy-proxy.d.ts +28 -3
- package/dist/esm/runtime/lazy-proxy.d.ts.map +1 -1
- package/dist/esm/runtime/lazy-proxy.js +83 -16
- package/dist/esm/runtime/lazy-proxy.js.map +1 -1
- package/dist/esm/types/bridge.d.ts +12 -7
- package/dist/esm/types/bridge.d.ts.map +1 -1
- package/dist/esm/types/bridge.js +7 -1
- package/dist/esm/types/bridge.js.map +1 -1
- package/dist/esm/types/evaluator.d.ts +24 -14
- package/dist/esm/types/evaluator.d.ts.map +1 -1
- package/dist/esm/types/evaluator.js.map +1 -1
- package/dist/esm/types/index.d.ts +1 -1
- package/dist/esm/types/index.d.ts.map +1 -1
- package/package.json +10 -7
- package/dist/cjs/runtime/reset.d.ts +0 -16
- package/dist/cjs/runtime/reset.d.ts.map +0 -1
- package/dist/cjs/runtime/reset.js.map +0 -1
- package/dist/esm/runtime/reset.d.ts +0 -16
- package/dist/esm/runtime/reset.d.ts.map +0 -1
- package/dist/esm/runtime/reset.js.map +0 -1
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.buildContext = buildContext;
|
|
13
13
|
const luxon_1 = require("luxon");
|
|
14
14
|
const extend_1 = require("../extensions/extend");
|
|
15
15
|
const function_extensions_1 = require("../extensions/function-extensions");
|
|
@@ -23,33 +23,36 @@
|
|
|
23
23
|
const SafeReferenceError = (0, safe_globals_1.createSafeErrorSubclass)(ReferenceError);
|
|
24
24
|
const SafeURIError = (0, safe_globals_1.createSafeErrorSubclass)(URIError);
|
|
25
25
|
// ============================================================================
|
|
26
|
-
//
|
|
26
|
+
// Build Context Function
|
|
27
27
|
// ============================================================================
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* Build a fresh, closure-scoped evaluation context.
|
|
30
30
|
*
|
|
31
|
-
* This function
|
|
32
|
-
*
|
|
31
|
+
* This function creates a context object that contains everything needed to
|
|
32
|
+
* evaluate an expression, without touching any global mutable state
|
|
33
|
+
* (except luxon's Settings.defaultZone which is process-wide).
|
|
33
34
|
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* 2. Fetch primitives directly ($runIndex, $itemIndex)
|
|
37
|
-
* 3. Create function wrappers for callable properties ($items, etc.)
|
|
38
|
-
* 4. Expose all properties to globalThis for expression access
|
|
35
|
+
* The returned object is used as tournament's `this` context in the
|
|
36
|
+
* evalClosureSync wrapper.
|
|
39
37
|
*
|
|
40
|
-
*
|
|
38
|
+
* @param getValueAtPath - ivm.Reference for fetching values by path
|
|
39
|
+
* @param getArrayElement - ivm.Reference for fetching array elements
|
|
40
|
+
* @param callFunctionAtPath - ivm.Reference for calling functions by path
|
|
41
|
+
* @param timezone - Optional IANA timezone string
|
|
42
|
+
* @returns A context object with all workflow data, proxies, and builtins
|
|
41
43
|
*/
|
|
42
|
-
function
|
|
44
|
+
function buildContext(getValueAtPath, getArrayElement, callFunctionAtPath, timezone) {
|
|
43
45
|
if (timezone && !luxon_1.IANAZone.isValidZone(timezone)) {
|
|
44
46
|
throw new Error(`Invalid timezone: "${timezone}"`);
|
|
45
47
|
}
|
|
46
48
|
luxon_1.Settings.defaultZone = timezone ?? 'system';
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
//
|
|
49
|
+
const ctx = {};
|
|
50
|
+
// Callback bundle passed to createDeepLazyProxy so proxies don't touch globalThis
|
|
51
|
+
const callbacks = { getValueAtPath, getArrayElement, callFunctionAtPath };
|
|
52
|
+
// __sanitize must be on the context because PrototypeSanitizer generates:
|
|
53
|
+
// obj[this.__sanitize(expr)] where 'this' is the context (via .call(ctx) wrapping)
|
|
51
54
|
// Use a non-writable property descriptor so override attempts throw instead of silently succeeding.
|
|
52
|
-
Object.defineProperty(
|
|
55
|
+
Object.defineProperty(ctx, '__sanitize', {
|
|
53
56
|
get: () => safe_globals_1.__sanitize,
|
|
54
57
|
set: () => {
|
|
55
58
|
throw new safe_globals_1.ExpressionError('Cannot override "__sanitize" due to security concerns');
|
|
@@ -57,125 +60,117 @@
|
|
|
57
60
|
enumerable: false,
|
|
58
61
|
configurable: false,
|
|
59
62
|
});
|
|
60
|
-
// Verify callbacks are available
|
|
61
|
-
// Note: ivm.Reference may not be typeof 'function', check for existence
|
|
62
|
-
if (!globalThis.__getValueAtPath) {
|
|
63
|
-
throw new Error('__getValueAtPath callback not registered');
|
|
64
|
-
}
|
|
65
63
|
// -------------------------------------------------------------------------
|
|
66
64
|
// Create lazy proxies for complex workflow properties
|
|
67
65
|
// -------------------------------------------------------------------------
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
66
|
+
ctx.$json = (0, lazy_proxy_1.createDeepLazyProxy)(['$json'], undefined, callbacks);
|
|
67
|
+
ctx.$binary = (0, lazy_proxy_1.createDeepLazyProxy)(['$binary'], undefined, callbacks);
|
|
68
|
+
ctx.$input = (0, lazy_proxy_1.createDeepLazyProxy)(['$input'], undefined, callbacks);
|
|
69
|
+
ctx.$node = (0, lazy_proxy_1.createDeepLazyProxy)(['$node'], undefined, callbacks);
|
|
70
|
+
ctx.$parameter = (0, lazy_proxy_1.createDeepLazyProxy)(['$parameter'], undefined, callbacks);
|
|
71
|
+
ctx.$workflow = (0, lazy_proxy_1.createDeepLazyProxy)(['$workflow'], undefined, callbacks);
|
|
72
|
+
ctx.$prevNode = (0, lazy_proxy_1.createDeepLazyProxy)(['$prevNode'], undefined, callbacks);
|
|
73
|
+
ctx.$data = (0, lazy_proxy_1.createDeepLazyProxy)(['$data'], undefined, callbacks);
|
|
74
|
+
ctx.$env = (0, lazy_proxy_1.createDeepLazyProxy)(['$env'], undefined, callbacks);
|
|
75
|
+
ctx.process = (0, lazy_proxy_1.createDeepLazyProxy)(['process'], undefined, callbacks);
|
|
76
|
+
ctx.$execution = (0, lazy_proxy_1.createDeepLazyProxy)(['$execution'], undefined, callbacks);
|
|
77
|
+
ctx.$vars = (0, lazy_proxy_1.createDeepLazyProxy)(['$vars'], undefined, callbacks);
|
|
78
|
+
ctx.$secrets = (0, lazy_proxy_1.createDeepLazyProxy)(['$secrets'], undefined, callbacks);
|
|
77
79
|
// -------------------------------------------------------------------------
|
|
78
80
|
// Create DateTime values inside the isolate (not lazy-loaded from host,
|
|
79
81
|
// because host-side DateTime objects lose their prototype crossing the
|
|
80
82
|
// boundary). The isolate has its own luxon with the correct timezone
|
|
81
83
|
// already set via Settings.defaultZone above.
|
|
82
84
|
// -------------------------------------------------------------------------
|
|
83
|
-
|
|
84
|
-
|
|
85
|
+
ctx.$now = luxon_1.DateTime.now();
|
|
86
|
+
ctx.$today = luxon_1.DateTime.now().set({ hour: 0, minute: 0, second: 0, millisecond: 0 });
|
|
85
87
|
// -------------------------------------------------------------------------
|
|
86
88
|
// Fetch primitives directly (no lazy loading needed for simple values)
|
|
87
89
|
// -------------------------------------------------------------------------
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
try {
|
|
99
|
-
globalThis.__data.$itemIndex = globalThis.__getValueAtPath.applySync(null, [['$itemIndex']], {
|
|
100
|
-
arguments: { copy: true },
|
|
101
|
-
result: { copy: true },
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
catch (error) {
|
|
105
|
-
// Property doesn't exist - set to undefined
|
|
106
|
-
globalThis.__data.$itemIndex = undefined;
|
|
90
|
+
function fetchPrimitive(key) {
|
|
91
|
+
try {
|
|
92
|
+
return getValueAtPath.applySync(null, [[key]], {
|
|
93
|
+
arguments: { copy: true },
|
|
94
|
+
result: { copy: true },
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
return undefined;
|
|
99
|
+
}
|
|
107
100
|
}
|
|
101
|
+
ctx.$runIndex = fetchPrimitive('$runIndex');
|
|
102
|
+
ctx.$itemIndex = fetchPrimitive('$itemIndex');
|
|
103
|
+
ctx.$executionId = fetchPrimitive('$executionId');
|
|
104
|
+
ctx.$resumeWebhookUrl = fetchPrimitive('$resumeWebhookUrl');
|
|
105
|
+
ctx.$webhookId = fetchPrimitive('$webhookId');
|
|
106
|
+
ctx.$nodeId = fetchPrimitive('$nodeId');
|
|
107
|
+
ctx.$nodeVersion = fetchPrimitive('$nodeVersion');
|
|
108
108
|
// -------------------------------------------------------------------------
|
|
109
|
-
// Expose workflow data to globalThis for expression access
|
|
110
|
-
// -------------------------------------------------------------------------
|
|
111
|
-
globalThis.$json = globalThis.__data.$json;
|
|
112
|
-
globalThis.$binary = globalThis.__data.$binary;
|
|
113
|
-
globalThis.$input = globalThis.__data.$input;
|
|
114
|
-
globalThis.$node = globalThis.__data.$node;
|
|
115
|
-
globalThis.$parameter = globalThis.__data.$parameter;
|
|
116
|
-
globalThis.$workflow = globalThis.__data.$workflow;
|
|
117
|
-
globalThis.$prevNode = globalThis.__data.$prevNode;
|
|
118
|
-
globalThis.$runIndex = globalThis.__data.$runIndex;
|
|
119
|
-
globalThis.$itemIndex = globalThis.__data.$itemIndex;
|
|
120
|
-
globalThis.$data = globalThis.__data.$data;
|
|
121
|
-
globalThis.$env = globalThis.__data.$env;
|
|
122
|
-
globalThis.$now = globalThis.__data.$now;
|
|
123
|
-
globalThis.$today = globalThis.__data.$today;
|
|
124
109
|
// Expose standalone functions (min, max, average, numberList, zip, $ifEmpty, etc.)
|
|
125
|
-
|
|
110
|
+
// -------------------------------------------------------------------------
|
|
111
|
+
Object.assign(ctx, function_extensions_1.extendedFunctions);
|
|
126
112
|
// -------------------------------------------------------------------------
|
|
127
113
|
// Handle function properties (check if value is function metadata)
|
|
128
114
|
// -------------------------------------------------------------------------
|
|
129
|
-
//
|
|
130
|
-
|
|
115
|
+
// Probe a host-side property: if it is a function, create an isolate
|
|
116
|
+
// wrapper that forwards calls via callFunctionAtPath; otherwise copy
|
|
117
|
+
// the value as-is.
|
|
118
|
+
function exposeHostFunction(name) {
|
|
119
|
+
if (!callFunctionAtPath)
|
|
120
|
+
return;
|
|
131
121
|
try {
|
|
132
|
-
const
|
|
122
|
+
const value = getValueAtPath.applySync(null, [[name]], {
|
|
133
123
|
arguments: { copy: true },
|
|
134
124
|
result: { copy: true },
|
|
135
125
|
});
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
return globalThis.__callFunctionAtPath.applySync(null, [['$items'], ...args], {
|
|
126
|
+
if (value && typeof value === 'object' && value.__isFunction) {
|
|
127
|
+
ctx[name] = function (...args) {
|
|
128
|
+
const result = callFunctionAtPath.applySync(null, [[name], ...args], {
|
|
140
129
|
arguments: { copy: true },
|
|
141
130
|
result: { copy: true },
|
|
142
131
|
});
|
|
132
|
+
(0, lazy_proxy_1.throwIfErrorSentinel)(result);
|
|
133
|
+
return result;
|
|
143
134
|
};
|
|
144
|
-
globalThis.__data.$items = globalThis.$items;
|
|
145
135
|
}
|
|
146
136
|
else {
|
|
147
|
-
|
|
148
|
-
globalThis.$items = itemsValue;
|
|
149
|
-
globalThis.__data.$items = itemsValue;
|
|
137
|
+
ctx[name] = value;
|
|
150
138
|
}
|
|
151
139
|
}
|
|
152
|
-
catch
|
|
153
|
-
|
|
154
|
-
globalThis.$items = undefined;
|
|
155
|
-
globalThis.__data.$items = undefined;
|
|
140
|
+
catch {
|
|
141
|
+
ctx[name] = undefined;
|
|
156
142
|
}
|
|
157
143
|
}
|
|
144
|
+
exposeHostFunction('$items');
|
|
145
|
+
exposeHostFunction('$fromAI');
|
|
146
|
+
exposeHostFunction('$fromai');
|
|
147
|
+
exposeHostFunction('$fromAi');
|
|
158
148
|
// -------------------------------------------------------------------------
|
|
159
|
-
// Expose globals on
|
|
160
|
-
// pattern resolves them correctly (tournament checks
|
|
149
|
+
// Expose globals on ctx so tournament's "x in this ? this.x : global.x"
|
|
150
|
+
// pattern resolves them correctly (tournament checks ctx before global)
|
|
161
151
|
// -------------------------------------------------------------------------
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
// Expose extend/extendOptional on
|
|
166
|
-
// pattern resolves them correctly when the VM checks
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
// Wire builtins so tournament's VariablePolyfill resolves them from
|
|
170
|
-
initializeBuiltins(
|
|
152
|
+
ctx.DateTime = globalThis.DateTime;
|
|
153
|
+
ctx.Duration = globalThis.Duration;
|
|
154
|
+
ctx.Interval = globalThis.Interval;
|
|
155
|
+
// Expose extend/extendOptional on ctx so tournament's "x in this ? this.x : global.x"
|
|
156
|
+
// pattern resolves them correctly when the VM checks ctx first
|
|
157
|
+
ctx.extend = extend_1.extend;
|
|
158
|
+
ctx.extendOptional = extend_1.extendOptional;
|
|
159
|
+
// Wire builtins so tournament's VariablePolyfill resolves them from ctx
|
|
160
|
+
initializeBuiltins(ctx);
|
|
171
161
|
// $item(itemIndex) returns a sub-proxy for the specified item (legacy syntax)
|
|
172
|
-
|
|
162
|
+
ctx.$item = function (itemIndex) {
|
|
173
163
|
const indexStr = String(itemIndex);
|
|
174
164
|
return {
|
|
175
|
-
$json: (0, lazy_proxy_1.createDeepLazyProxy)(['$item', indexStr, '$json']),
|
|
176
|
-
$binary: (0, lazy_proxy_1.createDeepLazyProxy)(['$item', indexStr, '$binary']),
|
|
165
|
+
$json: (0, lazy_proxy_1.createDeepLazyProxy)(['$item', indexStr, '$json'], undefined, callbacks),
|
|
166
|
+
$binary: (0, lazy_proxy_1.createDeepLazyProxy)(['$item', indexStr, '$binary'], undefined, callbacks),
|
|
177
167
|
};
|
|
178
168
|
};
|
|
169
|
+
// $() function for accessing other nodes
|
|
170
|
+
ctx.$ = function (nodeName) {
|
|
171
|
+
return (0, lazy_proxy_1.createDeepLazyProxy)(['$', nodeName], undefined, callbacks);
|
|
172
|
+
};
|
|
173
|
+
return ctx;
|
|
179
174
|
}
|
|
180
175
|
// Matches initializeGlobalContext() lines 262-318 in packages/workflow/src/expression.ts
|
|
181
176
|
const DENYLISTED_GLOBALS = [
|
|
@@ -216,10 +211,10 @@
|
|
|
216
211
|
'unescape',
|
|
217
212
|
];
|
|
218
213
|
/**
|
|
219
|
-
* Wire builtins onto
|
|
214
|
+
* Wire builtins onto a context object so tournament's VariablePolyfill resolves them.
|
|
220
215
|
*
|
|
221
216
|
* Tournament transforms `Object` → `("Object" in this ? this : window).Object`.
|
|
222
|
-
* `this` =
|
|
217
|
+
* `this` = ctx. Without these entries on ctx, builtins fall through to
|
|
223
218
|
* `window` which doesn't exist in the isolate, causing a ReferenceError.
|
|
224
219
|
*
|
|
225
220
|
* Mirrors Expression.initializeGlobalContext() in packages/workflow/src/expression.ts.
|
|
@@ -288,4 +283,4 @@
|
|
|
288
283
|
data.Symbol = Symbol;
|
|
289
284
|
}
|
|
290
285
|
});
|
|
291
|
-
//# sourceMappingURL=
|
|
286
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/runtime/context.ts"],"names":[],"mappings":";;;;;;;;;;;IAoCA,oCA0JC;IA9LD,iCAAqD;IAErD,iDAA8D;IAC9D,2EAAsE;IAEtE,iDAAsF;IACtF,6CAAyE;IAEzE,sEAAsE;IACtE,MAAM,aAAa,GAAG,IAAA,sCAAuB,EAAC,SAAS,CAAC,CAAC;IACzD,MAAM,eAAe,GAAG,IAAA,sCAAuB,EAAC,WAAW,CAAC,CAAC;IAC7D,MAAM,aAAa,GAAG,IAAA,sCAAuB,EAAC,SAAS,CAAC,CAAC;IACzD,MAAM,cAAc,GAAG,IAAA,sCAAuB,EAAC,UAAU,CAAC,CAAC;IAC3D,MAAM,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,IAAI,CAAC,OAAO,GAAG,OAAO,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7D,IAAI,CAAC,QAAQ,GAAG,OAAO,QAAQ,KAAK,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;QAEhE,WAAW;QACX,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;QAC7C,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;QAE7C,QAAQ;QACR,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,CAAC"}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
declare global {
|
|
2
2
|
namespace globalThis {
|
|
3
|
-
var __getValueAtPath: any;
|
|
4
|
-
var __getArrayElement: any;
|
|
5
|
-
var __callFunctionAtPath: any;
|
|
6
|
-
var __data: Record<string, unknown>;
|
|
7
3
|
var createDeepLazyProxy: (basePath?: string[]) => any;
|
|
8
|
-
var
|
|
4
|
+
var buildContext: (getValueAtPath: any, getArrayElement: any, callFunctionAtPath: any, timezone?: string) => Record<string, unknown>;
|
|
9
5
|
var SafeObject: typeof Object;
|
|
10
6
|
var SafeError: typeof Error;
|
|
11
7
|
var DateTime: typeof import('luxon').DateTime;
|
|
@@ -14,20 +10,6 @@ declare global {
|
|
|
14
10
|
var __prepareForTransfer: (value: unknown) => unknown;
|
|
15
11
|
var extend: typeof import('../extensions/extend').extend;
|
|
16
12
|
var extendOptional: typeof import('../extensions/extend').extendOptional;
|
|
17
|
-
var $json: unknown;
|
|
18
|
-
var $binary: unknown;
|
|
19
|
-
var $input: unknown;
|
|
20
|
-
var $node: unknown;
|
|
21
|
-
var $parameter: unknown;
|
|
22
|
-
var $workflow: unknown;
|
|
23
|
-
var $prevNode: unknown;
|
|
24
|
-
var $data: unknown;
|
|
25
|
-
var $env: unknown;
|
|
26
|
-
var $runIndex: number | undefined;
|
|
27
|
-
var $itemIndex: number | undefined;
|
|
28
|
-
var $now: import('luxon').DateTime;
|
|
29
|
-
var $today: import('luxon').DateTime;
|
|
30
|
-
var $items: unknown;
|
|
31
13
|
}
|
|
32
14
|
}
|
|
33
15
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/index.ts"],"names":[],"mappings":"AAUA,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,UAAU,CAAC;QAEpB,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/index.ts"],"names":[],"mappings":"AAUA,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,UAAU,CAAC;QAEpB,IAAI,mBAAmB,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,KAAK,GAAG,CAAC;QAGtD,IAAI,YAAY,EAAE,CACjB,cAAc,EAAE,GAAG,EACnB,eAAe,EAAE,GAAG,EACpB,kBAAkB,EAAE,GAAG,EACvB,QAAQ,CAAC,EAAE,MAAM,KACb,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAG7B,IAAI,UAAU,EAAE,OAAO,MAAM,CAAC;QAC9B,IAAI,SAAS,EAAE,OAAO,KAAK,CAAC;QAG5B,IAAI,QAAQ,EAAE,cAAc,OAAO,EAAE,QAAQ,CAAC;QAC9C,IAAI,QAAQ,EAAE,cAAc,OAAO,EAAE,QAAQ,CAAC;QAC9C,IAAI,QAAQ,EAAE,cAAc,OAAO,EAAE,QAAQ,CAAC;QAC9C,IAAI,oBAAoB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;QACtD,IAAI,MAAM,EAAE,cAAc,sBAAsB,EAAE,MAAM,CAAC;QACzD,IAAI,cAAc,EAAE,cAAc,sBAAsB,EAAE,cAAc,CAAC;KACzE;CACD"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
if (v !== undefined) module.exports = v;
|
|
5
5
|
}
|
|
6
6
|
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports", "luxon", "../extensions/extend", "./safe-globals", "./lazy-proxy", "./
|
|
7
|
+
define(["require", "exports", "luxon", "../extensions/extend", "./safe-globals", "./lazy-proxy", "./context", "./serialize"], factory);
|
|
8
8
|
}
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
const extend_1 = require("../extensions/extend");
|
|
14
14
|
const safe_globals_1 = require("./safe-globals");
|
|
15
15
|
const lazy_proxy_1 = require("./lazy-proxy");
|
|
16
|
-
const
|
|
16
|
+
const context_1 = require("./context");
|
|
17
17
|
const serialize_1 = require("./serialize");
|
|
18
18
|
// ============================================================================
|
|
19
19
|
// Library Setup
|
|
@@ -31,9 +31,7 @@
|
|
|
31
31
|
globalThis.SafeError = safe_globals_1.SafeError;
|
|
32
32
|
globalThis.ExpressionError = safe_globals_1.ExpressionError;
|
|
33
33
|
globalThis.createDeepLazyProxy = lazy_proxy_1.createDeepLazyProxy;
|
|
34
|
-
globalThis.
|
|
34
|
+
globalThis.buildContext = context_1.buildContext;
|
|
35
35
|
globalThis.__prepareForTransfer = serialize_1.__prepareForTransfer;
|
|
36
|
-
// Initialize empty __data object (populated by resetDataProxies before each evaluation)
|
|
37
|
-
globalThis.__data = {};
|
|
38
36
|
});
|
|
39
37
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runtime/index.ts"],"names":[],"mappings":";;;;;;;;;;;IAAA,iCAAqD;IAErD,iDAA8D;IAE9D,iDAAwE;IACxE,6CAAmD;IACnD,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runtime/index.ts"],"names":[],"mappings":";;;;;;;;;;;IAAA,iCAAqD;IAErD,iDAA8D;IAE9D,iDAAwE;IACxE,6CAAmD;IACnD,uCAAyC;IACzC,2CAAmD;IA8BnD,+EAA+E;IAC/E,gBAAgB;IAChB,+EAA+E;IAE/E,gEAAgE;IAChE,UAAU,CAAC,MAAM,GAAG,eAAM,CAAC;IAC3B,UAAU,CAAC,cAAc,GAAG,uBAAc,CAAC;IAC3C,UAAU,CAAC,QAAQ,GAAG,gBAAQ,CAAC;IAC/B,UAAU,CAAC,QAAQ,GAAG,gBAAQ,CAAC;IAC/B,UAAU,CAAC,QAAQ,GAAG,gBAAQ,CAAC;IAE/B,+EAA+E;IAC/E,gDAAgD;IAChD,+EAA+E;IAE/E,UAAU,CAAC,UAAU,GAAG,yBAAU,CAAC;IACnC,UAAU,CAAC,SAAS,GAAG,wBAAS,CAAC;IAChC,UAAkB,CAAC,eAAe,GAAG,8BAAe,CAAC;IAEtD,UAAU,CAAC,mBAAmB,GAAG,gCAAmB,CAAC;IACrD,UAAU,CAAC,YAAY,GAAG,sBAAY,CAAC;IACvC,UAAU,CAAC,oBAAoB,GAAG,gCAAoB,CAAC"}
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serialized error sentinel returned by host-side bridge callbacks.
|
|
3
|
+
* When a callback throws, the bridge catches the error and returns this
|
|
4
|
+
* sentinel instead of letting it cross the isolate boundary (which strips
|
|
5
|
+
* custom class identity and properties).
|
|
6
|
+
*/
|
|
7
|
+
export interface ErrorSentinel {
|
|
8
|
+
__isError: true;
|
|
9
|
+
name: string;
|
|
10
|
+
message: string;
|
|
11
|
+
stack?: string;
|
|
12
|
+
extra?: Record<string, unknown>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* If `value` is an error sentinel from a host-side callback, throw it
|
|
16
|
+
* directly. The isolate's outer try-catch will detect __isError and
|
|
17
|
+
* return it as the result. Error reconstruction happens on the host only.
|
|
18
|
+
*/
|
|
19
|
+
export declare function throwIfErrorSentinel(value: unknown): void;
|
|
1
20
|
/** Returns true if `obj` is a deep lazy proxy created by createDeepLazyProxy. */
|
|
2
21
|
export declare function isLazyProxy(obj: unknown): boolean;
|
|
3
22
|
/** Returns the basePath the proxy was created with, or undefined if not a proxy. */
|
|
@@ -9,14 +28,20 @@ export declare function getProxyPath(obj: object): string[] | undefined;
|
|
|
9
28
|
* the isolate boundary using metadata-driven callbacks.
|
|
10
29
|
*
|
|
11
30
|
* Pattern:
|
|
12
|
-
* 1. When property accessed: Call
|
|
31
|
+
* 1. When property accessed: Call getValueAtPath([path]) to get metadata
|
|
13
32
|
* 2. Metadata indicates type: primitive, object, array, or function
|
|
14
33
|
* 3. For objects/arrays: Create nested proxy for lazy loading
|
|
15
|
-
* 4. For functions: Create wrapper that calls
|
|
34
|
+
* 4. For functions: Create wrapper that calls callFunctionAtPath
|
|
16
35
|
* 5. Cache all fetched values in target to avoid repeated callbacks
|
|
17
36
|
*
|
|
18
37
|
* @param basePath - Current path in object tree (e.g., ['$json', 'user'])
|
|
38
|
+
* @param knownKeys - Optional pre-known keys for the proxy
|
|
39
|
+
* @param callbacks - ivm.Reference callbacks for cross-isolate communication
|
|
19
40
|
* @returns Proxy object with lazy loading behavior
|
|
20
41
|
*/
|
|
21
|
-
export declare function createDeepLazyProxy(basePath?: string[]
|
|
42
|
+
export declare function createDeepLazyProxy(basePath?: string[], knownKeys?: string[], callbacks?: {
|
|
43
|
+
getValueAtPath: any;
|
|
44
|
+
getArrayElement: any;
|
|
45
|
+
callFunctionAtPath: any;
|
|
46
|
+
}): any;
|
|
22
47
|
//# sourceMappingURL=lazy-proxy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lazy-proxy.d.ts","sourceRoot":"","sources":["../../../src/runtime/lazy-proxy.ts"],"names":[],"mappings":"AAYA,iFAAiF;AACjF,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAEjD;AAED,oFAAoF;AACpF,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAE9D;AAED
|
|
1
|
+
{"version":3,"file":"lazy-proxy.d.ts","sourceRoot":"","sources":["../../../src/runtime/lazy-proxy.ts"],"names":[],"mappings":"AAYA;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC7B,SAAS,EAAE,IAAI,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAsBD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAKzD;AAED,iFAAiF;AACjF,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAEjD;AAED,oFAAoF;AACpF,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAE9D;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,mBAAmB,CAClC,QAAQ,GAAE,MAAM,EAAO,EACvB,SAAS,CAAC,EAAE,MAAM,EAAE,EACpB,SAAS,CAAC,EAAE;IACX,cAAc,EAAE,GAAG,CAAC;IACpB,eAAe,EAAE,GAAG,CAAC;IACrB,kBAAkB,EAAE,GAAG,CAAC;CACxB,GACC,GAAG,CAsML"}
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
})(function (require, exports) {
|
|
15
15
|
"use strict";
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.throwIfErrorSentinel = throwIfErrorSentinel;
|
|
17
18
|
exports.isLazyProxy = isLazyProxy;
|
|
18
19
|
exports.getProxyPath = getProxyPath;
|
|
19
20
|
exports.createDeepLazyProxy = createDeepLazyProxy;
|
|
@@ -22,6 +23,26 @@
|
|
|
22
23
|
// expression code. Avoids shadowing user data keys like __isProxy / __path.
|
|
23
24
|
// ---------------------------------------------------------------------------
|
|
24
25
|
const proxyPaths = new WeakMap();
|
|
26
|
+
function isObjectMetadata(value) {
|
|
27
|
+
return (typeof value === 'object' &&
|
|
28
|
+
value !== null &&
|
|
29
|
+
'__isObject' in value &&
|
|
30
|
+
value.__isObject === true);
|
|
31
|
+
}
|
|
32
|
+
function isErrorSentinel(value) {
|
|
33
|
+
return (typeof value === 'object' && value !== null && '__isError' in value && value.__isError === true);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* If `value` is an error sentinel from a host-side callback, throw it
|
|
37
|
+
* directly. The isolate's outer try-catch will detect __isError and
|
|
38
|
+
* return it as the result. Error reconstruction happens on the host only.
|
|
39
|
+
*/
|
|
40
|
+
function throwIfErrorSentinel(value) {
|
|
41
|
+
if (isErrorSentinel(value)) {
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-throw-literal -- sentinel is reconstructed on the host
|
|
43
|
+
throw value;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
25
46
|
/** Returns true if `obj` is a deep lazy proxy created by createDeepLazyProxy. */
|
|
26
47
|
function isLazyProxy(obj) {
|
|
27
48
|
return typeof obj === 'object' && obj !== null && proxyPaths.has(obj);
|
|
@@ -37,17 +58,53 @@
|
|
|
37
58
|
* the isolate boundary using metadata-driven callbacks.
|
|
38
59
|
*
|
|
39
60
|
* Pattern:
|
|
40
|
-
* 1. When property accessed: Call
|
|
61
|
+
* 1. When property accessed: Call getValueAtPath([path]) to get metadata
|
|
41
62
|
* 2. Metadata indicates type: primitive, object, array, or function
|
|
42
63
|
* 3. For objects/arrays: Create nested proxy for lazy loading
|
|
43
|
-
* 4. For functions: Create wrapper that calls
|
|
64
|
+
* 4. For functions: Create wrapper that calls callFunctionAtPath
|
|
44
65
|
* 5. Cache all fetched values in target to avoid repeated callbacks
|
|
45
66
|
*
|
|
46
67
|
* @param basePath - Current path in object tree (e.g., ['$json', 'user'])
|
|
68
|
+
* @param knownKeys - Optional pre-known keys for the proxy
|
|
69
|
+
* @param callbacks - ivm.Reference callbacks for cross-isolate communication
|
|
47
70
|
* @returns Proxy object with lazy loading behavior
|
|
48
71
|
*/
|
|
49
|
-
function createDeepLazyProxy(basePath = []) {
|
|
72
|
+
function createDeepLazyProxy(basePath = [], knownKeys, callbacks) {
|
|
73
|
+
if (!callbacks) {
|
|
74
|
+
throw new Error('createDeepLazyProxy requires callbacks parameter');
|
|
75
|
+
}
|
|
76
|
+
const { getValueAtPath, getArrayElement, callFunctionAtPath } = callbacks;
|
|
77
|
+
// Cache for keys fetched from the bridge (root proxies without knownKeys).
|
|
78
|
+
// Shared between ownKeys and getOwnPropertyDescriptor for consistency.
|
|
79
|
+
let fetchedKeys;
|
|
80
|
+
function resolveKeys() {
|
|
81
|
+
if (knownKeys)
|
|
82
|
+
return knownKeys;
|
|
83
|
+
if (fetchedKeys)
|
|
84
|
+
return fetchedKeys;
|
|
85
|
+
const value = getValueAtPath.applySync(null, [basePath], {
|
|
86
|
+
arguments: { copy: true },
|
|
87
|
+
result: { copy: true },
|
|
88
|
+
});
|
|
89
|
+
throwIfErrorSentinel(value);
|
|
90
|
+
if (isObjectMetadata(value)) {
|
|
91
|
+
fetchedKeys = value.__keys;
|
|
92
|
+
return fetchedKeys;
|
|
93
|
+
}
|
|
94
|
+
return [];
|
|
95
|
+
}
|
|
50
96
|
const proxy = new Proxy({}, {
|
|
97
|
+
ownKeys() {
|
|
98
|
+
return resolveKeys();
|
|
99
|
+
},
|
|
100
|
+
getOwnPropertyDescriptor(_target, prop) {
|
|
101
|
+
if (typeof prop === 'symbol')
|
|
102
|
+
return undefined;
|
|
103
|
+
if (resolveKeys().includes(prop)) {
|
|
104
|
+
return { configurable: true, enumerable: true, writable: false };
|
|
105
|
+
}
|
|
106
|
+
return undefined;
|
|
107
|
+
},
|
|
51
108
|
get(target, prop) {
|
|
52
109
|
// Handle Symbol properties - return undefined
|
|
53
110
|
// Symbols like Symbol.toStringTag are accessed internally
|
|
@@ -73,9 +130,9 @@
|
|
|
73
130
|
}
|
|
74
131
|
// Build path for this property
|
|
75
132
|
const path = [...basePath, prop];
|
|
76
|
-
// Call back to
|
|
77
|
-
// Note:
|
|
78
|
-
const value =
|
|
133
|
+
// Call back to host to get metadata/value
|
|
134
|
+
// Note: getValueAtPath is an ivm.Reference passed via callbacks
|
|
135
|
+
const value = getValueAtPath.applySync(null, [path], {
|
|
79
136
|
arguments: { copy: true },
|
|
80
137
|
result: { copy: true },
|
|
81
138
|
});
|
|
@@ -84,14 +141,20 @@
|
|
|
84
141
|
target[prop] = value;
|
|
85
142
|
return value;
|
|
86
143
|
}
|
|
144
|
+
// Handle errors serialized by host-side callbacks — reconstruct and throw
|
|
145
|
+
// so the isolate's outer try-catch can serialize them back via __reportError
|
|
146
|
+
throwIfErrorSentinel(value);
|
|
87
147
|
// Handle functions - metadata: { __isFunction: true, __name: string }
|
|
88
148
|
if (value && typeof value === 'object' && value.__isFunction) {
|
|
89
149
|
// Create function wrapper that calls back to parent
|
|
90
150
|
target[prop] = function (...args) {
|
|
91
|
-
|
|
151
|
+
const result = callFunctionAtPath.applySync(null, [path, ...args], {
|
|
92
152
|
arguments: { copy: true },
|
|
93
153
|
result: { copy: true },
|
|
94
154
|
});
|
|
155
|
+
// Check if the host-side function threw — reconstruct and throw
|
|
156
|
+
throwIfErrorSentinel(result);
|
|
157
|
+
return result;
|
|
95
158
|
};
|
|
96
159
|
return target[prop];
|
|
97
160
|
}
|
|
@@ -122,19 +185,21 @@
|
|
|
122
185
|
// Check cache
|
|
123
186
|
if (!(arrProp in arrTarget)) {
|
|
124
187
|
// Fetch element from parent
|
|
125
|
-
const element =
|
|
188
|
+
const element = getArrayElement.applySync(null, [path, index], {
|
|
126
189
|
arguments: { copy: true },
|
|
127
190
|
result: { copy: true },
|
|
128
191
|
});
|
|
192
|
+
throwIfErrorSentinel(element);
|
|
129
193
|
// Handle element metadata (arrays and objects need proxies)
|
|
130
194
|
if (element && typeof element === 'object' && element.__isArray) {
|
|
131
195
|
const elementPath = [...path, String(index)];
|
|
132
|
-
arrTarget[arrProp] = createDeepLazyProxy(elementPath);
|
|
196
|
+
arrTarget[arrProp] = createDeepLazyProxy(elementPath, undefined, callbacks);
|
|
133
197
|
}
|
|
134
|
-
else if (element
|
|
135
|
-
// Object metadata: create nested proxy
|
|
198
|
+
else if (isObjectMetadata(element)) {
|
|
199
|
+
// Object metadata: create nested proxy, passing known keys to
|
|
200
|
+
// avoid an extra __getValueAtPath round-trip for ownKeys/Object.keys()
|
|
136
201
|
const elementPath = [...path, String(index)];
|
|
137
|
-
arrTarget[arrProp] = createDeepLazyProxy(elementPath);
|
|
202
|
+
arrTarget[arrProp] = createDeepLazyProxy(elementPath, element.__keys, callbacks);
|
|
138
203
|
}
|
|
139
204
|
else {
|
|
140
205
|
// Primitive element
|
|
@@ -152,9 +217,9 @@
|
|
|
152
217
|
return target[prop];
|
|
153
218
|
}
|
|
154
219
|
// Handle objects - metadata: { __isObject: true, __keys: string[] }
|
|
155
|
-
if (value
|
|
156
|
-
// Create nested proxy for recursive lazy loading
|
|
157
|
-
target[prop] = createDeepLazyProxy(path);
|
|
220
|
+
if (isObjectMetadata(value)) {
|
|
221
|
+
// Create nested proxy for recursive lazy loading, passing known keys
|
|
222
|
+
target[prop] = createDeepLazyProxy(path, value.__keys, callbacks);
|
|
158
223
|
return target[prop];
|
|
159
224
|
}
|
|
160
225
|
// Primitive value - cache and return
|
|
@@ -172,10 +237,13 @@
|
|
|
172
237
|
}
|
|
173
238
|
// Build path and check existence via callback
|
|
174
239
|
const path = [...basePath, prop];
|
|
175
|
-
const value =
|
|
240
|
+
const value = getValueAtPath.applySync(null, [path], {
|
|
176
241
|
arguments: { copy: true },
|
|
177
242
|
result: { copy: true },
|
|
178
243
|
});
|
|
244
|
+
// Handle errors serialized by host-side callbacks — reconstruct and throw
|
|
245
|
+
// so the isolate's outer try-catch can serialize them back via __reportError
|
|
246
|
+
throwIfErrorSentinel(value);
|
|
179
247
|
// Property exists if value is not undefined
|
|
180
248
|
// Note: null values mean property exists but is null
|
|
181
249
|
return value !== undefined;
|