@poe-platform/safe-js 0.1.277 → 0.1.278

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.
@@ -12201,6 +12201,13 @@ function budgetSandboxValue(value, budget) {
12201
12201
  allocateSandboxValue(value, budget, /* @__PURE__ */ new WeakSet());
12202
12202
  return value;
12203
12203
  }
12204
+ function prepareAwaitedPromise(value, budget, context) {
12205
+ if (!intrinsicPromiseConstructors.has(budget)) createPromiseGlobals({ budget });
12206
+ const constructor = intrinsicPromiseConstructors.get(budget);
12207
+ const actualConstructor = readPromiseProperty(value, "constructor", getPromisePrototype(budget), budget, context);
12208
+ const finish = (actual) => actual === constructor ? value : createSandboxPromise(resolveSandboxValue(value, { budget, context }), { trackReplay: false });
12209
+ return actualConstructor instanceof Promise ? actualConstructor.then(finish) : finish(actualConstructor);
12210
+ }
12204
12211
  function resolveSandboxValue(value, options = {}) {
12205
12212
  try {
12206
12213
  return resolveSandboxValueNow(value, options);
@@ -12618,16 +12625,18 @@ function registerCancelablePromises(value, signal) {
12618
12625
  }
12619
12626
  }
12620
12627
  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) => {
12628
+ if (!isSandboxPromise(value)) {
12629
+ return interruptOnFatalPromiseRejection(awaitWithSignal(resolveSandboxValue(value, { budget, context }), signal));
12630
+ }
12631
+ const observe = (value2) => {
12632
+ observeSandboxPromise(value2);
12633
+ const outcome = signal === void 0 ? value2.promise : cancelableOutcomes.get(value2)?.get(signal) ?? value2.promise;
12634
+ const resolved = new Promise((resolve, reject) => {
12626
12635
  const detach = onFatalPromiseRejection(reject);
12627
12636
  const complete = (state, result) => {
12628
12637
  detach?.();
12629
12638
  try {
12630
- consumeSettledHostCall(value);
12639
+ consumeSettledHostCall(value2);
12631
12640
  if (state === "fulfilled") resolve(result);
12632
12641
  else reject(result);
12633
12642
  } catch (error) {
@@ -12639,11 +12648,15 @@ function awaitSandboxValue(value, signal, budget, context) {
12639
12648
  (reason) => complete("rejected", reason)
12640
12649
  );
12641
12650
  });
12642
- } else {
12643
- resolved = resolveSandboxValue(value, { budget, context });
12651
+ return value2.synchronousPrefix !== void 0 || signal !== void 0 && cancelableOutcomes.get(value2)?.has(signal) ? resolved : awaitWithSignal(resolved, signal);
12652
+ };
12653
+ try {
12654
+ assertPromiseExecutionAllowed();
12655
+ const prepared = budget === void 0 ? value : prepareAwaitedPromise(value, budget, context);
12656
+ return prepared instanceof Promise ? interruptOnFatalPromiseRejection(awaitWithSignal(prepared.then(observe), signal)) : observe(prepared);
12657
+ } catch (error) {
12658
+ return Promise.reject(error);
12644
12659
  }
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
12660
  }
12648
12661
  function awaitWithSignal(promise, signal) {
12649
12662
  if (signal === void 0) return Promise.resolve(promise);
@@ -40249,4 +40262,4 @@ export {
40249
40262
  FileSnapshotBackend,
40250
40263
  run
40251
40264
  };
40252
- //# sourceMappingURL=chunk-VDDR5KKE.js.map
40265
+ //# sourceMappingURL=chunk-6GA7LIXS.js.map