@learncard/helpers 1.1.15 → 1.1.17

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.
@@ -47,7 +47,7 @@ var require_types_cjs_development = __commonJS({
47
47
  }
48
48
  return to;
49
49
  }, "__copyProps");
50
- var __toCommonJS2 = /* @__PURE__ */ __name((mod2) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod2), "__toCommonJS");
50
+ var __toCommonJS2 = /* @__PURE__ */ __name((mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod), "__toCommonJS");
51
51
  var src_exports2 = {};
52
52
  __export2(src_exports2, {
53
53
  AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX: () => AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX,
@@ -234,6 +234,15 @@ var require_types_cjs_development = __commonJS({
234
234
  return value;
235
235
  };
236
236
  })(util || (util = {}));
237
+ var objectUtil;
238
+ (function(objectUtil2) {
239
+ objectUtil2.mergeShapes = (first, second) => {
240
+ return {
241
+ ...first,
242
+ ...second
243
+ };
244
+ };
245
+ })(objectUtil || (objectUtil = {}));
237
246
  var ZodParsedType = util.arrayToEnum([
238
247
  "string",
239
248
  "nan",
@@ -377,6 +386,11 @@ var require_types_cjs_development = __commonJS({
377
386
  processError(this);
378
387
  return fieldErrors;
379
388
  }
389
+ static assert(value) {
390
+ if (!(value instanceof ZodError)) {
391
+ throw new Error(`Not a ZodError: ${value}`);
392
+ }
393
+ }
380
394
  toString() {
381
395
  return this.message;
382
396
  }
@@ -444,7 +458,12 @@ var require_types_cjs_development = __commonJS({
444
458
  break;
445
459
  case ZodIssueCode.invalid_string:
446
460
  if (typeof issue.validation === "object") {
447
- if ("startsWith" in issue.validation) {
461
+ if ("includes" in issue.validation) {
462
+ message = `Invalid input: must include "${issue.validation.includes}"`;
463
+ if (typeof issue.validation.position === "number") {
464
+ message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;
465
+ }
466
+ } else if ("startsWith" in issue.validation) {
448
467
  message = `Invalid input: must start with "${issue.validation.startsWith}"`;
449
468
  } else if ("endsWith" in issue.validation) {
450
469
  message = `Invalid input: must end with "${issue.validation.endsWith}"`;
@@ -465,7 +484,7 @@ var require_types_cjs_development = __commonJS({
465
484
  else if (issue.type === "number")
466
485
  message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
467
486
  else if (issue.type === "date")
468
- message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(issue.minimum)}`;
487
+ message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
469
488
  else
470
489
  message = "Invalid input";
471
490
  break;
@@ -476,8 +495,10 @@ var require_types_cjs_development = __commonJS({
476
495
  message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
477
496
  else if (issue.type === "number")
478
497
  message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
498
+ else if (issue.type === "bigint")
499
+ message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
479
500
  else if (issue.type === "date")
480
- message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(issue.maximum)}`;
501
+ message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`;
481
502
  else
482
503
  message = "Invalid input";
483
504
  break;
@@ -517,6 +538,13 @@ var require_types_cjs_development = __commonJS({
517
538
  ...issueData,
518
539
  path: fullPath
519
540
  };
541
+ if (issueData.message !== void 0) {
542
+ return {
543
+ ...issueData,
544
+ path: fullPath,
545
+ message: issueData.message
546
+ };
547
+ }
520
548
  let errorMessage = "";
521
549
  const maps = errorMaps.filter((m) => !!m).slice().reverse();
522
550
  for (const map of maps) {
@@ -525,11 +553,12 @@ var require_types_cjs_development = __commonJS({
525
553
  return {
526
554
  ...issueData,
527
555
  path: fullPath,
528
- message: issueData.message || errorMessage
556
+ message: errorMessage
529
557
  };
530
558
  }, "makeIssue");
531
559
  var EMPTY_PATH = [];
532
560
  function addIssueToContext(ctx, issueData) {
561
+ const overrideMap = getErrorMap();
533
562
  const issue = makeIssue({
534
563
  issueData,
535
564
  data: ctx.data,
@@ -537,8 +566,8 @@ var require_types_cjs_development = __commonJS({
537
566
  errorMaps: [
538
567
  ctx.common.contextualErrorMap,
539
568
  ctx.schemaErrorMap,
540
- getErrorMap(),
541
- errorMap
569
+ overrideMap,
570
+ overrideMap === errorMap ? void 0 : errorMap
542
571
  ].filter((x) => !!x)
543
572
  });
544
573
  ctx.common.issues.push(issue);
@@ -571,9 +600,11 @@ var require_types_cjs_development = __commonJS({
571
600
  static async mergeObjectAsync(status, pairs) {
572
601
  const syncPairs = [];
573
602
  for (const pair of pairs) {
603
+ const key = await pair.key;
604
+ const value = await pair.value;
574
605
  syncPairs.push({
575
- key: await pair.key,
576
- value: await pair.value
606
+ key,
607
+ value
577
608
  });
578
609
  }
579
610
  return ParseStatus.mergeObjectSync(status, syncPairs);
@@ -590,7 +621,7 @@ var require_types_cjs_development = __commonJS({
590
621
  status.dirty();
591
622
  if (value.status === "dirty")
592
623
  status.dirty();
593
- if (typeof value.value !== "undefined" || pair.alwaysSet) {
624
+ if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) {
594
625
  finalObject[key.value] = value.value;
595
626
  }
596
627
  }
@@ -606,21 +637,51 @@ var require_types_cjs_development = __commonJS({
606
637
  var isAborted = /* @__PURE__ */ __name2((x) => x.status === "aborted", "isAborted");
607
638
  var isDirty = /* @__PURE__ */ __name2((x) => x.status === "dirty", "isDirty");
608
639
  var isValid = /* @__PURE__ */ __name2((x) => x.status === "valid", "isValid");
609
- var isAsync = /* @__PURE__ */ __name2((x) => typeof Promise !== void 0 && x instanceof Promise, "isAsync");
640
+ var isAsync = /* @__PURE__ */ __name2((x) => typeof Promise !== "undefined" && x instanceof Promise, "isAsync");
641
+ function __classPrivateFieldGet(receiver, state, kind, f) {
642
+ if (kind === "a" && !f)
643
+ throw new TypeError("Private accessor was defined without a getter");
644
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
645
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
646
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
647
+ }
648
+ __name(__classPrivateFieldGet, "__classPrivateFieldGet");
649
+ __name2(__classPrivateFieldGet, "__classPrivateFieldGet");
650
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
651
+ if (kind === "m")
652
+ throw new TypeError("Private method is not writable");
653
+ if (kind === "a" && !f)
654
+ throw new TypeError("Private accessor was defined without a setter");
655
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
656
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
657
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
658
+ }
659
+ __name(__classPrivateFieldSet, "__classPrivateFieldSet");
660
+ __name2(__classPrivateFieldSet, "__classPrivateFieldSet");
610
661
  var errorUtil;
611
662
  (function(errorUtil2) {
612
663
  errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
613
664
  errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
614
665
  })(errorUtil || (errorUtil = {}));
666
+ var _ZodEnum_cache;
667
+ var _ZodNativeEnum_cache;
615
668
  var ParseInputLazyPath = /* @__PURE__ */ __name(class {
616
669
  constructor(parent, value, path, key) {
670
+ this._cachedPath = [];
617
671
  this.parent = parent;
618
672
  this.data = value;
619
673
  this._path = path;
620
674
  this._key = key;
621
675
  }
622
676
  get path() {
623
- return this._path.concat(this._key);
677
+ if (!this._cachedPath.length) {
678
+ if (this._key instanceof Array) {
679
+ this._cachedPath.push(...this._path, ...this._key);
680
+ } else {
681
+ this._cachedPath.push(...this._path, this._key);
682
+ }
683
+ }
684
+ return this._cachedPath;
624
685
  }
625
686
  }, "ParseInputLazyPath");
626
687
  __name2(ParseInputLazyPath, "ParseInputLazyPath");
@@ -631,8 +692,16 @@ var require_types_cjs_development = __commonJS({
631
692
  if (!ctx.common.issues.length) {
632
693
  throw new Error("Validation failed but no issues detected.");
633
694
  }
634
- const error = new ZodError(ctx.common.issues);
635
- return { success: false, error };
695
+ return {
696
+ success: false,
697
+ get error() {
698
+ if (this._error)
699
+ return this._error;
700
+ const error = new ZodError(ctx.common.issues);
701
+ this._error = error;
702
+ return this._error;
703
+ }
704
+ };
636
705
  }
637
706
  }, "handleResult");
638
707
  function processCreateParams(params) {
@@ -645,12 +714,17 @@ var require_types_cjs_development = __commonJS({
645
714
  if (errorMap2)
646
715
  return { errorMap: errorMap2, description };
647
716
  const customMap = /* @__PURE__ */ __name2((iss, ctx) => {
648
- if (iss.code !== "invalid_type")
649
- return { message: ctx.defaultError };
717
+ var _a, _b;
718
+ const { message } = params;
719
+ if (iss.code === "invalid_enum_value") {
720
+ return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
721
+ }
650
722
  if (typeof ctx.data === "undefined") {
651
- return { message: required_error !== null && required_error !== void 0 ? required_error : ctx.defaultError };
723
+ return { message: (_a = message !== null && message !== void 0 ? message : required_error) !== null && _a !== void 0 ? _a : ctx.defaultError };
652
724
  }
653
- return { message: invalid_type_error !== null && invalid_type_error !== void 0 ? invalid_type_error : ctx.defaultError };
725
+ if (iss.code !== "invalid_type")
726
+ return { message: ctx.defaultError };
727
+ return { message: (_b = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b !== void 0 ? _b : ctx.defaultError };
654
728
  }, "customMap");
655
729
  return { errorMap: customMap, description };
656
730
  }
@@ -681,6 +755,7 @@ var require_types_cjs_development = __commonJS({
681
755
  this.catch = this.catch.bind(this);
682
756
  this.describe = this.describe.bind(this);
683
757
  this.pipe = this.pipe.bind(this);
758
+ this.readonly = this.readonly.bind(this);
684
759
  this.isNullable = this.isNullable.bind(this);
685
760
  this.isOptional = this.isOptional.bind(this);
686
761
  }
@@ -825,28 +900,29 @@ var require_types_cjs_development = __commonJS({
825
900
  return this._refinement(refinement);
826
901
  }
827
902
  optional() {
828
- return ZodOptional.create(this);
903
+ return ZodOptional.create(this, this._def);
829
904
  }
830
905
  nullable() {
831
- return ZodNullable.create(this);
906
+ return ZodNullable.create(this, this._def);
832
907
  }
833
908
  nullish() {
834
- return this.optional().nullable();
909
+ return this.nullable().optional();
835
910
  }
836
911
  array() {
837
- return ZodArray.create(this);
912
+ return ZodArray.create(this, this._def);
838
913
  }
839
914
  promise() {
840
- return ZodPromise.create(this);
915
+ return ZodPromise.create(this, this._def);
841
916
  }
842
917
  or(option) {
843
- return ZodUnion.create([this, option]);
918
+ return ZodUnion.create([this, option], this._def);
844
919
  }
845
920
  and(incoming) {
846
- return ZodIntersection.create(this, incoming);
921
+ return ZodIntersection.create(this, incoming, this._def);
847
922
  }
848
923
  transform(transform) {
849
924
  return new ZodEffects({
925
+ ...processCreateParams(this._def),
850
926
  schema: this,
851
927
  typeName: ZodFirstPartyTypeKind.ZodEffects,
852
928
  effect: { type: "transform", transform }
@@ -855,6 +931,7 @@ var require_types_cjs_development = __commonJS({
855
931
  default(def) {
856
932
  const defaultValueFunc = typeof def === "function" ? def : () => def;
857
933
  return new ZodDefault({
934
+ ...processCreateParams(this._def),
858
935
  innerType: this,
859
936
  defaultValue: defaultValueFunc,
860
937
  typeName: ZodFirstPartyTypeKind.ZodDefault
@@ -864,14 +941,15 @@ var require_types_cjs_development = __commonJS({
864
941
  return new ZodBranded({
865
942
  typeName: ZodFirstPartyTypeKind.ZodBranded,
866
943
  type: this,
867
- ...processCreateParams(void 0)
944
+ ...processCreateParams(this._def)
868
945
  });
869
946
  }
870
947
  catch(def) {
871
- const defaultValueFunc = typeof def === "function" ? def : () => def;
948
+ const catchValueFunc = typeof def === "function" ? def : () => def;
872
949
  return new ZodCatch({
950
+ ...processCreateParams(this._def),
873
951
  innerType: this,
874
- defaultValue: defaultValueFunc,
952
+ catchValue: catchValueFunc,
875
953
  typeName: ZodFirstPartyTypeKind.ZodCatch
876
954
  });
877
955
  }
@@ -885,6 +963,9 @@ var require_types_cjs_development = __commonJS({
885
963
  pipe(target) {
886
964
  return ZodPipeline.create(this, target);
887
965
  }
966
+ readonly() {
967
+ return ZodReadonly.create(this);
968
+ }
888
969
  isOptional() {
889
970
  return this.safeParse(void 0).success;
890
971
  }
@@ -894,43 +975,58 @@ var require_types_cjs_development = __commonJS({
894
975
  }, "ZodType");
895
976
  __name2(ZodType, "ZodType");
896
977
  var cuidRegex = /^c[^\s-]{8,}$/i;
897
- 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;
898
- var emailRegex = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;
899
- var datetimeRegex = /* @__PURE__ */ __name2((args) => {
978
+ var cuid2Regex = /^[0-9a-z]+$/;
979
+ var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;
980
+ 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;
981
+ var nanoidRegex = /^[a-z0-9_-]{21}$/i;
982
+ 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)?)??$/;
983
+ var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
984
+ var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
985
+ var emojiRegex;
986
+ 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])$/;
987
+ 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})))$/;
988
+ var base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
989
+ 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])))`;
990
+ var dateRegex = new RegExp(`^${dateRegexSource}$`);
991
+ function timeRegexSource(args) {
992
+ let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
900
993
  if (args.precision) {
901
- if (args.offset) {
902
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}:\\d{2})|Z)$`);
903
- } else {
904
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
905
- }
906
- } else if (args.precision === 0) {
907
- if (args.offset) {
908
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$`);
909
- } else {
910
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
911
- }
912
- } else {
913
- if (args.offset) {
914
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$`);
915
- } else {
916
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
917
- }
994
+ regex = `${regex}\\.\\d{${args.precision}}`;
995
+ } else if (args.precision == null) {
996
+ regex = `${regex}(\\.\\d+)?`;
918
997
  }
919
- }, "datetimeRegex");
920
- var ZodString = /* @__PURE__ */ __name(class extends ZodType {
921
- constructor() {
922
- super(...arguments);
923
- this._regex = (regex, validation, message) => this.refinement((data) => regex.test(data), {
924
- validation,
925
- code: ZodIssueCode.invalid_string,
926
- ...errorUtil.errToObj(message)
927
- });
928
- this.nonempty = (message) => this.min(1, errorUtil.errToObj(message));
929
- this.trim = () => new ZodString({
930
- ...this._def,
931
- checks: [...this._def.checks, { kind: "trim" }]
932
- });
998
+ return regex;
999
+ }
1000
+ __name(timeRegexSource, "timeRegexSource");
1001
+ __name2(timeRegexSource, "timeRegexSource");
1002
+ function timeRegex(args) {
1003
+ return new RegExp(`^${timeRegexSource(args)}$`);
1004
+ }
1005
+ __name(timeRegex, "timeRegex");
1006
+ __name2(timeRegex, "timeRegex");
1007
+ function datetimeRegex(args) {
1008
+ let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
1009
+ const opts = [];
1010
+ opts.push(args.local ? `Z?` : `Z`);
1011
+ if (args.offset)
1012
+ opts.push(`([+-]\\d{2}:?\\d{2})`);
1013
+ regex = `${regex}(${opts.join("|")})`;
1014
+ return new RegExp(`^${regex}$`);
1015
+ }
1016
+ __name(datetimeRegex, "datetimeRegex");
1017
+ __name2(datetimeRegex, "datetimeRegex");
1018
+ function isValidIP(ip, version) {
1019
+ if ((version === "v4" || !version) && ipv4Regex.test(ip)) {
1020
+ return true;
933
1021
  }
1022
+ if ((version === "v6" || !version) && ipv6Regex.test(ip)) {
1023
+ return true;
1024
+ }
1025
+ return false;
1026
+ }
1027
+ __name(isValidIP, "isValidIP");
1028
+ __name2(isValidIP, "isValidIP");
1029
+ var ZodString = /* @__PURE__ */ __name(class extends ZodType {
934
1030
  _parse(input) {
935
1031
  if (this._def.coerce) {
936
1032
  input.data = String(input.data);
@@ -938,14 +1034,11 @@ var require_types_cjs_development = __commonJS({
938
1034
  const parsedType = this._getType(input);
939
1035
  if (parsedType !== ZodParsedType.string) {
940
1036
  const ctx2 = this._getOrReturnCtx(input);
941
- addIssueToContext(
942
- ctx2,
943
- {
944
- code: ZodIssueCode.invalid_type,
945
- expected: ZodParsedType.string,
946
- received: ctx2.parsedType
947
- }
948
- );
1037
+ addIssueToContext(ctx2, {
1038
+ code: ZodIssueCode.invalid_type,
1039
+ expected: ZodParsedType.string,
1040
+ received: ctx2.parsedType
1041
+ });
949
1042
  return INVALID;
950
1043
  }
951
1044
  const status = new ParseStatus();
@@ -1013,6 +1106,19 @@ var require_types_cjs_development = __commonJS({
1013
1106
  });
1014
1107
  status.dirty();
1015
1108
  }
1109
+ } else if (check.kind === "emoji") {
1110
+ if (!emojiRegex) {
1111
+ emojiRegex = new RegExp(_emojiRegex, "u");
1112
+ }
1113
+ if (!emojiRegex.test(input.data)) {
1114
+ ctx = this._getOrReturnCtx(input, ctx);
1115
+ addIssueToContext(ctx, {
1116
+ validation: "emoji",
1117
+ code: ZodIssueCode.invalid_string,
1118
+ message: check.message
1119
+ });
1120
+ status.dirty();
1121
+ }
1016
1122
  } else if (check.kind === "uuid") {
1017
1123
  if (!uuidRegex.test(input.data)) {
1018
1124
  ctx = this._getOrReturnCtx(input, ctx);
@@ -1023,6 +1129,16 @@ var require_types_cjs_development = __commonJS({
1023
1129
  });
1024
1130
  status.dirty();
1025
1131
  }
1132
+ } else if (check.kind === "nanoid") {
1133
+ if (!nanoidRegex.test(input.data)) {
1134
+ ctx = this._getOrReturnCtx(input, ctx);
1135
+ addIssueToContext(ctx, {
1136
+ validation: "nanoid",
1137
+ code: ZodIssueCode.invalid_string,
1138
+ message: check.message
1139
+ });
1140
+ status.dirty();
1141
+ }
1026
1142
  } else if (check.kind === "cuid") {
1027
1143
  if (!cuidRegex.test(input.data)) {
1028
1144
  ctx = this._getOrReturnCtx(input, ctx);
@@ -1033,6 +1149,26 @@ var require_types_cjs_development = __commonJS({
1033
1149
  });
1034
1150
  status.dirty();
1035
1151
  }
1152
+ } else if (check.kind === "cuid2") {
1153
+ if (!cuid2Regex.test(input.data)) {
1154
+ ctx = this._getOrReturnCtx(input, ctx);
1155
+ addIssueToContext(ctx, {
1156
+ validation: "cuid2",
1157
+ code: ZodIssueCode.invalid_string,
1158
+ message: check.message
1159
+ });
1160
+ status.dirty();
1161
+ }
1162
+ } else if (check.kind === "ulid") {
1163
+ if (!ulidRegex.test(input.data)) {
1164
+ ctx = this._getOrReturnCtx(input, ctx);
1165
+ addIssueToContext(ctx, {
1166
+ validation: "ulid",
1167
+ code: ZodIssueCode.invalid_string,
1168
+ message: check.message
1169
+ });
1170
+ status.dirty();
1171
+ }
1036
1172
  } else if (check.kind === "url") {
1037
1173
  try {
1038
1174
  new URL(input.data);
@@ -1059,6 +1195,20 @@ var require_types_cjs_development = __commonJS({
1059
1195
  }
1060
1196
  } else if (check.kind === "trim") {
1061
1197
  input.data = input.data.trim();
1198
+ } else if (check.kind === "includes") {
1199
+ if (!input.data.includes(check.value, check.position)) {
1200
+ ctx = this._getOrReturnCtx(input, ctx);
1201
+ addIssueToContext(ctx, {
1202
+ code: ZodIssueCode.invalid_string,
1203
+ validation: { includes: check.value, position: check.position },
1204
+ message: check.message
1205
+ });
1206
+ status.dirty();
1207
+ }
1208
+ } else if (check.kind === "toLowerCase") {
1209
+ input.data = input.data.toLowerCase();
1210
+ } else if (check.kind === "toUpperCase") {
1211
+ input.data = input.data.toUpperCase();
1062
1212
  } else if (check.kind === "startsWith") {
1063
1213
  if (!input.data.startsWith(check.value)) {
1064
1214
  ctx = this._getOrReturnCtx(input, ctx);
@@ -1090,12 +1240,71 @@ var require_types_cjs_development = __commonJS({
1090
1240
  });
1091
1241
  status.dirty();
1092
1242
  }
1243
+ } else if (check.kind === "date") {
1244
+ const regex = dateRegex;
1245
+ if (!regex.test(input.data)) {
1246
+ ctx = this._getOrReturnCtx(input, ctx);
1247
+ addIssueToContext(ctx, {
1248
+ code: ZodIssueCode.invalid_string,
1249
+ validation: "date",
1250
+ message: check.message
1251
+ });
1252
+ status.dirty();
1253
+ }
1254
+ } else if (check.kind === "time") {
1255
+ const regex = timeRegex(check);
1256
+ if (!regex.test(input.data)) {
1257
+ ctx = this._getOrReturnCtx(input, ctx);
1258
+ addIssueToContext(ctx, {
1259
+ code: ZodIssueCode.invalid_string,
1260
+ validation: "time",
1261
+ message: check.message
1262
+ });
1263
+ status.dirty();
1264
+ }
1265
+ } else if (check.kind === "duration") {
1266
+ if (!durationRegex.test(input.data)) {
1267
+ ctx = this._getOrReturnCtx(input, ctx);
1268
+ addIssueToContext(ctx, {
1269
+ validation: "duration",
1270
+ code: ZodIssueCode.invalid_string,
1271
+ message: check.message
1272
+ });
1273
+ status.dirty();
1274
+ }
1275
+ } else if (check.kind === "ip") {
1276
+ if (!isValidIP(input.data, check.version)) {
1277
+ ctx = this._getOrReturnCtx(input, ctx);
1278
+ addIssueToContext(ctx, {
1279
+ validation: "ip",
1280
+ code: ZodIssueCode.invalid_string,
1281
+ message: check.message
1282
+ });
1283
+ status.dirty();
1284
+ }
1285
+ } else if (check.kind === "base64") {
1286
+ if (!base64Regex.test(input.data)) {
1287
+ ctx = this._getOrReturnCtx(input, ctx);
1288
+ addIssueToContext(ctx, {
1289
+ validation: "base64",
1290
+ code: ZodIssueCode.invalid_string,
1291
+ message: check.message
1292
+ });
1293
+ status.dirty();
1294
+ }
1093
1295
  } else {
1094
1296
  util.assertNever(check);
1095
1297
  }
1096
1298
  }
1097
1299
  return { status: status.value, value: input.data };
1098
1300
  }
1301
+ _regex(regex, validation, message) {
1302
+ return this.refinement((data) => regex.test(data), {
1303
+ validation,
1304
+ code: ZodIssueCode.invalid_string,
1305
+ ...errorUtil.errToObj(message)
1306
+ });
1307
+ }
1099
1308
  _addCheck(check) {
1100
1309
  return new ZodString({
1101
1310
  ...this._def,
@@ -1108,19 +1317,38 @@ var require_types_cjs_development = __commonJS({
1108
1317
  url(message) {
1109
1318
  return this._addCheck({ kind: "url", ...errorUtil.errToObj(message) });
1110
1319
  }
1320
+ emoji(message) {
1321
+ return this._addCheck({ kind: "emoji", ...errorUtil.errToObj(message) });
1322
+ }
1111
1323
  uuid(message) {
1112
1324
  return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) });
1113
1325
  }
1326
+ nanoid(message) {
1327
+ return this._addCheck({ kind: "nanoid", ...errorUtil.errToObj(message) });
1328
+ }
1114
1329
  cuid(message) {
1115
1330
  return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
1116
1331
  }
1332
+ cuid2(message) {
1333
+ return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
1334
+ }
1335
+ ulid(message) {
1336
+ return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) });
1337
+ }
1338
+ base64(message) {
1339
+ return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
1340
+ }
1341
+ ip(options) {
1342
+ return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
1343
+ }
1117
1344
  datetime(options) {
1118
- var _a;
1345
+ var _a, _b;
1119
1346
  if (typeof options === "string") {
1120
1347
  return this._addCheck({
1121
1348
  kind: "datetime",
1122
1349
  precision: null,
1123
1350
  offset: false,
1351
+ local: false,
1124
1352
  message: options
1125
1353
  });
1126
1354
  }
@@ -1128,9 +1356,30 @@ var require_types_cjs_development = __commonJS({
1128
1356
  kind: "datetime",
1129
1357
  precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
1130
1358
  offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
1359
+ local: (_b = options === null || options === void 0 ? void 0 : options.local) !== null && _b !== void 0 ? _b : false,
1360
+ ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
1361
+ });
1362
+ }
1363
+ date(message) {
1364
+ return this._addCheck({ kind: "date", message });
1365
+ }
1366
+ time(options) {
1367
+ if (typeof options === "string") {
1368
+ return this._addCheck({
1369
+ kind: "time",
1370
+ precision: null,
1371
+ message: options
1372
+ });
1373
+ }
1374
+ return this._addCheck({
1375
+ kind: "time",
1376
+ precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
1131
1377
  ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
1132
1378
  });
1133
1379
  }
1380
+ duration(message) {
1381
+ return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) });
1382
+ }
1134
1383
  regex(regex, message) {
1135
1384
  return this._addCheck({
1136
1385
  kind: "regex",
@@ -1138,6 +1387,14 @@ var require_types_cjs_development = __commonJS({
1138
1387
  ...errorUtil.errToObj(message)
1139
1388
  });
1140
1389
  }
1390
+ includes(value, options) {
1391
+ return this._addCheck({
1392
+ kind: "includes",
1393
+ value,
1394
+ position: options === null || options === void 0 ? void 0 : options.position,
1395
+ ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
1396
+ });
1397
+ }
1141
1398
  startsWith(value, message) {
1142
1399
  return this._addCheck({
1143
1400
  kind: "startsWith",
@@ -1173,21 +1430,69 @@ var require_types_cjs_development = __commonJS({
1173
1430
  ...errorUtil.errToObj(message)
1174
1431
  });
1175
1432
  }
1433
+ nonempty(message) {
1434
+ return this.min(1, errorUtil.errToObj(message));
1435
+ }
1436
+ trim() {
1437
+ return new ZodString({
1438
+ ...this._def,
1439
+ checks: [...this._def.checks, { kind: "trim" }]
1440
+ });
1441
+ }
1442
+ toLowerCase() {
1443
+ return new ZodString({
1444
+ ...this._def,
1445
+ checks: [...this._def.checks, { kind: "toLowerCase" }]
1446
+ });
1447
+ }
1448
+ toUpperCase() {
1449
+ return new ZodString({
1450
+ ...this._def,
1451
+ checks: [...this._def.checks, { kind: "toUpperCase" }]
1452
+ });
1453
+ }
1176
1454
  get isDatetime() {
1177
1455
  return !!this._def.checks.find((ch) => ch.kind === "datetime");
1178
1456
  }
1457
+ get isDate() {
1458
+ return !!this._def.checks.find((ch) => ch.kind === "date");
1459
+ }
1460
+ get isTime() {
1461
+ return !!this._def.checks.find((ch) => ch.kind === "time");
1462
+ }
1463
+ get isDuration() {
1464
+ return !!this._def.checks.find((ch) => ch.kind === "duration");
1465
+ }
1179
1466
  get isEmail() {
1180
1467
  return !!this._def.checks.find((ch) => ch.kind === "email");
1181
1468
  }
1182
1469
  get isURL() {
1183
1470
  return !!this._def.checks.find((ch) => ch.kind === "url");
1184
1471
  }
1472
+ get isEmoji() {
1473
+ return !!this._def.checks.find((ch) => ch.kind === "emoji");
1474
+ }
1185
1475
  get isUUID() {
1186
1476
  return !!this._def.checks.find((ch) => ch.kind === "uuid");
1187
1477
  }
1478
+ get isNANOID() {
1479
+ return !!this._def.checks.find((ch) => ch.kind === "nanoid");
1480
+ }
1188
1481
  get isCUID() {
1189
1482
  return !!this._def.checks.find((ch) => ch.kind === "cuid");
1190
1483
  }
1484
+ get isCUID2() {
1485
+ return !!this._def.checks.find((ch) => ch.kind === "cuid2");
1486
+ }
1487
+ get isULID() {
1488
+ return !!this._def.checks.find((ch) => ch.kind === "ulid");
1489
+ }
1490
+ get isIP() {
1491
+ return !!this._def.checks.find((ch) => ch.kind === "ip");
1492
+ }
1493
+ get isBase64() {
1494
+ return !!this._def.checks.find((ch) => ch.kind === "base64");
1495
+ }
1191
1496
  get minLength() {
1192
1497
  let min = null;
1193
1498
  for (const ch of this._def.checks) {
@@ -1400,6 +1705,19 @@ var require_types_cjs_development = __commonJS({
1400
1705
  message: errorUtil.toString(message)
1401
1706
  });
1402
1707
  }
1708
+ safe(message) {
1709
+ return this._addCheck({
1710
+ kind: "min",
1711
+ inclusive: true,
1712
+ value: Number.MIN_SAFE_INTEGER,
1713
+ message: errorUtil.toString(message)
1714
+ })._addCheck({
1715
+ kind: "max",
1716
+ inclusive: true,
1717
+ value: Number.MAX_SAFE_INTEGER,
1718
+ message: errorUtil.toString(message)
1719
+ });
1720
+ }
1403
1721
  get minValue() {
1404
1722
  let min = null;
1405
1723
  for (const ch of this._def.checks) {
@@ -1421,7 +1739,22 @@ var require_types_cjs_development = __commonJS({
1421
1739
  return max;
1422
1740
  }
1423
1741
  get isInt() {
1424
- return !!this._def.checks.find((ch) => ch.kind === "int");
1742
+ return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
1743
+ }
1744
+ get isFinite() {
1745
+ let max = null, min = null;
1746
+ for (const ch of this._def.checks) {
1747
+ if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
1748
+ return true;
1749
+ } else if (ch.kind === "min") {
1750
+ if (min === null || ch.value > min)
1751
+ min = ch.value;
1752
+ } else if (ch.kind === "max") {
1753
+ if (max === null || ch.value < max)
1754
+ max = ch.value;
1755
+ }
1756
+ }
1757
+ return Number.isFinite(min) && Number.isFinite(max);
1425
1758
  }
1426
1759
  }, "ZodNumber");
1427
1760
  __name2(ZodNumber, "ZodNumber");
@@ -1434,27 +1767,167 @@ var require_types_cjs_development = __commonJS({
1434
1767
  });
1435
1768
  };
1436
1769
  var ZodBigInt = /* @__PURE__ */ __name(class extends ZodType {
1770
+ constructor() {
1771
+ super(...arguments);
1772
+ this.min = this.gte;
1773
+ this.max = this.lte;
1774
+ }
1437
1775
  _parse(input) {
1438
1776
  if (this._def.coerce) {
1439
1777
  input.data = BigInt(input.data);
1440
1778
  }
1441
1779
  const parsedType = this._getType(input);
1442
1780
  if (parsedType !== ZodParsedType.bigint) {
1443
- const ctx = this._getOrReturnCtx(input);
1444
- addIssueToContext(ctx, {
1781
+ const ctx2 = this._getOrReturnCtx(input);
1782
+ addIssueToContext(ctx2, {
1445
1783
  code: ZodIssueCode.invalid_type,
1446
1784
  expected: ZodParsedType.bigint,
1447
- received: ctx.parsedType
1785
+ received: ctx2.parsedType
1448
1786
  });
1449
1787
  return INVALID;
1450
1788
  }
1451
- return OK(input.data);
1789
+ let ctx = void 0;
1790
+ const status = new ParseStatus();
1791
+ for (const check of this._def.checks) {
1792
+ if (check.kind === "min") {
1793
+ const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
1794
+ if (tooSmall) {
1795
+ ctx = this._getOrReturnCtx(input, ctx);
1796
+ addIssueToContext(ctx, {
1797
+ code: ZodIssueCode.too_small,
1798
+ type: "bigint",
1799
+ minimum: check.value,
1800
+ inclusive: check.inclusive,
1801
+ message: check.message
1802
+ });
1803
+ status.dirty();
1804
+ }
1805
+ } else if (check.kind === "max") {
1806
+ const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
1807
+ if (tooBig) {
1808
+ ctx = this._getOrReturnCtx(input, ctx);
1809
+ addIssueToContext(ctx, {
1810
+ code: ZodIssueCode.too_big,
1811
+ type: "bigint",
1812
+ maximum: check.value,
1813
+ inclusive: check.inclusive,
1814
+ message: check.message
1815
+ });
1816
+ status.dirty();
1817
+ }
1818
+ } else if (check.kind === "multipleOf") {
1819
+ if (input.data % check.value !== BigInt(0)) {
1820
+ ctx = this._getOrReturnCtx(input, ctx);
1821
+ addIssueToContext(ctx, {
1822
+ code: ZodIssueCode.not_multiple_of,
1823
+ multipleOf: check.value,
1824
+ message: check.message
1825
+ });
1826
+ status.dirty();
1827
+ }
1828
+ } else {
1829
+ util.assertNever(check);
1830
+ }
1831
+ }
1832
+ return { status: status.value, value: input.data };
1833
+ }
1834
+ gte(value, message) {
1835
+ return this.setLimit("min", value, true, errorUtil.toString(message));
1836
+ }
1837
+ gt(value, message) {
1838
+ return this.setLimit("min", value, false, errorUtil.toString(message));
1839
+ }
1840
+ lte(value, message) {
1841
+ return this.setLimit("max", value, true, errorUtil.toString(message));
1842
+ }
1843
+ lt(value, message) {
1844
+ return this.setLimit("max", value, false, errorUtil.toString(message));
1845
+ }
1846
+ setLimit(kind, value, inclusive, message) {
1847
+ return new ZodBigInt({
1848
+ ...this._def,
1849
+ checks: [
1850
+ ...this._def.checks,
1851
+ {
1852
+ kind,
1853
+ value,
1854
+ inclusive,
1855
+ message: errorUtil.toString(message)
1856
+ }
1857
+ ]
1858
+ });
1859
+ }
1860
+ _addCheck(check) {
1861
+ return new ZodBigInt({
1862
+ ...this._def,
1863
+ checks: [...this._def.checks, check]
1864
+ });
1865
+ }
1866
+ positive(message) {
1867
+ return this._addCheck({
1868
+ kind: "min",
1869
+ value: BigInt(0),
1870
+ inclusive: false,
1871
+ message: errorUtil.toString(message)
1872
+ });
1873
+ }
1874
+ negative(message) {
1875
+ return this._addCheck({
1876
+ kind: "max",
1877
+ value: BigInt(0),
1878
+ inclusive: false,
1879
+ message: errorUtil.toString(message)
1880
+ });
1881
+ }
1882
+ nonpositive(message) {
1883
+ return this._addCheck({
1884
+ kind: "max",
1885
+ value: BigInt(0),
1886
+ inclusive: true,
1887
+ message: errorUtil.toString(message)
1888
+ });
1889
+ }
1890
+ nonnegative(message) {
1891
+ return this._addCheck({
1892
+ kind: "min",
1893
+ value: BigInt(0),
1894
+ inclusive: true,
1895
+ message: errorUtil.toString(message)
1896
+ });
1897
+ }
1898
+ multipleOf(value, message) {
1899
+ return this._addCheck({
1900
+ kind: "multipleOf",
1901
+ value,
1902
+ message: errorUtil.toString(message)
1903
+ });
1904
+ }
1905
+ get minValue() {
1906
+ let min = null;
1907
+ for (const ch of this._def.checks) {
1908
+ if (ch.kind === "min") {
1909
+ if (min === null || ch.value > min)
1910
+ min = ch.value;
1911
+ }
1912
+ }
1913
+ return min;
1914
+ }
1915
+ get maxValue() {
1916
+ let max = null;
1917
+ for (const ch of this._def.checks) {
1918
+ if (ch.kind === "max") {
1919
+ if (max === null || ch.value < max)
1920
+ max = ch.value;
1921
+ }
1922
+ }
1923
+ return max;
1452
1924
  }
1453
1925
  }, "ZodBigInt");
1454
1926
  __name2(ZodBigInt, "ZodBigInt");
1455
1927
  ZodBigInt.create = (params) => {
1456
1928
  var _a;
1457
1929
  return new ZodBigInt({
1930
+ checks: [],
1458
1931
  typeName: ZodFirstPartyTypeKind.ZodBigInt,
1459
1932
  coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
1460
1933
  ...processCreateParams(params)
@@ -1789,13 +2262,13 @@ var require_types_cjs_development = __commonJS({
1789
2262
  }
1790
2263
  }
1791
2264
  if (ctx.common.async) {
1792
- return Promise.all(ctx.data.map((item, i) => {
2265
+ return Promise.all([...ctx.data].map((item, i) => {
1793
2266
  return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
1794
2267
  })).then((result2) => {
1795
2268
  return ParseStatus.mergeArray(status, result2);
1796
2269
  });
1797
2270
  }
1798
- const result = ctx.data.map((item, i) => {
2271
+ const result = [...ctx.data].map((item, i) => {
1799
2272
  return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
1800
2273
  });
1801
2274
  return ParseStatus.mergeArray(status, result);
@@ -1836,24 +2309,6 @@ var require_types_cjs_development = __commonJS({
1836
2309
  ...processCreateParams(params)
1837
2310
  });
1838
2311
  };
1839
- var objectUtil;
1840
- (function(objectUtil2) {
1841
- objectUtil2.mergeShapes = (first, second) => {
1842
- return {
1843
- ...first,
1844
- ...second
1845
- };
1846
- };
1847
- })(objectUtil || (objectUtil = {}));
1848
- var AugmentFactory = /* @__PURE__ */ __name2((def) => (augmentation) => {
1849
- return new ZodObject({
1850
- ...def,
1851
- shape: () => ({
1852
- ...def.shape(),
1853
- ...augmentation
1854
- })
1855
- });
1856
- }, "AugmentFactory");
1857
2312
  function deepPartialify(schema) {
1858
2313
  if (schema instanceof ZodObject) {
1859
2314
  const newShape = {};
@@ -1866,7 +2321,10 @@ var require_types_cjs_development = __commonJS({
1866
2321
  shape: () => newShape
1867
2322
  });
1868
2323
  } else if (schema instanceof ZodArray) {
1869
- return ZodArray.create(deepPartialify(schema.element));
2324
+ return new ZodArray({
2325
+ ...schema._def,
2326
+ type: deepPartialify(schema.element)
2327
+ });
1870
2328
  } else if (schema instanceof ZodOptional) {
1871
2329
  return ZodOptional.create(deepPartialify(schema.unwrap()));
1872
2330
  } else if (schema instanceof ZodNullable) {
@@ -1884,8 +2342,7 @@ var require_types_cjs_development = __commonJS({
1884
2342
  super(...arguments);
1885
2343
  this._cached = null;
1886
2344
  this.nonstrict = this.passthrough;
1887
- this.augment = AugmentFactory(this._def);
1888
- this.extend = AugmentFactory(this._def);
2345
+ this.augment = this.extend;
1889
2346
  }
1890
2347
  _getCached() {
1891
2348
  if (this._cached !== null)
@@ -1965,9 +2422,10 @@ var require_types_cjs_development = __commonJS({
1965
2422
  const syncPairs = [];
1966
2423
  for (const pair of pairs) {
1967
2424
  const key = await pair.key;
2425
+ const value = await pair.value;
1968
2426
  syncPairs.push({
1969
2427
  key,
1970
- value: await pair.value,
2428
+ value,
1971
2429
  alwaysSet: pair.alwaysSet
1972
2430
  });
1973
2431
  }
@@ -2014,18 +2472,30 @@ var require_types_cjs_development = __commonJS({
2014
2472
  unknownKeys: "passthrough"
2015
2473
  });
2016
2474
  }
2017
- setKey(key, schema) {
2018
- return this.augment({ [key]: schema });
2475
+ extend(augmentation) {
2476
+ return new ZodObject({
2477
+ ...this._def,
2478
+ shape: () => ({
2479
+ ...this._def.shape(),
2480
+ ...augmentation
2481
+ })
2482
+ });
2019
2483
  }
2020
2484
  merge(merging) {
2021
2485
  const merged = new ZodObject({
2022
2486
  unknownKeys: merging._def.unknownKeys,
2023
2487
  catchall: merging._def.catchall,
2024
- shape: () => objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
2488
+ shape: () => ({
2489
+ ...this._def.shape(),
2490
+ ...merging._def.shape()
2491
+ }),
2025
2492
  typeName: ZodFirstPartyTypeKind.ZodObject
2026
2493
  });
2027
2494
  return merged;
2028
2495
  }
2496
+ setKey(key, schema) {
2497
+ return this.augment({ [key]: schema });
2498
+ }
2029
2499
  catchall(index) {
2030
2500
  return new ZodObject({
2031
2501
  ...this._def,
@@ -2034,9 +2504,10 @@ var require_types_cjs_development = __commonJS({
2034
2504
  }
2035
2505
  pick(mask) {
2036
2506
  const shape = {};
2037
- util.objectKeys(mask).map((key) => {
2038
- if (this.shape[key])
2507
+ util.objectKeys(mask).forEach((key) => {
2508
+ if (mask[key] && this.shape[key]) {
2039
2509
  shape[key] = this.shape[key];
2510
+ }
2040
2511
  });
2041
2512
  return new ZodObject({
2042
2513
  ...this._def,
@@ -2045,8 +2516,8 @@ var require_types_cjs_development = __commonJS({
2045
2516
  }
2046
2517
  omit(mask) {
2047
2518
  const shape = {};
2048
- util.objectKeys(this.shape).map((key) => {
2049
- if (util.objectKeys(mask).indexOf(key) === -1) {
2519
+ util.objectKeys(this.shape).forEach((key) => {
2520
+ if (!mask[key]) {
2050
2521
  shape[key] = this.shape[key];
2051
2522
  }
2052
2523
  });
@@ -2060,24 +2531,14 @@ var require_types_cjs_development = __commonJS({
2060
2531
  }
2061
2532
  partial(mask) {
2062
2533
  const newShape = {};
2063
- if (mask) {
2064
- util.objectKeys(this.shape).map((key) => {
2065
- if (util.objectKeys(mask).indexOf(key) === -1) {
2066
- newShape[key] = this.shape[key];
2067
- } else {
2068
- newShape[key] = this.shape[key].optional();
2069
- }
2070
- });
2071
- return new ZodObject({
2072
- ...this._def,
2073
- shape: () => newShape
2074
- });
2075
- } else {
2076
- for (const key in this.shape) {
2077
- const fieldSchema = this.shape[key];
2534
+ util.objectKeys(this.shape).forEach((key) => {
2535
+ const fieldSchema = this.shape[key];
2536
+ if (mask && !mask[key]) {
2537
+ newShape[key] = fieldSchema;
2538
+ } else {
2078
2539
  newShape[key] = fieldSchema.optional();
2079
2540
  }
2080
- }
2541
+ });
2081
2542
  return new ZodObject({
2082
2543
  ...this._def,
2083
2544
  shape: () => newShape
@@ -2085,21 +2546,10 @@ var require_types_cjs_development = __commonJS({
2085
2546
  }
2086
2547
  required(mask) {
2087
2548
  const newShape = {};
2088
- if (mask) {
2089
- util.objectKeys(this.shape).map((key) => {
2090
- if (util.objectKeys(mask).indexOf(key) === -1) {
2091
- newShape[key] = this.shape[key];
2092
- } else {
2093
- const fieldSchema = this.shape[key];
2094
- let newField = fieldSchema;
2095
- while (newField instanceof ZodOptional) {
2096
- newField = newField._def.innerType;
2097
- }
2098
- newShape[key] = newField;
2099
- }
2100
- });
2101
- } else {
2102
- for (const key in this.shape) {
2549
+ util.objectKeys(this.shape).forEach((key) => {
2550
+ if (mask && !mask[key]) {
2551
+ newShape[key] = this.shape[key];
2552
+ } else {
2103
2553
  const fieldSchema = this.shape[key];
2104
2554
  let newField = fieldSchema;
2105
2555
  while (newField instanceof ZodOptional) {
@@ -2107,7 +2557,7 @@ var require_types_cjs_development = __commonJS({
2107
2557
  }
2108
2558
  newShape[key] = newField;
2109
2559
  }
2110
- }
2560
+ });
2111
2561
  return new ZodObject({
2112
2562
  ...this._def,
2113
2563
  shape: () => newShape
@@ -2249,15 +2699,25 @@ var require_types_cjs_development = __commonJS({
2249
2699
  } else if (type instanceof ZodEnum) {
2250
2700
  return type.options;
2251
2701
  } else if (type instanceof ZodNativeEnum) {
2252
- return Object.keys(type.enum);
2702
+ return util.objectValues(type.enum);
2253
2703
  } else if (type instanceof ZodDefault) {
2254
2704
  return getDiscriminator(type._def.innerType);
2255
2705
  } else if (type instanceof ZodUndefined) {
2256
2706
  return [void 0];
2257
2707
  } else if (type instanceof ZodNull) {
2258
2708
  return [null];
2709
+ } else if (type instanceof ZodOptional) {
2710
+ return [void 0, ...getDiscriminator(type.unwrap())];
2711
+ } else if (type instanceof ZodNullable) {
2712
+ return [null, ...getDiscriminator(type.unwrap())];
2713
+ } else if (type instanceof ZodBranded) {
2714
+ return getDiscriminator(type.unwrap());
2715
+ } else if (type instanceof ZodReadonly) {
2716
+ return getDiscriminator(type.unwrap());
2717
+ } else if (type instanceof ZodCatch) {
2718
+ return getDiscriminator(type._def.innerType);
2259
2719
  } else {
2260
- return null;
2720
+ return [];
2261
2721
  }
2262
2722
  }, "getDiscriminator");
2263
2723
  var ZodDiscriminatedUnion = /* @__PURE__ */ __name(class extends ZodType {
@@ -2309,7 +2769,7 @@ var require_types_cjs_development = __commonJS({
2309
2769
  const optionsMap = /* @__PURE__ */ new Map();
2310
2770
  for (const type of options) {
2311
2771
  const discriminatorValues = getDiscriminator(type.shape[discriminator]);
2312
- if (!discriminatorValues) {
2772
+ if (!discriminatorValues.length) {
2313
2773
  throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
2314
2774
  }
2315
2775
  for (const value of discriminatorValues) {
@@ -2455,7 +2915,7 @@ var require_types_cjs_development = __commonJS({
2455
2915
  });
2456
2916
  status.dirty();
2457
2917
  }
2458
- const items = ctx.data.map((item, itemIndex) => {
2918
+ const items = [...ctx.data].map((item, itemIndex) => {
2459
2919
  const schema = this._def.items[itemIndex] || this._def.rest;
2460
2920
  if (!schema)
2461
2921
  return null;
@@ -2514,7 +2974,8 @@ var require_types_cjs_development = __commonJS({
2514
2974
  for (const key in ctx.data) {
2515
2975
  pairs.push({
2516
2976
  key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
2517
- value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key))
2977
+ value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),
2978
+ alwaysSet: key in ctx.data
2518
2979
  });
2519
2980
  }
2520
2981
  if (ctx.common.async) {
@@ -2545,6 +3006,12 @@ var require_types_cjs_development = __commonJS({
2545
3006
  }, "ZodRecord");
2546
3007
  __name2(ZodRecord, "ZodRecord");
2547
3008
  var ZodMap = /* @__PURE__ */ __name(class extends ZodType {
3009
+ get keySchema() {
3010
+ return this._def.keyType;
3011
+ }
3012
+ get valueSchema() {
3013
+ return this._def.valueType;
3014
+ }
2548
3015
  _parse(input) {
2549
3016
  const { status, ctx } = this._processInputParams(input);
2550
3017
  if (ctx.parsedType !== ZodParsedType.map) {
@@ -2747,27 +3214,29 @@ var require_types_cjs_development = __commonJS({
2747
3214
  const params = { errorMap: ctx.common.contextualErrorMap };
2748
3215
  const fn = ctx.data;
2749
3216
  if (this._def.returns instanceof ZodPromise) {
2750
- return OK(async (...args) => {
3217
+ const me = this;
3218
+ return OK(async function(...args) {
2751
3219
  const error = new ZodError([]);
2752
- const parsedArgs = await this._def.args.parseAsync(args, params).catch((e) => {
3220
+ const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
2753
3221
  error.addIssue(makeArgsIssue(args, e));
2754
3222
  throw error;
2755
3223
  });
2756
- const result = await fn(...parsedArgs);
2757
- const parsedReturns = await this._def.returns._def.type.parseAsync(result, params).catch((e) => {
3224
+ const result = await Reflect.apply(fn, this, parsedArgs);
3225
+ const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e) => {
2758
3226
  error.addIssue(makeReturnsIssue(result, e));
2759
3227
  throw error;
2760
3228
  });
2761
3229
  return parsedReturns;
2762
3230
  });
2763
3231
  } else {
2764
- return OK((...args) => {
2765
- const parsedArgs = this._def.args.safeParse(args, params);
3232
+ const me = this;
3233
+ return OK(function(...args) {
3234
+ const parsedArgs = me._def.args.safeParse(args, params);
2766
3235
  if (!parsedArgs.success) {
2767
3236
  throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
2768
3237
  }
2769
- const result = fn(...parsedArgs.data);
2770
- const parsedReturns = this._def.returns.safeParse(result, params);
3238
+ const result = Reflect.apply(fn, this, parsedArgs.data);
3239
+ const parsedReturns = me._def.returns.safeParse(result, params);
2771
3240
  if (!parsedReturns.success) {
2772
3241
  throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
2773
3242
  }
@@ -2834,6 +3303,7 @@ var require_types_cjs_development = __commonJS({
2834
3303
  if (input.data !== this._def.value) {
2835
3304
  const ctx = this._getOrReturnCtx(input);
2836
3305
  addIssueToContext(ctx, {
3306
+ received: ctx.data,
2837
3307
  code: ZodIssueCode.invalid_literal,
2838
3308
  expected: this._def.value
2839
3309
  });
@@ -2863,6 +3333,10 @@ var require_types_cjs_development = __commonJS({
2863
3333
  __name(createZodEnum, "createZodEnum");
2864
3334
  __name2(createZodEnum, "createZodEnum");
2865
3335
  var ZodEnum = /* @__PURE__ */ __name(class extends ZodType {
3336
+ constructor() {
3337
+ super(...arguments);
3338
+ _ZodEnum_cache.set(this, void 0);
3339
+ }
2866
3340
  _parse(input) {
2867
3341
  if (typeof input.data !== "string") {
2868
3342
  const ctx = this._getOrReturnCtx(input);
@@ -2874,7 +3348,10 @@ var require_types_cjs_development = __commonJS({
2874
3348
  });
2875
3349
  return INVALID;
2876
3350
  }
2877
- if (this._def.values.indexOf(input.data) === -1) {
3351
+ if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f")) {
3352
+ __classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values), "f");
3353
+ }
3354
+ if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f").has(input.data)) {
2878
3355
  const ctx = this._getOrReturnCtx(input);
2879
3356
  const expectedValues = this._def.values;
2880
3357
  addIssueToContext(ctx, {
@@ -2910,10 +3387,27 @@ var require_types_cjs_development = __commonJS({
2910
3387
  }
2911
3388
  return enumValues;
2912
3389
  }
3390
+ extract(values, newDef = this._def) {
3391
+ return ZodEnum.create(values, {
3392
+ ...this._def,
3393
+ ...newDef
3394
+ });
3395
+ }
3396
+ exclude(values, newDef = this._def) {
3397
+ return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {
3398
+ ...this._def,
3399
+ ...newDef
3400
+ });
3401
+ }
2913
3402
  }, "ZodEnum");
2914
3403
  __name2(ZodEnum, "ZodEnum");
3404
+ _ZodEnum_cache = /* @__PURE__ */ new WeakMap();
2915
3405
  ZodEnum.create = createZodEnum;
2916
3406
  var ZodNativeEnum = /* @__PURE__ */ __name(class extends ZodType {
3407
+ constructor() {
3408
+ super(...arguments);
3409
+ _ZodNativeEnum_cache.set(this, void 0);
3410
+ }
2917
3411
  _parse(input) {
2918
3412
  const nativeEnumValues = util.getValidEnumValues(this._def.values);
2919
3413
  const ctx = this._getOrReturnCtx(input);
@@ -2926,7 +3420,10 @@ var require_types_cjs_development = __commonJS({
2926
3420
  });
2927
3421
  return INVALID;
2928
3422
  }
2929
- if (nativeEnumValues.indexOf(input.data) === -1) {
3423
+ if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f")) {
3424
+ __classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util.getValidEnumValues(this._def.values)), "f");
3425
+ }
3426
+ if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f").has(input.data)) {
2930
3427
  const expectedValues = util.objectValues(nativeEnumValues);
2931
3428
  addIssueToContext(ctx, {
2932
3429
  received: ctx.data,
@@ -2942,6 +3439,7 @@ var require_types_cjs_development = __commonJS({
2942
3439
  }
2943
3440
  }, "ZodNativeEnum");
2944
3441
  __name2(ZodNativeEnum, "ZodNativeEnum");
3442
+ _ZodNativeEnum_cache = /* @__PURE__ */ new WeakMap();
2945
3443
  ZodNativeEnum.create = (values, params) => {
2946
3444
  return new ZodNativeEnum({
2947
3445
  values,
@@ -2950,6 +3448,9 @@ var require_types_cjs_development = __commonJS({
2950
3448
  });
2951
3449
  };
2952
3450
  var ZodPromise = /* @__PURE__ */ __name(class extends ZodType {
3451
+ unwrap() {
3452
+ return this._def.type;
3453
+ }
2953
3454
  _parse(input) {
2954
3455
  const { ctx } = this._processInputParams(input);
2955
3456
  if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
@@ -2987,24 +3488,6 @@ var require_types_cjs_development = __commonJS({
2987
3488
  _parse(input) {
2988
3489
  const { status, ctx } = this._processInputParams(input);
2989
3490
  const effect = this._def.effect || null;
2990
- if (effect.type === "preprocess") {
2991
- const processed = effect.transform(ctx.data);
2992
- if (ctx.common.async) {
2993
- return Promise.resolve(processed).then((processed2) => {
2994
- return this._def.schema._parseAsync({
2995
- data: processed2,
2996
- path: ctx.path,
2997
- parent: ctx
2998
- });
2999
- });
3000
- } else {
3001
- return this._def.schema._parseSync({
3002
- data: processed,
3003
- path: ctx.path,
3004
- parent: ctx
3005
- });
3006
- }
3007
- }
3008
3491
  const checkCtx = {
3009
3492
  addIssue: (arg) => {
3010
3493
  addIssueToContext(ctx, arg);
@@ -3019,6 +3502,42 @@ var require_types_cjs_development = __commonJS({
3019
3502
  }
3020
3503
  };
3021
3504
  checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
3505
+ if (effect.type === "preprocess") {
3506
+ const processed = effect.transform(ctx.data, checkCtx);
3507
+ if (ctx.common.async) {
3508
+ return Promise.resolve(processed).then(async (processed2) => {
3509
+ if (status.value === "aborted")
3510
+ return INVALID;
3511
+ const result = await this._def.schema._parseAsync({
3512
+ data: processed2,
3513
+ path: ctx.path,
3514
+ parent: ctx
3515
+ });
3516
+ if (result.status === "aborted")
3517
+ return INVALID;
3518
+ if (result.status === "dirty")
3519
+ return DIRTY(result.value);
3520
+ if (status.value === "dirty")
3521
+ return DIRTY(result.value);
3522
+ return result;
3523
+ });
3524
+ } else {
3525
+ if (status.value === "aborted")
3526
+ return INVALID;
3527
+ const result = this._def.schema._parseSync({
3528
+ data: processed,
3529
+ path: ctx.path,
3530
+ parent: ctx
3531
+ });
3532
+ if (result.status === "aborted")
3533
+ return INVALID;
3534
+ if (result.status === "dirty")
3535
+ return DIRTY(result.value);
3536
+ if (status.value === "dirty")
3537
+ return DIRTY(result.value);
3538
+ return result;
3539
+ }
3540
+ }
3022
3541
  if (effect.type === "refinement") {
3023
3542
  const executeRefinement = /* @__PURE__ */ __name2((acc) => {
3024
3543
  const result = effect.refinement(acc, checkCtx);
@@ -3165,26 +3684,45 @@ var require_types_cjs_development = __commonJS({
3165
3684
  var ZodCatch = /* @__PURE__ */ __name(class extends ZodType {
3166
3685
  _parse(input) {
3167
3686
  const { ctx } = this._processInputParams(input);
3687
+ const newCtx = {
3688
+ ...ctx,
3689
+ common: {
3690
+ ...ctx.common,
3691
+ issues: []
3692
+ }
3693
+ };
3168
3694
  const result = this._def.innerType._parse({
3169
- data: ctx.data,
3170
- path: ctx.path,
3171
- parent: ctx
3695
+ data: newCtx.data,
3696
+ path: newCtx.path,
3697
+ parent: {
3698
+ ...newCtx
3699
+ }
3172
3700
  });
3173
3701
  if (isAsync(result)) {
3174
3702
  return result.then((result2) => {
3175
3703
  return {
3176
3704
  status: "valid",
3177
- value: result2.status === "valid" ? result2.value : this._def.defaultValue()
3705
+ value: result2.status === "valid" ? result2.value : this._def.catchValue({
3706
+ get error() {
3707
+ return new ZodError(newCtx.common.issues);
3708
+ },
3709
+ input: newCtx.data
3710
+ })
3178
3711
  };
3179
3712
  });
3180
3713
  } else {
3181
3714
  return {
3182
3715
  status: "valid",
3183
- value: result.status === "valid" ? result.value : this._def.defaultValue()
3716
+ value: result.status === "valid" ? result.value : this._def.catchValue({
3717
+ get error() {
3718
+ return new ZodError(newCtx.common.issues);
3719
+ },
3720
+ input: newCtx.data
3721
+ })
3184
3722
  };
3185
3723
  }
3186
3724
  }
3187
- removeDefault() {
3725
+ removeCatch() {
3188
3726
  return this._def.innerType;
3189
3727
  }
3190
3728
  }, "ZodCatch");
@@ -3193,7 +3731,7 @@ var require_types_cjs_development = __commonJS({
3193
3731
  return new ZodCatch({
3194
3732
  innerType: type,
3195
3733
  typeName: ZodFirstPartyTypeKind.ZodCatch,
3196
- defaultValue: typeof params.default === "function" ? params.default : () => params.default,
3734
+ catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
3197
3735
  ...processCreateParams(params)
3198
3736
  });
3199
3737
  };
@@ -3291,17 +3829,44 @@ var require_types_cjs_development = __commonJS({
3291
3829
  }
3292
3830
  }, "ZodPipeline");
3293
3831
  __name2(ZodPipeline, "ZodPipeline");
3294
- var custom = /* @__PURE__ */ __name2((check, params = {}, fatal) => {
3832
+ var ZodReadonly = /* @__PURE__ */ __name(class extends ZodType {
3833
+ _parse(input) {
3834
+ const result = this._def.innerType._parse(input);
3835
+ const freeze = /* @__PURE__ */ __name2((data) => {
3836
+ if (isValid(data)) {
3837
+ data.value = Object.freeze(data.value);
3838
+ }
3839
+ return data;
3840
+ }, "freeze");
3841
+ return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
3842
+ }
3843
+ unwrap() {
3844
+ return this._def.innerType;
3845
+ }
3846
+ }, "ZodReadonly");
3847
+ __name2(ZodReadonly, "ZodReadonly");
3848
+ ZodReadonly.create = (type, params) => {
3849
+ return new ZodReadonly({
3850
+ innerType: type,
3851
+ typeName: ZodFirstPartyTypeKind.ZodReadonly,
3852
+ ...processCreateParams(params)
3853
+ });
3854
+ };
3855
+ function custom(check, params = {}, fatal) {
3295
3856
  if (check)
3296
3857
  return ZodAny.create().superRefine((data, ctx) => {
3858
+ var _a, _b;
3297
3859
  if (!check(data)) {
3298
- const p = typeof params === "function" ? params(data) : params;
3860
+ const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
3861
+ const _fatal = (_b = (_a = p.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
3299
3862
  const p2 = typeof p === "string" ? { message: p } : p;
3300
- ctx.addIssue({ code: "custom", ...p2, fatal });
3863
+ ctx.addIssue({ code: "custom", ...p2, fatal: _fatal });
3301
3864
  }
3302
3865
  });
3303
3866
  return ZodAny.create();
3304
- }, "custom");
3867
+ }
3868
+ __name(custom, "custom");
3869
+ __name2(custom, "custom");
3305
3870
  var late = {
3306
3871
  object: ZodObject.lazycreate
3307
3872
  };
@@ -3342,10 +3907,11 @@ var require_types_cjs_development = __commonJS({
3342
3907
  ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";
3343
3908
  ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";
3344
3909
  ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
3910
+ ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly";
3345
3911
  })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
3346
3912
  var instanceOfType = /* @__PURE__ */ __name2((cls, params = {
3347
3913
  message: `Input not instance of ${cls.name}`
3348
- }) => custom((data) => data instanceof cls, params, true), "instanceOfType");
3914
+ }) => custom((data) => data instanceof cls, params), "instanceOfType");
3349
3915
  var stringType = ZodString.create;
3350
3916
  var numberType = ZodNumber.create;
3351
3917
  var nanType = ZodNaN.create;
@@ -3386,12 +3952,15 @@ var require_types_cjs_development = __commonJS({
3386
3952
  var coerce = {
3387
3953
  string: (arg) => ZodString.create({ ...arg, coerce: true }),
3388
3954
  number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
3389
- boolean: (arg) => ZodBoolean.create({ ...arg, coerce: true }),
3955
+ boolean: (arg) => ZodBoolean.create({
3956
+ ...arg,
3957
+ coerce: true
3958
+ }),
3390
3959
  bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
3391
3960
  date: (arg) => ZodDate.create({ ...arg, coerce: true })
3392
3961
  };
3393
3962
  var NEVER = INVALID;
3394
- var mod = /* @__PURE__ */ Object.freeze({
3963
+ var z = /* @__PURE__ */ Object.freeze({
3395
3964
  __proto__: null,
3396
3965
  defaultErrorMap: errorMap,
3397
3966
  setErrorMap,
@@ -3410,9 +3979,13 @@ var require_types_cjs_development = __commonJS({
3410
3979
  get util() {
3411
3980
  return util;
3412
3981
  },
3982
+ get objectUtil() {
3983
+ return objectUtil;
3984
+ },
3413
3985
  ZodParsedType,
3414
3986
  getParsedType,
3415
3987
  ZodType,
3988
+ datetimeRegex,
3416
3989
  ZodString,
3417
3990
  ZodNumber,
3418
3991
  ZodBigInt,
@@ -3426,9 +3999,6 @@ var require_types_cjs_development = __commonJS({
3426
3999
  ZodNever,
3427
4000
  ZodVoid,
3428
4001
  ZodArray,
3429
- get objectUtil() {
3430
- return objectUtil;
3431
- },
3432
4002
  ZodObject,
3433
4003
  ZodUnion,
3434
4004
  ZodDiscriminatedUnion,
@@ -3453,6 +4023,7 @@ var require_types_cjs_development = __commonJS({
3453
4023
  BRAND,
3454
4024
  ZodBranded,
3455
4025
  ZodPipeline,
4026
+ ZodReadonly,
3456
4027
  custom,
3457
4028
  Schema: ZodType,
3458
4029
  ZodSchema: ZodType,
@@ -3505,35 +4076,132 @@ var require_types_cjs_development = __commonJS({
3505
4076
  quotelessJson,
3506
4077
  ZodError
3507
4078
  });
3508
- var ContextValidator = mod.array(mod.string().or(mod.record(mod.any())));
3509
- var AchievementCriteriaValidator = mod.object({
3510
- type: mod.string().optional(),
3511
- narrative: mod.string().optional()
4079
+ var currentSymbol = Symbol("current");
4080
+ var previousSymbol = Symbol("previous");
4081
+ var mergeOpenApi = /* @__PURE__ */ __name2((openapi, {
4082
+ ref: _ref,
4083
+ refType: _refType,
4084
+ param: _param,
4085
+ header: _header,
4086
+ ...rest
4087
+ } = {}) => ({
4088
+ ...rest,
4089
+ ...openapi
4090
+ }), "mergeOpenApi");
4091
+ function extendZodWithOpenApi(zod) {
4092
+ if (typeof zod.ZodType.prototype.openapi !== "undefined") {
4093
+ return;
4094
+ }
4095
+ zod.ZodType.prototype.openapi = function(openapi) {
4096
+ const { zodOpenApi, ...rest } = this._def;
4097
+ const result = new this.constructor({
4098
+ ...rest,
4099
+ zodOpenApi: {
4100
+ openapi: mergeOpenApi(
4101
+ openapi,
4102
+ zodOpenApi == null ? void 0 : zodOpenApi.openapi
4103
+ )
4104
+ }
4105
+ });
4106
+ result._def.zodOpenApi[currentSymbol] = result;
4107
+ if (zodOpenApi) {
4108
+ result._def.zodOpenApi[previousSymbol] = this;
4109
+ }
4110
+ return result;
4111
+ };
4112
+ const zodDescribe = zod.ZodType.prototype.describe;
4113
+ zod.ZodType.prototype.describe = function(...args) {
4114
+ const result = zodDescribe.apply(this, args);
4115
+ const def = result._def;
4116
+ if (def.zodOpenApi) {
4117
+ const cloned = { ...def.zodOpenApi };
4118
+ cloned.openapi = mergeOpenApi({ description: args[0] }, cloned.openapi);
4119
+ cloned[previousSymbol] = this;
4120
+ cloned[currentSymbol] = result;
4121
+ def.zodOpenApi = cloned;
4122
+ } else {
4123
+ def.zodOpenApi = {
4124
+ openapi: { description: args[0] },
4125
+ [currentSymbol]: result
4126
+ };
4127
+ }
4128
+ return result;
4129
+ };
4130
+ const zodObjectExtend = zod.ZodObject.prototype.extend;
4131
+ zod.ZodObject.prototype.extend = function(...args) {
4132
+ const extendResult = zodObjectExtend.apply(this, args);
4133
+ const zodOpenApi = extendResult._def.zodOpenApi;
4134
+ if (zodOpenApi) {
4135
+ const cloned = { ...zodOpenApi };
4136
+ cloned.openapi = mergeOpenApi({}, cloned.openapi);
4137
+ cloned[previousSymbol] = this;
4138
+ extendResult._def.zodOpenApi = cloned;
4139
+ } else {
4140
+ extendResult._def.zodOpenApi = {
4141
+ [previousSymbol]: this
4142
+ };
4143
+ }
4144
+ return extendResult;
4145
+ };
4146
+ const zodObjectOmit = zod.ZodObject.prototype.omit;
4147
+ zod.ZodObject.prototype.omit = function(...args) {
4148
+ const omitResult = zodObjectOmit.apply(this, args);
4149
+ const zodOpenApi = omitResult._def.zodOpenApi;
4150
+ if (zodOpenApi) {
4151
+ const cloned = { ...zodOpenApi };
4152
+ cloned.openapi = mergeOpenApi({}, cloned.openapi);
4153
+ delete cloned[previousSymbol];
4154
+ delete cloned[currentSymbol];
4155
+ omitResult._def.zodOpenApi = cloned;
4156
+ }
4157
+ return omitResult;
4158
+ };
4159
+ const zodObjectPick = zod.ZodObject.prototype.pick;
4160
+ zod.ZodObject.prototype.pick = function(...args) {
4161
+ const pickResult = zodObjectPick.apply(this, args);
4162
+ const zodOpenApi = pickResult._def.zodOpenApi;
4163
+ if (zodOpenApi) {
4164
+ const cloned = { ...zodOpenApi };
4165
+ cloned.openapi = mergeOpenApi({}, cloned.openapi);
4166
+ delete cloned[previousSymbol];
4167
+ delete cloned[currentSymbol];
4168
+ pickResult._def.zodOpenApi = cloned;
4169
+ }
4170
+ return pickResult;
4171
+ };
4172
+ }
4173
+ __name(extendZodWithOpenApi, "extendZodWithOpenApi");
4174
+ __name2(extendZodWithOpenApi, "extendZodWithOpenApi");
4175
+ extendZodWithOpenApi(z);
4176
+ var ContextValidator = z.array(z.string().or(z.record(z.any())));
4177
+ var AchievementCriteriaValidator = z.object({
4178
+ type: z.string().optional(),
4179
+ narrative: z.string().optional()
3512
4180
  });
3513
- var ImageValidator = mod.string().or(
3514
- mod.object({
3515
- id: mod.string(),
3516
- type: mod.string(),
3517
- caption: mod.string().optional()
4181
+ var ImageValidator = z.string().or(
4182
+ z.object({
4183
+ id: z.string(),
4184
+ type: z.string(),
4185
+ caption: z.string().optional()
3518
4186
  })
3519
4187
  );
3520
- var GeoCoordinatesValidator = mod.object({
3521
- type: mod.string().min(1).or(mod.string().array().nonempty()),
3522
- latitude: mod.number(),
3523
- longitude: mod.number()
4188
+ var GeoCoordinatesValidator = z.object({
4189
+ type: z.string().min(1).or(z.string().array().nonempty()),
4190
+ latitude: z.number(),
4191
+ longitude: z.number()
3524
4192
  });
3525
- var AddressValidator = mod.object({
3526
- type: mod.string().min(1).or(mod.string().array().nonempty()),
3527
- addressCountry: mod.string().optional(),
3528
- addressCountryCode: mod.string().optional(),
3529
- addressRegion: mod.string().optional(),
3530
- addressLocality: mod.string().optional(),
3531
- streetAddress: mod.string().optional(),
3532
- postOfficeBoxNumber: mod.string().optional(),
3533
- postalCode: mod.string().optional(),
4193
+ var AddressValidator = z.object({
4194
+ type: z.string().min(1).or(z.string().array().nonempty()),
4195
+ addressCountry: z.string().optional(),
4196
+ addressCountryCode: z.string().optional(),
4197
+ addressRegion: z.string().optional(),
4198
+ addressLocality: z.string().optional(),
4199
+ streetAddress: z.string().optional(),
4200
+ postOfficeBoxNumber: z.string().optional(),
4201
+ postalCode: z.string().optional(),
3534
4202
  geo: GeoCoordinatesValidator.optional()
3535
4203
  });
3536
- var IdentifierTypeValidator = mod.enum([
4204
+ var IdentifierTypeValidator = z.enum([
3537
4205
  "sourcedId",
3538
4206
  "systemId",
3539
4207
  "productId",
@@ -3552,140 +4220,140 @@ var require_types_cjs_development = __commonJS({
3552
4220
  "ltiPlatformId",
3553
4221
  "ltiUserId",
3554
4222
  "identifier"
3555
- ]).or(mod.string());
3556
- var IdentifierEntryValidator = mod.object({
3557
- type: mod.string().min(1).or(mod.string().array().nonempty()),
3558
- identifier: mod.string(),
4223
+ ]).or(z.string());
4224
+ var IdentifierEntryValidator = z.object({
4225
+ type: z.string().min(1).or(z.string().array().nonempty()),
4226
+ identifier: z.string(),
3559
4227
  identifierType: IdentifierTypeValidator
3560
4228
  });
3561
- var ProfileValidator = mod.string().or(
3562
- mod.object({
3563
- id: mod.string().optional(),
3564
- type: mod.string().or(mod.string().array().nonempty().optional()),
3565
- name: mod.string().optional(),
3566
- url: mod.string().optional(),
3567
- phone: mod.string().optional(),
3568
- description: mod.string().optional(),
3569
- endorsement: mod.any().array().optional(),
4229
+ var ProfileValidator = z.string().or(
4230
+ z.object({
4231
+ id: z.string().optional(),
4232
+ type: z.string().or(z.string().array().nonempty().optional()),
4233
+ name: z.string().optional(),
4234
+ url: z.string().optional(),
4235
+ phone: z.string().optional(),
4236
+ description: z.string().optional(),
4237
+ endorsement: z.any().array().optional(),
3570
4238
  image: ImageValidator.optional(),
3571
- email: mod.string().email().optional(),
4239
+ email: z.string().email().optional(),
3572
4240
  address: AddressValidator.optional(),
3573
4241
  otherIdentifier: IdentifierEntryValidator.array().optional(),
3574
- official: mod.string().optional(),
3575
- parentOrg: mod.any().optional(),
3576
- familyName: mod.string().optional(),
3577
- givenName: mod.string().optional(),
3578
- additionalName: mod.string().optional(),
3579
- patronymicName: mod.string().optional(),
3580
- honorificPrefix: mod.string().optional(),
3581
- honorificSuffix: mod.string().optional(),
3582
- familyNamePrefix: mod.string().optional(),
3583
- dateOfBirth: mod.string().optional()
3584
- }).catchall(mod.any())
4242
+ official: z.string().optional(),
4243
+ parentOrg: z.any().optional(),
4244
+ familyName: z.string().optional(),
4245
+ givenName: z.string().optional(),
4246
+ additionalName: z.string().optional(),
4247
+ patronymicName: z.string().optional(),
4248
+ honorificPrefix: z.string().optional(),
4249
+ honorificSuffix: z.string().optional(),
4250
+ familyNamePrefix: z.string().optional(),
4251
+ dateOfBirth: z.string().optional()
4252
+ }).catchall(z.any())
3585
4253
  );
3586
- var CredentialSubjectValidator = mod.object({ id: mod.string().optional() }).catchall(mod.any());
3587
- var CredentialStatusValidator = mod.object({ type: mod.string(), id: mod.string() }).catchall(mod.any());
3588
- var CredentialSchemaValidator = mod.object({ id: mod.string(), type: mod.string() }).catchall(mod.any());
3589
- var RefreshServiceValidator = mod.object({ id: mod.string().optional(), type: mod.string() }).catchall(mod.any());
3590
- var TermsOfUseValidator = mod.object({ type: mod.string(), id: mod.string().optional() }).catchall(mod.any());
3591
- var VC2EvidenceValidator = mod.object({ type: mod.string().or(mod.string().array().nonempty()), id: mod.string().optional() }).catchall(mod.any());
3592
- var UnsignedVCValidator = mod.object({
4254
+ var CredentialSubjectValidator = z.object({ id: z.string().optional() }).catchall(z.any());
4255
+ var CredentialStatusValidator = z.object({ type: z.string(), id: z.string() }).catchall(z.any());
4256
+ var CredentialSchemaValidator = z.object({ id: z.string(), type: z.string() }).catchall(z.any());
4257
+ var RefreshServiceValidator = z.object({ id: z.string().optional(), type: z.string() }).catchall(z.any());
4258
+ var TermsOfUseValidator = z.object({ type: z.string(), id: z.string().optional() }).catchall(z.any());
4259
+ var VC2EvidenceValidator = z.object({ type: z.string().or(z.string().array().nonempty()), id: z.string().optional() }).catchall(z.any());
4260
+ var UnsignedVCValidator = z.object({
3593
4261
  "@context": ContextValidator,
3594
- id: mod.string().optional(),
3595
- type: mod.string().array().nonempty(),
4262
+ id: z.string().optional(),
4263
+ type: z.string().array().nonempty(),
3596
4264
  issuer: ProfileValidator,
3597
4265
  credentialSubject: CredentialSubjectValidator.or(CredentialSubjectValidator.array()),
3598
4266
  refreshService: RefreshServiceValidator.or(RefreshServiceValidator.array()).optional(),
3599
4267
  credentialSchema: CredentialSchemaValidator.or(
3600
4268
  CredentialSchemaValidator.array()
3601
4269
  ).optional(),
3602
- issuanceDate: mod.string().optional(),
3603
- expirationDate: mod.string().optional(),
4270
+ issuanceDate: z.string().optional(),
4271
+ expirationDate: z.string().optional(),
3604
4272
  credentialStatus: CredentialStatusValidator.or(
3605
4273
  CredentialStatusValidator.array()
3606
4274
  ).optional(),
3607
- name: mod.string().optional(),
3608
- description: mod.string().optional(),
3609
- validFrom: mod.string().optional(),
3610
- validUntil: mod.string().optional(),
4275
+ name: z.string().optional(),
4276
+ description: z.string().optional(),
4277
+ validFrom: z.string().optional(),
4278
+ validUntil: z.string().optional(),
3611
4279
  status: CredentialStatusValidator.or(CredentialStatusValidator.array()).optional(),
3612
4280
  termsOfUse: TermsOfUseValidator.or(TermsOfUseValidator.array()).optional(),
3613
4281
  evidence: VC2EvidenceValidator.or(VC2EvidenceValidator.array()).optional()
3614
- }).catchall(mod.any());
3615
- var ProofValidator = mod.object({
3616
- type: mod.string(),
3617
- created: mod.string(),
3618
- challenge: mod.string().optional(),
3619
- domain: mod.string().optional(),
3620
- nonce: mod.string().optional(),
3621
- proofPurpose: mod.string(),
3622
- verificationMethod: mod.string(),
3623
- jws: mod.string().optional()
3624
- }).catchall(mod.any());
4282
+ }).catchall(z.any());
4283
+ var ProofValidator = z.object({
4284
+ type: z.string(),
4285
+ created: z.string(),
4286
+ challenge: z.string().optional(),
4287
+ domain: z.string().optional(),
4288
+ nonce: z.string().optional(),
4289
+ proofPurpose: z.string(),
4290
+ verificationMethod: z.string(),
4291
+ jws: z.string().optional()
4292
+ }).catchall(z.any());
3625
4293
  var VCValidator = UnsignedVCValidator.extend({
3626
4294
  proof: ProofValidator.or(ProofValidator.array())
3627
4295
  });
3628
- var UnsignedVPValidator = mod.object({
4296
+ var UnsignedVPValidator = z.object({
3629
4297
  "@context": ContextValidator,
3630
- id: mod.string().optional(),
3631
- type: mod.string().or(mod.string().array().nonempty()),
4298
+ id: z.string().optional(),
4299
+ type: z.string().or(z.string().array().nonempty()),
3632
4300
  verifiableCredential: VCValidator.or(VCValidator.array()).optional(),
3633
- holder: mod.string().optional()
3634
- }).catchall(mod.any());
4301
+ holder: z.string().optional()
4302
+ }).catchall(z.any());
3635
4303
  var VPValidator = UnsignedVPValidator.extend({
3636
4304
  proof: ProofValidator.or(ProofValidator.array())
3637
4305
  });
3638
- var JWKValidator = mod.object({
3639
- kty: mod.string(),
3640
- crv: mod.string(),
3641
- x: mod.string(),
3642
- y: mod.string().optional(),
3643
- n: mod.string().optional(),
3644
- d: mod.string().optional()
4306
+ var JWKValidator = z.object({
4307
+ kty: z.string(),
4308
+ crv: z.string(),
4309
+ x: z.string(),
4310
+ y: z.string().optional(),
4311
+ n: z.string().optional(),
4312
+ d: z.string().optional()
3645
4313
  });
3646
- var JWKWithPrivateKeyValidator = JWKValidator.omit({ d: true }).extend({ d: mod.string() });
3647
- var JWERecipientHeaderValidator = mod.object({
3648
- alg: mod.string(),
3649
- iv: mod.string(),
3650
- tag: mod.string(),
4314
+ var JWKWithPrivateKeyValidator = JWKValidator.omit({ d: true }).extend({ d: z.string() });
4315
+ var JWERecipientHeaderValidator = z.object({
4316
+ alg: z.string(),
4317
+ iv: z.string(),
4318
+ tag: z.string(),
3651
4319
  epk: JWKValidator.partial().optional(),
3652
- kid: mod.string().optional(),
3653
- apv: mod.string().optional(),
3654
- apu: mod.string().optional()
4320
+ kid: z.string().optional(),
4321
+ apv: z.string().optional(),
4322
+ apu: z.string().optional()
3655
4323
  });
3656
- var JWERecipientValidator = mod.object({
4324
+ var JWERecipientValidator = z.object({
3657
4325
  header: JWERecipientHeaderValidator,
3658
- encrypted_key: mod.string()
4326
+ encrypted_key: z.string()
3659
4327
  });
3660
- var JWEValidator2 = mod.object({
3661
- protected: mod.string(),
3662
- iv: mod.string(),
3663
- ciphertext: mod.string(),
3664
- tag: mod.string(),
3665
- aad: mod.string().optional(),
4328
+ var JWEValidator2 = z.object({
4329
+ protected: z.string(),
4330
+ iv: z.string(),
4331
+ ciphertext: z.string(),
4332
+ tag: z.string(),
4333
+ aad: z.string().optional(),
3666
4334
  recipients: JWERecipientValidator.array().optional()
3667
4335
  });
3668
- var VerificationMethodValidator = mod.string().or(
3669
- mod.object({
4336
+ var VerificationMethodValidator = z.string().or(
4337
+ z.object({
3670
4338
  "@context": ContextValidator.optional(),
3671
- id: mod.string(),
3672
- type: mod.string(),
3673
- controller: mod.string(),
4339
+ id: z.string(),
4340
+ type: z.string(),
4341
+ controller: z.string(),
3674
4342
  publicKeyJwk: JWKValidator.optional(),
3675
- publicKeyBase58: mod.string().optional(),
3676
- blockChainAccountId: mod.string().optional()
3677
- }).catchall(mod.any())
4343
+ publicKeyBase58: z.string().optional(),
4344
+ blockChainAccountId: z.string().optional()
4345
+ }).catchall(z.any())
3678
4346
  );
3679
- var ServiceValidator = mod.object({
3680
- id: mod.string(),
3681
- type: mod.string().or(mod.string().array().nonempty()),
3682
- serviceEndpoint: mod.any().or(mod.any().array().nonempty())
3683
- }).catchall(mod.any());
3684
- var DidDocumentValidator = mod.object({
4347
+ var ServiceValidator = z.object({
4348
+ id: z.string(),
4349
+ type: z.string().or(z.string().array().nonempty()),
4350
+ serviceEndpoint: z.any().or(z.any().array().nonempty())
4351
+ }).catchall(z.any());
4352
+ var DidDocumentValidator = z.object({
3685
4353
  "@context": ContextValidator,
3686
- id: mod.string(),
3687
- alsoKnownAs: mod.string().optional(),
3688
- controller: mod.string().or(mod.string().array().nonempty()).optional(),
4354
+ id: z.string(),
4355
+ alsoKnownAs: z.string().optional(),
4356
+ controller: z.string().or(z.string().array().nonempty()).optional(),
3689
4357
  verificationMethod: VerificationMethodValidator.array().optional(),
3690
4358
  authentication: VerificationMethodValidator.array().optional(),
3691
4359
  assertionMethod: VerificationMethodValidator.array().optional(),
@@ -3695,8 +4363,8 @@ var require_types_cjs_development = __commonJS({
3695
4363
  publicKey: VerificationMethodValidator.array().optional(),
3696
4364
  service: ServiceValidator.array().optional(),
3697
4365
  proof: ProofValidator.or(ProofValidator.array()).optional()
3698
- }).catchall(mod.any());
3699
- var AlignmentTargetTypeValidator = mod.enum([
4366
+ }).catchall(z.any());
4367
+ var AlignmentTargetTypeValidator = z.enum([
3700
4368
  "ceasn:Competency",
3701
4369
  "ceterms:Credential",
3702
4370
  "CFItem",
@@ -3704,17 +4372,17 @@ var require_types_cjs_development = __commonJS({
3704
4372
  "CFRubricCriterion",
3705
4373
  "CFRubricCriterionLevel",
3706
4374
  "CTDL"
3707
- ]).or(mod.string());
3708
- var AlignmentValidator = mod.object({
3709
- type: mod.string().array().nonempty(),
3710
- targetCode: mod.string().optional(),
3711
- targetDescription: mod.string().optional(),
3712
- targetName: mod.string(),
3713
- targetFramework: mod.string().optional(),
4375
+ ]).or(z.string());
4376
+ var AlignmentValidator = z.object({
4377
+ type: z.string().array().nonempty(),
4378
+ targetCode: z.string().optional(),
4379
+ targetDescription: z.string().optional(),
4380
+ targetName: z.string(),
4381
+ targetFramework: z.string().optional(),
3714
4382
  targetType: AlignmentTargetTypeValidator.optional(),
3715
- targetUrl: mod.string()
4383
+ targetUrl: z.string()
3716
4384
  });
3717
- var KnownAchievementTypeValidator = mod.enum([
4385
+ var KnownAchievementTypeValidator = z.enum([
3718
4386
  "Achievement",
3719
4387
  "ApprenticeshipCertificate",
3720
4388
  "Assessment",
@@ -3747,23 +4415,23 @@ var require_types_cjs_development = __commonJS({
3747
4415
  "ResearchDoctorate",
3748
4416
  "SecondarySchoolDiploma"
3749
4417
  ]);
3750
- var AchievementTypeValidator = KnownAchievementTypeValidator.or(mod.string());
3751
- var CriteriaValidator = mod.object({ id: mod.string().optional(), narrative: mod.string().optional() }).catchall(mod.any());
3752
- var EndorsementSubjectValidator = mod.object({
3753
- id: mod.string(),
3754
- type: mod.string().array().nonempty(),
3755
- endorsementComment: mod.string().optional()
4418
+ var AchievementTypeValidator = KnownAchievementTypeValidator.or(z.string());
4419
+ var CriteriaValidator = z.object({ id: z.string().optional(), narrative: z.string().optional() }).catchall(z.any());
4420
+ var EndorsementSubjectValidator = z.object({
4421
+ id: z.string(),
4422
+ type: z.string().array().nonempty(),
4423
+ endorsementComment: z.string().optional()
3756
4424
  });
3757
4425
  var EndorsementCredentialValidator = UnsignedVCValidator.extend({
3758
4426
  credentialSubject: EndorsementSubjectValidator,
3759
4427
  proof: ProofValidator.or(ProofValidator.array()).optional()
3760
4428
  });
3761
- var RelatedValidator = mod.object({
3762
- id: mod.string(),
3763
- "@language": mod.string().optional(),
3764
- version: mod.string().optional()
4429
+ var RelatedValidator = z.object({
4430
+ id: z.string(),
4431
+ "@language": z.string().optional(),
4432
+ version: z.string().optional()
3765
4433
  });
3766
- var ResultTypeValidator = mod.enum([
4434
+ var ResultTypeValidator = z.enum([
3767
4435
  "GradePointAverage",
3768
4436
  "LetterGrade",
3769
4437
  "Percent",
@@ -3776,59 +4444,59 @@ var require_types_cjs_development = __commonJS({
3776
4444
  "RubricScore",
3777
4445
  "ScaledScore",
3778
4446
  "Status"
3779
- ]).or(mod.string());
3780
- var RubricCriterionValidator = mod.object({
3781
- id: mod.string(),
3782
- type: mod.string().array().nonempty(),
4447
+ ]).or(z.string());
4448
+ var RubricCriterionValidator = z.object({
4449
+ id: z.string(),
4450
+ type: z.string().array().nonempty(),
3783
4451
  alignment: AlignmentValidator.array().optional(),
3784
- description: mod.string().optional(),
3785
- level: mod.string().optional(),
3786
- name: mod.string(),
3787
- points: mod.string().optional()
3788
- }).catchall(mod.any());
3789
- var ResultDescriptionValidator = mod.object({
3790
- id: mod.string(),
3791
- type: mod.string().array().nonempty(),
4452
+ description: z.string().optional(),
4453
+ level: z.string().optional(),
4454
+ name: z.string(),
4455
+ points: z.string().optional()
4456
+ }).catchall(z.any());
4457
+ var ResultDescriptionValidator = z.object({
4458
+ id: z.string(),
4459
+ type: z.string().array().nonempty(),
3792
4460
  alignment: AlignmentValidator.array().optional(),
3793
- allowedValue: mod.string().array().optional(),
3794
- name: mod.string(),
3795
- requiredLevel: mod.string().optional(),
3796
- requiredValue: mod.string().optional(),
4461
+ allowedValue: z.string().array().optional(),
4462
+ name: z.string(),
4463
+ requiredLevel: z.string().optional(),
4464
+ requiredValue: z.string().optional(),
3797
4465
  resultType: ResultTypeValidator,
3798
4466
  rubricCriterionLevel: RubricCriterionValidator.array().optional(),
3799
- valueMax: mod.string().optional(),
3800
- valueMin: mod.string().optional()
3801
- }).catchall(mod.any());
3802
- var AchievementValidator = mod.object({
3803
- id: mod.string().optional(),
3804
- type: mod.string().array().nonempty(),
4467
+ valueMax: z.string().optional(),
4468
+ valueMin: z.string().optional()
4469
+ }).catchall(z.any());
4470
+ var AchievementValidator = z.object({
4471
+ id: z.string().optional(),
4472
+ type: z.string().array().nonempty(),
3805
4473
  alignment: AlignmentValidator.array().optional(),
3806
4474
  achievementType: AchievementTypeValidator.optional(),
3807
4475
  creator: ProfileValidator.optional(),
3808
- creditsAvailable: mod.number().optional(),
4476
+ creditsAvailable: z.number().optional(),
3809
4477
  criteria: CriteriaValidator,
3810
- description: mod.string(),
4478
+ description: z.string(),
3811
4479
  endorsement: EndorsementCredentialValidator.array().optional(),
3812
- fieldOfStudy: mod.string().optional(),
3813
- humanCode: mod.string().optional(),
4480
+ fieldOfStudy: z.string().optional(),
4481
+ humanCode: z.string().optional(),
3814
4482
  image: ImageValidator.optional(),
3815
- "@language": mod.string().optional(),
3816
- name: mod.string(),
4483
+ "@language": z.string().optional(),
4484
+ name: z.string(),
3817
4485
  otherIdentifier: IdentifierEntryValidator.array().optional(),
3818
4486
  related: RelatedValidator.array().optional(),
3819
4487
  resultDescription: ResultDescriptionValidator.array().optional(),
3820
- specialization: mod.string().optional(),
3821
- tag: mod.string().array().optional(),
3822
- version: mod.string().optional()
3823
- }).catchall(mod.any());
3824
- var IdentityObjectValidator = mod.object({
3825
- type: mod.string(),
3826
- hashed: mod.boolean(),
3827
- identityHash: mod.string(),
3828
- identityType: mod.string(),
3829
- salt: mod.string().optional()
4488
+ specialization: z.string().optional(),
4489
+ tag: z.string().array().optional(),
4490
+ version: z.string().optional()
4491
+ }).catchall(z.any());
4492
+ var IdentityObjectValidator = z.object({
4493
+ type: z.string(),
4494
+ hashed: z.boolean(),
4495
+ identityHash: z.string(),
4496
+ identityType: z.string(),
4497
+ salt: z.string().optional()
3830
4498
  });
3831
- var ResultStatusTypeValidator = mod.enum([
4499
+ var ResultStatusTypeValidator = z.enum([
3832
4500
  "Completed",
3833
4501
  "Enrolled",
3834
4502
  "Failed",
@@ -3836,42 +4504,42 @@ var require_types_cjs_development = __commonJS({
3836
4504
  "OnHold",
3837
4505
  "Withdrew"
3838
4506
  ]);
3839
- var ResultValidator = mod.object({
3840
- type: mod.string().array().nonempty(),
3841
- achievedLevel: mod.string().optional(),
4507
+ var ResultValidator = z.object({
4508
+ type: z.string().array().nonempty(),
4509
+ achievedLevel: z.string().optional(),
3842
4510
  alignment: AlignmentValidator.array().optional(),
3843
- resultDescription: mod.string().optional(),
4511
+ resultDescription: z.string().optional(),
3844
4512
  status: ResultStatusTypeValidator.optional(),
3845
- value: mod.string().optional()
3846
- }).catchall(mod.any());
3847
- var AchievementSubjectValidator = mod.object({
3848
- id: mod.string().optional(),
3849
- type: mod.string().array().nonempty(),
3850
- activityEndDate: mod.string().optional(),
3851
- activityStartDate: mod.string().optional(),
3852
- creditsEarned: mod.number().optional(),
4513
+ value: z.string().optional()
4514
+ }).catchall(z.any());
4515
+ var AchievementSubjectValidator = z.object({
4516
+ id: z.string().optional(),
4517
+ type: z.string().array().nonempty(),
4518
+ activityEndDate: z.string().optional(),
4519
+ activityStartDate: z.string().optional(),
4520
+ creditsEarned: z.number().optional(),
3853
4521
  achievement: AchievementValidator.optional(),
3854
4522
  identifier: IdentityObjectValidator.array().optional(),
3855
4523
  image: ImageValidator.optional(),
3856
- licenseNumber: mod.string().optional(),
3857
- narrative: mod.string().optional(),
4524
+ licenseNumber: z.string().optional(),
4525
+ narrative: z.string().optional(),
3858
4526
  result: ResultValidator.array().optional(),
3859
- role: mod.string().optional(),
4527
+ role: z.string().optional(),
3860
4528
  source: ProfileValidator.optional(),
3861
- term: mod.string().optional()
3862
- }).catchall(mod.any());
3863
- var EvidenceValidator = mod.object({
3864
- id: mod.string().optional(),
3865
- type: mod.string().or(mod.string().array().nonempty()),
3866
- narrative: mod.string().optional(),
3867
- name: mod.string().optional(),
3868
- description: mod.string().optional(),
3869
- genre: mod.string().optional(),
3870
- audience: mod.string().optional()
3871
- }).catchall(mod.any());
4529
+ term: z.string().optional()
4530
+ }).catchall(z.any());
4531
+ var EvidenceValidator = z.object({
4532
+ id: z.string().optional(),
4533
+ type: z.string().or(z.string().array().nonempty()),
4534
+ narrative: z.string().optional(),
4535
+ name: z.string().optional(),
4536
+ description: z.string().optional(),
4537
+ genre: z.string().optional(),
4538
+ audience: z.string().optional()
4539
+ }).catchall(z.any());
3872
4540
  var UnsignedAchievementCredentialValidator = UnsignedVCValidator.extend({
3873
- name: mod.string().optional(),
3874
- description: mod.string().optional(),
4541
+ name: z.string().optional(),
4542
+ description: z.string().optional(),
3875
4543
  image: ImageValidator.optional(),
3876
4544
  credentialSubject: AchievementSubjectValidator.or(
3877
4545
  AchievementSubjectValidator.array()
@@ -3882,42 +4550,42 @@ var require_types_cjs_development = __commonJS({
3882
4550
  var AchievementCredentialValidator = UnsignedAchievementCredentialValidator.extend({
3883
4551
  proof: ProofValidator.or(ProofValidator.array())
3884
4552
  });
3885
- var VerificationCheckValidator = mod.object({
3886
- checks: mod.string().array(),
3887
- warnings: mod.string().array(),
3888
- errors: mod.string().array()
4553
+ var VerificationCheckValidator = z.object({
4554
+ checks: z.string().array(),
4555
+ warnings: z.string().array(),
4556
+ errors: z.string().array()
3889
4557
  });
3890
- var VerificationStatusValidator = mod.enum(["Success", "Failed", "Error"]);
4558
+ var VerificationStatusValidator = z.enum(["Success", "Failed", "Error"]);
3891
4559
  var VerificationStatusEnum = VerificationStatusValidator.enum;
3892
- var VerificationItemValidator = mod.object({
3893
- check: mod.string(),
4560
+ var VerificationItemValidator = z.object({
4561
+ check: z.string(),
3894
4562
  status: VerificationStatusValidator,
3895
- message: mod.string().optional(),
3896
- details: mod.string().optional()
4563
+ message: z.string().optional(),
4564
+ details: z.string().optional()
3897
4565
  });
3898
- var CredentialInfoValidator = mod.object({
3899
- title: mod.string().optional(),
3900
- createdAt: mod.string().optional(),
4566
+ var CredentialInfoValidator = z.object({
4567
+ title: z.string().optional(),
4568
+ createdAt: z.string().optional(),
3901
4569
  issuer: ProfileValidator.optional(),
3902
4570
  issuee: ProfileValidator.optional(),
3903
4571
  credentialSubject: CredentialSubjectValidator.optional()
3904
4572
  });
3905
- var CredentialRecordValidator = mod.object({ id: mod.string(), uri: mod.string() }).catchall(mod.any());
3906
- var PaginationOptionsValidator = mod.object({
3907
- limit: mod.number(),
3908
- cursor: mod.string().optional(),
3909
- sort: mod.string().optional()
4573
+ var CredentialRecordValidator = z.object({ id: z.string(), uri: z.string() }).catchall(z.any());
4574
+ var PaginationOptionsValidator = z.object({
4575
+ limit: z.number(),
4576
+ cursor: z.string().optional(),
4577
+ sort: z.string().optional()
3910
4578
  });
3911
- var PaginationResponseValidator = mod.object({
3912
- cursor: mod.string().optional(),
3913
- hasMore: mod.boolean()
4579
+ var PaginationResponseValidator = z.object({
4580
+ cursor: z.string().optional(),
4581
+ hasMore: z.boolean()
3914
4582
  });
3915
- var EncryptedRecordValidator = mod.object({ encryptedRecord: JWEValidator2, fields: mod.string().array() }).catchall(mod.any());
4583
+ var EncryptedRecordValidator = z.object({ encryptedRecord: JWEValidator2, fields: z.string().array() }).catchall(z.any());
3916
4584
  var PaginatedEncryptedRecordsValidator = PaginationResponseValidator.extend({
3917
4585
  records: EncryptedRecordValidator.array()
3918
4586
  });
3919
4587
  var EncryptedCredentialRecordValidator = EncryptedRecordValidator.extend({
3920
- id: mod.string()
4588
+ id: z.string()
3921
4589
  });
3922
4590
  var PaginatedEncryptedCredentialRecordsValidator = PaginationResponseValidator.extend({
3923
4591
  records: EncryptedCredentialRecordValidator.array()
@@ -3928,8 +4596,8 @@ var require_types_cjs_development = __commonJS({
3928
4596
  throw new Error("Invalid RegExp string format");
3929
4597
  return { pattern: match[1], flags: match[2] };
3930
4598
  }, "parseRegexString");
3931
- var RegExpValidator = mod.instanceof(RegExp).or(
3932
- mod.string().refine(
4599
+ var RegExpValidator = z.instanceof(RegExp).or(
4600
+ z.string().refine(
3933
4601
  (str) => {
3934
4602
  try {
3935
4603
  parseRegexString(str);
@@ -3950,71 +4618,71 @@ var require_types_cjs_development = __commonJS({
3950
4618
  }
3951
4619
  })
3952
4620
  );
3953
- var StringQuery = mod.string().or(mod.object({ $in: mod.string().array() })).or(mod.object({ $regex: RegExpValidator }));
3954
- var LCNProfileDisplayValidator = mod.object({
3955
- backgroundColor: mod.string().optional(),
3956
- backgroundImage: mod.string().optional(),
3957
- fadeBackgroundImage: mod.boolean().optional(),
3958
- repeatBackgroundImage: mod.boolean().optional(),
3959
- fontColor: mod.string().optional(),
3960
- accentColor: mod.string().optional(),
3961
- accentFontColor: mod.string().optional(),
3962
- idBackgroundImage: mod.string().optional(),
3963
- fadeIdBackgroundImage: mod.boolean().optional(),
3964
- idBackgroundColor: mod.string().optional(),
3965
- repeatIdBackgroundImage: mod.boolean().optional()
4621
+ var StringQuery = z.string().or(z.object({ $in: z.string().array() })).or(z.object({ $regex: RegExpValidator }));
4622
+ var LCNProfileDisplayValidator = z.object({
4623
+ backgroundColor: z.string().optional(),
4624
+ backgroundImage: z.string().optional(),
4625
+ fadeBackgroundImage: z.boolean().optional(),
4626
+ repeatBackgroundImage: z.boolean().optional(),
4627
+ fontColor: z.string().optional(),
4628
+ accentColor: z.string().optional(),
4629
+ accentFontColor: z.string().optional(),
4630
+ idBackgroundImage: z.string().optional(),
4631
+ fadeIdBackgroundImage: z.boolean().optional(),
4632
+ idBackgroundColor: z.string().optional(),
4633
+ repeatIdBackgroundImage: z.boolean().optional()
3966
4634
  });
3967
- var LCNProfileValidator = mod.object({
3968
- profileId: mod.string().min(3).max(40),
3969
- displayName: mod.string().default(""),
3970
- shortBio: mod.string().default(""),
3971
- bio: mod.string().default(""),
3972
- did: mod.string(),
3973
- isPrivate: mod.boolean().optional(),
3974
- email: mod.string().optional(),
3975
- image: mod.string().optional(),
3976
- heroImage: mod.string().optional(),
3977
- websiteLink: mod.string().optional(),
3978
- isServiceProfile: mod.boolean().default(false).optional(),
3979
- type: mod.string().optional(),
3980
- notificationsWebhook: mod.string().url().startsWith("http").optional(),
3981
- display: LCNProfileDisplayValidator.optional(),
3982
- role: mod.string().default("").optional(),
3983
- dob: mod.string().default("").optional()
4635
+ var LCNProfileValidator = z.object({
4636
+ profileId: z.string().min(3).max(40).describe("Unique, URL-safe identifier for the profile."),
4637
+ displayName: z.string().default("").describe("Human-readable display name for the profile."),
4638
+ shortBio: z.string().default("").describe("Short bio for the profile."),
4639
+ bio: z.string().default("").describe("Longer bio for the profile."),
4640
+ did: z.string().describe("Decentralized Identifier for the profile. (auto-assigned)"),
4641
+ isPrivate: z.boolean().optional().describe("Whether the profile is private or not and shows up in search results."),
4642
+ email: z.string().optional().describe("Contact email address for the profile."),
4643
+ image: z.string().optional().describe("Profile image URL for the profile."),
4644
+ heroImage: z.string().optional().describe("Hero image URL for the profile."),
4645
+ websiteLink: z.string().optional().describe("Website link for the profile."),
4646
+ isServiceProfile: z.boolean().default(false).optional().describe("Whether the profile is a service profile or not."),
4647
+ type: z.string().optional().describe('Profile type: e.g. "person", "organization", "service".'),
4648
+ notificationsWebhook: z.string().url().startsWith("http").optional().describe("URL to send notifications to."),
4649
+ display: LCNProfileDisplayValidator.optional().describe("Display settings for the profile."),
4650
+ role: z.string().default("").optional().describe('Role of the profile: e.g. "teacher", "student".'),
4651
+ dob: z.string().default("").optional().describe('Date of birth of the profile: e.g. "1990-01-01".')
3984
4652
  });
3985
- var LCNProfileQueryValidator = mod.object({
4653
+ var LCNProfileQueryValidator = z.object({
3986
4654
  profileId: StringQuery,
3987
4655
  displayName: StringQuery,
3988
4656
  shortBio: StringQuery,
3989
4657
  bio: StringQuery,
3990
4658
  email: StringQuery,
3991
4659
  websiteLink: StringQuery,
3992
- isServiceProfile: mod.boolean(),
4660
+ isServiceProfile: z.boolean(),
3993
4661
  type: StringQuery
3994
4662
  }).partial();
3995
4663
  var PaginatedLCNProfilesValidator = PaginationResponseValidator.extend({
3996
4664
  records: LCNProfileValidator.array()
3997
4665
  });
3998
- var LCNProfileConnectionStatusEnum = mod.enum([
4666
+ var LCNProfileConnectionStatusEnum = z.enum([
3999
4667
  "CONNECTED",
4000
4668
  "PENDING_REQUEST_SENT",
4001
4669
  "PENDING_REQUEST_RECEIVED",
4002
4670
  "NOT_CONNECTED"
4003
4671
  ]);
4004
- var LCNProfileManagerValidator = mod.object({
4005
- id: mod.string(),
4006
- created: mod.string(),
4007
- displayName: mod.string().default("").optional(),
4008
- shortBio: mod.string().default("").optional(),
4009
- bio: mod.string().default("").optional(),
4010
- email: mod.string().optional(),
4011
- image: mod.string().optional(),
4012
- heroImage: mod.string().optional()
4672
+ var LCNProfileManagerValidator = z.object({
4673
+ id: z.string(),
4674
+ created: z.string(),
4675
+ displayName: z.string().default("").optional(),
4676
+ shortBio: z.string().default("").optional(),
4677
+ bio: z.string().default("").optional(),
4678
+ email: z.string().optional(),
4679
+ image: z.string().optional(),
4680
+ heroImage: z.string().optional()
4013
4681
  });
4014
4682
  var PaginatedLCNProfileManagersValidator = PaginationResponseValidator.extend({
4015
- records: LCNProfileManagerValidator.extend({ did: mod.string() }).array()
4683
+ records: LCNProfileManagerValidator.extend({ did: z.string() }).array()
4016
4684
  });
4017
- var LCNProfileManagerQueryValidator = mod.object({
4685
+ var LCNProfileManagerQueryValidator = z.object({
4018
4686
  id: StringQuery,
4019
4687
  displayName: StringQuery,
4020
4688
  shortBio: StringQuery,
@@ -4022,296 +4690,296 @@ var require_types_cjs_development = __commonJS({
4022
4690
  email: StringQuery
4023
4691
  }).partial();
4024
4692
  var PaginatedLCNProfilesAndManagersValidator = PaginationResponseValidator.extend({
4025
- records: mod.object({
4693
+ records: z.object({
4026
4694
  profile: LCNProfileValidator,
4027
- manager: LCNProfileManagerValidator.extend({ did: mod.string() }).optional()
4695
+ manager: LCNProfileManagerValidator.extend({ did: z.string() }).optional()
4028
4696
  }).array()
4029
4697
  });
4030
- var SentCredentialInfoValidator = mod.object({
4031
- uri: mod.string(),
4032
- to: mod.string(),
4033
- from: mod.string(),
4034
- sent: mod.string().datetime(),
4035
- received: mod.string().datetime().optional()
4698
+ var SentCredentialInfoValidator = z.object({
4699
+ uri: z.string(),
4700
+ to: z.string(),
4701
+ from: z.string(),
4702
+ sent: z.string().datetime(),
4703
+ received: z.string().datetime().optional()
4036
4704
  });
4037
- var BoostPermissionsValidator = mod.object({
4038
- role: mod.string(),
4039
- canEdit: mod.boolean(),
4040
- canIssue: mod.boolean(),
4041
- canRevoke: mod.boolean(),
4042
- canManagePermissions: mod.boolean(),
4043
- canIssueChildren: mod.string(),
4044
- canCreateChildren: mod.string(),
4045
- canEditChildren: mod.string(),
4046
- canRevokeChildren: mod.string(),
4047
- canManageChildrenPermissions: mod.string(),
4048
- canManageChildrenProfiles: mod.boolean().default(false).optional(),
4049
- canViewAnalytics: mod.boolean()
4705
+ var BoostPermissionsValidator = z.object({
4706
+ role: z.string(),
4707
+ canEdit: z.boolean(),
4708
+ canIssue: z.boolean(),
4709
+ canRevoke: z.boolean(),
4710
+ canManagePermissions: z.boolean(),
4711
+ canIssueChildren: z.string(),
4712
+ canCreateChildren: z.string(),
4713
+ canEditChildren: z.string(),
4714
+ canRevokeChildren: z.string(),
4715
+ canManageChildrenPermissions: z.string(),
4716
+ canManageChildrenProfiles: z.boolean().default(false).optional(),
4717
+ canViewAnalytics: z.boolean()
4050
4718
  });
4051
- var BoostPermissionsQueryValidator = mod.object({
4719
+ var BoostPermissionsQueryValidator = z.object({
4052
4720
  role: StringQuery,
4053
- canEdit: mod.boolean(),
4054
- canIssue: mod.boolean(),
4055
- canRevoke: mod.boolean(),
4056
- canManagePermissions: mod.boolean(),
4721
+ canEdit: z.boolean(),
4722
+ canIssue: z.boolean(),
4723
+ canRevoke: z.boolean(),
4724
+ canManagePermissions: z.boolean(),
4057
4725
  canIssueChildren: StringQuery,
4058
4726
  canCreateChildren: StringQuery,
4059
4727
  canEditChildren: StringQuery,
4060
4728
  canRevokeChildren: StringQuery,
4061
4729
  canManageChildrenPermissions: StringQuery,
4062
- canManageChildrenProfiles: mod.boolean(),
4063
- canViewAnalytics: mod.boolean()
4730
+ canManageChildrenProfiles: z.boolean(),
4731
+ canViewAnalytics: z.boolean()
4064
4732
  }).partial();
4065
- var ClaimHookTypeValidator = mod.enum(["GRANT_PERMISSIONS", "ADD_ADMIN"]);
4066
- var ClaimHookValidator = mod.discriminatedUnion("type", [
4067
- mod.object({
4068
- type: mod.literal(ClaimHookTypeValidator.Values.GRANT_PERMISSIONS),
4069
- data: mod.object({
4070
- claimUri: mod.string(),
4071
- targetUri: mod.string(),
4733
+ var ClaimHookTypeValidator = z.enum(["GRANT_PERMISSIONS", "ADD_ADMIN"]);
4734
+ var ClaimHookValidator = z.discriminatedUnion("type", [
4735
+ z.object({
4736
+ type: z.literal(ClaimHookTypeValidator.Values.GRANT_PERMISSIONS),
4737
+ data: z.object({
4738
+ claimUri: z.string(),
4739
+ targetUri: z.string(),
4072
4740
  permissions: BoostPermissionsValidator.partial()
4073
4741
  })
4074
4742
  }),
4075
- mod.object({
4076
- type: mod.literal(ClaimHookTypeValidator.Values.ADD_ADMIN),
4077
- data: mod.object({ claimUri: mod.string(), targetUri: mod.string() })
4743
+ z.object({
4744
+ type: z.literal(ClaimHookTypeValidator.Values.ADD_ADMIN),
4745
+ data: z.object({ claimUri: z.string(), targetUri: z.string() })
4078
4746
  })
4079
4747
  ]);
4080
- var ClaimHookQueryValidator = mod.object({
4748
+ var ClaimHookQueryValidator = z.object({
4081
4749
  type: StringQuery,
4082
- data: mod.object({
4750
+ data: z.object({
4083
4751
  claimUri: StringQuery,
4084
4752
  targetUri: StringQuery,
4085
4753
  permissions: BoostPermissionsQueryValidator
4086
4754
  })
4087
4755
  }).deepPartial();
4088
- var FullClaimHookValidator = mod.object({ id: mod.string(), createdAt: mod.string(), updatedAt: mod.string() }).and(ClaimHookValidator);
4756
+ var FullClaimHookValidator = z.object({ id: z.string(), createdAt: z.string(), updatedAt: z.string() }).and(ClaimHookValidator);
4089
4757
  var PaginatedClaimHooksValidator = PaginationResponseValidator.extend({
4090
4758
  records: FullClaimHookValidator.array()
4091
4759
  });
4092
- var LCNBoostStatus = mod.enum(["DRAFT", "LIVE"]);
4093
- var BoostValidator = mod.object({
4094
- uri: mod.string(),
4095
- name: mod.string().optional(),
4096
- type: mod.string().optional(),
4097
- category: mod.string().optional(),
4760
+ var LCNBoostStatus = z.enum(["DRAFT", "LIVE"]);
4761
+ var BoostValidator = z.object({
4762
+ uri: z.string(),
4763
+ name: z.string().optional(),
4764
+ type: z.string().optional(),
4765
+ category: z.string().optional(),
4098
4766
  status: LCNBoostStatus.optional(),
4099
- autoConnectRecipients: mod.boolean().optional(),
4100
- meta: mod.record(mod.any()).optional(),
4767
+ autoConnectRecipients: z.boolean().optional(),
4768
+ meta: z.record(z.any()).optional(),
4101
4769
  claimPermissions: BoostPermissionsValidator.optional()
4102
4770
  });
4103
- var BoostQueryValidator = mod.object({
4771
+ var BoostQueryValidator = z.object({
4104
4772
  uri: StringQuery,
4105
4773
  name: StringQuery,
4106
4774
  type: StringQuery,
4107
4775
  category: StringQuery,
4108
- meta: mod.record(StringQuery),
4109
- status: LCNBoostStatus.or(mod.object({ $in: LCNBoostStatus.array() })),
4110
- autoConnectRecipients: mod.boolean()
4776
+ meta: z.record(StringQuery),
4777
+ status: LCNBoostStatus.or(z.object({ $in: LCNBoostStatus.array() })),
4778
+ autoConnectRecipients: z.boolean()
4111
4779
  }).partial();
4112
4780
  var PaginatedBoostsValidator = PaginationResponseValidator.extend({
4113
4781
  records: BoostValidator.array()
4114
4782
  });
4115
- var BoostRecipientValidator = mod.object({
4783
+ var BoostRecipientValidator = z.object({
4116
4784
  to: LCNProfileValidator,
4117
- from: mod.string(),
4118
- received: mod.string().optional(),
4119
- uri: mod.string().optional()
4785
+ from: z.string(),
4786
+ received: z.string().optional(),
4787
+ uri: z.string().optional()
4120
4788
  });
4121
4789
  var PaginatedBoostRecipientsValidator = PaginationResponseValidator.extend({
4122
4790
  records: BoostRecipientValidator.array()
4123
4791
  });
4124
- var LCNBoostClaimLinkSigningAuthorityValidator = mod.object({
4125
- endpoint: mod.string(),
4126
- name: mod.string(),
4127
- did: mod.string().optional()
4792
+ var LCNBoostClaimLinkSigningAuthorityValidator = z.object({
4793
+ endpoint: z.string(),
4794
+ name: z.string(),
4795
+ did: z.string().optional()
4128
4796
  });
4129
- var LCNBoostClaimLinkOptionsValidator = mod.object({
4130
- ttlSeconds: mod.number().optional(),
4131
- totalUses: mod.number().optional()
4797
+ var LCNBoostClaimLinkOptionsValidator = z.object({
4798
+ ttlSeconds: z.number().optional(),
4799
+ totalUses: z.number().optional()
4132
4800
  });
4133
- var LCNSigningAuthorityValidator = mod.object({
4134
- endpoint: mod.string()
4801
+ var LCNSigningAuthorityValidator = z.object({
4802
+ endpoint: z.string()
4135
4803
  });
4136
- var LCNSigningAuthorityForUserValidator = mod.object({
4804
+ var LCNSigningAuthorityForUserValidator = z.object({
4137
4805
  signingAuthority: LCNSigningAuthorityValidator,
4138
- relationship: mod.object({
4139
- name: mod.string().max(15).regex(/^[a-z0-9-]+$/, {
4806
+ relationship: z.object({
4807
+ name: z.string().max(15).regex(/^[a-z0-9-]+$/, {
4140
4808
  message: "The input string must contain only lowercase letters, numbers, and hyphens."
4141
4809
  }),
4142
- did: mod.string()
4810
+ did: z.string()
4143
4811
  })
4144
4812
  });
4145
- var AutoBoostConfigValidator = mod.object({
4146
- boostUri: mod.string(),
4147
- signingAuthority: mod.object({
4148
- endpoint: mod.string(),
4149
- name: mod.string()
4813
+ var AutoBoostConfigValidator = z.object({
4814
+ boostUri: z.string(),
4815
+ signingAuthority: z.object({
4816
+ endpoint: z.string(),
4817
+ name: z.string()
4150
4818
  })
4151
4819
  });
4152
- var ConsentFlowTermsStatusValidator = mod.enum(["live", "stale", "withdrawn"]);
4153
- var ConsentFlowContractValidator = mod.object({
4154
- read: mod.object({
4155
- anonymize: mod.boolean().optional(),
4156
- credentials: mod.object({ categories: mod.record(mod.object({ required: mod.boolean() })).default({}) }).default({}),
4157
- personal: mod.record(mod.object({ required: mod.boolean() })).default({})
4820
+ var ConsentFlowTermsStatusValidator = z.enum(["live", "stale", "withdrawn"]);
4821
+ var ConsentFlowContractValidator = z.object({
4822
+ read: z.object({
4823
+ anonymize: z.boolean().optional(),
4824
+ credentials: z.object({ categories: z.record(z.object({ required: z.boolean() })).default({}) }).default({}),
4825
+ personal: z.record(z.object({ required: z.boolean() })).default({})
4158
4826
  }).default({}),
4159
- write: mod.object({
4160
- credentials: mod.object({ categories: mod.record(mod.object({ required: mod.boolean() })).default({}) }).default({}),
4161
- personal: mod.record(mod.object({ required: mod.boolean() })).default({})
4827
+ write: z.object({
4828
+ credentials: z.object({ categories: z.record(z.object({ required: z.boolean() })).default({}) }).default({}),
4829
+ personal: z.record(z.object({ required: z.boolean() })).default({})
4162
4830
  }).default({})
4163
4831
  });
4164
- var ConsentFlowContractDetailsValidator = mod.object({
4832
+ var ConsentFlowContractDetailsValidator = z.object({
4165
4833
  contract: ConsentFlowContractValidator,
4166
4834
  owner: LCNProfileValidator,
4167
- name: mod.string(),
4168
- subtitle: mod.string().optional(),
4169
- description: mod.string().optional(),
4170
- reasonForAccessing: mod.string().optional(),
4171
- image: mod.string().optional(),
4172
- uri: mod.string(),
4173
- needsGuardianConsent: mod.boolean().optional(),
4174
- redirectUrl: mod.string().optional(),
4175
- frontDoorBoostUri: mod.string().optional(),
4176
- createdAt: mod.string(),
4177
- updatedAt: mod.string(),
4178
- expiresAt: mod.string().optional(),
4179
- autoBoosts: mod.string().array().optional(),
4180
- writers: mod.array(LCNProfileValidator).optional()
4835
+ name: z.string(),
4836
+ subtitle: z.string().optional(),
4837
+ description: z.string().optional(),
4838
+ reasonForAccessing: z.string().optional(),
4839
+ image: z.string().optional(),
4840
+ uri: z.string(),
4841
+ needsGuardianConsent: z.boolean().optional(),
4842
+ redirectUrl: z.string().optional(),
4843
+ frontDoorBoostUri: z.string().optional(),
4844
+ createdAt: z.string(),
4845
+ updatedAt: z.string(),
4846
+ expiresAt: z.string().optional(),
4847
+ autoBoosts: z.string().array().optional(),
4848
+ writers: z.array(LCNProfileValidator).optional()
4181
4849
  });
4182
4850
  var PaginatedConsentFlowContractsValidator = PaginationResponseValidator.extend({
4183
4851
  records: ConsentFlowContractDetailsValidator.omit({ owner: true }).array()
4184
4852
  });
4185
- var ConsentFlowContractDataValidator = mod.object({
4186
- credentials: mod.object({ categories: mod.record(mod.string().array()).default({}) }),
4187
- personal: mod.record(mod.string()).default({}),
4188
- date: mod.string()
4853
+ var ConsentFlowContractDataValidator = z.object({
4854
+ credentials: z.object({ categories: z.record(z.string().array()).default({}) }),
4855
+ personal: z.record(z.string()).default({}),
4856
+ date: z.string()
4189
4857
  });
4190
4858
  var PaginatedConsentFlowDataValidator = PaginationResponseValidator.extend({
4191
4859
  records: ConsentFlowContractDataValidator.array()
4192
4860
  });
4193
- var ConsentFlowContractDataForDidValidator = mod.object({
4194
- credentials: mod.object({ category: mod.string(), uri: mod.string() }).array(),
4195
- personal: mod.record(mod.string()).default({}),
4196
- date: mod.string(),
4197
- contractUri: mod.string()
4861
+ var ConsentFlowContractDataForDidValidator = z.object({
4862
+ credentials: z.object({ category: z.string(), uri: z.string() }).array(),
4863
+ personal: z.record(z.string()).default({}),
4864
+ date: z.string(),
4865
+ contractUri: z.string()
4198
4866
  });
4199
4867
  var PaginatedConsentFlowDataForDidValidator = PaginationResponseValidator.extend({
4200
4868
  records: ConsentFlowContractDataForDidValidator.array()
4201
4869
  });
4202
- var ConsentFlowTermValidator = mod.object({
4203
- sharing: mod.boolean().optional(),
4204
- shared: mod.string().array().optional(),
4205
- shareAll: mod.boolean().optional(),
4206
- shareUntil: mod.string().optional()
4870
+ var ConsentFlowTermValidator = z.object({
4871
+ sharing: z.boolean().optional(),
4872
+ shared: z.string().array().optional(),
4873
+ shareAll: z.boolean().optional(),
4874
+ shareUntil: z.string().optional()
4207
4875
  });
4208
- var ConsentFlowTermsValidator = mod.object({
4209
- read: mod.object({
4210
- anonymize: mod.boolean().optional(),
4211
- credentials: mod.object({
4212
- shareAll: mod.boolean().optional(),
4213
- sharing: mod.boolean().optional(),
4214
- categories: mod.record(ConsentFlowTermValidator).default({})
4876
+ var ConsentFlowTermsValidator = z.object({
4877
+ read: z.object({
4878
+ anonymize: z.boolean().optional(),
4879
+ credentials: z.object({
4880
+ shareAll: z.boolean().optional(),
4881
+ sharing: z.boolean().optional(),
4882
+ categories: z.record(ConsentFlowTermValidator).default({})
4215
4883
  }).default({}),
4216
- personal: mod.record(mod.string()).default({})
4884
+ personal: z.record(z.string()).default({})
4217
4885
  }).default({}),
4218
- write: mod.object({
4219
- credentials: mod.object({ categories: mod.record(mod.boolean()).default({}) }).default({}),
4220
- personal: mod.record(mod.boolean()).default({})
4886
+ write: z.object({
4887
+ credentials: z.object({ categories: z.record(z.boolean()).default({}) }).default({}),
4888
+ personal: z.record(z.boolean()).default({})
4221
4889
  }).default({}),
4222
- deniedWriters: mod.array(mod.string()).optional()
4890
+ deniedWriters: z.array(z.string()).optional()
4223
4891
  });
4224
4892
  var PaginatedConsentFlowTermsValidator = PaginationResponseValidator.extend({
4225
- records: mod.object({
4226
- expiresAt: mod.string().optional(),
4227
- oneTime: mod.boolean().optional(),
4893
+ records: z.object({
4894
+ expiresAt: z.string().optional(),
4895
+ oneTime: z.boolean().optional(),
4228
4896
  terms: ConsentFlowTermsValidator,
4229
4897
  contract: ConsentFlowContractDetailsValidator,
4230
- uri: mod.string(),
4898
+ uri: z.string(),
4231
4899
  consenter: LCNProfileValidator,
4232
4900
  status: ConsentFlowTermsStatusValidator
4233
4901
  }).array()
4234
4902
  });
4235
- var ConsentFlowContractQueryValidator = mod.object({
4236
- read: mod.object({
4237
- anonymize: mod.boolean().optional(),
4238
- credentials: mod.object({
4239
- categories: mod.record(mod.object({ required: mod.boolean().optional() })).optional()
4903
+ var ConsentFlowContractQueryValidator = z.object({
4904
+ read: z.object({
4905
+ anonymize: z.boolean().optional(),
4906
+ credentials: z.object({
4907
+ categories: z.record(z.object({ required: z.boolean().optional() })).optional()
4240
4908
  }).optional(),
4241
- personal: mod.record(mod.object({ required: mod.boolean().optional() })).optional()
4909
+ personal: z.record(z.object({ required: z.boolean().optional() })).optional()
4242
4910
  }).optional(),
4243
- write: mod.object({
4244
- credentials: mod.object({
4245
- categories: mod.record(mod.object({ required: mod.boolean().optional() })).optional()
4911
+ write: z.object({
4912
+ credentials: z.object({
4913
+ categories: z.record(z.object({ required: z.boolean().optional() })).optional()
4246
4914
  }).optional(),
4247
- personal: mod.record(mod.object({ required: mod.boolean().optional() })).optional()
4915
+ personal: z.record(z.object({ required: z.boolean().optional() })).optional()
4248
4916
  }).optional()
4249
4917
  });
4250
- var ConsentFlowDataQueryValidator = mod.object({
4251
- anonymize: mod.boolean().optional(),
4252
- credentials: mod.object({ categories: mod.record(mod.boolean()).optional() }).optional(),
4253
- personal: mod.record(mod.boolean()).optional()
4918
+ var ConsentFlowDataQueryValidator = z.object({
4919
+ anonymize: z.boolean().optional(),
4920
+ credentials: z.object({ categories: z.record(z.boolean()).optional() }).optional(),
4921
+ personal: z.record(z.boolean()).optional()
4254
4922
  });
4255
- var ConsentFlowDataForDidQueryValidator = mod.object({
4256
- credentials: mod.object({ categories: mod.record(mod.boolean()).optional() }).optional(),
4257
- personal: mod.record(mod.boolean()).optional(),
4923
+ var ConsentFlowDataForDidQueryValidator = z.object({
4924
+ credentials: z.object({ categories: z.record(z.boolean()).optional() }).optional(),
4925
+ personal: z.record(z.boolean()).optional(),
4258
4926
  id: StringQuery.optional()
4259
4927
  });
4260
- var ConsentFlowTermsQueryValidator = mod.object({
4261
- read: mod.object({
4262
- anonymize: mod.boolean().optional(),
4263
- credentials: mod.object({
4264
- shareAll: mod.boolean().optional(),
4265
- sharing: mod.boolean().optional(),
4266
- categories: mod.record(ConsentFlowTermValidator.optional()).optional()
4928
+ var ConsentFlowTermsQueryValidator = z.object({
4929
+ read: z.object({
4930
+ anonymize: z.boolean().optional(),
4931
+ credentials: z.object({
4932
+ shareAll: z.boolean().optional(),
4933
+ sharing: z.boolean().optional(),
4934
+ categories: z.record(ConsentFlowTermValidator.optional()).optional()
4267
4935
  }).optional(),
4268
- personal: mod.record(mod.string()).optional()
4936
+ personal: z.record(z.string()).optional()
4269
4937
  }).optional(),
4270
- write: mod.object({
4271
- credentials: mod.object({ categories: mod.record(mod.boolean()).optional() }).optional(),
4272
- personal: mod.record(mod.boolean()).optional()
4938
+ write: z.object({
4939
+ credentials: z.object({ categories: z.record(z.boolean()).optional() }).optional(),
4940
+ personal: z.record(z.boolean()).optional()
4273
4941
  }).optional()
4274
4942
  });
4275
- var ConsentFlowTransactionActionValidator = mod.enum([
4943
+ var ConsentFlowTransactionActionValidator = z.enum([
4276
4944
  "consent",
4277
4945
  "update",
4278
4946
  "sync",
4279
4947
  "withdraw",
4280
4948
  "write"
4281
4949
  ]);
4282
- var ConsentFlowTransactionsQueryValidator = mod.object({
4950
+ var ConsentFlowTransactionsQueryValidator = z.object({
4283
4951
  terms: ConsentFlowTermsQueryValidator.optional(),
4284
4952
  action: ConsentFlowTransactionActionValidator.or(
4285
4953
  ConsentFlowTransactionActionValidator.array()
4286
4954
  ).optional(),
4287
- date: mod.object({ $gt: mod.string() }).or(mod.object({ $lt: mod.string() })).or(mod.object({ $eq: mod.string() })).optional(),
4288
- expiresAt: mod.object({ $gt: mod.string() }).or(mod.object({ $lt: mod.string() })).or(mod.object({ $eq: mod.string() })).optional(),
4289
- oneTime: mod.boolean().optional()
4955
+ date: z.object({ $gt: z.string() }).or(z.object({ $lt: z.string() })).or(z.object({ $eq: z.string() })).optional(),
4956
+ expiresAt: z.object({ $gt: z.string() }).or(z.object({ $lt: z.string() })).or(z.object({ $eq: z.string() })).optional(),
4957
+ oneTime: z.boolean().optional()
4290
4958
  });
4291
- var ConsentFlowTransactionValidator = mod.object({
4292
- expiresAt: mod.string().optional(),
4293
- oneTime: mod.boolean().optional(),
4959
+ var ConsentFlowTransactionValidator = z.object({
4960
+ expiresAt: z.string().optional(),
4961
+ oneTime: z.boolean().optional(),
4294
4962
  terms: ConsentFlowTermsValidator.optional(),
4295
- id: mod.string(),
4963
+ id: z.string(),
4296
4964
  action: ConsentFlowTransactionActionValidator,
4297
- date: mod.string(),
4298
- uris: mod.string().array().optional()
4965
+ date: z.string(),
4966
+ uris: z.string().array().optional()
4299
4967
  });
4300
4968
  var PaginatedConsentFlowTransactionsValidator = PaginationResponseValidator.extend({
4301
4969
  records: ConsentFlowTransactionValidator.array()
4302
4970
  });
4303
- var ContractCredentialValidator = mod.object({
4304
- credentialUri: mod.string(),
4305
- termsUri: mod.string(),
4306
- contractUri: mod.string(),
4307
- boostUri: mod.string(),
4308
- category: mod.string().optional(),
4309
- date: mod.string()
4971
+ var ContractCredentialValidator = z.object({
4972
+ credentialUri: z.string(),
4973
+ termsUri: z.string(),
4974
+ contractUri: z.string(),
4975
+ boostUri: z.string(),
4976
+ category: z.string().optional(),
4977
+ date: z.string()
4310
4978
  });
4311
4979
  var PaginatedContractCredentialsValidator = PaginationResponseValidator.extend({
4312
4980
  records: ContractCredentialValidator.array()
4313
4981
  });
4314
- var LCNNotificationTypeEnumValidator = mod.enum([
4982
+ var LCNNotificationTypeEnumValidator = z.enum([
4315
4983
  "CONNECTION_REQUEST",
4316
4984
  "CONNECTION_ACCEPTED",
4317
4985
  "CREDENTIAL_RECEIVED",
@@ -4322,40 +4990,40 @@ var require_types_cjs_development = __commonJS({
4322
4990
  "PRESENTATION_RECEIVED",
4323
4991
  "CONSENT_FLOW_TRANSACTION"
4324
4992
  ]);
4325
- var LCNNotificationMessageValidator = mod.object({
4326
- title: mod.string().optional(),
4327
- body: mod.string().optional()
4993
+ var LCNNotificationMessageValidator = z.object({
4994
+ title: z.string().optional(),
4995
+ body: z.string().optional()
4328
4996
  });
4329
- var LCNNotificationDataValidator = mod.object({
4330
- vcUris: mod.array(mod.string()).optional(),
4331
- vpUris: mod.array(mod.string()).optional(),
4997
+ var LCNNotificationDataValidator = z.object({
4998
+ vcUris: z.array(z.string()).optional(),
4999
+ vpUris: z.array(z.string()).optional(),
4332
5000
  transaction: ConsentFlowTransactionValidator.optional()
4333
5001
  });
4334
- var LCNNotificationValidator = mod.object({
5002
+ var LCNNotificationValidator = z.object({
4335
5003
  type: LCNNotificationTypeEnumValidator,
4336
- to: LCNProfileValidator.partial().and(mod.object({ did: mod.string() })),
4337
- from: LCNProfileValidator.partial().and(mod.object({ did: mod.string() })),
5004
+ to: LCNProfileValidator.partial().and(z.object({ did: z.string() })),
5005
+ from: LCNProfileValidator.partial().and(z.object({ did: z.string() })),
4338
5006
  message: LCNNotificationMessageValidator.optional(),
4339
5007
  data: LCNNotificationDataValidator.optional(),
4340
- sent: mod.string().datetime().optional()
5008
+ sent: z.string().datetime().optional()
4341
5009
  });
4342
5010
  var AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX = "auth-grant:";
4343
- var AuthGrantValidator = mod.object({
4344
- id: mod.string(),
4345
- name: mod.string(),
4346
- description: mod.string().optional(),
4347
- challenge: mod.string().startsWith(AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX).min(10, { message: "Challenge is too short" }).max(100, { message: "Challenge is too long" }),
4348
- status: mod.enum(["revoked", "active"], {
5011
+ var AuthGrantValidator = z.object({
5012
+ id: z.string(),
5013
+ name: z.string(),
5014
+ description: z.string().optional(),
5015
+ challenge: z.string().startsWith(AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX).min(10, { message: "Challenge is too short" }).max(100, { message: "Challenge is too long" }),
5016
+ status: z.enum(["revoked", "active"], {
4349
5017
  required_error: "Status is required",
4350
5018
  invalid_type_error: "Status must be either active or revoked"
4351
5019
  }),
4352
- scope: mod.string(),
4353
- createdAt: mod.string().datetime({ message: "createdAt must be a valid ISO 8601 datetime string" }),
4354
- expiresAt: mod.string().datetime({ message: "expiresAt must be a valid ISO 8601 datetime string" }).nullish().optional()
5020
+ scope: z.string(),
5021
+ createdAt: z.string().datetime({ message: "createdAt must be a valid ISO 8601 datetime string" }),
5022
+ expiresAt: z.string().datetime({ message: "expiresAt must be a valid ISO 8601 datetime string" }).nullish().optional()
4355
5023
  });
4356
- var FlatAuthGrantValidator = mod.object({ id: mod.string() }).catchall(mod.any());
4357
- var AuthGrantStatusValidator = mod.enum(["active", "revoked"]);
4358
- var AuthGrantQueryValidator = mod.object({
5024
+ var FlatAuthGrantValidator = z.object({ id: z.string() }).catchall(z.any());
5025
+ var AuthGrantStatusValidator = z.enum(["active", "revoked"]);
5026
+ var AuthGrantQueryValidator = z.object({
4359
5027
  id: StringQuery,
4360
5028
  name: StringQuery,
4361
5029
  description: StringQuery,