@learncard/claimable-boosts-plugin 1.0.38 → 1.0.40

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.
@@ -1,7 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
3
 
4
- // ../../../node_modules/.pnpm/zod@3.20.2/node_modules/zod/lib/index.mjs
4
+ // ../../../node_modules/.pnpm/zod@3.23.8/node_modules/zod/lib/index.mjs
5
5
  var util;
6
6
  (function(util2) {
7
7
  util2.assertEqual = (val) => val;
@@ -63,6 +63,15 @@ var util;
63
63
  return value;
64
64
  };
65
65
  })(util || (util = {}));
66
+ var objectUtil;
67
+ (function(objectUtil2) {
68
+ objectUtil2.mergeShapes = (first, second) => {
69
+ return {
70
+ ...first,
71
+ ...second
72
+ };
73
+ };
74
+ })(objectUtil || (objectUtil = {}));
66
75
  var ZodParsedType = util.arrayToEnum([
67
76
  "string",
68
77
  "nan",
@@ -206,6 +215,11 @@ var ZodError = class extends Error {
206
215
  processError(this);
207
216
  return fieldErrors;
208
217
  }
218
+ static assert(value) {
219
+ if (!(value instanceof ZodError)) {
220
+ throw new Error(`Not a ZodError: ${value}`);
221
+ }
222
+ }
209
223
  toString() {
210
224
  return this.message;
211
225
  }
@@ -273,7 +287,12 @@ var errorMap = /* @__PURE__ */ __name((issue, _ctx) => {
273
287
  break;
274
288
  case ZodIssueCode.invalid_string:
275
289
  if (typeof issue.validation === "object") {
276
- if ("startsWith" in issue.validation) {
290
+ if ("includes" in issue.validation) {
291
+ message = `Invalid input: must include "${issue.validation.includes}"`;
292
+ if (typeof issue.validation.position === "number") {
293
+ message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;
294
+ }
295
+ } else if ("startsWith" in issue.validation) {
277
296
  message = `Invalid input: must start with "${issue.validation.startsWith}"`;
278
297
  } else if ("endsWith" in issue.validation) {
279
298
  message = `Invalid input: must end with "${issue.validation.endsWith}"`;
@@ -294,7 +313,7 @@ var errorMap = /* @__PURE__ */ __name((issue, _ctx) => {
294
313
  else if (issue.type === "number")
295
314
  message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
296
315
  else if (issue.type === "date")
297
- message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(issue.minimum)}`;
316
+ message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
298
317
  else
299
318
  message = "Invalid input";
300
319
  break;
@@ -305,8 +324,10 @@ var errorMap = /* @__PURE__ */ __name((issue, _ctx) => {
305
324
  message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
306
325
  else if (issue.type === "number")
307
326
  message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
327
+ else if (issue.type === "bigint")
328
+ message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
308
329
  else if (issue.type === "date")
309
- message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(issue.maximum)}`;
330
+ message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`;
310
331
  else
311
332
  message = "Invalid input";
312
333
  break;
@@ -344,6 +365,13 @@ var makeIssue = /* @__PURE__ */ __name((params) => {
344
365
  ...issueData,
345
366
  path: fullPath
346
367
  };
368
+ if (issueData.message !== void 0) {
369
+ return {
370
+ ...issueData,
371
+ path: fullPath,
372
+ message: issueData.message
373
+ };
374
+ }
347
375
  let errorMessage = "";
348
376
  const maps = errorMaps.filter((m) => !!m).slice().reverse();
349
377
  for (const map of maps) {
@@ -352,11 +380,12 @@ var makeIssue = /* @__PURE__ */ __name((params) => {
352
380
  return {
353
381
  ...issueData,
354
382
  path: fullPath,
355
- message: issueData.message || errorMessage
383
+ message: errorMessage
356
384
  };
357
385
  }, "makeIssue");
358
386
  var EMPTY_PATH = [];
359
387
  function addIssueToContext(ctx, issueData) {
388
+ const overrideMap = getErrorMap();
360
389
  const issue = makeIssue({
361
390
  issueData,
362
391
  data: ctx.data,
@@ -364,8 +393,8 @@ function addIssueToContext(ctx, issueData) {
364
393
  errorMaps: [
365
394
  ctx.common.contextualErrorMap,
366
395
  ctx.schemaErrorMap,
367
- getErrorMap(),
368
- errorMap
396
+ overrideMap,
397
+ overrideMap === errorMap ? void 0 : errorMap
369
398
  ].filter((x) => !!x)
370
399
  });
371
400
  ctx.common.issues.push(issue);
@@ -397,9 +426,11 @@ var ParseStatus = class {
397
426
  static async mergeObjectAsync(status, pairs) {
398
427
  const syncPairs = [];
399
428
  for (const pair of pairs) {
429
+ const key = await pair.key;
430
+ const value = await pair.value;
400
431
  syncPairs.push({
401
- key: await pair.key,
402
- value: await pair.value
432
+ key,
433
+ value
403
434
  });
404
435
  }
405
436
  return ParseStatus.mergeObjectSync(status, syncPairs);
@@ -416,7 +447,7 @@ var ParseStatus = class {
416
447
  status.dirty();
417
448
  if (value.status === "dirty")
418
449
  status.dirty();
419
- if (typeof value.value !== "undefined" || pair.alwaysSet) {
450
+ if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) {
420
451
  finalObject[key.value] = value.value;
421
452
  }
422
453
  }
@@ -432,21 +463,49 @@ var OK = /* @__PURE__ */ __name((value) => ({ status: "valid", value }), "OK");
432
463
  var isAborted = /* @__PURE__ */ __name((x) => x.status === "aborted", "isAborted");
433
464
  var isDirty = /* @__PURE__ */ __name((x) => x.status === "dirty", "isDirty");
434
465
  var isValid = /* @__PURE__ */ __name((x) => x.status === "valid", "isValid");
435
- var isAsync = /* @__PURE__ */ __name((x) => typeof Promise !== void 0 && x instanceof Promise, "isAsync");
466
+ var isAsync = /* @__PURE__ */ __name((x) => typeof Promise !== "undefined" && x instanceof Promise, "isAsync");
467
+ function __classPrivateFieldGet(receiver, state, kind, f) {
468
+ if (kind === "a" && !f)
469
+ throw new TypeError("Private accessor was defined without a getter");
470
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
471
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
472
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
473
+ }
474
+ __name(__classPrivateFieldGet, "__classPrivateFieldGet");
475
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
476
+ if (kind === "m")
477
+ throw new TypeError("Private method is not writable");
478
+ if (kind === "a" && !f)
479
+ throw new TypeError("Private accessor was defined without a setter");
480
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
481
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
482
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
483
+ }
484
+ __name(__classPrivateFieldSet, "__classPrivateFieldSet");
436
485
  var errorUtil;
437
486
  (function(errorUtil2) {
438
487
  errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
439
488
  errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
440
489
  })(errorUtil || (errorUtil = {}));
490
+ var _ZodEnum_cache;
491
+ var _ZodNativeEnum_cache;
441
492
  var ParseInputLazyPath = class {
442
493
  constructor(parent, value, path, key) {
494
+ this._cachedPath = [];
443
495
  this.parent = parent;
444
496
  this.data = value;
445
497
  this._path = path;
446
498
  this._key = key;
447
499
  }
448
500
  get path() {
449
- return this._path.concat(this._key);
501
+ if (!this._cachedPath.length) {
502
+ if (this._key instanceof Array) {
503
+ this._cachedPath.push(...this._path, ...this._key);
504
+ } else {
505
+ this._cachedPath.push(...this._path, this._key);
506
+ }
507
+ }
508
+ return this._cachedPath;
450
509
  }
451
510
  };
452
511
  __name(ParseInputLazyPath, "ParseInputLazyPath");
@@ -457,8 +516,16 @@ var handleResult = /* @__PURE__ */ __name((ctx, result) => {
457
516
  if (!ctx.common.issues.length) {
458
517
  throw new Error("Validation failed but no issues detected.");
459
518
  }
460
- const error = new ZodError(ctx.common.issues);
461
- return { success: false, error };
519
+ return {
520
+ success: false,
521
+ get error() {
522
+ if (this._error)
523
+ return this._error;
524
+ const error = new ZodError(ctx.common.issues);
525
+ this._error = error;
526
+ return this._error;
527
+ }
528
+ };
462
529
  }
463
530
  }, "handleResult");
464
531
  function processCreateParams(params) {
@@ -471,12 +538,17 @@ function processCreateParams(params) {
471
538
  if (errorMap2)
472
539
  return { errorMap: errorMap2, description };
473
540
  const customMap = /* @__PURE__ */ __name((iss, ctx) => {
474
- if (iss.code !== "invalid_type")
475
- return { message: ctx.defaultError };
541
+ var _a, _b;
542
+ const { message } = params;
543
+ if (iss.code === "invalid_enum_value") {
544
+ return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
545
+ }
476
546
  if (typeof ctx.data === "undefined") {
477
- return { message: required_error !== null && required_error !== void 0 ? required_error : ctx.defaultError };
547
+ return { message: (_a = message !== null && message !== void 0 ? message : required_error) !== null && _a !== void 0 ? _a : ctx.defaultError };
478
548
  }
479
- return { message: invalid_type_error !== null && invalid_type_error !== void 0 ? invalid_type_error : ctx.defaultError };
549
+ if (iss.code !== "invalid_type")
550
+ return { message: ctx.defaultError };
551
+ return { message: (_b = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b !== void 0 ? _b : ctx.defaultError };
480
552
  }, "customMap");
481
553
  return { errorMap: customMap, description };
482
554
  }
@@ -506,6 +578,7 @@ var ZodType = class {
506
578
  this.catch = this.catch.bind(this);
507
579
  this.describe = this.describe.bind(this);
508
580
  this.pipe = this.pipe.bind(this);
581
+ this.readonly = this.readonly.bind(this);
509
582
  this.isNullable = this.isNullable.bind(this);
510
583
  this.isOptional = this.isOptional.bind(this);
511
584
  }
@@ -650,28 +723,29 @@ var ZodType = class {
650
723
  return this._refinement(refinement);
651
724
  }
652
725
  optional() {
653
- return ZodOptional.create(this);
726
+ return ZodOptional.create(this, this._def);
654
727
  }
655
728
  nullable() {
656
- return ZodNullable.create(this);
729
+ return ZodNullable.create(this, this._def);
657
730
  }
658
731
  nullish() {
659
- return this.optional().nullable();
732
+ return this.nullable().optional();
660
733
  }
661
734
  array() {
662
- return ZodArray.create(this);
735
+ return ZodArray.create(this, this._def);
663
736
  }
664
737
  promise() {
665
- return ZodPromise.create(this);
738
+ return ZodPromise.create(this, this._def);
666
739
  }
667
740
  or(option) {
668
- return ZodUnion.create([this, option]);
741
+ return ZodUnion.create([this, option], this._def);
669
742
  }
670
743
  and(incoming) {
671
- return ZodIntersection.create(this, incoming);
744
+ return ZodIntersection.create(this, incoming, this._def);
672
745
  }
673
746
  transform(transform) {
674
747
  return new ZodEffects({
748
+ ...processCreateParams(this._def),
675
749
  schema: this,
676
750
  typeName: ZodFirstPartyTypeKind.ZodEffects,
677
751
  effect: { type: "transform", transform }
@@ -680,6 +754,7 @@ var ZodType = class {
680
754
  default(def) {
681
755
  const defaultValueFunc = typeof def === "function" ? def : () => def;
682
756
  return new ZodDefault({
757
+ ...processCreateParams(this._def),
683
758
  innerType: this,
684
759
  defaultValue: defaultValueFunc,
685
760
  typeName: ZodFirstPartyTypeKind.ZodDefault
@@ -689,14 +764,15 @@ var ZodType = class {
689
764
  return new ZodBranded({
690
765
  typeName: ZodFirstPartyTypeKind.ZodBranded,
691
766
  type: this,
692
- ...processCreateParams(void 0)
767
+ ...processCreateParams(this._def)
693
768
  });
694
769
  }
695
770
  catch(def) {
696
- const defaultValueFunc = typeof def === "function" ? def : () => def;
771
+ const catchValueFunc = typeof def === "function" ? def : () => def;
697
772
  return new ZodCatch({
773
+ ...processCreateParams(this._def),
698
774
  innerType: this,
699
- defaultValue: defaultValueFunc,
775
+ catchValue: catchValueFunc,
700
776
  typeName: ZodFirstPartyTypeKind.ZodCatch
701
777
  });
702
778
  }
@@ -710,6 +786,9 @@ var ZodType = class {
710
786
  pipe(target) {
711
787
  return ZodPipeline.create(this, target);
712
788
  }
789
+ readonly() {
790
+ return ZodReadonly.create(this);
791
+ }
713
792
  isOptional() {
714
793
  return this.safeParse(void 0).success;
715
794
  }
@@ -719,43 +798,54 @@ var ZodType = class {
719
798
  };
720
799
  __name(ZodType, "ZodType");
721
800
  var cuidRegex = /^c[^\s-]{8,}$/i;
722
- var uuidRegex = /^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i;
723
- var emailRegex = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;
724
- var datetimeRegex = /* @__PURE__ */ __name((args) => {
801
+ var cuid2Regex = /^[0-9a-z]+$/;
802
+ var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;
803
+ var uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i;
804
+ var nanoidRegex = /^[a-z0-9_-]{21}$/i;
805
+ var durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
806
+ var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
807
+ var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
808
+ var emojiRegex;
809
+ var ipv4Regex = /^(?:(?: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])$/;
810
+ var ipv6Regex = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;
811
+ var base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
812
+ var dateRegexSource = `((\\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])))`;
813
+ var dateRegex = new RegExp(`^${dateRegexSource}$`);
814
+ function timeRegexSource(args) {
815
+ let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
725
816
  if (args.precision) {
726
- if (args.offset) {
727
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}:\\d{2})|Z)$`);
728
- } else {
729
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
730
- }
731
- } else if (args.precision === 0) {
732
- if (args.offset) {
733
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$`);
734
- } else {
735
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
736
- }
737
- } else {
738
- if (args.offset) {
739
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$`);
740
- } else {
741
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
742
- }
817
+ regex = `${regex}\\.\\d{${args.precision}}`;
818
+ } else if (args.precision == null) {
819
+ regex = `${regex}(\\.\\d+)?`;
743
820
  }
744
- }, "datetimeRegex");
745
- var ZodString = class extends ZodType {
746
- constructor() {
747
- super(...arguments);
748
- this._regex = (regex, validation, message) => this.refinement((data) => regex.test(data), {
749
- validation,
750
- code: ZodIssueCode.invalid_string,
751
- ...errorUtil.errToObj(message)
752
- });
753
- this.nonempty = (message) => this.min(1, errorUtil.errToObj(message));
754
- this.trim = () => new ZodString({
755
- ...this._def,
756
- checks: [...this._def.checks, { kind: "trim" }]
757
- });
821
+ return regex;
822
+ }
823
+ __name(timeRegexSource, "timeRegexSource");
824
+ function timeRegex(args) {
825
+ return new RegExp(`^${timeRegexSource(args)}$`);
826
+ }
827
+ __name(timeRegex, "timeRegex");
828
+ function datetimeRegex(args) {
829
+ let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
830
+ const opts = [];
831
+ opts.push(args.local ? `Z?` : `Z`);
832
+ if (args.offset)
833
+ opts.push(`([+-]\\d{2}:?\\d{2})`);
834
+ regex = `${regex}(${opts.join("|")})`;
835
+ return new RegExp(`^${regex}$`);
836
+ }
837
+ __name(datetimeRegex, "datetimeRegex");
838
+ function isValidIP(ip, version) {
839
+ if ((version === "v4" || !version) && ipv4Regex.test(ip)) {
840
+ return true;
758
841
  }
842
+ if ((version === "v6" || !version) && ipv6Regex.test(ip)) {
843
+ return true;
844
+ }
845
+ return false;
846
+ }
847
+ __name(isValidIP, "isValidIP");
848
+ var ZodString = class extends ZodType {
759
849
  _parse(input) {
760
850
  if (this._def.coerce) {
761
851
  input.data = String(input.data);
@@ -763,14 +853,11 @@ var ZodString = class extends ZodType {
763
853
  const parsedType = this._getType(input);
764
854
  if (parsedType !== ZodParsedType.string) {
765
855
  const ctx2 = this._getOrReturnCtx(input);
766
- addIssueToContext(
767
- ctx2,
768
- {
769
- code: ZodIssueCode.invalid_type,
770
- expected: ZodParsedType.string,
771
- received: ctx2.parsedType
772
- }
773
- );
856
+ addIssueToContext(ctx2, {
857
+ code: ZodIssueCode.invalid_type,
858
+ expected: ZodParsedType.string,
859
+ received: ctx2.parsedType
860
+ });
774
861
  return INVALID;
775
862
  }
776
863
  const status = new ParseStatus();
@@ -838,6 +925,19 @@ var ZodString = class extends ZodType {
838
925
  });
839
926
  status.dirty();
840
927
  }
928
+ } else if (check.kind === "emoji") {
929
+ if (!emojiRegex) {
930
+ emojiRegex = new RegExp(_emojiRegex, "u");
931
+ }
932
+ if (!emojiRegex.test(input.data)) {
933
+ ctx = this._getOrReturnCtx(input, ctx);
934
+ addIssueToContext(ctx, {
935
+ validation: "emoji",
936
+ code: ZodIssueCode.invalid_string,
937
+ message: check.message
938
+ });
939
+ status.dirty();
940
+ }
841
941
  } else if (check.kind === "uuid") {
842
942
  if (!uuidRegex.test(input.data)) {
843
943
  ctx = this._getOrReturnCtx(input, ctx);
@@ -848,6 +948,16 @@ var ZodString = class extends ZodType {
848
948
  });
849
949
  status.dirty();
850
950
  }
951
+ } else if (check.kind === "nanoid") {
952
+ if (!nanoidRegex.test(input.data)) {
953
+ ctx = this._getOrReturnCtx(input, ctx);
954
+ addIssueToContext(ctx, {
955
+ validation: "nanoid",
956
+ code: ZodIssueCode.invalid_string,
957
+ message: check.message
958
+ });
959
+ status.dirty();
960
+ }
851
961
  } else if (check.kind === "cuid") {
852
962
  if (!cuidRegex.test(input.data)) {
853
963
  ctx = this._getOrReturnCtx(input, ctx);
@@ -858,6 +968,26 @@ var ZodString = class extends ZodType {
858
968
  });
859
969
  status.dirty();
860
970
  }
971
+ } else if (check.kind === "cuid2") {
972
+ if (!cuid2Regex.test(input.data)) {
973
+ ctx = this._getOrReturnCtx(input, ctx);
974
+ addIssueToContext(ctx, {
975
+ validation: "cuid2",
976
+ code: ZodIssueCode.invalid_string,
977
+ message: check.message
978
+ });
979
+ status.dirty();
980
+ }
981
+ } else if (check.kind === "ulid") {
982
+ if (!ulidRegex.test(input.data)) {
983
+ ctx = this._getOrReturnCtx(input, ctx);
984
+ addIssueToContext(ctx, {
985
+ validation: "ulid",
986
+ code: ZodIssueCode.invalid_string,
987
+ message: check.message
988
+ });
989
+ status.dirty();
990
+ }
861
991
  } else if (check.kind === "url") {
862
992
  try {
863
993
  new URL(input.data);
@@ -884,6 +1014,20 @@ var ZodString = class extends ZodType {
884
1014
  }
885
1015
  } else if (check.kind === "trim") {
886
1016
  input.data = input.data.trim();
1017
+ } else if (check.kind === "includes") {
1018
+ if (!input.data.includes(check.value, check.position)) {
1019
+ ctx = this._getOrReturnCtx(input, ctx);
1020
+ addIssueToContext(ctx, {
1021
+ code: ZodIssueCode.invalid_string,
1022
+ validation: { includes: check.value, position: check.position },
1023
+ message: check.message
1024
+ });
1025
+ status.dirty();
1026
+ }
1027
+ } else if (check.kind === "toLowerCase") {
1028
+ input.data = input.data.toLowerCase();
1029
+ } else if (check.kind === "toUpperCase") {
1030
+ input.data = input.data.toUpperCase();
887
1031
  } else if (check.kind === "startsWith") {
888
1032
  if (!input.data.startsWith(check.value)) {
889
1033
  ctx = this._getOrReturnCtx(input, ctx);
@@ -915,12 +1059,71 @@ var ZodString = class extends ZodType {
915
1059
  });
916
1060
  status.dirty();
917
1061
  }
1062
+ } else if (check.kind === "date") {
1063
+ const regex = dateRegex;
1064
+ if (!regex.test(input.data)) {
1065
+ ctx = this._getOrReturnCtx(input, ctx);
1066
+ addIssueToContext(ctx, {
1067
+ code: ZodIssueCode.invalid_string,
1068
+ validation: "date",
1069
+ message: check.message
1070
+ });
1071
+ status.dirty();
1072
+ }
1073
+ } else if (check.kind === "time") {
1074
+ const regex = timeRegex(check);
1075
+ if (!regex.test(input.data)) {
1076
+ ctx = this._getOrReturnCtx(input, ctx);
1077
+ addIssueToContext(ctx, {
1078
+ code: ZodIssueCode.invalid_string,
1079
+ validation: "time",
1080
+ message: check.message
1081
+ });
1082
+ status.dirty();
1083
+ }
1084
+ } else if (check.kind === "duration") {
1085
+ if (!durationRegex.test(input.data)) {
1086
+ ctx = this._getOrReturnCtx(input, ctx);
1087
+ addIssueToContext(ctx, {
1088
+ validation: "duration",
1089
+ code: ZodIssueCode.invalid_string,
1090
+ message: check.message
1091
+ });
1092
+ status.dirty();
1093
+ }
1094
+ } else if (check.kind === "ip") {
1095
+ if (!isValidIP(input.data, check.version)) {
1096
+ ctx = this._getOrReturnCtx(input, ctx);
1097
+ addIssueToContext(ctx, {
1098
+ validation: "ip",
1099
+ code: ZodIssueCode.invalid_string,
1100
+ message: check.message
1101
+ });
1102
+ status.dirty();
1103
+ }
1104
+ } else if (check.kind === "base64") {
1105
+ if (!base64Regex.test(input.data)) {
1106
+ ctx = this._getOrReturnCtx(input, ctx);
1107
+ addIssueToContext(ctx, {
1108
+ validation: "base64",
1109
+ code: ZodIssueCode.invalid_string,
1110
+ message: check.message
1111
+ });
1112
+ status.dirty();
1113
+ }
918
1114
  } else {
919
1115
  util.assertNever(check);
920
1116
  }
