@poe-platform/safe-js 0.1.283 → 0.1.284

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-Y55BYBLS.js";
30
+ } from "./chunk-TF7REBUG.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-UOJGDWKG.js.map
8252
+ //# sourceMappingURL=chunk-KSXYQRJE.js.map
@@ -21887,10 +21887,13 @@ function createDateGlobal(options) {
21887
21887
  construct: async (args, context) => {
21888
21888
  let time;
21889
21889
  if (args.length === 0) time = Number(await now.call([], context));
21890
- else if (args.length > 1) time = dateFromParts(args, false);
21890
+ else if (args.length > 1) time = await coerceDateParts(args, false, options.budget, context);
21891
21891
  else if (isSandboxDate(args[0])) time = dateTime(args[0]);
21892
- else if (typeof args[0] === "string") time = parseDate(args[0], options.budget);
21893
- else time = dateNumber(args[0]);
21892
+ else {
21893
+ const input = args[0];
21894
+ const primitive = input !== null && typeof input === "object" ? await objectToPrimitive(input, options.budget, context, /* @__PURE__ */ new Set(), "default") : input;
21895
+ time = typeof primitive === "string" ? parseDate(primitive, options.budget) : await sandboxNumber(primitive, options.budget, context);
21896
+ }
21894
21897
  const newTarget = context?.newTarget;
21895
21898
  const selectedPrototype = newTarget === void 0 || newTarget === constructor ? prototype : context?.getProperty !== void 0 ? await context.getProperty(newTarget, "prototype") : await readPropertyDescriptor(getSandboxPropertyDescriptor(newTarget, "prototype", options.budget) ?? { value: void 0 }, newTarget, context);
21896
21899
  options.budget.chargeDataUsage(9);
@@ -21907,13 +21910,13 @@ function createDateGlobal(options) {
21907
21910
  sandbox: true,
21908
21911
  name: "parse",
21909
21912
  length: 1,
21910
- call: ([value]) => parseDate(value, options.budget)
21913
+ call: async ([value], context) => parseDate(await sandboxString(value, options.budget, context), options.budget)
21911
21914
  }),
21912
21915
  UTC: createSandboxClosure({
21913
21916
  sandbox: true,
21914
21917
  name: "UTC",
21915
21918
  length: 7,
21916
- call: (args) => dateFromParts(args, true)
21919
+ call: (args, context) => coerceDateParts(args, true, options.budget, context)
21917
21920
  })
21918
21921
  };
21919
21922
  const methods = /* @__PURE__ */ new Map();
@@ -21957,6 +21960,11 @@ function createDateGlobal(options) {
21957
21960
  installDatePrototype(options.budget, prototype, constructor);
21958
21961
  return constructor;
21959
21962
  }
21963
+ async function coerceDateParts(args, utc, budget, context) {
21964
+ const parts = [];
21965
+ for (const value of args.slice(0, 7)) parts.push(await sandboxNumber(value, budget, context));
21966
+ return dateFromParts(parts, utc);
21967
+ }
21960
21968
  async function dateToJSON(receiver, budget, context) {
21961
21969
  if (receiver === null || receiver === void 0) throw new TypeError("Date JSON conversion requires a receiver.");
21962
21970
  if (typeof receiver === "number" || typeof receiver === "string" || typeof receiver === "boolean") {
@@ -40311,4 +40319,4 @@ export {
40311
40319
  FileSnapshotBackend,
40312
40320
  run
40313
40321
  };
40314
- //# sourceMappingURL=chunk-Y55BYBLS.js.map
40322
+ //# sourceMappingURL=chunk-TF7REBUG.js.map