@ariestools/cli 0.1.20 → 0.1.22

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.
@@ -58,7 +58,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
58
58
  var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp$15({}, "__esModule", { value: true }), mod);
59
59
  var __require$1 = /* #__PURE__ */ (() => createRequire(import.meta.url))();
60
60
  //#endregion
61
- //#region ../../node_modules/.pnpm/zod@4.5.1/node_modules/zod/v4/core/util.js
61
+ //#region ../../node_modules/.pnpm/zod@4.6.1/node_modules/zod/v4/core/util.js
62
62
  function getEnumValues(entries) {
63
63
  const numericValues = Object.values(entries).filter((v) => typeof v === "number");
64
64
  return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
@@ -70,14 +70,22 @@ function jsonStringifyReplacer(_, value) {
70
70
  if (typeof value === "bigint") return value.toString();
71
71
  return value;
72
72
  }
73
- function cached(getter) {
74
- return { get value() {
75
- {
76
- const value = getter();
77
- Object.defineProperty(this, "value", { value });
78
- return value;
73
+ var Cached = class {
74
+ constructor(getter) {
75
+ this._getter = getter;
76
+ this._value = void 0;
77
+ }
78
+ get value() {
79
+ const getter = this._getter;
80
+ if (getter !== void 0) {
81
+ this._value = getter();
82
+ this._getter = void 0;
79
83
  }
80
- } };
84
+ return this._value;
85
+ }
86
+ };
87
+ function cached(getter) {
88
+ return new Cached(getter);
81
89
  }
82
90
  function nullish$1(input) {
83
91
  return input === null || input === void 0;
@@ -120,6 +128,58 @@ function assignProp(target, prop, value) {
120
128
  configurable: true
121
129
  });
122
130
  }
131
+ /**
132
+ * Whichever object a def's `shape` currently answers from: the one the caller passed until the first read, the frozen copy after it.
133
+ *
134
+ * Its keys and descriptors read without invoking anything, which is what lets a discriminated union check its discriminator, and the cycle walk read a shape, without resolving a getter that references the schema being constructed. A def that answers `shape` from an accessor of its own has none.
135
+ */
136
+ function rawShape(def) {
137
+ const desc = Object.getOwnPropertyDescriptor(def, "shape");
138
+ return desc?.get ? desc.get.raw : desc?.value;
139
+ }
140
+ function sourceShape(schema) {
141
+ return rawShape(schema._zod.def) ?? schema._zod.def.shape;
142
+ }
143
+ function deferProp(target, key, getter) {
144
+ Object.defineProperty(target, key, {
145
+ get() {
146
+ const value = getter();
147
+ assignProp(this, key, value);
148
+ return value;
149
+ },
150
+ enumerable: true,
151
+ configurable: true
152
+ });
153
+ }
154
+ function putProp(target, key, value) {
155
+ if (key in target) assignProp(target, key, value);
156
+ else target[key] = value;
157
+ }
158
+ /**
159
+ * Copies `keys` of `source`'s shape onto `target`, each value passed through `wrap`.
160
+ *
161
+ * A key the source has resolved is copied through now, so the derived shape states it outright and nothing has to resolve it to learn what it holds. A key the source still defers stays deferred, and reads back through the source's own `shape`, so it resolves once and both shapes get that one schema.
162
+ */
163
+ function mirrorShape(target, source, keys, wrap) {
164
+ const raw = sourceShape(source);
165
+ for (const key of keys) {
166
+ const desc = Object.getOwnPropertyDescriptor(raw, key);
167
+ if (!desc.enumerable) continue;
168
+ if (desc.get) deferProp(target, key, () => {
169
+ const value = source._zod.def.shape[key];
170
+ return wrap ? wrap(value, key) : value;
171
+ });
172
+ else putProp(target, key, wrap ? wrap(desc.value, key) : desc.value);
173
+ }
174
+ }
175
+ function mirrorProps(target, source) {
176
+ for (const key of Reflect.ownKeys(source)) {
177
+ const desc = Object.getOwnPropertyDescriptor(source, key);
178
+ if (!desc.enumerable) continue;
179
+ if (desc.get) deferProp(target, key, () => source[key]);
180
+ else putProp(target, key, desc.value);
181
+ }
182
+ }
123
183
  function mergeDefs(...defs) {
124
184
  const mergedDescriptors = {};
125
185
  for (const def of defs) {
@@ -226,35 +286,31 @@ function pick(schema, mask) {
226
286
  const currDef = schema._zod.def;
227
287
  const checks = currDef.checks;
228
288
  if (checks && checks.length > 0) throw new Error(".pick() cannot be used on object schemas containing refinements");
229
- return clone(schema, mergeDefs(schema._zod.def, {
230
- get shape() {
231
- const newShape = {};
232
- for (const key of Reflect.ownKeys(mask)) {
233
- if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
234
- if (!mask[key]) continue;
235
- assignProp(newShape, key, currDef.shape[key]);
236
- }
237
- assignProp(this, "shape", newShape);
238
- return newShape;
239
- },
289
+ const newShape = {};
290
+ mirrorShape(newShape, schema, maskedKeys(schema, mask));
291
+ return clone(schema, mergeDefs(currDef, {
292
+ shape: newShape,
240
293
  checks: []
241
294
  }));
242
295
  }
296
+ function maskedKeys(schema, mask) {
297
+ const raw = sourceShape(schema);
298
+ const keys = [];
299
+ for (const key of Reflect.ownKeys(mask)) {
300
+ if (!Object.getOwnPropertyDescriptor(raw, key)?.enumerable) throw new Error(`Unrecognized key: "${String(key)}"`);
301
+ if (mask[key]) keys.push(key);
302
+ }
303
+ return keys;
304
+ }
243
305
  function omit(schema, mask) {
244
306
  const currDef = schema._zod.def;
245
307
  const checks = currDef.checks;
246
308
  if (checks && checks.length > 0) throw new Error(".omit() cannot be used on object schemas containing refinements");
247
- return clone(schema, mergeDefs(schema._zod.def, {
248
- get shape() {
249
- const newShape = { ...schema._zod.def.shape };
250
- for (const key of Reflect.ownKeys(mask)) {
251
- if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
252
- if (!mask[key]) continue;
253
- delete newShape[key];
254
- }
255
- assignProp(this, "shape", newShape);
256
- return newShape;
257
- },
309
+ const omitted = new Set(maskedKeys(schema, mask));
310
+ const newShape = {};
311
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)).filter((key) => !omitted.has(key)));
312
+ return clone(schema, mergeDefs(currDef, {
313
+ shape: newShape,
258
314
  checks: []
259
315
  }));
260
316
  }
@@ -262,41 +318,29 @@ function extend$1(schema, shape) {
262
318
  if (!isPlainObject$1(shape)) throw new Error("Invalid input to extend: expected a plain object");
263
319
  const checks = schema._zod.def.checks;
264
320
  if (checks && checks.length > 0) {
265
- const existingShape = schema._zod.def.shape;
321
+ const existingShape = sourceShape(schema);
266
322
  for (const key of Reflect.ownKeys(shape)) if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
267
323
  }
268
- return clone(schema, mergeDefs(schema._zod.def, { get shape() {
269
- const _shape = {
270
- ...schema._zod.def.shape,
271
- ...shape
272
- };
273
- assignProp(this, "shape", _shape);
274
- return _shape;
275
- } }));
324
+ return clone(schema, mergeDefs(schema._zod.def, { shape: extended(schema, shape) }));
325
+ }
326
+ function extended(schema, shape) {
327
+ const newShape = {};
328
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)));
329
+ mirrorProps(newShape, shape);
330
+ return newShape;
276
331
  }
277
332
  function safeExtend$1(schema, shape) {
278
333
  if (!isPlainObject$1(shape)) throw new Error("Invalid input to safeExtend: expected a plain object");
279
- return clone(schema, mergeDefs(schema._zod.def, { get shape() {
280
- const _shape = {
281
- ...schema._zod.def.shape,
282
- ...shape
283
- };
284
- assignProp(this, "shape", _shape);
285
- return _shape;
286
- } }));
334
+ return clone(schema, mergeDefs(schema._zod.def, { shape: extended(schema, shape) }));
287
335
  }
288
336
  function merge$1(a, b) {
289
337
  if (!b?._zod?.def) throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");
290
338
  if (a._zod.def.checks?.length) throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
339
+ const newShape = {};
340
+ mirrorShape(newShape, a, Reflect.ownKeys(sourceShape(a)));
341
+ mirrorShape(newShape, b, Reflect.ownKeys(sourceShape(b)));
291
342
  return clone(a, mergeDefs(a._zod.def, {
292
- get shape() {
293
- const _shape = {
294
- ...a._zod.def.shape,
295
- ...b._zod.def.shape
296
- };
297
- assignProp(this, "shape", _shape);
298
- return _shape;
299
- },
343
+ shape: newShape,
300
344
  get catchall() {
301
345
  return b._zod.def.catchall;
302
346
  },
@@ -306,47 +350,25 @@ function merge$1(a, b) {
306
350
  function partial(Class, schema, mask, name = "partial") {
307
351
  const checks = schema._zod.def.checks;
308
352
  if (checks && checks.length > 0) throw new Error(`.${name}() cannot be used on object schemas containing refinements`);
353
+ const selected = mask ? new Set(maskedKeys(schema, mask)) : void 0;
354
+ const newShape = {};
355
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), Class && ((value, key) => selected && !selected.has(key) ? value : new Class({
356
+ type: "optional",
357
+ innerType: value
358
+ })));
309
359
  return clone(schema, mergeDefs(schema._zod.def, {
310
- get shape() {
311
- const oldShape = schema._zod.def.shape;
312
- const shape = { ...oldShape };
313
- if (mask) for (const key of Reflect.ownKeys(mask)) {
314
- if (!Object.prototype.hasOwnProperty.call(oldShape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
315
- if (!mask[key]) continue;
316
- shape[key] = Class ? new Class({
317
- type: "optional",
318
- innerType: oldShape[key]
319
- }) : oldShape[key];
320
- }
321
- else for (const key of Reflect.ownKeys(oldShape)) shape[key] = Class ? new Class({
322
- type: "optional",
323
- innerType: oldShape[key]
324
- }) : oldShape[key];
325
- assignProp(this, "shape", shape);
326
- return shape;
327
- },
360
+ shape: newShape,
328
361
  checks: []
329
362
  }));
330
363
  }
331
364
  function required(Class, schema, mask) {
332
- return clone(schema, mergeDefs(schema._zod.def, { get shape() {
333
- const oldShape = schema._zod.def.shape;
334
- const shape = { ...oldShape };
335
- if (mask) for (const key of Reflect.ownKeys(mask)) {
336
- if (!Object.prototype.hasOwnProperty.call(shape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
337
- if (!mask[key]) continue;
338
- shape[key] = new Class({
339
- type: "nonoptional",
340
- innerType: oldShape[key]
341
- });
342
- }
343
- else for (const key of Reflect.ownKeys(oldShape)) shape[key] = new Class({
344
- type: "nonoptional",
345
- innerType: oldShape[key]
346
- });
347
- assignProp(this, "shape", shape);
348
- return shape;
349
- } }));
365
+ const selected = mask ? new Set(maskedKeys(schema, mask)) : void 0;
366
+ const newShape = {};
367
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), (value, key) => selected && !selected.has(key) ? value : new Class({
368
+ type: "nonoptional",
369
+ innerType: value
370
+ }));
371
+ return clone(schema, mergeDefs(schema._zod.def, { shape: newShape }));
350
372
  }
351
373
  function aborted(x, startIndex = 0) {
352
374
  if (x.aborted === true) return true;
@@ -382,11 +404,15 @@ function finalizeIssue(iss, ctx, config) {
382
404
  }
383
405
  const schemaError = iss.schema !== iss.inst ? iss.schema?._zod.def?.error : void 0;
384
406
  const message = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(schemaError?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config.customError?.(iss)) ?? unwrapMessage(config.localeError?.(iss)) ?? "Invalid input";
385
- const { inst: _inst, schema: _schema, continue: _continue, input: _input, ...rest } = iss;
386
- rest.path ?? (rest.path = []);
387
- rest.message = message;
388
- if (ctx?.reportInput) rest.input = _input;
389
- return rest;
407
+ const full = {};
408
+ for (const k of Object.keys(iss)) {
409
+ if (k === "inst" || k === "schema" || k === "continue" || k === "input" || k === "__proto__") continue;
410
+ full[k] = iss[k];
411
+ }
412
+ full.path ?? (full.path = []);
413
+ full.message = message;
414
+ if (ctx?.reportInput) full.input = iss.input;
415
+ return full;
390
416
  }
391
417
  function getSizableOrigin(input) {
392
418
  if (input instanceof Set) return "set";
@@ -447,6 +473,7 @@ function members(proto, table) {
447
473
  });
448
474
  else defineBound(proto, key, desc.value);
449
475
  }
476
+ for (const sym of Object.getOwnPropertySymbols(table)) defineBound(proto, sym, table[sym]);
450
477
  }
451
478
  /** Shadows a prototype member with an own value, so a getter that builds from the instance runs once. */
452
479
  function own(inst, key, value, enumerable = true) {
@@ -462,11 +489,28 @@ function own(inst, key, value, enumerable = true) {
462
489
  function hide(inst, key, value) {
463
490
  return own(inst, key, value, false);
464
491
  }
492
+ /** Adds members a table derives from the instance: each builds on first read and shadows as own data, and assignment shadows the same way, as when these were own properties. */
493
+ function derived(computes, table) {
494
+ for (const key in computes) {
495
+ const compute = computes[key];
496
+ Object.defineProperty(table, key, {
497
+ configurable: true,
498
+ enumerable: true,
499
+ get() {
500
+ return own(this, key, compute(this));
501
+ },
502
+ set(value) {
503
+ own(this, key, value);
504
+ }
505
+ });
506
+ }
507
+ return table;
508
+ }
465
509
  function defineBound(proto, key, fn) {
466
510
  Object.defineProperty(proto, key, {
467
511
  configurable: true,
468
512
  get() {
469
- return own(this, key, fn.bind(this));
513
+ return this == null ? fn : own(this, key, fn.bind(this));
470
514
  },
471
515
  set(value) {
472
516
  own(this, key, value);
@@ -570,9 +614,9 @@ function constantCatch(value) {
570
614
  return fn;
571
615
  }
572
616
  //#endregion
573
- //#region ../../node_modules/.pnpm/zod@4.5.1/node_modules/zod/v4/core/core.js
617
+ //#region ../../node_modules/.pnpm/zod@4.6.1/node_modules/zod/v4/core/core.js
574
618
  var _a$1;
575
- const _zodDesc$1 = {
619
+ const _zodDesc = {
576
620
  value: void 0,
577
621
  enumerable: false
578
622
  };
@@ -609,11 +653,11 @@ function $constructor(name, initializer, proto, params) {
609
653
  const initialized = protoMembers && /* @__PURE__ */ new WeakSet();
610
654
  function init(inst, def) {
611
655
  if (!inst._zod) {
612
- _zodDesc$1.value = new Internals(def);
656
+ _zodDesc.value = new Internals(def);
613
657
  try {
614
- Object.defineProperty(inst, "_zod", _zodDesc$1);
658
+ Object.defineProperty(inst, "_zod", _zodDesc);
615
659
  } finally {
616
- _zodDesc$1.value = void 0;
660
+ _zodDesc.value = void 0;
617
661
  }
618
662
  }
619
663
  if (inst._zod.traits.has(name)) return;
@@ -677,7 +721,7 @@ function config(newConfig) {
677
721
  return globalConfig;
678
722
  }
679
723
  //#endregion
680
- //#region ../../node_modules/.pnpm/zod@4.5.1/node_modules/zod/v4/core/errors.js
724
+ //#region ../../node_modules/.pnpm/zod@4.6.1/node_modules/zod/v4/core/errors.js
681
725
  function _getMessage() {
682
726
  const internals = this._zod;
683
727
  internals.message ?? (internals.message = JSON.stringify(internals.def, jsonStringifyReplacer, 2));
@@ -692,10 +736,6 @@ const _messageDesc = {
692
736
  enumerable: true,
693
737
  configurable: true
694
738
  };
695
- const _zodDesc = {
696
- value: void 0,
697
- enumerable: false
698
- };
699
739
  const _issuesDesc = {
700
740
  value: void 0,
701
741
  enumerable: false
@@ -703,11 +743,8 @@ const _issuesDesc = {
703
743
  const _installedToString = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
704
744
  const initializer$1 = (inst, def) => {
705
745
  inst.name = "$ZodError";
706
- _zodDesc.value = inst._zod;
707
- Object.defineProperty(inst, "_zod", _zodDesc);
708
746
  _issuesDesc.value = def;
709
747
  Object.defineProperty(inst, "issues", _issuesDesc);
710
- _zodDesc.value = void 0;
711
748
  _issuesDesc.value = void 0;
712
749
  Object.defineProperty(inst, "message", _messageDesc);
713
750
  const proto = Object.getPrototypeOf(inst);
@@ -800,7 +837,7 @@ function formatError$2(error, mapper = (issue) => issue.message) {
800
837
  return fieldErrors;
801
838
  }
802
839
  //#endregion
803
- //#region ../../node_modules/.pnpm/zod@4.5.1/node_modules/zod/v4/core/parse.js
840
+ //#region ../../node_modules/.pnpm/zod@4.6.1/node_modules/zod/v4/core/parse.js
804
841
  function finalizeParams(callee, params) {
805
842
  return {
806
843
  callee: params?.callee ?? callee,
@@ -859,15 +896,31 @@ const _safeParse = (_Err) => (schema, value, _ctx) => {
859
896
  issues: []
860
897
  }, ctx);
861
898
  if (result instanceof Promise) throw new $ZodAsyncError();
862
- return result.issues.length ? {
863
- success: false,
864
- error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
865
- } : {
899
+ return result.issues.length ? failure$1(_Err, result.issues, ctx) : {
866
900
  success: true,
867
901
  data: result.value
868
902
  };
869
903
  };
870
904
  const safeParse$1 = /* @__PURE__*/ _safeParse($ZodRealError);
905
+ function failure$1(Err, issues, ctx) {
906
+ let error;
907
+ return {
908
+ success: false,
909
+ get error() {
910
+ if (!error) {
911
+ error = new Err(issues.map((iss) => finalizeIssue(iss, ctx, config())));
912
+ issues = void 0;
913
+ ctx = void 0;
914
+ }
915
+ return error;
916
+ },
917
+ set error(e) {
918
+ error = e;
919
+ issues = void 0;
920
+ ctx = void 0;
921
+ }
922
+ };
923
+ }
871
924
  const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
872
925
  const ctx = _ctx ? {
873
926
  ..._ctx,
@@ -878,15 +931,62 @@ const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
878
931
  issues: []
879
932
  }, ctx);
880
933
  if (result instanceof Promise) result = await result;
881
- return result.issues.length ? {
882
- success: false,
883
- error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
884
- } : {
934
+ return result.issues.length ? failure$1(_Err, result.issues, ctx) : {
885
935
  success: true,
886
936
  data: result.value
887
937
  };
888
938
  };
889
939
  const safeParseAsync$1 = /* @__PURE__*/ _safeParseAsync($ZodRealError);
940
+ const COMPILE_INVALID = /* @__PURE__ */ Symbol.for("zod.compile.invalid");
941
+ const COMPILE_FALLBACK = /* @__PURE__ */ Symbol.for("zod.compile.fallback");
942
+ const validate$1 = ((schema, value, _ctx) => {
943
+ const validator = schema._zod.bag.validator;
944
+ if (validator !== void 0) {
945
+ if (validator(value) !== COMPILE_INVALID) return true;
946
+ if (validator.definite === true && _ctx === void 0) return false;
947
+ }
948
+ return validateFallback(schema, value, _ctx);
949
+ });
950
+ function validateFallback(schema, value, _ctx) {
951
+ const ctx = _ctx ? {
952
+ ..._ctx,
953
+ async: false,
954
+ abortEarly: true
955
+ } : {
956
+ async: false,
957
+ abortEarly: true
958
+ };
959
+ const fallbackRun = schema._zod.bag.fallbackRun;
960
+ let result;
961
+ if (fallbackRun) {
962
+ ctx[COMPILE_FALLBACK] = true;
963
+ result = fallbackRun({
964
+ value,
965
+ issues: []
966
+ }, ctx);
967
+ } else result = schema._zod.run({
968
+ value,
969
+ issues: []
970
+ }, ctx);
971
+ if (result instanceof Promise) throw new $ZodAsyncError();
972
+ return result.issues.length === 0;
973
+ }
974
+ const validateAsync$1 = async (schema, value, _ctx) => {
975
+ const ctx = _ctx ? {
976
+ ..._ctx,
977
+ async: true,
978
+ abortEarly: true
979
+ } : {
980
+ async: true,
981
+ abortEarly: true
982
+ };
983
+ let result = schema._zod.run({
984
+ value,
985
+ issues: []
986
+ }, ctx);
987
+ if (result instanceof Promise) result = await result;
988
+ return result.issues.length === 0;
989
+ };
890
990
  const _encode$1 = (_Err) => {
891
991
  const parse = _parse(_Err);
892
992
  const fn = (schema, value, _ctx, _params) => {
@@ -944,8 +1044,9 @@ const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
944
1044
  return _safeParseAsync(_Err)(schema, value, _ctx);
945
1045
  };
946
1046
  //#endregion
947
- //#region ../../node_modules/.pnpm/zod@4.5.1/node_modules/zod/v4/core/regexes.js
1047
+ //#region ../../node_modules/.pnpm/zod@4.6.1/node_modules/zod/v4/core/regexes.js
948
1048
  var regexes_exports = /* @__PURE__ */ __exportAll({
1049
+ anyString: () => anyString,
949
1050
  base64: () => base64$1,
950
1051
  base64url: () => base64url$1,
951
1052
  bigint: () => bigint$2,
@@ -969,6 +1070,7 @@ var regexes_exports = /* @__PURE__ */ __exportAll({
969
1070
  hostname: () => hostname$1,
970
1071
  html5Email: () => html5Email,
971
1072
  httpProtocol: () => httpProtocol,
1073
+ iban: () => iban$1,
972
1074
  idnEmail: () => idnEmail,
973
1075
  integer: () => integer,
974
1076
  ipv4: () => ipv4$1,
@@ -1039,7 +1141,7 @@ const uuid4 = /*@__PURE__*/ uuid$1(4);
1039
1141
  const uuid6 = /*@__PURE__*/ uuid$1(6);
1040
1142
  const uuid7 = /*@__PURE__*/ uuid$1(7);
1041
1143
  /** Practical email validation */
1042
- const email$1 = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
1144
+ const email$1 = /^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
1043
1145
  /** Equivalent to the HTML5 input[type=email] validation implemented by browsers. Source: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email */
1044
1146
  const html5Email = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
1045
1147
  /** The classic emailregex.com regex for RFC 5322-compliant emails */
@@ -1048,7 +1150,7 @@ const rfc5322Email = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+
1048
1150
  const unicodeEmail = /^[^\s@"]{1,64}@[^\s@]{1,255}$/u;
1049
1151
  const idnEmail = unicodeEmail;
1050
1152
  const browserEmail = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
1051
- const _emoji$1 = `^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
1153
+ const _emoji$1 = `^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
1052
1154
  function emoji$1() {
1053
1155
  return new RegExp(_emoji$1, "u");
1054
1156
  }
@@ -1061,12 +1163,13 @@ const mac$1 = (delimiter) => {
1061
1163
  const cidrv4$1 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/;
1062
1164
  const cidrv6$1 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
1063
1165
  const base64$1 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
1064
- const base64url$1 = /^[A-Za-z0-9_-]*$/;
1166
+ const base64url$1 = /^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;
1065
1167
  const hostname$1 = /^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/;
1066
1168
  const domain = /^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/;
1067
1169
  const httpProtocol = /^https?$/;
1068
1170
  const e164$1 = /^\+[1-9]\d{6,14}$/;
1069
1171
  const creditCard$1 = /^\d(?:[ -]?\d){11,18}$/;
1172
+ const iban$1 = /^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/;
1070
1173
  const dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
1071
1174
  /** Anchors a pattern source. The interpolation lives here rather than at the call site because
1072
1175
  * esbuild will not drop a `@__PURE__` call whose own argument interpolates a variable, but it
@@ -1092,6 +1195,7 @@ function datetime$1(args) {
1092
1195
  const timeRegex = args.local ? `${qualified}|${timeSource({ precision: args.precision })}` : qualified;
1093
1196
  return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
1094
1197
  }
1198
+ const anyString = /^[\s\S]{0,}$/;
1095
1199
  const string$3 = (params) => {
1096
1200
  const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
1097
1201
  return new RegExp(`^${regex}$`);
@@ -1127,7 +1231,7 @@ const sha512_hex = /^[0-9a-fA-F]{128}$/;
1127
1231
  const sha512_base64 = /*@__PURE__*/ fixedBase64(86, "==");
1128
1232
  const sha512_base64url = /*@__PURE__*/ fixedBase64url(86);
1129
1233
  //#endregion
1130
- //#region ../../node_modules/.pnpm/zod@4.5.1/node_modules/zod/v4/core/checks.js
1234
+ //#region ../../node_modules/.pnpm/zod@4.6.1/node_modules/zod/v4/core/checks.js
1131
1235
  const $ZodCheck = /*@__PURE__*/ $constructor("$ZodCheck", (inst, def) => {
1132
1236
  var _a;
1133
1237
  inst._zod ?? (inst._zod = {});
@@ -1152,14 +1256,6 @@ const numericOriginMap = {
1152
1256
  const $ZodCheckLessThan = /*@__PURE__*/ $constructor("$ZodCheckLessThan", (inst, def) => {
1153
1257
  $ZodCheck.init(inst, def);
1154
1258
  const origin = numericOriginMap[typeof def.value];
1155
- inst._zod.onattach.push((inst) => {
1156
- const bag = inst._zod.bag;
1157
- const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
1158
- if (def.value < curr) {
1159
- if (def.inclusive) bag.maximum = def.value;
1160
- else bag.exclusiveMaximum = def.value;
1161
- }
1162
- });
1163
1259
  inst._zod.check = (payload) => {
1164
1260
  if (def.inclusive ? payload.value <= def.value : payload.value < def.value) return;
1165
1261
  payload.issues.push({
@@ -1176,14 +1272,6 @@ const $ZodCheckLessThan = /*@__PURE__*/ $constructor("$ZodCheckLessThan", (inst,
1176
1272
  const $ZodCheckGreaterThan = /*@__PURE__*/ $constructor("$ZodCheckGreaterThan", (inst, def) => {
1177
1273
  $ZodCheck.init(inst, def);
1178
1274
  const origin = numericOriginMap[typeof def.value];
1179
- inst._zod.onattach.push((inst) => {
1180
- const bag = inst._zod.bag;
1181
- const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
1182
- if (def.value > curr) {
1183
- if (def.inclusive) bag.minimum = def.value;
1184
- else bag.exclusiveMinimum = def.value;
1185
- }
1186
- });
1187
1275
  inst._zod.check = (payload) => {
1188
1276
  if (def.inclusive ? payload.value >= def.value : payload.value > def.value) return;
1189
1277
  payload.issues.push({
@@ -1199,10 +1287,6 @@ const $ZodCheckGreaterThan = /*@__PURE__*/ $constructor("$ZodCheckGreaterThan",
1199
1287
  });
1200
1288
  const $ZodCheckMultipleOf = /*@__PURE__*/ $constructor("$ZodCheckMultipleOf", (inst, def) => {
1201
1289
  $ZodCheck.init(inst, def);
1202
- inst._zod.onattach.push((inst) => {
1203
- var _a;
1204
- (_a = inst._zod.bag).multipleOf ?? (_a.multipleOf = def.value);
1205
- });
1206
1290
  inst._zod.check = (payload) => {
1207
1291
  if (typeof payload.value !== typeof def.value) throw new Error("Cannot mix number and bigint in multiple_of check.");
1208
1292
  if (typeof payload.value === "bigint" ? def.value !== BigInt(0) && payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0) return;
@@ -1222,13 +1306,6 @@ const $ZodCheckNumberFormat = /*@__PURE__*/ $constructor("$ZodCheckNumberFormat"
1222
1306
  const isInt = def.format?.includes("int");
1223
1307
  const origin = isInt ? "int" : "number";
1224
1308
  const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];
1225
- inst._zod.onattach.push((inst) => {
1226
- const bag = inst._zod.bag;
1227
- bag.format = def.format;
1228
- bag.minimum = minimum;
1229
- bag.maximum = maximum;
1230
- if (isInt) bag.pattern = integer;
1231
- });
1232
1309
  inst._zod.check = (payload) => {
1233
1310
  const input = payload.value;
1234
1311
  if (isInt) {
@@ -1290,12 +1367,6 @@ const $ZodCheckNumberFormat = /*@__PURE__*/ $constructor("$ZodCheckNumberFormat"
1290
1367
  const $ZodCheckBigIntFormat = /*@__PURE__*/ $constructor("$ZodCheckBigIntFormat", (inst, def) => {
1291
1368
  $ZodCheck.init(inst, def);
1292
1369
  const [minimum, maximum] = BIGINT_FORMAT_RANGES[def.format];
1293
- inst._zod.onattach.push((inst) => {
1294
- const bag = inst._zod.bag;
1295
- bag.format = def.format;
1296
- bag.minimum = minimum;
1297
- bag.maximum = maximum;
1298
- });
1299
1370
  inst._zod.check = (payload) => {
1300
1371
  const input = payload.value;
1301
1372
  if (input < minimum) payload.issues.push({
@@ -1322,10 +1393,6 @@ const $ZodCheckMaxSize = /*@__PURE__*/ $constructor("$ZodCheckMaxSize", (inst, d
1322
1393
  var _a;
1323
1394
  $ZodCheck.init(inst, def);
1324
1395
  (_a = inst._zod.def).when ?? (_a.when = _whenHasSize);
1325
- inst._zod.onattach.push((inst) => {
1326
- const curr = inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
1327
- if (def.maximum < curr) inst._zod.bag.maximum = def.maximum;
1328
- });
1329
1396
  inst._zod.check = (payload) => {
1330
1397
  const input = payload.value;
1331
1398
  if (input.size <= def.maximum) return;
@@ -1344,10 +1411,6 @@ const $ZodCheckMinSize = /*@__PURE__*/ $constructor("$ZodCheckMinSize", (inst, d
1344
1411
  var _a;
1345
1412
  $ZodCheck.init(inst, def);
1346
1413
  (_a = inst._zod.def).when ?? (_a.when = _whenHasSize);
1347
- inst._zod.onattach.push((inst) => {
1348
- const curr = inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
1349
- if (def.minimum > curr) inst._zod.bag.minimum = def.minimum;
1350
- });
1351
1414
  inst._zod.check = (payload) => {
1352
1415
  const input = payload.value;
1353
1416
  if (input.size >= def.minimum) return;
@@ -1366,12 +1429,6 @@ const $ZodCheckSizeEquals = /*@__PURE__*/ $constructor("$ZodCheckSizeEquals", (i
1366
1429
  var _a;
1367
1430
  $ZodCheck.init(inst, def);
1368
1431
  (_a = inst._zod.def).when ?? (_a.when = _whenHasSize);
1369
- inst._zod.onattach.push((inst) => {
1370
- const bag = inst._zod.bag;
1371
- bag.minimum = def.size;
1372
- bag.maximum = def.size;
1373
- bag.size = def.size;
1374
- });
1375
1432
  inst._zod.check = (payload) => {
1376
1433
  const input = payload.value;
1377
1434
  const size = input.size;
@@ -1398,10 +1455,6 @@ const $ZodCheckMaxLength = /*@__PURE__*/ $constructor("$ZodCheckMaxLength", (ins
1398
1455
  var _a;
1399
1456
  $ZodCheck.init(inst, def);
1400
1457
  (_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
1401
- inst._zod.onattach.push((inst) => {
1402
- const curr = inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
1403
- if (def.maximum < curr) inst._zod.bag.maximum = def.maximum;
1404
- });
1405
1458
  inst._zod.check = (payload) => {
1406
1459
  const input = payload.value;
1407
1460
  const units = input.length;
@@ -1422,10 +1475,6 @@ const $ZodCheckMinLength = /*@__PURE__*/ $constructor("$ZodCheckMinLength", (ins
1422
1475
  var _a;
1423
1476
  $ZodCheck.init(inst, def);
1424
1477
  (_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
1425
- inst._zod.onattach.push((inst) => {
1426
- const curr = inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
1427
- if (def.minimum > curr) inst._zod.bag.minimum = def.minimum;
1428
- });
1429
1478
  inst._zod.check = (payload) => {
1430
1479
  const input = payload.value;
1431
1480
  const units = input.length;
@@ -1446,12 +1495,6 @@ const $ZodCheckLengthEquals = /*@__PURE__*/ $constructor("$ZodCheckLengthEquals"
1446
1495
  var _a;
1447
1496
  $ZodCheck.init(inst, def);
1448
1497
  (_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
1449
- inst._zod.onattach.push((inst) => {
1450
- const bag = inst._zod.bag;
1451
- bag.minimum = def.length;
1452
- bag.maximum = def.length;
1453
- bag.length = def.length;
1454
- });
1455
1498
  inst._zod.check = (payload) => {
1456
1499
  const input = payload.value;
1457
1500
  const units = input.length;
@@ -1479,14 +1522,6 @@ const $ZodCheckLengthEquals = /*@__PURE__*/ $constructor("$ZodCheckLengthEquals"
1479
1522
  const $ZodCheckStringFormat = /*@__PURE__*/ $constructor("$ZodCheckStringFormat", (inst, def) => {
1480
1523
  var _a, _b;
1481
1524
  $ZodCheck.init(inst, def);
1482
- inst._zod.onattach.push((inst) => {
1483
- const bag = inst._zod.bag;
1484
- bag.format = def.format;
1485
- if (def.pattern) {
1486
- bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
1487
- bag.patterns.add(def.pattern);
1488
- }
1489
- });
1490
1525
  if (def.pattern) (_a = inst._zod).check ?? (_a.check = (payload) => {
1491
1526
  def.pattern.lastIndex = 0;
1492
1527
  if (def.pattern.test(payload.value)) return;
@@ -1529,13 +1564,7 @@ const $ZodCheckUpperCase = /*@__PURE__*/ $constructor("$ZodCheckUpperCase", (ins
1529
1564
  const $ZodCheckIncludes = /*@__PURE__*/ $constructor("$ZodCheckIncludes", (inst, def) => {
1530
1565
  $ZodCheck.init(inst, def);
1531
1566
  const escapedRegex = escapeRegex$1(def.includes);
1532
- const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position},}${escapedRegex}` : escapedRegex);
1533
- def.pattern = pattern;
1534
- inst._zod.onattach.push((inst) => {
1535
- const bag = inst._zod.bag;
1536
- bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
1537
- bag.patterns.add(pattern);
1538
- });
1567
+ def.pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position},}${escapedRegex}` : escapedRegex);
1539
1568
  inst._zod.check = (payload) => {
1540
1569
  if (payload.value.includes(def.includes, def.position)) return;
1541
1570
  payload.issues.push({
@@ -1553,11 +1582,6 @@ const $ZodCheckStartsWith = /*@__PURE__*/ $constructor("$ZodCheckStartsWith", (i
1553
1582
  $ZodCheck.init(inst, def);
1554
1583
  const pattern = new RegExp(`^${escapeRegex$1(def.prefix)}.*`);
1555
1584
  def.pattern ?? (def.pattern = pattern);
1556
- inst._zod.onattach.push((inst) => {
1557
- const bag = inst._zod.bag;
1558
- bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
1559
- bag.patterns.add(pattern);
1560
- });
1561
1585
  inst._zod.check = (payload) => {
1562
1586
  if (payload.value.startsWith(def.prefix)) return;
1563
1587
  payload.issues.push({
@@ -1575,11 +1599,6 @@ const $ZodCheckEndsWith = /*@__PURE__*/ $constructor("$ZodCheckEndsWith", (inst,
1575
1599
  $ZodCheck.init(inst, def);
1576
1600
  const pattern = new RegExp(`.*${escapeRegex$1(def.suffix)}$`);
1577
1601
  def.pattern ?? (def.pattern = pattern);
1578
- inst._zod.onattach.push((inst) => {
1579
- const bag = inst._zod.bag;
1580
- bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
1581
- bag.patterns.add(pattern);
1582
- });
1583
1602
  inst._zod.check = (payload) => {
1584
1603
  if (payload.value.endsWith(def.suffix)) return;
1585
1604
  payload.issues.push({
@@ -1610,9 +1629,6 @@ const $ZodCheckProperty = /*@__PURE__*/ $constructor("$ZodCheckProperty", (inst,
1610
1629
  const $ZodCheckMimeType = /*@__PURE__*/ $constructor("$ZodCheckMimeType", (inst, def) => {
1611
1630
  $ZodCheck.init(inst, def);
1612
1631
  const mimeSet = new Set(def.mime);
1613
- inst._zod.onattach.push((inst) => {
1614
- inst._zod.bag.mime = def.mime;
1615
- });
1616
1632
  inst._zod.check = (payload) => {
1617
1633
  if (mimeSet.has(payload.value.type)) return;
1618
1634
  payload.issues.push({
@@ -1631,7 +1647,7 @@ const $ZodCheckOverwrite = /*@__PURE__*/ $constructor("$ZodCheckOverwrite", (ins
1631
1647
  };
1632
1648
  });
1633
1649
  //#endregion
1634
- //#region ../../node_modules/.pnpm/zod@4.5.1/node_modules/zod/v4/core/doc.js
1650
+ //#region ../../node_modules/.pnpm/zod@4.6.1/node_modules/zod/v4/core/doc.js
1635
1651
  var Doc = class {
1636
1652
  constructor(args = [], closed = {}) {
1637
1653
  this.content = [];
@@ -1641,8 +1657,11 @@ var Doc = class {
1641
1657
  }
1642
1658
  indented(fn) {
1643
1659
  this.indent += 1;
1644
- fn(this);
1645
- this.indent -= 1;
1660
+ try {
1661
+ fn(this);
1662
+ } finally {
1663
+ this.indent -= 1;
1664
+ }
1646
1665
  }
1647
1666
  write(arg) {
1648
1667
  if (typeof arg === "function") {
@@ -1662,14 +1681,14 @@ var Doc = class {
1662
1681
  }
1663
1682
  };
1664
1683
  //#endregion
1665
- //#region ../../node_modules/.pnpm/zod@4.5.1/node_modules/zod/v4/core/versions.js
1684
+ //#region ../../node_modules/.pnpm/zod@4.6.1/node_modules/zod/v4/core/versions.js
1666
1685
  const version$1 = {
1667
1686
  major: 4,
1668
- minor: 5,
1687
+ minor: 6,
1669
1688
  patch: 1
1670
1689
  };
1671
1690
  //#endregion
1672
- //#region ../../node_modules/.pnpm/zod@4.5.1/node_modules/zod/v4/core/schemas.js
1691
+ //#region ../../node_modules/.pnpm/zod@4.6.1/node_modules/zod/v4/core/schemas.js
1673
1692
  const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
1674
1693
  var _a;
1675
1694
  inst ?? (inst = {});
@@ -1758,15 +1777,26 @@ const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
1758
1777
  }
1759
1778
  });
1760
1779
  /** The Standard Schema surface for `inst`. Shared so wrappers can extend it without forcing it. */
1761
- const toStandardResult = (r) => r.success ? { value: r.data } : { issues: r.error?.issues };
1780
+ const toStandardResult = (r, ctx) => r.issues.length ? { issues: r.issues.map((iss) => finalizeIssue(iss, ctx, config())) } : { value: r.value };
1781
+ async function validateAsync(inst, value) {
1782
+ const ctx = { async: true };
1783
+ return toStandardResult(await inst._zod.run({
1784
+ value,
1785
+ issues: []
1786
+ }, ctx), ctx);
1787
+ }
1762
1788
  function standardProps(inst) {
1763
1789
  return {
1764
1790
  validate: (value) => {
1791
+ const ctx = { async: false };
1765
1792
  try {
1766
- return toStandardResult(safeParse$1(inst, value));
1767
- } catch (_) {
1768
- return safeParseAsync$1(inst, value).then(toStandardResult);
1769
- }
1793
+ const r = inst._zod.run({
1794
+ value,
1795
+ issues: []
1796
+ }, ctx);
1797
+ if (!(r instanceof Promise)) return toStandardResult(r, ctx);
1798
+ } catch (_) {}
1799
+ return validateAsync(inst, value);
1770
1800
  },
1771
1801
  vendor: "zod",
1772
1802
  version: 1
@@ -1774,7 +1804,7 @@ function standardProps(inst) {
1774
1804
  }
1775
1805
  const $ZodString = /*@__PURE__*/ $constructor("$ZodString", (inst, def) => {
1776
1806
  $ZodType.init(inst, def);
1777
- inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string$3(inst._zod.bag);
1807
+ inst._zod.pattern = def.pattern ?? anyString;
1778
1808
  inst._zod.parse = (payload, _) => {
1779
1809
  if (def.coerce) try {
1780
1810
  payload.value = String(payload.value);
@@ -1935,12 +1965,6 @@ const $ZodKSUID = /*@__PURE__*/ $constructor("$ZodKSUID", (inst, def) => {
1935
1965
  const $ZodISODateTime = /*@__PURE__*/ $constructor("$ZodISODateTime", (inst, def) => {
1936
1966
  def.pattern ?? (def.pattern = datetime$1(def));
1937
1967
  $ZodStringFormat.init(inst, def);
1938
- if (def.local || def.precision === -1) {
1939
- inst._zod.bag.laxFormat = true;
1940
- inst._zod.onattach.push((s) => {
1941
- s._zod.bag.laxFormat = true;
1942
- });
1943
- }
1944
1968
  });
1945
1969
  const $ZodISODate = /*@__PURE__*/ $constructor("$ZodISODate", (inst, def) => {
1946
1970
  def.pattern ?? (def.pattern = date$2);
@@ -1957,7 +1981,6 @@ const $ZodISODuration = /*@__PURE__*/ $constructor("$ZodISODuration", (inst, def
1957
1981
  const $ZodIPv4 = /*@__PURE__*/ $constructor("$ZodIPv4", (inst, def) => {
1958
1982
  def.pattern ?? (def.pattern = ipv4$1);
1959
1983
  $ZodStringFormat.init(inst, def);
1960
- inst._zod.bag.format = `ipv4`;
1961
1984
  });
1962
1985
  /** An IPv6 address is written with hex digits, colons and dots, and nothing else. The guard is what makes the check below an IPv6 check: `new URL("http://[...]")` parses an authority, not an address, so `@` and `\` re-delimit it and `"::@1\\"` validates against the host `0.0.0.1`. The URL parser also deletes ASCII tab, LF and CR rather than failing, which is how `"::1\n"` validated as `::1`. */
1963
1986
  const ipv6Alphabet = /^[0-9a-fA-F:.]+$/;
@@ -1973,7 +1996,6 @@ function isValidIPv6(value) {
1973
1996
  const $ZodIPv6 = /*@__PURE__*/ $constructor("$ZodIPv6", (inst, def) => {
1974
1997
  def.pattern ?? (def.pattern = ipv6$1);
1975
1998
  $ZodStringFormat.init(inst, def);
1976
- inst._zod.bag.format = `ipv6`;
1977
1999
  inst._zod.check = (payload) => {
1978
2000
  if (!isValidIPv6(payload.value)) payload.issues.push({
1979
2001
  code: "invalid_format",
@@ -1987,7 +2009,6 @@ const $ZodIPv6 = /*@__PURE__*/ $constructor("$ZodIPv6", (inst, def) => {
1987
2009
  const $ZodMAC = /*@__PURE__*/ $constructor("$ZodMAC", (inst, def) => {
1988
2010
  def.pattern ?? (def.pattern = mac$1(def.delimiter));
1989
2011
  $ZodStringFormat.init(inst, def);
1990
- inst._zod.bag.format = `mac`;
1991
2012
  });
1992
2013
  const $ZodCIDRv4 = /*@__PURE__*/ $constructor("$ZodCIDRv4", (inst, def) => {
1993
2014
  def.pattern ?? (def.pattern = cidrv4$1);
@@ -2027,10 +2048,10 @@ function isValidBase64(data) {
2027
2048
  return false;
2028
2049
  }
2029
2050
  }
2051
+ const base64Charset = /^[0-9a-zA-Z+/]*={0,2}$/;
2030
2052
  const $ZodBase64 = /*@__PURE__*/ $constructor("$ZodBase64", (inst, def) => {
2031
- def.pattern ?? (def.pattern = base64$1);
2053
+ def.pattern ?? (def.pattern = base64Charset);
2032
2054
  $ZodStringFormat.init(inst, def);
2033
- inst._zod.bag.contentEncoding = "base64";
2034
2055
  inst._zod.check = (payload) => {
2035
2056
  if (isValidBase64(payload.value)) return;
2036
2057
  payload.issues.push({
@@ -2042,15 +2063,15 @@ const $ZodBase64 = /*@__PURE__*/ $constructor("$ZodBase64", (inst, def) => {
2042
2063
  });
2043
2064
  };
2044
2065
  });
2066
+ const base64urlCharset = /^[A-Za-z0-9_-]*$/;
2045
2067
  function isValidBase64URL(data) {
2046
- if (!base64url$1.test(data)) return false;
2068
+ if (!base64urlCharset.test(data)) return false;
2047
2069
  const base64 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
2048
2070
  return isValidBase64(base64.padEnd(Math.ceil(base64.length / 4) * 4, "="));
2049
2071
  }
2050
2072
  const $ZodBase64URL = /*@__PURE__*/ $constructor("$ZodBase64URL", (inst, def) => {
2051
- def.pattern ?? (def.pattern = base64url$1);
2073
+ def.pattern ?? (def.pattern = base64urlCharset);
2052
2074
  $ZodStringFormat.init(inst, def);
2053
- inst._zod.bag.contentEncoding = "base64url";
2054
2075
  inst._zod.check = (payload) => {
2055
2076
  if (isValidBase64URL(payload.value)) return;
2056
2077
  payload.issues.push({
@@ -2073,7 +2094,7 @@ function isLuhnAlgo(digits) {
2073
2094
  let bit = 1;
2074
2095
  let sum = 0;
2075
2096
  while (length) {
2076
- const value = +digits[--length];
2097
+ const value = digits.charCodeAt(--length) - 48;
2077
2098
  bit ^= 1;
2078
2099
  sum += bit ? [
2079
2100
  0,
@@ -2108,6 +2129,37 @@ const $ZodCreditCard = /*@__PURE__*/ $constructor("$ZodCreditCard", (inst, def)
2108
2129
  });
2109
2130
  };
2110
2131
  });
2132
+ function isIso7064Mod97(iban) {
2133
+ let remainder = 0;
2134
+ const len = iban.length;
2135
+ for (let i = 4; i < len; i++) {
2136
+ const code = iban.charCodeAt(i);
2137
+ remainder = (code >= 65 ? remainder * 100 + (code - 55) : remainder * 10 + (code - 48)) % 97;
2138
+ }
2139
+ for (let i = 0; i < 4; i++) {
2140
+ const code = iban.charCodeAt(i);
2141
+ remainder = (code >= 65 ? remainder * 100 + (code - 55) : remainder * 10 + (code - 48)) % 97;
2142
+ }
2143
+ return remainder === 1;
2144
+ }
2145
+ function isValidIBAN(input) {
2146
+ if (!iban$1.test(input)) return false;
2147
+ return isIso7064Mod97(input);
2148
+ }
2149
+ const $ZodIBAN = /*@__PURE__*/ $constructor("$ZodIBAN", (inst, def) => {
2150
+ def.pattern ?? (def.pattern = iban$1);
2151
+ $ZodStringFormat.init(inst, def);
2152
+ inst._zod.check = (payload) => {
2153
+ if (isValidIBAN(payload.value)) return;
2154
+ payload.issues.push({
2155
+ code: "invalid_format",
2156
+ format: "iban",
2157
+ input: payload.value,
2158
+ inst,
2159
+ continue: !def.abort
2160
+ });
2161
+ };
2162
+ });
2111
2163
  function isValidJWT(token, algorithm = null) {
2112
2164
  try {
2113
2165
  const tokensParts = token.split(".");
@@ -2151,7 +2203,7 @@ const $ZodCustomStringFormat = /*@__PURE__*/ $constructor("$ZodCustomStringForma
2151
2203
  });
2152
2204
  const $ZodNumber = /*@__PURE__*/ $constructor("$ZodNumber", (inst, def) => {
2153
2205
  $ZodType.init(inst, def);
2154
- inst._zod.pattern = inst._zod.bag.pattern ?? number$3;
2206
+ inst._zod.pattern = number$3;
2155
2207
  inst._zod.parse = (payload, _ctx) => {
2156
2208
  if (def.coerce) try {
2157
2209
  payload.value = Number(payload.value);
@@ -2332,6 +2384,7 @@ const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
2332
2384
  }
2333
2385
  payload.value = memo ? memo.alloc(inst, payload, Array(input.length), ctx) : Array(input.length);
2334
2386
  const proms = [];
2387
+ const abortEarly = ctx?.abortEarly;
2335
2388
  for (let i = 0; i < input.length; i++) {
2336
2389
  const item = input[i];
2337
2390
  const result = def.element._zod.run({
@@ -2339,7 +2392,10 @@ const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
2339
2392
  issues: []
2340
2393
  }, ctx);
2341
2394
  if (result instanceof Promise) proms.push(result.then((result) => handleArrayResult(result, payload, i)));
2342
- else handleArrayResult(result, payload, i);
2395
+ else {
2396
+ handleArrayResult(result, payload, i);
2397
+ if (abortEarly && result.issues.length !== 0 && aborted(result)) break;
2398
+ }
2343
2399
  }
2344
2400
  if (proms.length) return Promise.all(proms).then(() => payload);
2345
2401
  return payload;
@@ -2383,14 +2439,19 @@ function normalizeDef(def) {
2383
2439
  optionalKeys: new Set(okeys)
2384
2440
  };
2385
2441
  }
2386
- function handleCatchall(proms, input, payload, ctx, def, inst) {
2442
+ function handleCatchall(proms, input, payload, ctx, def, inst, abortEarly) {
2387
2443
  const unrecognized = [];
2388
2444
  const keySet = def.keySet;
2389
2445
  const _catchall = def.catchall._zod;
2390
2446
  const t = _catchall.def.type;
2391
2447
  const optin = _catchall.optin;
2392
2448
  const optout = _catchall.optout;
2449
+ let seen = 0;
2393
2450
  for (const key in input) {
2451
+ if (abortEarly && payload.issues.length !== seen) {
2452
+ if (aborted(payload, seen)) break;
2453
+ seen = payload.issues.length;
2454
+ }
2394
2455
  if (keySet.has(key)) continue;
2395
2456
  if (key === "__proto__") {
2396
2457
  if (t === "never") unrecognized.push(key);
@@ -2419,18 +2480,19 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
2419
2480
  return payload;
2420
2481
  });
2421
2482
  }
2422
- const propShapes = /* @__PURE__ */ new WeakMap();
2423
2483
  const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
2424
2484
  $ZodType.init(inst, def);
2425
- if (!Object.getOwnPropertyDescriptor(def, "shape")?.get) {
2426
- const sh = def.shape;
2427
- propShapes.set(def, sh);
2428
- Object.defineProperty(def, "shape", { get: () => {
2485
+ const desc = Object.getOwnPropertyDescriptor(def, "shape");
2486
+ const sh = desc?.get ? desc.get.raw : def.shape ?? {};
2487
+ if (sh) {
2488
+ const get = () => {
2429
2489
  const newSh = { ...sh };
2430
2490
  Object.defineProperty(def, "shape", { value: newSh });
2431
- propShapes.set(def, newSh);
2491
+ get.raw = newSh;
2432
2492
  return newSh;
2433
- } });
2493
+ };
2494
+ get.raw = sh;
2495
+ Object.defineProperty(def, "shape", { get });
2434
2496
  }
2435
2497
  const _normalized = cached(() => normalizeDef(def));
2436
2498
  defineLazyInternal(inst, "propValues", (zod) => {
@@ -2466,7 +2528,13 @@ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
2466
2528
  payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
2467
2529
  const proms = [];
2468
2530
  const shape = value.shape;
2531
+ const abortEarly = ctx?.abortEarly;
2532
+ let seen = payload.issues.length;
2469
2533
  for (const key of value.allKeys) {
2534
+ if (abortEarly && payload.issues.length !== seen) {
2535
+ if (aborted(payload, seen)) break;
2536
+ seen = payload.issues.length;
2537
+ }
2470
2538
  if (key === "__proto__") continue;
2471
2539
  const el = shape[key];
2472
2540
  const optin = el._zod.optin;
@@ -2479,7 +2547,7 @@ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
2479
2547
  else handlePropertyResult(r, payload, key, input, optin, optout);
2480
2548
  }
2481
2549
  if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload;
2482
- return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
2550
+ return handleCatchall(proms, input, payload, ctx, _normalized.value, inst, abortEarly === true);
2483
2551
  };
2484
2552
  });
2485
2553
  const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) => {
@@ -2498,10 +2566,16 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
2498
2566
  });
2499
2567
  const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
2500
2568
  const prefixStr = (id, k) => `
2569
+ let ${id}_ab = false;
2501
2570
  for (let i = 0; i < ${id}.issues.length; i++) {
2502
2571
  const iss = ${id}.issues[i];
2503
2572
  iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
2504
2573
  payload.issues.push(iss);
2574
+ if (iss.continue !== true) ${id}_ab = true;
2575
+ }
2576
+ if (${id}_ab && ctx && ctx.abortEarly) {
2577
+ payload.value = newResult;
2578
+ return payload;
2505
2579
  }`;
2506
2580
  doc.write(`const input = payload.value;`);
2507
2581
  const ids = Object.create(null);
@@ -2543,6 +2617,10 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
2543
2617
  input: undefined,
2544
2618
  path: [${k}]
2545
2619
  });
2620
+ if (ctx && ctx.abortEarly) {
2621
+ payload.value = newResult;
2622
+ return payload;
2623
+ }
2546
2624
  }
2547
2625
 
2548
2626
  if (${id}_present) {
@@ -2590,7 +2668,7 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
2590
2668
  if (!fastpass) fastpass = generateFastpass(def.shape);
2591
2669
  payload = fastpass(payload, ctx);
2592
2670
  if (!catchall) return payload;
2593
- return handleCatchall([], input, payload, ctx, value, inst);
2671
+ return handleCatchall([], input, payload, ctx, value, inst, ctx?.abortEarly === true);
2594
2672
  }
2595
2673
  return superParse(payload, ctx);
2596
2674
  };
@@ -2697,39 +2775,42 @@ const $ZodXor = /*@__PURE__*/ $constructor("$ZodXor", (inst, def) => {
2697
2775
  });
2698
2776
  };
2699
2777
  });
2778
+ function discriminatorMap(def) {
2779
+ const map = /* @__PURE__ */ new Map();
2780
+ for (const option of def.options) {
2781
+ const values = option._zod.propValues?.[def.discriminator];
2782
+ if (!values || values.size === 0) throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
2783
+ for (const value of values) if (map.has(value)) {
2784
+ if (value !== void 0) throw new Error(`Duplicate discriminator value "${String(value)}"`);
2785
+ map.set(value, null);
2786
+ } else map.set(value, option);
2787
+ }
2788
+ return map;
2789
+ }
2700
2790
  const $ZodDiscriminatedUnion = /*@__PURE__*/ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
2701
2791
  def.inclusive = false;
2702
2792
  $ZodUnion.init(inst, def);
2703
2793
  const _super = inst._zod.parse;
2704
2794
  defineLazyInternal(inst, "propValues", (zod) => {
2705
2795
  const propValues = {};
2796
+ let undefinedCount = 0;
2706
2797
  for (const option of zod.def.options) {
2707
2798
  const pv = option._zod.propValues;
2708
2799
  if (!pv || Object.keys(pv).length === 0) throw new Error(`Invalid discriminated union option at index "${zod.def.options.indexOf(option)}"`);
2800
+ if (pv[zod.def.discriminator]?.has(void 0)) undefinedCount++;
2709
2801
  for (const [k, v] of Object.entries(pv)) {
2710
2802
  if (!Object.prototype.hasOwnProperty.call(propValues, k)) assignProp(propValues, k, /* @__PURE__ */ new Set());
2711
2803
  for (const val of v) propValues[k].add(val);
2712
2804
  }
2713
2805
  }
2806
+ if (!zod.def.unionFallback && undefinedCount > 1) propValues[zod.def.discriminator]?.delete(void 0);
2714
2807
  return propValues;
2715
2808
  });
2716
2809
  def.options.forEach((option, i) => {
2717
- const propShape = propShapes.get(option._zod.def);
2810
+ const propShape = rawShape(option._zod.def);
2718
2811
  if (propShape && !Object.prototype.hasOwnProperty.call(propShape, def.discriminator)) throw new Error(`Invalid discriminated union option at index "${i}"`);
2719
2812
  });
2720
- const disc = cached(() => {
2721
- const opts = def.options;
2722
- const map = /* @__PURE__ */ new Map();
2723
- for (const o of opts) {
2724
- const values = o._zod.propValues?.[def.discriminator];
2725
- if (!values || values.size === 0) throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
2726
- for (const v of values) {
2727
- if (map.has(v)) throw new Error(`Duplicate discriminator value "${String(v)}"`);
2728
- map.set(v, o);
2729
- }
2730
- }
2731
- return map;
2732
- });
2813
+ const disc = cached(() => discriminatorMap(def));
2733
2814
  inst._zod.parse = (payload, ctx) => {
2734
2815
  const input = payload.value;
2735
2816
  if (!isObject$1(input)) {
@@ -2741,15 +2822,16 @@ const $ZodDiscriminatedUnion = /*@__PURE__*/ $constructor("$ZodDiscriminatedUnio
2741
2822
  });
2742
2823
  return payload;
2743
2824
  }
2744
- const opt = disc.value.get(input?.[def.discriminator]);
2745
- if (opt) return opt._zod.run(payload, ctx);
2825
+ const value = input?.[def.discriminator];
2826
+ const opt = disc.value.get(value);
2827
+ if (opt && (value !== void 0 || ctx.direction !== "backward")) return opt._zod.run(payload, ctx);
2746
2828
  if (def.unionFallback || ctx.direction === "backward") return _super(payload, ctx);
2747
2829
  payload.issues.push({
2748
2830
  code: "invalid_union",
2749
2831
  errors: [],
2750
2832
  note: "No matching discriminator",
2751
2833
  discriminator: def.discriminator,
2752
- options: Array.from(disc.value.keys()),
2834
+ options: Array.from(disc.value.keys()).filter((value) => disc.value.get(value) !== null),
2753
2835
  input,
2754
2836
  path: [def.discriminator],
2755
2837
  inst
@@ -2913,6 +2995,8 @@ const $ZodTuple = /*@__PURE__*/ $constructor("$ZodTuple", (inst, def) => {
2913
2995
  });
2914
2996
  }
2915
2997
  const itemResults = new Array(items.length);
2998
+ const abortEarly = def.rest ? ctx?.abortEarly : void 0;
2999
+ let itemAborted = false;
2916
3000
  for (let i = 0; i < items.length; i++) {
2917
3001
  const r = items[i]._zod.run({
2918
3002
  value: input[i],
@@ -2921,12 +3005,20 @@ const $ZodTuple = /*@__PURE__*/ $constructor("$ZodTuple", (inst, def) => {
2921
3005
  if (r instanceof Promise) proms.push(r.then((rr) => {
2922
3006
  itemResults[i] = rr;
2923
3007
  }));
2924
- else itemResults[i] = r;
3008
+ else {
3009
+ itemResults[i] = r;
3010
+ if (abortEarly && !itemAborted && r.issues.length) itemAborted = aborted(r);
3011
+ }
2925
3012
  }
2926
- if (def.rest) {
3013
+ if (def.rest && !itemAborted) {
2927
3014
  let i = items.length - 1;
2928
3015
  const rest = input.slice(items.length);
3016
+ let seen = payload.issues.length;
2929
3017
  for (const el of rest) {
3018
+ if (abortEarly && payload.issues.length !== seen) {
3019
+ if (aborted(payload, seen)) break;
3020
+ seen = payload.issues.length;
3021
+ }
2930
3022
  i++;
2931
3023
  const result = def.rest._zod.run({
2932
3024
  value: el,
@@ -3118,7 +3210,13 @@ const $ZodMap = /*@__PURE__*/ $constructor("$ZodMap", (inst, def) => {
3118
3210
  }
3119
3211
  const proms = [];
3120
3212
  payload.value = memo ? memo.alloc(inst, payload, /* @__PURE__ */ new Map(), ctx) : /* @__PURE__ */ new Map();
3213
+ const abortEarly = ctx?.abortEarly;
3214
+ let seen = payload.issues.length;
3121
3215
  for (const [key, value] of input) {
3216
+ if (abortEarly && payload.issues.length !== seen) {
3217
+ if (aborted(payload, seen)) break;
3218
+ seen = payload.issues.length;
3219
+ }
3122
3220
  const keyResult = def.keyType._zod.run({
3123
3221
  value: key,
3124
3222
  issues: []
@@ -3177,7 +3275,13 @@ const $ZodSet = /*@__PURE__*/ $constructor("$ZodSet", (inst, def) => {
3177
3275
  }
3178
3276
  const proms = [];
3179
3277
  payload.value = memo ? memo.alloc(inst, payload, /* @__PURE__ */ new Set(), ctx) : /* @__PURE__ */ new Set();
3278
+ const abortEarly = ctx?.abortEarly;
3279
+ let seen = payload.issues.length;
3180
3280
  for (const item of input) {
3281
+ if (abortEarly && payload.issues.length !== seen) {
3282
+ if (aborted(payload, seen)) break;
3283
+ seen = payload.issues.length;
3284
+ }
3181
3285
  const result = def.valueType._zod.run({
3182
3286
  value: item,
3183
3287
  issues: []
@@ -3198,8 +3302,10 @@ const $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def) => {
3198
3302
  const values = getEnumValues(def.entries);
3199
3303
  const valuesSet = new Set(values);
3200
3304
  inst._zod.values = valuesSet;
3201
- const patternValues = values.filter((k) => propertyKeyTypes.has(typeof k));
3202
- inst._zod.pattern = new RegExp(patternValues.length ? `^(${patternValues.map((o) => escapeRegex$1(o.toString())).join("|")})$` : "^[^\\s\\S]$");
3305
+ defineLazyInternal(inst, "pattern", (zod) => {
3306
+ const patternValues = getEnumValues(zod.def.entries).filter((k) => propertyKeyTypes.has(typeof k));
3307
+ return new RegExp(patternValues.length ? `^(${patternValues.map((o) => escapeRegex$1(o.toString())).join("|")})$` : "^[^\\s\\S]$");
3308
+ });
3203
3309
  inst._zod.parse = (payload, _ctx) => {
3204
3310
  const input = payload.value;
3205
3311
  if (valuesSet.has(input)) return payload;
@@ -3216,7 +3322,10 @@ const $ZodLiteral = /*@__PURE__*/ $constructor("$ZodLiteral", (inst, def) => {
3216
3322
  $ZodType.init(inst, def);
3217
3323
  const values = new Set(def.values);
3218
3324
  inst._zod.values = values;
3219
- inst._zod.pattern = new RegExp(def.values.length ? `^(${def.values.map((o) => typeof o === "string" ? escapeRegex$1(o) : o ? escapeRegex$1(o.toString()) : String(o)).join("|")})$` : "^[^\\s\\S]$");
3325
+ defineLazyInternal(inst, "pattern", (zod) => {
3326
+ const vals = zod.def.values;
3327
+ return new RegExp(vals.length ? `^(${vals.map((o) => typeof o === "string" ? escapeRegex$1(o) : o ? escapeRegex$1(o.toString()) : String(o)).join("|")})$` : "^[^\\s\\S]$");
3328
+ });
3220
3329
  inst._zod.parse = (payload, _ctx) => {
3221
3330
  const input = payload.value;
3222
3331
  if (values.has(input)) return payload;
@@ -3512,16 +3621,53 @@ function handleReadonlyResult(payload) {
3512
3621
  if (!payload.memo) payload.value = Object.freeze(payload.value);
3513
3622
  return payload;
3514
3623
  }
3624
+ function leafPattern(schema) {
3625
+ const def = schema._zod.def;
3626
+ let pattern = def.pattern;
3627
+ let isInt = !!def.format?.includes("int");
3628
+ let minimum;
3629
+ let maximum;
3630
+ for (const ch of def.checks ?? []) {
3631
+ const d = ch._zod.def;
3632
+ if (d.pattern) pattern = d.pattern;
3633
+ isInt || (isInt = !!d.format?.includes("int"));
3634
+ const lo = d.minimum ?? d.length;
3635
+ const hi = d.maximum ?? d.length;
3636
+ if (lo !== void 0 && (minimum === void 0 || lo > minimum)) minimum = lo;
3637
+ if (hi !== void 0 && (maximum === void 0 || hi < maximum)) maximum = hi;
3638
+ }
3639
+ if (pattern) return pattern.source;
3640
+ if (minimum !== void 0 && maximum !== void 0 && minimum > maximum) return "(?!)";
3641
+ if (minimum !== void 0 || maximum !== void 0) return string$3({
3642
+ minimum,
3643
+ maximum
3644
+ }).source;
3645
+ const own = schema._zod.pattern;
3646
+ return (isInt && own === number$3 ? integer : own)?.source;
3647
+ }
3648
+ function partPattern(schema) {
3649
+ const def = schema._zod.def;
3650
+ const own = schema._zod.pattern?.source;
3651
+ const inner = def.innerType ?? schema._zod.innerType;
3652
+ if (inner) {
3653
+ const before = inner._zod.pattern?.source;
3654
+ const after = partPattern(inner);
3655
+ if (own && before && after && after !== before) return own.replace(cleanRegex(before), () => cleanRegex(after));
3656
+ return own;
3657
+ }
3658
+ if (def.options) {
3659
+ const sources = def.options.map(partPattern);
3660
+ if (sources.every(Boolean)) return `^(${sources.map((s) => cleanRegex(s)).join("|")})$`;
3661
+ }
3662
+ return leafPattern(schema);
3663
+ }
3515
3664
  const $ZodTemplateLiteral = /*@__PURE__*/ $constructor("$ZodTemplateLiteral", (inst, def) => {
3516
3665
  $ZodType.init(inst, def);
3517
3666
  const regexParts = [];
3518
3667
  for (const part of def.parts) if (typeof part === "object" && part !== null) {
3519
- if (!part._zod.pattern) throw new Error(`Invalid template literal part, no pattern found: ${[...part._zod.traits].shift()}`);
3520
- const source = part._zod.pattern instanceof RegExp ? part._zod.pattern.source : part._zod.pattern;
3521
- if (!source) throw new Error(`Invalid template literal part: ${part._zod.traits}`);
3522
- const start = source.startsWith("^") ? 1 : 0;
3523
- const end = source.endsWith("$") ? source.length - 1 : source.length;
3524
- regexParts.push(source.slice(start, end));
3668
+ const source = partPattern(part);
3669
+ if (!source) throw new Error(`Invalid template literal part, no pattern found: ${[...part._zod.traits].shift()}`);
3670
+ regexParts.push(cleanRegex(source));
3525
3671
  } else if (part === null || primitiveTypes.has(typeof part)) regexParts.push(escapeRegex$1(`${part}`));
3526
3672
  else throw new Error(`Invalid template literal part: ${part}`);
3527
3673
  inst._zod.pattern = new RegExp(`^${regexParts.join("")}$`);
@@ -3668,8 +3814,67 @@ function handleRefineResult(result, payload, input, inst) {
3668
3814
  payload.issues.push(issue(_iss));
3669
3815
  }
3670
3816
  }
3817
+ function handlePropertiesResult(result, payload, key) {
3818
+ if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
3819
+ }
3820
+ const $ZodProperties = /*@__PURE__*/ $constructor("$ZodProperties", (inst, def) => {
3821
+ $ZodType.init(inst, def);
3822
+ $ZodCheck.init(inst, def);
3823
+ const memo = globalConfig.memoizer;
3824
+ memo?.attach(inst);
3825
+ let entries;
3826
+ const runShape = (payload, ctx) => {
3827
+ entries ?? (entries = Reflect.ownKeys(def.shape).map((key) => [key, def.shape[key]]));
3828
+ const input = payload.value;
3829
+ let proms;
3830
+ for (const [key, schema] of entries) {
3831
+ const result = schema._zod.run({
3832
+ value: input[key],
3833
+ issues: []
3834
+ }, ctx);
3835
+ if (result instanceof Promise) {
3836
+ proms ?? (proms = []);
3837
+ proms.push(result.then((result) => handlePropertiesResult(result, payload, key)));
3838
+ } else handlePropertiesResult(result, payload, key);
3839
+ }
3840
+ if (proms) return Promise.all(proms).then(() => void 0);
3841
+ };
3842
+ inst._zod.parse = (payload, ctx) => {
3843
+ const input = payload.value;
3844
+ if (input === null || typeof input !== "object" && typeof input !== "function") {
3845
+ payload.issues.push({
3846
+ expected: "object",
3847
+ code: "invalid_type",
3848
+ input,
3849
+ inst
3850
+ });
3851
+ return payload;
3852
+ }
3853
+ if (ctx.direction === "backward") ctx = {
3854
+ ...ctx,
3855
+ direction: "forward"
3856
+ };
3857
+ if (memo) memo.alloc(inst, payload, input, ctx);
3858
+ const result = runShape(payload, ctx);
3859
+ return result instanceof Promise ? result.then(() => payload) : payload;
3860
+ };
3861
+ inst._zod.check = (payload) => {
3862
+ if (payload.value == null) {
3863
+ payload.issues.push({
3864
+ expected: "object",
3865
+ code: "invalid_type",
3866
+ input: payload.value,
3867
+ inst
3868
+ });
3869
+ return;
3870
+ }
3871
+ return runShape(payload, {});
3872
+ };
3873
+ }, { *[Symbol.iterator]() {
3874
+ yield this;
3875
+ } });
3671
3876
  //#endregion
3672
- //#region ../../node_modules/.pnpm/zod@4.5.1/node_modules/zod/v4/core/memoizer.js
3877
+ //#region ../../node_modules/.pnpm/zod@4.6.1/node_modules/zod/v4/core/memoizer.js
3673
3878
  var $ZodCyclicError = class extends Error {
3674
3879
  constructor() {
3675
3880
  super(`Cannot parse a reference cycle that closes through a transform`);
@@ -3679,6 +3884,9 @@ var $ZodCyclicError = class extends Error {
3679
3884
  /** Keyed off the context object every schema in one parse call already shares. */
3680
3885
  const STATE = "~memo";
3681
3886
  const NO_ISSUES = [];
3887
+ function isRef(value) {
3888
+ return value !== null && (typeof value === "object" || typeof value === "function");
3889
+ }
3682
3890
  function cloneIssues(issues) {
3683
3891
  return issues.map((iss) => iss.path ? {
3684
3892
  ...iss,
@@ -3686,36 +3894,134 @@ function cloneIssues(issues) {
3686
3894
  } : { ...iss });
3687
3895
  }
3688
3896
  const recursive = /*@__PURE__*/ new WeakMap();
3897
+ /** What the walk established, in order of certainty: ordered so the strongest answer among children wins. */
3898
+ const NONE = 0;
3899
+ const ASSUMED = 1;
3900
+ const PROVEN = 2;
3689
3901
  /** Whether this schema's subtree contains a cycle, so one parse can re-enter it. */
3690
- function isRecursive(inst, stack) {
3902
+ function isRecursive(inst, stack, resolve) {
3691
3903
  const cached = recursive.get(inst);
3692
- if (cached !== void 0) return cached;
3693
- if (stack.has(inst)) return true;
3904
+ if (cached !== void 0) return cached ? PROVEN : NONE;
3905
+ if (stack.has(inst)) return PROVEN;
3694
3906
  stack.add(inst);
3695
- let result = false;
3907
+ let result = NONE;
3696
3908
  const check = (child) => {
3697
- if (!result && child?._zod && isRecursive(child, stack)) result = true;
3909
+ if (result !== PROVEN && child?._zod) {
3910
+ const answer = isRecursive(child, stack, resolve);
3911
+ if (answer > result) result = answer;
3912
+ }
3913
+ };
3914
+ const shape = (sh, spread) => {
3915
+ let answer = NONE;
3916
+ for (const key of Reflect.ownKeys(sh)) {
3917
+ const desc = Object.getOwnPropertyDescriptor(sh, key);
3918
+ if (spread && !desc.enumerable) continue;
3919
+ const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve) : NONE;
3920
+ if (child > answer) answer = child;
3921
+ }
3922
+ return answer;
3923
+ };
3924
+ const merge = (answer) => {
3925
+ if (answer > result) result = answer;
3698
3926
  };
3699
3927
  const def = inst._zod.def;
3700
- if (def.type === "lazy") check(inst._zod.innerType);
3701
- else {
3702
- const shape = def.shape;
3703
- if (shape) for (const key of Reflect.ownKeys(shape)) check(shape[key]);
3704
- for (const key in def) {
3705
- const value = def[key];
3928
+ switch (def.type) {
3929
+ case "object": {
3930
+ const raw = rawShape(def);
3931
+ merge(raw ? shape(raw, true) : ASSUMED);
3932
+ check(def.catchall);
3933
+ break;
3934
+ }
3935
+ case "properties":
3936
+ merge(shape(def.shape, false));
3937
+ break;
3938
+ case "array":
3939
+ check(def.element);
3940
+ break;
3941
+ case "tuple":
3942
+ for (const el of def.items) check(el);
3943
+ check(def.rest);
3944
+ break;
3945
+ case "record":
3946
+ case "map":
3947
+ check(def.keyType);
3948
+ check(def.valueType);
3949
+ break;
3950
+ case "set":
3951
+ check(def.valueType);
3952
+ break;
3953
+ case "union":
3954
+ for (const el of def.options) check(el);
3955
+ break;
3956
+ case "intersection":
3957
+ check(def.left);
3958
+ check(def.right);
3959
+ break;
3960
+ case "optional":
3961
+ case "nullable":
3962
+ case "default":
3963
+ case "prefault":
3964
+ case "catch":
3965
+ case "readonly":
3966
+ case "nonoptional":
3967
+ case "promise":
3968
+ case "success":
3969
+ check(def.innerType);
3970
+ break;
3971
+ case "pipe":
3972
+ check(def.in);
3973
+ check(def.out);
3974
+ break;
3975
+ case "function":
3976
+ check(def.input);
3977
+ check(def.output);
3978
+ break;
3979
+ case "lazy": {
3980
+ const inner = def._cachedInner ?? (resolve ? inst._zod.innerType : void 0);
3981
+ merge(inner ? isRecursive(inner, stack, false) : ASSUMED);
3982
+ break;
3983
+ }
3984
+ case "template_literal":
3985
+ case "string":
3986
+ case "number":
3987
+ case "int":
3988
+ case "boolean":
3989
+ case "bigint":
3990
+ case "symbol":
3991
+ case "undefined":
3992
+ case "null":
3993
+ case "void":
3994
+ case "never":
3995
+ case "any":
3996
+ case "unknown":
3997
+ case "date":
3998
+ case "nan":
3999
+ case "enum":
4000
+ case "literal":
4001
+ case "file":
4002
+ case "transform":
4003
+ case "custom": break;
4004
+ default: for (const key in def) {
4005
+ const desc = Object.getOwnPropertyDescriptor(def, key);
4006
+ if (!desc || desc.get) continue;
4007
+ const value = desc.value;
3706
4008
  if (!value || typeof value !== "object") continue;
3707
4009
  if (value._zod) check(value);
3708
4010
  else if (Array.isArray(value)) for (const el of value) check(el);
3709
4011
  }
3710
4012
  }
3711
4013
  stack.delete(inst);
3712
- recursive.set(inst, result);
3713
- return result;
4014
+ return settle(inst, result);
4015
+ }
4016
+ /** An assumed answer must not outlive the resolution that settles it, so only a certain one is cached. */
4017
+ function settle(inst, answer) {
4018
+ if (answer !== ASSUMED) recursive.set(inst, answer === PROVEN);
4019
+ return answer;
3714
4020
  }
3715
4021
  function bucketFor(state, inst) {
3716
4022
  let bucket = state.buckets.get(inst);
3717
4023
  if (!bucket) {
3718
- bucket = /* @__PURE__ */ new Map();
4024
+ bucket = /* @__PURE__ */ new WeakMap();
3719
4025
  state.buckets.set(inst, bucket);
3720
4026
  }
3721
4027
  return bucket;
@@ -3751,6 +4057,7 @@ const memo = {
3751
4057
  attach(inst) {
3752
4058
  var _a;
3753
4059
  let isRecursiveInst;
4060
+ let rechecked = false;
3754
4061
  let lastCtx;
3755
4062
  let lastBucket;
3756
4063
  (_a = inst._zod).deferred ?? (_a.deferred = []);
@@ -3758,19 +4065,21 @@ const memo = {
3758
4065
  const base = inst._zod.parse;
3759
4066
  const wrapped = (payload, ctx) => {
3760
4067
  if (isRecursiveInst === void 0) {
3761
- isRecursiveInst = isRecursive(inst, /* @__PURE__ */ new Set());
3762
- if (!isRecursiveInst) {
4068
+ const walked = isRecursive(inst, /* @__PURE__ */ new Set(), false);
4069
+ if (walked === NONE) {
3763
4070
  inst._zod.parse = base;
3764
4071
  if (inst._zod.run === wrapped) inst._zod.run = base;
3765
4072
  return base(payload, ctx);
3766
4073
  }
4074
+ if (walked === PROVEN || rechecked) isRecursiveInst = true;
4075
+ else rechecked = true;
3767
4076
  }
3768
4077
  const input = payload.value;
3769
- if (input === null || typeof input !== "object") return base(payload, ctx);
4078
+ if (!isRef(input)) return base(payload, ctx);
3770
4079
  let state = ctx[STATE];
3771
4080
  if (!state) {
3772
4081
  state = {
3773
- buckets: /* @__PURE__ */ new Map(),
4082
+ buckets: /* @__PURE__ */ new WeakMap(),
3774
4083
  backEdges: void 0
3775
4084
  };
3776
4085
  ctx[STATE] = state;
@@ -3789,7 +4098,7 @@ const memo = {
3789
4098
  if (hit.issues.length) payload.issues.push(...cloneIssues(hit.issues));
3790
4099
  } else {
3791
4100
  payload.memo = true;
3792
- state.backEdges ?? (state.backEdges = /* @__PURE__ */ new Set());
4101
+ state.backEdges ?? (state.backEdges = /* @__PURE__ */ new WeakSet());
3793
4102
  state.backEdges.add(hit.value);
3794
4103
  }
3795
4104
  return payload;
@@ -3818,10 +4127,10 @@ function memoizer() {
3818
4127
  /** Whether this value is a node a back-edge resolved to before it finished. */
3819
4128
  function isBackEdge(ctx, value) {
3820
4129
  const backEdges = ctx[STATE]?.backEdges;
3821
- return backEdges !== void 0 && value !== null && typeof value === "object" && backEdges.has(value);
4130
+ return backEdges !== void 0 && isRef(value) && backEdges.has(value);
3822
4131
  }
3823
4132
  //#endregion
3824
- //#region ../../node_modules/.pnpm/zod@4.5.1/node_modules/zod/v4/locales/en.js
4133
+ //#region ../../node_modules/.pnpm/zod@4.6.1/node_modules/zod/v4/locales/en.js
3825
4134
  const error = () => {
3826
4135
  const Sizable = {
3827
4136
  string: {
@@ -3877,6 +4186,7 @@ const error = () => {
3877
4186
  json_string: "JSON string",
3878
4187
  e164: "E.164 number",
3879
4188
  credit_card: "credit card number",
4189
+ iban: "IBAN",
3880
4190
  jwt: "JWT",
3881
4191
  template_literal: "input"
3882
4192
  };
@@ -3927,7 +4237,7 @@ function en_default() {
3927
4237
  return { localeError: error() };
3928
4238
  }
3929
4239
  //#endregion
3930
- //#region ../../node_modules/.pnpm/zod@4.5.1/node_modules/zod/v4/core/registries.js
4240
+ //#region ../../node_modules/.pnpm/zod@4.6.1/node_modules/zod/v4/core/registries.js
3931
4241
  var _a;
3932
4242
  var $ZodRegistry = class {
3933
4243
  constructor() {
@@ -3974,7 +4284,7 @@ function registry$2() {
3974
4284
  (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry$2());
3975
4285
  const globalRegistry = globalThis.__zod_globalRegistry;
3976
4286
  //#endregion
3977
- //#region ../../node_modules/.pnpm/zod@4.5.1/node_modules/zod/v4/core/api.js
4287
+ //#region ../../node_modules/.pnpm/zod@4.6.1/node_modules/zod/v4/core/api.js
3978
4288
  // @__NO_SIDE_EFFECTS__
3979
4289
  function _string(Class, params) {
3980
4290
  return new Class({
@@ -4221,6 +4531,16 @@ function _creditCard(Class, params) {
4221
4531
  });
4222
4532
  }
4223
4533
  // @__NO_SIDE_EFFECTS__
4534
+ function _iban(Class, params) {
4535
+ return new Class({
4536
+ type: "string",
4537
+ format: "iban",
4538
+ check: "string_format",
4539
+ abort: false,
4540
+ ...normalizeParams(params)
4541
+ });
4542
+ }
4543
+ // @__NO_SIDE_EFFECTS__
4224
4544
  function _jwt(Class, params) {
4225
4545
  return new Class({
4226
4546
  type: "string",
@@ -4589,12 +4909,13 @@ function _property(property, schema, params) {
4589
4909
  });
4590
4910
  }
4591
4911
  // @__NO_SIDE_EFFECTS__
4592
- function _properties(shape) {
4593
- return Object.entries(shape).map(([property, schema]) => new $ZodCheckProperty({
4594
- check: "property",
4595
- property,
4596
- schema
4597
- }));
4912
+ function _properties(Class, shape, params) {
4913
+ return new Class({
4914
+ type: "properties",
4915
+ check: "properties",
4916
+ shape,
4917
+ ...normalizeParams(params)
4918
+ });
4598
4919
  }
4599
4920
  // @__NO_SIDE_EFFECTS__
4600
4921
  function _mime(types, params) {
@@ -4799,7 +5120,7 @@ function _stringFormat(Class, format, fnOrRegex, _params = {}) {
4799
5120
  return new Class(def);
4800
5121
  }
4801
5122
  //#endregion
4802
- //#region ../../node_modules/.pnpm/zod@4.5.1/node_modules/zod/v4/core/to-json-schema.js
5123
+ //#region ../../node_modules/.pnpm/zod@4.6.1/node_modules/zod/v4/core/to-json-schema.js
4803
5124
  function assignProps(target, ...sources) {
4804
5125
  for (const source of sources) for (const key of Reflect.ownKeys(source)) if (Object.prototype.propertyIsEnumerable.call(source, key)) assignProp(target, key, source[key]);
4805
5126
  return target;
@@ -4822,6 +5143,7 @@ function initializeContext(params) {
4822
5143
  cycles: params?.cycles ?? "ref",
4823
5144
  reused: params?.reused ?? "inline",
4824
5145
  intersections: [],
5146
+ deferred: [],
4825
5147
  external: params?.external ?? void 0
4826
5148
  };
4827
5149
  }
@@ -4841,7 +5163,7 @@ function handleUnrepresentable(schema, ctx, json, params, message) {
4841
5163
  Object.assign(json, result);
4842
5164
  return true;
4843
5165
  }
4844
- function process$3(schema, ctx, _params = {
5166
+ function processSchema(schema, ctx, _params = {
4845
5167
  path: [],
4846
5168
  schemaPath: []
4847
5169
  }) {
@@ -4880,7 +5202,7 @@ function process$3(schema, ctx, _params = {
4880
5202
  const parent = schema._zod.parent;
4881
5203
  if (parent) {
4882
5204
  if (!result.ref) result.ref = parent;
4883
- process$3(parent, ctx, params);
5205
+ processSchema(parent, ctx, params);
4884
5206
  ctx.seen.get(parent).isParent = true;
4885
5207
  }
4886
5208
  }
@@ -4970,10 +5292,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4970
5292
  continue;
4971
5293
  }
4972
5294
  if (seen.count > 1) {
4973
- if (ctx.reused === "ref") {
4974
- extractToDef(entry);
4975
- continue;
4976
- }
5295
+ if (ctx.reused === "ref") extractToDef(entry);
4977
5296
  }
4978
5297
  }
4979
5298
  if (ctx.external) ctx.sharedDefsExtractedFor = ctx.external;
@@ -5131,6 +5450,7 @@ function finalize(ctx, schema) {
5131
5450
  if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) {
5132
5451
  for (const entry of [...ctx.seen.entries()].reverse()) flattenRef(entry[0]);
5133
5452
  if (ctx.target !== "openapi-3.0") for (const entry of ctx.seen.entries()) compactTypeUnion(entry[1].def ?? entry[1].schema);
5453
+ for (const rewrite of ctx.deferred) rewrite();
5134
5454
  if (ctx.intersections.length) {
5135
5455
  const carriers = /* @__PURE__ */ new Map();
5136
5456
  for (const seen of ctx.seen.values()) for (const json of [seen.schema, seen.def]) {
@@ -5227,7 +5547,7 @@ const createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
5227
5547
  ...params,
5228
5548
  processors
5229
5549
  });
5230
- process$3(schema, ctx);
5550
+ processSchema(schema, ctx);
5231
5551
  extractDefs(ctx, schema);
5232
5552
  return finalize(ctx, schema);
5233
5553
  };
@@ -5239,12 +5559,84 @@ const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params)
5239
5559
  io,
5240
5560
  processors
5241
5561
  });
5242
- process$3(schema, ctx);
5562
+ processSchema(schema, ctx);
5243
5563
  extractDefs(ctx, schema);
5244
5564
  return finalize(ctx, schema);
5245
5565
  };
5246
5566
  //#endregion
5247
- //#region ../../node_modules/.pnpm/zod@4.5.1/node_modules/zod/v4/core/json-schema-processors.js
5567
+ //#region ../../node_modules/.pnpm/zod@4.6.1/node_modules/zod/v4/core/json-schema-processors.js
5568
+ const narrowMin = (agg, key, value) => {
5569
+ if (agg[key] === void 0 || value > agg[key]) agg[key] = value;
5570
+ };
5571
+ const narrowMax = (agg, key, value) => {
5572
+ if (agg[key] === void 0 || value < agg[key]) agg[key] = value;
5573
+ };
5574
+ const narrowBoth = (agg, value) => {
5575
+ narrowMin(agg, "minimum", value);
5576
+ narrowMax(agg, "maximum", value);
5577
+ };
5578
+ const addDivisor = (agg, value) => {
5579
+ agg.multipleOf ?? (agg.multipleOf = []);
5580
+ if (!agg.multipleOf.includes(value)) agg.multipleOf.push(value);
5581
+ };
5582
+ const addPattern = (agg, pattern) => {
5583
+ agg.patterns ?? (agg.patterns = /* @__PURE__ */ new Set());
5584
+ agg.patterns.add(pattern);
5585
+ };
5586
+ const intersectMime = (agg, mime) => {
5587
+ agg.mime = agg.mime ? agg.mime.filter((m) => mime.includes(m)) : [...mime];
5588
+ };
5589
+ const setFormat = (agg, format) => {
5590
+ agg.format = format;
5591
+ if (format.includes("int")) agg.isInt = true;
5592
+ };
5593
+ const minContributor = (agg, def) => narrowMin(agg, "minimum", def.minimum);
5594
+ const maxContributor = (agg, def) => narrowMax(agg, "maximum", def.maximum);
5595
+ const formatContributor = (ranges) => (agg, def) => {
5596
+ setFormat(agg, def.format);
5597
+ const [minimum, maximum] = ranges[def.format];
5598
+ narrowMin(agg, "minimum", minimum);
5599
+ narrowMax(agg, "maximum", maximum);
5600
+ };
5601
+ const contributors = {
5602
+ greater_than: (agg, def) => narrowMin(agg, def.inclusive ? "minimum" : "exclusiveMinimum", def.value),
5603
+ less_than: (agg, def) => narrowMax(agg, def.inclusive ? "maximum" : "exclusiveMaximum", def.value),
5604
+ multiple_of: (agg, def) => addDivisor(agg, def.value),
5605
+ number_format: formatContributor(NUMBER_FORMAT_RANGES),
5606
+ bigint_format: formatContributor(BIGINT_FORMAT_RANGES),
5607
+ min_length: minContributor,
5608
+ max_length: maxContributor,
5609
+ length_equals: (agg, def) => narrowBoth(agg, def.length),
5610
+ min_size: minContributor,
5611
+ max_size: maxContributor,
5612
+ size_equals: (agg, def) => narrowBoth(agg, def.size),
5613
+ string_format: (agg, def) => {
5614
+ setFormat(agg, def.format);
5615
+ if (def.pattern) addPattern(agg, def.pattern);
5616
+ if (def.format === "base64" || def.format === "base64url") agg.contentEncoding = def.format;
5617
+ if (def.local || def.precision === -1) agg.laxFormat = true;
5618
+ },
5619
+ mime_type: (agg, def) => intersectMime(agg, def.mime)
5620
+ };
5621
+ function aggregateChecks(schema) {
5622
+ const agg = {};
5623
+ const def = schema._zod.def;
5624
+ const list = schema._zod.traits.has("$ZodCheck") ? [schema, ...def.checks ?? []] : def.checks ?? [];
5625
+ for (const ch of list) contributors[ch._zod.def.check]?.(agg, ch._zod.def);
5626
+ const bag = schema._zod.bag;
5627
+ if (bag.minimum !== void 0) narrowMin(agg, "minimum", bag.minimum);
5628
+ if (bag.exclusiveMinimum !== void 0) narrowMin(agg, "exclusiveMinimum", bag.exclusiveMinimum);
5629
+ if (bag.maximum !== void 0) narrowMax(agg, "maximum", bag.maximum);
5630
+ if (bag.exclusiveMaximum !== void 0) narrowMax(agg, "exclusiveMaximum", bag.exclusiveMaximum);
5631
+ if (bag.multipleOf !== void 0) addDivisor(agg, bag.multipleOf);
5632
+ if (bag.format !== void 0) {
5633
+ agg.format ?? (agg.format = bag.format);
5634
+ if (bag.format.includes("int")) agg.isInt = true;
5635
+ }
5636
+ if (bag.mime) intersectMime(agg, bag.mime);
5637
+ for (const pattern of bag.patterns ?? []) addPattern(agg, pattern);
5638
+ return agg;
5639
+ }
5248
5640
  const formatMap = {
5249
5641
  guid: "uuid",
5250
5642
  url: "uri",
@@ -5252,10 +5644,12 @@ const formatMap = {
5252
5644
  json_string: "json-string",
5253
5645
  regex: ""
5254
5646
  };
5647
+ const exactPatterns = /* @__PURE__ */ new Map([[base64Charset, base64$1], [base64urlCharset, base64url$1]]);
5648
+ const exactPattern = (p) => exactPatterns.get(p) ?? p;
5255
5649
  const stringProcessor = (schema, ctx, _json, _params) => {
5256
5650
  const json = _json;
5257
5651
  json.type = "string";
5258
- const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = schema._zod.bag;
5652
+ const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = aggregateChecks(schema);
5259
5653
  if (typeof minimum === "number") json.minLength = minimum;
5260
5654
  if (typeof maximum === "number") json.maxLength = maximum;
5261
5655
  if (format) {
@@ -5265,9 +5659,9 @@ const stringProcessor = (schema, ctx, _json, _params) => {
5265
5659
  }
5266
5660
  if (contentEncoding) json.contentEncoding = contentEncoding;
5267
5661
  if (patterns && patterns.size > 0) {
5268
- const regexes = [...patterns];
5269
- if (regexes.length === 1) json.pattern = regexes[0].source;
5270
- else if (regexes.length > 1) json.allOf = [...regexes.map((regex) => ({
5662
+ const patternList = [...patterns].map(exactPattern);
5663
+ if (patternList.length === 1) json.pattern = patternList[0].source;
5664
+ else if (patternList.length > 1) json.allOf = [...patternList.map((regex) => ({
5271
5665
  ...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
5272
5666
  pattern: regex.source
5273
5667
  }))];
@@ -5275,9 +5669,8 @@ const stringProcessor = (schema, ctx, _json, _params) => {
5275
5669
  };
5276
5670
  const numberProcessor = (schema, ctx, _json, params) => {
5277
5671
  const json = _json;
5278
- const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
5279
- if (typeof format === "string" && format.includes("int")) json.type = "integer";
5280
- else json.type = "number";
5672
+ const { minimum, maximum, multipleOf, exclusiveMaximum, exclusiveMinimum, isInt } = aggregateChecks(schema);
5673
+ json.type = isInt ? "integer" : "number";
5281
5674
  const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
5282
5675
  const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
5283
5676
  const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
@@ -5293,9 +5686,13 @@ const numberProcessor = (schema, ctx, _json, params) => {
5293
5686
  json.exclusiveMaximum = true;
5294
5687
  } else json.exclusiveMaximum = exclusiveMaximum;
5295
5688
  } else if (typeof maximum === "number") json.maximum = maximum;
5296
- if (typeof multipleOf === "number") {
5297
- if (Number.isFinite(multipleOf) && multipleOf !== 0) json.multipleOf = Math.abs(multipleOf);
5298
- else handleUnrepresentable(schema, ctx, json, params, `A multipleOf divisor of ${multipleOf} cannot be represented in JSON Schema`);
5689
+ if (multipleOf) {
5690
+ const divisors = /* @__PURE__ */ new Set();
5691
+ for (const divisor of multipleOf) if (Number.isFinite(divisor) && divisor !== 0) divisors.add(Math.abs(divisor));
5692
+ else handleUnrepresentable(schema, ctx, json, params, `A multipleOf divisor of ${divisor} cannot be represented in JSON Schema`);
5693
+ const [first, ...rest] = divisors;
5694
+ if (first !== void 0) json.multipleOf = first;
5695
+ if (rest.length) json.allOf = [...json.allOf ?? [], ...rest.map((m) => ({ multipleOf: m }))];
5299
5696
  }
5300
5697
  };
5301
5698
  const booleanProcessor = (_schema, _ctx, json, _params) => {
@@ -5375,23 +5772,16 @@ const templateLiteralProcessor = (schema, _ctx, json, _params) => {
5375
5772
  };
5376
5773
  const fileProcessor = (schema, _ctx, json, _params) => {
5377
5774
  const _json = json;
5378
- const file = {
5379
- type: "string",
5380
- format: "binary",
5381
- contentEncoding: "binary"
5382
- };
5383
- const { minimum, maximum, mime } = schema._zod.bag;
5384
- if (minimum !== void 0) file.minLength = minimum;
5385
- if (maximum !== void 0) file.maxLength = maximum;
5386
- if (mime) {
5387
- if (mime.length === 1) {
5388
- file.contentMediaType = mime[0];
5389
- Object.assign(_json, file);
5390
- } else {
5391
- Object.assign(_json, file);
5392
- _json.anyOf = mime.map((m) => ({ contentMediaType: m }));
5393
- }
5394
- } else Object.assign(_json, file);
5775
+ _json.type = "string";
5776
+ _json.format = "binary";
5777
+ _json.contentEncoding = "binary";
5778
+ const { minimum, maximum, mime } = aggregateChecks(schema);
5779
+ if (minimum !== void 0) _json.minLength = minimum;
5780
+ if (maximum !== void 0) _json.maxLength = maximum;
5781
+ if (!mime) return;
5782
+ if (mime.length === 0) _json.not = {};
5783
+ else if (mime.length === 1) _json.contentMediaType = mime[0];
5784
+ else _json.anyOf = mime.map((m) => ({ contentMediaType: m }));
5395
5785
  };
5396
5786
  const successProcessor = (_schema, _ctx, json, _params) => {
5397
5787
  json.type = "boolean";
@@ -5414,11 +5804,11 @@ const setProcessor = (schema, ctx, json, params) => {
5414
5804
  const arrayProcessor = (schema, ctx, _json, params) => {
5415
5805
  const json = _json;
5416
5806
  const def = schema._zod.def;
5417
- const { minimum, maximum } = schema._zod.bag;
5807
+ const { minimum, maximum } = aggregateChecks(schema);
5418
5808
  if (typeof minimum === "number") json.minItems = minimum;
5419
5809
  if (typeof maximum === "number") json.maxItems = maximum;
5420
5810
  json.type = "array";
5421
- json.items = process$3(def.element, ctx, {
5811
+ json.items = processSchema(def.element, ctx, {
5422
5812
  ...params,
5423
5813
  path: [...params.path, "items"]
5424
5814
  });
@@ -5436,7 +5826,7 @@ const objectProcessor = (schema, ctx, _json, params) => {
5436
5826
  if (Object.getOwnPropertySymbols(shape).length && handleUnrepresentable(schema, ctx, json, params, "Symbol keys cannot be represented in JSON Schema")) return;
5437
5827
  json.type = "object";
5438
5828
  json.properties = {};
5439
- for (const key in shape) assignProp(json.properties, key, process$3(shape[key], ctx, {
5829
+ for (const key in shape) assignProp(json.properties, key, processSchema(shape[key], ctx, {
5440
5830
  ...params,
5441
5831
  path: [
5442
5832
  ...params.path,
@@ -5454,7 +5844,7 @@ const objectProcessor = (schema, ctx, _json, params) => {
5454
5844
  if (def.catchall?._zod.def.type === "never") json.additionalProperties = false;
5455
5845
  else if (!def.catchall) {
5456
5846
  if (ctx.io === "output") json.additionalProperties = false;
5457
- } else if (def.catchall) json.additionalProperties = process$3(def.catchall, ctx, {
5847
+ } else if (def.catchall) json.additionalProperties = processSchema(def.catchall, ctx, {
5458
5848
  ...params,
5459
5849
  path: [...params.path, "additionalProperties"]
5460
5850
  });
@@ -5462,7 +5852,7 @@ const objectProcessor = (schema, ctx, _json, params) => {
5462
5852
  const unionProcessor = (schema, ctx, json, params) => {
5463
5853
  const def = schema._zod.def;
5464
5854
  const isExclusive = def.inclusive === false;
5465
- const options = def.options.map((x, i) => process$3(x, ctx, {
5855
+ const options = def.options.map((x, i) => processSchema(x, ctx, {
5466
5856
  ...params,
5467
5857
  path: [
5468
5858
  ...params.path,
@@ -5475,7 +5865,7 @@ const unionProcessor = (schema, ctx, json, params) => {
5475
5865
  };
5476
5866
  const intersectionProcessor = (schema, ctx, json, params) => {
5477
5867
  const def = schema._zod.def;
5478
- const a = process$3(def.left, ctx, {
5868
+ const a = processSchema(def.left, ctx, {
5479
5869
  ...params,
5480
5870
  path: [
5481
5871
  ...params.path,
@@ -5483,7 +5873,7 @@ const intersectionProcessor = (schema, ctx, json, params) => {
5483
5873
  0
5484
5874
  ]
5485
5875
  });
5486
- const b = process$3(def.right, ctx, {
5876
+ const b = processSchema(def.right, ctx, {
5487
5877
  ...params,
5488
5878
  path: [
5489
5879
  ...params.path,
@@ -5502,7 +5892,7 @@ const tupleProcessor = (schema, ctx, _json, params) => {
5502
5892
  json.type = "array";
5503
5893
  const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
5504
5894
  const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
5505
- const prefixItems = def.items.map((x, i) => process$3(x, ctx, {
5895
+ const prefixItems = def.items.map((x, i) => processSchema(x, ctx, {
5506
5896
  ...params,
5507
5897
  path: [
5508
5898
  ...params.path,
@@ -5510,7 +5900,7 @@ const tupleProcessor = (schema, ctx, _json, params) => {
5510
5900
  i
5511
5901
  ]
5512
5902
  }));
5513
- const rest = def.rest ? process$3(def.rest, ctx, {
5903
+ const rest = def.rest ? processSchema(def.rest, ctx, {
5514
5904
  ...params,
5515
5905
  path: [
5516
5906
  ...params.path,
@@ -5544,18 +5934,76 @@ const tupleProcessor = (schema, ctx, _json, params) => {
5544
5934
  if (minItems > 0) json.minItems = minItems;
5545
5935
  if (isClosed) json.maxItems = maxItems;
5546
5936
  }
5547
- const { minimum, maximum } = schema._zod.bag;
5937
+ const { minimum, maximum } = aggregateChecks(schema);
5548
5938
  if (typeof minimum === "number") json.minItems = minimum;
5549
5939
  if (typeof maximum === "number") json.maxItems = maximum;
5550
5940
  };
5941
+ /** JSON object keys are always strings, so a numeric record key schema is re-expressed over the
5942
+ * numeric-string form the record parser matches. Deferred to `finalize`, after the flatten: a key
5943
+ * behind a wrapper only carries its own `type` before then, and a union key only has its branches.
5944
+ *
5945
+ * A numeric bound cannot apply to a property name, so `minimum` and its siblings are dropped rather
5946
+ * than carried over: keeping them beside `type: "string"` reproduces the match-nothing schema this
5947
+ * exists to fix. A key that carries one therefore emits wider than the record parses — `z.record(z.number().min(5), V)`
5948
+ * accepts `"3"` — which is the deliberate trade, since throwing on it would reject an ordinary schema
5949
+ * outright. */
5950
+ function stringifyKeyNames(bySchema, json, visited) {
5951
+ if (json.$ref) {
5952
+ if (visited.has(json)) return json;
5953
+ visited.add(json);
5954
+ const def = bySchema.get(json)?.def;
5955
+ if (!def) return json;
5956
+ const inlined = stringifyKeyNames(bySchema, def, visited);
5957
+ return inlined === def ? json : inlined;
5958
+ }
5959
+ for (const keyword of ["anyOf", "oneOf"]) {
5960
+ const branches = json[keyword];
5961
+ if (!Array.isArray(branches)) continue;
5962
+ const mapped = branches.map((branch) => stringifyKeyNames(bySchema, branch, visited));
5963
+ if (mapped.some((branch, i) => branch !== branches[i])) json = {
5964
+ ...json,
5965
+ [keyword]: mapped
5966
+ };
5967
+ }
5968
+ const types = Array.isArray(json.type) ? json.type : [json.type];
5969
+ const numericType = !types.includes("string") && types.some((t) => t === "number" || t === "integer");
5970
+ const values = json.enum ?? (json.const !== void 0 ? [json.const] : void 0);
5971
+ if (!numericType && !values?.some((v) => typeof v === "number")) return json;
5972
+ const { minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, format, id, ...rest } = json;
5973
+ if (rest.enum) rest.enum = rest.enum.map((v) => typeof v === "number" ? String(v) : v);
5974
+ else if (typeof rest.const === "number") rest.const = String(rest.const);
5975
+ if (!numericType) return rest;
5976
+ rest.type = "string";
5977
+ if (!values) rest.pattern = (types.includes("number") ? number$3 : integer).source;
5978
+ return rest;
5979
+ }
5980
+ /** Every record of one conversion, so the carriers are found in a single pass rather than once per record. */
5981
+ const pendingRecords = /* @__PURE__ */ new WeakMap();
5982
+ function rewriteKeyNames(ctx) {
5983
+ const bySchema = /* @__PURE__ */ new Map();
5984
+ for (const entry of ctx.seen.values()) if (entry.def && !bySchema.has(entry.schema)) bySchema.set(entry.schema, entry);
5985
+ const rewrites = /* @__PURE__ */ new Map();
5986
+ for (const record of pendingRecords.get(ctx) ?? []) {
5987
+ const seen = ctx.seen.get(record);
5988
+ const names = (seen?.def ?? seen?.schema)?.propertyNames;
5989
+ if (!names || names === true || rewrites.has(names)) continue;
5990
+ const rewritten = stringifyKeyNames(bySchema, names, /* @__PURE__ */ new Set());
5991
+ if (rewritten !== names) rewrites.set(names, rewritten);
5992
+ }
5993
+ if (!rewrites.size) return;
5994
+ for (const entry of ctx.seen.values()) for (const carrier of [entry.schema, entry.def]) {
5995
+ const rewritten = carrier && rewrites.get(carrier.propertyNames);
5996
+ if (rewritten) carrier.propertyNames = rewritten;
5997
+ }
5998
+ }
5551
5999
  const recordProcessor = (schema, ctx, _json, params) => {
5552
6000
  const json = _json;
5553
6001
  const def = schema._zod.def;
5554
6002
  json.type = "object";
5555
6003
  const keyType = def.keyType;
5556
- const patterns = keyType._zod.bag?.patterns;
6004
+ const patterns = aggregateChecks(keyType).patterns;
5557
6005
  if (def.mode === "loose" && patterns && patterns.size > 0) {
5558
- const valueSchema = process$3(def.valueType, ctx, {
6006
+ const valueSchema = processSchema(def.valueType, ctx, {
5559
6007
  ...params,
5560
6008
  path: [
5561
6009
  ...params.path,
@@ -5564,13 +6012,22 @@ const recordProcessor = (schema, ctx, _json, params) => {
5564
6012
  ]
5565
6013
  });
5566
6014
  json.patternProperties = {};
5567
- for (const pattern of patterns) assignProp(json.patternProperties, pattern.source, valueSchema);
6015
+ for (const pattern of patterns) assignProp(json.patternProperties, exactPattern(pattern).source, valueSchema);
5568
6016
  } else {
5569
- if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") json.propertyNames = process$3(def.keyType, ctx, {
5570
- ...params,
5571
- path: [...params.path, "propertyNames"]
5572
- });
5573
- json.additionalProperties = process$3(def.valueType, ctx, {
6017
+ if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
6018
+ json.propertyNames = processSchema(def.keyType, ctx, {
6019
+ ...params,
6020
+ path: [...params.path, "propertyNames"]
6021
+ });
6022
+ let pending = pendingRecords.get(ctx);
6023
+ if (!pending) {
6024
+ pending = [];
6025
+ pendingRecords.set(ctx, pending);
6026
+ ctx.deferred.push(() => rewriteKeyNames(ctx));
6027
+ }
6028
+ pending.push(schema);
6029
+ }
6030
+ json.additionalProperties = processSchema(def.valueType, ctx, {
5574
6031
  ...params,
5575
6032
  path: [...params.path, "additionalProperties"]
5576
6033
  });
@@ -5579,12 +6036,12 @@ const recordProcessor = (schema, ctx, _json, params) => {
5579
6036
  const omittableOnInput = ctx.io === "input" && inputOptin(def.valueType) !== void 0;
5580
6037
  if (keyValues && !def.partial && !omittableOnInput) {
5581
6038
  const validKeyValues = [...keyValues].filter((v) => typeof v === "string" || typeof v === "number");
5582
- if (validKeyValues.length > 0) json.required = validKeyValues;
6039
+ if (validKeyValues.length > 0) json.required = validKeyValues.map(String);
5583
6040
  }
5584
6041
  };
5585
6042
  const nullableProcessor = (schema, ctx, json, params) => {
5586
6043
  const def = schema._zod.def;
5587
- const inner = process$3(def.innerType, ctx, params);
6044
+ const inner = processSchema(def.innerType, ctx, params);
5588
6045
  const seen = ctx.seen.get(schema);
5589
6046
  if (ctx.target === "openapi-3.0") {
5590
6047
  seen.ref = def.innerType;
@@ -5593,7 +6050,7 @@ const nullableProcessor = (schema, ctx, json, params) => {
5593
6050
  };
5594
6051
  const nonoptionalProcessor = (schema, ctx, _json, params) => {
5595
6052
  const def = schema._zod.def;
5596
- process$3(def.innerType, ctx, params);
6053
+ processSchema(def.innerType, ctx, params);
5597
6054
  const seen = ctx.seen.get(schema);
5598
6055
  seen.ref = def.innerType;
5599
6056
  };
@@ -5614,7 +6071,7 @@ function serializeDefaultValue(value, schema, ctx, json, params) {
5614
6071
  }
5615
6072
  const defaultProcessor = (schema, ctx, json, params) => {
5616
6073
  const def = schema._zod.def;
5617
- process$3(def.innerType, ctx, params);
6074
+ processSchema(def.innerType, ctx, params);
5618
6075
  const seen = ctx.seen.get(schema);
5619
6076
  seen.ref = def.innerType;
5620
6077
  const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
@@ -5622,7 +6079,7 @@ const defaultProcessor = (schema, ctx, json, params) => {
5622
6079
  };
5623
6080
  const prefaultProcessor = (schema, ctx, json, params) => {
5624
6081
  const def = schema._zod.def;
5625
- process$3(def.innerType, ctx, params);
6082
+ processSchema(def.innerType, ctx, params);
5626
6083
  const seen = ctx.seen.get(schema);
5627
6084
  seen.ref = def.innerType;
5628
6085
  if (ctx.io !== "input") return;
@@ -5631,7 +6088,7 @@ const prefaultProcessor = (schema, ctx, json, params) => {
5631
6088
  };
5632
6089
  const catchProcessor = (schema, ctx, json, params) => {
5633
6090
  const def = schema._zod.def;
5634
- process$3(def.innerType, ctx, params);
6091
+ processSchema(def.innerType, ctx, params);
5635
6092
  const seen = ctx.seen.get(schema);
5636
6093
  seen.ref = def.innerType;
5637
6094
  let catchValue;
@@ -5647,37 +6104,37 @@ const pipeProcessor = (schema, ctx, _json, params) => {
5647
6104
  const def = schema._zod.def;
5648
6105
  const inIsTransform = def.in._zod.traits.has("$ZodTransform");
5649
6106
  const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out;
5650
- process$3(innerType, ctx, params);
6107
+ processSchema(innerType, ctx, params);
5651
6108
  const seen = ctx.seen.get(schema);
5652
6109
  seen.ref = innerType;
5653
6110
  };
5654
6111
  const readonlyProcessor = (schema, ctx, json, params) => {
5655
6112
  const def = schema._zod.def;
5656
- process$3(def.innerType, ctx, params);
6113
+ processSchema(def.innerType, ctx, params);
5657
6114
  const seen = ctx.seen.get(schema);
5658
6115
  seen.ref = def.innerType;
5659
6116
  json.readOnly = true;
5660
6117
  };
5661
6118
  const promiseProcessor = (schema, ctx, _json, params) => {
5662
6119
  const def = schema._zod.def;
5663
- process$3(def.innerType, ctx, params);
6120
+ processSchema(def.innerType, ctx, params);
5664
6121
  const seen = ctx.seen.get(schema);
5665
6122
  seen.ref = def.innerType;
5666
6123
  };
5667
6124
  const optionalProcessor = (schema, ctx, _json, params) => {
5668
6125
  const def = schema._zod.def;
5669
- process$3(def.innerType, ctx, params);
6126
+ processSchema(def.innerType, ctx, params);
5670
6127
  const seen = ctx.seen.get(schema);
5671
6128
  seen.ref = def.innerType;
5672
6129
  };
5673
6130
  const lazyProcessor = (schema, ctx, _json, params) => {
5674
6131
  const innerType = schema._zod.innerType;
5675
- process$3(innerType, ctx, params);
6132
+ processSchema(innerType, ctx, params);
5676
6133
  const seen = ctx.seen.get(schema);
5677
6134
  seen.ref = innerType;
5678
6135
  };
5679
6136
  //#endregion
5680
- //#region ../../node_modules/.pnpm/zod@4.5.1/node_modules/zod/v4/mini/schemas.js
6137
+ //#region ../../node_modules/.pnpm/zod@4.6.1/node_modules/zod/v4/mini/schemas.js
5681
6138
  const ZodMiniType = /*@__PURE__*/ $constructor("ZodMiniType", (inst, def) => {
5682
6139
  if (!inst._zod) throw new Error("Uninitialized schema in ZodMiniType.");
5683
6140
  $ZodType.init(inst, def);
@@ -7654,7 +8111,7 @@ var init_esm = __esmMin((() => {
7654
8111
  };
7655
8112
  }));
7656
8113
  //#endregion
7657
- //#region ../../node_modules/.pnpm/@ariestools+telemetry@8.2.0_@opentelemetry+api@1.9.1/node_modules/@ariestools/telemetry/dist/neutral/index.mjs
8114
+ //#region ../../node_modules/.pnpm/@ariestools+telemetry@8.3.0_@opentelemetry+api@1.9.1/node_modules/@ariestools/telemetry/dist/neutral/index.mjs
7658
8115
  init_esm();
7659
8116
  async function timeBudget(name, logger, func, budget, status = false) {
7660
8117
  const start = Date.now();
@@ -7820,7 +8277,7 @@ function spanDurationInMillis$1(span2) {
7820
8277
  }
7821
8278
  });
7822
8279
  //#endregion
7823
- //#region ../../node_modules/.pnpm/@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod@4.5.1/node_modules/@ariestools/sdk/dist/node/index.mjs
8280
+ //#region ../../node_modules/.pnpm/@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod@4.6.1/node_modules/@ariestools/sdk/dist/node/index.mjs
7824
8281
  var __defProp$14 = Object.defineProperty;
7825
8282
  var __getOwnPropDesc$14 = Object.getOwnPropertyDescriptor;
7826
8283
  var __decorateClass$14 = (decorators, target, key, kind) => {
@@ -9865,9 +10322,6 @@ var retry = async (func, config) => {
9865
10322
  retries: retries - 1
9866
10323
  });
9867
10324
  };
9868
- var difference = (a, b) => {
9869
- return a.difference(b);
9870
- };
9871
10325
  function staticImplements() {
9872
10326
  return (constructor) => {};
9873
10327
  }
@@ -10307,7 +10761,7 @@ function genBech32(encoding) {
10307
10761
  */
10308
10762
  const bech32m = /* @__PURE__ */ freeze(() => genBech32("bech32m"));
10309
10763
  //#endregion
10310
- //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod_052079727d4e9a2fd8307a4fb0f9051a/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/address.mjs
10764
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod_f45bda03f26c28cac91f6ce20c9370bf/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/address.mjs
10311
10765
  var XyoLegacyAddressZod = AddressZod;
10312
10766
  function encodeQuantAddress(hrp, bytes) {
10313
10767
  return bech32m.encodeFromBytes(hrp, toUint8Array(bytes));
@@ -10328,7 +10782,7 @@ var XyoQuantAddressZod = /* @__PURE__ */ pipe$1((/* @__PURE__ */ string$2()).che
10328
10782
  var XyoAddressRegEx = /^(?:[0-9a-f]{40}|[a-z0-9]{1,83}1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{38})$/;
10329
10783
  var XyoAddressZod = /* @__PURE__ */ union$2([XyoLegacyAddressZod, XyoQuantAddressZod]);
10330
10784
  //#endregion
10331
- //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod_052079727d4e9a2fd8307a4fb0f9051a/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/account-model.mjs
10785
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod_f45bda03f26c28cac91f6ce20c9370bf/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/account-model.mjs
10332
10786
  var isPhraseInitializationConfig = (value) => {
10333
10787
  if (typeof value === "object" && value !== null) return typeof value.phrase === "string";
10334
10788
  return false;
@@ -12492,7 +12946,7 @@ async function asyncLoop(iters, tick, cb) {
12492
12946
  cb(i);
12493
12947
  const diff = Date.now() - ts;
12494
12948
  if (diff >= 0 && diff < tick) continue;
12495
- await nextTick();
12949
+ await /* @__PURE__ */ nextTick();
12496
12950
  ts += diff;
12497
12951
  }
12498
12952
  }
@@ -13968,8 +14422,8 @@ function utf8ToBytes(str) {
13968
14422
  * Same as `n.toString(2).length`
13969
14423
  */
13970
14424
  function bitLen(n) {
13971
- let len;
13972
- for (len = 0; n > _0n$4; n >>= _1n$5, len += 1);
14425
+ let len = 0;
14426
+ for (; n > _0n$4; n >>= _1n$5, len += 1);
13973
14427
  return len;
13974
14428
  }
13975
14429
  /**
@@ -28761,7 +29215,7 @@ var LangZh = class LangZh extends Wordlist {
28761
29215
  };
28762
29216
  LangCz.wordlist(), LangEn.wordlist(), LangEs.wordlist(), LangFr.wordlist(), LangIt.wordlist(), LangPt.wordlist(), LangJa.wordlist(), LangKo.wordlist(), LangZh.wordlist("cn"), LangZh.wordlist("tw");
28763
29217
  //#endregion
28764
- //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod_052079727d4e9a2fd8307a4fb0f9051a/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/data.mjs
29218
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod_f45bda03f26c28cac91f6ce20c9370bf/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/data.mjs
28765
29219
  var AbstractData = class {
28766
29220
  /** Type guard for {@link AbstractData} instances. */
28767
29221
  static is(value) {
@@ -28816,7 +29270,7 @@ var Data = class _Data extends AbstractData {
28816
29270
  }
28817
29271
  };
28818
29272
  //#endregion
28819
- //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod_052079727d4e9a2fd8307a4fb0f9051a/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/wasm.mjs
29273
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod_f45bda03f26c28cac91f6ce20c9370bf/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/wasm.mjs
28820
29274
  var validate = (bytes) => Promise.resolve(WebAssembly.validate(new Uint8Array(bytes)));
28821
29275
  var bigInt = async () => {
28822
29276
  try {
@@ -70201,7 +70655,7 @@ var init_build = __esmMin((async () => {
70201
70655
  await init_lib();
70202
70656
  }));
70203
70657
  //#endregion
70204
- //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod_052079727d4e9a2fd8307a4fb0f9051a/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/elliptic.mjs
70658
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod_f45bda03f26c28cac91f6ce20c9370bf/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/elliptic.mjs
70205
70659
  var wasmSupportStatic$1 = new WasmSupport([
70206
70660
  "bigInt",
70207
70661
  "mutableGlobals",
@@ -70344,7 +70798,7 @@ var Elliptic = class {
70344
70798
  }
70345
70799
  };
70346
70800
  //#endregion
70347
- //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod_052079727d4e9a2fd8307a4fb0f9051a/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/account.mjs
70801
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod_f45bda03f26c28cac91f6ce20c9370bf/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/account.mjs
70348
70802
  var __defProp$13 = Object.defineProperty;
70349
70803
  var __getOwnPropDesc$13 = Object.getOwnPropertyDescriptor;
70350
70804
  var __defNormalProp$11 = (obj, key, value) => key in obj ? __defProp$13(obj, key, {
@@ -70870,7 +71324,7 @@ __publicField$11(Account, "_addressMap", {});
70870
71324
  __publicField$11(Account, "_protectedConstructorKey", /* @__PURE__ */ Symbol());
70871
71325
  Account = __decorateClass$13([staticImplements()], Account);
70872
71326
  //#endregion
70873
- //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod_052079727d4e9a2fd8307a4fb0f9051a/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/payload-model.mjs
71327
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod_f45bda03f26c28cac91f6ce20c9370bf/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/payload-model.mjs
70874
71328
  var DefaultPayloadVersion = 1e6;
70875
71329
  var PayloadVersionMax = 999999999;
70876
71330
  var PayloadVersionZod = int$1().check(/* @__PURE__ */ _gte(0), /* @__PURE__ */ _lte(PayloadVersionMax));
@@ -71146,7 +71600,7 @@ var QueryFieldsZod = /* @__PURE__ */ object$2({
71146
71600
  minBid: /* @__PURE__ */ optional$1(/* @__PURE__ */ number$2())
71147
71601
  });
71148
71602
  //#endregion
71149
- //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod_052079727d4e9a2fd8307a4fb0f9051a/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/boundwitness-model.mjs
71603
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod_f45bda03f26c28cac91f6ce20c9370bf/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/boundwitness-model.mjs
71150
71604
  var BoundWitnessSchema = asSchema("network.xyo.boundwitness", true);
71151
71605
  var SignaturesMetaZod = /* @__PURE__ */ object$2({ $signatures: /* @__PURE__ */ array$1(/* @__PURE__ */ union$2([HexZod, /* @__PURE__ */ _null$1()])) });
71152
71606
  var UnsignedSignaturesMetaZod = /* @__PURE__ */ object$2({ $signatures: /* @__PURE__ */ array$1(/* @__PURE__ */ _null$1()) });
@@ -72521,7 +72975,7 @@ function multicast(coldObservable) {
72521
72975
  });
72522
72976
  }
72523
72977
  //#endregion
72524
- //#region ../../node_modules/.pnpm/@ariestools+threads@8.1.9_@opentelemetry+api@1.9.1_observable-fns@0.6.1_supports-color@10.2.2_zod@4.5.1/node_modules/@ariestools/threads/dist/node/master/index-node.mjs
72978
+ //#region ../../node_modules/.pnpm/@ariestools+threads@8.1.9_@opentelemetry+api@1.9.1_observable-fns@0.6.1_supports-color@10.2.2_zod@4.6.1/node_modules/@ariestools/threads/dist/node/master/index-node.mjs
72525
72979
  cpus().length;
72526
72980
  function resolveScriptPath(scriptPath, baseURL) {
72527
72981
  const makeAbsolute = (filePath) => {
@@ -73221,7 +73675,7 @@ var Worker2 = getWorkerImplementation().default;
73221
73675
  * @license MIT
73222
73676
  */
73223
73677
  //#endregion
73224
- //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod_052079727d4e9a2fd8307a4fb0f9051a/node_modules/@xyo-network/sdk-protocol-core/dist/node/hash.mjs
73678
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod_f45bda03f26c28cac91f6ce20c9370bf/node_modules/@xyo-network/sdk-protocol-core/dist/node/hash.mjs
73225
73679
  var import_index_umd = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
73226
73680
  (function(global, factory) {
73227
73681
  typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.hashwasm = {}));
@@ -75692,7 +76146,7 @@ var NodeObjectHasher = class extends ObjectHasher {
75692
76146
  static createNodeWorker = createNodeWorker;
75693
76147
  };
75694
76148
  //#endregion
75695
- //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod_052079727d4e9a2fd8307a4fb0f9051a/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/payload-builder.mjs
76149
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod_f45bda03f26c28cac91f6ce20c9370bf/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/payload-builder.mjs
75696
76150
  var omitSchema = (payload) => {
75697
76151
  const result = structuredClone(payload);
75698
76152
  delete result.schema;
@@ -75969,7 +76423,7 @@ var PayloadBuilder = class _PayloadBuilder {
75969
76423
  }
75970
76424
  };
75971
76425
  //#endregion
75972
- //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod_052079727d4e9a2fd8307a4fb0f9051a/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/schema-name-validator.mjs
76426
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod_f45bda03f26c28cac91f6ce20c9370bf/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/schema-name-validator.mjs
75973
76427
  var SchemaNameValidator = class {
75974
76428
  _parts;
75975
76429
  _rootDomain;
@@ -76040,7 +76494,7 @@ function domainLevel(validator, level) {
76040
76494
  return validator.parts?.slice(0, level + 1).toReversed().join(".");
76041
76495
  }
76042
76496
  //#endregion
76043
- //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod_052079727d4e9a2fd8307a4fb0f9051a/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/payload-validator.mjs
76497
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod_f45bda03f26c28cac91f6ce20c9370bf/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/payload-validator.mjs
76044
76498
  var defaultSchemaNameValidatorFactory = (schema) => new SchemaNameValidator(schema);
76045
76499
  var PayloadValidator = class _PayloadValidator extends ValidatorBase {
76046
76500
  static schemaNameValidatorFactory = defaultSchemaNameValidatorFactory;
@@ -76101,7 +76555,7 @@ var PayloadValidator = class _PayloadValidator extends ValidatorBase {
76101
76555
  }
76102
76556
  };
76103
76557
  //#endregion
76104
- //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod_052079727d4e9a2fd8307a4fb0f9051a/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/payload-wrapper.mjs
76558
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod_f45bda03f26c28cac91f6ce20c9370bf/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/payload-wrapper.mjs
76105
76559
  var isPayloadWrapperBase = (value) => {
76106
76560
  return value instanceof PayloadWrapperBase;
76107
76561
  };
@@ -76291,7 +76745,7 @@ var payloadJsonSchema = {
76291
76745
  type: "object"
76292
76746
  };
76293
76747
  //#endregion
76294
- //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod_052079727d4e9a2fd8307a4fb0f9051a/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/boundwitness-builder.mjs
76748
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod_f45bda03f26c28cac91f6ce20c9370bf/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/boundwitness-builder.mjs
76295
76749
  var isSigningParty = (party) => "sign" in party;
76296
76750
  var GeneratedBoundWitnessFields = [
76297
76751
  "addresses",
@@ -76635,7 +77089,7 @@ var QueryBoundWitnessBuilder = class extends BoundWitnessBuilder {
76635
77089
  }
76636
77090
  };
76637
77091
  //#endregion
76638
- //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod_052079727d4e9a2fd8307a4fb0f9051a/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/boundwitness-validator.mjs
77092
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod_f45bda03f26c28cac91f6ce20c9370bf/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/boundwitness-validator.mjs
76639
77093
  var validateArraysSameLength = (a, b, message = "Array length mismatch") => {
76640
77094
  return a.length == b.length ? [] : [/* @__PURE__ */ new Error(`${message} [${a.length} !== ${b.length}]`)];
76641
77095
  };
@@ -76772,7 +77226,7 @@ var BoundWitnessValidator = class _BoundWitnessValidator extends PayloadValidato
76772
77226
  }
76773
77227
  };
76774
77228
  //#endregion
76775
- //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod_052079727d4e9a2fd8307a4fb0f9051a/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/boundwitness-wrapper.mjs
77229
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod_f45bda03f26c28cac91f6ce20c9370bf/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/boundwitness-wrapper.mjs
76776
77230
  var isBoundWitnessWrapper = (value) => {
76777
77231
  if (isPayloadWrapperBase(value)) return typeof value.payloadsDataHashMap === "function";
76778
77232
  return false;
@@ -77075,16 +77529,16 @@ var SignatureRegEx = HexRegExMinMax(64, 5261);
77075
77529
  ({ ...payloadJsonSchema.properties }), XyoAddressRegEx.source, HashRegEx.source, SchemaRegEx.source, HashRegEx.source, HashRegEx.source, HashRegEx.source, HashRegEx.source, HashRegEx.source, SignatureRegEx.source;
77076
77530
  ({ ...payloadJsonSchema }), [...payloadJsonSchema.required];
77077
77531
  //#endregion
77078
- //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod_052079727d4e9a2fd8307a4fb0f9051a/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/config-payload-plugin.mjs
77532
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod_f45bda03f26c28cac91f6ce20c9370bf/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/config-payload-plugin.mjs
77079
77533
  var ConfigSchema = asSchema("network.xyo.config", true);
77080
77534
  PayloadZodOfSchema(ConfigSchema);
77081
77535
  //#endregion
77082
- //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod_052079727d4e9a2fd8307a4fb0f9051a/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/schema-payload-plugin.mjs
77536
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod_f45bda03f26c28cac91f6ce20c9370bf/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/schema-payload-plugin.mjs
77083
77537
  var SchemaSchema = asSchema("network.xyo.schema", true);
77084
77538
  PayloadZodOfSchema(SchemaSchema);
77085
77539
  isPayloadOfSchemaTypeWithSources(SchemaSchema);
77086
77540
  //#endregion
77087
- //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod_052079727d4e9a2fd8307a4fb0f9051a/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/domain-payload-plugin.mjs
77541
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod_f45bda03f26c28cac91f6ce20c9370bf/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/domain-payload-plugin.mjs
77088
77542
  var DomainConfigSchema = asSchema("network.xyo.domain.config", true);
77089
77543
  var DomainSchema = asSchema("network.xyo.domain", true);
77090
77544
  var AliasZod = /* @__PURE__ */ object$2({
@@ -77108,12 +77562,12 @@ var DomainConfigFieldsZod = /* @__PURE__ */ object$2({
77108
77562
  PayloadZodOfSchema(DomainSchema), DomainConfigFieldsZod.shape;
77109
77563
  PayloadZodOfSchema(DomainConfigSchema), DomainConfigFieldsZod.shape;
77110
77564
  //#endregion
77111
- //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod_052079727d4e9a2fd8307a4fb0f9051a/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/id-payload-plugin.mjs
77565
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod_f45bda03f26c28cac91f6ce20c9370bf/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/id-payload-plugin.mjs
77112
77566
  var IdSchema = asSchema("network.xyo.id", true);
77113
77567
  PayloadZodOfSchema(IdSchema);
77114
77568
  isPayloadOfSchemaTypeWithSources(IdSchema);
77115
77569
  //#endregion
77116
- //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod_052079727d4e9a2fd8307a4fb0f9051a/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/query-payload-plugin.mjs
77570
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod_f45bda03f26c28cac91f6ce20c9370bf/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/query-payload-plugin.mjs
77117
77571
  var QuerySchema = asSchema("network.xyo.query", true);
77118
77572
  PayloadZodOfSchema(QuerySchema);
77119
77573
  PayloadZodOfSchema(asSchema("network.xyo.value", true));
@@ -79076,7 +79530,7 @@ const ml_dsa65 = /* @__PURE__ */ (() => getDilithium({
79076
79530
  securityLevel: 192
79077
79531
  }))();
79078
79532
  //#endregion
79079
- //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod_052079727d4e9a2fd8307a4fb0f9051a/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/pqc.mjs
79533
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod_f45bda03f26c28cac91f6ce20c9370bf/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/pqc.mjs
79080
79534
  var MlDsa = class {
79081
79535
  /** Concatenated public key + signature length in bytes. */
79082
79536
  static bundleLength = 5261;
@@ -79353,7 +79807,7 @@ replaceTraps((oldTraps) => ({
79353
79807
  }
79354
79808
  }));
79355
79809
  //#endregion
79356
- //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod_052079727d4e9a2fd8307a4fb0f9051a/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/previous-hash-store-storage.mjs
79810
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod_f45bda03f26c28cac91f6ce20c9370bf/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/previous-hash-store-storage.mjs
79357
79811
  var InMemoryBackend = class {
79358
79812
  data = /* @__PURE__ */ new Map();
79359
79813
  get(key) {
@@ -79368,7 +79822,7 @@ var InMemoryBackend = class {
79368
79822
  };
79369
79823
  new InMemoryBackend();
79370
79824
  //#endregion
79371
- //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod_052079727d4e9a2fd8307a4fb0f9051a/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/quant-account.mjs
79825
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod_f45bda03f26c28cac91f6ce20c9370bf/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/quant-account.mjs
79372
79826
  var __defProp$12 = Object.defineProperty;
79373
79827
  var __getOwnPropDesc$12 = Object.getOwnPropertyDescriptor;
79374
79828
  var __defNormalProp$10 = (obj, key, value) => key in obj ? __defProp$12(obj, key, {
@@ -82079,7 +82533,7 @@ zero
82079
82533
  zone
82080
82534
  zoo`.split("\n"));
82081
82535
  //#endregion
82082
- //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod_052079727d4e9a2fd8307a4fb0f9051a/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/wallet.mjs
82536
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod_f45bda03f26c28cac91f6ce20c9370bf/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/wallet.mjs
82083
82537
  var __defProp$11 = Object.defineProperty;
82084
82538
  var __getOwnPropDesc$11 = Object.getOwnPropertyDescriptor;
82085
82539
  var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$11(obj, key, {
@@ -82291,7 +82745,7 @@ PayloadVersionZodForVersions();
82291
82745
  PayloadZodOfSchema(asSchema("network.xyo.network.node", true));
82292
82746
  PayloadZodOfSchema(asSchema("network.xyo.network", true));
82293
82747
  //#endregion
82294
- //#region ../../node_modules/.pnpm/@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod@4.5.1/node_modules/@ariestools/sdk/dist/neutral/geo.mjs
82748
+ //#region ../../node_modules/.pnpm/@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod@4.6.1/node_modules/@ariestools/sdk/dist/neutral/geo.mjs
82295
82749
  var boundingBoxToBoundary = (box) => {
82296
82750
  return [
82297
82751
  box.getNorthWest(),
@@ -82567,7 +83021,7 @@ var GeoJson = class _GeoJson {
82567
83021
  }
82568
83022
  };
82569
83023
  //#endregion
82570
- //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod_052079727d4e9a2fd8307a4fb0f9051a/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/quadkey.mjs
83024
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod_f45bda03f26c28cac91f6ce20c9370bf/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/quadkey.mjs
82571
83025
  var RelativeDirectionConstantLookup = {
82572
83026
  e: 1,
82573
83027
  n: -2,
@@ -82892,7 +83346,7 @@ function gridOffsetForDigit(digit, blockSize) {
82892
83346
  }
82893
83347
  });
82894
83348
  //#endregion
82895
- //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod_052079727d4e9a2fd8307a4fb0f9051a/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/quant-wallet.mjs
83349
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.4.2_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod_f45bda03f26c28cac91f6ce20c9370bf/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/quant-wallet.mjs
82896
83350
  var __defProp$10 = Object.defineProperty;
82897
83351
  var __getOwnPropDesc$10 = Object.getOwnPropertyDescriptor;
82898
83352
  var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$10(obj, key, {
@@ -89746,7 +90200,7 @@ var I = class d {
89746
90200
  }
89747
90201
  };
89748
90202
  //#endregion
89749
- //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.0_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod@4.5.1__@opent_b1718bbc760a78b6c56b3abbac30bebc/node_modules/@xyo-network/sdk/dist/neutral/module-model.mjs
90203
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.1_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod@4.6.1__@opent_9148262d6de5ca3d3b22c984d3a5a4f2/node_modules/@xyo-network/sdk/dist/neutral/module-model.mjs
89750
90204
  var ArchivingModuleConfigZod = /* @__PURE__ */ object$2({ archiving: /* @__PURE__ */ optional$1(/* @__PURE__ */ object$2({
89751
90205
  archivists: /* @__PURE__ */ optional$1(/* @__PURE__ */ array$1(/* @__PURE__ */ custom$1())),
89752
90206
  queries: /* @__PURE__ */ optional$1(/* @__PURE__ */ array$1(/* @__PURE__ */ custom$1()))
@@ -89967,7 +90421,7 @@ var isAttachableArchivistInstance = new IsObjectFactory().create({}, [isArchivis
89967
90421
  AsObjectFactory.create(isAttachableArchivistInstance);
89968
90422
  var ArchivistConfigSchema = asSchema("network.xyo.archivist.config", true);
89969
90423
  //#endregion
89970
- //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.0_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod@4.5.1__@opent_b1718bbc760a78b6c56b3abbac30bebc/node_modules/@xyo-network/sdk/dist/neutral/diviner-model.mjs
90424
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.1_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod@4.6.1__@opent_9148262d6de5ca3d3b22c984d3a5a4f2/node_modules/@xyo-network/sdk/dist/neutral/diviner-model.mjs
89971
90425
  var DivinerDivineQuerySchema = asSchema("network.xyo.query.diviner.divine", true);
89972
90426
  PayloadZodOfSchema(DivinerDivineQuerySchema), { ...QueryFieldsZod.shape };
89973
90427
  var isDivinerInstance = new IsInstanceFactory().create({ divine: "function" }, [isModuleInstance]);
@@ -89980,7 +90434,7 @@ var isAttachableDivinerInstance = new IsObjectFactory().create({}, [isDivinerIns
89980
90434
  AsObjectFactory.create(isAttachableDivinerInstance);
89981
90435
  var DivinerConfigSchema = asSchema("network.xyo.diviner.config", true);
89982
90436
  //#endregion
89983
- //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.0_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod@4.5.1__@opent_b1718bbc760a78b6c56b3abbac30bebc/node_modules/@xyo-network/sdk/dist/neutral/diviner-payload-model.mjs
90437
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.1_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod@4.6.1__@opent_9148262d6de5ca3d3b22c984d3a5a4f2/node_modules/@xyo-network/sdk/dist/neutral/diviner-payload-model.mjs
89984
90438
  var PayloadDivinerSchema = asSchema("network.xyo.diviner.payload", true);
89985
90439
  var PayloadDivinerConfigSchema = asSchema(`${PayloadDivinerSchema}.config`, true);
89986
90440
  var asPayloadDivinerQueryPayload = zodAsFactory(/* @__PURE__ */ extend(PayloadZodOfSchema(asSchema(`${PayloadDivinerSchema}.query`, true)), {
@@ -89991,7 +90445,7 @@ var asPayloadDivinerQueryPayload = zodAsFactory(/* @__PURE__ */ extend(PayloadZo
89991
90445
  schemas: /* @__PURE__ */ optional$1(/* @__PURE__ */ array$1(/* @__PURE__ */ custom$1()))
89992
90446
  }), "asPayloadDivinerQueryPayload");
89993
90447
  //#endregion
89994
- //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.0_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod@4.5.1__@opent_b1718bbc760a78b6c56b3abbac30bebc/node_modules/@xyo-network/sdk/dist/neutral/module-resolver.mjs
90448
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.1_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod@4.6.1__@opent_9148262d6de5ca3d3b22c984d3a5a4f2/node_modules/@xyo-network/sdk/dist/neutral/module-resolver.mjs
89995
90449
  var AbstractModuleResolver = class extends Base {
89996
90450
  get priority() {
89997
90451
  return this.params.priority ?? ObjectResolverPriority.Normal;
@@ -90436,7 +90890,7 @@ var CompositeModuleResolver = class _CompositeModuleResolver extends AbstractMod
90436
90890
  }
90437
90891
  };
90438
90892
  //#endregion
90439
- //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.0_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod@4.5.1__@opent_b1718bbc760a78b6c56b3abbac30bebc/node_modules/@xyo-network/sdk/dist/neutral/node-model.mjs
90893
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.1_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod@4.6.1__@opent_9148262d6de5ca3d3b22c984d3a5a4f2/node_modules/@xyo-network/sdk/dist/neutral/node-model.mjs
90440
90894
  var NodeAttachQuerySchema = asSchema("network.xyo.query.node.attach", true);
90441
90895
  PayloadZodOfSchema(NodeAttachQuerySchema), { ...QueryFieldsZod.shape };
90442
90896
  var NodeAttachedQuerySchema = asSchema("network.xyo.query.node.attached", true);
@@ -90465,7 +90919,7 @@ var ChildCertificationSchema = asSchema("network.xyo.child.certification", true)
90465
90919
  PayloadZodOfSchema(ChildCertificationSchema);
90466
90920
  var NodeConfigSchema = asSchema("network.xyo.node.config", true);
90467
90921
  //#endregion
90468
- //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.0_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod@4.5.1__@opent_b1718bbc760a78b6c56b3abbac30bebc/node_modules/@xyo-network/sdk/dist/neutral/module-abstract.mjs
90922
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.1_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod@4.6.1__@opent_9148262d6de5ca3d3b22c984d3a5a4f2/node_modules/@xyo-network/sdk/dist/neutral/module-abstract.mjs
90469
90923
  var isDetermineAccountFromAccountParams = (params) => {
90470
90924
  assertEx(isUndefined(params.accountPath), () => "accountPath may not be provided when account is provided");
90471
90925
  return isDefined(params.account);
@@ -91226,7 +91680,7 @@ var AbstractModuleInstance = class _AbstractModuleInstance extends AbstractModul
91226
91680
  }
91227
91681
  };
91228
91682
  //#endregion
91229
- //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.0_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod@4.5.1__@opent_b1718bbc760a78b6c56b3abbac30bebc/node_modules/@xyo-network/sdk/dist/neutral/archivist-abstract.mjs
91683
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.1_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod@4.6.1__@opent_9148262d6de5ca3d3b22c984d3a5a4f2/node_modules/@xyo-network/sdk/dist/neutral/archivist-abstract.mjs
91230
91684
  var StorageClassLabel = "network.xyo.storage.class";
91231
91685
  var NOT_IMPLEMENTED = "Not implemented";
91232
91686
  var AbstractArchivist = class _AbstractArchivist extends AbstractModuleInstance {
@@ -91241,6 +91695,8 @@ var AbstractArchivist = class _AbstractArchivist extends AbstractModuleInstance
91241
91695
  _parentArchivists;
91242
91696
  _payloadCountGauge;
91243
91697
  _payloadCountMeter;
91698
+ activeCacheMutations = 0;
91699
+ cacheGeneration = 0;
91244
91700
  static get defaultNextLimit() {
91245
91701
  return this.defaultNextLimitSetting;
91246
91702
  }
@@ -91294,9 +91750,7 @@ var AbstractArchivist = class _AbstractArchivist extends AbstractModuleInstance
91294
91750
  await this.globalReentrancyMutex?.acquire();
91295
91751
  return await this.busy(async () => {
91296
91752
  await this.startedAsync("throw");
91297
- await this.clearHandler();
91298
- this.reportPayloadCount();
91299
- await this.emit("cleared", { mod: this });
91753
+ await this.clearWithConfig();
91300
91754
  });
91301
91755
  } finally {
91302
91756
  this.globalReentrancyMutex?.release();
@@ -91380,13 +91834,14 @@ var AbstractArchivist = class _AbstractArchivist extends AbstractModuleInstance
91380
91834
  async insert(payloads) {
91381
91835
  this._noOverride("insert");
91382
91836
  this.isSupportedQuery(ArchivistInsertQuerySchema, "insert");
91837
+ const snapshot = this.snapshotPayloads(payloads);
91383
91838
  return await this.spanAsync(`${this.id}|insert`, async () => {
91384
91839
  if (this.reentrancy?.scope === "global" && this.reentrancy.action === "skip" && this.globalReentrancyMutex?.isLocked()) return [];
91385
91840
  try {
91386
91841
  await this.globalReentrancyMutex?.acquire();
91387
91842
  return await this.busy(async () => {
91388
91843
  await this.startedAsync("throw");
91389
- return await this.insertWithConfig(PayloadBuilder.omitStorageMeta(payloads));
91844
+ return await this.insertWithConfig(snapshot);
91390
91845
  });
91391
91846
  } finally {
91392
91847
  this.globalReentrancyMutex?.release();
@@ -91396,7 +91851,7 @@ var AbstractArchivist = class _AbstractArchivist extends AbstractModuleInstance
91396
91851
  async insertQuery(payloads, account) {
91397
91852
  this._noOverride("insertQuery");
91398
91853
  const queryPayload = { schema: ArchivistInsertQuerySchema };
91399
- return await this.sendQueryRaw(queryPayload, payloads, account);
91854
+ return await this.sendQueryRaw(queryPayload, this.snapshotPayloads(payloads), account);
91400
91855
  }
91401
91856
  async next(options) {
91402
91857
  this._noOverride("next");
@@ -91453,6 +91908,13 @@ var AbstractArchivist = class _AbstractArchivist extends AbstractModuleInstance
91453
91908
  clearHandler() {
91454
91909
  throw new Error(NOT_IMPLEMENTED);
91455
91910
  }
91911
+ async clearWithConfig(config) {
91912
+ await this.withCacheMutation(async () => {
91913
+ await this.withStorageMutation(async () => await this.clearHandler());
91914
+ this.reportPayloadCount();
91915
+ if (config?.emitEvents ?? true) await this.emit("cleared", { mod: this });
91916
+ });
91917
+ }
91456
91918
  commitHandler() {
91457
91919
  throw new Error(NOT_IMPLEMENTED);
91458
91920
  }
@@ -91460,16 +91922,18 @@ var AbstractArchivist = class _AbstractArchivist extends AbstractModuleInstance
91460
91922
  throw new Error(NOT_IMPLEMENTED);
91461
91923
  }
91462
91924
  async deleteWithConfig(hashes, config) {
91463
- const emitEvents = config?.emitEvents ?? true;
91464
- const payloads = await this.deleteHandler(hashes);
91465
- const hashesDeleted = payloads.map((p) => p._hash);
91466
- if (emitEvents) await this.emit("deleted", {
91467
- hashes: hashesDeleted,
91468
- payloads,
91469
- mod: this
91925
+ return await this.withCacheMutation(async () => {
91926
+ const emitEvents = config?.emitEvents ?? true;
91927
+ const payloads = await this.withStorageMutation(async () => await this.deleteHandler(hashes));
91928
+ const hashesDeleted = payloads.map((p) => p._hash);
91929
+ if (emitEvents) await this.emit("deleted", {
91930
+ hashes: hashesDeleted,
91931
+ payloads,
91932
+ mod: this
91933
+ });
91934
+ this.reportPayloadCount();
91935
+ return payloads;
91470
91936
  });
91471
- this.reportPayloadCount();
91472
- return payloads;
91473
91937
  }
91474
91938
  generateStats() {
91475
91939
  return {
@@ -91477,14 +91941,18 @@ var AbstractArchivist = class _AbstractArchivist extends AbstractModuleInstance
91477
91941
  schema: ArchivistStatsPayloadSchema
91478
91942
  };
91479
91943
  }
91944
+ /**
91945
+ * Inspect local stored roots without consulting public projections, caches or
91946
+ * parents. Backends whose getHandler synthesizes views must override this hook
91947
+ * to read their primary record keys directly.
91948
+ */
91949
+ async getExistingLocalPayloads(hashes) {
91950
+ return await this.exactRepresentations(await this.getHandler(hashes), hashes);
91951
+ }
91480
91952
  async getFromParent(hashes, archivist) {
91481
- const foundPairs = (await PayloadBuilder.dataHashPairs(await archivist.get(hashes))).filter(([, hash]) => {
91482
- const askedFor = hashes.includes(hash);
91483
- if (!askedFor) console.warn(`Parent returned payload with hash not asked for: ${hash}`);
91484
- return askedFor;
91485
- });
91486
- const foundHashes = new Set(foundPairs.map(([, hash]) => hash));
91487
- return [foundPairs.map(([payload]) => payload), hashes.filter((hash) => !foundHashes.has(hash))];
91953
+ const foundPayloads = await this.requestedRepresentations(await archivist.get(hashes), hashes);
91954
+ const foundHashes = new Set(foundPayloads.map((payload) => payload._hash));
91955
+ return [foundPayloads, hashes.filter((hash) => !foundHashes.has(hash))];
91488
91956
  }
91489
91957
  async getFromParents(hashes) {
91490
91958
  const parents = Object.values((await this.parentArchivists())?.read ?? {});
@@ -91506,48 +91974,22 @@ var AbstractArchivist = class _AbstractArchivist extends AbstractModuleInstance
91506
91974
  throw new Error(NOT_IMPLEMENTED);
91507
91975
  }
91508
91976
  async getWithConfig(hashes, _config) {
91509
- const requestedHashes = new Set(hashes);
91510
- const cache = this._getCache;
91511
- let fromCache = [];
91512
- let remainingHashes = [...requestedHashes];
91513
- if (cache !== void 0) {
91514
- fromCache = hashes.map((hash) => cache.get(hash)).filter(exists$1);
91515
- remainingHashes = hashes.filter((hash) => !fromCache.some((payload) => payload?._hash === hash || payload?._dataHash === hash));
91516
- }
91517
- const fromGet = await this.getHandler([...remainingHashes]);
91518
- const gotten = [...fromCache, ...fromGet].toSorted(PayloadBuilder.compareStorageMeta);
91519
- const foundPayloads = [];
91520
- const foundHashes = /* @__PURE__ */ new Set();
91521
- for (const payload of gotten) {
91522
- const map = {
91523
- [payload._hash]: payload,
91524
- [payload._dataHash]: payload
91525
- };
91526
- for (const [key, payload2] of Object.entries(map)) {
91527
- let requestedPayloadFound = false;
91528
- const hash = key;
91529
- if (requestedHashes.has(hash) && !foundHashes.has(hash)) {
91530
- requestedPayloadFound = true;
91531
- foundHashes.add(hash);
91532
- }
91533
- if (requestedPayloadFound) foundPayloads.push(payload2);
91534
- }
91535
- }
91536
- const notFoundHashes = [...difference(requestedHashes, foundHashes)];
91537
- const [parentFoundPayloads] = await this.getFromParents(notFoundHashes);
91538
- if (this.storeParentReads) await this.insertWithConfig(parentFoundPayloads);
91539
- const result = this.omitClientMetaForDataHashes(hashes, PayloadBuilder.omitPrivateStorageMeta([...foundPayloads, ...parentFoundPayloads]).toSorted(PayloadBuilder.compareStorageMeta));
91540
- if (cache !== void 0) {
91541
- for (const payload of fromGet) {
91542
- cache.set(payload._hash, payload);
91543
- cache.set(payload._dataHash, payload);
91544
- }
91545
- for (const payload of parentFoundPayloads) {
91546
- cache.set(payload._hash, payload);
91547
- cache.set(payload._dataHash, payload);
91548
- }
91549
- }
91550
- return result;
91977
+ const requestedHashes = [...new Set(hashes)];
91978
+ const generation = this.cacheGeneration;
91979
+ const cache = this.activeCacheMutations === 0 ? this._getCache : void 0;
91980
+ const fromCache = await this.requestedRepresentations(requestedHashes.map((hash) => cache?.get(hash)).filter(exists$1), requestedHashes);
91981
+ const cachedHashes = new Set(fromCache.map((payload) => payload._hash));
91982
+ const remainingHashes = requestedHashes.filter((hash) => !cachedHashes.has(hash));
91983
+ const fromGet = await this.requestedRepresentations(await this.getHandler(remainingHashes), remainingHashes);
91984
+ const foundHashes = new Set([...fromCache, ...fromGet].map((payload) => payload._hash));
91985
+ const [parentFoundPayloads] = await this.getFromParents(requestedHashes.filter((hash) => !foundHashes.has(hash)));
91986
+ if (this.storeParentReads && parentFoundPayloads.length > 0) await this.insertWithConfig(parentFoundPayloads);
91987
+ if (this.activeCacheMutations === 0 && generation === this.cacheGeneration) for (const payload of [...fromGet, ...parentFoundPayloads]) cache?.set(payload._hash, payload);
91988
+ return PayloadBuilder.omitPrivateStorageMeta([
91989
+ ...fromCache,
91990
+ ...fromGet,
91991
+ ...parentFoundPayloads
91992
+ ].toSorted(PayloadBuilder.compareStorageMeta));
91551
91993
  }
91552
91994
  insertHandler(_payloads) {
91553
91995
  throw new Error(NOT_IMPLEMENTED);
@@ -91561,23 +92003,37 @@ var AbstractArchivist = class _AbstractArchivist extends AbstractModuleInstance
91561
92003
  return await this.insertWithConfig(payloadsWithoutQuery);
91562
92004
  }
91563
92005
  async insertWithConfig(payloads, config) {
91564
- const emitEvents = config?.emitEvents ?? true;
91565
- const writeToParents = config?.writeToParents ?? true;
91566
- const withStorageMeta = await PayloadBuilder.addStorageMeta(payloads);
91567
- const hashes = withStorageMeta.map((p) => p._hash);
91568
- const existingPayloads = await this.getWithConfig(hashes);
91569
- const existingHashes = new Set(existingPayloads.map((p) => p._hash));
91570
- const payloadsToInsert = withStorageMeta.filter((p) => !existingHashes.has(p._hash));
91571
- const insertedPayloads = await this.insertHandler(payloadsToInsert);
91572
- if (writeToParents) await this.writeToParents(insertedPayloads);
91573
- if (emitEvents) await this.emit("inserted", {
91574
- mod: this,
91575
- payloads: insertedPayloads,
91576
- outPayloads: insertedPayloads,
91577
- inPayloads: payloads
92006
+ const sanitizedPayloads = this.snapshotPayloads(payloads);
92007
+ return await this.withCacheMutation(async () => {
92008
+ const emitEvents = config?.emitEvents ?? true;
92009
+ const writeToParents = config?.writeToParents ?? true;
92010
+ await this.validateInsertPayloads(sanitizedPayloads);
92011
+ const withStorageMeta = await PayloadBuilder.addStorageMeta(sanitizedPayloads);
92012
+ const hashes = [...new Set(withStorageMeta.map((payload) => payload._hash))];
92013
+ const { existingPayloads, insertedPayloads } = await this.withStorageMutation(async () => {
92014
+ const existingPayloads2 = await this.getExistingLocalPayloads(hashes);
92015
+ await this.repairExistingPayloads(existingPayloads2);
92016
+ const existingHashes = new Set(existingPayloads2.map((payload) => payload._hash));
92017
+ const payloadsToInsert = withStorageMeta.filter((payload) => {
92018
+ if (existingHashes.has(payload._hash)) return false;
92019
+ existingHashes.add(payload._hash);
92020
+ return true;
92021
+ });
92022
+ return {
92023
+ existingPayloads: existingPayloads2,
92024
+ insertedPayloads: await this.insertHandler(payloadsToInsert)
92025
+ };
92026
+ });
92027
+ if (writeToParents) await this.writeToParents([...existingPayloads, ...insertedPayloads]);
92028
+ if (emitEvents) await this.emit("inserted", {
92029
+ mod: this,
92030
+ payloads: insertedPayloads,
92031
+ outPayloads: insertedPayloads,
92032
+ inPayloads: payloads
92033
+ });
92034
+ this.reportPayloadCount();
92035
+ return PayloadBuilder.omitPrivateStorageMeta(insertedPayloads);
91578
92036
  });
91579
- this.reportPayloadCount();
91580
- return PayloadBuilder.omitPrivateStorageMeta(insertedPayloads);
91581
92037
  }
91582
92038
  nextHandler(_options) {
91583
92039
  throw new Error(NOT_IMPLEMENTED);
@@ -91599,7 +92055,7 @@ var AbstractArchivist = class _AbstractArchivist extends AbstractModuleInstance
91599
92055
  }
91600
92056
  async queryHandler(query, payloads, queryConfig) {
91601
92057
  const sanitizedQuery = PayloadBuilder.omitStorageMeta(query);
91602
- const sanitizedPayloads = PayloadBuilder.omitStorageMeta(payloads);
92058
+ const sanitizedPayloads = this.snapshotPayloads(payloads);
91603
92059
  const wrappedQuery = QueryBoundWitnessWrapper.parseQuery(sanitizedQuery, sanitizedPayloads);
91604
92060
  const queryPayload = await wrappedQuery.getQuery();
91605
92061
  assertEx(await this.queryable(sanitizedQuery, sanitizedPayloads, queryConfig));
@@ -91609,7 +92065,7 @@ var AbstractArchivist = class _AbstractArchivist extends AbstractModuleInstance
91609
92065
  resultPayloads.push(...await this.allHandler());
91610
92066
  break;
91611
92067
  case ArchivistClearQuerySchema:
91612
- await this.clearHandler();
92068
+ await this.clearWithConfig();
91613
92069
  break;
91614
92070
  case ArchivistCommitQuerySchema:
91615
92071
  resultPayloads.push(...await this.commitHandler());
@@ -91644,6 +92100,8 @@ var AbstractArchivist = class _AbstractArchivist extends AbstractModuleInstance
91644
92100
  if (this.config.storeQueries) await this.insertWithConfig([sanitizedQuery]);
91645
92101
  return PayloadBuilder.omitPrivateStorageMeta(resultPayloads);
91646
92102
  }
92103
+ /** Restore derived indexes for a stored root without rewriting its body. */
92104
+ repairExistingPayloads(_payloads) {}
91647
92105
  reportPayloadCount() {
91648
92106
  this._noOverride("reportPayloadCount");
91649
92107
  const gauge = this.payloadCountGauge;
@@ -91666,8 +92124,23 @@ var AbstractArchivist = class _AbstractArchivist extends AbstractModuleInstance
91666
92124
  async stateHandler() {
91667
92125
  return [...await super.stateHandler(), await this.generateStats()];
91668
92126
  }
92127
+ /** Enforce backend admission before lookup, repair, insertion or parent writes. */
92128
+ validateInsertPayloads(_payloads) {}
92129
+ /** Serialize local storage changes without holding a lock across callbacks or parents. */
92130
+ async withStorageMutation(operation) {
92131
+ return await operation();
92132
+ }
91669
92133
  async writeToParent(parent, payloads) {
91670
- return await parent.insert(PayloadBuilder.omitStorageMeta(payloads));
92134
+ if (payloads.length === 0) return [];
92135
+ const sanitized = PayloadBuilder.omitStorageMeta(payloads);
92136
+ const hashes = [...new Set(await Promise.all(sanitized.map((payload) => PayloadBuilder.hash(payload))))];
92137
+ const inserted = await this.exactRepresentations(await parent.insert(sanitized), hashes);
92138
+ const insertedHashes = new Set(inserted.map((payload) => payload._hash));
92139
+ const missing = hashes.filter((hash) => !insertedHashes.has(hash));
92140
+ const existing = missing.length > 0 ? await this.exactRepresentations(await parent.get(missing), missing) : [];
92141
+ const acknowledged = new Set([...inserted, ...existing].map((payload) => payload._hash));
92142
+ if (hashes.some((hash) => !acknowledged.has(hash))) throw new Error("Write parent did not acknowledge all requested payloads");
92143
+ return [...inserted, ...existing];
91671
92144
  }
91672
92145
  async writeToParents(payloads) {
91673
92146
  const parents = await this.parentArchivists();
@@ -91675,14 +92148,31 @@ var AbstractArchivist = class _AbstractArchivist extends AbstractModuleInstance
91675
92148
  return parent ? await this.writeToParent(parent, payloads) : void 0;
91676
92149
  }))).filter(exists$1).flat();
91677
92150
  }
91678
- omitClientMetaForDataHashes(hashes, payloads) {
91679
- return payloads.map((payload) => {
91680
- if (hashes.includes(payload._dataHash) && !hashes.includes(payload._hash)) {
91681
- const result = PayloadBuilder.omitClientMeta(payload);
91682
- result._hash = result._dataHash;
91683
- return result;
91684
- } else return payload;
91685
- });
92151
+ async exactRepresentations(payloads, hashes) {
92152
+ const requested = new Set(hashes);
92153
+ const found = /* @__PURE__ */ new Map();
92154
+ for (const payload of payloads) {
92155
+ await this.verifyPayloadIdentity(payload);
92156
+ if (requested.has(payload._hash)) found.set(payload._hash, payload);
92157
+ }
92158
+ return [...found.values()];
92159
+ }
92160
+ async requestedRepresentations(payloads, hashes) {
92161
+ const requested = new Set(hashes);
92162
+ const result = /* @__PURE__ */ new Map();
92163
+ const sorted = payloads.toSorted(PayloadBuilder.compareStorageMeta);
92164
+ for (const payload of sorted) {
92165
+ await this.verifyPayloadIdentity(payload);
92166
+ if (requested.has(payload._hash) && !result.has(payload._hash)) result.set(payload._hash, payload);
92167
+ }
92168
+ for (const payload of sorted) if (requested.has(payload._dataHash) && !result.has(payload._dataHash)) {
92169
+ const dataOnly = PayloadBuilder.omitClientMeta(payload);
92170
+ result.set(payload._dataHash, {
92171
+ ...dataOnly,
92172
+ _hash: payload._dataHash
92173
+ });
92174
+ }
92175
+ return [...result.values()];
91686
92176
  }
91687
92177
  async resolveArchivists(archivists = [], archivistInstances) {
91688
92178
  const archivistModules = (await Promise.all(archivists.map((archivist) => this.resolve(archivist)))).filter(exists$1).filter(duplicateModules);
@@ -91697,9 +92187,29 @@ var AbstractArchivist = class _AbstractArchivist extends AbstractModuleInstance
91697
92187
  return prev;
91698
92188
  }, archivistInstancesMap);
91699
92189
  }
92190
+ snapshotPayloads(payloads) {
92191
+ return JSON.parse(JSON.stringify(PayloadBuilder.omitStorageMeta(payloads)));
92192
+ }
92193
+ async verifyPayloadIdentity(payload) {
92194
+ const canonicalPayload = PayloadBuilder.omitStorageMeta(payload);
92195
+ const [hash, dataHash] = await Promise.all([PayloadBuilder.hash(canonicalPayload), PayloadBuilder.dataHash(canonicalPayload)]);
92196
+ if (hash !== payload._hash || dataHash !== payload._dataHash) throw new Error("Archivist returned payload with invalid hash metadata");
92197
+ }
92198
+ async withCacheMutation(operation) {
92199
+ this.activeCacheMutations++;
92200
+ this.cacheGeneration++;
92201
+ this._getCache?.clear();
92202
+ try {
92203
+ return await operation();
92204
+ } finally {
92205
+ this.activeCacheMutations--;
92206
+ this.cacheGeneration++;
92207
+ this._getCache?.clear();
92208
+ }
92209
+ }
91700
92210
  };
91701
92211
  //#endregion
91702
- //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.0_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod@4.5.1__@opent_b1718bbc760a78b6c56b3abbac30bebc/node_modules/@xyo-network/sdk/dist/neutral/archivist-generic.mjs
92212
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.1_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod@4.6.1__@opent_9148262d6de5ca3d3b22c984d3a5a4f2/node_modules/@xyo-network/sdk/dist/neutral/archivist-generic.mjs
91703
92213
  var __defProp$9 = Object.defineProperty;
91704
92214
  var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
91705
92215
  var __getProtoOf$5 = Object.getPrototypeOf;
@@ -91782,7 +92292,7 @@ __publicField$7(GenericArchivist, "labels", {
91782
92292
  });
91783
92293
  GenericArchivist = __decorateClass$9([creatableModule()], GenericArchivist);
91784
92294
  //#endregion
91785
- //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.0_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod@4.5.1__@opent_b1718bbc760a78b6c56b3abbac30bebc/node_modules/@xyo-network/sdk/dist/neutral/archivist-view.mjs
92295
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.1_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod@4.6.1__@opent_9148262d6de5ca3d3b22c984d3a5a4f2/node_modules/@xyo-network/sdk/dist/neutral/archivist-view.mjs
91786
92296
  var __defProp$8 = Object.defineProperty;
91787
92297
  var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
91788
92298
  var __getProtoOf$4 = Object.getPrototypeOf;
@@ -91841,7 +92351,7 @@ __publicField$6(ViewArchivist, "labels", {
91841
92351
  });
91842
92352
  ViewArchivist = __decorateClass$8([labeledCreatableModule()], ViewArchivist);
91843
92353
  //#endregion
91844
- //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.0_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod@4.5.1__@opent_b1718bbc760a78b6c56b3abbac30bebc/node_modules/@xyo-network/sdk/dist/neutral/bridge-model.mjs
92354
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.1_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod@4.6.1__@opent_9148262d6de5ca3d3b22c984d3a5a4f2/node_modules/@xyo-network/sdk/dist/neutral/bridge-model.mjs
91845
92355
  var BridgeConnectQuerySchema = asSchema("network.xyo.query.bridge.connect", true);
91846
92356
  PayloadZodOfSchema(BridgeConnectQuerySchema), { ...QueryFieldsZod.shape };
91847
92357
  var BridgeDisconnectQuerySchema = asSchema("network.xyo.query.bridge.disconnect", true);
@@ -91862,7 +92372,7 @@ var isAttachableBridgeInstance = new IsObjectFactory().create({}, [isBridgeInsta
91862
92372
  AsObjectFactory.create(isAttachableBridgeInstance);
91863
92373
  var BridgeConfigSchema = asSchema("network.xyo.bridge.config", true);
91864
92374
  //#endregion
91865
- //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.0_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod@4.5.1__@opent_b1718bbc760a78b6c56b3abbac30bebc/node_modules/@xyo-network/sdk/dist/neutral/module-wrapper.mjs
92375
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.1_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod@4.6.1__@opent_9148262d6de5ca3d3b22c984d3a5a4f2/node_modules/@xyo-network/sdk/dist/neutral/module-wrapper.mjs
91866
92376
  var __defProp$7 = Object.defineProperty;
91867
92377
  var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
91868
92378
  var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$7(obj, key, {
@@ -92314,7 +92824,7 @@ var NodeWrapper = class extends ModuleWrapper {
92314
92824
  }
92315
92825
  };
92316
92826
  //#endregion
92317
- //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.0_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod@4.5.1__@opent_b1718bbc760a78b6c56b3abbac30bebc/node_modules/@xyo-network/sdk/dist/neutral/sentinel-model.mjs
92827
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.1_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod@4.6.1__@opent_9148262d6de5ca3d3b22c984d3a5a4f2/node_modules/@xyo-network/sdk/dist/neutral/sentinel-model.mjs
92318
92828
  var SentinelReportQuerySchema = asSchema("network.xyo.query.sentinel.report", true);
92319
92829
  PayloadZodOfSchema(SentinelReportQuerySchema), { ...QueryFieldsZod.shape };
92320
92830
  var isSentinelInstance = new IsInstanceFactory().create({ report: "function" }, [isModuleInstance]);
@@ -92370,7 +92880,7 @@ var SentinelWrapper = class extends ModuleWrapper {
92370
92880
  }
92371
92881
  };
92372
92882
  //#endregion
92373
- //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.0_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod@4.5.1__@opent_b1718bbc760a78b6c56b3abbac30bebc/node_modules/@xyo-network/sdk/dist/neutral/witness-model.mjs
92883
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.1_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod@4.6.1__@opent_9148262d6de5ca3d3b22c984d3a5a4f2/node_modules/@xyo-network/sdk/dist/neutral/witness-model.mjs
92374
92884
  var WitnessObserveQuerySchema = asSchema("network.xyo.query.witness.observe", true);
92375
92885
  PayloadZodOfSchema(WitnessObserveQuerySchema), { ...QueryFieldsZod.shape };
92376
92886
  var isWitnessInstance = new IsInstanceFactory().create({ observe: "function" }, [isModuleInstance]);
@@ -92396,7 +92906,7 @@ var WitnessWrapper = class extends ModuleWrapper {
92396
92906
  }
92397
92907
  };
92398
92908
  //#endregion
92399
- //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.0_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod@4.5.1__@opent_b1718bbc760a78b6c56b3abbac30bebc/node_modules/@xyo-network/sdk/dist/neutral/bridge-abstract.mjs
92909
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.1_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod@4.6.1__@opent_9148262d6de5ca3d3b22c984d3a5a4f2/node_modules/@xyo-network/sdk/dist/neutral/bridge-abstract.mjs
92400
92910
  var AbstractBridge = class extends AbstractModuleInstance {
92401
92911
  static configSchemas = [...super.configSchemas, BridgeConfigSchema];
92402
92912
  static defaultConfigSchema = BridgeConfigSchema;
@@ -92806,7 +93316,7 @@ var AbstractModuleProxy = class extends AbstractModuleInstance {
92806
93316
  }
92807
93317
  };
92808
93318
  //#endregion
92809
- //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.0_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod@4.5.1__@opent_b1718bbc760a78b6c56b3abbac30bebc/node_modules/@xyo-network/sdk/dist/neutral/bridge-http.mjs
93319
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.1_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod@4.6.1__@opent_9148262d6de5ca3d3b22c984d3a5a4f2/node_modules/@xyo-network/sdk/dist/neutral/bridge-http.mjs
92810
93320
  var __defProp$6 = Object.defineProperty;
92811
93321
  var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
92812
93322
  var __getProtoOf$3 = Object.getPrototypeOf;
@@ -93081,7 +93591,7 @@ __publicField$4(HttpBridge, "fetchClient", new FetchJsonClient());
93081
93591
  __publicField$4(HttpBridge, "maxFailureCacheSize", 1e3);
93082
93592
  HttpBridge = __decorateClass$6([creatableModule()], HttpBridge);
93083
93593
  //#endregion
93084
- //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.0_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod@4.5.1__@opent_b1718bbc760a78b6c56b3abbac30bebc/node_modules/@xyo-network/sdk/dist/neutral/diviner-abstract.mjs
93594
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.1_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod@4.6.1__@opent_9148262d6de5ca3d3b22c984d3a5a4f2/node_modules/@xyo-network/sdk/dist/neutral/diviner-abstract.mjs
93085
93595
  var delayedResolve = async (parent, id, closure, as = asModuleInstance, timeout = 3e4, logger) => {
93086
93596
  const start = Date.now();
93087
93597
  let result;
@@ -93196,7 +93706,7 @@ var AbstractDiviner = class extends AbstractModuleInstance {
93196
93706
  }
93197
93707
  };
93198
93708
  //#endregion
93199
- //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.0_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod@4.5.1__@opent_b1718bbc760a78b6c56b3abbac30bebc/node_modules/@xyo-network/sdk/dist/neutral/diviner-boundwitness.mjs
93709
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.1_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod@4.6.1__@opent_9148262d6de5ca3d3b22c984d3a5a4f2/node_modules/@xyo-network/sdk/dist/neutral/diviner-boundwitness.mjs
93200
93710
  var BoundWitnessDivinerSchema$1 = asSchema("network.xyo.diviner.boundwitness", true);
93201
93711
  var BoundWitnessDivinerConfigSchema$1 = asSchema(`${BoundWitnessDivinerSchema$1}.config`, true);
93202
93712
  var BoundWitnessDiviner$1 = class extends AbstractDiviner {
@@ -93205,7 +93715,7 @@ var BoundWitnessDiviner$1 = class extends AbstractDiviner {
93205
93715
  };
93206
93716
  PayloadZodOfSchema(asSchema(`${BoundWitnessDivinerSchema$1}.query`, true)), { ...QueryFieldsZod.shape };
93207
93717
  //#endregion
93208
- //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.0_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod@4.5.1__@opent_b1718bbc760a78b6c56b3abbac30bebc/node_modules/@xyo-network/sdk/dist/neutral/diviner-identity.mjs
93718
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.1_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod@4.6.1__@opent_9148262d6de5ca3d3b22c984d3a5a4f2/node_modules/@xyo-network/sdk/dist/neutral/diviner-identity.mjs
93209
93719
  var __defProp$5 = Object.defineProperty;
93210
93720
  var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
93211
93721
  var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$5(obj, key, {
@@ -93229,13 +93739,13 @@ var IdentityDiviner = class extends AbstractDiviner {
93229
93739
  __publicField$3(IdentityDiviner, "targetSchema", asSchema("network.xyo.test", true));
93230
93740
  IdentityDiviner = __decorateClass$5([creatableModule()], IdentityDiviner);
93231
93741
  //#endregion
93232
- //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.0_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod@4.5.1__@opent_b1718bbc760a78b6c56b3abbac30bebc/node_modules/@xyo-network/sdk/dist/neutral/diviner-payload-abstract.mjs
93742
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.1_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod@4.6.1__@opent_9148262d6de5ca3d3b22c984d3a5a4f2/node_modules/@xyo-network/sdk/dist/neutral/diviner-payload-abstract.mjs
93233
93743
  var PayloadDiviner = class extends AbstractDiviner {
93234
93744
  static configSchemas = [...super.configSchemas, PayloadDivinerConfigSchema];
93235
93745
  static defaultConfigSchema = PayloadDivinerConfigSchema;
93236
93746
  };
93237
93747
  //#endregion
93238
- //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.0_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod@4.5.1__@opent_b1718bbc760a78b6c56b3abbac30bebc/node_modules/@xyo-network/sdk/dist/neutral/diviner-payload-generic.mjs
93748
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.1_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod@4.6.1__@opent_9148262d6de5ca3d3b22c984d3a5a4f2/node_modules/@xyo-network/sdk/dist/neutral/diviner-payload-generic.mjs
93239
93749
  var __defProp$4 = Object.defineProperty;
93240
93750
  var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
93241
93751
  var __getProtoOf$2 = Object.getPrototypeOf;
@@ -93380,7 +93890,7 @@ asSchema("network.xyo.location.range.query", true);
93380
93890
  asSchema("network.xyo.location.range.answer", true);
93381
93891
  asSchema("network.xyo.diviner.remote.config", true);
93382
93892
  //#endregion
93383
- //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.0_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod@4.5.1__@opent_b1718bbc760a78b6c56b3abbac30bebc/node_modules/@xyo-network/sdk/dist/neutral/archivist-memory.mjs
93893
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.1_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod@4.6.1__@opent_9148262d6de5ca3d3b22c984d3a5a4f2/node_modules/@xyo-network/sdk/dist/neutral/archivist-memory.mjs
93384
93894
  var __defProp$3 = Object.defineProperty;
93385
93895
  var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
93386
93896
  var __getProtoOf$1 = Object.getPrototypeOf;
@@ -93461,6 +93971,8 @@ var MemoryDriver = class extends AbstractCreatable {
93461
93971
  }
93462
93972
  get(hashes) {
93463
93973
  return hashes.map((hash) => {
93974
+ const exact = this.cache.get(hash);
93975
+ if (exact) return exact;
93464
93976
  const resolvedHash = this.dataHashIndex.get(hash) ?? hash;
93465
93977
  const result = this.cache.get(resolvedHash);
93466
93978
  if (resolvedHash !== hash && !result) throw new Error("Missing referenced payload");
@@ -93519,7 +94031,7 @@ __publicField$1(MemoryArchivist, "labels", {
93519
94031
  });
93520
94032
  MemoryArchivist = __decorateClass$3([creatableModule()], MemoryArchivist);
93521
94033
  //#endregion
93522
- //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.0_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod@4.5.1__@opent_b1718bbc760a78b6c56b3abbac30bebc/node_modules/@xyo-network/sdk/dist/neutral/node-abstract.mjs
94034
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.1_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod@4.6.1__@opent_9148262d6de5ca3d3b22c984d3a5a4f2/node_modules/@xyo-network/sdk/dist/neutral/node-abstract.mjs
93523
94035
  var AbstractNode = class extends AbstractModuleInstance {
93524
94036
  static configSchemas = [...super.configSchemas, NodeConfigSchema];
93525
94037
  static defaultConfigSchema = NodeConfigSchema;
@@ -93721,7 +94233,7 @@ var NodeHelper = {
93721
94233
  attachedPublicModules
93722
94234
  };
93723
94235
  //#endregion
93724
- //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.0_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod@4.5.1__@opent_b1718bbc760a78b6c56b3abbac30bebc/node_modules/@xyo-network/sdk/dist/neutral/node-memory.mjs
94236
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.1_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod@4.6.1__@opent_9148262d6de5ca3d3b22c984d3a5a4f2/node_modules/@xyo-network/sdk/dist/neutral/node-memory.mjs
93725
94237
  var __defProp$2 = Object.defineProperty;
93726
94238
  var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
93727
94239
  var __decorateClass$2 = (decorators, target, key, kind) => {
@@ -93944,7 +94456,7 @@ var MemoryNodeHelper = {
93944
94456
  flatAttachToNewNode
93945
94457
  };
93946
94458
  //#endregion
93947
- //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.0_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod@4.5.1__@opent_b1718bbc760a78b6c56b3abbac30bebc/node_modules/@xyo-network/sdk/dist/neutral/diviner-boundwitness.memory.mjs
94459
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.1_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod@4.6.1__@opent_9148262d6de5ca3d3b22c984d3a5a4f2/node_modules/@xyo-network/sdk/dist/neutral/diviner-boundwitness.memory.mjs
93948
94460
  var applyBoundWitnessDivinerQueryPayload = (filter, payloads = []) => {
93949
94461
  if (!filter) return [];
93950
94462
  const { addresses, cursor, destination, limit, order = "desc", payload_hashes, payload_schemas, sourceQuery } = filter;
@@ -93983,7 +94495,7 @@ var MemoryBoundWitnessDiviner = class extends BoundWitnessDiviner {
93983
94495
  }
93984
94496
  };
93985
94497
  //#endregion
93986
- //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.0_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod@4.5.1__@opent_b1718bbc760a78b6c56b3abbac30bebc/node_modules/@xyo-network/sdk/dist/neutral/node-view.mjs
94498
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.1_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod@4.6.1__@opent_9148262d6de5ca3d3b22c984d3a5a4f2/node_modules/@xyo-network/sdk/dist/neutral/node-view.mjs
93987
94499
  var __defProp$1 = Object.defineProperty;
93988
94500
  var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
93989
94501
  var __getProtoOf = Object.getPrototypeOf;
@@ -94081,7 +94593,7 @@ __publicField(ViewNode, "defaultConfigSchema", ViewNodeConfigSchema);
94081
94593
  __publicField(ViewNode, "labels", { ...ModuleLimitationViewLabel });
94082
94594
  ViewNode = __decorateClass$1([creatableModule()], ViewNode);
94083
94595
  //#endregion
94084
- //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.0_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod@4.5.1__@opent_b1718bbc760a78b6c56b3abbac30bebc/node_modules/@xyo-network/sdk/dist/neutral/sentinel-abstract.mjs
94596
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.1_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod@4.6.1__@opent_9148262d6de5ca3d3b22c984d3a5a4f2/node_modules/@xyo-network/sdk/dist/neutral/sentinel-abstract.mjs
94085
94597
  var AbstractSentinel = class extends AbstractModuleInstance {
94086
94598
  static configSchemas = [...super.configSchemas, SentinelConfigSchema];
94087
94599
  static defaultConfigSchema = SentinelConfigSchema;
@@ -94186,7 +94698,7 @@ var AbstractSentinel = class extends AbstractModuleInstance {
94186
94698
  }
94187
94699
  };
94188
94700
  //#endregion
94189
- //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.0_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod@4.5.1__@opent_b1718bbc760a78b6c56b3abbac30bebc/node_modules/@xyo-network/sdk/dist/neutral/sentinel-memory.mjs
94701
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.1_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod@4.6.1__@opent_9148262d6de5ca3d3b22c984d3a5a4f2/node_modules/@xyo-network/sdk/dist/neutral/sentinel-memory.mjs
94190
94702
  var SentinelIntervalAutomationWrapper = class extends PayloadWrapper {
94191
94703
  constructor(payload) {
94192
94704
  super(payload);
@@ -94457,7 +94969,7 @@ var MemorySentinel = class extends AbstractSentinel {
94457
94969
  }
94458
94970
  };
94459
94971
  //#endregion
94460
- //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.0_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod@4.5.1__@opent_b1718bbc760a78b6c56b3abbac30bebc/node_modules/@xyo-network/sdk/dist/neutral/witness-abstract.mjs
94972
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.1_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod@4.6.1__@opent_9148262d6de5ca3d3b22c984d3a5a4f2/node_modules/@xyo-network/sdk/dist/neutral/witness-abstract.mjs
94461
94973
  var AbstractWitness = class extends AbstractModuleInstance {
94462
94974
  static configSchemas = [...super.configSchemas, WitnessConfigSchema];
94463
94975
  static defaultConfigSchema = WitnessConfigSchema;
@@ -94524,7 +95036,7 @@ var AbstractWitness = class extends AbstractModuleInstance {
94524
95036
  }
94525
95037
  };
94526
95038
  //#endregion
94527
- //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.0_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod@4.5.1__@opent_b1718bbc760a78b6c56b3abbac30bebc/node_modules/@xyo-network/sdk/dist/neutral/witness-adhoc.mjs
95039
+ //#region ../../node_modules/.pnpm/@xyo-network+sdk@7.4.1_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod@4.6.1__@opent_9148262d6de5ca3d3b22c984d3a5a4f2/node_modules/@xyo-network/sdk/dist/neutral/witness-adhoc.mjs
94528
95040
  var AdhocWitnessConfigSchema = asSchema("network.xyo.witness.adhoc.config", true);
94529
95041
  var AdhocWitness = class extends AbstractWitness {
94530
95042
  static configSchemas = [...super.configSchemas, AdhocWitnessConfigSchema];
@@ -94537,8 +95049,24 @@ var AdhocWitness = class extends AbstractWitness {
94537
95049
  }
94538
95050
  };
94539
95051
  HttpBridge.factory(), ViewArchivist.factory(), ViewNode.factory(), AdhocWitness.factory(), GenericPayloadDiviner.factory(), MemoryBoundWitnessDiviner.factory(), IdentityDiviner.factory(), MemoryArchivist.factory(), MemoryArchivist.factory(), MemoryNode.factory(), MemorySentinel.factory(), GenericPayloadDiviner.factory();
94540
- //#endregion
94541
- //#region ../jwt/dist/neutral/index.mjs
95052
+ Object.freeze({
95053
+ AudienceMismatch: "AUDIENCE_MISMATCH",
95054
+ CryptographicVerificationFailed: "CRYPTOGRAPHIC_VERIFICATION_FAILED",
95055
+ CustomClaimsMismatch: "CUSTOM_CLAIMS_MISMATCH",
95056
+ HeaderAlgorithmMismatch: "HEADER_ALGORITHM_MISMATCH",
95057
+ HeaderKeysMismatch: "HEADER_KEYS_MISMATCH",
95058
+ HeaderTypeMismatch: "HEADER_TYPE_MISMATCH",
95059
+ InvalidOptions: "INVALID_OPTIONS",
95060
+ InvalidToken: "INVALID_TOKEN",
95061
+ NonCanonicalBase64Url: "NON_CANONICAL_BASE64URL",
95062
+ NonCanonicalJson: "NON_CANONICAL_JSON",
95063
+ NumericDateMismatch: "NUMERIC_DATE_MISMATCH",
95064
+ PayloadKeysMismatch: "PAYLOAD_KEYS_MISMATCH",
95065
+ PrincipalMismatch: "PRINCIPAL_MISMATCH",
95066
+ SchemaMismatch: "SCHEMA_MISMATCH",
95067
+ TokenNotCurrent: "TOKEN_NOT_CURRENT",
95068
+ TokenTooLong: "TOKEN_TOO_LONG"
95069
+ });
94542
95070
  var ADDRESS_PATTERN$1 = /^(?:0x)?[\da-fA-F]{40}$/;
94543
95071
  var PUBLIC_KEY_PATTERN = /^[\da-fA-F]{128}$/;
94544
95072
  var DEFAULT_MAX_LIFETIME_SECONDS = 300;
@@ -94563,8 +95091,8 @@ async function verifyWalletJwtPolicy(token, options) {
94563
95091
  const now = options.now ?? Math.floor(Date.now() / 1e3);
94564
95092
  const maxLifetimeSeconds = options.maxLifetimeSeconds ?? DEFAULT_MAX_LIFETIME_SECONDS;
94565
95093
  const futureSkewSeconds = options.futureSkewSeconds ?? DEFAULT_FUTURE_SKEW_SECONDS;
94566
- validateHeader(header, reasons);
94567
- validatePayload(payload, options.audience, now, maxLifetimeSeconds, futureSkewSeconds, reasons);
95094
+ validateHeader2(header, reasons);
95095
+ validatePayload2(payload, options.audience, now, maxLifetimeSeconds, futureSkewSeconds, reasons);
94568
95096
  const scopes = validateProfile(payload, options.profile, reasons);
94569
95097
  await validateSignature(token, options.audience, now, reasons);
94570
95098
  const kid = typeof header.kid === "string" ? header.kid : "";
@@ -94610,13 +95138,13 @@ function resolvePrincipal(header, payload, reasons) {
94610
95138
  reasons.push("kid or iss is not a valid XYO address");
94611
95139
  }
94612
95140
  }
94613
- function validateHeader(header, reasons) {
95141
+ function validateHeader2(header, reasons) {
94614
95142
  if (header.alg !== JwtAlg.ES256K) reasons.push("header.alg must be ES256K");
94615
95143
  if (header.typ !== JwtTyp.JWT) reasons.push("header.typ must be JWT");
94616
95144
  if (typeof header.kid !== "string" || !ADDRESS_PATTERN$1.test(header.kid)) reasons.push("header.kid must be a 20-byte hex address");
94617
95145
  if (typeof header.pub !== "string" || !PUBLIC_KEY_PATTERN.test(header.pub)) reasons.push("header.pub must be an embedded 64-byte secp256k1 public key");
94618
95146
  }
94619
- function validatePayload(payload, audience, now, maxLifetimeSeconds, futureSkewSeconds, reasons) {
95147
+ function validatePayload2(payload, audience, now, maxLifetimeSeconds, futureSkewSeconds, reasons) {
94620
95148
  if (typeof payload.iss !== "string" || !ADDRESS_PATTERN$1.test(payload.iss)) reasons.push("payload.iss must be a 20-byte hex address");
94621
95149
  if (payload.aud !== audience) reasons.push("payload.aud does not exactly match the required audience");
94622
95150
  if (payload.schema !== JwtSchema.Signin) reasons.push(`payload.schema must be ${JwtSchema.Signin}`);
@@ -94660,21 +95188,21 @@ function parseCanonicalScope(value, allowedScopes, reasons) {
94660
95188
  reasons.push("payload.scope must use single-space separators with no surrounding whitespace");
94661
95189
  return [];
94662
95190
  }
94663
- const canonical = [...new Set(scopes)].sort();
95191
+ const canonical = [...new Set(scopes)].toSorted();
94664
95192
  if (canonical.length !== scopes.length || canonical.join(" ") !== value) reasons.push("payload.scope must be sorted, unique, and space-delimited");
94665
95193
  const allowed = new Set(allowedScopes);
94666
95194
  for (const scope of scopes) if (!allowed.has(scope)) reasons.push(`payload.scope contains unknown operation: ${scope}`);
94667
95195
  return scopes;
94668
95196
  }
94669
95197
  function isFiniteInteger$1(value) {
94670
- return typeof value === "number" && Number.isFinite(value) && Number.isInteger(value);
95198
+ return typeof value === "number" && Number.isFinite(value) && Number.isSafeInteger(value);
94671
95199
  }
94672
95200
  function asRecord(value) {
94673
95201
  if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
94674
95202
  return value;
94675
95203
  }
94676
95204
  //#endregion
94677
- //#region ../../node_modules/.pnpm/zod@4.5.1/node_modules/zod/v4/classic/checks.js
95205
+ //#region ../../node_modules/.pnpm/zod@4.6.1/node_modules/zod/v4/classic/checks.js
94678
95206
  var checks_exports = /* @__PURE__ */ __exportAll({
94679
95207
  endsWith: () => _endsWith,
94680
95208
  gt: () => _gt,
@@ -94696,7 +95224,6 @@ var checks_exports = /* @__PURE__ */ __exportAll({
94696
95224
  normalize: () => _normalize,
94697
95225
  overwrite: () => _overwrite,
94698
95226
  positive: () => _positive,
94699
- properties: () => _properties,
94700
95227
  property: () => _property,
94701
95228
  regex: () => _regex,
94702
95229
  size: () => _size,
@@ -94708,7 +95235,7 @@ var checks_exports = /* @__PURE__ */ __exportAll({
94708
95235
  uppercase: () => _uppercase
94709
95236
  });
94710
95237
  //#endregion
94711
- //#region ../../node_modules/.pnpm/zod@4.5.1/node_modules/zod/v4/classic/errors.js
95238
+ //#region ../../node_modules/.pnpm/zod@4.6.1/node_modules/zod/v4/classic/errors.js
94712
95239
  const _installedErrorProtos = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
94713
95240
  function _lazyMethod(proto, key, make) {
94714
95241
  Object.defineProperty(proto, key, {
@@ -94758,7 +95285,7 @@ const initializer = (inst, issues) => {
94758
95285
  };
94759
95286
  const ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, void 0, { Parent: Error });
94760
95287
  //#endregion
94761
- //#region ../../node_modules/.pnpm/zod@4.5.1/node_modules/zod/v4/classic/parse.js
95288
+ //#region ../../node_modules/.pnpm/zod@4.6.1/node_modules/zod/v4/classic/parse.js
94762
95289
  const parse$1 = /* @__PURE__ */ _parse(ZodRealError);
94763
95290
  const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
94764
95291
  const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
@@ -94772,7 +95299,7 @@ const safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
94772
95299
  const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
94773
95300
  const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
94774
95301
  //#endregion
94775
- //#region ../../node_modules/.pnpm/zod@4.5.1/node_modules/zod/v4/classic/schemas.js
95302
+ //#region ../../node_modules/.pnpm/zod@4.6.1/node_modules/zod/v4/classic/schemas.js
94776
95303
  var schemas_exports = /* @__PURE__ */ __exportAll({
94777
95304
  ZodAny: () => ZodAny,
94778
95305
  ZodArray: () => ZodArray,
@@ -94801,12 +95328,14 @@ var schemas_exports = /* @__PURE__ */ __exportAll({
94801
95328
  ZodFile: () => ZodFile,
94802
95329
  ZodFunction: () => ZodFunction,
94803
95330
  ZodGUID: () => ZodGUID,
95331
+ ZodIBAN: () => ZodIBAN,
94804
95332
  ZodIPv4: () => ZodIPv4,
94805
95333
  ZodIPv6: () => ZodIPv6,
94806
95334
  ZodISODate: () => ZodISODate,
94807
95335
  ZodISODateTime: () => ZodISODateTime,
94808
95336
  ZodISODuration: () => ZodISODuration,
94809
95337
  ZodISOTime: () => ZodISOTime,
95338
+ ZodInstanceOf: () => ZodInstanceOf,
94810
95339
  ZodIntersection: () => ZodIntersection,
94811
95340
  ZodJWT: () => ZodJWT,
94812
95341
  ZodKSUID: () => ZodKSUID,
@@ -94828,6 +95357,7 @@ var schemas_exports = /* @__PURE__ */ __exportAll({
94828
95357
  ZodPrefault: () => ZodPrefault,
94829
95358
  ZodPreprocess: () => ZodPreprocess,
94830
95359
  ZodPromise: () => ZodPromise,
95360
+ ZodProperties: () => ZodProperties,
94831
95361
  ZodReadonly: () => ZodReadonly,
94832
95362
  ZodRecord: () => ZodRecord,
94833
95363
  ZodSet: () => ZodSet,
@@ -94883,6 +95413,7 @@ var schemas_exports = /* @__PURE__ */ __exportAll({
94883
95413
  hex: () => hex,
94884
95414
  hostname: () => hostname,
94885
95415
  httpUrl: () => httpUrl,
95416
+ iban: () => iban,
94886
95417
  instanceof: () => _instanceof,
94887
95418
  int: () => int,
94888
95419
  int32: () => int32,
@@ -94918,6 +95449,7 @@ var schemas_exports = /* @__PURE__ */ __exportAll({
94918
95449
  prefault: () => prefault,
94919
95450
  preprocess: () => preprocess,
94920
95451
  promise: () => promise,
95452
+ properties: () => properties,
94921
95453
  readonly: () => readonly,
94922
95454
  record: () => record,
94923
95455
  refine: () => refine,
@@ -95077,11 +95609,17 @@ const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
95077
95609
  return safeParseAsync(this, data, params);
95078
95610
  },
95079
95611
  get spa() {
95080
- return this.safeParseAsync;
95612
+ return this?.safeParseAsync;
95081
95613
  },
95082
95614
  set spa(value) {
95083
95615
  own(this, "spa", value);
95084
95616
  },
95617
+ validate(data, params) {
95618
+ return validate$1(this, data, params);
95619
+ },
95620
+ validateAsync(data, params) {
95621
+ return validateAsync$1(this, data, params);
95622
+ },
95085
95623
  encode: function _encode(data, params) {
95086
95624
  return encode(this, data, params, { callee: _encode });
95087
95625
  },
@@ -95106,11 +95644,8 @@ const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
95106
95644
  async safeDecodeAsync(data, params) {
95107
95645
  return safeDecodeAsync(this, data, params);
95108
95646
  },
95109
- get toJSONSchema() {
95110
- return own(this, "toJSONSchema", createToJSONSchemaMethod(this, {}));
95111
- },
95112
- set toJSONSchema(value) {
95113
- own(this, "toJSONSchema", value);
95647
+ toJSONSchema(params) {
95648
+ return createToJSONSchemaMethod(this, {})(params);
95114
95649
  },
95115
95650
  get description() {
95116
95651
  return globalRegistry.get(this)?.description;
@@ -95124,10 +95659,10 @@ const _ZodString = /*@__PURE__*/ $constructor("_ZodString", (inst, def) => {
95124
95659
  $ZodString.init(inst, def);
95125
95660
  ZodType.init(inst, def);
95126
95661
  inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
95127
- const bag = inst._zod.bag;
95128
- inst.format = bag.format ?? null;
95129
- inst.minLength = bag.minimum ?? null;
95130
- inst.maxLength = bag.maximum ?? null;
95662
+ }, /*@__PURE__*/ derived({
95663
+ format: (inst) => aggregateChecks(inst).format ?? null,
95664
+ minLength: (inst) => aggregateChecks(inst).minimum ?? null,
95665
+ maxLength: (inst) => aggregateChecks(inst).maximum ?? null
95131
95666
  }, {
95132
95667
  regex(...args) {
95133
95668
  return this.check(/* @__PURE__ */ _regex(...args));
@@ -95174,7 +95709,7 @@ const _ZodString = /*@__PURE__*/ $constructor("_ZodString", (inst, def) => {
95174
95709
  slugify() {
95175
95710
  return this.check(/* @__PURE__ */ _slugify());
95176
95711
  }
95177
- });
95712
+ }));
95178
95713
  const ZodString = /*@__PURE__*/ $constructor("ZodString", (inst, def) => {
95179
95714
  $ZodString.init(inst, def);
95180
95715
  _ZodString.init(inst, def);
@@ -95449,6 +95984,13 @@ const ZodCreditCard = /*@__PURE__*/ $constructor("ZodCreditCard", (inst, def) =>
95449
95984
  function creditCard(params) {
95450
95985
  return /* @__PURE__ */ _creditCard(ZodCreditCard, params);
95451
95986
  }
95987
+ const ZodIBAN = /*@__PURE__*/ $constructor("ZodIBAN", (inst, def) => {
95988
+ $ZodIBAN.init(inst, def);
95989
+ ZodStringFormat.init(inst, def);
95990
+ });
95991
+ function iban(params) {
95992
+ return /* @__PURE__ */ _iban(ZodIBAN, params);
95993
+ }
95452
95994
  const ZodJWT = /*@__PURE__*/ $constructor("ZodJWT", (inst, def) => {
95453
95995
  $ZodJWT.init(inst, def);
95454
95996
  ZodStringFormat.init(inst, def);
@@ -95479,12 +96021,21 @@ const ZodNumber = /*@__PURE__*/ $constructor("ZodNumber", (inst, def) => {
95479
96021
  $ZodNumber.init(inst, def);
95480
96022
  ZodType.init(inst, def);
95481
96023
  inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
95482
- const bag = inst._zod.bag;
95483
- inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
95484
- inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
95485
- inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? .5);
95486
96024
  inst.isFinite = true;
95487
- inst.format = bag.format ?? null;
96025
+ }, /*@__PURE__*/ derived({
96026
+ minValue: (inst) => {
96027
+ const { minimum, exclusiveMinimum } = aggregateChecks(inst);
96028
+ return Math.max(minimum ?? Number.NEGATIVE_INFINITY, exclusiveMinimum ?? Number.NEGATIVE_INFINITY);
96029
+ },
96030
+ maxValue: (inst) => {
96031
+ const { maximum, exclusiveMaximum } = aggregateChecks(inst);
96032
+ return Math.min(maximum ?? Number.POSITIVE_INFINITY, exclusiveMaximum ?? Number.POSITIVE_INFINITY);
96033
+ },
96034
+ isInt: (inst) => {
96035
+ const { isInt, multipleOf } = aggregateChecks(inst);
96036
+ return !!isInt || !!multipleOf?.some(Number.isSafeInteger);
96037
+ },
96038
+ format: (inst) => aggregateChecks(inst).format ?? null
95488
96039
  }, {
95489
96040
  gt(value, params) {
95490
96041
  return this.check(/* @__PURE__ */ _gt(value, params));
@@ -95531,7 +96082,7 @@ const ZodNumber = /*@__PURE__*/ $constructor("ZodNumber", (inst, def) => {
95531
96082
  finite() {
95532
96083
  return this;
95533
96084
  }
95534
- });
96085
+ }));
95535
96086
  function number(params) {
95536
96087
  return /* @__PURE__ */ _number(ZodNumber, params);
95537
96088
  }
@@ -95566,10 +96117,10 @@ const ZodBigInt = /*@__PURE__*/ $constructor("ZodBigInt", (inst, def) => {
95566
96117
  $ZodBigInt.init(inst, def);
95567
96118
  ZodType.init(inst, def);
95568
96119
  inst._zod.processJSONSchema = (ctx, json, params) => bigintProcessor(inst, ctx, json, params);
95569
- const bag = inst._zod.bag;
95570
- inst.minValue = bag.minimum ?? null;
95571
- inst.maxValue = bag.maximum ?? null;
95572
- inst.format = bag.format ?? null;
96120
+ }, /*@__PURE__*/ derived({
96121
+ minValue: (inst) => aggregateChecks(inst).minimum ?? null,
96122
+ maxValue: (inst) => aggregateChecks(inst).maximum ?? null,
96123
+ format: (inst) => aggregateChecks(inst).format ?? null
95573
96124
  }, {
95574
96125
  gte(value, params) {
95575
96126
  return this.check(/* @__PURE__ */ _gte(value, params));
@@ -95604,7 +96155,7 @@ const ZodBigInt = /*@__PURE__*/ $constructor("ZodBigInt", (inst, def) => {
95604
96155
  multipleOf(value, params) {
95605
96156
  return this.check(/* @__PURE__ */ _multipleOf(value, params));
95606
96157
  }
95607
- });
96158
+ }));
95608
96159
  function bigint(params) {
95609
96160
  return /* @__PURE__ */ _bigint(ZodBigInt, params);
95610
96161
  }
@@ -95680,10 +96231,16 @@ const ZodDate = /*@__PURE__*/ $constructor("ZodDate", (inst, def) => {
95680
96231
  inst._zod.processJSONSchema = (ctx, json, params) => dateProcessor(inst, ctx, json, params);
95681
96232
  inst.min = (value, params) => inst.check(/* @__PURE__ */ _gte(value, params));
95682
96233
  inst.max = (value, params) => inst.check(/* @__PURE__ */ _lte(value, params));
95683
- const c = inst._zod.bag;
95684
- inst.minDate = c.minimum ? new Date(c.minimum) : null;
95685
- inst.maxDate = c.maximum ? new Date(c.maximum) : null;
95686
- });
96234
+ }, /*@__PURE__*/ derived({
96235
+ minDate: (inst) => {
96236
+ const { minimum } = aggregateChecks(inst);
96237
+ return minimum ? new Date(minimum) : null;
96238
+ },
96239
+ maxDate: (inst) => {
96240
+ const { maximum } = aggregateChecks(inst);
96241
+ return maximum ? new Date(maximum) : null;
96242
+ }
96243
+ }, {}));
95687
96244
  function date$1(params) {
95688
96245
  return /* @__PURE__ */ _date(ZodDate, params);
95689
96246
  }
@@ -95728,34 +96285,19 @@ const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
95728
96285
  return _enum(Object.keys(this._zod.def.shape));
95729
96286
  },
95730
96287
  catchall(catchall) {
95731
- return this.clone({
95732
- ...this._zod.def,
95733
- catchall
95734
- });
96288
+ return this.clone(mergeDefs(this._zod.def, { catchall }));
95735
96289
  },
95736
96290
  passthrough() {
95737
- return this.clone({
95738
- ...this._zod.def,
95739
- catchall: unknown()
95740
- });
96291
+ return this.clone(mergeDefs(this._zod.def, { catchall: unknown() }));
95741
96292
  },
95742
96293
  loose() {
95743
- return this.clone({
95744
- ...this._zod.def,
95745
- catchall: unknown()
95746
- });
96294
+ return this.clone(mergeDefs(this._zod.def, { catchall: unknown() }));
95747
96295
  },
95748
96296
  strict() {
95749
- return this.clone({
95750
- ...this._zod.def,
95751
- catchall: never()
95752
- });
96297
+ return this.clone(mergeDefs(this._zod.def, { catchall: never() }));
95753
96298
  },
95754
96299
  strip() {
95755
- return this.clone({
95756
- ...this._zod.def,
95757
- catchall: void 0
95758
- });
96300
+ return this.clone(mergeDefs(this._zod.def, { catchall: void 0 }));
95759
96301
  },
95760
96302
  extend(incoming) {
95761
96303
  return extend$1(this, incoming);
@@ -95975,7 +96517,7 @@ const ZodEnum = /*@__PURE__*/ $constructor("ZodEnum", (inst, def) => {
95975
96517
  ZodType.init(inst, def);
95976
96518
  inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
95977
96519
  inst.enum = def.entries;
95978
- inst.options = Object.values(def.entries);
96520
+ inst.options = [...inst._zod.values];
95979
96521
  const keys = new Set(Object.keys(def.entries));
95980
96522
  inst.extract = (values, params) => {
95981
96523
  const newEntries = {};
@@ -96306,6 +96848,14 @@ const ZodCustom = /*@__PURE__*/ $constructor("ZodCustom", (inst, def) => {
96306
96848
  ZodType.init(inst, def);
96307
96849
  inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx, json, params);
96308
96850
  });
96851
+ const ZodProperties = /*@__PURE__*/ $constructor("ZodProperties", (inst, def) => {
96852
+ _ensureDefaultMemoizer();
96853
+ $ZodProperties.init(inst, def);
96854
+ ZodType.init(inst, def);
96855
+ });
96856
+ function properties(shape, params) {
96857
+ return /* @__PURE__ */ _properties(ZodProperties, shape, params);
96858
+ }
96309
96859
  function check(fn) {
96310
96860
  const ch = new $ZodCheck({ check: "custom" });
96311
96861
  ch._zod.check = fn;
@@ -96322,8 +96872,13 @@ function superRefine(fn, params) {
96322
96872
  }
96323
96873
  const describe = describe$1;
96324
96874
  const meta = meta$1;
96875
+ const ZodInstanceOf = /*@__PURE__*/ $constructor("ZodInstanceOf", (inst, def) => {
96876
+ ZodCustom.init(inst, def);
96877
+ }, { properties(shape, params) {
96878
+ return this.check(properties(shape, params));
96879
+ } });
96325
96880
  function _instanceof(cls, params = {}) {
96326
- const inst = new ZodCustom({
96881
+ const inst = new ZodInstanceOf({
96327
96882
  type: "custom",
96328
96883
  check: "custom",
96329
96884
  fn: (data) => data instanceof cls,
@@ -96368,7 +96923,7 @@ function preprocess(fn, schema) {
96368
96923
  });
96369
96924
  }
96370
96925
  //#endregion
96371
- //#region ../../node_modules/.pnpm/zod@4.5.1/node_modules/zod/v4/classic/compat.js
96926
+ //#region ../../node_modules/.pnpm/zod@4.6.1/node_modules/zod/v4/classic/compat.js
96372
96927
  /** @deprecated Do not use. Stub definition, only included for zod-to-json-schema compatibility. */
96373
96928
  var ZodFirstPartyTypeKind;
96374
96929
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
@@ -96377,7 +96932,7 @@ ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
96377
96932
  ...checks_exports
96378
96933
  });
96379
96934
  //#endregion
96380
- //#region ../../node_modules/.pnpm/@ariestools+provider-model@1.3.0_zod@4.5.1/node_modules/@ariestools/provider-model/dist/neutral/index.mjs
96935
+ //#region ../../node_modules/.pnpm/@ariestools+provider-model@1.3.0_zod@4.6.1/node_modules/@ariestools/provider-model/dist/neutral/index.mjs
96381
96936
  var ConnectionConfigZod = looseObject({ type: string().min(1) });
96382
96937
  var ConnectionsConfigZod = record(string(), ConnectionConfigZod).default({});
96383
96938
  strictObject({ dependencies: array(string().min(1)).default([]) });
@@ -96477,7 +97032,7 @@ function spanDurationInMillis(span2) {
96477
97032
  }
96478
97033
  });
96479
97034
  //#endregion
96480
- //#region ../../node_modules/.pnpm/@ariestools+actor@1.3.0_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod@4.5.1__@opentelemetry+api@1.9.1_zod@4.5.1/node_modules/@ariestools/actor/dist/neutral/index.mjs
97035
+ //#region ../../node_modules/.pnpm/@ariestools+actor@1.3.0_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod@4.6.1__@opentelemetry+api@1.9.1_zod@4.6.1/node_modules/@ariestools/actor/dist/neutral/index.mjs
96481
97036
  var __defProp = Object.defineProperty;
96482
97037
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
96483
97038
  var __decorateClass = (decorators, target, key, kind) => {
@@ -96730,7 +97285,7 @@ ${err.stack}` : "";
96730
97285
  return String(err);
96731
97286
  }
96732
97287
  //#endregion
96733
- //#region ../../node_modules/.pnpm/@ariestools+actor-system@1.3.0_@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod@4.5.1_752b528cb5f988af784c74b301fa6850/node_modules/@ariestools/actor-system/dist/neutral/index.mjs
97288
+ //#region ../../node_modules/.pnpm/@ariestools+actor-system@1.3.0_@ariestools+sdk@8.3.0_@opentelemetry+api@1.9.1_zod@4.6.1_e4d63a6db742046cbc8d622a2f828386/node_modules/@ariestools/actor-system/dist/neutral/index.mjs
96734
97289
  var ActorSystemSelectionZod = strictObject({
96735
97290
  config: unknown().optional(),
96736
97291
  host: string().min(1).optional(),
@@ -96751,7 +97306,7 @@ var ActorSystemSelectionZod = strictObject({
96751
97306
  });
96752
97307
  ProviderConfigFieldsZod.extend({ actors: array(ActorSystemSelectionZod).default([]) });
96753
97308
  //#endregion
96754
- //#region ../../node_modules/.pnpm/@ariestools+cli-kit@1.2.3_@ariestools+actor-model@1.3.0_@ariestools+sdk@8.2.0_@opentele_5e4f1ac05713d1b486b4dc63d7c48617/node_modules/@ariestools/cli-kit/dist/node/index.mjs
97309
+ //#region ../../node_modules/.pnpm/@ariestools+cli-kit@1.2.3_@ariestools+actor-model@1.3.0_@ariestools+sdk@8.3.0_@opentele_12686f89e232b4319a2511392ce53195/node_modules/@ariestools/cli-kit/dist/node/index.mjs
96755
97310
  async function runServiceUntilInterrupt(host, stop) {
96756
97311
  await new Promise((resolve, reject) => {
96757
97312
  const dispose = host.onInterrupt(async () => {
@@ -96766,7 +97321,7 @@ async function runServiceUntilInterrupt(host, stop) {
96766
97321
  });
96767
97322
  }
96768
97323
  //#endregion
96769
- //#region ../../node_modules/.pnpm/@ariestools+cli-kit-node@1.2.3_@ariestools+actor-model@1.3.0_@ariestools+sdk@8.2.0_@ope_d8f4f361a702e5d537d1687709db0882/node_modules/@ariestools/cli-kit-node/dist/node/index.mjs
97324
+ //#region ../../node_modules/.pnpm/@ariestools+cli-kit-node@1.2.3_@ariestools+actor-model@1.3.0_@ariestools+sdk@8.3.0_@ope_7b18c786a1c8bb7b1298534a22a75fd9/node_modules/@ariestools/cli-kit-node/dist/node/index.mjs
96770
97325
  function resolveEnvironmentValue(key, layers) {
96771
97326
  for (const layer of layers) {
96772
97327
  if (!Object.hasOwn(layer, key)) continue;
@@ -99822,14 +100377,16 @@ function registerMetrics$1(app, options) {
99822
100377
  }
99823
100378
  function registerHealthRoute(app, options) {
99824
100379
  app.get(options.path, async () => {
99825
- return options.includeTime ? {
99826
- status: "ok",
99827
- version: options.version,
99828
- time: (/* @__PURE__ */ new Date()).toISOString()
99829
- } : {
100380
+ if (!options.includeTime) return {
99830
100381
  status: "ok",
99831
100382
  version: options.version
99832
100383
  };
100384
+ const now = /* @__PURE__ */ new Date();
100385
+ return {
100386
+ status: "ok",
100387
+ version: options.version,
100388
+ time: now.toISOString()
100389
+ };
99833
100390
  });
99834
100391
  }
99835
100392
  var JsonSnapshotFile = class {
@@ -99914,12 +100471,12 @@ function verifyStrictHs256(token, signingSecret) {
99914
100471
  return { payload: decodeJsonObject(payloadPart, "Payload") };
99915
100472
  }
99916
100473
  function assertExactKeys(value, expected, label) {
99917
- const actual = Object.keys(value).sort();
99918
- const canonical = [...expected].sort();
100474
+ const actual = Object.keys(value).toSorted();
100475
+ const canonical = [...expected].toSorted();
99919
100476
  if (actual.length !== canonical.length || actual.some((key, index) => key !== canonical[index])) throw new StrictHs256Error("malformed", `${label} fields must be exactly: ${canonical.join(", ")}`);
99920
100477
  }
99921
100478
  function isFiniteInteger(value) {
99922
- return typeof value === "number" && Number.isFinite(value) && Number.isInteger(value);
100479
+ return typeof value === "number" && Number.isFinite(value) && Number.isSafeInteger(value);
99923
100480
  }
99924
100481
  function isNonEmptyString(value) {
99925
100482
  return typeof value === "string" && value.length > 0;
@@ -99927,7 +100484,8 @@ function isNonEmptyString(value) {
99927
100484
  function decodeJsonObject(value, label) {
99928
100485
  let parsed;
99929
100486
  try {
99930
- parsed = JSON.parse(decodeBase64Url(value, label).toString("utf8"));
100487
+ const decoder = new TextDecoder();
100488
+ parsed = JSON.parse(decoder.decode(decodeBase64Url(value, label)));
99931
100489
  } catch (error) {
99932
100490
  if (error instanceof StrictHs256Error) throw error;
99933
100491
  throw new StrictHs256Error("malformed", `${label} is not valid JSON`);
@@ -99958,9 +100516,11 @@ function signSessionToken(input) {
99958
100516
  alg: "HS256",
99959
100517
  typ: "JWT"
99960
100518
  }))}.${base64UrlEncode(JSON.stringify(payload))}`;
100519
+ const signature = createHmac("sha256", input.signingSecret).update(toSign).digest("base64url");
100520
+ const expiresAtDate = /* @__PURE__ */ new Date(expiresAt * 1e3);
99961
100521
  return {
99962
- token: `${toSign}.${createHmac("sha256", input.signingSecret).update(toSign).digest("base64url")}`,
99963
- expiresAt: (/* @__PURE__ */ new Date(expiresAt * 1e3)).toISOString()
100522
+ token: `${toSign}.${signature}`,
100523
+ expiresAt: expiresAtDate.toISOString()
99964
100524
  };
99965
100525
  }
99966
100526
  var SessionTokenVerificationError = class extends Error {
@@ -100017,9 +100577,11 @@ function signChallenge(input) {
100017
100577
  alg: "HS256",
100018
100578
  typ: "JWT"
100019
100579
  }))}.${base64UrlEncode(JSON.stringify(payload))}`;
100580
+ const signature = createHmac("sha256", input.signingSecret).update(toSign).digest("base64url");
100581
+ const expiresAtDate = /* @__PURE__ */ new Date(expiresAt * 1e3);
100020
100582
  return {
100021
- challenge: `${toSign}.${createHmac("sha256", input.signingSecret).update(toSign).digest("base64url")}`,
100022
- expiresAt: (/* @__PURE__ */ new Date(expiresAt * 1e3)).toISOString()
100583
+ challenge: `${toSign}.${signature}`,
100584
+ expiresAt: expiresAtDate.toISOString()
100023
100585
  };
100024
100586
  }
100025
100587
  function verifyChallenge(input) {
@@ -100072,11 +100634,13 @@ function signToken(input) {
100072
100634
  alg: "HS256",
100073
100635
  typ: "JWT"
100074
100636
  }))}.${base64UrlEncode2(JSON.stringify(payload))}`;
100637
+ const signature = createHmac("sha256", input.signingSecret).update(toSign).digest("base64url");
100638
+ const expiresAtDate = /* @__PURE__ */ new Date(expiresAt * 1e3);
100075
100639
  return {
100076
- token: `${toSign}.${createHmac("sha256", input.signingSecret).update(toSign).digest("base64url")}`,
100640
+ token: `${toSign}.${signature}`,
100077
100641
  datalakeId: input.datalakeId,
100078
100642
  role: input.role,
100079
- expiresAt: (/* @__PURE__ */ new Date(expiresAt * 1e3)).toISOString(),
100643
+ expiresAt: expiresAtDate.toISOString(),
100080
100644
  url: input.url
100081
100645
  };
100082
100646
  }
@@ -100124,6 +100688,22 @@ function verifyToken(input) {
100124
100688
  if (payload.iat > now + 60) throw new TokenVerificationError("not_yet_valid", "Token issued in the future");
100125
100689
  return payload;
100126
100690
  }
100691
+ function validateDatalakeAdmissionConfig(config) {
100692
+ if (config.schemaPolicy !== void 0 && config.schemaPolicy !== "allowlist") throw new TypeError("schemaPolicy must be allowlist when supplied");
100693
+ if (config.schemaPolicy === "allowlist" && !Array.isArray(config.allowedSchemas)) throw new TypeError("allowedSchemas must be explicitly supplied in allowlist mode; use [] to accept no payloads");
100694
+ for (const [name, schemas] of [["allowedSchemas", config.allowedSchemas], ["disallowedSchemas", config.disallowedSchemas]]) if (schemas !== void 0 && (!Array.isArray(schemas) || schemas.some((schema) => typeof schema !== "string" || schema.length === 0))) throw new TypeError(`${name} must be an array of non-empty schema strings`);
100695
+ if (config.maxPayloadBytes !== void 0 || config.schemaPolicy === "allowlist") requireByteLimit(config.maxPayloadBytes, "maxPayloadBytes");
100696
+ if (config.schemaMaxPayloadBytes !== void 0) {
100697
+ if (!config.schemaMaxPayloadBytes || typeof config.schemaMaxPayloadBytes !== "object" || Array.isArray(config.schemaMaxPayloadBytes)) throw new TypeError("schemaMaxPayloadBytes must map schema strings to positive byte limits");
100698
+ for (const [schema, limit] of Object.entries(config.schemaMaxPayloadBytes)) {
100699
+ if (schema.length === 0) throw new TypeError("schemaMaxPayloadBytes keys must be non-empty schema strings");
100700
+ requireByteLimit(limit, `schemaMaxPayloadBytes[${schema}]`);
100701
+ }
100702
+ }
100703
+ }
100704
+ function requireByteLimit(value, field) {
100705
+ if (!Number.isSafeInteger(value) || (value ?? 0) <= 0) throw new TypeError(`${field} must be a finite positive safe integer byte count`);
100706
+ }
100127
100707
  var PUBLIC_PRINCIPAL = "public";
100128
100708
  function isPublicPrincipal(principal) {
100129
100709
  return principal === PUBLIC_PRINCIPAL;
@@ -101477,7 +102057,7 @@ var require_avvio = /* @__PURE__ */ __commonJSMin(((exports, module) => {
101477
102057
  module.exports = Boot;
101478
102058
  }));
101479
102059
  //#endregion
101480
- //#region ../../node_modules/.pnpm/fastify@5.12.1/node_modules/fastify/lib/symbols.js
102060
+ //#region ../../node_modules/.pnpm/fastify@5.12.3/node_modules/fastify/lib/symbols.js
101481
102061
  var require_symbols$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
101482
102062
  module.exports = {
101483
102063
  kAvvioBoot: Symbol("fastify.avvioBoot"),
@@ -101709,7 +102289,7 @@ var require_process_warning$1 = /* @__PURE__ */ __commonJSMin(((exports, module)
101709
102289
  module.exports.processWarning = out;
101710
102290
  }));
101711
102291
  //#endregion
101712
- //#region ../../node_modules/.pnpm/fastify@5.12.1/node_modules/fastify/lib/warnings.js
102292
+ //#region ../../node_modules/.pnpm/fastify@5.12.3/node_modules/fastify/lib/warnings.js
101713
102293
  var require_warnings = /* @__PURE__ */ __commonJSMin(((exports, module) => {
101714
102294
  const { createWarning } = require_process_warning$1();
101715
102295
  module.exports = {
@@ -101737,6 +102317,12 @@ var require_warnings = /* @__PURE__ */ __commonJSMin(((exports, module) => {
101737
102317
  message: "You are using /%s/ Content-Type which may be vulnerable to CORS attack. Please make sure your RegExp start with \"^\" or include \";?\" to proper detection of the essence MIME type.",
101738
102318
  unlimited: true
101739
102319
  }),
102320
+ FSTSEC002: createWarning({
102321
+ name: "FastifySecurity",
102322
+ code: "FSTSEC002",
102323
+ message: "The headers schema for %s: %s references an external $ref (%s) that is not case-normalized. Header names in the referenced schema keep their original case and will not match the lowercased request headers, so case-insensitive assertions such as required and dependencies may not apply. Inline the header schema instead of referencing it with an external $ref.",
102324
+ unlimited: true
102325
+ }),
101740
102326
  FSTDEP022: createWarning({
101741
102327
  name: "FastifyWarning",
101742
102328
  code: "FSTDEP022",
@@ -101764,7 +102350,7 @@ var require_warnings = /* @__PURE__ */ __commonJSMin(((exports, module) => {
101764
102350
  };
101765
102351
  }));
101766
102352
  //#endregion
101767
- //#region ../../node_modules/.pnpm/fastify@5.12.1/node_modules/fastify/lib/errors.js
102353
+ //#region ../../node_modules/.pnpm/fastify@5.12.3/node_modules/fastify/lib/errors.js
101768
102354
  var require_errors$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
101769
102355
  const createError = require_error$1();
101770
102356
  const codes = {
@@ -101918,7 +102504,7 @@ var require_errors$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
101918
102504
  };
101919
102505
  }));
101920
102506
  //#endregion
101921
- //#region ../../node_modules/.pnpm/fastify@5.12.1/node_modules/fastify/lib/hooks.js
102507
+ //#region ../../node_modules/.pnpm/fastify@5.12.3/node_modules/fastify/lib/hooks.js
101922
102508
  var require_hooks = /* @__PURE__ */ __commonJSMin(((exports, module) => {
101923
102509
  const applicationHooks = [
101924
102510
  "onRoute",
@@ -102238,7 +102824,7 @@ var require_hooks = /* @__PURE__ */ __commonJSMin(((exports, module) => {
102238
102824
  };
102239
102825
  }));
102240
102826
  //#endregion
102241
- //#region ../../node_modules/.pnpm/fastify@5.12.1/node_modules/fastify/lib/noop-set.js
102827
+ //#region ../../node_modules/.pnpm/fastify@5.12.3/node_modules/fastify/lib/noop-set.js
102242
102828
  var require_noop_set = /* @__PURE__ */ __commonJSMin(((exports, module) => {
102243
102829
  module.exports = function noopSet() {
102244
102830
  return {
@@ -102252,7 +102838,7 @@ var require_noop_set = /* @__PURE__ */ __commonJSMin(((exports, module) => {
102252
102838
  };
102253
102839
  }));
102254
102840
  //#endregion
102255
- //#region ../../node_modules/.pnpm/fastify@5.12.1/node_modules/fastify/lib/promise.js
102841
+ //#region ../../node_modules/.pnpm/fastify@5.12.3/node_modules/fastify/lib/promise.js
102256
102842
  var require_promise = /* @__PURE__ */ __commonJSMin(((exports, module) => {
102257
102843
  const { kTestInternals } = require_symbols$1();
102258
102844
  function withResolvers() {
@@ -102272,7 +102858,7 @@ var require_promise = /* @__PURE__ */ __commonJSMin(((exports, module) => {
102272
102858
  };
102273
102859
  }));
102274
102860
  //#endregion
102275
- //#region ../../node_modules/.pnpm/fastify@5.12.1/node_modules/fastify/lib/server.js
102861
+ //#region ../../node_modules/.pnpm/fastify@5.12.3/node_modules/fastify/lib/server.js
102276
102862
  var require_server = /* @__PURE__ */ __commonJSMin(((exports, module) => {
102277
102863
  const http$3 = __require$1("node:http");
102278
102864
  const https$1 = __require$1("node:https");
@@ -102549,7 +103135,7 @@ var require_server = /* @__PURE__ */ __commonJSMin(((exports, module) => {
102549
103135
  }
102550
103136
  }));
102551
103137
  //#endregion
102552
- //#region ../../node_modules/.pnpm/fastify@5.12.1/node_modules/fastify/lib/error-status.js
103138
+ //#region ../../node_modules/.pnpm/fastify@5.12.3/node_modules/fastify/lib/error-status.js
102553
103139
  var require_error_status = /* @__PURE__ */ __commonJSMin(((exports, module) => {
102554
103140
  const { kReplyHasStatusCode } = require_symbols$1();
102555
103141
  function setErrorStatusCode(reply, err) {
@@ -102561,7 +103147,7 @@ var require_error_status = /* @__PURE__ */ __commonJSMin(((exports, module) => {
102561
103147
  module.exports = { setErrorStatusCode };
102562
103148
  }));
102563
103149
  //#endregion
102564
- //#region ../../node_modules/.pnpm/fastify@5.12.1/node_modules/fastify/lib/wrap-thenable.js
103150
+ //#region ../../node_modules/.pnpm/fastify@5.12.3/node_modules/fastify/lib/wrap-thenable.js
102565
103151
  var require_wrap_thenable = /* @__PURE__ */ __commonJSMin(((exports, module) => {
102566
103152
  const { kReplyIsError, kReplyHijacked } = require_symbols$1();
102567
103153
  const { setErrorStatusCode } = require_error_status();
@@ -102605,12 +103191,12 @@ var require_wrap_thenable = /* @__PURE__ */ __commonJSMin(((exports, module) =>
102605
103191
  module.exports = wrapThenable;
102606
103192
  }));
102607
103193
  //#endregion
102608
- //#region ../../node_modules/.pnpm/fastify@5.12.1/node_modules/fastify/lib/validation.js
103194
+ //#region ../../node_modules/.pnpm/fastify@5.12.3/node_modules/fastify/lib/validation.js
102609
103195
  var require_validation = /* @__PURE__ */ __commonJSMin(((exports, module) => {
102610
103196
  const { kSchemaHeaders: headersSchema, kSchemaParams: paramsSchema, kSchemaQuerystring: querystringSchema, kSchemaBody: bodySchema, kSchemaResponse: responseSchema } = require_symbols$1();
102611
103197
  const scChecker = /^[1-5](?:\d{2}|xx)$|^default$/;
102612
103198
  const { FST_ERR_SCH_RESPONSE_SCHEMA_NOT_NESTED_2XX } = require_errors$1();
102613
- const { FSTWRN001 } = require_warnings();
103199
+ const { FSTWRN001, FSTSEC002 } = require_warnings();
102614
103200
  function compileSchemasForSerialization(context, compile) {
102615
103201
  if (!context.schema || !context.schema.response) return;
102616
103202
  const { method, url } = context.config || {};
@@ -102640,38 +103226,135 @@ var require_validation = /* @__PURE__ */ __commonJSMin(((exports, module) => {
102640
103226
  return acc;
102641
103227
  }, {});
102642
103228
  }
103229
+ function lowerCaseHeadersSchema(schema) {
103230
+ if (Array.isArray(schema)) return schema.map(lowerCaseHeadersSchema);
103231
+ if (schema === null || typeof schema !== "object") return schema;
103232
+ const result = {};
103233
+ for (const key of Object.keys(schema)) {
103234
+ const value = schema[key];
103235
+ switch (key) {
103236
+ case "properties": {
103237
+ if (value === null || typeof value !== "object") {
103238
+ result.properties = value;
103239
+ break;
103240
+ }
103241
+ const normalized = {};
103242
+ for (const prop of Object.keys(value)) normalized[prop.toLowerCase()] = lowerCaseHeadersSchema(value[prop]);
103243
+ result.properties = normalized;
103244
+ break;
103245
+ }
103246
+ case "required":
103247
+ result.required = Array.isArray(value) ? value.map((name) => name.toLowerCase()) : value;
103248
+ break;
103249
+ case "dependencies": {
103250
+ if (value === null || typeof value !== "object") {
103251
+ result.dependencies = value;
103252
+ break;
103253
+ }
103254
+ const normalized = {};
103255
+ for (const dep of Object.keys(value)) {
103256
+ const depValue = value[dep];
103257
+ if (Array.isArray(depValue)) normalized[dep.toLowerCase()] = depValue.map((name) => name.toLowerCase());
103258
+ else normalized[dep.toLowerCase()] = lowerCaseHeadersSchema(depValue);
103259
+ }
103260
+ result.dependencies = normalized;
103261
+ break;
103262
+ }
103263
+ case "dependentSchemas": {
103264
+ if (value === null || typeof value !== "object") {
103265
+ result.dependentSchemas = value;
103266
+ break;
103267
+ }
103268
+ const normalized = {};
103269
+ for (const dep of Object.keys(value)) normalized[dep.toLowerCase()] = lowerCaseHeadersSchema(value[dep]);
103270
+ result.dependentSchemas = normalized;
103271
+ break;
103272
+ }
103273
+ case "dependentRequired": {
103274
+ if (value === null || typeof value !== "object") {
103275
+ result.dependentRequired = value;
103276
+ break;
103277
+ }
103278
+ const normalized = {};
103279
+ for (const dep of Object.keys(value)) normalized[dep.toLowerCase()] = value[dep].map((name) => name.toLowerCase());
103280
+ result.dependentRequired = normalized;
103281
+ break;
103282
+ }
103283
+ case "allOf":
103284
+ case "anyOf":
103285
+ case "oneOf":
103286
+ case "not":
103287
+ case "if":
103288
+ case "then":
103289
+ case "else":
103290
+ case "items":
103291
+ case "additionalItems":
103292
+ case "additionalProperties":
103293
+ case "unevaluatedItems":
103294
+ case "unevaluatedProperties":
103295
+ case "contains":
103296
+ case "propertyNames":
103297
+ case "contentSchema":
103298
+ result[key] = lowerCaseHeadersSchema(value);
103299
+ break;
103300
+ case "definitions":
103301
+ case "$defs":
103302
+ case "patternProperties": {
103303
+ if (value === null || typeof value !== "object") {
103304
+ result[key] = value;
103305
+ break;
103306
+ }
103307
+ const normalized = {};
103308
+ for (const k of Object.keys(value)) normalized[k] = lowerCaseHeadersSchema(value[k]);
103309
+ result[key] = normalized;
103310
+ break;
103311
+ }
103312
+ default: result[key] = value;
103313
+ }
103314
+ }
103315
+ return result;
103316
+ }
103317
+ function findExternalHeaderRef(schema) {
103318
+ if (Array.isArray(schema)) {
103319
+ for (const item of schema) {
103320
+ const ref = findExternalHeaderRef(item);
103321
+ if (ref !== void 0) return ref;
103322
+ }
103323
+ return;
103324
+ }
103325
+ if (schema === null || typeof schema !== "object") return;
103326
+ if (typeof schema.$ref === "string" && schema.$ref[0] !== "#") return schema.$ref;
103327
+ for (const key of Object.keys(schema)) {
103328
+ const ref = findExternalHeaderRef(schema[key]);
103329
+ if (ref !== void 0) return ref;
103330
+ }
103331
+ }
102643
103332
  function compileSchemasForValidation(context, compile, isCustom) {
102644
103333
  const { schema } = context;
102645
103334
  if (!schema) return;
102646
103335
  const { method, url } = context.config || {};
102647
103336
  const headers = schema.headers;
102648
- if (headers && (isCustom || Object.getPrototypeOf(headers) !== Object.prototype)) context[headersSchema] = compile({
102649
- schema: headers,
102650
- method,
102651
- url,
102652
- httpPart: "headers"
102653
- });
102654
- else if (headers) {
102655
- const headersSchemaLowerCase = {};
102656
- Object.keys(headers).forEach((k) => {
102657
- headersSchemaLowerCase[k] = headers[k];
102658
- });
102659
- if (headersSchemaLowerCase.required instanceof Array) headersSchemaLowerCase.required = headersSchemaLowerCase.required.map((h) => h.toLowerCase());
102660
- if (headers.properties) {
102661
- headersSchemaLowerCase.properties = {};
102662
- Object.keys(headers.properties).forEach((k) => {
102663
- headersSchemaLowerCase.properties[k.toLowerCase()] = headers.properties[k];
102664
- });
102665
- }
102666
- context[headersSchema] = compile({
102667
- schema: headersSchemaLowerCase,
103337
+ if (headers !== void 0) {
103338
+ if (isCustom || typeof headers !== "object" || headers === null || Object.getPrototypeOf(headers) !== Object.prototype) context[headersSchema] = compile({
103339
+ schema: headers,
102668
103340
  method,
102669
103341
  url,
102670
103342
  httpPart: "headers"
102671
103343
  });
103344
+ else {
103345
+ const headersSchemaLowerCase = lowerCaseHeadersSchema(headers);
103346
+ const externalRef = findExternalHeaderRef(headers);
103347
+ if (externalRef !== void 0) FSTSEC002(method, url, externalRef);
103348
+ context[headersSchema] = compile({
103349
+ schema: headersSchemaLowerCase,
103350
+ method,
103351
+ url,
103352
+ httpPart: "headers"
103353
+ });
103354
+ }
102672
103355
  } else if (Object.hasOwn(schema, "headers")) FSTWRN001("headers", method, url);
102673
- if (schema.body) {
102674
- const contentProperty = schema.body.content;
103356
+ if (schema.body !== void 0) {
103357
+ const contentProperty = schema.body !== null && typeof schema.body === "object" ? schema.body.content : void 0;
102675
103358
  if (contentProperty) {
102676
103359
  const contentTypeSchemas = {};
102677
103360
  for (const contentType of Object.keys(contentProperty)) {
@@ -102692,14 +103375,14 @@ var require_validation = /* @__PURE__ */ __commonJSMin(((exports, module) => {
102692
103375
  httpPart: "body"
102693
103376
  });
102694
103377
  } else if (Object.hasOwn(schema, "body")) FSTWRN001("body", method, url);
102695
- if (schema.querystring) context[querystringSchema] = compile({
103378
+ if (schema.querystring !== void 0) context[querystringSchema] = compile({
102696
103379
  schema: schema.querystring,
102697
103380
  method,
102698
103381
  url,
102699
103382
  httpPart: "querystring"
102700
103383
  });
102701
103384
  else if (Object.hasOwn(schema, "querystring")) FSTWRN001("querystring", method, url);
102702
- if (schema.params) context[paramsSchema] = compile({
103385
+ if (schema.params !== void 0) context[paramsSchema] = compile({
102703
103386
  schema: schema.params,
102704
103387
  method,
102705
103388
  url,
@@ -102722,7 +103405,7 @@ var require_validation = /* @__PURE__ */ __commonJSMin(((exports, module) => {
102722
103405
  return err;
102723
103406
  }
102724
103407
  if (ret && typeof ret.then === "function") return ret.then((res) => {
102725
- return answer(res);
103408
+ return res === false ? validatorFunction.errors : false;
102726
103409
  }).catch((err) => {
102727
103410
  return err;
102728
103411
  });
@@ -103401,7 +104084,7 @@ var require_toad_cache = /* @__PURE__ */ __commonJSMin(((exports) => {
103401
104084
  exports.LruObjectHitStatistics = LruObjectHitStatistics;
103402
104085
  }));
103403
104086
  //#endregion
103404
- //#region ../../node_modules/.pnpm/fastify@5.12.1/node_modules/fastify/lib/content-type.js
104087
+ //#region ../../node_modules/.pnpm/fastify@5.12.3/node_modules/fastify/lib/content-type.js
103405
104088
  var require_content_type = /* @__PURE__ */ __commonJSMin(((exports, module) => {
103406
104089
  const { LruMap: Lru } = require_toad_cache();
103407
104090
  /**
@@ -103571,7 +104254,7 @@ var require_content_type = /* @__PURE__ */ __commonJSMin(((exports, module) => {
103571
104254
  };
103572
104255
  }));
103573
104256
  //#endregion
103574
- //#region ../../node_modules/.pnpm/fastify@5.12.1/node_modules/fastify/lib/handle-request.js
104257
+ //#region ../../node_modules/.pnpm/fastify@5.12.3/node_modules/fastify/lib/handle-request.js
103575
104258
  var require_handle_request = /* @__PURE__ */ __commonJSMin(((exports, module) => {
103576
104259
  const diagnostics$1 = __require$1("node:diagnostics_channel");
103577
104260
  const wrapThenable = require_wrap_thenable();
@@ -103723,7 +104406,7 @@ var require_handle_request = /* @__PURE__ */ __commonJSMin(((exports, module) =>
103723
104406
  };
103724
104407
  }));
103725
104408
  //#endregion
103726
- //#region ../../node_modules/.pnpm/fastify@5.12.1/node_modules/fastify/lib/config-validator.js
104409
+ //#region ../../node_modules/.pnpm/fastify@5.12.3/node_modules/fastify/lib/config-validator.js
103727
104410
  /* c8 ignore start */
103728
104411
  var require_config_validator$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
103729
104412
  module.exports = validate10;
@@ -105165,7 +105848,7 @@ var require_rfdc = /* @__PURE__ */ __commonJSMin(((exports, module) => {
105165
105848
  }
105166
105849
  }));
105167
105850
  //#endregion
105168
- //#region ../../node_modules/.pnpm/fastify@5.12.1/node_modules/fastify/lib/initial-config-validation.js
105851
+ //#region ../../node_modules/.pnpm/fastify@5.12.3/node_modules/fastify/lib/initial-config-validation.js
105169
105852
  var require_initial_config_validation = /* @__PURE__ */ __commonJSMin(((exports, module) => {
105170
105853
  const validate = require_config_validator$1();
105171
105854
  const deepClone = require_rfdc()({
@@ -105196,7 +105879,7 @@ var require_initial_config_validation = /* @__PURE__ */ __commonJSMin(((exports,
105196
105879
  module.exports.utils = { deepFreezeObject };
105197
105880
  }));
105198
105881
  //#endregion
105199
- //#region ../../node_modules/.pnpm/fastify@5.12.1/node_modules/fastify/lib/log-controller.js
105882
+ //#region ../../node_modules/.pnpm/fastify@5.12.3/node_modules/fastify/lib/log-controller.js
105200
105883
  var require_log_controller = /* @__PURE__ */ __commonJSMin(((exports, module) => {
105201
105884
  const { defaultInitOptions } = require_initial_config_validation();
105202
105885
  /**
@@ -108929,7 +109612,7 @@ var require_pino = /* @__PURE__ */ __commonJSMin(((exports, module) => {
108929
109612
  module.exports.pino = pino;
108930
109613
  }));
108931
109614
  //#endregion
108932
- //#region ../../node_modules/.pnpm/fastify@5.12.1/node_modules/fastify/lib/logger-pino.js
109615
+ //#region ../../node_modules/.pnpm/fastify@5.12.3/node_modules/fastify/lib/logger-pino.js
108933
109616
  var require_logger_pino = /* @__PURE__ */ __commonJSMin(((exports, module) => {
108934
109617
  /**
108935
109618
  * Code imported from `pino-http`
@@ -108979,7 +109662,7 @@ var require_logger_pino = /* @__PURE__ */ __commonJSMin(((exports, module) => {
108979
109662
  };
108980
109663
  }));
108981
109664
  //#endregion
108982
- //#region ../../node_modules/.pnpm/fastify@5.12.1/node_modules/fastify/lib/logger-factory.js
109665
+ //#region ../../node_modules/.pnpm/fastify@5.12.3/node_modules/fastify/lib/logger-factory.js
108983
109666
  var require_logger_factory = /* @__PURE__ */ __commonJSMin(((exports, module) => {
108984
109667
  const { performance: performance$1 } = __require$1("node:perf_hooks");
108985
109668
  const { FST_ERR_LOG_LOGGER_AND_LOGGER_INSTANCE_PROVIDED, FST_ERR_LOG_INVALID_LOGGER_CONFIG, FST_ERR_LOG_INVALID_LOGGER_INSTANCE, FST_ERR_LOG_INVALID_LOGGER, FST_ERR_LOG_INVALID_LOG_CONTROLLER } = require_errors$1();
@@ -109098,7 +109781,7 @@ var require_logger_factory = /* @__PURE__ */ __commonJSMin(((exports, module) =>
109098
109781
  };
109099
109782
  }));
109100
109783
  //#endregion
109101
- //#region ../../node_modules/.pnpm/fastify@5.12.1/node_modules/fastify/lib/schemas.js
109784
+ //#region ../../node_modules/.pnpm/fastify@5.12.3/node_modules/fastify/lib/schemas.js
109102
109785
  var require_schemas = /* @__PURE__ */ __commonJSMin(((exports, module) => {
109103
109786
  const fastClone = require_rfdc()({
109104
109787
  circles: false,
@@ -109142,8 +109825,8 @@ var require_schemas = /* @__PURE__ */ __commonJSMin(((exports, module) => {
109142
109825
  }
109143
109826
  function normalizeSchema(routeSchemas, serverOptions) {
109144
109827
  if (routeSchemas[kSchemaVisited]) return routeSchemas;
109145
- if (routeSchemas.query) {
109146
- if (routeSchemas.querystring) throw new FST_ERR_SCH_DUPLICATE("querystring");
109828
+ if (routeSchemas.query !== void 0) {
109829
+ if (routeSchemas.querystring !== void 0) throw new FST_ERR_SCH_DUPLICATE("querystring");
109147
109830
  routeSchemas.querystring = routeSchemas.query;
109148
109831
  }
109149
109832
  generateFluentSchema(routeSchemas);
@@ -109328,7 +110011,7 @@ var require_serializer$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
109328
110011
  };
109329
110012
  }));
109330
110013
  //#endregion
109331
- //#region ../../node_modules/.pnpm/fastify@5.12.1/node_modules/fastify/lib/error-serializer.js
110014
+ //#region ../../node_modules/.pnpm/fastify@5.12.3/node_modules/fastify/lib/error-serializer.js
109332
110015
  /* c8 ignore start */
109333
110016
  var require_error_serializer = /* @__PURE__ */ __commonJSMin(((exports, module) => {
109334
110017
  module.exports = function anonymous(validator, serializer) {
@@ -109393,7 +110076,7 @@ var require_error_serializer = /* @__PURE__ */ __commonJSMin(((exports, module)
109393
110076
  }));
109394
110077
  /* c8 ignore stop */
109395
110078
  //#endregion
109396
- //#region ../../node_modules/.pnpm/fastify@5.12.1/node_modules/fastify/lib/error-handler.js
110079
+ //#region ../../node_modules/.pnpm/fastify@5.12.3/node_modules/fastify/lib/error-handler.js
109397
110080
  var require_error_handler = /* @__PURE__ */ __commonJSMin(((exports, module) => {
109398
110081
  const statusCodes = __require$1("node:http").STATUS_CODES;
109399
110082
  const wrapThenable = require_wrap_thenable();
@@ -109501,7 +110184,7 @@ var require_error_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
109501
110184
  };
109502
110185
  }));
109503
110186
  //#endregion
109504
- //#region ../../node_modules/.pnpm/fastify@5.12.1/node_modules/fastify/lib/decorate.js
110187
+ //#region ../../node_modules/.pnpm/fastify@5.12.3/node_modules/fastify/lib/decorate.js
109505
110188
  var require_decorate = /* @__PURE__ */ __commonJSMin(((exports, module) => {
109506
110189
  const { kReply, kRequest, kState, kHasBeenDecorated } = require_symbols$1();
109507
110190
  const { FST_ERR_DEC_ALREADY_PRESENT, FST_ERR_DEC_MISSING_DEPENDENCY, FST_ERR_DEC_AFTER_START, FST_ERR_DEC_REFERENCE_TYPE, FST_ERR_DEC_DEPENDENCY_INVALID_TYPE, FST_ERR_DEC_UNDECLARED } = require_errors$1();
@@ -109600,7 +110283,7 @@ var require_decorate = /* @__PURE__ */ __commonJSMin(((exports, module) => {
109600
110283
  };
109601
110284
  }));
109602
110285
  //#endregion
109603
- //#region ../../node_modules/.pnpm/fastify@5.12.1/node_modules/fastify/lib/reply.js
110286
+ //#region ../../node_modules/.pnpm/fastify@5.12.3/node_modules/fastify/lib/reply.js
109604
110287
  var require_reply = /* @__PURE__ */ __commonJSMin(((exports, module) => {
109605
110288
  const eos = __require$1("node:stream").finished;
109606
110289
  const { kFourOhFourContext, kReplyErrorHandlerCalled, kReplyHijacked, kReplyStartTime, kReplyEndTime, kReplySerializer, kReplySerializerDefault, kReplyIsError, kReplyHeaders, kReplyTrailers, kReplyHasStatusCode, kReplyIsRunningOnErrorHook, kReplyNextErrorHandler, kSchemaResponse, kReplyCacheSerializeFns, kSchemaController, kOptions, kRouteContext, kTimeoutTimer, kOnAbort, kRequestSignal, kLogController } = require_symbols$1();
@@ -110659,8 +111342,8 @@ var require_ipaddr = /* @__PURE__ */ __commonJSMin(((exports, module) => {
110659
111342
  if (value > 4294967295 || value < 0) throw new Error("ipaddr: address outside defined range");
110660
111343
  return (function() {
110661
111344
  const results = [];
110662
- let shift;
110663
- for (shift = 0; shift <= 24; shift += 8) results.push(value >> shift & 255);
111345
+ let shift = 0;
111346
+ for (; shift <= 24; shift += 8) results.push(value >> shift & 255);
110664
111347
  return results;
110665
111348
  })().reverse();
110666
111349
  } else if (match = string.match(ipv4Regexes.twoOctet)) return (function() {
@@ -111468,7 +112151,7 @@ var require_proxy_addr = /* @__PURE__ */ __commonJSMin(((exports, module) => {
111468
112151
  }
111469
112152
  }));
111470
112153
  //#endregion
111471
- //#region ../../node_modules/.pnpm/fastify@5.12.1/node_modules/fastify/lib/request.js
112154
+ //#region ../../node_modules/.pnpm/fastify@5.12.3/node_modules/fastify/lib/request.js
111472
112155
  var require_request$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
111473
112156
  const proxyAddr = require_proxy_addr();
111474
112157
  const { kHasBeenDecorated, kSchemaBody, kSchemaHeaders, kSchemaParams, kSchemaQuerystring, kSchemaController, kOptions, kRequestCacheValidateFns, kRequestContentType, kRouteContext, kRequestOriginalUrl, kRequestSignal, kOnAbort } = require_symbols$1();
@@ -111714,7 +112397,7 @@ var require_request$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
111714
112397
  module.exports.buildRequest = buildRequest;
111715
112398
  }));
111716
112399
  //#endregion
111717
- //#region ../../node_modules/.pnpm/fastify@5.12.1/node_modules/fastify/lib/context.js
112400
+ //#region ../../node_modules/.pnpm/fastify@5.12.3/node_modules/fastify/lib/context.js
111718
112401
  var require_context = /* @__PURE__ */ __commonJSMin(((exports, module) => {
111719
112402
  const { kFourOhFourContext, kReplySerializerDefault, kSchemaErrorFormatter, kErrorHandler, kChildLoggerFactory, kReply, kRequest, kBodyLimit, kLogLevel, kContentTypeParser, kRouteByFastify, kRequestCacheValidateFns, kReplyCacheSerializeFns, kHandlerTimeout } = require_symbols$1();
111720
112403
  function Context({ schema, handler, config, childLoggerFactory, errorHandler, bodyLimit, logLevel, logSerializers, attachValidation, validatorCompiler, serializerCompiler, replySerializer, schemaErrorFormatter, exposeHeadRoute, prefixTrailingSlash, server, isFastify, handlerTimeout }) {
@@ -111878,7 +112561,7 @@ var require_secure_json_parse = /* @__PURE__ */ __commonJSMin(((exports, module)
111878
112561
  module.exports.scan = filter;
111879
112562
  }));
111880
112563
  //#endregion
111881
- //#region ../../node_modules/.pnpm/fastify@5.12.1/node_modules/fastify/lib/content-type-parser.js
112564
+ //#region ../../node_modules/.pnpm/fastify@5.12.3/node_modules/fastify/lib/content-type-parser.js
111882
112565
  var require_content_type_parser = /* @__PURE__ */ __commonJSMin(((exports, module) => {
111883
112566
  const { AsyncResource } = __require$1("node:async_hooks");
111884
112567
  const { FifoMap: Fifo } = require_toad_cache();
@@ -118386,7 +119069,7 @@ var require_fast_json_stringify_compiler = /* @__PURE__ */ __commonJSMin(((expor
118386
119069
  module.exports.StandaloneSerializer = StandaloneSerializer;
118387
119070
  }));
118388
119071
  //#endregion
118389
- //#region ../../node_modules/.pnpm/fastify@5.12.1/node_modules/fastify/lib/schema-controller.js
119072
+ //#region ../../node_modules/.pnpm/fastify@5.12.3/node_modules/fastify/lib/schema-controller.js
118390
119073
  var require_schema_controller = /* @__PURE__ */ __commonJSMin(((exports, module) => {
118391
119074
  const { buildSchemas } = require_schemas();
118392
119075
  /**
@@ -119881,7 +120564,7 @@ var require_semver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
119881
120564
  };
119882
120565
  }));
119883
120566
  //#endregion
119884
- //#region ../../node_modules/.pnpm/fastify@5.12.1/node_modules/fastify/lib/plugin-utils.js
120567
+ //#region ../../node_modules/.pnpm/fastify@5.12.3/node_modules/fastify/lib/plugin-utils.js
119885
120568
  var require_plugin_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
119886
120569
  const semver = require_semver();
119887
120570
  const assert$6 = __require$1("node:assert");
@@ -119989,7 +120672,7 @@ var require_plugin_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
119989
120672
  };
119990
120673
  }));
119991
120674
  //#endregion
119992
- //#region ../../node_modules/.pnpm/fastify@5.12.1/node_modules/fastify/lib/req-id-gen-factory.js
120675
+ //#region ../../node_modules/.pnpm/fastify@5.12.3/node_modules/fastify/lib/req-id-gen-factory.js
119993
120676
  var require_req_id_gen_factory = /* @__PURE__ */ __commonJSMin(((exports, module) => {
119994
120677
  const { kGenReqId } = require_symbols$1();
119995
120678
  /**
@@ -122932,7 +123615,7 @@ var require_find_my_way = /* @__PURE__ */ __commonJSMin(((exports, module) => {
122932
123615
  }
122933
123616
  }));
122934
123617
  //#endregion
122935
- //#region ../../node_modules/.pnpm/fastify@5.12.1/node_modules/fastify/lib/head-route.js
123618
+ //#region ../../node_modules/.pnpm/fastify@5.12.3/node_modules/fastify/lib/head-route.js
122936
123619
  var require_head_route = /* @__PURE__ */ __commonJSMin(((exports, module) => {
122937
123620
  function headRouteOnSendHandler(req, reply, payload, done) {
122938
123621
  if (payload === void 0) {
@@ -122966,7 +123649,7 @@ var require_head_route = /* @__PURE__ */ __commonJSMin(((exports, module) => {
122966
123649
  module.exports = { parseHeadOnSendHandlers };
122967
123650
  }));
122968
123651
  //#endregion
122969
- //#region ../../node_modules/.pnpm/fastify@5.12.1/node_modules/fastify/lib/route.js
123652
+ //#region ../../node_modules/.pnpm/fastify@5.12.3/node_modules/fastify/lib/route.js
122970
123653
  var require_route = /* @__PURE__ */ __commonJSMin(((exports, module) => {
122971
123654
  const FindMyWay = require_find_my_way();
122972
123655
  const Context = require_context();
@@ -123226,7 +123909,7 @@ var require_route = /* @__PURE__ */ __commonJSMin(((exports, module) => {
123226
123909
  if (opts.schema) {
123227
123910
  context.schema = normalizeSchema(context.schema, this.initialConfig);
123228
123911
  const schemaController = this[kSchemaController];
123229
- const hasValidationSchema = opts.schema.body || opts.schema.headers || opts.schema.querystring || opts.schema.params;
123912
+ const hasValidationSchema = opts.schema.body !== void 0 || opts.schema.headers !== void 0 || opts.schema.querystring !== void 0 || opts.schema.params !== void 0;
123230
123913
  if (!opts.validatorCompiler && hasValidationSchema) schemaController.setupValidator(this[kOptions]);
123231
123914
  try {
123232
123915
  const isCustom = typeof opts?.validatorCompiler === "function" || schemaController.isCustomValidatorCompiler;
@@ -123396,7 +124079,7 @@ var require_route = /* @__PURE__ */ __commonJSMin(((exports, module) => {
123396
124079
  };
123397
124080
  }));
123398
124081
  //#endregion
123399
- //#region ../../node_modules/.pnpm/fastify@5.12.1/node_modules/fastify/lib/four-oh-four.js
124082
+ //#region ../../node_modules/.pnpm/fastify@5.12.3/node_modules/fastify/lib/four-oh-four.js
123400
124083
  var require_four_oh_four = /* @__PURE__ */ __commonJSMin(((exports, module) => {
123401
124084
  const FindMyWay = require_find_my_way();
123402
124085
  const Reply = require_reply();
@@ -123418,11 +124101,10 @@ var require_four_oh_four = /* @__PURE__ */ __commonJSMin(((exports, module) => {
123418
124101
  function fourOhFour(options) {
123419
124102
  const { logger } = options;
123420
124103
  const router = FindMyWay({
123421
- onBadUrl: createRouteEventHandler(),
123422
- onMaxParamLength: createRouteEventHandler(),
124104
+ onBadUrl: options.routerOptions.onBadUrl,
124105
+ onMaxParamLength: options.routerOptions.onMaxParamLength,
123423
124106
  defaultRoute: fourOhFourFallBack
123424
124107
  });
123425
- let _routeEventHandler = null;
123426
124108
  return {
123427
124109
  router,
123428
124110
  setNotFoundHandler,
@@ -123432,8 +124114,6 @@ var require_four_oh_four = /* @__PURE__ */ __commonJSMin(((exports, module) => {
123432
124114
  function arrange404(instance) {
123433
124115
  instance[kFourOhFourLevelInstance] = instance;
123434
124116
  instance[kCanSetNotFoundHandler] = true;
123435
- router.onBadUrl = router.onBadUrl.bind(instance);
123436
- router.onMaxParamLength = router.onMaxParamLength.bind(instance);
123437
124117
  router.defaultRoute = router.defaultRoute.bind(instance);
123438
124118
  }
123439
124119
  function basic404(request, reply) {
@@ -123445,18 +124125,8 @@ var require_four_oh_four = /* @__PURE__ */ __commonJSMin(((exports, module) => {
123445
124125
  statusCode: 404
123446
124126
  });
123447
124127
  }
123448
- function createRouteEventHandler() {
123449
- return function onRouteEvent(path, req, res) {
123450
- const fourOhFourContext = this[kFourOhFourLevelInstance][kFourOhFourContext];
123451
- const id = getGenReqId(fourOhFourContext.server, req);
123452
- const childLogger = createChildLogger(fourOhFourContext, logger, req, id);
123453
- const request = new Request(id, null, req, null, childLogger, fourOhFourContext);
123454
- const reply = new Reply(res, request, childLogger);
123455
- _routeEventHandler(request, reply);
123456
- };
123457
- }
123458
124128
  function setContext(instance, context) {
123459
- const _404Context = Object.assign({}, instance[kFourOhFourContext]);
124129
+ const _404Context = Object.create(instance[kFourOhFourContext]);
123460
124130
  _404Context.onSend = context.onSend;
123461
124131
  context[kFourOhFourContext] = _404Context;
123462
124132
  }
@@ -123484,11 +124154,7 @@ var require_four_oh_four = /* @__PURE__ */ __commonJSMin(((exports, module) => {
123484
124154
  if (handler) {
123485
124155
  this[kFourOhFourLevelInstance][kCanSetNotFoundHandler] = false;
123486
124156
  handler = handler.bind(this);
123487
- _routeEventHandler = handler;
123488
- } else {
123489
- handler = basic404;
123490
- _routeEventHandler = basic404;
123491
- }
124157
+ } else handler = basic404;
123492
124158
  this.after((notHandledErr, done) => {
123493
124159
  _setNotFoundHandler.call(this, prefix, opts, handler, avvio, routeHandler);
123494
124160
  done(notHandledErr);
@@ -123532,7 +124198,7 @@ var require_four_oh_four = /* @__PURE__ */ __commonJSMin(((exports, module) => {
123532
124198
  module.exports = fourOhFour;
123533
124199
  }));
123534
124200
  //#endregion
123535
- //#region ../../node_modules/.pnpm/fastify@5.12.1/node_modules/fastify/lib/plugin-override.js
124201
+ //#region ../../node_modules/.pnpm/fastify@5.12.3/node_modules/fastify/lib/plugin-override.js
123536
124202
  var require_plugin_override = /* @__PURE__ */ __commonJSMin(((exports, module) => {
123537
124203
  const { kAvvioBoot, kChildren, kRoutePrefix, kLogLevel, kLogSerializers, kHooks, kSchemaController, kContentTypeParser, kReply, kRequest, kFourOhFour, kPluginNameChain, kErrorHandlerAlreadySet } = require_symbols$1();
123538
124204
  const Reply = require_reply();
@@ -125639,9 +126305,9 @@ var require_light_my_request = /* @__PURE__ */ __commonJSMin(((exports, module)
125639
126305
  module.exports.isInjection = isInjection;
125640
126306
  }));
125641
126307
  //#endregion
125642
- //#region ../../node_modules/.pnpm/fastify@5.12.1/node_modules/fastify/fastify.js
126308
+ //#region ../../node_modules/.pnpm/fastify@5.12.3/node_modules/fastify/fastify.js
125643
126309
  var require_fastify = /* @__PURE__ */ __commonJSMin(((exports, module) => {
125644
- const VERSION = "5.12.1";
126310
+ const VERSION = "5.12.2";
125645
126311
  const Avvio = require_avvio();
125646
126312
  const http$1 = __require$1("node:http");
125647
126313
  const diagnostics = __require$1("node:diagnostics_channel");
@@ -130758,6 +131424,11 @@ var TIER_IOPS_DEFAULTS = {
130758
131424
  archive: 0
130759
131425
  };
130760
131426
  function normalizeConfig(config) {
131427
+ try {
131428
+ validateDatalakeAdmissionConfig(config);
131429
+ } catch (error) {
131430
+ throw new HttpError("unprocessable", error instanceof Error ? error.message : "Invalid datalake admission policy");
131431
+ }
130761
131432
  const tier = config.tier;
130762
131433
  return {
130763
131434
  tier,
@@ -130767,6 +131438,9 @@ function normalizeConfig(config) {
130767
131438
  region: config.region ?? "us-west-2",
130768
131439
  allowedSchemas: config.allowedSchemas ?? [],
130769
131440
  disallowedSchemas: config.disallowedSchemas ?? [],
131441
+ schemaPolicy: config.schemaPolicy,
131442
+ maxPayloadBytes: config.maxPayloadBytes,
131443
+ schemaMaxPayloadBytes: config.schemaMaxPayloadBytes,
130770
131444
  rateLimits: config.rateLimits
130771
131445
  };
130772
131446
  }
@@ -130894,10 +131568,11 @@ function registerDatalakeRoutes(app, deps) {
130894
131568
  if (body.role !== "viewer" && body.role !== "runner") throw new HttpError("unprocessable", `Invalid role: ${String(body.role)}`);
130895
131569
  const principal = normalizePrincipal$1(body.principal);
130896
131570
  const descriptor = await requireDatalake(deps, request.userId, request.params.idOrName);
131571
+ const grantedAtDate = /* @__PURE__ */ new Date();
130897
131572
  return deps.store.upsertAcl(descriptor.id, {
130898
131573
  principal,
130899
131574
  role: body.role,
130900
- grantedAt: (/* @__PURE__ */ new Date()).toISOString(),
131575
+ grantedAt: grantedAtDate.toISOString(),
130901
131576
  grantedBy: request.userId
130902
131577
  });
130903
131578
  });
@@ -131003,7 +131678,7 @@ var InMemoryDatalakeStore = class {
131003
131678
  this.datalakes.set(descriptor.id, structuredClone(descriptor));
131004
131679
  }
131005
131680
  async listByOwner(ownerId) {
131006
- return [...this.datalakes.values()].filter((descriptor) => descriptor.ownerId === ownerId).map((descriptor) => structuredClone(descriptor));
131681
+ return this.datalakes.values().filter((descriptor) => descriptor.ownerId === ownerId).map((descriptor) => structuredClone(descriptor)).toArray();
131007
131682
  }
131008
131683
  async remove(id) {
131009
131684
  this.datalakes.delete(id);
@@ -131011,10 +131686,11 @@ var InMemoryDatalakeStore = class {
131011
131686
  async removeAcl(id, principal) {
131012
131687
  const existing = this.datalakes.get(id);
131013
131688
  if (!existing) throw new Error(`Datalake ${id} not found`);
131689
+ const updatedAtDate = /* @__PURE__ */ new Date();
131014
131690
  const next = {
131015
131691
  ...existing,
131016
131692
  acl: existing.acl.filter((candidate) => candidate.principal !== principal),
131017
- updatedAt: (/* @__PURE__ */ new Date()).toISOString()
131693
+ updatedAt: updatedAtDate.toISOString()
131018
131694
  };
131019
131695
  this.datalakes.set(id, next);
131020
131696
  return structuredClone(next);
@@ -131024,7 +131700,7 @@ var InMemoryDatalakeStore = class {
131024
131700
  * to materialize the full state for disk serialization.
131025
131701
  */
131026
131702
  snapshot() {
131027
- return [...this.datalakes.values()].map((descriptor) => structuredClone(descriptor));
131703
+ return this.datalakes.values().map((descriptor) => structuredClone(descriptor)).toArray();
131028
131704
  }
131029
131705
  async update(descriptor) {
131030
131706
  if (!this.datalakes.has(descriptor.id)) throw new Error(`Datalake ${descriptor.id} not found for update`);
@@ -131434,8 +132110,9 @@ function registerAudit(app, logger, principalHashSecret) {
131434
132110
  const { subject, authenticated } = resolveSubject$1(request, principalHashSecret);
131435
132111
  const datalakeId = extractDatalakeId$1(request);
131436
132112
  const datalakeSubject = datalakeId === void 0 ? void 0 : `datalake:${stableDatalakeHash(datalakeId, principalHashSecret)}`;
132113
+ const now = /* @__PURE__ */ new Date();
131437
132114
  logger.log({
131438
- time: (/* @__PURE__ */ new Date()).toISOString(),
132115
+ time: now.toISOString(),
131439
132116
  requestId: request.id,
131440
132117
  method: request.method,
131441
132118
  path,
@@ -131758,6 +132435,51 @@ function registerPlaneHealthRoute(app, version) {
131758
132435
  });
131759
132436
  }
131760
132437
  //#endregion
132438
+ //#region src/policy/applyInsertPolicy.ts
132439
+ /** Apply schema and uncompressed per-payload byte admission before storage. */
132440
+ async function applyInsertPolicy(descriptor, payloads) {
132441
+ const config = descriptor.config;
132442
+ validatePolicy(config);
132443
+ const allow = schemaSet(config.allowedSchemas, config.schemaPolicy === "allowlist");
132444
+ const deny = schemaSet(config.disallowedSchemas);
132445
+ if (!allow && !deny && config.maxPayloadBytes === void 0 && config.schemaMaxPayloadBytes === void 0) return {
132446
+ accepted: payloads,
132447
+ rejected: []
132448
+ };
132449
+ const accepted = [];
132450
+ const rejected = [];
132451
+ const stripped = PayloadBuilder.omitStorageMeta(payloads);
132452
+ const hashes = await PayloadBuilder.hashes(stripped);
132453
+ for (const [index, payload] of stripped.entries()) {
132454
+ const limit = byteLimit(config, payload.schema);
132455
+ if (typeof payload.schema !== "string" || allow && !allow.has(payload.schema) || deny?.has(payload.schema) || limit !== void 0 && Buffer.byteLength(JSON.stringify(payload), "utf8") > limit) {
132456
+ rejected.push(hashes[index]);
132457
+ continue;
132458
+ }
132459
+ accepted.push(payload);
132460
+ }
132461
+ return {
132462
+ accepted,
132463
+ rejected
132464
+ };
132465
+ }
132466
+ function validatePolicy(config) {
132467
+ try {
132468
+ validateDatalakeAdmissionConfig(config);
132469
+ } catch (error) {
132470
+ throw new PlaneHttpError("unprocessable", error instanceof Error ? error.message : "Invalid datalake admission policy");
132471
+ }
132472
+ }
132473
+ function schemaSet(schemas, strict = false) {
132474
+ return strict || (schemas?.length ?? 0) > 0 ? new Set(schemas) : void 0;
132475
+ }
132476
+ function byteLimit(config, schema) {
132477
+ const limits = config.schemaMaxPayloadBytes;
132478
+ const schemaLimit = limits && Object.hasOwn(limits, schema) ? limits[schema] : void 0;
132479
+ if (schemaLimit === void 0) return config.maxPayloadBytes;
132480
+ return Math.min(config.maxPayloadBytes ?? schemaLimit, schemaLimit);
132481
+ }
132482
+ //#endregion
131761
132483
  //#region src/routes/payloadRoutes.ts
131762
132484
  const PLANE_PREFIX$1 = `/v1/datalakes/:id`;
131763
132485
  function registerPayloadRoutes(app, deps) {
@@ -131770,6 +132492,10 @@ function registerPayloadRoutes(app, deps) {
131770
132492
  }
131771
132493
  if (payloads.length > deps.maxInsertBatch) throw new PlaneHttpError("unprocessable", `Batch size ${payloads.length} exceeds limit ${deps.maxInsertBatch}`);
131772
132494
  const { accepted, rejected } = await applyInsertPolicy(access.descriptor, payloads);
132495
+ if (accepted.length === 0) {
132496
+ setInsertSummaryHeaders(reply, 0, rejected);
132497
+ return [];
132498
+ }
131773
132499
  const result = await deps.payloadStore.insert(access.descriptor.id, accepted);
131774
132500
  setInsertSummaryHeaders(reply, result.duplicates, rejected);
131775
132501
  return result.inserted;
@@ -131840,38 +132566,6 @@ function setInsertSummaryHeaders(reply, duplicates, rejected) {
131840
132566
  reply.header(DATALAKE_HEADER_DUPLICATES, String(duplicates));
131841
132567
  if (rejected.length > 0) reply.header(DATALAKE_HEADER_REJECTED, rejected.join(","));
131842
132568
  }
131843
- async function applyInsertPolicy(descriptor, payloads) {
131844
- const allow = descriptor.config.allowedSchemas && descriptor.config.allowedSchemas.length > 0 ? new Set(descriptor.config.allowedSchemas) : void 0;
131845
- const deny = descriptor.config.disallowedSchemas && descriptor.config.disallowedSchemas.length > 0 ? new Set(descriptor.config.disallowedSchemas) : void 0;
131846
- if (!allow && !deny) return {
131847
- accepted: payloads,
131848
- rejected: []
131849
- };
131850
- const accepted = [];
131851
- const rejected = [];
131852
- const stripped = PayloadBuilder.omitStorageMeta(payloads);
131853
- const hashes = await PayloadBuilder.hashes(stripped);
131854
- for (const [index, payload] of stripped.entries()) {
131855
- const hash = hashes[index];
131856
- if (typeof payload.schema !== "string") {
131857
- rejected.push(hash);
131858
- continue;
131859
- }
131860
- if (allow && !allow.has(payload.schema)) {
131861
- rejected.push(hash);
131862
- continue;
131863
- }
131864
- if (deny?.has(payload.schema)) {
131865
- rejected.push(hash);
131866
- continue;
131867
- }
131868
- accepted.push(payload);
131869
- }
131870
- return {
131871
- accepted,
131872
- rejected
131873
- };
131874
- }
131875
132569
  //#endregion
131876
132570
  //#region src/routes/usageRoutes.ts
131877
132571
  const PLANE_PREFIX = `/v1/datalakes/:id`;
@@ -132007,33 +132701,12 @@ async function countArchivistPayloads(archivist) {
132007
132701
  }
132008
132702
  //#endregion
132009
132703
  //#region src/store/archivistInsert.ts
132010
- /**
132011
- * Inserts payloads into an archivist while detecting duplicates against
132012
- * payloads already present. The XYO archivist deduplicates internally by
132013
- * overwriting on `_hash` collision, but does not expose how many writes
132014
- * were no-ops; we pre-compute `_hash` to figure that out ourselves.
132015
- *
132016
- * Returns the newly-inserted payloads (archivist-decorated with storage
132017
- * meta) plus the duplicate count.
132018
- */
132704
+ /** The framework deduplicates against canonical local roots and repairs existing indexes. */
132019
132705
  async function archivistInsertDeduped(archivist, payloads) {
132020
- if (payloads.length === 0) return {
132021
- inserted: [],
132022
- duplicates: 0
132023
- };
132024
- const stripped = PayloadBuilder.omitStorageMeta(payloads);
132025
- const hashes = await PayloadBuilder.hashes(stripped);
132026
- const existing = await archivist.get(hashes);
132027
- const existingHashes = new Set(existing.map((p) => p._hash));
132028
- const fresh = [];
132029
- for (const [index, payload] of stripped.entries()) if (!existingHashes.has(hashes[index])) fresh.push(payload);
132030
- if (fresh.length === 0) return {
132031
- inserted: [],
132032
- duplicates: payloads.length
132033
- };
132706
+ const inserted = await archivist.insert(payloads);
132034
132707
  return {
132035
- inserted: await archivist.insert(fresh),
132036
- duplicates: payloads.length - fresh.length
132708
+ inserted,
132709
+ duplicates: payloads.length - inserted.length
132037
132710
  };
132038
132711
  }
132039
132712
  //#endregion
@@ -132074,14 +132747,14 @@ var FilePersistedPayloadStore = class {
132074
132747
  const limit = Math.max(1, Math.min(options.limit ?? 100, 1e3));
132075
132748
  const all = await archivist.next({
132076
132749
  limit,
132077
- ...!(options.cursor === void 0) && { cursor: options.cursor },
132078
- ...!(options.order === void 0) && { order: options.order }
132750
+ ...options.cursor !== void 0 && { cursor: options.cursor },
132751
+ ...options.order !== void 0 && { order: options.order }
132079
132752
  });
132080
132753
  const filtered = options.schemas && options.schemas.length > 0 ? all.filter((p) => options.schemas.includes(p.schema)) : all;
132081
132754
  const nextCursor = filtered.at(-1)?._sequence;
132082
132755
  return {
132083
132756
  payloads: filtered,
132084
- ...!(nextCursor === void 0) && { nextCursor }
132757
+ ...nextCursor !== void 0 && { nextCursor }
132085
132758
  };
132086
132759
  }
132087
132760
  async getArchivist(datalakeId) {
@@ -132134,14 +132807,14 @@ var InMemoryPayloadStore = class {
132134
132807
  const limit = Math.max(1, Math.min(options.limit ?? 100, 1e3));
132135
132808
  const all = await archivist.next({
132136
132809
  limit,
132137
- ...!(options.cursor === void 0) && { cursor: options.cursor },
132138
- ...!(options.order === void 0) && { order: options.order }
132810
+ ...options.cursor !== void 0 && { cursor: options.cursor },
132811
+ ...options.order !== void 0 && { order: options.order }
132139
132812
  });
132140
132813
  const filtered = options.schemas && options.schemas.length > 0 ? all.filter((p) => options.schemas.includes(p.schema)) : all;
132141
132814
  const nextCursor = filtered.at(-1)?._sequence;
132142
132815
  return {
132143
132816
  payloads: filtered,
132144
- ...!(nextCursor === void 0) && { nextCursor }
132817
+ ...nextCursor !== void 0 && { nextCursor }
132145
132818
  };
132146
132819
  }
132147
132820
  async getArchivist(datalakeId) {
@@ -132264,9 +132937,13 @@ async function main() {
132264
132937
  if (failure !== void 0 && failure.status === "rejected") throw failure.reason;
132265
132938
  });
132266
132939
  }
132267
- main().catch((error) => {
132268
- console.error(error);
132269
- process.exit(1);
132270
- });
132940
+ (async () => {
132941
+ try {
132942
+ await main();
132943
+ } catch (error) {
132944
+ console.error(error);
132945
+ process.exit(1);
132946
+ }
132947
+ })();
132271
132948
  //#endregion
132272
132949
  export {};