@poe-platform/safe-js 0.1.310 → 0.1.311

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-K33MF7AA.js";
30
+ } from "./chunk-GWV7ELQW.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-S2EJB3SL.js.map
8252
+ //# sourceMappingURL=chunk-7LBVMJQT.js.map
@@ -9551,6 +9551,8 @@ async function acquireSandboxIterator(value, budget, context, asyncProtocol = fa
9551
9551
  const iterator = await invokeBuiltinClosure(factory, [], budget, context, value);
9552
9552
  if (typeof iterator !== "object" && typeof iterator !== "function" || iterator === null)
9553
9553
  throw new TypeError("Iterator must be an object.");
9554
+ if (!asyncProtocol && isSandboxGenerator(iterator) && !iterator.async && !hasExplicitSandboxPrototype(iterator) && getSandboxPropertyDescriptor(iterator, "next", budget) === void 0)
9555
+ return getSandboxIterator(iterator, budget, context);
9554
9556
  const next = await context.getProperty(iterator, "next");
9555
9557
  return guestIterator(iterator, next, asyncProtocol, budget, context, signal);
9556
9558
  }
@@ -14604,6 +14606,78 @@ function createFloat32ArrayPrototypes(budget, constructor) {
14604
14606
  construct: abstractCall
14605
14607
  });
14606
14608
  Object.defineProperty(materializeFunctionProperties(typedArray), "prototype", { value: shared, writable: false });
14609
+ Object.defineProperty(materializeFunctionProperties(typedArray), "from", {
14610
+ writable: true,
14611
+ configurable: true,
14612
+ value: createSandboxClosure({
14613
+ guest: true,
14614
+ sandbox: true,
14615
+ name: "from",
14616
+ length: 1,
14617
+ call: async (args, context) => {
14618
+ const target = context?.thisValue;
14619
+ const [source, mapper, receiver] = args;
14620
+ if (!isSandboxClosure(target) || target.construct === void 0)
14621
+ throw new TypeError("TypedArray.from requires a constructor receiver.");
14622
+ if (mapper !== void 0 && !isSandboxClosure(mapper))
14623
+ throw new TypeError("TypedArray.from mapper must be callable.");
14624
+ if (source === null || source === void 0)
14625
+ throw new TypeError("TypedArray.from requires a non-null source.");
14626
+ const callerContext = context;
14627
+ context = {
14628
+ ...callerContext,
14629
+ stack: callerContext?.stack ?? [],
14630
+ thisValue: target,
14631
+ getProperty: callerContext?.getProperty ?? ((value, key) => {
14632
+ const descriptor = getSandboxPropertyDescriptor(value, key, budget);
14633
+ return descriptor === void 0 ? getSandboxDataProperty(value, key, budget) : readPropertyDescriptor(descriptor, value, context);
14634
+ }),
14635
+ invokeClosure: callerContext?.invokeClosure ?? ((callee, values2, thisValue, construct) => invokeBuiltinClosure(callee, values2, budget, callerContext, thisValue, construct))
14636
+ };
14637
+ let result;
14638
+ let current;
14639
+ let iterator;
14640
+ const values = [];
14641
+ const release = retainValues(budget, () => [target, result, current, iterator?.retainedValue, values, ...args]);
14642
+ const checkData = createDataCheckpoint(budget, context);
14643
+ const read = (key) => context?.getProperty === void 0 ? getSandboxDataProperty(source, key, budget) : context.getProperty(source, key);
14644
+ try {
14645
+ iterator = await acquireSandboxIterator(source, budget, context);
14646
+ let length;
14647
+ if (iterator !== void 0) {
14648
+ while (true) {
14649
+ budget.visitNode();
14650
+ const next = await iterator.next();
14651
+ if (typeof next !== "object" || next === null) throw new TypeError("Iterator result must be an object.");
14652
+ if ((await readIteratorResult(iterator, next, "done")).value) break;
14653
+ current = (await readIteratorResult(iterator, next, "value")).value;
14654
+ budget.allocateArrayLength(values.length + 1);
14655
+ values.push(current);
14656
+ checkData(values, 1 + (budget.limits.dataSize === void 0 ? 0 : measureSandboxData([current])));
14657
+ }
14658
+ length = values.length;
14659
+ } else {
14660
+ const number = await sandboxNumber(await read("length"), budget, context);
14661
+ length = Number.isNaN(number) || number <= 0 ? 0 : Math.min(Math.trunc(number), Number.MAX_SAFE_INTEGER);
14662
+ }
14663
+ result = await invokeBuiltinClosure(target, [length], budget, context, void 0, true);
14664
+ if (!isFloat32Array(result) || float32Storage(result).length < length)
14665
+ throw new TypeError("TypedArray.from constructor must return sufficient typed storage.");
14666
+ checkData(result, 0, true);
14667
+ for (let index = 0; index < length; index++) {
14668
+ budget.visitNode();
14669
+ current = iterator === void 0 ? await read(String(index)) : values[index];
14670
+ if (mapper !== void 0)
14671
+ current = await invokeBuiltinClosure(mapper, [current, index], budget, context, receiver);
14672
+ result[index] = await sandboxNumber(current, budget, context);
14673
+ }
14674
+ return result;
14675
+ } finally {
14676
+ release();
14677
+ }
14678
+ }
14679
+ })
14680
+ });
14607
14681
  Object.defineProperty(materializeFunctionProperties(typedArray), "of", {
14608
14682
  writable: true,
14609
14683
  configurable: true,
@@ -41667,4 +41741,4 @@ export {
41667
41741
  FileSnapshotBackend,
41668
41742
  run
41669
41743
  };
41670
- //# sourceMappingURL=chunk-K33MF7AA.js.map
41744
+ //# sourceMappingURL=chunk-GWV7ELQW.js.map