@learncard/types 5.6.13 → 5.7.0

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.
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
19
- var __toCommonJS = (mod2) => __copyProps(__defProp({}, "__esModule", { value: true }), mod2);
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
20
 
21
21
  // src/index.ts
22
22
  var src_exports = {};
@@ -142,7 +142,7 @@ __export(src_exports, {
142
142
  });
143
143
  module.exports = __toCommonJS(src_exports);
144
144
 
145
- // ../../node_modules/.pnpm/zod@3.20.2/node_modules/zod/lib/index.mjs
145
+ // ../../node_modules/.pnpm/zod@3.23.8/node_modules/zod/lib/index.mjs
146
146
  var util;
147
147
  (function(util2) {
148
148
  util2.assertEqual = (val) => val;
@@ -204,6 +204,16 @@ var util;
204
204
  return value;
205
205
  };
206
206
  })(util || (util = {}));
207
+ var objectUtil;
208
+ (function(objectUtil2) {
209
+ objectUtil2.mergeShapes = (first, second) => {
210
+ return {
211
+ ...first,
212
+ ...second
213
+ // second overwrites first
214
+ };
215
+ };
216
+ })(objectUtil || (objectUtil = {}));
207
217
  var ZodParsedType = util.arrayToEnum([
208
218
  "string",
209
219
  "nan",
@@ -347,6 +357,11 @@ var ZodError = class extends Error {
347
357
  processError(this);
348
358
  return fieldErrors;
349
359
  }
360
+ static assert(value) {
361
+ if (!(value instanceof ZodError)) {
362
+ throw new Error(`Not a ZodError: ${value}`);
363
+ }
364
+ }
350
365
  toString() {
351
366
  return this.message;
352
367
  }
@@ -414,7 +429,12 @@ var errorMap = /* @__PURE__ */ __name((issue, _ctx) => {
414
429
  break;
415
430
  case ZodIssueCode.invalid_string:
416
431
  if (typeof issue.validation === "object") {
417
- if ("startsWith" in issue.validation) {
432
+ if ("includes" in issue.validation) {
433
+ message = `Invalid input: must include "${issue.validation.includes}"`;
434
+ if (typeof issue.validation.position === "number") {
435
+ message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;
436
+ }
437
+ } else if ("startsWith" in issue.validation) {
418
438
  message = `Invalid input: must start with "${issue.validation.startsWith}"`;
419
439
  } else if ("endsWith" in issue.validation) {
420
440
  message = `Invalid input: must end with "${issue.validation.endsWith}"`;
@@ -435,7 +455,7 @@ var errorMap = /* @__PURE__ */ __name((issue, _ctx) => {
435
455
  else if (issue.type === "number")
436
456
  message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
437
457
  else if (issue.type === "date")
438
- message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(issue.minimum)}`;
458
+ message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
439
459
  else
440
460
  message = "Invalid input";
441
461
  break;
@@ -446,8 +466,10 @@ var errorMap = /* @__PURE__ */ __name((issue, _ctx) => {
446
466
  message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
447
467
  else if (issue.type === "number")
448
468
  message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
469
+ else if (issue.type === "bigint")
470
+ message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
449
471
  else if (issue.type === "date")
450
- message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(issue.maximum)}`;
472
+ message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`;
451
473
  else
452
474
  message = "Invalid input";
453
475
  break;
@@ -485,6 +507,13 @@ var makeIssue = /* @__PURE__ */ __name((params) => {
485
507
  ...issueData,
486
508
  path: fullPath
487
509
  };
510
+ if (issueData.message !== void 0) {
511
+ return {
512
+ ...issueData,
513
+ path: fullPath,
514
+ message: issueData.message
515
+ };
516
+ }
488
517
  let errorMessage = "";
489
518
  const maps = errorMaps.filter((m) => !!m).slice().reverse();
490
519
  for (const map of maps) {
@@ -493,11 +522,12 @@ var makeIssue = /* @__PURE__ */ __name((params) => {
493
522
  return {
494
523
  ...issueData,
495
524
  path: fullPath,
496
- message: issueData.message || errorMessage
525
+ message: errorMessage
497
526
  };
498
527
  }, "makeIssue");
499
528
  var EMPTY_PATH = [];
500
529
  function addIssueToContext(ctx, issueData) {
530
+ const overrideMap = getErrorMap();
501
531
  const issue = makeIssue({
502
532
  issueData,
503
533
  data: ctx.data,
@@ -505,8 +535,8 @@ function addIssueToContext(ctx, issueData) {
505
535
  errorMaps: [
506
536
  ctx.common.contextualErrorMap,
507
537
  ctx.schemaErrorMap,
508
- getErrorMap(),
509
- errorMap
538
+ overrideMap,
539
+ overrideMap === errorMap ? void 0 : errorMap
510
540
  // then global default map
511
541
  ].filter((x) => !!x)
512
542
  });
@@ -539,9 +569,11 @@ var ParseStatus = class {
539
569
  static async mergeObjectAsync(status, pairs) {
540
570
  const syncPairs = [];
541
571
  for (const pair of pairs) {
572
+ const key = await pair.key;
573
+ const value = await pair.value;
542
574
  syncPairs.push({
543
- key: await pair.key,
544
- value: await pair.value
575
+ key,
576
+ value
545
577
  });
546
578
  }
547
579
  return ParseStatus.mergeObjectSync(status, syncPairs);
@@ -558,7 +590,7 @@ var ParseStatus = class {
558
590
  status.dirty();
559
591
  if (value.status === "dirty")
560
592
  status.dirty();
561
- if (typeof value.value !== "undefined" || pair.alwaysSet) {
593
+ if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) {
562
594
  finalObject[key.value] = value.value;
563
595
  }
564
596
  }
@@ -574,21 +606,49 @@ var OK = /* @__PURE__ */ __name((value) => ({ status: "valid", value }), "OK");
574
606
  var isAborted = /* @__PURE__ */ __name((x) => x.status === "aborted", "isAborted");
575
607
  var isDirty = /* @__PURE__ */ __name((x) => x.status === "dirty", "isDirty");
576
608
  var isValid = /* @__PURE__ */ __name((x) => x.status === "valid", "isValid");
577
- var isAsync = /* @__PURE__ */ __name((x) => typeof Promise !== void 0 && x instanceof Promise, "isAsync");
609
+ var isAsync = /* @__PURE__ */ __name((x) => typeof Promise !== "undefined" && x instanceof Promise, "isAsync");
610
+ function __classPrivateFieldGet(receiver, state, kind, f) {
611
+ if (kind === "a" && !f)
612
+ throw new TypeError("Private accessor was defined without a getter");
613
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
614
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
615
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
616
+ }
617
+ __name(__classPrivateFieldGet, "__classPrivateFieldGet");
618
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
619
+ if (kind === "m")
620
+ throw new TypeError("Private method is not writable");
621
+ if (kind === "a" && !f)
622
+ throw new TypeError("Private accessor was defined without a setter");
623
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
624
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
625
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
626
+ }
627
+ __name(__classPrivateFieldSet, "__classPrivateFieldSet");
578
628
  var errorUtil;
579
629
  (function(errorUtil2) {
580
630
  errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
581
631
  errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
582
632
  })(errorUtil || (errorUtil = {}));
633
+ var _ZodEnum_cache;
634
+ var _ZodNativeEnum_cache;
583
635
  var ParseInputLazyPath = class {
584
636
  constructor(parent, value, path, key) {
637
+ this._cachedPath = [];
585
638
  this.parent = parent;
586
639
  this.data = value;
587
640
  this._path = path;
588
641
  this._key = key;
589
642
  }
590
643
  get path() {
591
- return this._path.concat(this._key);
644
+ if (!this._cachedPath.length) {
645
+ if (this._key instanceof Array) {
646
+ this._cachedPath.push(...this._path, ...this._key);
647
+ } else {
648
+ this._cachedPath.push(...this._path, this._key);
649
+ }
650
+ }
651
+ return this._cachedPath;
592
652
  }
593
653
  };
594
654
  __name(ParseInputLazyPath, "ParseInputLazyPath");
@@ -599,8 +659,16 @@ var handleResult = /* @__PURE__ */ __name((ctx, result) => {
599
659
  if (!ctx.common.issues.length) {
600
660
  throw new Error("Validation failed but no issues detected.");
601
661
  }
602
- const error = new ZodError(ctx.common.issues);
603
- return { success: false, error };
662
+ return {
663
+ success: false,
664
+ get error() {
665
+ if (this._error)
666
+ return this._error;
667
+ const error = new ZodError(ctx.common.issues);
668
+ this._error = error;
669
+ return this._error;
670
+ }
671
+ };
604
672
  }
605
673
  }, "handleResult");
606
674
  function processCreateParams(params) {
@@ -613,12 +681,17 @@ function processCreateParams(params) {
613
681
  if (errorMap2)
614
682
  return { errorMap: errorMap2, description };
615
683
  const customMap = /* @__PURE__ */ __name((iss, ctx) => {
616
- if (iss.code !== "invalid_type")
617
- return { message: ctx.defaultError };
684
+ var _a, _b;
685
+ const { message } = params;
686
+ if (iss.code === "invalid_enum_value") {
687
+ return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
688
+ }
618
689
  if (typeof ctx.data === "undefined") {
619
- return { message: required_error !== null && required_error !== void 0 ? required_error : ctx.defaultError };
690
+ return { message: (_a = message !== null && message !== void 0 ? message : required_error) !== null && _a !== void 0 ? _a : ctx.defaultError };
620
691
  }
621
- return { message: invalid_type_error !== null && invalid_type_error !== void 0 ? invalid_type_error : ctx.defaultError };
692
+ if (iss.code !== "invalid_type")
693
+ return { message: ctx.defaultError };
694
+ return { message: (_b = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b !== void 0 ? _b : ctx.defaultError };
622
695
  }, "customMap");
623
696
  return { errorMap: customMap, description };
624
697
  }
@@ -648,6 +721,7 @@ var ZodType = class {
648
721
  this.catch = this.catch.bind(this);
649
722
  this.describe = this.describe.bind(this);
650
723
  this.pipe = this.pipe.bind(this);
724
+ this.readonly = this.readonly.bind(this);
651
725
  this.isNullable = this.isNullable.bind(this);
652
726
  this.isOptional = this.isOptional.bind(this);
653
727
  }
@@ -792,28 +866,29 @@ var ZodType = class {
792
866
  return this._refinement(refinement);
793
867
  }
794
868
  optional() {
795
- return ZodOptional.create(this);
869
+ return ZodOptional.create(this, this._def);
796
870
  }
797
871
  nullable() {
798
- return ZodNullable.create(this);
872
+ return ZodNullable.create(this, this._def);
799
873
  }
800
874
  nullish() {
801
- return this.optional().nullable();
875
+ return this.nullable().optional();
802
876
  }
803
877
  array() {
804
- return ZodArray.create(this);
878
+ return ZodArray.create(this, this._def);
805
879
  }
806
880
  promise() {
807
- return ZodPromise.create(this);
881
+ return ZodPromise.create(this, this._def);
808
882
  }
809
883
  or(option) {
810
- return ZodUnion.create([this, option]);
884
+ return ZodUnion.create([this, option], this._def);
811
885
  }
812
886
  and(incoming) {
813
- return ZodIntersection.create(this, incoming);
887
+ return ZodIntersection.create(this, incoming, this._def);
814
888
  }
815
889
  transform(transform) {
816
890
  return new ZodEffects({
891
+ ...processCreateParams(this._def),
817
892
  schema: this,
818
893
  typeName: ZodFirstPartyTypeKind.ZodEffects,
819
894
  effect: { type: "transform", transform }
@@ -822,6 +897,7 @@ var ZodType = class {
822
897
  default(def) {
823
898
  const defaultValueFunc = typeof def === "function" ? def : () => def;
824
899
  return new ZodDefault({
900
+ ...processCreateParams(this._def),
825
901
  innerType: this,
826
902
  defaultValue: defaultValueFunc,
827
903
  typeName: ZodFirstPartyTypeKind.ZodDefault
@@ -831,14 +907,15 @@ var ZodType = class {
831
907
  return new ZodBranded({
832
908
  typeName: ZodFirstPartyTypeKind.ZodBranded,
833
909
  type: this,
834
- ...processCreateParams(void 0)
910
+ ...processCreateParams(this._def)
835
911
  });
836
912
  }
837
913
  catch(def) {
838
- const defaultValueFunc = typeof def === "function" ? def : () => def;
914
+ const catchValueFunc = typeof def === "function" ? def : () => def;
839
915
  return new ZodCatch({
916
+ ...processCreateParams(this._def),
840
917
  innerType: this,
841
- defaultValue: defaultValueFunc,
918
+ catchValue: catchValueFunc,
842
919
  typeName: ZodFirstPartyTypeKind.ZodCatch
843
920
  });
844
921
  }
@@ -852,6 +929,9 @@ var ZodType = class {
852
929
  pipe(target) {
853
930
  return ZodPipeline.create(this, target);
854
931
  }
932
+ readonly() {
933
+ return ZodReadonly.create(this);
934
+ }
855
935
  isOptional() {
856
936
  return this.safeParse(void 0).success;
857
937
  }
@@ -861,43 +941,54 @@ var ZodType = class {
861
941
  };
862
942
  __name(ZodType, "ZodType");
863
943
  var cuidRegex = /^c[^\s-]{8,}$/i;
864
- 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;
865
- var emailRegex = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;
866
- var datetimeRegex = /* @__PURE__ */ __name((args) => {
944
+ var cuid2Regex = /^[0-9a-z]+$/;
945
+ var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;
946
+ 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;
947
+ var nanoidRegex = /^[a-z0-9_-]{21}$/i;
948
+ 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)?)??$/;
949
+ var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
950
+ var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
951
+ var emojiRegex;
952
+ 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])$/;
953
+ 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})))$/;
954
+ var base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
955
+ 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])))`;
956
+ var dateRegex = new RegExp(`^${dateRegexSource}$`);
957
+ function timeRegexSource(args) {
958
+ let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
867
959
  if (args.precision) {
868
- if (args.offset) {
869
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}:\\d{2})|Z)$`);
870
- } else {
871
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
872
- }
873
- } else if (args.precision === 0) {
874
- if (args.offset) {
875
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$`);
876
- } else {
877
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
878
- }
879
- } else {
880
- if (args.offset) {
881
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$`);
882
- } else {
883
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
884
- }
960
+ regex = `${regex}\\.\\d{${args.precision}}`;
961
+ } else if (args.precision == null) {
962
+ regex = `${regex}(\\.\\d+)?`;
885
963
  }
886
- }, "datetimeRegex");
887
- var ZodString = class extends ZodType {
888
- constructor() {
889
- super(...arguments);
890
- this._regex = (regex, validation, message) => this.refinement((data) => regex.test(data), {
891
- validation,
892
- code: ZodIssueCode.invalid_string,
893
- ...errorUtil.errToObj(message)
894
- });
895
- this.nonempty = (message) => this.min(1, errorUtil.errToObj(message));
896
- this.trim = () => new ZodString({
897
- ...this._def,
898
- checks: [...this._def.checks, { kind: "trim" }]
899
- });
964
+ return regex;
965
+ }
966
+ __name(timeRegexSource, "timeRegexSource");
967
+ function timeRegex(args) {
968
+ return new RegExp(`^${timeRegexSource(args)}$`);
969
+ }
970
+ __name(timeRegex, "timeRegex");
971
+ function datetimeRegex(args) {
972
+ let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
973
+ const opts = [];
974
+ opts.push(args.local ? `Z?` : `Z`);
975
+ if (args.offset)
976
+ opts.push(`([+-]\\d{2}:?\\d{2})`);
977
+ regex = `${regex}(${opts.join("|")})`;
978
+ return new RegExp(`^${regex}$`);
979
+ }
980
+ __name(datetimeRegex, "datetimeRegex");
981
+ function isValidIP(ip, version) {
982
+ if ((version === "v4" || !version) && ipv4Regex.test(ip)) {
983
+ return true;
900
984
  }
985
+ if ((version === "v6" || !version) && ipv6Regex.test(ip)) {
986
+ return true;
987
+ }
988
+ return false;
989
+ }
990
+ __name(isValidIP, "isValidIP");
991
+ var ZodString = class extends ZodType {
901
992
  _parse(input) {
902
993
  if (this._def.coerce) {
903
994
  input.data = String(input.data);
@@ -905,15 +996,11 @@ var ZodString = class extends ZodType {
905
996
  const parsedType = this._getType(input);
906
997
  if (parsedType !== ZodParsedType.string) {
907
998
  const ctx2 = this._getOrReturnCtx(input);
908
- addIssueToContext(
909
- ctx2,
910
- {
911
- code: ZodIssueCode.invalid_type,
912
- expected: ZodParsedType.string,
913
- received: ctx2.parsedType
914
- }
915
- //
916
- );
999
+ addIssueToContext(ctx2, {
1000
+ code: ZodIssueCode.invalid_type,
1001
+ expected: ZodParsedType.string,
1002
+ received: ctx2.parsedType
1003
+ });
917
1004
  return INVALID;
918
1005
  }
919
1006
  const status = new ParseStatus();
@@ -981,6 +1068,19 @@ var ZodString = class extends ZodType {
981
1068
  });
982
1069
  status.dirty();
983
1070
  }
1071
+ } else if (check.kind === "emoji") {
1072
+ if (!emojiRegex) {
1073
+ emojiRegex = new RegExp(_emojiRegex, "u");
1074
+ }
1075
+ if (!emojiRegex.test(input.data)) {
1076
+ ctx = this._getOrReturnCtx(input, ctx);
1077
+ addIssueToContext(ctx, {
1078
+ validation: "emoji",
1079
+ code: ZodIssueCode.invalid_string,
1080
+ message: check.message
1081
+ });
1082
+ status.dirty();
1083
+ }
984
1084
  } else if (check.kind === "uuid") {
985
1085
  if (!uuidRegex.test(input.data)) {
986
1086
  ctx = this._getOrReturnCtx(input, ctx);
@@ -991,6 +1091,16 @@ var ZodString = class extends ZodType {
991
1091
  });
992
1092
  status.dirty();
993
1093
  }
1094
+ } else if (check.kind === "nanoid") {
1095
+ if (!nanoidRegex.test(input.data)) {
1096
+ ctx = this._getOrReturnCtx(input, ctx);
1097
+ addIssueToContext(ctx, {
1098
+ validation: "nanoid",
1099
+ code: ZodIssueCode.invalid_string,
1100
+ message: check.message
1101
+ });
1102
+ status.dirty();
1103
+ }
994
1104
  } else if (check.kind === "cuid") {
995
1105
  if (!cuidRegex.test(input.data)) {
996
1106
  ctx = this._getOrReturnCtx(input, ctx);
@@ -1001,6 +1111,26 @@ var ZodString = class extends ZodType {
1001
1111
  });
1002
1112
  status.dirty();
1003
1113
  }
1114
+ } else if (check.kind === "cuid2") {
1115
+ if (!cuid2Regex.test(input.data)) {
1116
+ ctx = this._getOrReturnCtx(input, ctx);
1117
+ addIssueToContext(ctx, {
1118
+ validation: "cuid2",
1119
+ code: ZodIssueCode.invalid_string,
1120
+ message: check.message
1121
+ });
1122
+ status.dirty();
1123
+ }
1124
+ } else if (check.kind === "ulid") {
1125
+ if (!ulidRegex.test(input.data)) {
1126
+ ctx = this._getOrReturnCtx(input, ctx);
1127
+ addIssueToContext(ctx, {
1128
+ validation: "ulid",
1129
+ code: ZodIssueCode.invalid_string,
1130
+ message: check.message
1131
+ });
1132
+ status.dirty();
1133
+ }
1004
1134
  } else if (check.kind === "url") {
1005
1135
  try {
1006
1136
  new URL(input.data);
@@ -1027,6 +1157,20 @@ var ZodString = class extends ZodType {
1027
1157
  }
1028
1158
  } else if (check.kind === "trim") {
1029
1159
  input.data = input.data.trim();
1160
+ } else if (check.kind === "includes") {
1161
+ if (!input.data.includes(check.value, check.position)) {
1162
+ ctx = this._getOrReturnCtx(input, ctx);
1163
+ addIssueToContext(ctx, {
1164
+ code: ZodIssueCode.invalid_string,
1165
+ validation: { includes: check.value, position: check.position },
1166
+ message: check.message
1167
+ });
1168
+ status.dirty();
1169
+ }
1170
+ } else if (check.kind === "toLowerCase") {
1171
+ input.data = input.data.toLowerCase();
1172
+ } else if (check.kind === "toUpperCase") {
1173
+ input.data = input.data.toUpperCase();
1030
1174
  } else if (check.kind === "startsWith") {
1031
1175
  if (!input.data.startsWith(check.value)) {
1032
1176
  ctx = this._getOrReturnCtx(input, ctx);
@@ -1058,12 +1202,71 @@ var ZodString = class extends ZodType {
1058
1202
  });
1059
1203
  status.dirty();
1060
1204
  }
1205
+ } else if (check.kind === "date") {
1206
+ const regex = dateRegex;
1207
+ if (!regex.test(input.data)) {
1208
+ ctx = this._getOrReturnCtx(input, ctx);
1209
+ addIssueToContext(ctx, {
1210
+ code: ZodIssueCode.invalid_string,
1211
+ validation: "date",
1212
+ message: check.message
1213
+ });
1214
+ status.dirty();
1215
+ }
1216
+ } else if (check.kind === "time") {
1217
+ const regex = timeRegex(check);
1218
+ if (!regex.test(input.data)) {
1219
+ ctx = this._getOrReturnCtx(input, ctx);
1220
+ addIssueToContext(ctx, {
1221
+ code: ZodIssueCode.invalid_string,
1222
+ validation: "time",
1223
+ message: check.message
1224
+ });
1225
+ status.dirty();
1226
+ }
1227
+ } else if (check.kind === "duration") {
1228
+ if (!durationRegex.test(input.data)) {
1229
+ ctx = this._getOrReturnCtx(input, ctx);
1230
+ addIssueToContext(ctx, {
1231
+ validation: "duration",
1232
+ code: ZodIssueCode.invalid_string,
1233
+ message: check.message
1234
+ });
1235
+ status.dirty();
1236
+ }
1237
+ } else if (check.kind === "ip") {
1238
+ if (!isValidIP(input.data, check.version)) {
1239
+ ctx = this._getOrReturnCtx(input, ctx);
1240
+ addIssueToContext(ctx, {
1241
+ validation: "ip",
1242
+ code: ZodIssueCode.invalid_string,
1243
+ message: check.message
1244
+ });
1245
+ status.dirty();
1246
+ }
1247
+ } else if (check.kind === "base64") {
1248
+ if (!base64Regex.test(input.data)) {
1249
+ ctx = this._getOrReturnCtx(input, ctx);
1250
+ addIssueToContext(ctx, {
1251
+ validation: "base64",
1252
+ code: ZodIssueCode.invalid_string,
1253
+ message: check.message
1254
+ });
1255
+ status.dirty();
1256
+ }
1061
1257
  } else {
1062
1258
  util.assertNever(check);
1063
1259
  }
1064
1260
  }
1065
1261
  return { status: status.value, value: input.data };
1066
1262
  }
1263
+ _regex(regex, validation, message) {
1264
+ return this.refinement((data) => regex.test(data), {
1265
+ validation,
1266
+ code: ZodIssueCode.invalid_string,
1267
+ ...errorUtil.errToObj(message)
1268
+ });
1269
+ }
1067
1270
  _addCheck(check) {
1068
1271
  return new ZodString({
1069
1272
  ...this._def,
@@ -1076,19 +1279,38 @@ var ZodString = class extends ZodType {
1076
1279
  url(message) {
1077
1280
  return this._addCheck({ kind: "url", ...errorUtil.errToObj(message) });
1078
1281
  }
1282
+ emoji(message) {
1283
+ return this._addCheck({ kind: "emoji", ...errorUtil.errToObj(message) });
1284
+ }
1079
1285
  uuid(message) {
1080
1286
  return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) });
1081
1287
  }
1288
+ nanoid(message) {
1289
+ return this._addCheck({ kind: "nanoid", ...errorUtil.errToObj(message) });
1290
+ }
1082
1291
  cuid(message) {
1083
1292
  return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
1084
1293
  }
1294
+ cuid2(message) {
1295
+ return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
1296
+ }
1297
+ ulid(message) {
1298
+ return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) });
1299
+ }
1300
+ base64(message) {
1301
+ return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
1302
+ }
1303
+ ip(options) {
1304
+ return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
1305
+ }
1085
1306
  datetime(options) {
1086
- var _a;
1307
+ var _a, _b;
1087
1308
  if (typeof options === "string") {
1088
1309
  return this._addCheck({
1089
1310
  kind: "datetime",
1090
1311
  precision: null,
1091
1312
  offset: false,
1313
+ local: false,
1092
1314
  message: options
1093
1315
  });
1094
1316
  }
@@ -1096,9 +1318,30 @@ var ZodString = class extends ZodType {
1096
1318
  kind: "datetime",
1097
1319
  precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
1098
1320
  offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
1321
+ local: (_b = options === null || options === void 0 ? void 0 : options.local) !== null && _b !== void 0 ? _b : false,
1322
+ ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
1323
+ });
1324
+ }
1325
+ date(message) {
1326
+ return this._addCheck({ kind: "date", message });
1327
+ }
1328
+ time(options) {
1329
+ if (typeof options === "string") {
1330
+ return this._addCheck({
1331
+ kind: "time",
1332
+ precision: null,
1333
+ message: options
1334
+ });
1335
+ }
1336
+ return this._addCheck({
1337
+ kind: "time",
1338
+ precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
1099
1339
  ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
1100
1340
  });
1101
1341
  }
1342
+ duration(message) {
1343
+ return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) });
1344
+ }
1102
1345
  regex(regex, message) {
1103
1346
  return this._addCheck({
1104
1347
  kind: "regex",
@@ -1106,6 +1349,14 @@ var ZodString = class extends ZodType {
1106
1349
  ...errorUtil.errToObj(message)
1107
1350
  });
1108
1351
  }
1352
+ includes(value, options) {
1353
+ return this._addCheck({
1354
+ kind: "includes",
1355
+ value,
1356
+ position: options === null || options === void 0 ? void 0 : options.position,
1357
+ ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
1358
+ });
1359
+ }
1109
1360
  startsWith(value, message) {
1110
1361
  return this._addCheck({
1111
1362
  kind: "startsWith",
@@ -1141,21 +1392,73 @@ var ZodString = class extends ZodType {
1141
1392
  ...errorUtil.errToObj(message)
1142
1393
  });
1143
1394
  }
1395
+ /**
1396
+ * @deprecated Use z.string().min(1) instead.
1397
+ * @see {@link ZodString.min}
1398
+ */
1399
+ nonempty(message) {
1400
+ return this.min(1, errorUtil.errToObj(message));
1401
+ }
1402
+ trim() {
1403
+ return new ZodString({
1404
+ ...this._def,
1405
+ checks: [...this._def.checks, { kind: "trim" }]
1406
+ });
1407
+ }
1408
+ toLowerCase() {
1409
+ return new ZodString({
1410
+ ...this._def,
1411
+ checks: [...this._def.checks, { kind: "toLowerCase" }]
1412
+ });
1413
+ }
1414
+ toUpperCase() {
1415
+ return new ZodString({
1416
+ ...this._def,
1417
+ checks: [...this._def.checks, { kind: "toUpperCase" }]
1418
+ });
1419
+ }
1144
1420
  get isDatetime() {
1145
1421
  return !!this._def.checks.find((ch) => ch.kind === "datetime");
1146
1422
  }
1423
+ get isDate() {
1424
+ return !!this._def.checks.find((ch) => ch.kind === "date");
1425
+ }
1426
+ get isTime() {
1427
+ return !!this._def.checks.find((ch) => ch.kind === "time");
1428
+ }
1429
+ get isDuration() {
1430
+ return !!this._def.checks.find((ch) => ch.kind === "duration");
1431
+ }
1147
1432
  get isEmail() {
1148
1433
  return !!this._def.checks.find((ch) => ch.kind === "email");
1149
1434
  }
1150
1435
  get isURL() {
1151
1436
  return !!this._def.checks.find((ch) => ch.kind === "url");
1152
1437
  }
1438
+ get isEmoji() {
1439
+ return !!this._def.checks.find((ch) => ch.kind === "emoji");
1440
+ }
1153
1441
  get isUUID() {
1154
1442
  return !!this._def.checks.find((ch) => ch.kind === "uuid");
1155
1443
  }
1444
+ get isNANOID() {
1445
+ return !!this._def.checks.find((ch) => ch.kind === "nanoid");
1446
+ }
1156
1447
  get isCUID() {
1157
1448
  return !!this._def.checks.find((ch) => ch.kind === "cuid");
1158
1449
  }
1450
+ get isCUID2() {
1451
+ return !!this._def.checks.find((ch) => ch.kind === "cuid2");
1452
+ }
1453
+ get isULID() {
1454
+ return !!this._def.checks.find((ch) => ch.kind === "ulid");
1455
+ }
1456
+ get isIP() {
1457
+ return !!this._def.checks.find((ch) => ch.kind === "ip");
1458
+ }
1459
+ get isBase64() {
1460
+ return !!this._def.checks.find((ch) => ch.kind === "base64");
1461
+ }
1159
1462
  get minLength() {
1160
1463
  let min = null;
1161
1464
  for (const ch of this._def.checks) {
@@ -1367,6 +1670,19 @@ var ZodNumber = class extends ZodType {
1367
1670
  message: errorUtil.toString(message)
1368
1671
  });
1369
1672
  }
1673
+ safe(message) {
1674
+ return this._addCheck({
1675
+ kind: "min",
1676
+ inclusive: true,
1677
+ value: Number.MIN_SAFE_INTEGER,
1678
+ message: errorUtil.toString(message)
1679
+ })._addCheck({
1680
+ kind: "max",
1681
+ inclusive: true,
1682
+ value: Number.MAX_SAFE_INTEGER,
1683
+ message: errorUtil.toString(message)
1684
+ });
1685
+ }
1370
1686
  get minValue() {
1371
1687
  let min = null;
1372
1688
  for (const ch of this._def.checks) {
@@ -1388,7 +1704,22 @@ var ZodNumber = class extends ZodType {
1388
1704
  return max;
1389
1705
  }
1390
1706
  get isInt() {
1391
- return !!this._def.checks.find((ch) => ch.kind === "int");
1707
+ return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
1708
+ }
1709
+ get isFinite() {
1710
+ let max = null, min = null;
1711
+ for (const ch of this._def.checks) {
1712
+ if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
1713
+ return true;
1714
+ } else if (ch.kind === "min") {
1715
+ if (min === null || ch.value > min)
1716
+ min = ch.value;
1717
+ } else if (ch.kind === "max") {
1718
+ if (max === null || ch.value < max)
1719
+ max = ch.value;
1720
+ }
1721
+ }
1722
+ return Number.isFinite(min) && Number.isFinite(max);
1392
1723
  }
1393
1724
  };
1394
1725
  __name(ZodNumber, "ZodNumber");
@@ -1401,27 +1732,167 @@ ZodNumber.create = (params) => {
1401
1732
  });
1402
1733
  };
1403
1734
  var ZodBigInt = class extends ZodType {
1735
+ constructor() {
1736
+ super(...arguments);
1737
+ this.min = this.gte;
1738
+ this.max = this.lte;
1739
+ }
1404
1740
  _parse(input) {
1405
1741
  if (this._def.coerce) {
1406
1742
  input.data = BigInt(input.data);
1407
1743
  }
1408
1744
  const parsedType = this._getType(input);
1409
1745
  if (parsedType !== ZodParsedType.bigint) {
1410
- const ctx = this._getOrReturnCtx(input);
1411
- addIssueToContext(ctx, {
1746
+ const ctx2 = this._getOrReturnCtx(input);
1747
+ addIssueToContext(ctx2, {
1412
1748
  code: ZodIssueCode.invalid_type,
1413
1749
  expected: ZodParsedType.bigint,
1414
- received: ctx.parsedType
1750
+ received: ctx2.parsedType
1415
1751
  });
1416
1752
  return INVALID;
1417
1753
  }
1418
- return OK(input.data);
1754
+ let ctx = void 0;
1755
+ const status = new ParseStatus();
1756
+ for (const check of this._def.checks) {
1757
+ if (check.kind === "min") {
1758
+ const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
1759
+ if (tooSmall) {
1760
+ ctx = this._getOrReturnCtx(input, ctx);
1761
+ addIssueToContext(ctx, {
1762
+ code: ZodIssueCode.too_small,
1763
+ type: "bigint",
1764
+ minimum: check.value,
1765
+ inclusive: check.inclusive,
1766
+ message: check.message
1767
+ });
1768
+ status.dirty();
1769
+ }
1770
+ } else if (check.kind === "max") {
1771
+ const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
1772
+ if (tooBig) {
1773
+ ctx = this._getOrReturnCtx(input, ctx);
1774
+ addIssueToContext(ctx, {
1775
+ code: ZodIssueCode.too_big,
1776
+ type: "bigint",
1777
+ maximum: check.value,
1778
+ inclusive: check.inclusive,
1779
+ message: check.message
1780
+ });
1781
+ status.dirty();
1782
+ }
1783
+ } else if (check.kind === "multipleOf") {
1784
+ if (input.data % check.value !== BigInt(0)) {
1785
+ ctx = this._getOrReturnCtx(input, ctx);
1786
+ addIssueToContext(ctx, {
1787
+ code: ZodIssueCode.not_multiple_of,
1788
+ multipleOf: check.value,
1789
+ message: check.message
1790
+ });
1791
+ status.dirty();
1792
+ }
1793
+ } else {
1794
+ util.assertNever(check);
1795
+ }
1796
+ }
1797
+ return { status: status.value, value: input.data };
1798
+ }
1799
+ gte(value, message) {
1800
+ return this.setLimit("min", value, true, errorUtil.toString(message));
1801
+ }
1802
+ gt(value, message) {
1803
+ return this.setLimit("min", value, false, errorUtil.toString(message));
1804
+ }
1805
+ lte(value, message) {
1806
+ return this.setLimit("max", value, true, errorUtil.toString(message));
1807
+ }
1808
+ lt(value, message) {
1809
+ return this.setLimit("max", value, false, errorUtil.toString(message));
1810
+ }
1811
+ setLimit(kind, value, inclusive, message) {
1812
+ return new ZodBigInt({
1813
+ ...this._def,
1814
+ checks: [
1815
+ ...this._def.checks,
1816
+ {
1817
+ kind,
1818
+ value,
1819
+ inclusive,
1820
+ message: errorUtil.toString(message)
1821
+ }
1822
+ ]
1823
+ });
1824
+ }
1825
+ _addCheck(check) {
1826
+ return new ZodBigInt({
1827
+ ...this._def,
1828
+ checks: [...this._def.checks, check]
1829
+ });
1830
+ }
1831
+ positive(message) {
1832
+ return this._addCheck({
1833
+ kind: "min",
1834
+ value: BigInt(0),
1835
+ inclusive: false,
1836
+ message: errorUtil.toString(message)
1837
+ });
1838
+ }
1839
+ negative(message) {
1840
+ return this._addCheck({
1841
+ kind: "max",
1842
+ value: BigInt(0),
1843
+ inclusive: false,
1844
+ message: errorUtil.toString(message)
1845
+ });
1846
+ }
1847
+ nonpositive(message) {
1848
+ return this._addCheck({
1849
+ kind: "max",
1850
+ value: BigInt(0),
1851
+ inclusive: true,
1852
+ message: errorUtil.toString(message)
1853
+ });
1854
+ }
1855
+ nonnegative(message) {
1856
+ return this._addCheck({
1857
+ kind: "min",
1858
+ value: BigInt(0),
1859
+ inclusive: true,
1860
+ message: errorUtil.toString(message)
1861
+ });
1862
+ }
1863
+ multipleOf(value, message) {
1864
+ return this._addCheck({
1865
+ kind: "multipleOf",
1866
+ value,
1867
+ message: errorUtil.toString(message)
1868
+ });
1869
+ }
1870
+ get minValue() {
1871
+ let min = null;
1872
+ for (const ch of this._def.checks) {
1873
+ if (ch.kind === "min") {
1874
+ if (min === null || ch.value > min)
1875
+ min = ch.value;
1876
+ }
1877
+ }
1878
+ return min;
1879
+ }
1880
+ get maxValue() {
1881
+ let max = null;
1882
+ for (const ch of this._def.checks) {
1883
+ if (ch.kind === "max") {
1884
+ if (max === null || ch.value < max)
1885
+ max = ch.value;
1886
+ }
1887
+ }
1888
+ return max;
1419
1889
  }
1420
1890
  };
1421
1891
  __name(ZodBigInt, "ZodBigInt");
1422
1892
  ZodBigInt.create = (params) => {
1423
1893
  var _a;
1424
1894
  return new ZodBigInt({
1895
+ checks: [],
1425
1896
  typeName: ZodFirstPartyTypeKind.ZodBigInt,
1426
1897
  coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
1427
1898
  ...processCreateParams(params)
@@ -1756,13 +2227,13 @@ var ZodArray = class extends ZodType {
1756
2227
  }
1757
2228
  }
1758
2229
  if (ctx.common.async) {
1759
- return Promise.all(ctx.data.map((item, i) => {
2230
+ return Promise.all([...ctx.data].map((item, i) => {
1760
2231
  return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
1761
2232
  })).then((result2) => {
1762
2233
  return ParseStatus.mergeArray(status, result2);
1763
2234
  });
1764
2235
  }
1765
- const result = ctx.data.map((item, i) => {
2236
+ const result = [...ctx.data].map((item, i) => {
1766
2237
  return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
1767
2238
  });
1768
2239
  return ParseStatus.mergeArray(status, result);
@@ -1803,25 +2274,6 @@ ZodArray.create = (schema, params) => {
1803
2274
  ...processCreateParams(params)
1804
2275
  });
1805
2276
  };
1806
- var objectUtil;
1807
- (function(objectUtil2) {
1808
- objectUtil2.mergeShapes = (first, second) => {
1809
- return {
1810
- ...first,
1811
- ...second
1812
- // second overwrites first
1813
- };
1814
- };
1815
- })(objectUtil || (objectUtil = {}));
1816
- var AugmentFactory = /* @__PURE__ */ __name((def) => (augmentation) => {
1817
- return new ZodObject({
1818
- ...def,
1819
- shape: () => ({
1820
- ...def.shape(),
1821
- ...augmentation
1822
- })
1823
- });
1824
- }, "AugmentFactory");
1825
2277
  function deepPartialify(schema) {
1826
2278
  if (schema instanceof ZodObject) {
1827
2279
  const newShape = {};
@@ -1834,7 +2286,10 @@ function deepPartialify(schema) {
1834
2286
  shape: () => newShape
1835
2287
  });
1836
2288
  } else if (schema instanceof ZodArray) {
1837
- return ZodArray.create(deepPartialify(schema.element));
2289
+ return new ZodArray({
2290
+ ...schema._def,
2291
+ type: deepPartialify(schema.element)
2292
+ });
1838
2293
  } else if (schema instanceof ZodOptional) {
1839
2294
  return ZodOptional.create(deepPartialify(schema.unwrap()));
1840
2295
  } else if (schema instanceof ZodNullable) {
@@ -1851,8 +2306,7 @@ var ZodObject = class extends ZodType {
1851
2306
  super(...arguments);
1852
2307
  this._cached = null;
1853
2308
  this.nonstrict = this.passthrough;
1854
- this.augment = AugmentFactory(this._def);
1855
- this.extend = AugmentFactory(this._def);
2309
+ this.augment = this.extend;
1856
2310
  }
1857
2311
  _getCached() {
1858
2312
  if (this._cached !== null)
@@ -1933,9 +2387,10 @@ var ZodObject = class extends ZodType {
1933
2387
  const syncPairs = [];
1934
2388
  for (const pair of pairs) {
1935
2389
  const key = await pair.key;
2390
+ const value = await pair.value;
1936
2391
  syncPairs.push({
1937
2392
  key,
1938
- value: await pair.value,
2393
+ value,
1939
2394
  alwaysSet: pair.alwaysSet
1940
2395
  });
1941
2396
  }
@@ -1982,8 +2437,31 @@ var ZodObject = class extends ZodType {
1982
2437
  unknownKeys: "passthrough"
1983
2438
  });
1984
2439
  }
1985
- setKey(key, schema) {
1986
- return this.augment({ [key]: schema });
2440
+ // const AugmentFactory =
2441
+ // <Def extends ZodObjectDef>(def: Def) =>
2442
+ // <Augmentation extends ZodRawShape>(
2443
+ // augmentation: Augmentation
2444
+ // ): ZodObject<
2445
+ // extendShape<ReturnType<Def["shape"]>, Augmentation>,
2446
+ // Def["unknownKeys"],
2447
+ // Def["catchall"]
2448
+ // > => {
2449
+ // return new ZodObject({
2450
+ // ...def,
2451
+ // shape: () => ({
2452
+ // ...def.shape(),
2453
+ // ...augmentation,
2454
+ // }),
2455
+ // }) as any;
2456
+ // };
2457
+ extend(augmentation) {
2458
+ return new ZodObject({
2459
+ ...this._def,
2460
+ shape: () => ({
2461
+ ...this._def.shape(),
2462
+ ...augmentation
2463
+ })
2464
+ });
1987
2465
  }
1988
2466
  /**
1989
2467
  * Prior to zod@1.0.12 there was a bug in the
@@ -1994,11 +2472,73 @@ var ZodObject = class extends ZodType {
1994
2472
  const merged = new ZodObject({
1995
2473
  unknownKeys: merging._def.unknownKeys,
1996
2474
  catchall: merging._def.catchall,
1997
- shape: () => objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
2475
+ shape: () => ({
2476
+ ...this._def.shape(),
2477
+ ...merging._def.shape()
2478
+ }),
1998
2479
  typeName: ZodFirstPartyTypeKind.ZodObject
1999
2480
  });
2000
2481
  return merged;
2001
2482
  }
2483
+ // merge<
2484
+ // Incoming extends AnyZodObject,
2485
+ // Augmentation extends Incoming["shape"],
2486
+ // NewOutput extends {
2487
+ // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
2488
+ // ? Augmentation[k]["_output"]
2489
+ // : k extends keyof Output
2490
+ // ? Output[k]
2491
+ // : never;
2492
+ // },
2493
+ // NewInput extends {
2494
+ // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
2495
+ // ? Augmentation[k]["_input"]
2496
+ // : k extends keyof Input
2497
+ // ? Input[k]
2498
+ // : never;
2499
+ // }
2500
+ // >(
2501
+ // merging: Incoming
2502
+ // ): ZodObject<
2503
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
2504
+ // Incoming["_def"]["unknownKeys"],
2505
+ // Incoming["_def"]["catchall"],
2506
+ // NewOutput,
2507
+ // NewInput
2508
+ // > {
2509
+ // const merged: any = new ZodObject({
2510
+ // unknownKeys: merging._def.unknownKeys,
2511
+ // catchall: merging._def.catchall,
2512
+ // shape: () =>
2513
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
2514
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
2515
+ // }) as any;
2516
+ // return merged;
2517
+ // }
2518
+ setKey(key, schema) {
2519
+ return this.augment({ [key]: schema });
2520
+ }
2521
+ // merge<Incoming extends AnyZodObject>(
2522
+ // merging: Incoming
2523
+ // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
2524
+ // ZodObject<
2525
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
2526
+ // Incoming["_def"]["unknownKeys"],
2527
+ // Incoming["_def"]["catchall"]
2528
+ // > {
2529
+ // // const mergedShape = objectUtil.mergeShapes(
2530
+ // // this._def.shape(),
2531
+ // // merging._def.shape()
2532
+ // // );
2533
+ // const merged: any = new ZodObject({
2534
+ // unknownKeys: merging._def.unknownKeys,
2535
+ // catchall: merging._def.catchall,
2536
+ // shape: () =>
2537
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
2538
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
2539
+ // }) as any;
2540
+ // return merged;
2541
+ // }
2002
2542
  catchall(index) {
2003
2543
  return new ZodObject({
2004
2544
  ...this._def,
@@ -2007,9 +2547,10 @@ var ZodObject = class extends ZodType {
2007
2547
  }
2008
2548
  pick(mask) {
2009
2549
  const shape = {};
2010
- util.objectKeys(mask).map((key) => {
2011
- if (this.shape[key])
2550
+ util.objectKeys(mask).forEach((key) => {
2551
+ if (mask[key] && this.shape[key]) {
2012
2552
  shape[key] = this.shape[key];
2553
+ }
2013
2554
  });
2014
2555
  return new ZodObject({
2015
2556
  ...this._def,
@@ -2018,8 +2559,8 @@ var ZodObject = class extends ZodType {
2018
2559
  }
2019
2560
  omit(mask) {
2020
2561
  const shape = {};
2021
- util.objectKeys(this.shape).map((key) => {
2022
- if (util.objectKeys(mask).indexOf(key) === -1) {
2562
+ util.objectKeys(this.shape).forEach((key) => {
2563
+ if (!mask[key]) {
2023
2564
  shape[key] = this.shape[key];
2024
2565
  }
2025
2566
  });
@@ -2028,29 +2569,22 @@ var ZodObject = class extends ZodType {
2028
2569
  shape: () => shape
2029
2570
  });
2030
2571
  }
2572
+ /**
2573
+ * @deprecated
2574
+ */
2031
2575
  deepPartial() {
2032
2576
  return deepPartialify(this);
2033
2577
  }
2034
2578
  partial(mask) {
2035
2579
  const newShape = {};
2036
- if (mask) {
2037
- util.objectKeys(this.shape).map((key) => {
2038
- if (util.objectKeys(mask).indexOf(key) === -1) {
2039
- newShape[key] = this.shape[key];
2040
- } else {
2041
- newShape[key] = this.shape[key].optional();
2042
- }
2043
- });
2044
- return new ZodObject({
2045
- ...this._def,
2046
- shape: () => newShape
2047
- });
2048
- } else {
2049
- for (const key in this.shape) {
2050
- const fieldSchema = this.shape[key];
2580
+ util.objectKeys(this.shape).forEach((key) => {
2581
+ const fieldSchema = this.shape[key];
2582
+ if (mask && !mask[key]) {
2583
+ newShape[key] = fieldSchema;
2584
+ } else {
2051
2585
  newShape[key] = fieldSchema.optional();
2052
2586
  }
2053
- }
2587
+ });
2054
2588
  return new ZodObject({
2055
2589
  ...this._def,
2056
2590
  shape: () => newShape
@@ -2058,21 +2592,10 @@ var ZodObject = class extends ZodType {
2058
2592
  }
2059
2593
  required(mask) {
2060
2594
  const newShape = {};
2061
- if (mask) {
2062
- util.objectKeys(this.shape).map((key) => {
2063
- if (util.objectKeys(mask).indexOf(key) === -1) {
2064
- newShape[key] = this.shape[key];
2065
- } else {
2066
- const fieldSchema = this.shape[key];
2067
- let newField = fieldSchema;
2068
- while (newField instanceof ZodOptional) {
2069
- newField = newField._def.innerType;
2070
- }
2071
- newShape[key] = newField;
2072
- }
2073
- });
2074
- } else {
2075
- for (const key in this.shape) {
2595
+ util.objectKeys(this.shape).forEach((key) => {
2596
+ if (mask && !mask[key]) {
2597
+ newShape[key] = this.shape[key];
2598
+ } else {
2076
2599
  const fieldSchema = this.shape[key];
2077
2600
  let newField = fieldSchema;
2078
2601
  while (newField instanceof ZodOptional) {
@@ -2080,7 +2603,7 @@ var ZodObject = class extends ZodType {
2080
2603
  }
2081
2604
  newShape[key] = newField;
2082
2605
  }
2083
- }
2606
+ });
2084
2607
  return new ZodObject({
2085
2608
  ...this._def,
2086
2609
  shape: () => newShape
@@ -2221,15 +2744,25 @@ var getDiscriminator = /* @__PURE__ */ __name((type) => {
2221
2744
  } else if (type instanceof ZodEnum) {
2222
2745
  return type.options;
2223
2746
  } else if (type instanceof ZodNativeEnum) {
2224
- return Object.keys(type.enum);
2747
+ return util.objectValues(type.enum);
2225
2748
  } else if (type instanceof ZodDefault) {
2226
2749
  return getDiscriminator(type._def.innerType);
2227
2750
  } else if (type instanceof ZodUndefined) {
2228
2751
  return [void 0];
2229
2752
  } else if (type instanceof ZodNull) {
2230
2753
  return [null];
2754
+ } else if (type instanceof ZodOptional) {
2755
+ return [void 0, ...getDiscriminator(type.unwrap())];
2756
+ } else if (type instanceof ZodNullable) {
2757
+ return [null, ...getDiscriminator(type.unwrap())];
2758
+ } else if (type instanceof ZodBranded) {
2759
+ return getDiscriminator(type.unwrap());
2760
+ } else if (type instanceof ZodReadonly) {
2761
+ return getDiscriminator(type.unwrap());
2762
+ } else if (type instanceof ZodCatch) {
2763
+ return getDiscriminator(type._def.innerType);
2231
2764
  } else {
2232
- return null;
2765
+ return [];
2233
2766
  }
2234
2767
  }, "getDiscriminator");
2235
2768
  var ZodDiscriminatedUnion = class extends ZodType {
@@ -2289,7 +2822,7 @@ var ZodDiscriminatedUnion = class extends ZodType {
2289
2822
  const optionsMap = /* @__PURE__ */ new Map();
2290
2823
  for (const type of options) {
2291
2824
  const discriminatorValues = getDiscriminator(type.shape[discriminator]);
2292
- if (!discriminatorValues) {
2825
+ if (!discriminatorValues.length) {
2293
2826
  throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
2294
2827
  }
2295
2828
  for (const value of discriminatorValues) {
@@ -2434,7 +2967,7 @@ var ZodTuple = class extends ZodType {
2434
2967
  });
2435
2968
  status.dirty();
2436
2969
  }
2437
- const items = ctx.data.map((item, itemIndex) => {
2970
+ const items = [...ctx.data].map((item, itemIndex) => {
2438
2971
  const schema = this._def.items[itemIndex] || this._def.rest;
2439
2972
  if (!schema)
2440
2973
  return null;
@@ -2493,7 +3026,8 @@ var ZodRecord = class extends ZodType {
2493
3026
  for (const key in ctx.data) {
2494
3027
  pairs.push({
2495
3028
  key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
2496
- value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key))
3029
+ value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),
3030
+ alwaysSet: key in ctx.data
2497
3031
  });
2498
3032
  }
2499
3033
  if (ctx.common.async) {
@@ -2524,6 +3058,12 @@ var ZodRecord = class extends ZodType {
2524
3058
  };
2525
3059
  __name(ZodRecord, "ZodRecord");
2526
3060
  var ZodMap = class extends ZodType {
3061
+ get keySchema() {
3062
+ return this._def.keyType;
3063
+ }
3064
+ get valueSchema() {
3065
+ return this._def.valueType;
3066
+ }
2527
3067
  _parse(input) {
2528
3068
  const { status, ctx } = this._processInputParams(input);
2529
3069
  if (ctx.parsedType !== ZodParsedType.map) {
@@ -2723,27 +3263,29 @@ var ZodFunction = class extends ZodType {
2723
3263
  const params = { errorMap: ctx.common.contextualErrorMap };
2724
3264
  const fn = ctx.data;
2725
3265
  if (this._def.returns instanceof ZodPromise) {
2726
- return OK(async (...args) => {
3266
+ const me = this;
3267
+ return OK(async function(...args) {
2727
3268
  const error = new ZodError([]);
2728
- const parsedArgs = await this._def.args.parseAsync(args, params).catch((e) => {
3269
+ const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
2729
3270
  error.addIssue(makeArgsIssue(args, e));
2730
3271
  throw error;
2731
3272
  });
2732
- const result = await fn(...parsedArgs);
2733
- const parsedReturns = await this._def.returns._def.type.parseAsync(result, params).catch((e) => {
3273
+ const result = await Reflect.apply(fn, this, parsedArgs);
3274
+ const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e) => {
2734
3275
  error.addIssue(makeReturnsIssue(result, e));
2735
3276
  throw error;
2736
3277
  });
2737
3278
  return parsedReturns;
2738
3279
  });
2739
3280
  } else {
2740
- return OK((...args) => {
2741
- const parsedArgs = this._def.args.safeParse(args, params);
3281
+ const me = this;
3282
+ return OK(function(...args) {
3283
+ const parsedArgs = me._def.args.safeParse(args, params);
2742
3284
  if (!parsedArgs.success) {
2743
3285
  throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
2744
3286
  }
2745
- const result = fn(...parsedArgs.data);
2746
- const parsedReturns = this._def.returns.safeParse(result, params);
3287
+ const result = Reflect.apply(fn, this, parsedArgs.data);
3288
+ const parsedReturns = me._def.returns.safeParse(result, params);
2747
3289
  if (!parsedReturns.success) {
2748
3290
  throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
2749
3291
  }
@@ -2810,6 +3352,7 @@ var ZodLiteral = class extends ZodType {
2810
3352
  if (input.data !== this._def.value) {
2811
3353
  const ctx = this._getOrReturnCtx(input);
2812
3354
  addIssueToContext(ctx, {
3355
+ received: ctx.data,
2813
3356
  code: ZodIssueCode.invalid_literal,
2814
3357
  expected: this._def.value
2815
3358
  });
@@ -2838,6 +3381,10 @@ function createZodEnum(values, params) {
2838
3381
  }
2839
3382
  __name(createZodEnum, "createZodEnum");
2840
3383
  var ZodEnum = class extends ZodType {
3384
+ constructor() {
3385
+ super(...arguments);
3386
+ _ZodEnum_cache.set(this, void 0);
3387
+ }
2841
3388
  _parse(input) {
2842
3389
  if (typeof input.data !== "string") {
2843
3390
  const ctx = this._getOrReturnCtx(input);
@@ -2849,7 +3396,10 @@ var ZodEnum = class extends ZodType {
2849
3396
  });
2850
3397
  return INVALID;
2851
3398
  }
2852
- if (this._def.values.indexOf(input.data) === -1) {
3399
+ if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f")) {
3400
+ __classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values), "f");
3401
+ }
3402
+ if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f").has(input.data)) {
2853
3403
  const ctx = this._getOrReturnCtx(input);
2854
3404
  const expectedValues = this._def.values;
2855
3405
  addIssueToContext(ctx, {
@@ -2885,10 +3435,27 @@ var ZodEnum = class extends ZodType {
2885
3435
  }
2886
3436
  return enumValues;
2887
3437
  }
3438
+ extract(values, newDef = this._def) {
3439
+ return ZodEnum.create(values, {
3440
+ ...this._def,
3441
+ ...newDef
3442
+ });
3443
+ }
3444
+ exclude(values, newDef = this._def) {
3445
+ return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {
3446
+ ...this._def,
3447
+ ...newDef
3448
+ });
3449
+ }
2888
3450
  };
2889
3451
  __name(ZodEnum, "ZodEnum");
3452
+ _ZodEnum_cache = /* @__PURE__ */ new WeakMap();
2890
3453
  ZodEnum.create = createZodEnum;
2891
3454
  var ZodNativeEnum = class extends ZodType {
3455
+ constructor() {
3456
+ super(...arguments);
3457
+ _ZodNativeEnum_cache.set(this, void 0);
3458
+ }
2892
3459
  _parse(input) {
2893
3460
  const nativeEnumValues = util.getValidEnumValues(this._def.values);
2894
3461
  const ctx = this._getOrReturnCtx(input);
@@ -2901,7 +3468,10 @@ var ZodNativeEnum = class extends ZodType {
2901
3468
  });
2902
3469
  return INVALID;
2903
3470
  }
2904
- if (nativeEnumValues.indexOf(input.data) === -1) {
3471
+ if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f")) {
3472
+ __classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util.getValidEnumValues(this._def.values)), "f");
3473
+ }
3474
+ if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f").has(input.data)) {
2905
3475
  const expectedValues = util.objectValues(nativeEnumValues);
2906
3476
  addIssueToContext(ctx, {
2907
3477
  received: ctx.data,
@@ -2917,6 +3487,7 @@ var ZodNativeEnum = class extends ZodType {
2917
3487
  }
2918
3488
  };
2919
3489
  __name(ZodNativeEnum, "ZodNativeEnum");
3490
+ _ZodNativeEnum_cache = /* @__PURE__ */ new WeakMap();
2920
3491
  ZodNativeEnum.create = (values, params) => {
2921
3492
  return new ZodNativeEnum({
2922
3493
  values,
@@ -2925,6 +3496,9 @@ ZodNativeEnum.create = (values, params) => {
2925
3496
  });
2926
3497
  };
2927
3498
  var ZodPromise = class extends ZodType {
3499
+ unwrap() {
3500
+ return this._def.type;
3501
+ }
2928
3502
  _parse(input) {
2929
3503
  const { ctx } = this._processInputParams(input);
2930
3504
  if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
@@ -2962,24 +3536,6 @@ var ZodEffects = class extends ZodType {
2962
3536
  _parse(input) {
2963
3537
  const { status, ctx } = this._processInputParams(input);
2964
3538
  const effect = this._def.effect || null;
2965
- if (effect.type === "preprocess") {
2966
- const processed = effect.transform(ctx.data);
2967
- if (ctx.common.async) {
2968
- return Promise.resolve(processed).then((processed2) => {
2969
- return this._def.schema._parseAsync({
2970
- data: processed2,
2971
- path: ctx.path,
2972
- parent: ctx
2973
- });
2974
- });
2975
- } else {
2976
- return this._def.schema._parseSync({
2977
- data: processed,
2978
- path: ctx.path,
2979
- parent: ctx
2980
- });
2981
- }
2982
- }
2983
3539
  const checkCtx = {
2984
3540
  addIssue: (arg) => {
2985
3541
  addIssueToContext(ctx, arg);
@@ -2994,6 +3550,42 @@ var ZodEffects = class extends ZodType {
2994
3550
  }
2995
3551
  };
2996
3552
  checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
3553
+ if (effect.type === "preprocess") {
3554
+ const processed = effect.transform(ctx.data, checkCtx);
3555
+ if (ctx.common.async) {
3556
+ return Promise.resolve(processed).then(async (processed2) => {
3557
+ if (status.value === "aborted")
3558
+ return INVALID;
3559
+ const result = await this._def.schema._parseAsync({
3560
+ data: processed2,
3561
+ path: ctx.path,
3562
+ parent: ctx
3563
+ });
3564
+ if (result.status === "aborted")
3565
+ return INVALID;
3566
+ if (result.status === "dirty")
3567
+ return DIRTY(result.value);
3568
+ if (status.value === "dirty")
3569
+ return DIRTY(result.value);
3570
+ return result;
3571
+ });
3572
+ } else {
3573
+ if (status.value === "aborted")
3574
+ return INVALID;
3575
+ const result = this._def.schema._parseSync({
3576
+ data: processed,
3577
+ path: ctx.path,
3578
+ parent: ctx
3579
+ });
3580
+ if (result.status === "aborted")
3581
+ return INVALID;
3582
+ if (result.status === "dirty")
3583
+ return DIRTY(result.value);
3584
+ if (status.value === "dirty")
3585
+ return DIRTY(result.value);
3586
+ return result;
3587
+ }
3588
+ }
2997
3589
  if (effect.type === "refinement") {
2998
3590
  const executeRefinement = /* @__PURE__ */ __name((acc) => {
2999
3591
  const result = effect.refinement(acc, checkCtx);
@@ -3140,26 +3732,45 @@ ZodDefault.create = (type, params) => {
3140
3732
  var ZodCatch = class extends ZodType {
3141
3733
  _parse(input) {
3142
3734
  const { ctx } = this._processInputParams(input);
3735
+ const newCtx = {
3736
+ ...ctx,
3737
+ common: {
3738
+ ...ctx.common,
3739
+ issues: []
3740
+ }
3741
+ };
3143
3742
  const result = this._def.innerType._parse({
3144
- data: ctx.data,
3145
- path: ctx.path,
3146
- parent: ctx
3743
+ data: newCtx.data,
3744
+ path: newCtx.path,
3745
+ parent: {
3746
+ ...newCtx
3747
+ }
3147
3748
  });
3148
3749
  if (isAsync(result)) {
3149
3750
  return result.then((result2) => {
3150
3751
  return {
3151
3752
  status: "valid",
3152
- value: result2.status === "valid" ? result2.value : this._def.defaultValue()
3753
+ value: result2.status === "valid" ? result2.value : this._def.catchValue({
3754
+ get error() {
3755
+ return new ZodError(newCtx.common.issues);
3756
+ },
3757
+ input: newCtx.data
3758
+ })
3153
3759
  };
3154
3760
  });
3155
3761
  } else {
3156
3762
  return {
3157
3763
  status: "valid",
3158
- value: result.status === "valid" ? result.value : this._def.defaultValue()
3764
+ value: result.status === "valid" ? result.value : this._def.catchValue({
3765
+ get error() {
3766
+ return new ZodError(newCtx.common.issues);
3767
+ },
3768
+ input: newCtx.data
3769
+ })
3159
3770
  };
3160
3771
  }
3161
3772
  }
3162
- removeDefault() {
3773
+ removeCatch() {
3163
3774
  return this._def.innerType;
3164
3775
  }
3165
3776
  };
@@ -3168,7 +3779,7 @@ ZodCatch.create = (type, params) => {
3168
3779
  return new ZodCatch({
3169
3780
  innerType: type,
3170
3781
  typeName: ZodFirstPartyTypeKind.ZodCatch,
3171
- defaultValue: typeof params.default === "function" ? params.default : () => params.default,
3782
+ catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
3172
3783
  ...processCreateParams(params)
3173
3784
  });
3174
3785
  };
@@ -3266,17 +3877,43 @@ var ZodPipeline = class extends ZodType {
3266
3877
  }
3267
3878
  };
3268
3879
  __name(ZodPipeline, "ZodPipeline");
3269
- var custom = /* @__PURE__ */ __name((check, params = {}, fatal) => {
3880
+ var ZodReadonly = class extends ZodType {
3881
+ _parse(input) {
3882
+ const result = this._def.innerType._parse(input);
3883
+ const freeze = /* @__PURE__ */ __name((data) => {
3884
+ if (isValid(data)) {
3885
+ data.value = Object.freeze(data.value);
3886
+ }
3887
+ return data;
3888
+ }, "freeze");
3889
+ return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
3890
+ }
3891
+ unwrap() {
3892
+ return this._def.innerType;
3893
+ }
3894
+ };
3895
+ __name(ZodReadonly, "ZodReadonly");
3896
+ ZodReadonly.create = (type, params) => {
3897
+ return new ZodReadonly({
3898
+ innerType: type,
3899
+ typeName: ZodFirstPartyTypeKind.ZodReadonly,
3900
+ ...processCreateParams(params)
3901
+ });
3902
+ };
3903
+ function custom(check, params = {}, fatal) {
3270
3904
  if (check)
3271
3905
  return ZodAny.create().superRefine((data, ctx) => {
3906
+ var _a, _b;
3272
3907
  if (!check(data)) {
3273
- const p = typeof params === "function" ? params(data) : params;
3908
+ const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
3909
+ const _fatal = (_b = (_a = p.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
3274
3910
  const p2 = typeof p === "string" ? { message: p } : p;
3275
- ctx.addIssue({ code: "custom", ...p2, fatal });
3911
+ ctx.addIssue({ code: "custom", ...p2, fatal: _fatal });
3276
3912
  }
3277
3913
  });
3278
3914
  return ZodAny.create();
3279
- }, "custom");
3915
+ }
3916
+ __name(custom, "custom");
3280
3917
  var late = {
3281
3918
  object: ZodObject.lazycreate
3282
3919
  };
@@ -3317,10 +3954,11 @@ var ZodFirstPartyTypeKind;
3317
3954
  ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";
3318
3955
  ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";
3319
3956
  ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
3957
+ ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly";
3320
3958
  })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
3321
3959
  var instanceOfType = /* @__PURE__ */ __name((cls, params = {
3322
3960
  message: `Input not instance of ${cls.name}`
3323
- }) => custom((data) => data instanceof cls, params, true), "instanceOfType");
3961
+ }) => custom((data) => data instanceof cls, params), "instanceOfType");
3324
3962
  var stringType = ZodString.create;
3325
3963
  var numberType = ZodNumber.create;
3326
3964
  var nanType = ZodNaN.create;
@@ -3361,12 +3999,15 @@ var oboolean = /* @__PURE__ */ __name(() => booleanType().optional(), "oboolean"
3361
3999
  var coerce = {
3362
4000
  string: (arg) => ZodString.create({ ...arg, coerce: true }),
3363
4001
  number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
3364
- boolean: (arg) => ZodBoolean.create({ ...arg, coerce: true }),
4002
+ boolean: (arg) => ZodBoolean.create({
4003
+ ...arg,
4004
+ coerce: true
4005
+ }),
3365
4006
  bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
3366
4007
  date: (arg) => ZodDate.create({ ...arg, coerce: true })
3367
4008
  };
3368
4009
  var NEVER = INVALID;
3369
- var mod = /* @__PURE__ */ Object.freeze({
4010
+ var z = /* @__PURE__ */ Object.freeze({
3370
4011
  __proto__: null,
3371
4012
  defaultErrorMap: errorMap,
3372
4013
  setErrorMap,
@@ -3385,9 +4026,13 @@ var mod = /* @__PURE__ */ Object.freeze({
3385
4026
  get util() {
3386
4027
  return util;
3387
4028
  },
4029
+ get objectUtil() {
4030
+ return objectUtil;
4031
+ },
3388
4032
  ZodParsedType,
3389
4033
  getParsedType,
3390
4034
  ZodType,
4035
+ datetimeRegex,
3391
4036
  ZodString,
3392
4037
  ZodNumber,
3393
4038
  ZodBigInt,
@@ -3401,9 +4046,6 @@ var mod = /* @__PURE__ */ Object.freeze({
3401
4046
  ZodNever,
3402
4047
  ZodVoid,
3403
4048
  ZodArray,
3404
- get objectUtil() {
3405
- return objectUtil;
3406
- },
3407
4049
  ZodObject,
3408
4050
  ZodUnion,
3409
4051
  ZodDiscriminatedUnion,
@@ -3428,6 +4070,7 @@ var mod = /* @__PURE__ */ Object.freeze({
3428
4070
  BRAND,
3429
4071
  ZodBranded,
3430
4072
  ZodPipeline,
4073
+ ZodReadonly,
3431
4074
  custom,
3432
4075
  Schema: ZodType,
3433
4076
  ZodSchema: ZodType,
@@ -3481,36 +4124,138 @@ var mod = /* @__PURE__ */ Object.freeze({
3481
4124
  ZodError
3482
4125
  });
3483
4126
 
4127
+ // ../../node_modules/.pnpm/zod-openapi@4.2.4_zod@3.23.8/node_modules/zod-openapi/dist/extendZodSymbols.chunk.mjs
4128
+ var currentSymbol = Symbol("current");
4129
+ var previousSymbol = Symbol("previous");
4130
+
4131
+ // ../../node_modules/.pnpm/zod-openapi@4.2.4_zod@3.23.8/node_modules/zod-openapi/dist/extendZod.chunk.mjs
4132
+ var mergeOpenApi = /* @__PURE__ */ __name((openapi, {
4133
+ ref: _ref,
4134
+ refType: _refType,
4135
+ param: _param,
4136
+ header: _header,
4137
+ ...rest
4138
+ } = {}) => ({
4139
+ ...rest,
4140
+ ...openapi
4141
+ }), "mergeOpenApi");
4142
+ function extendZodWithOpenApi(zod) {
4143
+ if (typeof zod.ZodType.prototype.openapi !== "undefined") {
4144
+ return;
4145
+ }
4146
+ zod.ZodType.prototype.openapi = function(openapi) {
4147
+ const { zodOpenApi, ...rest } = this._def;
4148
+ const result = new this.constructor({
4149
+ ...rest,
4150
+ zodOpenApi: {
4151
+ openapi: mergeOpenApi(
4152
+ openapi,
4153
+ zodOpenApi == null ? void 0 : zodOpenApi.openapi
4154
+ )
4155
+ }
4156
+ });
4157
+ result._def.zodOpenApi[currentSymbol] = result;
4158
+ if (zodOpenApi) {
4159
+ result._def.zodOpenApi[previousSymbol] = this;
4160
+ }
4161
+ return result;
4162
+ };
4163
+ const zodDescribe = zod.ZodType.prototype.describe;
4164
+ zod.ZodType.prototype.describe = function(...args) {
4165
+ const result = zodDescribe.apply(this, args);
4166
+ const def = result._def;
4167
+ if (def.zodOpenApi) {
4168
+ const cloned = { ...def.zodOpenApi };
4169
+ cloned.openapi = mergeOpenApi({ description: args[0] }, cloned.openapi);
4170
+ cloned[previousSymbol] = this;
4171
+ cloned[currentSymbol] = result;
4172
+ def.zodOpenApi = cloned;
4173
+ } else {
4174
+ def.zodOpenApi = {
4175
+ openapi: { description: args[0] },
4176
+ [currentSymbol]: result
4177
+ };
4178
+ }
4179
+ return result;
4180
+ };
4181
+ const zodObjectExtend = zod.ZodObject.prototype.extend;
4182
+ zod.ZodObject.prototype.extend = function(...args) {
4183
+ const extendResult = zodObjectExtend.apply(this, args);
4184
+ const zodOpenApi = extendResult._def.zodOpenApi;
4185
+ if (zodOpenApi) {
4186
+ const cloned = { ...zodOpenApi };
4187
+ cloned.openapi = mergeOpenApi({}, cloned.openapi);
4188
+ cloned[previousSymbol] = this;
4189
+ extendResult._def.zodOpenApi = cloned;
4190
+ } else {
4191
+ extendResult._def.zodOpenApi = {
4192
+ [previousSymbol]: this
4193
+ };
4194
+ }
4195
+ return extendResult;
4196
+ };
4197
+ const zodObjectOmit = zod.ZodObject.prototype.omit;
4198
+ zod.ZodObject.prototype.omit = function(...args) {
4199
+ const omitResult = zodObjectOmit.apply(this, args);
4200
+ const zodOpenApi = omitResult._def.zodOpenApi;
4201
+ if (zodOpenApi) {
4202
+ const cloned = { ...zodOpenApi };
4203
+ cloned.openapi = mergeOpenApi({}, cloned.openapi);
4204
+ delete cloned[previousSymbol];
4205
+ delete cloned[currentSymbol];
4206
+ omitResult._def.zodOpenApi = cloned;
4207
+ }
4208
+ return omitResult;
4209
+ };
4210
+ const zodObjectPick = zod.ZodObject.prototype.pick;
4211
+ zod.ZodObject.prototype.pick = function(...args) {
4212
+ const pickResult = zodObjectPick.apply(this, args);
4213
+ const zodOpenApi = pickResult._def.zodOpenApi;
4214
+ if (zodOpenApi) {
4215
+ const cloned = { ...zodOpenApi };
4216
+ cloned.openapi = mergeOpenApi({}, cloned.openapi);
4217
+ delete cloned[previousSymbol];
4218
+ delete cloned[currentSymbol];
4219
+ pickResult._def.zodOpenApi = cloned;
4220
+ }
4221
+ return pickResult;
4222
+ };
4223
+ }
4224
+ __name(extendZodWithOpenApi, "extendZodWithOpenApi");
4225
+
4226
+ // ../../node_modules/.pnpm/zod-openapi@4.2.4_zod@3.23.8/node_modules/zod-openapi/dist/extend.mjs
4227
+ extendZodWithOpenApi(z);
4228
+
3484
4229
  // src/vc.ts
3485
- var ContextValidator = mod.array(mod.string().or(mod.record(mod.any())));
3486
- var AchievementCriteriaValidator = mod.object({
3487
- type: mod.string().optional(),
3488
- narrative: mod.string().optional()
4230
+ var ContextValidator = z.array(z.string().or(z.record(z.any())));
4231
+ var AchievementCriteriaValidator = z.object({
4232
+ type: z.string().optional(),
4233
+ narrative: z.string().optional()
3489
4234
  });
3490
- var ImageValidator = mod.string().or(
3491
- mod.object({
3492
- id: mod.string(),
3493
- type: mod.string(),
3494
- caption: mod.string().optional()
4235
+ var ImageValidator = z.string().or(
4236
+ z.object({
4237
+ id: z.string(),
4238
+ type: z.string(),
4239
+ caption: z.string().optional()
3495
4240
  })
3496
4241
  );
3497
- var GeoCoordinatesValidator = mod.object({
3498
- type: mod.string().min(1).or(mod.string().array().nonempty()),
3499
- latitude: mod.number(),
3500
- longitude: mod.number()
4242
+ var GeoCoordinatesValidator = z.object({
4243
+ type: z.string().min(1).or(z.string().array().nonempty()),
4244
+ latitude: z.number(),
4245
+ longitude: z.number()
3501
4246
  });
3502
- var AddressValidator = mod.object({
3503
- type: mod.string().min(1).or(mod.string().array().nonempty()),
3504
- addressCountry: mod.string().optional(),
3505
- addressCountryCode: mod.string().optional(),
3506
- addressRegion: mod.string().optional(),
3507
- addressLocality: mod.string().optional(),
3508
- streetAddress: mod.string().optional(),
3509
- postOfficeBoxNumber: mod.string().optional(),
3510
- postalCode: mod.string().optional(),
4247
+ var AddressValidator = z.object({
4248
+ type: z.string().min(1).or(z.string().array().nonempty()),
4249
+ addressCountry: z.string().optional(),
4250
+ addressCountryCode: z.string().optional(),
4251
+ addressRegion: z.string().optional(),
4252
+ addressLocality: z.string().optional(),
4253
+ streetAddress: z.string().optional(),
4254
+ postOfficeBoxNumber: z.string().optional(),
4255
+ postalCode: z.string().optional(),
3511
4256
  geo: GeoCoordinatesValidator.optional()
3512
4257
  });
3513
- var IdentifierTypeValidator = mod.enum([
4258
+ var IdentifierTypeValidator = z.enum([
3514
4259
  "sourcedId",
3515
4260
  "systemId",
3516
4261
  "productId",
@@ -3529,49 +4274,49 @@ var IdentifierTypeValidator = mod.enum([
3529
4274
  "ltiPlatformId",
3530
4275
  "ltiUserId",
3531
4276
  "identifier"
3532
- ]).or(mod.string());
3533
- var IdentifierEntryValidator = mod.object({
3534
- type: mod.string().min(1).or(mod.string().array().nonempty()),
3535
- identifier: mod.string(),
4277
+ ]).or(z.string());
4278
+ var IdentifierEntryValidator = z.object({
4279
+ type: z.string().min(1).or(z.string().array().nonempty()),
4280
+ identifier: z.string(),
3536
4281
  identifierType: IdentifierTypeValidator
3537
4282
  });
3538
- var ProfileValidator = mod.string().or(
3539
- mod.object({
3540
- id: mod.string().optional(),
3541
- type: mod.string().or(mod.string().array().nonempty().optional()),
3542
- name: mod.string().optional(),
3543
- url: mod.string().optional(),
3544
- phone: mod.string().optional(),
3545
- description: mod.string().optional(),
3546
- endorsement: mod.any().array().optional(),
4283
+ var ProfileValidator = z.string().or(
4284
+ z.object({
4285
+ id: z.string().optional(),
4286
+ type: z.string().or(z.string().array().nonempty().optional()),
4287
+ name: z.string().optional(),
4288
+ url: z.string().optional(),
4289
+ phone: z.string().optional(),
4290
+ description: z.string().optional(),
4291
+ endorsement: z.any().array().optional(),
3547
4292
  // Recursive type
3548
4293
  image: ImageValidator.optional(),
3549
- email: mod.string().email().optional(),
4294
+ email: z.string().email().optional(),
3550
4295
  address: AddressValidator.optional(),
3551
4296
  otherIdentifier: IdentifierEntryValidator.array().optional(),
3552
- official: mod.string().optional(),
3553
- parentOrg: mod.any().optional(),
4297
+ official: z.string().optional(),
4298
+ parentOrg: z.any().optional(),
3554
4299
  // Recursive types are annoying =(
3555
- familyName: mod.string().optional(),
3556
- givenName: mod.string().optional(),
3557
- additionalName: mod.string().optional(),
3558
- patronymicName: mod.string().optional(),
3559
- honorificPrefix: mod.string().optional(),
3560
- honorificSuffix: mod.string().optional(),
3561
- familyNamePrefix: mod.string().optional(),
3562
- dateOfBirth: mod.string().optional()
3563
- }).catchall(mod.any())
4300
+ familyName: z.string().optional(),
4301
+ givenName: z.string().optional(),
4302
+ additionalName: z.string().optional(),
4303
+ patronymicName: z.string().optional(),
4304
+ honorificPrefix: z.string().optional(),
4305
+ honorificSuffix: z.string().optional(),
4306
+ familyNamePrefix: z.string().optional(),
4307
+ dateOfBirth: z.string().optional()
4308
+ }).catchall(z.any())
3564
4309
  );
3565
- var CredentialSubjectValidator = mod.object({ id: mod.string().optional() }).catchall(mod.any());
3566
- var CredentialStatusValidator = mod.object({ type: mod.string(), id: mod.string() }).catchall(mod.any());
3567
- var CredentialSchemaValidator = mod.object({ id: mod.string(), type: mod.string() }).catchall(mod.any());
3568
- var RefreshServiceValidator = mod.object({ id: mod.string().optional(), type: mod.string() }).catchall(mod.any());
3569
- var TermsOfUseValidator = mod.object({ type: mod.string(), id: mod.string().optional() }).catchall(mod.any());
3570
- var VC2EvidenceValidator = mod.object({ type: mod.string().or(mod.string().array().nonempty()), id: mod.string().optional() }).catchall(mod.any());
3571
- var UnsignedVCValidator = mod.object({
4310
+ var CredentialSubjectValidator = z.object({ id: z.string().optional() }).catchall(z.any());
4311
+ var CredentialStatusValidator = z.object({ type: z.string(), id: z.string() }).catchall(z.any());
4312
+ var CredentialSchemaValidator = z.object({ id: z.string(), type: z.string() }).catchall(z.any());
4313
+ var RefreshServiceValidator = z.object({ id: z.string().optional(), type: z.string() }).catchall(z.any());
4314
+ var TermsOfUseValidator = z.object({ type: z.string(), id: z.string().optional() }).catchall(z.any());
4315
+ var VC2EvidenceValidator = z.object({ type: z.string().or(z.string().array().nonempty()), id: z.string().optional() }).catchall(z.any());
4316
+ var UnsignedVCValidator = z.object({
3572
4317
  "@context": ContextValidator,
3573
- id: mod.string().optional(),
3574
- type: mod.string().array().nonempty(),
4318
+ id: z.string().optional(),
4319
+ type: z.string().array().nonempty(),
3575
4320
  issuer: ProfileValidator,
3576
4321
  credentialSubject: CredentialSubjectValidator.or(CredentialSubjectValidator.array()),
3577
4322
  refreshService: RefreshServiceValidator.or(RefreshServiceValidator.array()).optional(),
@@ -3579,98 +4324,98 @@ var UnsignedVCValidator = mod.object({
3579
4324
  CredentialSchemaValidator.array()
3580
4325
  ).optional(),
3581
4326
  // V1
3582
- issuanceDate: mod.string().optional(),
3583
- expirationDate: mod.string().optional(),
4327
+ issuanceDate: z.string().optional(),
4328
+ expirationDate: z.string().optional(),
3584
4329
  credentialStatus: CredentialStatusValidator.or(
3585
4330
  CredentialStatusValidator.array()
3586
4331
  ).optional(),
3587
4332
  // V2
3588
- name: mod.string().optional(),
3589
- description: mod.string().optional(),
3590
- validFrom: mod.string().optional(),
3591
- validUntil: mod.string().optional(),
4333
+ name: z.string().optional(),
4334
+ description: z.string().optional(),
4335
+ validFrom: z.string().optional(),
4336
+ validUntil: z.string().optional(),
3592
4337
  status: CredentialStatusValidator.or(CredentialStatusValidator.array()).optional(),
3593
4338
  termsOfUse: TermsOfUseValidator.or(TermsOfUseValidator.array()).optional(),
3594
4339
  evidence: VC2EvidenceValidator.or(VC2EvidenceValidator.array()).optional()
3595
- }).catchall(mod.any());
3596
- var ProofValidator = mod.object({
3597
- type: mod.string(),
3598
- created: mod.string(),
3599
- challenge: mod.string().optional(),
3600
- domain: mod.string().optional(),
3601
- nonce: mod.string().optional(),
3602
- proofPurpose: mod.string(),
3603
- verificationMethod: mod.string(),
3604
- jws: mod.string().optional()
3605
- }).catchall(mod.any());
4340
+ }).catchall(z.any());
4341
+ var ProofValidator = z.object({
4342
+ type: z.string(),
4343
+ created: z.string(),
4344
+ challenge: z.string().optional(),
4345
+ domain: z.string().optional(),
4346
+ nonce: z.string().optional(),
4347
+ proofPurpose: z.string(),
4348
+ verificationMethod: z.string(),
4349
+ jws: z.string().optional()
4350
+ }).catchall(z.any());
3606
4351
  var VCValidator = UnsignedVCValidator.extend({
3607
4352
  proof: ProofValidator.or(ProofValidator.array())
3608
4353
  });
3609
- var UnsignedVPValidator = mod.object({
4354
+ var UnsignedVPValidator = z.object({
3610
4355
  "@context": ContextValidator,
3611
- id: mod.string().optional(),
3612
- type: mod.string().or(mod.string().array().nonempty()),
4356
+ id: z.string().optional(),
4357
+ type: z.string().or(z.string().array().nonempty()),
3613
4358
  verifiableCredential: VCValidator.or(VCValidator.array()).optional(),
3614
- holder: mod.string().optional()
3615
- }).catchall(mod.any());
4359
+ holder: z.string().optional()
4360
+ }).catchall(z.any());
3616
4361
  var VPValidator = UnsignedVPValidator.extend({
3617
4362
  proof: ProofValidator.or(ProofValidator.array())
3618
4363
  });
3619
4364
 
3620
4365
  // src/crypto.ts
3621
- var JWKValidator = mod.object({
3622
- kty: mod.string(),
3623
- crv: mod.string(),
3624
- x: mod.string(),
3625
- y: mod.string().optional(),
3626
- n: mod.string().optional(),
3627
- d: mod.string().optional()
4366
+ var JWKValidator = z.object({
4367
+ kty: z.string(),
4368
+ crv: z.string(),
4369
+ x: z.string(),
4370
+ y: z.string().optional(),
4371
+ n: z.string().optional(),
4372
+ d: z.string().optional()
3628
4373
  });
3629
- var JWKWithPrivateKeyValidator = JWKValidator.omit({ d: true }).extend({ d: mod.string() });
3630
- var JWERecipientHeaderValidator = mod.object({
3631
- alg: mod.string(),
3632
- iv: mod.string(),
3633
- tag: mod.string(),
4374
+ var JWKWithPrivateKeyValidator = JWKValidator.omit({ d: true }).extend({ d: z.string() });
4375
+ var JWERecipientHeaderValidator = z.object({
4376
+ alg: z.string(),
4377
+ iv: z.string(),
4378
+ tag: z.string(),
3634
4379
  epk: JWKValidator.partial().optional(),
3635
- kid: mod.string().optional(),
3636
- apv: mod.string().optional(),
3637
- apu: mod.string().optional()
4380
+ kid: z.string().optional(),
4381
+ apv: z.string().optional(),
4382
+ apu: z.string().optional()
3638
4383
  });
3639
- var JWERecipientValidator = mod.object({
4384
+ var JWERecipientValidator = z.object({
3640
4385
  header: JWERecipientHeaderValidator,
3641
- encrypted_key: mod.string()
4386
+ encrypted_key: z.string()
3642
4387
  });
3643
- var JWEValidator = mod.object({
3644
- protected: mod.string(),
3645
- iv: mod.string(),
3646
- ciphertext: mod.string(),
3647
- tag: mod.string(),
3648
- aad: mod.string().optional(),
4388
+ var JWEValidator = z.object({
4389
+ protected: z.string(),
4390
+ iv: z.string(),
4391
+ ciphertext: z.string(),
4392
+ tag: z.string(),
4393
+ aad: z.string().optional(),
3649
4394
  recipients: JWERecipientValidator.array().optional()
3650
4395
  });
3651
4396
 
3652
4397
  // src/did.ts
3653
- var VerificationMethodValidator = mod.string().or(
3654
- mod.object({
4398
+ var VerificationMethodValidator = z.string().or(
4399
+ z.object({
3655
4400
  "@context": ContextValidator.optional(),
3656
- id: mod.string(),
3657
- type: mod.string(),
3658
- controller: mod.string(),
4401
+ id: z.string(),
4402
+ type: z.string(),
4403
+ controller: z.string(),
3659
4404
  publicKeyJwk: JWKValidator.optional(),
3660
- publicKeyBase58: mod.string().optional(),
3661
- blockChainAccountId: mod.string().optional()
3662
- }).catchall(mod.any())
4405
+ publicKeyBase58: z.string().optional(),
4406
+ blockChainAccountId: z.string().optional()
4407
+ }).catchall(z.any())
3663
4408
  );
3664
- var ServiceValidator = mod.object({
3665
- id: mod.string(),
3666
- type: mod.string().or(mod.string().array().nonempty()),
3667
- serviceEndpoint: mod.any().or(mod.any().array().nonempty())
3668
- }).catchall(mod.any());
3669
- var DidDocumentValidator = mod.object({
4409
+ var ServiceValidator = z.object({
4410
+ id: z.string(),
4411
+ type: z.string().or(z.string().array().nonempty()),
4412
+ serviceEndpoint: z.any().or(z.any().array().nonempty())
4413
+ }).catchall(z.any());
4414
+ var DidDocumentValidator = z.object({
3670
4415
  "@context": ContextValidator,
3671
- id: mod.string(),
3672
- alsoKnownAs: mod.string().optional(),
3673
- controller: mod.string().or(mod.string().array().nonempty()).optional(),
4416
+ id: z.string(),
4417
+ alsoKnownAs: z.string().optional(),
4418
+ controller: z.string().or(z.string().array().nonempty()).optional(),
3674
4419
  verificationMethod: VerificationMethodValidator.array().optional(),
3675
4420
  authentication: VerificationMethodValidator.array().optional(),
3676
4421
  assertionMethod: VerificationMethodValidator.array().optional(),
@@ -3680,10 +4425,10 @@ var DidDocumentValidator = mod.object({
3680
4425
  publicKey: VerificationMethodValidator.array().optional(),
3681
4426
  service: ServiceValidator.array().optional(),
3682
4427
  proof: ProofValidator.or(ProofValidator.array()).optional()
3683
- }).catchall(mod.any());
4428
+ }).catchall(z.any());
3684
4429
 
3685
4430
  // src/obv3.ts
3686
- var AlignmentTargetTypeValidator = mod.enum([
4431
+ var AlignmentTargetTypeValidator = z.enum([
3687
4432
  "ceasn:Competency",
3688
4433
  "ceterms:Credential",
3689
4434
  "CFItem",
@@ -3691,17 +4436,17 @@ var AlignmentTargetTypeValidator = mod.enum([
3691
4436
  "CFRubricCriterion",
3692
4437
  "CFRubricCriterionLevel",
3693
4438
  "CTDL"
3694
- ]).or(mod.string());
3695
- var AlignmentValidator = mod.object({
3696
- type: mod.string().array().nonempty(),
3697
- targetCode: mod.string().optional(),
3698
- targetDescription: mod.string().optional(),
3699
- targetName: mod.string(),
3700
- targetFramework: mod.string().optional(),
4439
+ ]).or(z.string());
4440
+ var AlignmentValidator = z.object({
4441
+ type: z.string().array().nonempty(),
4442
+ targetCode: z.string().optional(),
4443
+ targetDescription: z.string().optional(),
4444
+ targetName: z.string(),
4445
+ targetFramework: z.string().optional(),
3701
4446
  targetType: AlignmentTargetTypeValidator.optional(),
3702
- targetUrl: mod.string()
4447
+ targetUrl: z.string()
3703
4448
  });
3704
- var KnownAchievementTypeValidator = mod.enum([
4449
+ var KnownAchievementTypeValidator = z.enum([
3705
4450
  "Achievement",
3706
4451
  "ApprenticeshipCertificate",
3707
4452
  "Assessment",
@@ -3734,23 +4479,23 @@ var KnownAchievementTypeValidator = mod.enum([
3734
4479
  "ResearchDoctorate",
3735
4480
  "SecondarySchoolDiploma"
3736
4481
  ]);
3737
- var AchievementTypeValidator = KnownAchievementTypeValidator.or(mod.string());
3738
- var CriteriaValidator = mod.object({ id: mod.string().optional(), narrative: mod.string().optional() }).catchall(mod.any());
3739
- var EndorsementSubjectValidator = mod.object({
3740
- id: mod.string(),
3741
- type: mod.string().array().nonempty(),
3742
- endorsementComment: mod.string().optional()
4482
+ var AchievementTypeValidator = KnownAchievementTypeValidator.or(z.string());
4483
+ var CriteriaValidator = z.object({ id: z.string().optional(), narrative: z.string().optional() }).catchall(z.any());
4484
+ var EndorsementSubjectValidator = z.object({
4485
+ id: z.string(),
4486
+ type: z.string().array().nonempty(),
4487
+ endorsementComment: z.string().optional()
3743
4488
  });
3744
4489
  var EndorsementCredentialValidator = UnsignedVCValidator.extend({
3745
4490
  credentialSubject: EndorsementSubjectValidator,
3746
4491
  proof: ProofValidator.or(ProofValidator.array()).optional()
3747
4492
  });
3748
- var RelatedValidator = mod.object({
3749
- id: mod.string(),
3750
- "@language": mod.string().optional(),
3751
- version: mod.string().optional()
4493
+ var RelatedValidator = z.object({
4494
+ id: z.string(),
4495
+ "@language": z.string().optional(),
4496
+ version: z.string().optional()
3752
4497
  });
3753
- var ResultTypeValidator = mod.enum([
4498
+ var ResultTypeValidator = z.enum([
3754
4499
  "GradePointAverage",
3755
4500
  "LetterGrade",
3756
4501
  "Percent",
@@ -3763,59 +4508,59 @@ var ResultTypeValidator = mod.enum([
3763
4508
  "RubricScore",
3764
4509
  "ScaledScore",
3765
4510
  "Status"
3766
- ]).or(mod.string());
3767
- var RubricCriterionValidator = mod.object({
3768
- id: mod.string(),
3769
- type: mod.string().array().nonempty(),
4511
+ ]).or(z.string());
4512
+ var RubricCriterionValidator = z.object({
4513
+ id: z.string(),
4514
+ type: z.string().array().nonempty(),
3770
4515
  alignment: AlignmentValidator.array().optional(),
3771
- description: mod.string().optional(),
3772
- level: mod.string().optional(),
3773
- name: mod.string(),
3774
- points: mod.string().optional()
3775
- }).catchall(mod.any());
3776
- var ResultDescriptionValidator = mod.object({
3777
- id: mod.string(),
3778
- type: mod.string().array().nonempty(),
4516
+ description: z.string().optional(),
4517
+ level: z.string().optional(),
4518
+ name: z.string(),
4519
+ points: z.string().optional()
4520
+ }).catchall(z.any());
4521
+ var ResultDescriptionValidator = z.object({
4522
+ id: z.string(),
4523
+ type: z.string().array().nonempty(),
3779
4524
  alignment: AlignmentValidator.array().optional(),
3780
- allowedValue: mod.string().array().optional(),
3781
- name: mod.string(),
3782
- requiredLevel: mod.string().optional(),
3783
- requiredValue: mod.string().optional(),
4525
+ allowedValue: z.string().array().optional(),
4526
+ name: z.string(),
4527
+ requiredLevel: z.string().optional(),
4528
+ requiredValue: z.string().optional(),
3784
4529
  resultType: ResultTypeValidator,
3785
4530
  rubricCriterionLevel: RubricCriterionValidator.array().optional(),
3786
- valueMax: mod.string().optional(),
3787
- valueMin: mod.string().optional()
3788
- }).catchall(mod.any());
3789
- var AchievementValidator = mod.object({
3790
- id: mod.string().optional(),
3791
- type: mod.string().array().nonempty(),
4531
+ valueMax: z.string().optional(),
4532
+ valueMin: z.string().optional()
4533
+ }).catchall(z.any());
4534
+ var AchievementValidator = z.object({
4535
+ id: z.string().optional(),
4536
+ type: z.string().array().nonempty(),
3792
4537
  alignment: AlignmentValidator.array().optional(),
3793
4538
  achievementType: AchievementTypeValidator.optional(),
3794
4539
  creator: ProfileValidator.optional(),
3795
- creditsAvailable: mod.number().optional(),
4540
+ creditsAvailable: z.number().optional(),
3796
4541
  criteria: CriteriaValidator,
3797
- description: mod.string(),
4542
+ description: z.string(),
3798
4543
  endorsement: EndorsementCredentialValidator.array().optional(),
3799
- fieldOfStudy: mod.string().optional(),
3800
- humanCode: mod.string().optional(),
4544
+ fieldOfStudy: z.string().optional(),
4545
+ humanCode: z.string().optional(),
3801
4546
  image: ImageValidator.optional(),
3802
- "@language": mod.string().optional(),
3803
- name: mod.string(),
4547
+ "@language": z.string().optional(),
4548
+ name: z.string(),
3804
4549
  otherIdentifier: IdentifierEntryValidator.array().optional(),
3805
4550
  related: RelatedValidator.array().optional(),
3806
4551
  resultDescription: ResultDescriptionValidator.array().optional(),
3807
- specialization: mod.string().optional(),
3808
- tag: mod.string().array().optional(),
3809
- version: mod.string().optional()
3810
- }).catchall(mod.any());
3811
- var IdentityObjectValidator = mod.object({
3812
- type: mod.string(),
3813
- hashed: mod.boolean(),
3814
- identityHash: mod.string(),
3815
- identityType: mod.string(),
3816
- salt: mod.string().optional()
4552
+ specialization: z.string().optional(),
4553
+ tag: z.string().array().optional(),
4554
+ version: z.string().optional()
4555
+ }).catchall(z.any());
4556
+ var IdentityObjectValidator = z.object({
4557
+ type: z.string(),
4558
+ hashed: z.boolean(),
4559
+ identityHash: z.string(),
4560
+ identityType: z.string(),
4561
+ salt: z.string().optional()
3817
4562
  });
3818
- var ResultStatusTypeValidator = mod.enum([
4563
+ var ResultStatusTypeValidator = z.enum([
3819
4564
  "Completed",
3820
4565
  "Enrolled",
3821
4566
  "Failed",
@@ -3823,42 +4568,42 @@ var ResultStatusTypeValidator = mod.enum([
3823
4568
  "OnHold",
3824
4569
  "Withdrew"
3825
4570
  ]);
3826
- var ResultValidator = mod.object({
3827
- type: mod.string().array().nonempty(),
3828
- achievedLevel: mod.string().optional(),
4571
+ var ResultValidator = z.object({
4572
+ type: z.string().array().nonempty(),
4573
+ achievedLevel: z.string().optional(),
3829
4574
  alignment: AlignmentValidator.array().optional(),
3830
- resultDescription: mod.string().optional(),
4575
+ resultDescription: z.string().optional(),
3831
4576
  status: ResultStatusTypeValidator.optional(),
3832
- value: mod.string().optional()
3833
- }).catchall(mod.any());
3834
- var AchievementSubjectValidator = mod.object({
3835
- id: mod.string().optional(),
3836
- type: mod.string().array().nonempty(),
3837
- activityEndDate: mod.string().optional(),
3838
- activityStartDate: mod.string().optional(),
3839
- creditsEarned: mod.number().optional(),
4577
+ value: z.string().optional()
4578
+ }).catchall(z.any());
4579
+ var AchievementSubjectValidator = z.object({
4580
+ id: z.string().optional(),
4581
+ type: z.string().array().nonempty(),
4582
+ activityEndDate: z.string().optional(),
4583
+ activityStartDate: z.string().optional(),
4584
+ creditsEarned: z.number().optional(),
3840
4585
  achievement: AchievementValidator.optional(),
3841
4586
  identifier: IdentityObjectValidator.array().optional(),
3842
4587
  image: ImageValidator.optional(),
3843
- licenseNumber: mod.string().optional(),
3844
- narrative: mod.string().optional(),
4588
+ licenseNumber: z.string().optional(),
4589
+ narrative: z.string().optional(),
3845
4590
  result: ResultValidator.array().optional(),
3846
- role: mod.string().optional(),
4591
+ role: z.string().optional(),
3847
4592
  source: ProfileValidator.optional(),
3848
- term: mod.string().optional()
3849
- }).catchall(mod.any());
3850
- var EvidenceValidator = mod.object({
3851
- id: mod.string().optional(),
3852
- type: mod.string().or(mod.string().array().nonempty()),
3853
- narrative: mod.string().optional(),
3854
- name: mod.string().optional(),
3855
- description: mod.string().optional(),
3856
- genre: mod.string().optional(),
3857
- audience: mod.string().optional()
3858
- }).catchall(mod.any());
4593
+ term: z.string().optional()
4594
+ }).catchall(z.any());
4595
+ var EvidenceValidator = z.object({
4596
+ id: z.string().optional(),
4597
+ type: z.string().or(z.string().array().nonempty()),
4598
+ narrative: z.string().optional(),
4599
+ name: z.string().optional(),
4600
+ description: z.string().optional(),
4601
+ genre: z.string().optional(),
4602
+ audience: z.string().optional()
4603
+ }).catchall(z.any());
3859
4604
  var UnsignedAchievementCredentialValidator = UnsignedVCValidator.extend({
3860
- name: mod.string().optional(),
3861
- description: mod.string().optional(),
4605
+ name: z.string().optional(),
4606
+ description: z.string().optional(),
3862
4607
  image: ImageValidator.optional(),
3863
4608
  credentialSubject: AchievementSubjectValidator.or(
3864
4609
  AchievementSubjectValidator.array()
@@ -3871,46 +4616,46 @@ var AchievementCredentialValidator = UnsignedAchievementCredentialValidator.exte
3871
4616
  });
3872
4617
 
3873
4618
  // src/learncard.ts
3874
- var VerificationCheckValidator = mod.object({
3875
- checks: mod.string().array(),
3876
- warnings: mod.string().array(),
3877
- errors: mod.string().array()
4619
+ var VerificationCheckValidator = z.object({
4620
+ checks: z.string().array(),
4621
+ warnings: z.string().array(),
4622
+ errors: z.string().array()
3878
4623
  });
3879
- var VerificationStatusValidator = mod.enum(["Success", "Failed", "Error"]);
4624
+ var VerificationStatusValidator = z.enum(["Success", "Failed", "Error"]);
3880
4625
  var VerificationStatusEnum = VerificationStatusValidator.enum;
3881
- var VerificationItemValidator = mod.object({
3882
- check: mod.string(),
4626
+ var VerificationItemValidator = z.object({
4627
+ check: z.string(),
3883
4628
  status: VerificationStatusValidator,
3884
- message: mod.string().optional(),
3885
- details: mod.string().optional()
4629
+ message: z.string().optional(),
4630
+ details: z.string().optional()
3886
4631
  });
3887
- var CredentialInfoValidator = mod.object({
3888
- title: mod.string().optional(),
3889
- createdAt: mod.string().optional(),
4632
+ var CredentialInfoValidator = z.object({
4633
+ title: z.string().optional(),
4634
+ createdAt: z.string().optional(),
3890
4635
  issuer: ProfileValidator.optional(),
3891
4636
  issuee: ProfileValidator.optional(),
3892
4637
  credentialSubject: CredentialSubjectValidator.optional()
3893
4638
  });
3894
- var CredentialRecordValidator = mod.object({ id: mod.string(), uri: mod.string() }).catchall(mod.any());
4639
+ var CredentialRecordValidator = z.object({ id: z.string(), uri: z.string() }).catchall(z.any());
3895
4640
 
3896
4641
  // src/mongo.ts
3897
- var PaginationOptionsValidator = mod.object({
3898
- limit: mod.number(),
3899
- cursor: mod.string().optional(),
3900
- sort: mod.string().optional()
4642
+ var PaginationOptionsValidator = z.object({
4643
+ limit: z.number(),
4644
+ cursor: z.string().optional(),
4645
+ sort: z.string().optional()
3901
4646
  });
3902
- var PaginationResponseValidator = mod.object({
3903
- cursor: mod.string().optional(),
3904
- hasMore: mod.boolean()
4647
+ var PaginationResponseValidator = z.object({
4648
+ cursor: z.string().optional(),
4649
+ hasMore: z.boolean()
3905
4650
  });
3906
4651
 
3907
4652
  // src/learncloud.ts
3908
- var EncryptedRecordValidator = mod.object({ encryptedRecord: JWEValidator, fields: mod.string().array() }).catchall(mod.any());
4653
+ var EncryptedRecordValidator = z.object({ encryptedRecord: JWEValidator, fields: z.string().array() }).catchall(z.any());
3909
4654
  var PaginatedEncryptedRecordsValidator = PaginationResponseValidator.extend({
3910
4655
  records: EncryptedRecordValidator.array()
3911
4656
  });
3912
4657
  var EncryptedCredentialRecordValidator = EncryptedRecordValidator.extend({
3913
- id: mod.string()
4658
+ id: z.string()
3914
4659
  });
3915
4660
  var PaginatedEncryptedCredentialRecordsValidator = PaginationResponseValidator.extend({
3916
4661
  records: EncryptedCredentialRecordValidator.array()
@@ -3923,8 +4668,8 @@ var parseRegexString = /* @__PURE__ */ __name((regexStr) => {
3923
4668
  throw new Error("Invalid RegExp string format");
3924
4669
  return { pattern: match[1], flags: match[2] };
3925
4670
  }, "parseRegexString");
3926
- var RegExpValidator = mod.instanceof(RegExp).or(
3927
- mod.string().refine(
4671
+ var RegExpValidator = z.instanceof(RegExp).or(
4672
+ z.string().refine(
3928
4673
  (str) => {
3929
4674
  try {
3930
4675
  parseRegexString(str);
@@ -3945,73 +4690,73 @@ var RegExpValidator = mod.instanceof(RegExp).or(
3945
4690
  }
3946
4691
  })
3947
4692
  );
3948
- var StringQuery = mod.string().or(mod.object({ $in: mod.string().array() })).or(mod.object({ $regex: RegExpValidator }));
4693
+ var StringQuery = z.string().or(z.object({ $in: z.string().array() })).or(z.object({ $regex: RegExpValidator }));
3949
4694
 
3950
4695
  // src/lcn.ts
3951
- var LCNProfileDisplayValidator = mod.object({
3952
- backgroundColor: mod.string().optional(),
3953
- backgroundImage: mod.string().optional(),
3954
- fadeBackgroundImage: mod.boolean().optional(),
3955
- repeatBackgroundImage: mod.boolean().optional(),
3956
- fontColor: mod.string().optional(),
3957
- accentColor: mod.string().optional(),
3958
- accentFontColor: mod.string().optional(),
3959
- idBackgroundImage: mod.string().optional(),
3960
- fadeIdBackgroundImage: mod.boolean().optional(),
3961
- idBackgroundColor: mod.string().optional(),
3962
- repeatIdBackgroundImage: mod.boolean().optional()
4696
+ var LCNProfileDisplayValidator = z.object({
4697
+ backgroundColor: z.string().optional(),
4698
+ backgroundImage: z.string().optional(),
4699
+ fadeBackgroundImage: z.boolean().optional(),
4700
+ repeatBackgroundImage: z.boolean().optional(),
4701
+ fontColor: z.string().optional(),
4702
+ accentColor: z.string().optional(),
4703
+ accentFontColor: z.string().optional(),
4704
+ idBackgroundImage: z.string().optional(),
4705
+ fadeIdBackgroundImage: z.boolean().optional(),
4706
+ idBackgroundColor: z.string().optional(),
4707
+ repeatIdBackgroundImage: z.boolean().optional()
3963
4708
  });
3964
- var LCNProfileValidator = mod.object({
3965
- profileId: mod.string().min(3).max(40),
3966
- displayName: mod.string().default(""),
3967
- shortBio: mod.string().default(""),
3968
- bio: mod.string().default(""),
3969
- did: mod.string(),
3970
- isPrivate: mod.boolean().optional(),
3971
- email: mod.string().optional(),
3972
- image: mod.string().optional(),
3973
- heroImage: mod.string().optional(),
3974
- websiteLink: mod.string().optional(),
3975
- isServiceProfile: mod.boolean().default(false).optional(),
3976
- type: mod.string().optional(),
3977
- notificationsWebhook: mod.string().url().startsWith("http").optional(),
3978
- display: LCNProfileDisplayValidator.optional(),
3979
- role: mod.string().default("").optional(),
3980
- dob: mod.string().default("").optional()
4709
+ var LCNProfileValidator = z.object({
4710
+ profileId: z.string().min(3).max(40).describe("Unique, URL-safe identifier for the profile."),
4711
+ displayName: z.string().default("").describe("Human-readable display name for the profile."),
4712
+ shortBio: z.string().default("").describe("Short bio for the profile."),
4713
+ bio: z.string().default("").describe("Longer bio for the profile."),
4714
+ did: z.string().describe("Decentralized Identifier for the profile. (auto-assigned)"),
4715
+ isPrivate: z.boolean().optional().describe("Whether the profile is private or not and shows up in search results."),
4716
+ email: z.string().optional().describe("Contact email address for the profile."),
4717
+ image: z.string().optional().describe("Profile image URL for the profile."),
4718
+ heroImage: z.string().optional().describe("Hero image URL for the profile."),
4719
+ websiteLink: z.string().optional().describe("Website link for the profile."),
4720
+ isServiceProfile: z.boolean().default(false).optional().describe("Whether the profile is a service profile or not."),
4721
+ type: z.string().optional().describe('Profile type: e.g. "person", "organization", "service".'),
4722
+ notificationsWebhook: z.string().url().startsWith("http").optional().describe("URL to send notifications to."),
4723
+ display: LCNProfileDisplayValidator.optional().describe("Display settings for the profile."),
4724
+ role: z.string().default("").optional().describe('Role of the profile: e.g. "teacher", "student".'),
4725
+ dob: z.string().default("").optional().describe('Date of birth of the profile: e.g. "1990-01-01".')
3981
4726
  });
3982
- var LCNProfileQueryValidator = mod.object({
4727
+ var LCNProfileQueryValidator = z.object({
3983
4728
  profileId: StringQuery,
3984
4729
  displayName: StringQuery,
3985
4730
  shortBio: StringQuery,
3986
4731
  bio: StringQuery,
3987
4732
  email: StringQuery,
3988
4733
  websiteLink: StringQuery,
3989
- isServiceProfile: mod.boolean(),
4734
+ isServiceProfile: z.boolean(),
3990
4735
  type: StringQuery
3991
4736
  }).partial();
3992
4737
  var PaginatedLCNProfilesValidator = PaginationResponseValidator.extend({
3993
4738
  records: LCNProfileValidator.array()
3994
4739
  });
3995
- var LCNProfileConnectionStatusEnum = mod.enum([
4740
+ var LCNProfileConnectionStatusEnum = z.enum([
3996
4741
  "CONNECTED",
3997
4742
  "PENDING_REQUEST_SENT",
3998
4743
  "PENDING_REQUEST_RECEIVED",
3999
4744
  "NOT_CONNECTED"
4000
4745
  ]);
4001
- var LCNProfileManagerValidator = mod.object({
4002
- id: mod.string(),
4003
- created: mod.string(),
4004
- displayName: mod.string().default("").optional(),
4005
- shortBio: mod.string().default("").optional(),
4006
- bio: mod.string().default("").optional(),
4007
- email: mod.string().optional(),
4008
- image: mod.string().optional(),
4009
- heroImage: mod.string().optional()
4746
+ var LCNProfileManagerValidator = z.object({
4747
+ id: z.string(),
4748
+ created: z.string(),
4749
+ displayName: z.string().default("").optional(),
4750
+ shortBio: z.string().default("").optional(),
4751
+ bio: z.string().default("").optional(),
4752
+ email: z.string().optional(),
4753
+ image: z.string().optional(),
4754
+ heroImage: z.string().optional()
4010
4755
  });
4011
4756
  var PaginatedLCNProfileManagersValidator = PaginationResponseValidator.extend({
4012
- records: LCNProfileManagerValidator.extend({ did: mod.string() }).array()
4757
+ records: LCNProfileManagerValidator.extend({ did: z.string() }).array()
4013
4758
  });
4014
- var LCNProfileManagerQueryValidator = mod.object({
4759
+ var LCNProfileManagerQueryValidator = z.object({
4015
4760
  id: StringQuery,
4016
4761
  displayName: StringQuery,
4017
4762
  shortBio: StringQuery,
@@ -4019,296 +4764,296 @@ var LCNProfileManagerQueryValidator = mod.object({
4019
4764
  email: StringQuery
4020
4765
  }).partial();
4021
4766
  var PaginatedLCNProfilesAndManagersValidator = PaginationResponseValidator.extend({
4022
- records: mod.object({
4767
+ records: z.object({
4023
4768
  profile: LCNProfileValidator,
4024
- manager: LCNProfileManagerValidator.extend({ did: mod.string() }).optional()
4769
+ manager: LCNProfileManagerValidator.extend({ did: z.string() }).optional()
4025
4770
  }).array()
4026
4771
  });
4027
- var SentCredentialInfoValidator = mod.object({
4028
- uri: mod.string(),
4029
- to: mod.string(),
4030
- from: mod.string(),
4031
- sent: mod.string().datetime(),
4032
- received: mod.string().datetime().optional()
4772
+ var SentCredentialInfoValidator = z.object({
4773
+ uri: z.string(),
4774
+ to: z.string(),
4775
+ from: z.string(),
4776
+ sent: z.string().datetime(),
4777
+ received: z.string().datetime().optional()
4033
4778
  });
4034
- var BoostPermissionsValidator = mod.object({
4035
- role: mod.string(),
4036
- canEdit: mod.boolean(),
4037
- canIssue: mod.boolean(),
4038
- canRevoke: mod.boolean(),
4039
- canManagePermissions: mod.boolean(),
4040
- canIssueChildren: mod.string(),
4041
- canCreateChildren: mod.string(),
4042
- canEditChildren: mod.string(),
4043
- canRevokeChildren: mod.string(),
4044
- canManageChildrenPermissions: mod.string(),
4045
- canManageChildrenProfiles: mod.boolean().default(false).optional(),
4046
- canViewAnalytics: mod.boolean()
4779
+ var BoostPermissionsValidator = z.object({
4780
+ role: z.string(),
4781
+ canEdit: z.boolean(),
4782
+ canIssue: z.boolean(),
4783
+ canRevoke: z.boolean(),
4784
+ canManagePermissions: z.boolean(),
4785
+ canIssueChildren: z.string(),
4786
+ canCreateChildren: z.string(),
4787
+ canEditChildren: z.string(),
4788
+ canRevokeChildren: z.string(),
4789
+ canManageChildrenPermissions: z.string(),
4790
+ canManageChildrenProfiles: z.boolean().default(false).optional(),
4791
+ canViewAnalytics: z.boolean()
4047
4792
  });
4048
- var BoostPermissionsQueryValidator = mod.object({
4793
+ var BoostPermissionsQueryValidator = z.object({
4049
4794
  role: StringQuery,
4050
- canEdit: mod.boolean(),
4051
- canIssue: mod.boolean(),
4052
- canRevoke: mod.boolean(),
4053
- canManagePermissions: mod.boolean(),
4795
+ canEdit: z.boolean(),
4796
+ canIssue: z.boolean(),
4797
+ canRevoke: z.boolean(),
4798
+ canManagePermissions: z.boolean(),
4054
4799
  canIssueChildren: StringQuery,
4055
4800
  canCreateChildren: StringQuery,
4056
4801
  canEditChildren: StringQuery,
4057
4802
  canRevokeChildren: StringQuery,
4058
4803
  canManageChildrenPermissions: StringQuery,
4059
- canManageChildrenProfiles: mod.boolean(),
4060
- canViewAnalytics: mod.boolean()
4804
+ canManageChildrenProfiles: z.boolean(),
4805
+ canViewAnalytics: z.boolean()
4061
4806
  }).partial();
4062
- var ClaimHookTypeValidator = mod.enum(["GRANT_PERMISSIONS", "ADD_ADMIN"]);
4063
- var ClaimHookValidator = mod.discriminatedUnion("type", [
4064
- mod.object({
4065
- type: mod.literal(ClaimHookTypeValidator.Values.GRANT_PERMISSIONS),
4066
- data: mod.object({
4067
- claimUri: mod.string(),
4068
- targetUri: mod.string(),
4807
+ var ClaimHookTypeValidator = z.enum(["GRANT_PERMISSIONS", "ADD_ADMIN"]);
4808
+ var ClaimHookValidator = z.discriminatedUnion("type", [
4809
+ z.object({
4810
+ type: z.literal(ClaimHookTypeValidator.Values.GRANT_PERMISSIONS),
4811
+ data: z.object({
4812
+ claimUri: z.string(),
4813
+ targetUri: z.string(),
4069
4814
  permissions: BoostPermissionsValidator.partial()
4070
4815
  })
4071
4816
  }),
4072
- mod.object({
4073
- type: mod.literal(ClaimHookTypeValidator.Values.ADD_ADMIN),
4074
- data: mod.object({ claimUri: mod.string(), targetUri: mod.string() })
4817
+ z.object({
4818
+ type: z.literal(ClaimHookTypeValidator.Values.ADD_ADMIN),
4819
+ data: z.object({ claimUri: z.string(), targetUri: z.string() })
4075
4820
  })
4076
4821
  ]);
4077
- var ClaimHookQueryValidator = mod.object({
4822
+ var ClaimHookQueryValidator = z.object({
4078
4823
  type: StringQuery,
4079
- data: mod.object({
4824
+ data: z.object({
4080
4825
  claimUri: StringQuery,
4081
4826
  targetUri: StringQuery,
4082
4827
  permissions: BoostPermissionsQueryValidator
4083
4828
  })
4084
4829
  }).deepPartial();
4085
- var FullClaimHookValidator = mod.object({ id: mod.string(), createdAt: mod.string(), updatedAt: mod.string() }).and(ClaimHookValidator);
4830
+ var FullClaimHookValidator = z.object({ id: z.string(), createdAt: z.string(), updatedAt: z.string() }).and(ClaimHookValidator);
4086
4831
  var PaginatedClaimHooksValidator = PaginationResponseValidator.extend({
4087
4832
  records: FullClaimHookValidator.array()
4088
4833
  });
4089
- var LCNBoostStatus = mod.enum(["DRAFT", "LIVE"]);
4090
- var BoostValidator = mod.object({
4091
- uri: mod.string(),
4092
- name: mod.string().optional(),
4093
- type: mod.string().optional(),
4094
- category: mod.string().optional(),
4834
+ var LCNBoostStatus = z.enum(["DRAFT", "LIVE"]);
4835
+ var BoostValidator = z.object({
4836
+ uri: z.string(),
4837
+ name: z.string().optional(),
4838
+ type: z.string().optional(),
4839
+ category: z.string().optional(),
4095
4840
  status: LCNBoostStatus.optional(),
4096
- autoConnectRecipients: mod.boolean().optional(),
4097
- meta: mod.record(mod.any()).optional(),
4841
+ autoConnectRecipients: z.boolean().optional(),
4842
+ meta: z.record(z.any()).optional(),
4098
4843
  claimPermissions: BoostPermissionsValidator.optional()
4099
4844
  });
4100
- var BoostQueryValidator = mod.object({
4845
+ var BoostQueryValidator = z.object({
4101
4846
  uri: StringQuery,
4102
4847
  name: StringQuery,
4103
4848
  type: StringQuery,
4104
4849
  category: StringQuery,
4105
- meta: mod.record(StringQuery),
4106
- status: LCNBoostStatus.or(mod.object({ $in: LCNBoostStatus.array() })),
4107
- autoConnectRecipients: mod.boolean()
4850
+ meta: z.record(StringQuery),
4851
+ status: LCNBoostStatus.or(z.object({ $in: LCNBoostStatus.array() })),
4852
+ autoConnectRecipients: z.boolean()
4108
4853
  }).partial();
4109
4854
  var PaginatedBoostsValidator = PaginationResponseValidator.extend({
4110
4855
  records: BoostValidator.array()
4111
4856
  });
4112
- var BoostRecipientValidator = mod.object({
4857
+ var BoostRecipientValidator = z.object({
4113
4858
  to: LCNProfileValidator,
4114
- from: mod.string(),
4115
- received: mod.string().optional(),
4116
- uri: mod.string().optional()
4859
+ from: z.string(),
4860
+ received: z.string().optional(),
4861
+ uri: z.string().optional()
4117
4862
  });
4118
4863
  var PaginatedBoostRecipientsValidator = PaginationResponseValidator.extend({
4119
4864
  records: BoostRecipientValidator.array()
4120
4865
  });
4121
- var LCNBoostClaimLinkSigningAuthorityValidator = mod.object({
4122
- endpoint: mod.string(),
4123
- name: mod.string(),
4124
- did: mod.string().optional()
4866
+ var LCNBoostClaimLinkSigningAuthorityValidator = z.object({
4867
+ endpoint: z.string(),
4868
+ name: z.string(),
4869
+ did: z.string().optional()
4125
4870
  });
4126
- var LCNBoostClaimLinkOptionsValidator = mod.object({
4127
- ttlSeconds: mod.number().optional(),
4128
- totalUses: mod.number().optional()
4871
+ var LCNBoostClaimLinkOptionsValidator = z.object({
4872
+ ttlSeconds: z.number().optional(),
4873
+ totalUses: z.number().optional()
4129
4874
  });
4130
- var LCNSigningAuthorityValidator = mod.object({
4131
- endpoint: mod.string()
4875
+ var LCNSigningAuthorityValidator = z.object({
4876
+ endpoint: z.string()
4132
4877
  });
4133
- var LCNSigningAuthorityForUserValidator = mod.object({
4878
+ var LCNSigningAuthorityForUserValidator = z.object({
4134
4879
  signingAuthority: LCNSigningAuthorityValidator,
4135
- relationship: mod.object({
4136
- name: mod.string().max(15).regex(/^[a-z0-9-]+$/, {
4880
+ relationship: z.object({
4881
+ name: z.string().max(15).regex(/^[a-z0-9-]+$/, {
4137
4882
  message: "The input string must contain only lowercase letters, numbers, and hyphens."
4138
4883
  }),
4139
- did: mod.string()
4884
+ did: z.string()
4140
4885
  })
4141
4886
  });
4142
- var AutoBoostConfigValidator = mod.object({
4143
- boostUri: mod.string(),
4144
- signingAuthority: mod.object({
4145
- endpoint: mod.string(),
4146
- name: mod.string()
4887
+ var AutoBoostConfigValidator = z.object({
4888
+ boostUri: z.string(),
4889
+ signingAuthority: z.object({
4890
+ endpoint: z.string(),
4891
+ name: z.string()
4147
4892
  })
4148
4893
  });
4149
- var ConsentFlowTermsStatusValidator = mod.enum(["live", "stale", "withdrawn"]);
4150
- var ConsentFlowContractValidator = mod.object({
4151
- read: mod.object({
4152
- anonymize: mod.boolean().optional(),
4153
- credentials: mod.object({ categories: mod.record(mod.object({ required: mod.boolean() })).default({}) }).default({}),
4154
- personal: mod.record(mod.object({ required: mod.boolean() })).default({})
4894
+ var ConsentFlowTermsStatusValidator = z.enum(["live", "stale", "withdrawn"]);
4895
+ var ConsentFlowContractValidator = z.object({
4896
+ read: z.object({
4897
+ anonymize: z.boolean().optional(),
4898
+ credentials: z.object({ categories: z.record(z.object({ required: z.boolean() })).default({}) }).default({}),
4899
+ personal: z.record(z.object({ required: z.boolean() })).default({})
4155
4900
  }).default({}),
4156
- write: mod.object({
4157
- credentials: mod.object({ categories: mod.record(mod.object({ required: mod.boolean() })).default({}) }).default({}),
4158
- personal: mod.record(mod.object({ required: mod.boolean() })).default({})
4901
+ write: z.object({
4902
+ credentials: z.object({ categories: z.record(z.object({ required: z.boolean() })).default({}) }).default({}),
4903
+ personal: z.record(z.object({ required: z.boolean() })).default({})
4159
4904
  }).default({})
4160
4905
  });
4161
- var ConsentFlowContractDetailsValidator = mod.object({
4906
+ var ConsentFlowContractDetailsValidator = z.object({
4162
4907
  contract: ConsentFlowContractValidator,
4163
4908
  owner: LCNProfileValidator,
4164
- name: mod.string(),
4165
- subtitle: mod.string().optional(),
4166
- description: mod.string().optional(),
4167
- reasonForAccessing: mod.string().optional(),
4168
- image: mod.string().optional(),
4169
- uri: mod.string(),
4170
- needsGuardianConsent: mod.boolean().optional(),
4171
- redirectUrl: mod.string().optional(),
4172
- frontDoorBoostUri: mod.string().optional(),
4173
- createdAt: mod.string(),
4174
- updatedAt: mod.string(),
4175
- expiresAt: mod.string().optional(),
4176
- autoBoosts: mod.string().array().optional(),
4177
- writers: mod.array(LCNProfileValidator).optional()
4909
+ name: z.string(),
4910
+ subtitle: z.string().optional(),
4911
+ description: z.string().optional(),
4912
+ reasonForAccessing: z.string().optional(),
4913
+ image: z.string().optional(),
4914
+ uri: z.string(),
4915
+ needsGuardianConsent: z.boolean().optional(),
4916
+ redirectUrl: z.string().optional(),
4917
+ frontDoorBoostUri: z.string().optional(),
4918
+ createdAt: z.string(),
4919
+ updatedAt: z.string(),
4920
+ expiresAt: z.string().optional(),
4921
+ autoBoosts: z.string().array().optional(),
4922
+ writers: z.array(LCNProfileValidator).optional()
4178
4923
  });
4179
4924
  var PaginatedConsentFlowContractsValidator = PaginationResponseValidator.extend({
4180
4925
  records: ConsentFlowContractDetailsValidator.omit({ owner: true }).array()
4181
4926
  });
4182
- var ConsentFlowContractDataValidator = mod.object({
4183
- credentials: mod.object({ categories: mod.record(mod.string().array()).default({}) }),
4184
- personal: mod.record(mod.string()).default({}),
4185
- date: mod.string()
4927
+ var ConsentFlowContractDataValidator = z.object({
4928
+ credentials: z.object({ categories: z.record(z.string().array()).default({}) }),
4929
+ personal: z.record(z.string()).default({}),
4930
+ date: z.string()
4186
4931
  });
4187
4932
  var PaginatedConsentFlowDataValidator = PaginationResponseValidator.extend({
4188
4933
  records: ConsentFlowContractDataValidator.array()
4189
4934
  });
4190
- var ConsentFlowContractDataForDidValidator = mod.object({
4191
- credentials: mod.object({ category: mod.string(), uri: mod.string() }).array(),
4192
- personal: mod.record(mod.string()).default({}),
4193
- date: mod.string(),
4194
- contractUri: mod.string()
4935
+ var ConsentFlowContractDataForDidValidator = z.object({
4936
+ credentials: z.object({ category: z.string(), uri: z.string() }).array(),
4937
+ personal: z.record(z.string()).default({}),
4938
+ date: z.string(),
4939
+ contractUri: z.string()
4195
4940
  });
4196
4941
  var PaginatedConsentFlowDataForDidValidator = PaginationResponseValidator.extend({
4197
4942
  records: ConsentFlowContractDataForDidValidator.array()
4198
4943
  });
4199
- var ConsentFlowTermValidator = mod.object({
4200
- sharing: mod.boolean().optional(),
4201
- shared: mod.string().array().optional(),
4202
- shareAll: mod.boolean().optional(),
4203
- shareUntil: mod.string().optional()
4944
+ var ConsentFlowTermValidator = z.object({
4945
+ sharing: z.boolean().optional(),
4946
+ shared: z.string().array().optional(),
4947
+ shareAll: z.boolean().optional(),
4948
+ shareUntil: z.string().optional()
4204
4949
  });
4205
- var ConsentFlowTermsValidator = mod.object({
4206
- read: mod.object({
4207
- anonymize: mod.boolean().optional(),
4208
- credentials: mod.object({
4209
- shareAll: mod.boolean().optional(),
4210
- sharing: mod.boolean().optional(),
4211
- categories: mod.record(ConsentFlowTermValidator).default({})
4950
+ var ConsentFlowTermsValidator = z.object({
4951
+ read: z.object({
4952
+ anonymize: z.boolean().optional(),
4953
+ credentials: z.object({
4954
+ shareAll: z.boolean().optional(),
4955
+ sharing: z.boolean().optional(),
4956
+ categories: z.record(ConsentFlowTermValidator).default({})
4212
4957
  }).default({}),
4213
- personal: mod.record(mod.string()).default({})
4958
+ personal: z.record(z.string()).default({})
4214
4959
  }).default({}),
4215
- write: mod.object({
4216
- credentials: mod.object({ categories: mod.record(mod.boolean()).default({}) }).default({}),
4217
- personal: mod.record(mod.boolean()).default({})
4960
+ write: z.object({
4961
+ credentials: z.object({ categories: z.record(z.boolean()).default({}) }).default({}),
4962
+ personal: z.record(z.boolean()).default({})
4218
4963
  }).default({}),
4219
- deniedWriters: mod.array(mod.string()).optional()
4964
+ deniedWriters: z.array(z.string()).optional()
4220
4965
  });
4221
4966
  var PaginatedConsentFlowTermsValidator = PaginationResponseValidator.extend({
4222
- records: mod.object({
4223
- expiresAt: mod.string().optional(),
4224
- oneTime: mod.boolean().optional(),
4967
+ records: z.object({
4968
+ expiresAt: z.string().optional(),
4969
+ oneTime: z.boolean().optional(),
4225
4970
  terms: ConsentFlowTermsValidator,
4226
4971
  contract: ConsentFlowContractDetailsValidator,
4227
- uri: mod.string(),
4972
+ uri: z.string(),
4228
4973
  consenter: LCNProfileValidator,
4229
4974
  status: ConsentFlowTermsStatusValidator
4230
4975
  }).array()
4231
4976
  });
4232
- var ConsentFlowContractQueryValidator = mod.object({
4233
- read: mod.object({
4234
- anonymize: mod.boolean().optional(),
4235
- credentials: mod.object({
4236
- categories: mod.record(mod.object({ required: mod.boolean().optional() })).optional()
4977
+ var ConsentFlowContractQueryValidator = z.object({
4978
+ read: z.object({
4979
+ anonymize: z.boolean().optional(),
4980
+ credentials: z.object({
4981
+ categories: z.record(z.object({ required: z.boolean().optional() })).optional()
4237
4982
  }).optional(),
4238
- personal: mod.record(mod.object({ required: mod.boolean().optional() })).optional()
4983
+ personal: z.record(z.object({ required: z.boolean().optional() })).optional()
4239
4984
  }).optional(),
4240
- write: mod.object({
4241
- credentials: mod.object({
4242
- categories: mod.record(mod.object({ required: mod.boolean().optional() })).optional()
4985
+ write: z.object({
4986
+ credentials: z.object({
4987
+ categories: z.record(z.object({ required: z.boolean().optional() })).optional()
4243
4988
  }).optional(),
4244
- personal: mod.record(mod.object({ required: mod.boolean().optional() })).optional()
4989
+ personal: z.record(z.object({ required: z.boolean().optional() })).optional()
4245
4990
  }).optional()
4246
4991
  });
4247
- var ConsentFlowDataQueryValidator = mod.object({
4248
- anonymize: mod.boolean().optional(),
4249
- credentials: mod.object({ categories: mod.record(mod.boolean()).optional() }).optional(),
4250
- personal: mod.record(mod.boolean()).optional()
4992
+ var ConsentFlowDataQueryValidator = z.object({
4993
+ anonymize: z.boolean().optional(),
4994
+ credentials: z.object({ categories: z.record(z.boolean()).optional() }).optional(),
4995
+ personal: z.record(z.boolean()).optional()
4251
4996
  });
4252
- var ConsentFlowDataForDidQueryValidator = mod.object({
4253
- credentials: mod.object({ categories: mod.record(mod.boolean()).optional() }).optional(),
4254
- personal: mod.record(mod.boolean()).optional(),
4997
+ var ConsentFlowDataForDidQueryValidator = z.object({
4998
+ credentials: z.object({ categories: z.record(z.boolean()).optional() }).optional(),
4999
+ personal: z.record(z.boolean()).optional(),
4255
5000
  id: StringQuery.optional()
4256
5001
  });
4257
- var ConsentFlowTermsQueryValidator = mod.object({
4258
- read: mod.object({
4259
- anonymize: mod.boolean().optional(),
4260
- credentials: mod.object({
4261
- shareAll: mod.boolean().optional(),
4262
- sharing: mod.boolean().optional(),
4263
- categories: mod.record(ConsentFlowTermValidator.optional()).optional()
5002
+ var ConsentFlowTermsQueryValidator = z.object({
5003
+ read: z.object({
5004
+ anonymize: z.boolean().optional(),
5005
+ credentials: z.object({
5006
+ shareAll: z.boolean().optional(),
5007
+ sharing: z.boolean().optional(),
5008
+ categories: z.record(ConsentFlowTermValidator.optional()).optional()
4264
5009
  }).optional(),
4265
- personal: mod.record(mod.string()).optional()
5010
+ personal: z.record(z.string()).optional()
4266
5011
  }).optional(),
4267
- write: mod.object({
4268
- credentials: mod.object({ categories: mod.record(mod.boolean()).optional() }).optional(),
4269
- personal: mod.record(mod.boolean()).optional()
5012
+ write: z.object({
5013
+ credentials: z.object({ categories: z.record(z.boolean()).optional() }).optional(),
5014
+ personal: z.record(z.boolean()).optional()
4270
5015
  }).optional()
4271
5016
  });
4272
- var ConsentFlowTransactionActionValidator = mod.enum([
5017
+ var ConsentFlowTransactionActionValidator = z.enum([
4273
5018
  "consent",
4274
5019
  "update",
4275
5020
  "sync",
4276
5021
  "withdraw",
4277
5022
  "write"
4278
5023
  ]);
4279
- var ConsentFlowTransactionsQueryValidator = mod.object({
5024
+ var ConsentFlowTransactionsQueryValidator = z.object({
4280
5025
  terms: ConsentFlowTermsQueryValidator.optional(),
4281
5026
  action: ConsentFlowTransactionActionValidator.or(
4282
5027
  ConsentFlowTransactionActionValidator.array()
4283
5028
  ).optional(),
4284
- date: mod.object({ $gt: mod.string() }).or(mod.object({ $lt: mod.string() })).or(mod.object({ $eq: mod.string() })).optional(),
4285
- expiresAt: mod.object({ $gt: mod.string() }).or(mod.object({ $lt: mod.string() })).or(mod.object({ $eq: mod.string() })).optional(),
4286
- oneTime: mod.boolean().optional()
5029
+ date: z.object({ $gt: z.string() }).or(z.object({ $lt: z.string() })).or(z.object({ $eq: z.string() })).optional(),
5030
+ expiresAt: z.object({ $gt: z.string() }).or(z.object({ $lt: z.string() })).or(z.object({ $eq: z.string() })).optional(),
5031
+ oneTime: z.boolean().optional()
4287
5032
  });
4288
- var ConsentFlowTransactionValidator = mod.object({
4289
- expiresAt: mod.string().optional(),
4290
- oneTime: mod.boolean().optional(),
5033
+ var ConsentFlowTransactionValidator = z.object({
5034
+ expiresAt: z.string().optional(),
5035
+ oneTime: z.boolean().optional(),
4291
5036
  terms: ConsentFlowTermsValidator.optional(),
4292
- id: mod.string(),
5037
+ id: z.string(),
4293
5038
  action: ConsentFlowTransactionActionValidator,
4294
- date: mod.string(),
4295
- uris: mod.string().array().optional()
5039
+ date: z.string(),
5040
+ uris: z.string().array().optional()
4296
5041
  });
4297
5042
  var PaginatedConsentFlowTransactionsValidator = PaginationResponseValidator.extend({
4298
5043
  records: ConsentFlowTransactionValidator.array()
4299
5044
  });
4300
- var ContractCredentialValidator = mod.object({
4301
- credentialUri: mod.string(),
4302
- termsUri: mod.string(),
4303
- contractUri: mod.string(),
4304
- boostUri: mod.string(),
4305
- category: mod.string().optional(),
4306
- date: mod.string()
5045
+ var ContractCredentialValidator = z.object({
5046
+ credentialUri: z.string(),
5047
+ termsUri: z.string(),
5048
+ contractUri: z.string(),
5049
+ boostUri: z.string(),
5050
+ category: z.string().optional(),
5051
+ date: z.string()
4307
5052
  });
4308
5053
  var PaginatedContractCredentialsValidator = PaginationResponseValidator.extend({
4309
5054
  records: ContractCredentialValidator.array()
4310
5055
  });
4311
- var LCNNotificationTypeEnumValidator = mod.enum([
5056
+ var LCNNotificationTypeEnumValidator = z.enum([
4312
5057
  "CONNECTION_REQUEST",
4313
5058
  "CONNECTION_ACCEPTED",
4314
5059
  "CREDENTIAL_RECEIVED",
@@ -4319,40 +5064,40 @@ var LCNNotificationTypeEnumValidator = mod.enum([
4319
5064
  "PRESENTATION_RECEIVED",
4320
5065
  "CONSENT_FLOW_TRANSACTION"
4321
5066
  ]);
4322
- var LCNNotificationMessageValidator = mod.object({
4323
- title: mod.string().optional(),
4324
- body: mod.string().optional()
5067
+ var LCNNotificationMessageValidator = z.object({
5068
+ title: z.string().optional(),
5069
+ body: z.string().optional()
4325
5070
  });
4326
- var LCNNotificationDataValidator = mod.object({
4327
- vcUris: mod.array(mod.string()).optional(),
4328
- vpUris: mod.array(mod.string()).optional(),
5071
+ var LCNNotificationDataValidator = z.object({
5072
+ vcUris: z.array(z.string()).optional(),
5073
+ vpUris: z.array(z.string()).optional(),
4329
5074
  transaction: ConsentFlowTransactionValidator.optional()
4330
5075
  });
4331
- var LCNNotificationValidator = mod.object({
5076
+ var LCNNotificationValidator = z.object({
4332
5077
  type: LCNNotificationTypeEnumValidator,
4333
- to: LCNProfileValidator.partial().and(mod.object({ did: mod.string() })),
4334
- from: LCNProfileValidator.partial().and(mod.object({ did: mod.string() })),
5078
+ to: LCNProfileValidator.partial().and(z.object({ did: z.string() })),
5079
+ from: LCNProfileValidator.partial().and(z.object({ did: z.string() })),
4335
5080
  message: LCNNotificationMessageValidator.optional(),
4336
5081
  data: LCNNotificationDataValidator.optional(),
4337
- sent: mod.string().datetime().optional()
5082
+ sent: z.string().datetime().optional()
4338
5083
  });
4339
5084
  var AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX = "auth-grant:";
4340
- var AuthGrantValidator = mod.object({
4341
- id: mod.string(),
4342
- name: mod.string(),
4343
- description: mod.string().optional(),
4344
- challenge: mod.string().startsWith(AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX).min(10, { message: "Challenge is too short" }).max(100, { message: "Challenge is too long" }),
4345
- status: mod.enum(["revoked", "active"], {
5085
+ var AuthGrantValidator = z.object({
5086
+ id: z.string(),
5087
+ name: z.string(),
5088
+ description: z.string().optional(),
5089
+ challenge: z.string().startsWith(AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX).min(10, { message: "Challenge is too short" }).max(100, { message: "Challenge is too long" }),
5090
+ status: z.enum(["revoked", "active"], {
4346
5091
  required_error: "Status is required",
4347
5092
  invalid_type_error: "Status must be either active or revoked"
4348
5093
  }),
4349
- scope: mod.string(),
4350
- createdAt: mod.string().datetime({ message: "createdAt must be a valid ISO 8601 datetime string" }),
4351
- expiresAt: mod.string().datetime({ message: "expiresAt must be a valid ISO 8601 datetime string" }).nullish().optional()
5094
+ scope: z.string(),
5095
+ createdAt: z.string().datetime({ message: "createdAt must be a valid ISO 8601 datetime string" }),
5096
+ expiresAt: z.string().datetime({ message: "expiresAt must be a valid ISO 8601 datetime string" }).nullish().optional()
4352
5097
  });
4353
- var FlatAuthGrantValidator = mod.object({ id: mod.string() }).catchall(mod.any());
4354
- var AuthGrantStatusValidator = mod.enum(["active", "revoked"]);
4355
- var AuthGrantQueryValidator = mod.object({
5098
+ var FlatAuthGrantValidator = z.object({ id: z.string() }).catchall(z.any());
5099
+ var AuthGrantStatusValidator = z.enum(["active", "revoked"]);
5100
+ var AuthGrantQueryValidator = z.object({
4356
5101
  id: StringQuery,
4357
5102
  name: StringQuery,
4358
5103
  description: StringQuery,