@poe-platform/safe-js 0.1.275 → 0.1.276
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/safe-js/chunks/{chunk-MPVIYBZC.js → chunk-5MDRQKN6.js} +22 -15
- package/dist/safe-js/chunks/chunk-5MDRQKN6.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-XDACAERJ.js → chunk-P44IU3A7.js} +2 -2
- package/dist/safe-js/cli.js +2 -2
- package/dist/safe-js/core.js +1 -1
- package/dist/safe-js/index.js +2 -2
- package/package.json +2 -2
- package/dist/safe-js/chunks/chunk-MPVIYBZC.js.map +0 -7
- /package/dist/safe-js/chunks/{chunk-XDACAERJ.js.map → chunk-P44IU3A7.js.map} +0 -0
|
@@ -11616,6 +11616,8 @@ function createPromiseGlobals(options) {
|
|
|
11616
11616
|
const prototype = getPromisePrototype(options.budget);
|
|
11617
11617
|
const construct = async ([executor], context) => {
|
|
11618
11618
|
if (!isSandboxClosure(executor)) throw new TypeError("Promise executor must be a function.");
|
|
11619
|
+
const prototypeValue = context?.newTarget === void 0 ? prototype : context.getProperty === void 0 ? getSandboxDataProperty(context.newTarget, "prototype", options.budget) : context.getProperty(context.newTarget, "prototype");
|
|
11620
|
+
const targetPrototype = prototypeValue instanceof Promise ? await prototypeValue : prototypeValue;
|
|
11619
11621
|
let fulfill;
|
|
11620
11622
|
let reject;
|
|
11621
11623
|
const pending = createSandboxPromise(
|
|
@@ -11625,6 +11627,8 @@ function createPromiseGlobals(options) {
|
|
|
11625
11627
|
}),
|
|
11626
11628
|
{ span: context?.span }
|
|
11627
11629
|
);
|
|
11630
|
+
if (typeof targetPrototype === "object" && targetPrototype !== null && targetPrototype !== prototype)
|
|
11631
|
+
setSandboxPrototype(pending, targetPrototype, options.budget);
|
|
11628
11632
|
let settled = false;
|
|
11629
11633
|
const settle = (state, value) => {
|
|
11630
11634
|
if (settled) return;
|
|
@@ -11642,7 +11646,7 @@ function createPromiseGlobals(options) {
|
|
|
11642
11646
|
)
|
|
11643
11647
|
);
|
|
11644
11648
|
} else {
|
|
11645
|
-
fulfill(resolveSandboxValue(value, { budget: options.budget, self: pending }));
|
|
11649
|
+
fulfill(resolveSandboxValue(value, { budget: options.budget, self: pending, context }));
|
|
11646
11650
|
}
|
|
11647
11651
|
} catch (error) {
|
|
11648
11652
|
reject(error);
|
|
@@ -11755,7 +11759,7 @@ function createPromiseGlobals(options) {
|
|
|
11755
11759
|
}
|
|
11756
11760
|
const finish = (actualConstructor2) => {
|
|
11757
11761
|
if (isSandboxPromise(value) && actualConstructor2 === constructor) return value;
|
|
11758
|
-
return isSandboxPromiseConstructor(constructor) ? createSandboxPromise(resolveSandboxValue(value, { budget: options.budget })) : settleConstructedPromise(constructor, value, "fulfilled", options.budget, context);
|
|
11762
|
+
return isSandboxPromiseConstructor(constructor) ? createSandboxPromise(resolveSandboxValue(value, { budget: options.budget, context })) : settleConstructedPromise(constructor, value, "fulfilled", options.budget, context);
|
|
11759
11763
|
};
|
|
11760
11764
|
if (!isSandboxPromise(value)) return finish(void 0);
|
|
11761
11765
|
const descriptor = getSandboxPropertyDescriptor(value, "constructor", options.budget);
|
|
@@ -11853,9 +11857,10 @@ async function createPromiseCapability(constructor, budget, context) {
|
|
|
11853
11857
|
const leaveCall = budget.enterCall();
|
|
11854
11858
|
try {
|
|
11855
11859
|
const promise = await constructor.construct([executor], {
|
|
11860
|
+
...context,
|
|
11856
11861
|
stack: context?.stack ?? [],
|
|
11857
11862
|
thisValue: void 0,
|
|
11858
|
-
|
|
11863
|
+
newTarget: constructor
|
|
11859
11864
|
});
|
|
11860
11865
|
if (!isSandboxClosure(resolve) || !isSandboxClosure(reject)) {
|
|
11861
11866
|
throw new TypeError("Promise capability requires callable resolve and reject functions.");
|
|
@@ -11981,7 +11986,7 @@ function getPromisePrototype(budget) {
|
|
|
11981
11986
|
if (isSandboxPromise(result) && actualConstructor === constructor2) {
|
|
11982
11987
|
pending = result;
|
|
11983
11988
|
} else if (isSandboxPromiseConstructor(constructor2)) {
|
|
11984
|
-
pending = createSandboxPromise(resolveSandboxValue(result, { budget }));
|
|
11989
|
+
pending = createSandboxPromise(resolveSandboxValue(result, { budget, context }));
|
|
11985
11990
|
} else {
|
|
11986
11991
|
pending = await settleConstructedPromise(constructor2, result, "fulfilled", budget, context);
|
|
11987
11992
|
}
|
|
@@ -12150,7 +12155,7 @@ async function settleIterable(iterable, method, budget, constructor, context) {
|
|
|
12150
12155
|
});
|
|
12151
12156
|
});
|
|
12152
12157
|
remaining++;
|
|
12153
|
-
const then = await
|
|
12158
|
+
const then = await readPromiseProperty(entry, "then", prototype, budget, context);
|
|
12154
12159
|
if (!isSandboxClosure(then))
|
|
12155
12160
|
throw new TypeError("Promise resolver result requires a callable then.");
|
|
12156
12161
|
await callPromiseClosure(then, handlers, entry, budget, context);
|
|
@@ -12223,7 +12228,7 @@ function resolveSandboxValueNow(value, options) {
|
|
|
12223
12228
|
}
|
|
12224
12229
|
if (isSandboxPromise(value) && !hasCustomPromiseThen(value, options.budget)) {
|
|
12225
12230
|
if (options.budget !== void 0) {
|
|
12226
|
-
return resolvePromiseResult(value, options.budget, options.self);
|
|
12231
|
+
return resolvePromiseResult(value, options.budget, options.self, options.context);
|
|
12227
12232
|
}
|
|
12228
12233
|
observeSandboxPromise(value);
|
|
12229
12234
|
return value.promise.then(
|
|
@@ -12313,7 +12318,8 @@ function resolveThenable(value, then, options) {
|
|
|
12313
12318
|
recordSettlement("rejected", error);
|
|
12314
12319
|
complete();
|
|
12315
12320
|
}
|
|
12316
|
-
}
|
|
12321
|
+
},
|
|
12322
|
+
options.context
|
|
12317
12323
|
).catch(reject);
|
|
12318
12324
|
});
|
|
12319
12325
|
}
|
|
@@ -12355,13 +12361,13 @@ function runPromiseReaction(handler, value, state, budget, self, context) {
|
|
|
12355
12361
|
const argument = state === "rejected" && value instanceof Error ? coerceThrownValue(value, budget, []) : value;
|
|
12356
12362
|
const fulfilled = (result) => {
|
|
12357
12363
|
if (isPromiseLike2(result)) {
|
|
12358
|
-
resolve(resolvePromiseResult(result, budget, self));
|
|
12364
|
+
resolve(resolvePromiseResult(result, budget, self, context));
|
|
12359
12365
|
} else if (isSelfResolution(result, self)) {
|
|
12360
12366
|
reject(
|
|
12361
12367
|
createSubsetErrorValue("TypeError", "Promise cannot resolve to itself.", [], budget)
|
|
12362
12368
|
);
|
|
12363
12369
|
} else if (requiresPromiseResolution(result, budget)) {
|
|
12364
|
-
resolve(resolvePromiseResult(result, budget, self));
|
|
12370
|
+
resolve(resolvePromiseResult(result, budget, self, context));
|
|
12365
12371
|
} else {
|
|
12366
12372
|
resolve(budgetSandboxValue(result, budget));
|
|
12367
12373
|
}
|
|
@@ -12395,9 +12401,9 @@ function callInPromiseJob(handler, args, thisValue = void 0, completion, context
|
|
|
12395
12401
|
}
|
|
12396
12402
|
});
|
|
12397
12403
|
}
|
|
12398
|
-
function resolvePromiseResult(result, budget, self) {
|
|
12404
|
+
function resolvePromiseResult(result, budget, self, context) {
|
|
12399
12405
|
if (isPromiseLike2(result)) {
|
|
12400
|
-
return Promise.resolve(result).then((resolved) => resolvePromiseResult(resolved, budget, self));
|
|
12406
|
+
return Promise.resolve(result).then((resolved) => resolvePromiseResult(resolved, budget, self, context));
|
|
12401
12407
|
}
|
|
12402
12408
|
if (isSelfResolution(result, self)) {
|
|
12403
12409
|
return Promise.reject(
|
|
@@ -12405,7 +12411,7 @@ function resolvePromiseResult(result, budget, self) {
|
|
|
12405
12411
|
);
|
|
12406
12412
|
}
|
|
12407
12413
|
if (!isSandboxPromise(result) || hasCustomPromiseThen(result, budget)) {
|
|
12408
|
-
return resolveSandboxValue(result, { budget, self });
|
|
12414
|
+
return resolveSandboxValue(result, { budget, self, context });
|
|
12409
12415
|
}
|
|
12410
12416
|
const then = getSandboxPropertyDescriptor(result, "then", budget)?.value ?? getPromiseMember("then", budget);
|
|
12411
12417
|
if (!isSandboxClosure(then)) return Promise.resolve(result);
|
|
@@ -12417,7 +12423,7 @@ function resolvePromiseResult(result, budget, self) {
|
|
|
12417
12423
|
try {
|
|
12418
12424
|
if (state === "rejected") reject(budgetSandboxValue(value, budget));
|
|
12419
12425
|
else if (requiresPromiseResolution(value, budget)) {
|
|
12420
|
-
resolve(resolvePromiseResult(value, budget, self));
|
|
12426
|
+
resolve(resolvePromiseResult(value, budget, self, context));
|
|
12421
12427
|
} else {
|
|
12422
12428
|
resolve(budgetSandboxValue(value, budget));
|
|
12423
12429
|
}
|
|
@@ -12446,7 +12452,8 @@ function resolvePromiseResult(result, budget, self) {
|
|
|
12446
12452
|
})
|
|
12447
12453
|
],
|
|
12448
12454
|
result,
|
|
12449
|
-
budget
|
|
12455
|
+
budget,
|
|
12456
|
+
context
|
|
12450
12457
|
);
|
|
12451
12458
|
if (isSandboxPromise(completion)) {
|
|
12452
12459
|
completion.promise.catch((reason) => {
|
|
@@ -40241,4 +40248,4 @@ export {
|
|
|
40241
40248
|
FileSnapshotBackend,
|
|
40242
40249
|
run
|
|
40243
40250
|
};
|
|
40244
|
-
//# sourceMappingURL=chunk-
|
|
40251
|
+
//# sourceMappingURL=chunk-5MDRQKN6.js.map
|