921
1117
  }
922
1118
  return { status: status.value, value: input.data };
923
1119
  }
1120
+ _regex(regex, validation, message) {
1121
+ return this.refinement((data) => regex.test(data), {
1122
+ validation,
1123
+ code: ZodIssueCode.invalid_string,
1124
+ ...errorUtil.errToObj(message)
1125
+ });
1126
+ }
924
1127
  _addCheck(check) {
925
1128
  return new ZodString({
926
1129
  ...this._def,
@@ -933,19 +1136,38 @@ var ZodString = class extends ZodType {
933
1136
  url(message) {
934
1137
  return this._addCheck({ kind: "url", ...errorUtil.errToObj(message) });
935
1138
  }
1139
+ emoji(message) {
1140
+ return this._addCheck({ kind: "emoji", ...errorUtil.errToObj(message) });
1141
+ }
936
1142
  uuid(message) {
937
1143
  return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) });
938
1144
  }
1145
+ nanoid(message) {
1146
+ return this._addCheck({ kind: "nanoid", ...errorUtil.errToObj(message) });
1147
+ }
939
1148
  cuid(message) {
940
1149
  return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
941
1150
  }
1151
+ cuid2(message) {
1152
+ return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
1153
+ }
1154
+ ulid(message) {
1155
+ return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) });
1156
+ }
1157
+ base64(message) {
1158
+ return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
1159
+ }
1160
+ ip(options) {
1161
+ return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
1162
+ }
942
1163
  datetime(options) {
943
- var _a;
1164
+ var _a, _b;
944
1165
  if (typeof options === "string") {
945
1166
  return this._addCheck({
946
1167
  kind: "datetime",
947
1168
  precision: null,
948
1169
  offset: false,
1170
+ local: false,
949
1171
  message: options
950
1172
  });
951
1173
  }
@@ -953,9 +1175,30 @@ var ZodString = class extends ZodType {
953
1175
  kind: "datetime",
954
1176
  precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
955
1177
  offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
1178
+ local: (_b = options === null || options === void 0 ? void 0 : options.local) !== null && _b !== void 0 ? _b : false,
956
1179
  ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
957
1180
  });
