@poe-platform/safe-js 0.1.417 → 0.1.419

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-SFIE326W.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-FJSR7KIF.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);
@@ -7747,6 +7768,8 @@ function writePropertyDescriptor(descriptor, receiver, value, context) {
7747
7768
  var wellKnownSymbols = Object.freeze({
7748
7769
  iterator: Symbol.iterator,
7749
7770
  asyncIterator: Symbol.asyncIterator,
7771
+ dispose: Symbol.dispose ?? /* @__PURE__ */ Symbol.for("nodejs.dispose"),
7772
+ asyncDispose: Symbol.asyncDispose ?? /* @__PURE__ */ Symbol.for("nodejs.asyncDispose"),
7750
7773
  hasInstance: Symbol.hasInstance,
7751
7774
  isConcatSpreadable: Symbol.isConcatSpreadable,
7752
7775
  match: Symbol.match,
@@ -16490,7 +16513,8 @@ var errorNames = [
16490
16513
  "SyntaxError",
16491
16514
  "URIError",
16492
16515
  "EvalError",
16493
- "AggregateError"
16516
+ "AggregateError",
16517
+ "SuppressedError"
16494
16518
  ];
16495
16519
  function createErrorGlobals(options) {
16496
16520
  return Object.fromEntries(
@@ -16509,7 +16533,7 @@ function isSandboxErrorConstructorInstance2(value, constructor) {
16509
16533
  }
16510
16534
  function createErrorConstructor(name, budget, guest) {
16511
16535
  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 });
16536
+ const closure = createSandboxClosure({ guest, sandbox: true, call, construct: call, name, length: name === "SuppressedError" ? 3 : name === "AggregateError" ? 2 : 1 });
16513
16537
  errorConstructorNames.set(closure, name);
16514
16538
  return closure;
16515
16539
  }
@@ -16587,8 +16611,8 @@ async function createNativeError(name, args, budget, context, constructor) {
16587
16611
  const errors = [];
16588
16612
  const release = retainValues(budget, () => [prototype, error, iterator?.retainedValue, ...errors, ...args]);
16589
16613
  try {
16590
- const message = name === "AggregateError" ? args[1] : args[0];
16591
- const options = name === "AggregateError" ? args[2] : args[1];
16614
+ const message = name === "SuppressedError" ? args[2] : name === "AggregateError" ? args[1] : args[0];
16615
+ const options = name === "SuppressedError" ? void 0 : name === "AggregateError" ? args[2] : args[1];
16592
16616
  const text = message === void 0 ? void 0 : await sandboxString(message, budget, context);
16593
16617
  error = createSubsetErrorValue(name, text, context?.stack ?? [], budget);
16594
16618
  setSandboxPrototype(error, prototype, budget);
@@ -16596,6 +16620,12 @@ async function createNativeError(name, args, budget, context, constructor) {
16596
16620
  const cause = await readErrorProperty(options, "cause", budget, context);
16597
16621
  Object.defineProperty(error, "cause", { value: cause, writable: true, configurable: true });
16598
16622
  }
16623
+ if (name === "SuppressedError") {
16624
+ Object.defineProperties(error, {
16625
+ error: { value: args[0], writable: true, configurable: true },
16626
+ suppressed: { value: args[1], writable: true, configurable: true }
16627
+ });
16628
+ }
16599
16629
  if (name === "AggregateError") {
16600
16630
  iterator = context === void 0 ? getSandboxIterator(args[0], budget) : await acquireSandboxIterator(args[0], budget, context);
16601
16631
  if (iterator === void 0) throw new TypeError("AggregateError errors must be iterable.");
@@ -16615,9 +16645,13 @@ async function createNativeError(name, args, budget, context, constructor) {
16615
16645
  }
16616
16646
  }
16617
16647
  function createSubsetError(name, args, stackFrames, budget) {
16618
- const message = name === "AggregateError" ? args[1] : args[0];
16619
- const options = name === "AggregateError" ? args[2] : args[1];
16648
+ const message = name === "SuppressedError" ? args[2] : name === "AggregateError" ? args[1] : args[0];
16649
+ const options = name === "SuppressedError" ? void 0 : name === "AggregateError" ? args[2] : args[1];
16620
16650
  const error = createSubsetErrorValue(name, message, stackFrames, budget);
16651
+ if (name === "SuppressedError") {
16652
+ error.error = args[0];
16653
+ error.suppressed = args[1];
16654
+ }
16621
16655
  if (name === "AggregateError") {
16622
16656
  const errors = Array.isArray(args[0]) ? [...args[0]] : [];
16623
16657
  budget.allocateArrayLength(errors.length);
@@ -24666,9 +24700,13 @@ function createHostErrorValue(reason, stackFrames, budget, span, state = { seen:
24666
24700
  if (nativeError) {
24667
24701
  state.seen.set(reason, error);
24668
24702
  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;
24703
+ let data = hostErrorData.get(reason);
24704
+ for (const key of ["errors", "error", "suppressed"]) {
24705
+ const descriptor = Object.getOwnPropertyDescriptor(reason, key);
24706
+ if (descriptor !== void 0 && "value" in descriptor) {
24707
+ data = { ...data, [key]: descriptor.value };
24708
+ }
24709
+ }
24672
24710
  if (data !== void 0) {
24673
24711
  const copied = copyHostValueToSandbox(
24674
24712
  data,
@@ -31041,7 +31079,8 @@ function copyFromSandbox(value, state, path = "<root>", options, depth = 0) {
31041
31079
  SyntaxError: SyntaxError.prototype,
31042
31080
  URIError: URIError.prototype,
31043
31081
  EvalError: EvalError.prototype,
31044
- AggregateError: AggregateError.prototype
31082
+ AggregateError: AggregateError.prototype,
31083
+ SuppressedError: NativeSuppressedError.prototype
31045
31084
  };
31046
31085
  const path2 = identity === void 0 ? [] : JSON.parse(identity);
31047
31086
  if (path2.length !== 2 || typeof path2[0] !== "string" || path2[1] !== "prototype" || !Object.hasOwn(nativePrototypes, path2[0]))
@@ -33121,6 +33160,7 @@ var KNOWN_RUNTIME_GLOBALS = [
33121
33160
  "RegExp",
33122
33161
  "Set",
33123
33162
  "String",
33163
+ "SuppressedError",
33124
33164
  "Symbol",
33125
33165
  "structuredClone",
33126
33166
  "SyntaxError",
@@ -45612,4 +45652,4 @@ export {
45612
45652
  FileSnapshotBackend,
45613
45653
  run
45614
45654
  };
45615
- //# sourceMappingURL=chunk-J2YIA5RE.js.map
45655
+ //# sourceMappingURL=chunk-SFIE326W.js.map