@poe-platform/safe-js 0.1.277 → 0.1.279

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.
@@ -27,7 +27,7 @@ import {
27
27
  validateMigrationSemantics,
28
28
  validateSnapshotData,
29
29
  validateSnapshotMigration
30
- } from "./chunk-VDDR5KKE.js";
30
+ } from "./chunk-OXTYSTLB.js";
31
31
 
32
32
  // packages/safe-js/src/migrate.ts
33
33
  import { createHash } from "node:crypto";
@@ -8249,4 +8249,4 @@ export {
8249
8249
  parseMcpConfig,
8250
8250
  makeMcpModule
8251
8251
  };
8252
- //# sourceMappingURL=chunk-F6E3VH3T.js.map
8252
+ //# sourceMappingURL=chunk-B635E7GD.js.map
@@ -11779,6 +11779,17 @@ function createPromiseGlobals(options) {
11779
11779
  guest: true,
11780
11780
  name: "reject",
11781
11781
  length: 1
11782
+ }),
11783
+ withResolvers: createSandboxClosure({
11784
+ sandbox: true,
11785
+ guest: true,
11786
+ name: "withResolvers",
11787
+ length: 0,
11788
+ call: (_args, context) => createPromiseCapability(
11789
+ context === void 0 ? promiseConstructor : context.thisValue,
11790
+ options.budget,
11791
+ context
11792
+ )
11782
11793
  })
11783
11794
  };
11784
11795
  const promiseConstructor = createSandboxClosure({
@@ -12201,6 +12212,13 @@ function budgetSandboxValue(value, budget) {
12201
12212
  allocateSandboxValue(value, budget, /* @__PURE__ */ new WeakSet());
12202
12213
  return value;
12203
12214
  }
12215
+ function prepareAwaitedPromise(value, budget, context) {
12216
+ if (!intrinsicPromiseConstructors.has(budget)) createPromiseGlobals({ budget });
12217
+ const constructor = intrinsicPromiseConstructors.get(budget);
12218
+ const actualConstructor = readPromiseProperty(value, "constructor", getPromisePrototype(budget), budget, context);
12219
+ const finish = (actual) => actual === constructor ? value : createSandboxPromise(resolveSandboxValue(value, { budget, context }), { trackReplay: false });
12220
+ return actualConstructor instanceof Promise ? actualConstructor.then(finish) : finish(actualConstructor);
12221
+ }
12204
12222
  function resolveSandboxValue(value, options = {}) {
12205
12223
  try {
12206
12224
  return resolveSandboxValueNow(value, options);
@@ -12618,16 +12636,18 @@ function registerCancelablePromises(value, signal) {
12618
12636
  }
12619
12637
  }
12620
12638
  function awaitSandboxValue(value, signal, budget, context) {
12621
- let resolved;
12622
- if (isSandboxPromise(value)) {
12623
- observeSandboxPromise(value);
12624
- const outcome = signal === void 0 ? value.promise : cancelableOutcomes.get(value)?.get(signal) ?? value.promise;
12625
- resolved = new Promise((resolve, reject) => {
12639
+ if (!isSandboxPromise(value)) {
12640
+ return interruptOnFatalPromiseRejection(awaitWithSignal(resolveSandboxValue(value, { budget, context }), signal));
12641
+ }
12642
+ const observe = (value2) => {
12643
+ observeSandboxPromise(value2);
12644
+ const outcome = signal === void 0 ? value2.promise : cancelableOutcomes.get(value2)?.get(signal) ?? value2.promise;
12645
+ const resolved = new Promise((resolve, reject) => {
12626
12646
  const detach = onFatalPromiseRejection(reject);
12627
12647
  const complete = (state, result) => {
12628
12648
  detach?.();
12629
12649
  try {
12630
- consumeSettledHostCall(value);
12650
+ consumeSettledHostCall(value2);
12631
12651
  if (state === "fulfilled") resolve(result);
12632
12652
  else reject(result);
12633
12653
  } catch (error) {
@@ -12639,11 +12659,15 @@ function awaitSandboxValue(value, signal, budget, context) {
12639
12659
  (reason) => complete("rejected", reason)
12640
12660
  );
12641
12661
  });
12642
- } else {
12643
- resolved = resolveSandboxValue(value, { budget, context });
12662
+ return value2.synchronousPrefix !== void 0 || signal !== void 0 && cancelableOutcomes.get(value2)?.has(signal) ? resolved : awaitWithSignal(resolved, signal);
12663
+ };
12664
+ try {
12665
+ assertPromiseExecutionAllowed();
12666
+ const prepared = budget === void 0 ? value : prepareAwaitedPromise(value, budget, context);
12667
+ return prepared instanceof Promise ? interruptOnFatalPromiseRejection(awaitWithSignal(prepared.then(observe), signal)) : observe(prepared);
12668
+ } catch (error) {
12669
+ return Promise.reject(error);
12644
12670
  }
12645
- const pending = isSandboxPromise(value) && (value.synchronousPrefix !== void 0 || signal !== void 0 && cancelableOutcomes.get(value)?.has(signal)) ? resolved : awaitWithSignal(resolved, signal);
12646
- return isSandboxPromise(value) ? pending : interruptOnFatalPromiseRejection(pending);
12647
12671
  }
12648
12672
  function awaitWithSignal(promise, signal) {
12649
12673
  if (signal === void 0) return Promise.resolve(promise);
@@ -40249,4 +40273,4 @@ export {
40249
40273
  FileSnapshotBackend,
40250
40274
  run
40251
40275
  };
40252
- //# sourceMappingURL=chunk-VDDR5KKE.js.map
40276
+ //# sourceMappingURL=chunk-OXTYSTLB.js.map