958
1181
  }
1182
+ date(message) {
1183
+ return this._addCheck({ kind: "date", message });
1184
+ }
1185
+ time(options) {
1186
+ if (typeof options === "string") {
1187
+ return this._addCheck({
1188
+ kind: "time",
1189
+ precision: null,
1190
+ message: options
1191
+ });
1192
+ }
1193
+ return this._addCheck({
1194
+ kind: "time",
1195
+ precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
1196
+ ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
1197
+ });
1198
+ }
1199
+ duration(message) {
1200
+ return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) });
1201
+ }
959
1202
  regex(regex, message) {
960
1203
  return this._addCheck({
961
1204
  kind: "regex",
@@ -963,6 +1206,14 @@ var ZodString = class extends ZodType {
963
1206
  ...errorUtil.errToObj(message)
964
1207
  });
965
1208
  }
1209
+ includes(value, options) {
1210
+ return this._addCheck({
1211
+ kind: "includes",
1212
+ value,
1213
+ position: options === null || options === void 0 ? void 0 : options.position,
1214
+ ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
1215
+ });
1216
+ }
966
1217
  startsWith(value, message) {
967
1218
  return this._addCheck({
968
1219
  kind: "startsWith",
@@ -998,21 +1249,69 @@ var ZodString = class extends ZodType {
998
1249
  ...errorUtil.errToObj(message)
999
1250
  });
1000
1251
  }
1252
+ nonempty(message) {
1253
+ return this.min(1, errorUtil.errToObj(message));
1254
+ }
1255
+ trim() {
1256
+ return new ZodString({
1257
+ ...this._def,
1258
+ checks: [...this._def.checks, { kind: "trim" }]
1259
+ });
1260
+ }
1261
+ toLowerCase() {
1262
+ return new ZodString({
1263
+ ...this._def,
1264
+ checks: [...this._def.checks, { kind: "toLowerCase" }]
1265
+ });
1266
+ }
1267
+ toUpperCase() {
1268
+ return new ZodString({
1269
+ ...this._def,
1270
+ checks: [...this._def.checks, { kind: "toUpperCase" }]
1271
+ });
1272
+ }
1001
1273
  get isDatetime() {
1002
1274
  return !!this._def.checks.find((ch) => ch.kind === "datetime");
1003
1275
  }
1276
+ get isDate() {
1277
+ return !!this._def.checks.find((ch) => ch.kind === "date");
1278
+ }
1279
+ get isTime() {
1280
+ return !!this._def.checks.find((ch) => ch.kind === "time");
1281
+ }
1282
+ get isDuration() {
1283
+ return !!this._def.checks.find((ch) => ch.kind === "duration");
1284
+ }
1004
1285
  get isEmail() {
1005
1286
  return !!this._def.checks.find((ch) => ch.kind === "email");
1006
1287
  }
1007
1288
  get isURL() {
1008
1289
  return !!this._def.checks.find((ch) => ch.kind === "url");
1009
1290
  }
1291
+ get isEmoji() {
1292
+ return !!this._def.checks.find((ch) => ch.kind === "emoji");
1293
+ }
1010
1294
  get isUUID() {
1011
1295
  return !!this._def.checks.find((ch) => ch.kind === "uuid");
1012
1296
  }
1297
+ get isNANOID() {
1298
+ return !!this._def.checks.find((ch) => ch.kind === "nanoid");
1299
+ }
1013
1300
  get isCUID() {
1014
1301
  return !!this._def.checks.find((ch) => ch.kind === "cuid");
1015
1302
  }
1303
+ get isCUID2() {
1304
+ return !!this._def.checks.find((ch) => ch.kind === "cuid2");
1305
+ }
1306
+ get isULID() {
1307
+ return !!this._def.checks.find((ch) => ch.kind === "ulid");
1308
+ }
1309
+ get isIP() {
1310
+ return !!this._def.checks.find((ch) => ch.kind === "ip");
1311
+ }
1312
+ get isBase64() {
1313
+ return !!this._def.checks.find((ch) => ch.kind === "base64");
1314
+ }
1016
1315
  get minLength() {
1017
1316
  let min = null;
1018
1317
  for (const ch of this._def.checks) {
@@ -1224,6 +1523,19 @@ var ZodNumber = class extends ZodType {
1224
1523
  message: errorUtil.toString(message)
1225
1524
  });
1226
1525
  }
1526
+ safe(message) {
1527
+ return this._addCheck({
1528
+ kind: "min",
1529
+ inclusive: true,
1530
+ value: Number.MIN_SAFE_INTEGER,
1531
+ message: errorUtil.toString(message)
1532
+ })._addCheck({
1533
+ kind: "max",
1534
+ inclusive: true,
1535
+ value: Number.MAX_SAFE_INTEGER,
1536
+ message: errorUtil.toString(message)
1537
+ });
1538
+ }
1227
1539
  get minValue() {
1228
1540
  let min = null;
1229
1541
  for (const ch of this._def.checks) {
@@ -1245,7 +1557,22 @@ var ZodNumber = class extends ZodType {
1245
1557
  return max;
1246
1558
  }
1247
1559
  get isInt() {
1248
- return !!this._def.checks.find((ch) => ch.kind === "int");
1560
+ return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
1561
+ }
1562
+ get isFinite() {
1563
+ let max = null, min = null;
1564
+ for (const ch of this._def.checks) {
1565
+ if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
1566
+ return true;
1567
+ } else if (ch.kind === "min") {
1568
+ if (min === null || ch.value > min)
1569
+ min = ch.value;
1570
+ } else if (ch.kind === "max") {
1571
+ if (max === null || ch.value < max)
1572
+ max = ch.value;
1573
+ }
1574
+ }
1575
+ return Number.isFinite(min) && Number.isFinite(max);
1249
1576
  }
1250
1577
  };
1251
1578
  __name(ZodNumber, "ZodNumber");
@@ -1258,27 +1585,167 @@ ZodNumber.create = (params) => {
1258
1585
  });
1259
1586
  };
