@poe-platform/safe-js 0.1.417 → 0.1.418

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-J2YIA5RE.js";
30
+ } from "./chunk-VL4HQ4WF.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-WX23Y7DF.js.map
8252
+ //# sourceMappingURL=chunk-5W7GMU34.js.map
@@ -14,6 +14,7 @@ var sandboxErrorNames = [
14
14
  "EvalError",
15
15
  "AbortError",
16
16
  "AggregateError",
17
+ "SuppressedError",
17
18
  "HarnessFailure"
18
19
  ];
19
20
  var sandboxErrorTypes = /* @__PURE__ */ new WeakMap();
@@ -7316,6 +7317,26 @@ function serializedDateTime(value) {
7316
7317
  return Number.isNaN(time) ? null : time;
7317
7318
  }
7318
7319
 
7320
+ // packages/safe-js/src/error/native-suppressed-error.ts
7321
+ function SuppressedError(error, suppressed, message) {
7322
+ const prototype = new.target?.prototype;
7323
+ const result = new Error(message);
7324
+ Object.setPrototypeOf(result, prototype !== null && (typeof prototype === "object" || typeof prototype === "function") ? prototype : SuppressedError.prototype);
7325
+ Object.defineProperties(result, {
7326
+ error: { value: error, writable: true, configurable: true },
7327
+ suppressed: { value: suppressed, writable: true, configurable: true }
7328
+ });
7329
+ return result;
7330
+ }
7331
+ Object.setPrototypeOf(SuppressedError, Error);
7332
+ Object.setPrototypeOf(SuppressedError.prototype, Error.prototype);
7333
+ Object.defineProperties(SuppressedError.prototype, {
7334
+ name: { value: "SuppressedError", writable: true, configurable: true },
7335
+ message: { value: "", writable: true, configurable: true }
7336
+ });
7337
+ Object.defineProperty(SuppressedError, "prototype", { writable: false });
7338
+ var NativeSuppressedError = globalThis.SuppressedError ?? SuppressedError;
7339
+
7319
7340
  // packages/safe-js/src/interp/arguments.ts
7320
7341
  var sandboxArgumentsBrand = /* @__PURE__ */ Symbol("SandboxArguments");
7321
7342
  internalSymbols.add(sandboxArgumentsBrand);
@@ -16490,7 +16511,8 @@ var errorNames = [
16490
16511
  "SyntaxError",
16491
16512
  "URIError",
16492
16513
  "EvalError",
16493
- "AggregateError"
16514
+ "AggregateError",
16515
+ "SuppressedError"
16494
16516
  ];
