@poe-platform/safe-js 0.1.348 → 0.1.350

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-HCUDGRUU.js";
30
+ } from "./chunk-QDFP6UGN.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-KDBQOTJ2.js.map
8252
+ //# sourceMappingURL=chunk-KCCF2JJV.js.map
@@ -13173,11 +13173,12 @@ function createObjectArrayGlobals(options) {
13173
13173
  call: async ([value, key, descriptor], context) => {
13174
13174
  objectProperties(value, true);
13175
13175
  const property = await toPropertyKey(key, options.budget, context);
13176
- defineDataProperty(
13176
+ await defineDataProperty(
13177
13177
  value,
13178
13178
  property,
13179
13179
  await propertyDescriptor(descriptor, options.budget, context),
13180
- options.budget
13180
+ options.budget,
13181
+ context
13181
13182
  );
13182
13183
  return value;
13183
13184
  },
@@ -13756,15 +13757,27 @@ async function definePropertiesFromObject(target, descriptors2, budget, context)
13756
13757
  const descriptor = await (context?.getProperty !== void 0 ? context.getProperty(descriptors2, key) : getSandboxDataProperty(descriptors2, key, budget));
13757
13758
  properties.push([key, await propertyDescriptor(descriptor, budget, context)]);
13758
13759
  }
13759
- for (const [key, descriptor] of properties) defineDataProperty(target, key, descriptor, budget);
13760
+ for (const [key, descriptor] of properties) await defineDataProperty(target, key, descriptor, budget, context);
13760
13761
  } finally {
13761
13762
  release();
13762
13763
  }
13763
13764
  }
13764
- function defineDataProperty(target, key, descriptor, budget) {
13765
+ function defineDataProperty(target, key, descriptor, budget, context) {
13765
13766
  budget.visitNode();
13766
- if (isFloat32Array(target) && typeof key !== "symbol" && isFloat32Index(String(key)) && "value" in descriptor)
13767
- descriptor = { ...descriptor, value: float32Number(descriptor.value) };
13767
+ if (isFloat32Array(target) && typeof key !== "symbol" && isFloat32Index(String(key)) && "value" in descriptor) {
13768
+ const { value, ...attributes } = descriptor;
13769
+ Object.defineProperty(target, key, attributes);
13770
+ return (async () => {
13771
+ const release = retainValues(budget, () => [target, value]);
13772
+ try {
13773
+ const number = await sandboxNumber(value, budget, context);
13774
+ Reflect.set(target, key, number);
13775
+ markDescriptorObject(target);
13776
+ } finally {
13777
+ release();
13778
+ }
13779
+ })();
13780
+ }
13768
13781
  const properties = objectProperties(target, true);
13769
13782
  if (Array.isArray(properties)) {
13770
13783
  if (key === "length" && "value" in descriptor)
@@ -14158,7 +14171,7 @@ async function initializeElement(definition, receiver, homeObject, context, eval
14158
14171
  value = result.hasValue ? result.value : void 0;
14159
14172
  }
14160
14173
  if ("key" in definition) {
14161
- defineDataProperty(receiver, definition.key, { value, configurable: true, writable: true, enumerable: true }, context.budget);
14174
+ await defineDataProperty(receiver, definition.key, { value, configurable: true, writable: true, enumerable: true }, context.budget, createCoercionContext(context));
14162
14175
  }
14163
14176
  }
14164
14177
 
@@ -15394,15 +15407,22 @@ function getFloat32Member(value, property, budget, defaultConstructor) {
15394
15407
  }
15395
15408
  });
15396
15409
  }
15397
- function setFloat32Member(value, property, entry, budget) {
15410
+ function setFloat32Member(value, property, entry, budget, context) {
15398
15411
  const key = typeof property === "symbol" ? property : String(property);
15399
15412
  if (typeof key !== "symbol" && isFloat32Index(key)) {
15400
- Reflect.set(value, key, float32Number(entry));
15401
- return;
15413
+ return (async () => {
15414
+ const release = retainValues(budget, () => [value, entry]);
15415
+ try {
15416
+ const number = await sandboxNumber(entry, budget, context);
15417
+ Reflect.set(value, key, number);
15418
+ } finally {
15419
+ release();
15420
+ }
15421
+ })();
15402
15422
  }
15403
15423
  const descriptor = Object.getOwnPropertyDescriptor(value, key);
15404
- const inherited = descriptor ?? (budget === void 0 ? void 0 : getSandboxPropertyDescriptor(value, key, budget));
15405
- if (descriptor === void 0 && typeof key === "string" && (budget === void 0 || !float32Prototypes.has(budget)) && ["length", "byteLength", "byteOffset", "buffer", "BYTES_PER_ELEMENT"].includes(key))
15424
+ const inherited = descriptor ?? getSandboxPropertyDescriptor(value, key, budget);
15425
+ if (descriptor === void 0 && typeof key === "string" && !float32Prototypes.has(budget) && ["length", "byteLength", "byteOffset", "buffer", "BYTES_PER_ELEMENT"].includes(key))
15406
15426
  throw new TypeError(`Cannot assign to read only property '${String(key)}'.`);
15407
15427
  if (inherited !== void 0 && (!("value" in inherited) || !inherited.writable))
15408
15428
  throw new TypeError(`Cannot assign to read only property '${String(key)}'.`);
@@ -16289,11 +16309,11 @@ async function evaluateObjectExpression(node, context) {
16289
16309
  Object.defineProperty(materializeFunctionProperties(value.value), "name", {
16290
16310
  value: `${property.kind} ${propertyFunctionName(key.value)}`
16291
16311
  });
16292
- defineDataProperty(object, key.value, {
16312
+ await defineDataProperty(object, key.value, {
16293
16313
  [property.kind]: accessorAdapter(value.value, property.kind),
16294
16314
  configurable: true,
16295
16315
  enumerable: true
16296
- }, context.budget);
16316
+ }, context.budget, createCoercionContext(context));
16297
16317
  continue;
16298
16318
  }
16299
16319
  if (isObjectPrototypeSetterProperty(property, key.value)) {
@@ -18752,8 +18772,7 @@ function setSandboxProperty(target, property, value, budget, checkInherited = tr
18752
18772
  if (isSandboxGenerator(target)) target = getGeneratorProperties(target);
18753
18773
  if (isSandboxMap(target) || isSandboxSet(target)) target = getCollectionProperties(target);
18754
18774
  if (isFloat32Array(target)) {
18755
- setFloat32Member(target, property, value, budget);
18756
- return;
18775
+ return setFloat32Member(target, property, value, budget, context);
18757
18776
  }
18758
18777
  if (isSandboxRegex(target)) {
18759
18778
  setRegexMember(target, property, value, budget);
@@ -42658,4 +42677,4 @@ export {
42658
42677
  FileSnapshotBackend,
42659
42678
  run
42660
42679
  };
42661
- //# sourceMappingURL=chunk-HCUDGRUU.js.map
42680
+ //# sourceMappingURL=chunk-QDFP6UGN.js.map