1260
1587
  var ZodBigInt = class extends ZodType {
1588
+ constructor() {
1589
+ super(...arguments);
1590
+ this.min = this.gte;
1591
+ this.max = this.lte;
1592
+ }
1261
1593
  _parse(input) {
1262
1594
  if (this._def.coerce) {
1263
1595
  input.data = BigInt(input.data);
1264
1596
  }
1265
1597
  const parsedType = this._getType(input);
1266
1598
  if (parsedType !== ZodParsedType.bigint) {
1267
- const ctx = this._getOrReturnCtx(input);
1268
- addIssueToContext(ctx, {
1599
+ const ctx2 = this._getOrReturnCtx(input);
1600
+ addIssueToContext(ctx2, {
1269
1601
  code: ZodIssueCode.invalid_type,
1270
1602
  expected: ZodParsedType.bigint,
1271
- received: ctx.parsedType
1603
+ received: ctx2.parsedType
1272
1604
  });
1273
1605
  return INVALID;
1274
1606
  }
1275
- return OK(input.data);
1607
+ let ctx = void 0;
1608
+ const status = new ParseStatus();
1609
+ for (const check of this._def.checks) {
1610
+ if (check.kind === "min") {
1611
+ const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
1612
+ if (tooSmall) {
1613
+ ctx = this._getOrReturnCtx(input, ctx);
1614
+ addIssueToContext(ctx, {
1615
+ code: ZodIssueCode.too_small,
1616
+ type: "bigint",
1617
+ minimum: check.value,
1618
+ inclusive: check.inclusive,
1619
+ message: check.message
1620
+ });
1621
+ status.dirty();
1622
+ }
1623
+ } else if (check.kind === "max") {
1624
+ const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
1625
+ if (tooBig) {
1626
+ ctx = this._getOrReturnCtx(input, ctx);
1627
+ addIssueToContext(ctx, {
1628
+ code: ZodIssueCode.too_big,
1629
+ type: "bigint",
1630
+ maximum: check.value,
1631
+ inclusive: check.inclusive,
1632
+ message: check.message
1633
+ });
1634
+ status.dirty();
1635
+ }
1636
+ } else if (check.kind === "multipleOf") {
1637
+ if (input.data % check.value !== BigInt(0)) {
1638
+ ctx = this._getOrReturnCtx(input, ctx);
1639
+ addIssueToContext(ctx, {
1640
+ code: ZodIssueCode.not_multiple_of,
1641
+ multipleOf: check.value,
1642
+ message: check.message
1643
+ });
1644
+ status.dirty();
1645
+ }
1646
+ } else {
1647
+ util.assertNever(check);
1648
+ }
1649
+ }
1650
+ return { status: status.value, value: input.data };
1651
+ }
1652
+ gte(value, message) {
1653
+ return this.setLimit("min", value, true, errorUtil.toString(message));
1654
+ }
1655
+ gt(value, message) {
1656
+ return this.setLimit("min", value, false, errorUtil.toString(message));
1657
+ }
1658
+ lte(value, message) {
1659
+ return this.setLimit("max", value, true, errorUtil.toString(message));
1660
+ }
1661
+ lt(value, message) {
1662
+ return this.setLimit("max", value, false, errorUtil.toString(message));
1663
+ }
1664
+ setLimit(kind, value, inclusive, message) {
1665
+ return new ZodBigInt({
1666
+ ...this._def,
1667
+ checks: [
1668
+ ...this._def.checks,
1669
+ {
1670
+ kind,
1671
+ value,
1672
+ inclusive,
1673
+ message: errorUtil.toString(message)
1674
+ }
1675
+ ]
1676
+ });
1677
+ }
1678
+ _addCheck(check) {
1679
+ return new ZodBigInt({
1680
+ ...this._def,
1681
+ checks: [...this._def.checks, check]
1682
+ });
1683
+ }
1684
+ positive(message) {
1685
+ return this._addCheck({
1686
+ kind: "min",
1687
+ value: BigInt(0),
1688
+ inclusive: false,
1689
+ message: errorUtil.toString(message)
1690
+ });
1691
+ }
1692
+ negative(message) {
1693
+ return this._addCheck({
1694
+ kind: "max",
1695
+ value: BigInt(0),
1696
+ inclusive: false,
1697
+ message: errorUtil.toString(message)
1698
+ });
1699
+ }
1700
+ nonpositive(message) {
1701
+ return this._addCheck({
1702
+ kind: "max",
1703
+ value: BigInt(0),
1704
+ inclusive: true,
1705
+ message: errorUtil.toString(message)
1706
+ });
1707
+ }
1708
+ nonnegative(message) {
1709
+ return this._addCheck({
1710
+ kind: "min",
1711
+ value: BigInt(0),
1712
+ inclusive: true,
1713
+ message: errorUtil.toString(message)
1714
+ });
1715
+ }
1716
+ multipleOf(value, message) {
1717
+ return this._addCheck({
1718
+ kind: "multipleOf",
1719
+ value,
1720
+ message: errorUtil.toString(message)
1721
+ });
1722
+ }
1723
+ get minValue() {
1724
+ let min = null;
1725
+ for (const ch of this._def.checks) {
1726
+ if (ch.kind === "min") {
1727
+ if (min === null || ch.value > min)
1728
+ min = ch.value;
1729
+ }
1730
+ }
1731
+ return min;
1732
+ }
1733
+ get maxValue() {
1734
+ let max = null;
1735
+ for (const ch of this._def.checks) {
1736
+ if (ch.kind === "max") {
1737
+ if (max === null || ch.value < max)
1738
+ max = ch.value;
1739
+ }
1740
+ }
1741
+ return max;
1276
1742
  }
1277
1743
  };
1278
1744
  __name(ZodBigInt, "ZodBigInt");
1279
1745
  ZodBigInt.create = (params) => {
1280
1746
  var _a;
1281
1747
  return new ZodBigInt({
1748
+ checks: [],
1282
1749
  typeName: ZodFirstPartyTypeKind.ZodBigInt,
1283
1750
  coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
1284
1751
  ...processCreateParams(params)
@@ -1613,13 +2080,13 @@ var ZodArray = class extends ZodType {
1613
2080
  }
1614
2081
  }
1615
2082
  if (ctx.common.async) {
1616
- return Promise.all(ctx.data.map((item, i) => {
2083
+ return Promise.all([...ctx.data].map((item, i) => {
1617
2084
  return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
1618
2085
  })).then((result2) => {
1619
2086
  return ParseStatus.mergeArray(status, result2);
1620
2087
  });
1621
2088
  }
1622
- const result = ctx.data.map((item, i) => {
2089
+ const result = [...ctx.data].map((item, i) => {
1623
2090
  return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
1624
2091
  });
1625
2092
  return ParseStatus.mergeArray(status, result);
@@ -1660,24 +2127,6 @@ ZodArray.create = (schema, params) => {
1660
2127
  ...processCreateParams(params)
1661
2128
  });
1662
2129
  };
1663
- var objectUtil;
1664
- (function(objectUtil2) {
1665
- objectUtil2.mergeShapes = (first, second) => {
1666
- return {
1667
- ...first,
1668
- ...second
1669
- };
1670
- };
1671
- })(objectUtil || (objectUtil = {}));
1672
- var AugmentFactory = /* @__PURE__ */ __name((def) => (augmentation) => {
1673
- return new ZodObject({
1674
- ...def,
1675
- shape: () => ({
1676
- ...def.shape(),
1677
- ...augmentation
1678
- })
1679
- });
1680
- }, "AugmentFactory");
1681
2130
  function deepPartialify(schema) {
1682
2131
  if (schema instanceof ZodObject) {
1683
2132
  const newShape = {};
@@ -1690,7 +2139,10 @@ function deepPartialify(schema) {
1690
2139
  shape: () => newShape
1691
2140
  });
1692
2141
  } else if (schema instanceof ZodArray) {
1693
- return ZodArray.create(deepPartialify(schema.element));
2142
+ return new ZodArray({
2143
+ ...schema._def,
2144
+ type: deepPartialify(schema.element)
2145
+ });
1694
2146
  } else if (schema instanceof ZodOptional) {
1695
2147
  return ZodOptional.create(deepPartialify(schema.unwrap()));
1696
2148
  } else if (schema instanceof ZodNullable) {
@@ -1707,8 +2159,7 @@ var ZodObject = class extends ZodType {
1707
2159
  super(...arguments);
1708
2160
  this._cached = null;
1709
2161
  this.nonstrict = this.passthrough;
1710
- this.augment = AugmentFactory(this._def);
1711
- this.extend = AugmentFactory(this._def);
2162
+ this.augment = this.extend;
1712
2163
  }
1713
2164
  _getCached() {
1714
2165
  if (this._cached !== null)
@@ -1788,9 +2239,10 @@ var ZodObject = class extends ZodType {
1788
2239
  const syncPairs = [];
1789
2240
  for (const pair of pairs) {
1790
2241
  const key = await pair.key;
2242
+ const value = await pair.value;
1791
2243
  syncPairs.push({
1792
2244
  key,
1793
- value: await pair.value,
2245
+ value,
1794
2246
  alwaysSet: pair.alwaysSet
1795
2247
  });
1796
2248
  }
@@ -1837,18 +2289,30 @@ var ZodObject = class extends ZodType {
1837
2289
  unknownKeys: "passthrough"
1838
2290
  });
1839
2291
  }
1840
- setKey(key, schema) {
1841
- return this.augment({ [key]: schema });
2292
+ extend(augmentation) {
2293
+ return new ZodObject({
2294
+ ...this._def,
2295
+ shape: () => ({
2296
+ ...this._def.shape(),
2297
+ ...augmentation
2298
+ })
2299
+ });
1842
2300
  }
1843
2301
  merge(merging) {
1844
2302
  const merged = new ZodObject({
1845
2303
  unknownKeys: merging._def.unknownKeys,
1846
2304
  catchall: merging._def.catchall,
1847
- shape: () => objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
2305
+ shape: () => ({
2306
+ ...this._def.shape(),
2307
+ ...merging._def.shape()
2308
+ }),
1848
2309
  typeName: ZodFirstPartyTypeKind.ZodObject
1849
2310
  });
1850
2311
  return merged;
1851
2312
  }
2313
+ setKey(key, schema) {
2314
+ return this.augment({ [key]: schema });
2315
+ }
1852
2316
  catchall(index) {
1853
2317
  return new ZodObject({
1854
2318
  ...this._def,
@@ -1857,9 +2321,10 @@ var ZodObject = class extends ZodType {
1857
2321
  }
1858
2322
  pick(mask) {
1859
2323
  const shape = {};
1860
- util.objectKeys(mask).map((key) => {
1861
- if (this.shape[key])
2324
+ util.objectKeys(mask).forEach((key) => {
2325
+ if (mask[key] && this.shape[key]) {
1862
2326
  shape[key] = this.shape[key];
2327
+ }
1863
2328
  });
1864
2329
  return new ZodObject({
1865
2330
  ...this._def,
@@ -1868,8 +2333,8 @@ var ZodObject = class extends ZodType {
1868
2333
  }
1869
2334
  omit(mask) {
1870
2335
  const shape = {};
1871
- util.objectKeys(this.shape).map((key) => {
1872
- if (util.objectKeys(mask).indexOf(key) === -1) {
2336
+ util.objectKeys(this.shape).forEach((key) => {
2337
+ if (!mask[key]) {
1873
2338
  shape[key] = this.shape[key];
1874
2339
  }
1875
2340
  });
@@ -1883,24 +2348,14 @@ var ZodObject = class extends ZodType {
1883
2348
  }
1884
2349
  partial(mask) {
1885
2350
  const newShape = {};
1886
- if (mask) {
1887
- util.objectKeys(this.shape).map((key) => {
1888
- if (util.objectKeys(mask).indexOf(key) === -1) {
1889
- newShape[key] = this.shape[key];
1890
- } else {
1891
- newShape[key] = this.shape[key].optional();
1892
- }
1893
- });
1894
- return new ZodObject({
1895
- ...this._def,
1896
- shape: () => newShape
1897
- });
1898
- } else {
1899
- for (const key in this.shape) {
1900
- const fieldSchema = this.shape[key];
2351
+ util.objectKeys(this.shape).forEach((key) => {
2352
+ const fieldSchema = this.shape[key];
2353
+ if (mask && !mask[key]) {
2354
+ newShape[key] = fieldSchema;
2355
+ } else {
1901
2356
  newShape[key] = fieldSchema.optional();
1902
2357
  }
1903
- }
2358
+ });
1904
2359
  return new ZodObject({
1905
2360
  ...this._def,
1906
2361
  shape: () => newShape
@@ -1908,21 +2363,10 @@ var ZodObject = class extends ZodType {
1908
2363
  }
1909
2364
  required(mask) {
1910
2365
  const newShape = {};
1911
- if (mask) {
1912
- util.objectKeys(this.shape).map((key) => {
1913
- if (util.objectKeys(mask).indexOf(key) === -1) {
1914
- newShape[key] = this.shape[key];
1915
- } else {
1916
- const fieldSchema = this.shape[key];
1917
- let newField = fieldSchema;
1918
- while (newField instanceof ZodOptional) {
1919
- newField = newField._def.innerType;
1920
- }
1921
- newShape[key] = newField;
1922
- }
1923
- });
1924
- } else {
1925
- for (const key in this.shape) {
2366
+ util.objectKeys(this.shape).forEach((key) => {
2367
+ if (mask && !mask[key]) {
2368
+ newShape[key] = this.shape[key];
2369
+ } else {
1926
2370
  const fieldSchema = this.shape[key];
1927
2371
  let newField = fieldSchema;
1928
2372
  while (newField instanceof ZodOptional) {
@@ -1930,7 +2374,7 @@ var ZodObject = class extends ZodType {
1930
2374
  }
1931
2375
  newShape[key] = newField;
1932
2376
  }
1933
- }
2377
+ });
1934
2378
  return new ZodObject({
1935
2379
  ...this._def,
1936
2380
  shape: () => newShape
@@ -2071,15 +2515,25 @@ var getDiscriminator = /* @__PURE__ */ __name((type) => {
2071
2515
  } else if (type instanceof ZodEnum) {
2072
2516
  return type.options;
2073
2517
  } else if (type instanceof ZodNativeEnum) {
2074
- return Object.keys(type.enum);
2518
+ return util.objectValues(type.enum);
2075
2519
  } else if (type instanceof ZodDefault) {
2076
2520
  return getDiscriminator(type._def.innerType);
2077
2521
  } else if (type instanceof ZodUndefined) {
2078
2522
  return [void 0];
2079
2523
  } else if (type instanceof ZodNull) {
2080
2524
  return [null];
2525
+ } else if (type instanceof ZodOptional) {
2526
+ return [void 0, ...getDiscriminator(type.unwrap())];
2527
+ } else if (type instanceof ZodNullable) {
2528
+ return [null, ...getDiscriminator(type.unwrap())];
2529
+ } else if (type instanceof ZodBranded) {
2530
+ return getDiscriminator(type.unwrap());
2531
+ } else if (type instanceof ZodReadonly) {
2532
+ return getDiscriminator(type.unwrap());
2533
+ } else if (type instanceof ZodCatch) {
2534
+ return getDiscriminator(type._def.innerType);
2081
2535
  } else {
2082
- return null;
2536
+ return [];
2083
2537
  }
2084
2538
  }, "getDiscriminator");
2085
2539
  var ZodDiscriminatedUnion = class extends ZodType {
@@ -2131,7 +2585,7 @@ var ZodDiscriminatedUnion = class extends ZodType {
2131
2585
  const optionsMap = /* @__PURE__ */ new Map();
2132
2586
  for (const type of options) {
2133
2587
  const discriminatorValues = getDiscriminator(type.shape[discriminator]);
2134
- if (!discriminatorValues) {
2588
+ if (!discriminatorValues.length) {
2135
2589
  throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
2136
2590
  }
2137
2591
  for (const value of discriminatorValues) {
@@ -2276,7 +2730,7 @@ var ZodTuple = class extends ZodType {
2276
2730
  });
2277
2731
  status.dirty();
2278
2732
  }
2279
- const items = ctx.data.map((item, itemIndex) => {
2733
+ const items = [...ctx.data].map((item, itemIndex) => {
2280
2734
  const schema = this._def.items[itemIndex] || this._def.rest;
2281
2735
  if (!schema)
2282
2736
  return null;
@@ -2335,7 +2789,8 @@ var ZodRecord = class extends ZodType {
2335
2789
  for (const key in ctx.data) {
2336
2790
  pairs.push({
2337
2791
  key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
2338
- value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key))
2792
+ value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),
2793
+ alwaysSet: key in ctx.data
2339
2794
  });
2340
2795
  }
2341
2796
  if (ctx.common.async) {
@@ -2366,6 +2821,12 @@ var ZodRecord = class extends ZodType {
2366
2821
  };
2367
2822
  __name(ZodRecord, "ZodRecord");
2368
2823
  var ZodMap = class extends ZodType {
2824
+ get keySchema() {
2825
+ return this._def.keyType;
2826
+ }
2827
+ get valueSchema() {
2828
+ return this._def.valueType;
2829
+ }
2369
2830
  _parse(input) {
2370
2831
  const { status, ctx } = this._processInputParams(input);
2371
2832
  if (ctx.parsedType !== ZodParsedType.map) {
@@ -2565,27 +3026,29 @@ var ZodFunction = class extends ZodType {
2565
3026
  const params = { errorMap: ctx.common.contextualErrorMap };
2566
3027
  const fn = ctx.data;
2567
3028
  if (this._def.returns instanceof ZodPromise) {
2568
- return OK(async (...args) => {
3029
+ const me = this;
3030
+ return OK(async function(...args) {
2569
3031
  const error = new ZodError([]);
2570
- const parsedArgs = await this._def.args.parseAsync(args, params).catch((e) => {
3032
+ const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
2571
3033
  error.addIssue(makeArgsIssue(args, e));
2572
3034
  throw error;
2573
3035
  });
2574
- const result = await fn(...parsedArgs);
2575
- const parsedReturns = await this._def.returns._def.type.parseAsync(result, params).catch((e) => {
3036
+ const result = await Reflect.apply(fn, this, parsedArgs);
3037
+ const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e) => {
2576
3038
  error.addIssue(makeReturnsIssue(result, e));
2577
3039
  throw error;
2578
3040
  });
2579
3041
  return parsedReturns;
2580
3042
  });
2581
3043
  } else {
2582
- return OK((...args) => {
2583
- const parsedArgs = this._def.args.safeParse(args, params);
3044
+ const me = this;
3045
+ return OK(function(...args) {
3046
+ const parsedArgs = me._def.args.safeParse(args, params);
2584
3047
  if (!parsedArgs.success) {
2585
3048
  throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
2586
3049
  }
2587
- const result = fn(...parsedArgs.data);
2588
- const parsedReturns = this._def.returns.safeParse(result, params);
3050
+ const result = Reflect.apply(fn, this, parsedArgs.data);
3051
+ const parsedReturns = me._def.returns.safeParse(result, params);
2589
3052
  if (!parsedReturns.success) {
2590
3053
  throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
2591
3054
  }
@@ -2652,6 +3115,7 @@ var ZodLiteral = class extends ZodType {
2652
3115
  if (input.data !== this._def.value) {
2653
3116
  const ctx = this._getOrReturnCtx(input);
2654
3117
  addIssueToContext(ctx, {
3118
+ received: ctx.data,
2655
3119
  code: ZodIssueCode.invalid_literal,
2656
3120
  expected: this._def.value
2657
3121
  });
@@ -2680,6 +3144,10 @@ function createZodEnum(values, params) {
2680
3144
  }
2681
3145
  __name(createZodEnum, "createZodEnum");
2682
3146
  var ZodEnum = class extends ZodType {
3147
+ constructor() {
3148
+ super(...arguments);
3149
+ _ZodEnum_cache.set(this, void 0);
3150
+ }
2683
3151
  _parse(input) {
2684
3152
  if (typeof input.data !== "string") {
2685
3153
  const ctx = this._getOrReturnCtx(input);
@@ -2691,7 +3159,10 @@ var ZodEnum = class extends ZodType {
2691
3159
  });
2692
3160
  return INVALID;
2693
3161
  }
2694
- if (this._def.values.indexOf(input.data) === -1) {
3162
+ if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f")) {
3163
+ __classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values), "f");
3164
+ }
3165
+ if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f").has(input.data)) {
2695
3166
  const ctx = this._getOrReturnCtx(input);
2696
3167
  const expectedValues = this._def.values;
2697
3168
  addIssueToContext(ctx, {
@@ -2727,10 +3198,27 @@ var ZodEnum = class extends ZodType {
2727
3198
  }
2728
3199
  return enumValues;
2729
3200
  }
3201
+ extract(values, newDef = this._def) {
3202
+ return ZodEnum.create(values, {
3203
+ ...this._def,
3204
+ ...newDef
3205
+ });
3206
+ }
3207
+ exclude(values, newDef = this._def) {
3208
+ return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {
3209
+ ...this._def,
3210
+ ...newDef
3211
+ });
3212
+ }
2730
3213
  };
2731
3214
  __name(ZodEnum, "ZodEnum");
3215
+ _ZodEnum_cache = /* @__PURE__ */ new WeakMap();
2732
3216
  ZodEnum.create = createZodEnum;
2733
3217
  var ZodNativeEnum = class extends ZodType {
3218
+ constructor() {
3219
+ super(...arguments);
3220
+ _ZodNativeEnum_cache.set(this, void 0);
3221
+ }
2734
3222
  _parse(input) {
2735
3223
  const nativeEnumValues = util.getValidEnumValues(this._def.values);
2736
3224
  const ctx = this._getOrReturnCtx(input);
@@ -2743,7 +3231,10 @@ var ZodNativeEnum = class extends ZodType {
2743
3231
  });
2744
3232
  return INVALID;
2745
3233
  }
2746
- if (nativeEnumValues.indexOf(input.data) === -1) {
3234
+ if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f")) {
3235
+ __classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util.getValidEnumValues(this._def.values)), "f");
3236
+ }
3237
+ if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f").has(input.data)) {
2747
3238
  const expectedValues = util.objectValues(nativeEnumValues);
2748
3239
  addIssueToContext(ctx, {
2749
3240
  received: ctx.data,
@@ -2759,6 +3250,7 @@ var ZodNativeEnum = class extends ZodType {
2759
3250
  }
2760
3251
  };
2761
3252
  __name(ZodNativeEnum, "ZodNativeEnum");
3253
+ _ZodNativeEnum_cache = /* @__PURE__ */ new WeakMap();
2762
3254
  ZodNativeEnum.create = (values, params) => {
2763
3255
  return new ZodNativeEnum({
2764
3256
  values,
@@ -2767,6 +3259,9 @@ ZodNativeEnum.create = (values, params) => {
2767
3259
  });
2768
3260
  };
2769
3261
  var ZodPromise = class extends ZodType {
3262
+ unwrap() {
3263
+ return this._def.type;
3264
+ }
2770
3265
  _parse(input) {
2771
3266
  const { ctx } = this._processInputParams(input);
2772
3267
  if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
@@ -2804,24 +3299,6 @@ var ZodEffects = class extends ZodType {
2804
3299
  _parse(input) {
2805
3300
  const { status, ctx } = this._processInputParams(input);
2806
3301
  const effect = this._def.effect || null;
2807
- if (effect.type === "preprocess") {
2808
- const processed = effect.transform(ctx.data);
2809
- if (ctx.common.async) {
2810
- return Promise.resolve(processed).then((processed2) => {
2811
- return this._def.schema._parseAsync({
2812
- data: processed2,
2813
- path: ctx.path,
2814
- parent: ctx
2815
- });
2816
- });
2817
- } else {
2818
- return this._def.schema._parseSync({
2819
- data: processed,
2820
- path: ctx.path,
2821
- parent: ctx
2822
- });
2823
- }
2824
- }
2825
3302
  const checkCtx = {
2826
3303
  addIssue: (arg) => {
2827
3304
  addIssueToContext(ctx, arg);
@@ -2836,6 +3313,42 @@ var ZodEffects = class extends ZodType {
2836
3313
  }
2837
3314
  };
2838
3315
  checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
3316
+ if (effect.type === "preprocess") {
3317
+ const processed = effect.transform(ctx.data, checkCtx);
3318
+ if (ctx.common.async) {
3319
+ return Promise.resolve(processed).then(async (processed2) => {
3320
+ if (status.value === "aborted")
3321
+ return INVALID;
3322
+ const result = await this._def.schema._parseAsync({
3323
+ data: processed2,
3324
+ path: ctx.path,
3325
+ parent: ctx
3326
+ });
3327
+ if (result.status === "aborted")
3328
+ return INVALID;
3329
+ if (result.status === "dirty")
3330
+ return DIRTY(result.value);
3331
+ if (status.value === "dirty")
3332
+ return DIRTY(result.value);
3333
+ return result;
3334
+ });
3335
+ } else {
3336
+ if (status.value === "aborted")
3337
+ return INVALID;
3338
+ const result = this._def.schema._parseSync({
3339
+ data: processed,
3340
+ path: ctx.path,
3341
+ parent: ctx
3342
+ });
3343
+ if (result.status === "aborted")
3344
+ return INVALID;
3345
+ if (result.status === "dirty")
3346
+ return DIRTY(result.value);
3347
+ if (status.value === "dirty")
3348
+ return DIRTY(result.value);
3349
+ return result;
3350
+ }
3351
+ }
2839
3352
  if (effect.type === "refinement") {
2840
3353
  const executeRefinement = /* @__PURE__ */ __name((acc) => {
2841
3354
  const result = effect.refinement(acc, checkCtx);
@@ -2982,26 +3495,45 @@ ZodDefault.create = (type, params) => {
2982
3495
  var ZodCatch = class extends ZodType {
2983
3496
  _parse(input) {
2984
3497
  const { ctx } = this._processInputParams(input);
3498
+ const newCtx = {
3499
+ ...ctx,
3500
+ common: {
3501
+ ...ctx.common,
3502
+ issues: []
3503
+ }
3504
+ };
2985
3505
  const result = this._def.innerType._parse({
2986
- data: ctx.data,
2987
- path: ctx.path,
2988
- parent: ctx
3506
+ data: newCtx.data,
3507
+ path: newCtx.path,
3508
+ parent: {
3509
+ ...newCtx
3510
+ }
2989
3511
  });
2990
3512
  if (isAsync(result)) {
2991
3513
  return result.then((result2) => {
2992
3514
  return {
2993
3515
  status: "valid",
2994
- value: result2.status === "valid" ? result2.value : this._def.defaultValue()
3516
+ value: result2.status === "valid" ? result2.value : this._def.catchValue({
3517
+ get error() {
3518
+ return new ZodError(newCtx.common.issues);
3519
+ },
3520
+ input: newCtx.data
3521
+ })
2995
3522
  };
2996
3523
  });
2997
3524
  } else {
2998
3525
  return {
2999
3526
  status: "valid",
3000
- value: result.status === "valid" ? result.value : this._def.defaultValue()
3527
+ value: result.status === "valid" ? result.value : this._def.catchValue({
3528
+ get error() {
3529
+ return new ZodError(newCtx.common.issues);
3530
+ },
3531
+ input: newCtx.data
3532
+ })
3001
3533
  };
3002
3534
  }
3003
3535
  }
3004
- removeDefault() {
3536
+ removeCatch() {
3005
3537
  return this._def.innerType;
3006
3538
  }
3007
3539
  };
@@ -3010,7 +3542,7 @@ ZodCatch.create = (type, params) => {
3010
3542
  return new ZodCatch({
3011
3543
  innerType: type,
3012
3544
  typeName: ZodFirstPartyTypeKind.ZodCatch,
3013
- defaultValue: typeof params.default === "function" ? params.default : () => params.default,
3545
+ catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
3014
3546
  ...processCreateParams(params)
3015
3547
  });
3016
3548
  };
@@ -3108,17 +3640,43 @@ var ZodPipeline = class extends ZodType {
3108
3640
  }
3109
3641
  };
3110
3642
  __name(ZodPipeline, "ZodPipeline");
3111
- var custom = /* @__PURE__ */ __name((check, params = {}, fatal) => {
3643
+ var ZodReadonly = class extends ZodType {
3644
+ _parse(input) {
3645
+ const result = this._def.innerType._parse(input);
3646
+ const freeze = /* @__PURE__ */ __name((data) => {
3647
+ if (isValid(data)) {
3648
+ data.value = Object.freeze(data.value);
3649
+ }
3650
+ return data;
3651
+ }, "freeze");
3652
+ return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
3653
+ }
3654
+ unwrap() {
3655
+ return this._def.innerType;
3656
+ }
3657
+ };
3658
+ __name(ZodReadonly, "ZodReadonly");
3659
+ ZodReadonly.create = (type, params) => {
3660
+ return new ZodReadonly({
3661
+ innerType: type,
3662
+ typeName: ZodFirstPartyTypeKind.ZodReadonly,
3663
+ ...processCreateParams(params)
3664
+ });
3665
+ };
3666
+ function custom(check, params = {}, fatal) {
3112
3667
  if (check)
3113
3668
  return ZodAny.create().superRefine((data, ctx) => {
3669
+ var _a, _b;
3114
3670
  if (!check(data)) {
3115
- const p = typeof params === "function" ? params(data) : params;
3671
+ const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
3672
+ const _fatal = (_b = (_a = p.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
3116
3673
  const p2 = typeof p === "string" ? { message: p } : p;
3117
- ctx.addIssue({ code: "custom", ...p2, fatal });
3674
+ ctx.addIssue({ code: "custom", ...p2, fatal: _fatal });
3118
3675
  }
3119
3676
  });
3120
3677
  return ZodAny.create();
3121
- }, "custom");
3678
+ }
3679
+ __name(custom, "custom");
3122
3680
  var late = {
3123
3681
  object: ZodObject.lazycreate
3124
3682
  };
@@ -3159,10 +3717,11 @@ var ZodFirstPartyTypeKind;
3159
3717
  ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";
3160
3718
  ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";
3161
3719
  ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
3720
+ ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly";
3162
3721
  })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
3163
3722
  var instanceOfType = /* @__PURE__ */ __name((cls, params = {
3164
3723
  message: `Input not instance of ${cls.name}`
3165
- }) => custom((data) => data instanceof cls, params, true), "instanceOfType");
3724
+ }) => custom((data) => data instanceof cls, params), "instanceOfType");
3166
3725
  var stringType = ZodString.create;
3167
3726
  var numberType = ZodNumber.create;
3168
3727
  var nanType = ZodNaN.create;
@@ -3203,12 +3762,15 @@ var oboolean = /* @__PURE__ */ __name(() => booleanType().optional(), "oboolean"
3203
3762
  var coerce = {
3204
3763
  string: (arg) => ZodString.create({ ...arg, coerce: true }),
3205
3764
  number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
3206
- boolean: (arg) => ZodBoolean.create({ ...arg, coerce: true }),
3765
+ boolean: (arg) => ZodBoolean.create({
3766
+ ...arg,
3767
+ coerce: true
3768
+ }),
3207
3769
  bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
3208
3770
  date: (arg) => ZodDate.create({ ...arg, coerce: true })
3209
3771
  };
3210
3772
  var NEVER = INVALID;
3211
- var mod = /* @__PURE__ */ Object.freeze({
3773
+ var z = /* @__PURE__ */ Object.freeze({
3212
3774
  __proto__: null,
3213
3775
  defaultErrorMap: errorMap,
3214
3776
  setErrorMap,
@@ -3227,9 +3789,13 @@ var mod = /* @__PURE__ */ Object.freeze({
3227
3789
  get util() {
3228
3790
  return util;
3229
3791
  },
3792
+ get objectUtil() {
3793
+ return objectUtil;
3794
+ },
3230
3795
  ZodParsedType,
3231
3796
  getParsedType,
3232
3797
  ZodType,
3798
+ datetimeRegex,
3233
3799
  ZodString,
3234
3800
  ZodNumber,
3235
3801
  ZodBigInt,
@@ -3243,9 +3809,6 @@ var mod = /* @__PURE__ */ Object.freeze({
3243
3809
  ZodNever,
3244
3810
  ZodVoid,
3245
3811
  ZodArray,
3246
- get objectUtil() {
3247
- return objectUtil;
3248
- },
3249
3812
  ZodObject,
3250
3813
  ZodUnion,
3251
3814
  ZodDiscriminatedUnion,
@@ -3270,6 +3833,7 @@ var mod = /* @__PURE__ */ Object.freeze({
3270
3833
  BRAND,
3271
3834
  ZodBranded,
3272
3835
  ZodPipeline,
3836
+ ZodReadonly,
3273
3837
  custom,
3274
3838
  Schema: ZodType,
3275
3839
  ZodSchema: ZodType,
@@ -3324,12 +3888,12 @@ var mod = /* @__PURE__ */ Object.freeze({
3324
3888
  });
3325
3889
 
3326
3890
  // src/types.ts
3327
- var SigningAuthorityValidator = mod.object({
3328
- _id: mod.string().optional(),
3329
- ownerDid: mod.string(),
3330
- name: mod.string(),
3331
- did: mod.string().optional(),
3332
- endpoint: mod.string().optional()
3891
+ var SigningAuthorityValidator = z.object({
3892
+ _id: z.string().optional(),
3893
+ ownerDid: z.string(),
3894
+ name: z.string(),
3895
+ did: z.string().optional(),
3896
+ endpoint: z.string().optional()
3333
3897
  });
3334
3898
 
3335
3899
  // src/index.ts