16495
16517
  function createErrorGlobals(options) {
16496
16518
  return Object.fromEntries(
@@ -16509,7 +16531,7 @@ function isSandboxErrorConstructorInstance2(value, constructor) {
16509
16531
  }
16510
16532
  function createErrorConstructor(name, budget, guest) {
16511
16533
  const call = (args, context) => errorPrototypes.has(budget) ? createNativeError(name, args, budget, context, closure) : createSubsetError(name, args, context?.stack ?? [], budget);
16512
- const closure = createSandboxClosure({ guest, sandbox: true, call, construct: call, name, length: name === "AggregateError" ? 2 : 1 });
16534
+ const closure = createSandboxClosure({ guest, sandbox: true, call, construct: call, name, length: name === "SuppressedError" ? 3 : name === "AggregateError" ? 2 : 1 });
16513
16535
  errorConstructorNames.set(closure, name);
16514
16536
  return closure;
16515
16537
  }
@@ -16587,8 +16609,8 @@ async function createNativeError(name, args, budget, context, constructor) {
16587
16609
  const errors = [];
16588
16610
  const release = retainValues(budget, () => [prototype, error, iterator?.retainedValue, ...errors, ...args]);
16589
16611
  try {
16590
- const message = name === "AggregateError" ? args[1] : args[0];
16591
- const options = name === "AggregateError" ? args[2] : args[1];
16612
+ const message = name === "SuppressedError" ? args[2] : name === "AggregateError" ? args[1] : args[0];
16613
+ const options = name === "SuppressedError" ? void 0 : name === "AggregateError" ? args[2] : args[1];
16592
16614
  const text = message === void 0 ? void 0 : await sandboxString(message, budget, context);
16593
16615
  error = createSubsetErrorValue(name, text, context?.stack ?? [], budget);
16594
16616
  setSandboxPrototype(error, prototype, budget);
@@ -16596,6 +16618,12 @@ async function createNativeError(name, args, budget, context, constructor) {
16596
16618
  const cause = await readErrorProperty(options, "cause", budget, context);
16597
16619
  Object.defineProperty(error, "cause", { value: cause, writable: true, configurable: true });
16598
16620
  }
16621
+ if (name === "SuppressedError") {
16622
+ Object.defineProperties(error, {
16623
+ error: { value: args[0], writable: true, configurable: true },
16624
+ suppressed: { value: args[1], writable: true, configurable: true }
16625
+ });
16626
+ }
16599
16627
  if (name === "AggregateError") {
16600
16628
  iterator = context === void 0 ? getSandboxIterator(args[0], budget) : await acquireSandboxIterator(args[0], budget, context);
16601
16629
  if (iterator === void 0) throw new TypeError("AggregateError errors must be iterable.");
@@ -16615,9 +16643,13 @@ async function createNativeError(name, args, budget, context, constructor) {
16615
16643
  }
16616
16644
  }
16617
16645
  function createSubsetError(name, args, stackFrames, budget) {
16618
- const message = name === "AggregateError" ? args[1] : args[0];
16619
- const options = name === "AggregateError" ? args[2] : args[1];
16646
+ const message = name === "SuppressedError" ? args[2] : name === "AggregateError" ? args[1] : args[0];
16647
+ const options = name === "SuppressedError" ? void 0 : name === "AggregateError" ? args[2] : args[1];
16620
16648
  const error = createSubsetErrorValue(name, message, stackFrames, budget);
16649
+ if (name === "SuppressedError") {
16650
+ error.error = args[0];
16651
+ error.suppressed = args[1];
16652
+ }
16621
16653
  if (name === "AggregateError") {
16622
16654
  const errors = Array.isArray(args[0]) ? [...args[0]] : [];
16623
16655
  budget.allocateArrayLength(errors.length);
@@ -24666,9 +24698,13 @@ function createHostErrorValue(reason, stackFrames, budget, span, state = { seen:
24666
24698
  if (nativeError) {
24667
24699
  state.seen.set(reason, error);
24668
24700
  copyHostErrorMetadata(error, reason, budget, chargeBudget);
24669
- const errors = Object.getOwnPropertyDescriptor(reason, "errors");
24670
- const registered = hostErrorData.get(reason);
24671
- const data = errors !== void 0 && "value" in errors ? { ...registered, errors: errors.value } : registered;
24701
+ let data = hostErrorData.get(reason);
24702
+ for (const key of ["errors", "error", "suppressed"]) {
24703
+ const descriptor = Object.getOwnPropertyDescriptor(reason, key);
24704
+ if (descriptor !== void 0 && "value" in descriptor) {
24705
+ data = { ...data, [key]: descriptor.value };
24706
+ }
24707
+ }
24672
24708
  if (data !== void 0) {
24673
24709
  const copied = copyHostValueToSandbox(
24674
24710
  data,
@@ -31041,7 +31077,8 @@ function copyFromSandbox(value, state, path = "<root>", options, depth = 0) {
31041
31077
  SyntaxError: SyntaxError.prototype,
31042
31078
  URIError: URIError.prototype,
31043
31079
  EvalError: EvalError.prototype,
31044
- AggregateError: AggregateError.prototype
31080
+ AggregateError: AggregateError.prototype,
31081
+ SuppressedError: NativeSuppressedError.prototype
31045
31082
  };
31046
31083
  const path2 = identity === void 0 ? [] : JSON.parse(identity);
31047
31084
  if (path2.length !== 2 || typeof path2[0] !== "string" || path2[1] !== "prototype" || !Object.hasOwn(nativePrototypes, path2[0]))
@@ -33121,6 +33158,7 @@ var KNOWN_RUNTIME_GLOBALS = [
33121
33158
  "RegExp",
33122
33159
  "Set",
33123
33160
  "String",
33161
+ "SuppressedError",
33124
33162
  "Symbol",
33125
33163
  "structuredClone",
33126
33164
  "SyntaxError",
@@ -45612,4 +45650,4 @@ export {
45612
45650
  FileSnapshotBackend,
45613
45651
  run
45614
45652
  };
45615
- //# sourceMappingURL=chunk-J2YIA5RE.js.map
45653
+ //# sourceMappingURL=chunk-VL4HQ4WF.js.map