@learncard/didkey-plugin 1.0.38 → 1.0.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/didkey-plugin.cjs.development.js +1338 -662
- package/dist/didkey-plugin.cjs.development.js.map +2 -2
- package/dist/didkey-plugin.cjs.production.min.js +1 -1
- package/dist/didkey-plugin.cjs.production.min.js.map +3 -3
- package/dist/didkey-plugin.esm.js +1338 -662
- package/dist/didkey-plugin.esm.js.map +2 -2
- package/package.json +4 -4
@@ -81,7 +81,7 @@ var require_types_cjs_development = __commonJS({
|
|
81
81
|
}
|
82
82
|
return to;
|
83
83
|
}, "__copyProps");
|
84
|
-
var __toCommonJS2 = /* @__PURE__ */ __name2((
|
84
|
+
var __toCommonJS2 = /* @__PURE__ */ __name2((mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod), "__toCommonJS");
|
85
85
|
var src_exports2 = {};
|
86
86
|
__export2(src_exports2, {
|
87
87
|
AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX: () => AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX,
|
@@ -271,6 +271,15 @@ var require_types_cjs_development = __commonJS({
|
|
271
271
|
return value;
|
272
272
|
};
|
273
273
|
})(util || (util = {}));
|
274
|
+
var objectUtil;
|
275
|
+
(function(objectUtil2) {
|
276
|
+
objectUtil2.mergeShapes = (first, second) => {
|
277
|
+
return {
|
278
|
+
...first,
|
279
|
+
...second
|
280
|
+
};
|
281
|
+
};
|
282
|
+
})(objectUtil || (objectUtil = {}));
|
274
283
|
var ZodParsedType = util.arrayToEnum([
|
275
284
|
"string",
|
276
285
|
"nan",
|
@@ -414,6 +423,11 @@ var require_types_cjs_development = __commonJS({
|
|
414
423
|
processError(this);
|
415
424
|
return fieldErrors;
|
416
425
|
}
|
426
|
+
static assert(value) {
|
427
|
+
if (!(value instanceof ZodError)) {
|
428
|
+
throw new Error(`Not a ZodError: ${value}`);
|
429
|
+
}
|
430
|
+
}
|
417
431
|
toString() {
|
418
432
|
return this.message;
|
419
433
|
}
|
@@ -481,7 +495,12 @@ var require_types_cjs_development = __commonJS({
|
|
481
495
|
break;
|
482
496
|
case ZodIssueCode.invalid_string:
|
483
497
|
if (typeof issue.validation === "object") {
|
484
|
-
if ("
|
498
|
+
if ("includes" in issue.validation) {
|
499
|
+
message = `Invalid input: must include "${issue.validation.includes}"`;
|
500
|
+
if (typeof issue.validation.position === "number") {
|
501
|
+
message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;
|
502
|
+
}
|
503
|
+
} else if ("startsWith" in issue.validation) {
|
485
504
|
message = `Invalid input: must start with "${issue.validation.startsWith}"`;
|
486
505
|
} else if ("endsWith" in issue.validation) {
|
487
506
|
message = `Invalid input: must end with "${issue.validation.endsWith}"`;
|
@@ -502,7 +521,7 @@ var require_types_cjs_development = __commonJS({
|
|
502
521
|
else if (issue.type === "number")
|
503
522
|
message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
|
504
523
|
else if (issue.type === "date")
|
505
|
-
message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(issue.minimum)}`;
|
524
|
+
message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
|
506
525
|
else
|
507
526
|
message = "Invalid input";
|
508
527
|
break;
|
@@ -513,8 +532,10 @@ var require_types_cjs_development = __commonJS({
|
|
513
532
|
message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
|
514
533
|
else if (issue.type === "number")
|
515
534
|
message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
|
535
|
+
else if (issue.type === "bigint")
|
536
|
+
message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
|
516
537
|
else if (issue.type === "date")
|
517
|
-
message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(issue.maximum)}`;
|
538
|
+
message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`;
|
518
539
|
else
|
519
540
|
message = "Invalid input";
|
520
541
|
break;
|
@@ -556,6 +577,13 @@ var require_types_cjs_development = __commonJS({
|
|
556
577
|
...issueData,
|
557
578
|
path: fullPath
|
558
579
|
};
|
580
|
+
if (issueData.message !== void 0) {
|
581
|
+
return {
|
582
|
+
...issueData,
|
583
|
+
path: fullPath,
|
584
|
+
message: issueData.message
|
585
|
+
};
|
586
|
+
}
|
559
587
|
let errorMessage = "";
|
560
588
|
const maps = errorMaps.filter((m) => !!m).slice().reverse();
|
561
589
|
for (const map of maps) {
|
@@ -564,11 +592,12 @@ var require_types_cjs_development = __commonJS({
|
|
564
592
|
return {
|
565
593
|
...issueData,
|
566
594
|
path: fullPath,
|
567
|
-
message:
|
595
|
+
message: errorMessage
|
568
596
|
};
|
569
597
|
}, "makeIssue");
|
570
598
|
var EMPTY_PATH = [];
|
571
599
|
function addIssueToContext(ctx, issueData) {
|
600
|
+
const overrideMap = getErrorMap();
|
572
601
|
const issue = makeIssue({
|
573
602
|
issueData,
|
574
603
|
data: ctx.data,
|
@@ -576,8 +605,8 @@ var require_types_cjs_development = __commonJS({
|
|
576
605
|
errorMaps: [
|
577
606
|
ctx.common.contextualErrorMap,
|
578
607
|
ctx.schemaErrorMap,
|
579
|
-
|
580
|
-
errorMap
|
608
|
+
overrideMap,
|
609
|
+
overrideMap === errorMap ? void 0 : errorMap
|
581
610
|
].filter((x) => !!x)
|
582
611
|
});
|
583
612
|
ctx.common.issues.push(issue);
|
@@ -611,9 +640,11 @@ var require_types_cjs_development = __commonJS({
|
|
611
640
|
static async mergeObjectAsync(status, pairs) {
|
612
641
|
const syncPairs = [];
|
613
642
|
for (const pair of pairs) {
|
643
|
+
const key = await pair.key;
|
644
|
+
const value = await pair.value;
|
614
645
|
syncPairs.push({
|
615
|
-
key
|
616
|
-
value
|
646
|
+
key,
|
647
|
+
value
|
617
648
|
});
|
618
649
|
}
|
619
650
|
return ParseStatus.mergeObjectSync(status, syncPairs);
|
@@ -630,7 +661,7 @@ var require_types_cjs_development = __commonJS({
|
|
630
661
|
status.dirty();
|
631
662
|
if (value.status === "dirty")
|
632
663
|
status.dirty();
|
633
|
-
if (typeof value.value !== "undefined" || pair.alwaysSet) {
|
664
|
+
if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) {
|
634
665
|
finalObject[key.value] = value.value;
|
635
666
|
}
|
636
667
|
}
|
@@ -646,21 +677,53 @@ var require_types_cjs_development = __commonJS({
|
|
646
677
|
var isAborted = /* @__PURE__ */ __name22((x) => x.status === "aborted", "isAborted");
|
647
678
|
var isDirty = /* @__PURE__ */ __name22((x) => x.status === "dirty", "isDirty");
|
648
679
|
var isValid = /* @__PURE__ */ __name22((x) => x.status === "valid", "isValid");
|
649
|
-
var isAsync = /* @__PURE__ */ __name22((x) => typeof Promise !==
|
680
|
+
var isAsync = /* @__PURE__ */ __name22((x) => typeof Promise !== "undefined" && x instanceof Promise, "isAsync");
|
681
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
682
|
+
if (kind === "a" && !f)
|
683
|
+
throw new TypeError("Private accessor was defined without a getter");
|
684
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
685
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
686
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
687
|
+
}
|
688
|
+
__name(__classPrivateFieldGet, "__classPrivateFieldGet");
|
689
|
+
__name2(__classPrivateFieldGet, "__classPrivateFieldGet");
|
690
|
+
__name22(__classPrivateFieldGet, "__classPrivateFieldGet");
|
691
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
692
|
+
if (kind === "m")
|
693
|
+
throw new TypeError("Private method is not writable");
|
694
|
+
if (kind === "a" && !f)
|
695
|
+
throw new TypeError("Private accessor was defined without a setter");
|
696
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
697
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
698
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
699
|
+
}
|
700
|
+
__name(__classPrivateFieldSet, "__classPrivateFieldSet");
|
701
|
+
__name2(__classPrivateFieldSet, "__classPrivateFieldSet");
|
702
|
+
__name22(__classPrivateFieldSet, "__classPrivateFieldSet");
|
650
703
|
var errorUtil;
|
651
704
|
(function(errorUtil2) {
|
652
705
|
errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
653
706
|
errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
|
654
707
|
})(errorUtil || (errorUtil = {}));
|
708
|
+
var _ZodEnum_cache;
|
709
|
+
var _ZodNativeEnum_cache;
|
655
710
|
var ParseInputLazyPath = /* @__PURE__ */ __name2(class {
|
656
711
|
constructor(parent, value, path, key) {
|
712
|
+
this._cachedPath = [];
|
657
713
|
this.parent = parent;
|
658
714
|
this.data = value;
|
659
715
|
this._path = path;
|
660
716
|
this._key = key;
|
661
717
|
}
|
662
718
|
get path() {
|
663
|
-
|
719
|
+
if (!this._cachedPath.length) {
|
720
|
+
if (this._key instanceof Array) {
|
721
|
+
this._cachedPath.push(...this._path, ...this._key);
|
722
|
+
} else {
|
723
|
+
this._cachedPath.push(...this._path, this._key);
|
724
|
+
}
|
725
|
+
}
|
726
|
+
return this._cachedPath;
|
664
727
|
}
|
665
728
|
}, "ParseInputLazyPath");
|
666
729
|
__name22(ParseInputLazyPath, "ParseInputLazyPath");
|
@@ -671,8 +734,16 @@ var require_types_cjs_development = __commonJS({
|
|
671
734
|
if (!ctx.common.issues.length) {
|
672
735
|
throw new Error("Validation failed but no issues detected.");
|
673
736
|
}
|
674
|
-
|
675
|
-
|
737
|
+
return {
|
738
|
+
success: false,
|
739
|
+
get error() {
|
740
|
+
if (this._error)
|
741
|
+
return this._error;
|
742
|
+
const error = new ZodError(ctx.common.issues);
|
743
|
+
this._error = error;
|
744
|
+
return this._error;
|
745
|
+
}
|
746
|
+
};
|
676
747
|
}
|
677
748
|
}, "handleResult");
|
678
749
|
function processCreateParams(params) {
|
@@ -685,12 +756,17 @@ var require_types_cjs_development = __commonJS({
|
|
685
756
|
if (errorMap2)
|
686
757
|
return { errorMap: errorMap2, description };
|
687
758
|
const customMap = /* @__PURE__ */ __name22((iss, ctx) => {
|
688
|
-
|
689
|
-
|
759
|
+
var _a, _b;
|
760
|
+
const { message } = params;
|
761
|
+
if (iss.code === "invalid_enum_value") {
|
762
|
+
return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
|
763
|
+
}
|
690
764
|
if (typeof ctx.data === "undefined") {
|
691
|
-
return { message:
|
765
|
+
return { message: (_a = message !== null && message !== void 0 ? message : required_error) !== null && _a !== void 0 ? _a : ctx.defaultError };
|
692
766
|
}
|
693
|
-
|
767
|
+
if (iss.code !== "invalid_type")
|
768
|
+
return { message: ctx.defaultError };
|
769
|
+
return { message: (_b = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b !== void 0 ? _b : ctx.defaultError };
|
694
770
|
}, "customMap");
|
695
771
|
return { errorMap: customMap, description };
|
696
772
|
}
|
@@ -722,6 +798,7 @@ var require_types_cjs_development = __commonJS({
|
|
722
798
|
this.catch = this.catch.bind(this);
|
723
799
|
this.describe = this.describe.bind(this);
|
724
800
|
this.pipe = this.pipe.bind(this);
|
801
|
+
this.readonly = this.readonly.bind(this);
|
725
802
|
this.isNullable = this.isNullable.bind(this);
|
726
803
|
this.isOptional = this.isOptional.bind(this);
|
727
804
|
}
|
@@ -866,28 +943,29 @@ var require_types_cjs_development = __commonJS({
|
|
866
943
|
return this._refinement(refinement);
|
867
944
|
}
|
868
945
|
optional() {
|
869
|
-
return ZodOptional.create(this);
|
946
|
+
return ZodOptional.create(this, this._def);
|
870
947
|
}
|
871
948
|
nullable() {
|
872
|
-
return ZodNullable.create(this);
|
949
|
+
return ZodNullable.create(this, this._def);
|
873
950
|
}
|
874
951
|
nullish() {
|
875
|
-
return this.
|
952
|
+
return this.nullable().optional();
|
876
953
|
}
|
877
954
|
array() {
|
878
|
-
return ZodArray.create(this);
|
955
|
+
return ZodArray.create(this, this._def);
|
879
956
|
}
|
880
957
|
promise() {
|
881
|
-
return ZodPromise.create(this);
|
958
|
+
return ZodPromise.create(this, this._def);
|
882
959
|
}
|
883
960
|
or(option) {
|
884
|
-
return ZodUnion.create([this, option]);
|
961
|
+
return ZodUnion.create([this, option], this._def);
|
885
962
|
}
|
886
963
|
and(incoming) {
|
887
|
-
return ZodIntersection.create(this, incoming);
|
964
|
+
return ZodIntersection.create(this, incoming, this._def);
|
888
965
|
}
|
889
966
|
transform(transform) {
|
890
967
|
return new ZodEffects({
|
968
|
+
...processCreateParams(this._def),
|
891
969
|
schema: this,
|
892
970
|
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
893
971
|
effect: { type: "transform", transform }
|
@@ -896,6 +974,7 @@ var require_types_cjs_development = __commonJS({
|
|
896
974
|
default(def) {
|
897
975
|
const defaultValueFunc = typeof def === "function" ? def : () => def;
|
898
976
|
return new ZodDefault({
|
977
|
+
...processCreateParams(this._def),
|
899
978
|
innerType: this,
|
900
979
|
defaultValue: defaultValueFunc,
|
901
980
|
typeName: ZodFirstPartyTypeKind.ZodDefault
|
@@ -905,14 +984,15 @@ var require_types_cjs_development = __commonJS({
|
|
905
984
|
return new ZodBranded({
|
906
985
|
typeName: ZodFirstPartyTypeKind.ZodBranded,
|
907
986
|
type: this,
|
908
|
-
...processCreateParams(
|
987
|
+
...processCreateParams(this._def)
|
909
988
|
});
|
910
989
|
}
|
911
990
|
catch(def) {
|
912
|
-
const
|
991
|
+
const catchValueFunc = typeof def === "function" ? def : () => def;
|
913
992
|
return new ZodCatch({
|
993
|
+
...processCreateParams(this._def),
|
914
994
|
innerType: this,
|
915
|
-
|
995
|
+
catchValue: catchValueFunc,
|
916
996
|
typeName: ZodFirstPartyTypeKind.ZodCatch
|
917
997
|
});
|
918
998
|
}
|
@@ -926,6 +1006,9 @@ var require_types_cjs_development = __commonJS({
|
|
926
1006
|
pipe(target) {
|
927
1007
|
return ZodPipeline.create(this, target);
|
928
1008
|
}
|
1009
|
+
readonly() {
|
1010
|
+
return ZodReadonly.create(this);
|
1011
|
+
}
|
929
1012
|
isOptional() {
|
930
1013
|
return this.safeParse(void 0).success;
|
931
1014
|
}
|
@@ -935,43 +1018,62 @@ var require_types_cjs_development = __commonJS({
|
|
935
1018
|
}, "ZodType");
|
936
1019
|
__name22(ZodType, "ZodType");
|
937
1020
|
var cuidRegex = /^c[^\s-]{8,}$/i;
|
938
|
-
var
|
939
|
-
var
|
940
|
-
var
|
1021
|
+
var cuid2Regex = /^[0-9a-z]+$/;
|
1022
|
+
var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;
|
1023
|
+
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;
|
1024
|
+
var nanoidRegex = /^[a-z0-9_-]{21}$/i;
|
1025
|
+
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)?)??$/;
|
1026
|
+
var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
|
1027
|
+
var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
|
1028
|
+
var emojiRegex;
|
1029
|
+
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])$/;
|
1030
|
+
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})))$/;
|
1031
|
+
var base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
|
1032
|
+
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])))`;
|
1033
|
+
var dateRegex = new RegExp(`^${dateRegexSource}$`);
|
1034
|
+
function timeRegexSource(args) {
|
1035
|
+
let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
|
941
1036
|
if (args.precision) {
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
|
946
|
-
}
|
947
|
-
} else if (args.precision === 0) {
|
948
|
-
if (args.offset) {
|
949
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$`);
|
950
|
-
} else {
|
951
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
|
952
|
-
}
|
953
|
-
} else {
|
954
|
-
if (args.offset) {
|
955
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$`);
|
956
|
-
} else {
|
957
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
|
958
|
-
}
|
1037
|
+
regex = `${regex}\\.\\d{${args.precision}}`;
|
1038
|
+
} else if (args.precision == null) {
|
1039
|
+
regex = `${regex}(\\.\\d+)?`;
|
959
1040
|
}
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
1041
|
+
return regex;
|
1042
|
+
}
|
1043
|
+
__name(timeRegexSource, "timeRegexSource");
|
1044
|
+
__name2(timeRegexSource, "timeRegexSource");
|
1045
|
+
__name22(timeRegexSource, "timeRegexSource");
|
1046
|
+
function timeRegex(args) {
|
1047
|
+
return new RegExp(`^${timeRegexSource(args)}$`);
|
1048
|
+
}
|
1049
|
+
__name(timeRegex, "timeRegex");
|
1050
|
+
__name2(timeRegex, "timeRegex");
|
1051
|
+
__name22(timeRegex, "timeRegex");
|
1052
|
+
function datetimeRegex(args) {
|
1053
|
+
let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
|
1054
|
+
const opts = [];
|
1055
|
+
opts.push(args.local ? `Z?` : `Z`);
|
1056
|
+
if (args.offset)
|
1057
|
+
opts.push(`([+-]\\d{2}:?\\d{2})`);
|
1058
|
+
regex = `${regex}(${opts.join("|")})`;
|
1059
|
+
return new RegExp(`^${regex}$`);
|
1060
|
+
}
|
1061
|
+
__name(datetimeRegex, "datetimeRegex");
|
1062
|
+
__name2(datetimeRegex, "datetimeRegex");
|
1063
|
+
__name22(datetimeRegex, "datetimeRegex");
|
1064
|
+
function isValidIP(ip, version) {
|
1065
|
+
if ((version === "v4" || !version) && ipv4Regex.test(ip)) {
|
1066
|
+
return true;
|
974
1067
|
}
|
1068
|
+
if ((version === "v6" || !version) && ipv6Regex.test(ip)) {
|
1069
|
+
return true;
|
1070
|
+
}
|
1071
|
+
return false;
|
1072
|
+
}
|
1073
|
+
__name(isValidIP, "isValidIP");
|
1074
|
+
__name2(isValidIP, "isValidIP");
|
1075
|
+
__name22(isValidIP, "isValidIP");
|
1076
|
+
var ZodString = /* @__PURE__ */ __name2(class extends ZodType {
|
975
1077
|
_parse(input) {
|
976
1078
|
if (this._def.coerce) {
|
977
1079
|
input.data = String(input.data);
|
@@ -979,14 +1081,11 @@ var require_types_cjs_development = __commonJS({
|
|
979
1081
|
const parsedType = this._getType(input);
|
980
1082
|
if (parsedType !== ZodParsedType.string) {
|
981
1083
|
const ctx2 = this._getOrReturnCtx(input);
|
982
|
-
addIssueToContext(
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
received: ctx2.parsedType
|
988
|
-
}
|
989
|
-
);
|
1084
|
+
addIssueToContext(ctx2, {
|
1085
|
+
code: ZodIssueCode.invalid_type,
|
1086
|
+
expected: ZodParsedType.string,
|
1087
|
+
received: ctx2.parsedType
|
1088
|
+
});
|
990
1089
|
return INVALID;
|
991
1090
|
}
|
992
1091
|
const status = new ParseStatus();
|
@@ -1054,6 +1153,19 @@ var require_types_cjs_development = __commonJS({
|
|
1054
1153
|
});
|
1055
1154
|
status.dirty();
|
1056
1155
|
}
|
1156
|
+
} else if (check.kind === "emoji") {
|
1157
|
+
if (!emojiRegex) {
|
1158
|
+
emojiRegex = new RegExp(_emojiRegex, "u");
|
1159
|
+
}
|
1160
|
+
if (!emojiRegex.test(input.data)) {
|
1161
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
1162
|
+
addIssueToContext(ctx, {
|
1163
|
+
validation: "emoji",
|
1164
|
+
code: ZodIssueCode.invalid_string,
|
1165
|
+
message: check.message
|
1166
|
+
});
|
1167
|
+
status.dirty();
|
1168
|
+
}
|
1057
1169
|
} else if (check.kind === "uuid") {
|
1058
1170
|
if (!uuidRegex.test(input.data)) {
|
1059
1171
|
ctx = this._getOrReturnCtx(input, ctx);
|
@@ -1064,6 +1176,16 @@ var require_types_cjs_development = __commonJS({
|
|
1064
1176
|
});
|
1065
1177
|
status.dirty();
|
1066
1178
|
}
|
1179
|
+
} else if (check.kind === "nanoid") {
|
1180
|
+
if (!nanoidRegex.test(input.data)) {
|
1181
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
1182
|
+
addIssueToContext(ctx, {
|
1183
|
+
validation: "nanoid",
|
1184
|
+
code: ZodIssueCode.invalid_string,
|
1185
|
+
message: check.message
|
1186
|
+
});
|
1187
|
+
status.dirty();
|
1188
|
+
}
|
1067
1189
|
} else if (check.kind === "cuid") {
|
1068
1190
|
if (!cuidRegex.test(input.data)) {
|
1069
1191
|
ctx = this._getOrReturnCtx(input, ctx);
|
@@ -1074,6 +1196,26 @@ var require_types_cjs_development = __commonJS({
|
|
1074
1196
|
});
|
1075
1197
|
status.dirty();
|
1076
1198
|
}
|
1199
|
+
} else if (check.kind === "cuid2") {
|
1200
|
+
if (!cuid2Regex.test(input.data)) {
|
1201
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
1202
|
+
addIssueToContext(ctx, {
|
1203
|
+
validation: "cuid2",
|
1204
|
+
code: ZodIssueCode.invalid_string,
|
1205
|
+
message: check.message
|
1206
|
+
});
|
1207
|
+
status.dirty();
|
1208
|
+
}
|
1209
|
+
} else if (check.kind === "ulid") {
|
1210
|
+
if (!ulidRegex.test(input.data)) {
|
1211
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
1212
|
+
addIssueToContext(ctx, {
|
1213
|
+
validation: "ulid",
|
1214
|
+
code: ZodIssueCode.invalid_string,
|
1215
|
+
message: check.message
|
1216
|
+
});
|
1217
|
+
status.dirty();
|
1218
|
+
}
|
1077
1219
|
} else if (check.kind === "url") {
|
1078
1220
|
try {
|
1079
1221
|
new URL(input.data);
|
@@ -1100,6 +1242,20 @@ var require_types_cjs_development = __commonJS({
|
|
1100
1242
|
}
|
1101
1243
|
} else if (check.kind === "trim") {
|
1102
1244
|
input.data = input.data.trim();
|
1245
|
+
} else if (check.kind === "includes") {
|
1246
|
+
if (!input.data.includes(check.value, check.position)) {
|
1247
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
1248
|
+
addIssueToContext(ctx, {
|
1249
|
+
code: ZodIssueCode.invalid_string,
|
1250
|
+
validation: { includes: check.value, position: check.position },
|
1251
|
+
message: check.message
|
1252
|
+
});
|
1253
|
+
status.dirty();
|
1254
|
+
}
|
1255
|
+
} else if (check.kind === "toLowerCase") {
|
1256
|
+
input.data = input.data.toLowerCase();
|
1257
|
+
} else if (check.kind === "toUpperCase") {
|
1258
|
+
input.data = input.data.toUpperCase();
|
1103
1259
|
} else if (check.kind === "startsWith") {
|
1104
1260
|
if (!input.data.startsWith(check.value)) {
|
1105
1261
|
ctx = this._getOrReturnCtx(input, ctx);
|
@@ -1131,12 +1287,71 @@ var require_types_cjs_development = __commonJS({
|
|
1131
1287
|
});
|
1132
1288
|
status.dirty();
|
1133
1289
|
}
|
1290
|
+
} else if (check.kind === "date") {
|
1291
|
+
const regex = dateRegex;
|
1292
|
+
if (!regex.test(input.data)) {
|
1293
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
1294
|
+
addIssueToContext(ctx, {
|
1295
|
+
code: ZodIssueCode.invalid_string,
|
1296
|
+
validation: "date",
|
1297
|
+
message: check.message
|
1298
|
+
});
|
1299
|
+
status.dirty();
|
1300
|
+
}
|
1301
|
+
} else if (check.kind === "time") {
|
1302
|
+
const regex = timeRegex(check);
|
1303
|
+
if (!regex.test(input.data)) {
|
1304
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
1305
|
+
addIssueToContext(ctx, {
|
1306
|
+
code: ZodIssueCode.invalid_string,
|
1307
|
+
validation: "time",
|
1308
|
+
message: check.message
|
1309
|
+
});
|
1310
|
+
status.dirty();
|
1311
|
+
}
|
1312
|
+
} else if (check.kind === "duration") {
|
1313
|
+
if (!durationRegex.test(input.data)) {
|
1314
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
1315
|
+
addIssueToContext(ctx, {
|
1316
|
+
validation: "duration",
|
1317
|
+
code: ZodIssueCode.invalid_string,
|
1318
|
+
message: check.message
|
1319
|
+
});
|
1320
|
+
status.dirty();
|
1321
|
+
}
|
1322
|
+
} else if (check.kind === "ip") {
|
1323
|
+
if (!isValidIP(input.data, check.version)) {
|
1324
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
1325
|
+
addIssueToContext(ctx, {
|
1326
|
+
validation: "ip",
|
1327
|
+
code: ZodIssueCode.invalid_string,
|
1328
|
+
message: check.message
|
1329
|
+
});
|
1330
|
+
status.dirty();
|
1331
|
+
}
|
1332
|
+
} else if (check.kind === "base64") {
|
1333
|
+
if (!base64Regex.test(input.data)) {
|
1334
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
1335
|
+
addIssueToContext(ctx, {
|
1336
|
+
validation: "base64",
|
1337
|
+
code: ZodIssueCode.invalid_string,
|
1338
|
+
message: check.message
|
1339
|
+
});
|
1340
|
+
status.dirty();
|
1341
|
+
}
|
1134
1342
|
} else {
|
1135
1343
|
util.assertNever(check);
|
1136
1344
|
}
|
1137
1345
|
}
|
1138
1346
|
return { status: status.value, value: input.data };
|
1139
1347
|
}
|
1348
|
+
_regex(regex, validation, message) {
|
1349
|
+
return this.refinement((data) => regex.test(data), {
|
1350
|
+
validation,
|
1351
|
+
code: ZodIssueCode.invalid_string,
|
1352
|
+
...errorUtil.errToObj(message)
|
1353
|
+
});
|
1354
|
+
}
|
1140
1355
|
_addCheck(check) {
|
1141
1356
|
return new ZodString({
|
1142
1357
|
...this._def,
|
@@ -1149,19 +1364,38 @@ var require_types_cjs_development = __commonJS({
|
|
1149
1364
|
url(message) {
|
1150
1365
|
return this._addCheck({ kind: "url", ...errorUtil.errToObj(message) });
|
1151
1366
|
}
|
1367
|
+
emoji(message) {
|
1368
|
+
return this._addCheck({ kind: "emoji", ...errorUtil.errToObj(message) });
|
1369
|
+
}
|
1152
1370
|
uuid(message) {
|
1153
1371
|
return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) });
|
1154
1372
|
}
|
1373
|
+
nanoid(message) {
|
1374
|
+
return this._addCheck({ kind: "nanoid", ...errorUtil.errToObj(message) });
|
1375
|
+
}
|
1155
1376
|
cuid(message) {
|
1156
1377
|
return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
|
1157
1378
|
}
|
1379
|
+
cuid2(message) {
|
1380
|
+
return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
|
1381
|
+
}
|
1382
|
+
ulid(message) {
|
1383
|
+
return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) });
|
1384
|
+
}
|
1385
|
+
base64(message) {
|
1386
|
+
return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
|
1387
|
+
}
|
1388
|
+
ip(options) {
|
1389
|
+
return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
|
1390
|
+
}
|
1158
1391
|
datetime(options) {
|
1159
|
-
var _a;
|
1392
|
+
var _a, _b;
|
1160
1393
|
if (typeof options === "string") {
|
1161
1394
|
return this._addCheck({
|
1162
1395
|
kind: "datetime",
|
1163
1396
|
precision: null,
|
1164
1397
|
offset: false,
|
1398
|
+
local: false,
|
1165
1399
|
message: options
|
1166
1400
|
});
|
1167
1401
|
}
|
@@ -1169,9 +1403,30 @@ var require_types_cjs_development = __commonJS({
|
|
1169
1403
|
kind: "datetime",
|
1170
1404
|
precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
|
1171
1405
|
offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
|
1406
|
+
local: (_b = options === null || options === void 0 ? void 0 : options.local) !== null && _b !== void 0 ? _b : false,
|
1407
|
+
...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
|
1408
|
+
});
|
1409
|
+
}
|
1410
|
+
date(message) {
|
1411
|
+
return this._addCheck({ kind: "date", message });
|
1412
|
+
}
|
1413
|
+
time(options) {
|
1414
|
+
if (typeof options === "string") {
|
1415
|
+
return this._addCheck({
|
1416
|
+
kind: "time",
|
1417
|
+
precision: null,
|
1418
|
+
message: options
|
1419
|
+
});
|
1420
|
+
}
|
1421
|
+
return this._addCheck({
|
1422
|
+
kind: "time",
|
1423
|
+
precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
|
1172
1424
|
...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
|
1173
1425
|
});
|
1174
1426
|
}
|
1427
|
+
duration(message) {
|
1428
|
+
return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) });
|
1429
|
+
}
|
1175
1430
|
regex(regex, message) {
|
1176
1431
|
return this._addCheck({
|
1177
1432
|
kind: "regex",
|
@@ -1179,6 +1434,14 @@ var require_types_cjs_development = __commonJS({
|
|
1179
1434
|
...errorUtil.errToObj(message)
|
1180
1435
|
});
|
1181
1436
|
}
|
1437
|
+
includes(value, options) {
|
1438
|
+
return this._addCheck({
|
1439
|
+
kind: "includes",
|
1440
|
+
value,
|
1441
|
+
position: options === null || options === void 0 ? void 0 : options.position,
|
1442
|
+
...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
|
1443
|
+
});
|
1444
|
+
}
|
1182
1445
|
startsWith(value, message) {
|
1183
1446
|
return this._addCheck({
|
1184
1447
|
kind: "startsWith",
|
@@ -1214,21 +1477,69 @@ var require_types_cjs_development = __commonJS({
|
|
1214
1477
|
...errorUtil.errToObj(message)
|
1215
1478
|
});
|
1216
1479
|
}
|
1480
|
+
nonempty(message) {
|
1481
|
+
return this.min(1, errorUtil.errToObj(message));
|
1482
|
+
}
|
1483
|
+
trim() {
|
1484
|
+
return new ZodString({
|
1485
|
+
...this._def,
|
1486
|
+
checks: [...this._def.checks, { kind: "trim" }]
|
1487
|
+
});
|
1488
|
+
}
|
1489
|
+
toLowerCase() {
|
1490
|
+
return new ZodString({
|
1491
|
+
...this._def,
|
1492
|
+
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
1493
|
+
});
|
1494
|
+
}
|
1495
|
+
toUpperCase() {
|
1496
|
+
return new ZodString({
|
1497
|
+
...this._def,
|
1498
|
+
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
1499
|
+
});
|
1500
|
+
}
|
1217
1501
|
get isDatetime() {
|
1218
1502
|
return !!this._def.checks.find((ch) => ch.kind === "datetime");
|
1219
1503
|
}
|
1504
|
+
get isDate() {
|
1505
|
+
return !!this._def.checks.find((ch) => ch.kind === "date");
|
1506
|
+
}
|
1507
|
+
get isTime() {
|
1508
|
+
return !!this._def.checks.find((ch) => ch.kind === "time");
|
1509
|
+
}
|
1510
|
+
get isDuration() {
|
1511
|
+
return !!this._def.checks.find((ch) => ch.kind === "duration");
|
1512
|
+
}
|
1220
1513
|
get isEmail() {
|
1221
1514
|
return !!this._def.checks.find((ch) => ch.kind === "email");
|
1222
1515
|
}
|
1223
1516
|
get isURL() {
|
1224
1517
|
return !!this._def.checks.find((ch) => ch.kind === "url");
|
1225
1518
|
}
|
1519
|
+
get isEmoji() {
|
1520
|
+
return !!this._def.checks.find((ch) => ch.kind === "emoji");
|
1521
|
+
}
|
1226
1522
|
get isUUID() {
|
1227
1523
|
return !!this._def.checks.find((ch) => ch.kind === "uuid");
|
1228
1524
|
}
|
1525
|
+
get isNANOID() {
|
1526
|
+
return !!this._def.checks.find((ch) => ch.kind === "nanoid");
|
1527
|
+
}
|
1229
1528
|
get isCUID() {
|
1230
1529
|
return !!this._def.checks.find((ch) => ch.kind === "cuid");
|
1231
1530
|
}
|
1531
|
+
get isCUID2() {
|
1532
|
+
return !!this._def.checks.find((ch) => ch.kind === "cuid2");
|
1533
|
+
}
|
1534
|
+
get isULID() {
|
1535
|
+
return !!this._def.checks.find((ch) => ch.kind === "ulid");
|
1536
|
+
}
|
1537
|
+
get isIP() {
|
1538
|
+
return !!this._def.checks.find((ch) => ch.kind === "ip");
|
1539
|
+
}
|
1540
|
+
get isBase64() {
|
1541
|
+
return !!this._def.checks.find((ch) => ch.kind === "base64");
|
1542
|
+
}
|
1232
1543
|
get minLength() {
|
1233
1544
|
let min = null;
|
1234
1545
|
for (const ch of this._def.checks) {
|
@@ -1442,6 +1753,19 @@ var require_types_cjs_development = __commonJS({
|
|
1442
1753
|
message: errorUtil.toString(message)
|
1443
1754
|
});
|
1444
1755
|
}
|
1756
|
+
safe(message) {
|
1757
|
+
return this._addCheck({
|
1758
|
+
kind: "min",
|
1759
|
+
inclusive: true,
|
1760
|
+
value: Number.MIN_SAFE_INTEGER,
|
1761
|
+
message: errorUtil.toString(message)
|
1762
|
+
})._addCheck({
|
1763
|
+
kind: "max",
|
1764
|
+
inclusive: true,
|
1765
|
+
value: Number.MAX_SAFE_INTEGER,
|
1766
|
+
message: errorUtil.toString(message)
|
1767
|
+
});
|
1768
|
+
}
|
1445
1769
|
get minValue() {
|
1446
1770
|
let min = null;
|
1447
1771
|
for (const ch of this._def.checks) {
|
@@ -1463,7 +1787,22 @@ var require_types_cjs_development = __commonJS({
|
|
1463
1787
|
return max;
|
1464
1788
|
}
|
1465
1789
|
get isInt() {
|
1466
|
-
return !!this._def.checks.find((ch) => ch.kind === "int");
|
1790
|
+
return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
|
1791
|
+
}
|
1792
|
+
get isFinite() {
|
1793
|
+
let max = null, min = null;
|
1794
|
+
for (const ch of this._def.checks) {
|
1795
|
+
if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
|
1796
|
+
return true;
|
1797
|
+
} else if (ch.kind === "min") {
|
1798
|
+
if (min === null || ch.value > min)
|
1799
|
+
min = ch.value;
|
1800
|
+
} else if (ch.kind === "max") {
|
1801
|
+
if (max === null || ch.value < max)
|
1802
|
+
max = ch.value;
|
1803
|
+
}
|
1804
|
+
}
|
1805
|
+
return Number.isFinite(min) && Number.isFinite(max);
|
1467
1806
|
}
|
1468
1807
|
}, "ZodNumber");
|
1469
1808
|
__name22(ZodNumber, "ZodNumber");
|
@@ -1476,27 +1815,167 @@ var require_types_cjs_development = __commonJS({
|
|
1476
1815
|
});
|
1477
1816
|
};
|
1478
1817
|
var ZodBigInt = /* @__PURE__ */ __name2(class extends ZodType {
|
1818
|
+
constructor() {
|
1819
|
+
super(...arguments);
|
1820
|
+
this.min = this.gte;
|
1821
|
+
this.max = this.lte;
|
1822
|
+
}
|
1479
1823
|
_parse(input) {
|
1480
1824
|
if (this._def.coerce) {
|
1481
1825
|
input.data = BigInt(input.data);
|
1482
1826
|
}
|
1483
1827
|
const parsedType = this._getType(input);
|
1484
1828
|
if (parsedType !== ZodParsedType.bigint) {
|
1485
|
-
const
|
1486
|
-
addIssueToContext(
|
1829
|
+
const ctx2 = this._getOrReturnCtx(input);
|
1830
|
+
addIssueToContext(ctx2, {
|
1487
1831
|
code: ZodIssueCode.invalid_type,
|
1488
1832
|
expected: ZodParsedType.bigint,
|
1489
|
-
received:
|
1833
|
+
received: ctx2.parsedType
|
1490
1834
|
});
|
1491
1835
|
return INVALID;
|
1492
1836
|
}
|
1493
|
-
|
1837
|
+
let ctx = void 0;
|
1838
|
+
const status = new ParseStatus();
|
1839
|
+
for (const check of this._def.checks) {
|
1840
|
+
if (check.kind === "min") {
|
1841
|
+
const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
|
1842
|
+
if (tooSmall) {
|
1843
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
1844
|
+
addIssueToContext(ctx, {
|
1845
|
+
code: ZodIssueCode.too_small,
|
1846
|
+
type: "bigint",
|
1847
|
+
minimum: check.value,
|
1848
|
+
inclusive: check.inclusive,
|
1849
|
+
message: check.message
|
1850
|
+
});
|
1851
|
+
status.dirty();
|
1852
|
+
}
|
1853
|
+
} else if (check.kind === "max") {
|
1854
|
+
const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
|
1855
|
+
if (tooBig) {
|
1856
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
1857
|
+
addIssueToContext(ctx, {
|
1858
|
+
code: ZodIssueCode.too_big,
|
1859
|
+
type: "bigint",
|
1860
|
+
maximum: check.value,
|
1861
|
+
inclusive: check.inclusive,
|
1862
|
+
message: check.message
|
1863
|
+
});
|
1864
|
+
status.dirty();
|
1865
|
+
}
|
1866
|
+
} else if (check.kind === "multipleOf") {
|
1867
|
+
if (input.data % check.value !== BigInt(0)) {
|
1868
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
1869
|
+
addIssueToContext(ctx, {
|
1870
|
+
code: ZodIssueCode.not_multiple_of,
|
1871
|
+
multipleOf: check.value,
|
1872
|
+
message: check.message
|
1873
|
+
});
|
1874
|
+
status.dirty();
|
1875
|
+
}
|
1876
|
+
} else {
|
1877
|
+
util.assertNever(check);
|
1878
|
+
}
|
1879
|
+
}
|
1880
|
+
return { status: status.value, value: input.data };
|
1881
|
+
}
|
1882
|
+
gte(value, message) {
|
1883
|
+
return this.setLimit("min", value, true, errorUtil.toString(message));
|
1884
|
+
}
|
1885
|
+
gt(value, message) {
|
1886
|
+
return this.setLimit("min", value, false, errorUtil.toString(message));
|
1887
|
+
}
|
1888
|
+
lte(value, message) {
|
1889
|
+
return this.setLimit("max", value, true, errorUtil.toString(message));
|
1890
|
+
}
|
1891
|
+
lt(value, message) {
|
1892
|
+
return this.setLimit("max", value, false, errorUtil.toString(message));
|
1893
|
+
}
|
1894
|
+
setLimit(kind, value, inclusive, message) {
|
1895
|
+
return new ZodBigInt({
|
1896
|
+
...this._def,
|
1897
|
+
checks: [
|
1898
|
+
...this._def.checks,
|
1899
|
+
{
|
1900
|
+
kind,
|
1901
|
+
value,
|
1902
|
+
inclusive,
|
1903
|
+
message: errorUtil.toString(message)
|
1904
|
+
}
|
1905
|
+
]
|
1906
|
+
});
|
1907
|
+
}
|
1908
|
+
_addCheck(check) {
|
1909
|
+
return new ZodBigInt({
|
1910
|
+
...this._def,
|
1911
|
+
checks: [...this._def.checks, check]
|
1912
|
+
});
|
1913
|
+
}
|
1914
|
+
positive(message) {
|
1915
|
+
return this._addCheck({
|
1916
|
+
kind: "min",
|
1917
|
+
value: BigInt(0),
|
1918
|
+
inclusive: false,
|
1919
|
+
message: errorUtil.toString(message)
|
1920
|
+
});
|
1921
|
+
}
|
1922
|
+
negative(message) {
|
1923
|
+
return this._addCheck({
|
1924
|
+
kind: "max",
|
1925
|
+
value: BigInt(0),
|
1926
|
+
inclusive: false,
|
1927
|
+
message: errorUtil.toString(message)
|
1928
|
+
});
|
1929
|
+
}
|
1930
|
+
nonpositive(message) {
|
1931
|
+
return this._addCheck({
|
1932
|
+
kind: "max",
|
1933
|
+
value: BigInt(0),
|
1934
|
+
inclusive: true,
|
1935
|
+
message: errorUtil.toString(message)
|
1936
|
+
});
|
1937
|
+
}
|
1938
|
+
nonnegative(message) {
|
1939
|
+
return this._addCheck({
|
1940
|
+
kind: "min",
|
1941
|
+
value: BigInt(0),
|
1942
|
+
inclusive: true,
|
1943
|
+
message: errorUtil.toString(message)
|
1944
|
+
});
|
1945
|
+
}
|
1946
|
+
multipleOf(value, message) {
|
1947
|
+
return this._addCheck({
|
1948
|
+
kind: "multipleOf",
|
1949
|
+
value,
|
1950
|
+
message: errorUtil.toString(message)
|
1951
|
+
});
|
1952
|
+
}
|
1953
|
+
get minValue() {
|
1954
|
+
let min = null;
|
1955
|
+
for (const ch of this._def.checks) {
|
1956
|
+
if (ch.kind === "min") {
|
1957
|
+
if (min === null || ch.value > min)
|
1958
|
+
min = ch.value;
|
1959
|
+
}
|
1960
|
+
}
|
1961
|
+
return min;
|
1962
|
+
}
|
1963
|
+
get maxValue() {
|
1964
|
+
let max = null;
|
1965
|
+
for (const ch of this._def.checks) {
|
1966
|
+
if (ch.kind === "max") {
|
1967
|
+
if (max === null || ch.value < max)
|
1968
|
+
max = ch.value;
|
1969
|
+
}
|
1970
|
+
}
|
1971
|
+
return max;
|
1494
1972
|
}
|
1495
1973
|
}, "ZodBigInt");
|
1496
1974
|
__name22(ZodBigInt, "ZodBigInt");
|
1497
1975
|
ZodBigInt.create = (params) => {
|
1498
1976
|
var _a;
|
1499
1977
|
return new ZodBigInt({
|
1978
|
+
checks: [],
|
1500
1979
|
typeName: ZodFirstPartyTypeKind.ZodBigInt,
|
1501
1980
|
coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
|
1502
1981
|
...processCreateParams(params)
|
@@ -1831,13 +2310,13 @@ var require_types_cjs_development = __commonJS({
|
|
1831
2310
|
}
|
1832
2311
|
}
|
1833
2312
|
if (ctx.common.async) {
|
1834
|
-
return Promise.all(ctx.data.map((item, i) => {
|
2313
|
+
return Promise.all([...ctx.data].map((item, i) => {
|
1835
2314
|
return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
|
1836
2315
|
})).then((result2) => {
|
1837
2316
|
return ParseStatus.mergeArray(status, result2);
|
1838
2317
|
});
|
1839
2318
|
}
|
1840
|
-
const result = ctx.data.map((item, i) => {
|
2319
|
+
const result = [...ctx.data].map((item, i) => {
|
1841
2320
|
return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
|
1842
2321
|
});
|
1843
2322
|
return ParseStatus.mergeArray(status, result);
|
@@ -1878,24 +2357,6 @@ var require_types_cjs_development = __commonJS({
|
|
1878
2357
|
...processCreateParams(params)
|
1879
2358
|
});
|
1880
2359
|
};
|
1881
|
-
var objectUtil;
|
1882
|
-
(function(objectUtil2) {
|
1883
|
-
objectUtil2.mergeShapes = (first, second) => {
|
1884
|
-
return {
|
1885
|
-
...first,
|
1886
|
-
...second
|
1887
|
-
};
|
1888
|
-
};
|
1889
|
-
})(objectUtil || (objectUtil = {}));
|
1890
|
-
var AugmentFactory = /* @__PURE__ */ __name22((def) => (augmentation) => {
|
1891
|
-
return new ZodObject({
|
1892
|
-
...def,
|
1893
|
-
shape: () => ({
|
1894
|
-
...def.shape(),
|
1895
|
-
...augmentation
|
1896
|
-
})
|
1897
|
-
});
|
1898
|
-
}, "AugmentFactory");
|
1899
2360
|
function deepPartialify(schema) {
|
1900
2361
|
if (schema instanceof ZodObject) {
|
1901
2362
|
const newShape = {};
|
@@ -1908,7 +2369,10 @@ var require_types_cjs_development = __commonJS({
|
|
1908
2369
|
shape: () => newShape
|
1909
2370
|
});
|
1910
2371
|
} else if (schema instanceof ZodArray) {
|
1911
|
-
return ZodArray
|
2372
|
+
return new ZodArray({
|
2373
|
+
...schema._def,
|
2374
|
+
type: deepPartialify(schema.element)
|
2375
|
+
});
|
1912
2376
|
} else if (schema instanceof ZodOptional) {
|
1913
2377
|
return ZodOptional.create(deepPartialify(schema.unwrap()));
|
1914
2378
|
} else if (schema instanceof ZodNullable) {
|
@@ -1927,8 +2391,7 @@ var require_types_cjs_development = __commonJS({
|
|
1927
2391
|
super(...arguments);
|
1928
2392
|
this._cached = null;
|
1929
2393
|
this.nonstrict = this.passthrough;
|
1930
|
-
this.augment =
|
1931
|
-
this.extend = AugmentFactory(this._def);
|
2394
|
+
this.augment = this.extend;
|
1932
2395
|
}
|
1933
2396
|
_getCached() {
|
1934
2397
|
if (this._cached !== null)
|
@@ -2008,9 +2471,10 @@ var require_types_cjs_development = __commonJS({
|
|
2008
2471
|
const syncPairs = [];
|
2009
2472
|
for (const pair of pairs) {
|
2010
2473
|
const key = await pair.key;
|
2474
|
+
const value = await pair.value;
|
2011
2475
|
syncPairs.push({
|
2012
2476
|
key,
|
2013
|
-
value
|
2477
|
+
value,
|
2014
2478
|
alwaysSet: pair.alwaysSet
|
2015
2479
|
});
|
2016
2480
|
}
|
@@ -2057,18 +2521,30 @@ var require_types_cjs_development = __commonJS({
|
|
2057
2521
|
unknownKeys: "passthrough"
|
2058
2522
|
});
|
2059
2523
|
}
|
2060
|
-
|
2061
|
-
return
|
2524
|
+
extend(augmentation) {
|
2525
|
+
return new ZodObject({
|
2526
|
+
...this._def,
|
2527
|
+
shape: () => ({
|
2528
|
+
...this._def.shape(),
|
2529
|
+
...augmentation
|
2530
|
+
})
|
2531
|
+
});
|
2062
2532
|
}
|
2063
2533
|
merge(merging) {
|
2064
2534
|
const merged = new ZodObject({
|
2065
2535
|
unknownKeys: merging._def.unknownKeys,
|
2066
2536
|
catchall: merging._def.catchall,
|
2067
|
-
shape: () =>
|
2537
|
+
shape: () => ({
|
2538
|
+
...this._def.shape(),
|
2539
|
+
...merging._def.shape()
|
2540
|
+
}),
|
2068
2541
|
typeName: ZodFirstPartyTypeKind.ZodObject
|
2069
2542
|
});
|
2070
2543
|
return merged;
|
2071
2544
|
}
|
2545
|
+
setKey(key, schema) {
|
2546
|
+
return this.augment({ [key]: schema });
|
2547
|
+
}
|
2072
2548
|
catchall(index) {
|
2073
2549
|
return new ZodObject({
|
2074
2550
|
...this._def,
|
@@ -2077,9 +2553,10 @@ var require_types_cjs_development = __commonJS({
|
|
2077
2553
|
}
|
2078
2554
|
pick(mask) {
|
2079
2555
|
const shape = {};
|
2080
|
-
util.objectKeys(mask).
|
2081
|
-
if (this.shape[key])
|
2556
|
+
util.objectKeys(mask).forEach((key) => {
|
2557
|
+
if (mask[key] && this.shape[key]) {
|
2082
2558
|
shape[key] = this.shape[key];
|
2559
|
+
}
|
2083
2560
|
});
|
2084
2561
|
return new ZodObject({
|
2085
2562
|
...this._def,
|
@@ -2088,8 +2565,8 @@ var require_types_cjs_development = __commonJS({
|
|
2088
2565
|
}
|
2089
2566
|
omit(mask) {
|
2090
2567
|
const shape = {};
|
2091
|
-
util.objectKeys(this.shape).
|
2092
|
-
if (
|
2568
|
+
util.objectKeys(this.shape).forEach((key) => {
|
2569
|
+
if (!mask[key]) {
|
2093
2570
|
shape[key] = this.shape[key];
|
2094
2571
|
}
|
2095
2572
|
});
|
@@ -2103,24 +2580,14 @@ var require_types_cjs_development = __commonJS({
|
|
2103
2580
|
}
|
2104
2581
|
partial(mask) {
|
2105
2582
|
const newShape = {};
|
2106
|
-
|
2107
|
-
|
2108
|
-
|
2109
|
-
|
2110
|
-
|
2111
|
-
newShape[key] = this.shape[key].optional();
|
2112
|
-
}
|
2113
|
-
});
|
2114
|
-
return new ZodObject({
|
2115
|
-
...this._def,
|
2116
|
-
shape: () => newShape
|
2117
|
-
});
|
2118
|
-
} else {
|
2119
|
-
for (const key in this.shape) {
|
2120
|
-
const fieldSchema = this.shape[key];
|
2583
|
+
util.objectKeys(this.shape).forEach((key) => {
|
2584
|
+
const fieldSchema = this.shape[key];
|
2585
|
+
if (mask && !mask[key]) {
|
2586
|
+
newShape[key] = fieldSchema;
|
2587
|
+
} else {
|
2121
2588
|
newShape[key] = fieldSchema.optional();
|
2122
2589
|
}
|
2123
|
-
}
|
2590
|
+
});
|
2124
2591
|
return new ZodObject({
|
2125
2592
|
...this._def,
|
2126
2593
|
shape: () => newShape
|
@@ -2128,21 +2595,10 @@ var require_types_cjs_development = __commonJS({
|
|
2128
2595
|
}
|
2129
2596
|
required(mask) {
|
2130
2597
|
const newShape = {};
|
2131
|
-
|
2132
|
-
|
2133
|
-
|
2134
|
-
|
2135
|
-
} else {
|
2136
|
-
const fieldSchema = this.shape[key];
|
2137
|
-
let newField = fieldSchema;
|
2138
|
-
while (newField instanceof ZodOptional) {
|
2139
|
-
newField = newField._def.innerType;
|
2140
|
-
}
|
2141
|
-
newShape[key] = newField;
|
2142
|
-
}
|
2143
|
-
});
|
2144
|
-
} else {
|
2145
|
-
for (const key in this.shape) {
|
2598
|
+
util.objectKeys(this.shape).forEach((key) => {
|
2599
|
+
if (mask && !mask[key]) {
|
2600
|
+
newShape[key] = this.shape[key];
|
2601
|
+
} else {
|
2146
2602
|
const fieldSchema = this.shape[key];
|
2147
2603
|
let newField = fieldSchema;
|
2148
2604
|
while (newField instanceof ZodOptional) {
|
@@ -2150,7 +2606,7 @@ var require_types_cjs_development = __commonJS({
|
|
2150
2606
|
}
|
2151
2607
|
newShape[key] = newField;
|
2152
2608
|
}
|
2153
|
-
}
|
2609
|
+
});
|
2154
2610
|
return new ZodObject({
|
2155
2611
|
...this._def,
|
2156
2612
|
shape: () => newShape
|
@@ -2293,15 +2749,25 @@ var require_types_cjs_development = __commonJS({
|
|
2293
2749
|
} else if (type instanceof ZodEnum) {
|
2294
2750
|
return type.options;
|
2295
2751
|
} else if (type instanceof ZodNativeEnum) {
|
2296
|
-
return
|
2752
|
+
return util.objectValues(type.enum);
|
2297
2753
|
} else if (type instanceof ZodDefault) {
|
2298
2754
|
return getDiscriminator(type._def.innerType);
|
2299
2755
|
} else if (type instanceof ZodUndefined) {
|
2300
2756
|
return [void 0];
|
2301
2757
|
} else if (type instanceof ZodNull) {
|
2302
2758
|
return [null];
|
2759
|
+
} else if (type instanceof ZodOptional) {
|
2760
|
+
return [void 0, ...getDiscriminator(type.unwrap())];
|
2761
|
+
} else if (type instanceof ZodNullable) {
|
2762
|
+
return [null, ...getDiscriminator(type.unwrap())];
|
2763
|
+
} else if (type instanceof ZodBranded) {
|
2764
|
+
return getDiscriminator(type.unwrap());
|
2765
|
+
} else if (type instanceof ZodReadonly) {
|
2766
|
+
return getDiscriminator(type.unwrap());
|
2767
|
+
} else if (type instanceof ZodCatch) {
|
2768
|
+
return getDiscriminator(type._def.innerType);
|
2303
2769
|
} else {
|
2304
|
-
return
|
2770
|
+
return [];
|
2305
2771
|
}
|
2306
2772
|
}, "getDiscriminator");
|
2307
2773
|
var ZodDiscriminatedUnion = /* @__PURE__ */ __name2(class extends ZodType {
|
@@ -2353,7 +2819,7 @@ var require_types_cjs_development = __commonJS({
|
|
2353
2819
|
const optionsMap = /* @__PURE__ */ new Map();
|
2354
2820
|
for (const type of options) {
|
2355
2821
|
const discriminatorValues = getDiscriminator(type.shape[discriminator]);
|
2356
|
-
if (!discriminatorValues) {
|
2822
|
+
if (!discriminatorValues.length) {
|
2357
2823
|
throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
|
2358
2824
|
}
|
2359
2825
|
for (const value of discriminatorValues) {
|
@@ -2500,7 +2966,7 @@ var require_types_cjs_development = __commonJS({
|
|
2500
2966
|
});
|
2501
2967
|
status.dirty();
|
2502
2968
|
}
|
2503
|
-
const items = ctx.data.map((item, itemIndex) => {
|
2969
|
+
const items = [...ctx.data].map((item, itemIndex) => {
|
2504
2970
|
const schema = this._def.items[itemIndex] || this._def.rest;
|
2505
2971
|
if (!schema)
|
2506
2972
|
return null;
|
@@ -2559,7 +3025,8 @@ var require_types_cjs_development = __commonJS({
|
|
2559
3025
|
for (const key in ctx.data) {
|
2560
3026
|
pairs.push({
|
2561
3027
|
key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
|
2562
|
-
value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key))
|
3028
|
+
value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),
|
3029
|
+
alwaysSet: key in ctx.data
|
2563
3030
|
});
|
2564
3031
|
}
|
2565
3032
|
if (ctx.common.async) {
|
@@ -2590,6 +3057,12 @@ var require_types_cjs_development = __commonJS({
|
|
2590
3057
|
}, "ZodRecord");
|
2591
3058
|
__name22(ZodRecord, "ZodRecord");
|
2592
3059
|
var ZodMap = /* @__PURE__ */ __name2(class extends ZodType {
|
3060
|
+
get keySchema() {
|
3061
|
+
return this._def.keyType;
|
3062
|
+
}
|
3063
|
+
get valueSchema() {
|
3064
|
+
return this._def.valueType;
|
3065
|
+
}
|
2593
3066
|
_parse(input) {
|
2594
3067
|
const { status, ctx } = this._processInputParams(input);
|
2595
3068
|
if (ctx.parsedType !== ZodParsedType.map) {
|
@@ -2795,27 +3268,29 @@ var require_types_cjs_development = __commonJS({
|
|
2795
3268
|
const params = { errorMap: ctx.common.contextualErrorMap };
|
2796
3269
|
const fn = ctx.data;
|
2797
3270
|
if (this._def.returns instanceof ZodPromise) {
|
2798
|
-
|
3271
|
+
const me = this;
|
3272
|
+
return OK(async function(...args) {
|
2799
3273
|
const error = new ZodError([]);
|
2800
|
-
const parsedArgs = await
|
3274
|
+
const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
|
2801
3275
|
error.addIssue(makeArgsIssue(args, e));
|
2802
3276
|
throw error;
|
2803
3277
|
});
|
2804
|
-
const result = await fn
|
2805
|
-
const parsedReturns = await
|
3278
|
+
const result = await Reflect.apply(fn, this, parsedArgs);
|
3279
|
+
const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e) => {
|
2806
3280
|
error.addIssue(makeReturnsIssue(result, e));
|
2807
3281
|
throw error;
|
2808
3282
|
});
|
2809
3283
|
return parsedReturns;
|
2810
3284
|
});
|
2811
3285
|
} else {
|
2812
|
-
|
2813
|
-
|
3286
|
+
const me = this;
|
3287
|
+
return OK(function(...args) {
|
3288
|
+
const parsedArgs = me._def.args.safeParse(args, params);
|
2814
3289
|
if (!parsedArgs.success) {
|
2815
3290
|
throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
|
2816
3291
|
}
|
2817
|
-
const result = fn
|
2818
|
-
const parsedReturns =
|
3292
|
+
const result = Reflect.apply(fn, this, parsedArgs.data);
|
3293
|
+
const parsedReturns = me._def.returns.safeParse(result, params);
|
2819
3294
|
if (!parsedReturns.success) {
|
2820
3295
|
throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
|
2821
3296
|
}
|
@@ -2882,6 +3357,7 @@ var require_types_cjs_development = __commonJS({
|
|
2882
3357
|
if (input.data !== this._def.value) {
|
2883
3358
|
const ctx = this._getOrReturnCtx(input);
|
2884
3359
|
addIssueToContext(ctx, {
|
3360
|
+
received: ctx.data,
|
2885
3361
|
code: ZodIssueCode.invalid_literal,
|
2886
3362
|
expected: this._def.value
|
2887
3363
|
});
|
@@ -2912,6 +3388,10 @@ var require_types_cjs_development = __commonJS({
|
|
2912
3388
|
__name2(createZodEnum, "createZodEnum");
|
2913
3389
|
__name22(createZodEnum, "createZodEnum");
|
2914
3390
|
var ZodEnum = /* @__PURE__ */ __name2(class extends ZodType {
|
3391
|
+
constructor() {
|
3392
|
+
super(...arguments);
|
3393
|
+
_ZodEnum_cache.set(this, void 0);
|
3394
|
+
}
|
2915
3395
|
_parse(input) {
|
2916
3396
|
if (typeof input.data !== "string") {
|
2917
3397
|
const ctx = this._getOrReturnCtx(input);
|
@@ -2923,7 +3403,10 @@ var require_types_cjs_development = __commonJS({
|
|
2923
3403
|
});
|
2924
3404
|
return INVALID;
|
2925
3405
|
}
|
2926
|
-
if (this
|
3406
|
+
if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f")) {
|
3407
|
+
__classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values), "f");
|
3408
|
+
}
|
3409
|
+
if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f").has(input.data)) {
|
2927
3410
|
const ctx = this._getOrReturnCtx(input);
|
2928
3411
|
const expectedValues = this._def.values;
|
2929
3412
|
addIssueToContext(ctx, {
|
@@ -2959,10 +3442,27 @@ var require_types_cjs_development = __commonJS({
|
|
2959
3442
|
}
|
2960
3443
|
return enumValues;
|
2961
3444
|
}
|
3445
|
+
extract(values, newDef = this._def) {
|
3446
|
+
return ZodEnum.create(values, {
|
3447
|
+
...this._def,
|
3448
|
+
...newDef
|
3449
|
+
});
|
3450
|
+
}
|
3451
|
+
exclude(values, newDef = this._def) {
|
3452
|
+
return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {
|
3453
|
+
...this._def,
|
3454
|
+
...newDef
|
3455
|
+
});
|
3456
|
+
}
|
2962
3457
|
}, "ZodEnum");
|
2963
3458
|
__name22(ZodEnum, "ZodEnum");
|
3459
|
+
_ZodEnum_cache = /* @__PURE__ */ new WeakMap();
|
2964
3460
|
ZodEnum.create = createZodEnum;
|
2965
3461
|
var ZodNativeEnum = /* @__PURE__ */ __name2(class extends ZodType {
|
3462
|
+
constructor() {
|
3463
|
+
super(...arguments);
|
3464
|
+
_ZodNativeEnum_cache.set(this, void 0);
|
3465
|
+
}
|
2966
3466
|
_parse(input) {
|
2967
3467
|
const nativeEnumValues = util.getValidEnumValues(this._def.values);
|
2968
3468
|
const ctx = this._getOrReturnCtx(input);
|
@@ -2975,7 +3475,10 @@ var require_types_cjs_development = __commonJS({
|
|
2975
3475
|
});
|
2976
3476
|
return INVALID;
|
2977
3477
|
}
|
2978
|
-
if (
|
3478
|
+
if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f")) {
|
3479
|
+
__classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util.getValidEnumValues(this._def.values)), "f");
|
3480
|
+
}
|
3481
|
+
if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f").has(input.data)) {
|
2979
3482
|
const expectedValues = util.objectValues(nativeEnumValues);
|
2980
3483
|
addIssueToContext(ctx, {
|
2981
3484
|
received: ctx.data,
|
@@ -2991,6 +3494,7 @@ var require_types_cjs_development = __commonJS({
|
|
2991
3494
|
}
|
2992
3495
|
}, "ZodNativeEnum");
|
2993
3496
|
__name22(ZodNativeEnum, "ZodNativeEnum");
|
3497
|
+
_ZodNativeEnum_cache = /* @__PURE__ */ new WeakMap();
|
2994
3498
|
ZodNativeEnum.create = (values, params) => {
|
2995
3499
|
return new ZodNativeEnum({
|
2996
3500
|
values,
|
@@ -2999,6 +3503,9 @@ var require_types_cjs_development = __commonJS({
|
|
2999
3503
|
});
|
3000
3504
|
};
|
3001
3505
|
var ZodPromise = /* @__PURE__ */ __name2(class extends ZodType {
|
3506
|
+
unwrap() {
|
3507
|
+
return this._def.type;
|
3508
|
+
}
|
3002
3509
|
_parse(input) {
|
3003
3510
|
const { ctx } = this._processInputParams(input);
|
3004
3511
|
if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
|
@@ -3036,24 +3543,6 @@ var require_types_cjs_development = __commonJS({
|
|
3036
3543
|
_parse(input) {
|
3037
3544
|
const { status, ctx } = this._processInputParams(input);
|
3038
3545
|
const effect = this._def.effect || null;
|
3039
|
-
if (effect.type === "preprocess") {
|
3040
|
-
const processed = effect.transform(ctx.data);
|
3041
|
-
if (ctx.common.async) {
|
3042
|
-
return Promise.resolve(processed).then((processed2) => {
|
3043
|
-
return this._def.schema._parseAsync({
|
3044
|
-
data: processed2,
|
3045
|
-
path: ctx.path,
|
3046
|
-
parent: ctx
|
3047
|
-
});
|
3048
|
-
});
|
3049
|
-
} else {
|
3050
|
-
return this._def.schema._parseSync({
|
3051
|
-
data: processed,
|
3052
|
-
path: ctx.path,
|
3053
|
-
parent: ctx
|
3054
|
-
});
|
3055
|
-
}
|
3056
|
-
}
|
3057
3546
|
const checkCtx = {
|
3058
3547
|
addIssue: (arg) => {
|
3059
3548
|
addIssueToContext(ctx, arg);
|
@@ -3068,6 +3557,42 @@ var require_types_cjs_development = __commonJS({
|
|
3068
3557
|
}
|
3069
3558
|
};
|
3070
3559
|
checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
|
3560
|
+
if (effect.type === "preprocess") {
|
3561
|
+
const processed = effect.transform(ctx.data, checkCtx);
|
3562
|
+
if (ctx.common.async) {
|
3563
|
+
return Promise.resolve(processed).then(async (processed2) => {
|
3564
|
+
if (status.value === "aborted")
|
3565
|
+
return INVALID;
|
3566
|
+
const result = await this._def.schema._parseAsync({
|
3567
|
+
data: processed2,
|
3568
|
+
path: ctx.path,
|
3569
|
+
parent: ctx
|
3570
|
+
});
|
3571
|
+
if (result.status === "aborted")
|
3572
|
+
return INVALID;
|
3573
|
+
if (result.status === "dirty")
|
3574
|
+
return DIRTY(result.value);
|
3575
|
+
if (status.value === "dirty")
|
3576
|
+
return DIRTY(result.value);
|
3577
|
+
return result;
|
3578
|
+
});
|
3579
|
+
} else {
|
3580
|
+
if (status.value === "aborted")
|
3581
|
+
return INVALID;
|
3582
|
+
const result = this._def.schema._parseSync({
|
3583
|
+
data: processed,
|
3584
|
+
path: ctx.path,
|
3585
|
+
parent: ctx
|
3586
|
+
});
|
3587
|
+
if (result.status === "aborted")
|
3588
|
+
return INVALID;
|
3589
|
+
if (result.status === "dirty")
|
3590
|
+
return DIRTY(result.value);
|
3591
|
+
if (status.value === "dirty")
|
3592
|
+
return DIRTY(result.value);
|
3593
|
+
return result;
|
3594
|
+
}
|
3595
|
+
}
|
3071
3596
|
if (effect.type === "refinement") {
|
3072
3597
|
const executeRefinement = /* @__PURE__ */ __name22((acc) => {
|
3073
3598
|
const result = effect.refinement(acc, checkCtx);
|
@@ -3214,26 +3739,45 @@ var require_types_cjs_development = __commonJS({
|
|
3214
3739
|
var ZodCatch = /* @__PURE__ */ __name2(class extends ZodType {
|
3215
3740
|
_parse(input) {
|
3216
3741
|
const { ctx } = this._processInputParams(input);
|
3742
|
+
const newCtx = {
|
3743
|
+
...ctx,
|
3744
|
+
common: {
|
3745
|
+
...ctx.common,
|
3746
|
+
issues: []
|
3747
|
+
}
|
3748
|
+
};
|
3217
3749
|
const result = this._def.innerType._parse({
|
3218
|
-
data:
|
3219
|
-
path:
|
3220
|
-
parent:
|
3750
|
+
data: newCtx.data,
|
3751
|
+
path: newCtx.path,
|
3752
|
+
parent: {
|
3753
|
+
...newCtx
|
3754
|
+
}
|
3221
3755
|
});
|
3222
3756
|
if (isAsync(result)) {
|
3223
3757
|
return result.then((result2) => {
|
3224
3758
|
return {
|
3225
3759
|
status: "valid",
|
3226
|
-
value: result2.status === "valid" ? result2.value : this._def.
|
3760
|
+
value: result2.status === "valid" ? result2.value : this._def.catchValue({
|
3761
|
+
get error() {
|
3762
|
+
return new ZodError(newCtx.common.issues);
|
3763
|
+
},
|
3764
|
+
input: newCtx.data
|
3765
|
+
})
|
3227
3766
|
};
|
3228
3767
|
});
|
3229
3768
|
} else {
|
3230
3769
|
return {
|
3231
3770
|
status: "valid",
|
3232
|
-
value: result.status === "valid" ? result.value : this._def.
|
3771
|
+
value: result.status === "valid" ? result.value : this._def.catchValue({
|
3772
|
+
get error() {
|
3773
|
+
return new ZodError(newCtx.common.issues);
|
3774
|
+
},
|
3775
|
+
input: newCtx.data
|
3776
|
+
})
|
3233
3777
|
};
|
3234
3778
|
}
|
3235
3779
|
}
|
3236
|
-
|
3780
|
+
removeCatch() {
|
3237
3781
|
return this._def.innerType;
|
3238
3782
|
}
|
3239
3783
|
}, "ZodCatch");
|
@@ -3242,7 +3786,7 @@ var require_types_cjs_development = __commonJS({
|
|
3242
3786
|
return new ZodCatch({
|
3243
3787
|
innerType: type,
|
3244
3788
|
typeName: ZodFirstPartyTypeKind.ZodCatch,
|
3245
|
-
|
3789
|
+
catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
|
3246
3790
|
...processCreateParams(params)
|
3247
3791
|
});
|
3248
3792
|
};
|
@@ -3340,17 +3884,45 @@ var require_types_cjs_development = __commonJS({
|
|
3340
3884
|
}
|
3341
3885
|
}, "ZodPipeline");
|
3342
3886
|
__name22(ZodPipeline, "ZodPipeline");
|
3343
|
-
var
|
3887
|
+
var ZodReadonly = /* @__PURE__ */ __name2(class extends ZodType {
|
3888
|
+
_parse(input) {
|
3889
|
+
const result = this._def.innerType._parse(input);
|
3890
|
+
const freeze = /* @__PURE__ */ __name22((data) => {
|
3891
|
+
if (isValid(data)) {
|
3892
|
+
data.value = Object.freeze(data.value);
|
3893
|
+
}
|
3894
|
+
return data;
|
3895
|
+
}, "freeze");
|
3896
|
+
return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
|
3897
|
+
}
|
3898
|
+
unwrap() {
|
3899
|
+
return this._def.innerType;
|
3900
|
+
}
|
3901
|
+
}, "ZodReadonly");
|
3902
|
+
__name22(ZodReadonly, "ZodReadonly");
|
3903
|
+
ZodReadonly.create = (type, params) => {
|
3904
|
+
return new ZodReadonly({
|
3905
|
+
innerType: type,
|
3906
|
+
typeName: ZodFirstPartyTypeKind.ZodReadonly,
|
3907
|
+
...processCreateParams(params)
|
3908
|
+
});
|
3909
|
+
};
|
3910
|
+
function custom(check, params = {}, fatal) {
|
3344
3911
|
if (check)
|
3345
3912
|
return ZodAny.create().superRefine((data, ctx) => {
|
3913
|
+
var _a, _b;
|
3346
3914
|
if (!check(data)) {
|
3347
|
-
const p = typeof params === "function" ? params(data) : params;
|
3915
|
+
const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
|
3916
|
+
const _fatal = (_b = (_a = p.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
|
3348
3917
|
const p2 = typeof p === "string" ? { message: p } : p;
|
3349
|
-
ctx.addIssue({ code: "custom", ...p2, fatal });
|
3918
|
+
ctx.addIssue({ code: "custom", ...p2, fatal: _fatal });
|
3350
3919
|
}
|
3351
3920
|
});
|
3352
3921
|
return ZodAny.create();
|
3353
|
-
}
|
3922
|
+
}
|
3923
|
+
__name(custom, "custom");
|
3924
|
+
__name2(custom, "custom");
|
3925
|
+
__name22(custom, "custom");
|
3354
3926
|
var late = {
|
3355
3927
|
object: ZodObject.lazycreate
|
3356
3928
|
};
|
@@ -3391,10 +3963,11 @@ var require_types_cjs_development = __commonJS({
|
|
3391
3963
|
ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";
|
3392
3964
|
ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";
|
3393
3965
|
ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
|
3966
|
+
ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly";
|
3394
3967
|
})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
|
3395
3968
|
var instanceOfType = /* @__PURE__ */ __name22((cls, params = {
|
3396
3969
|
message: `Input not instance of ${cls.name}`
|
3397
|
-
}) => custom((data) => data instanceof cls, params
|
3970
|
+
}) => custom((data) => data instanceof cls, params), "instanceOfType");
|
3398
3971
|
var stringType = ZodString.create;
|
3399
3972
|
var numberType = ZodNumber.create;
|
3400
3973
|
var nanType = ZodNaN.create;
|
@@ -3435,12 +4008,15 @@ var require_types_cjs_development = __commonJS({
|
|
3435
4008
|
var coerce = {
|
3436
4009
|
string: (arg) => ZodString.create({ ...arg, coerce: true }),
|
3437
4010
|
number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
|
3438
|
-
boolean: (arg) => ZodBoolean.create({
|
4011
|
+
boolean: (arg) => ZodBoolean.create({
|
4012
|
+
...arg,
|
4013
|
+
coerce: true
|
4014
|
+
}),
|
3439
4015
|
bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
|
3440
4016
|
date: (arg) => ZodDate.create({ ...arg, coerce: true })
|
3441
4017
|
};
|
3442
4018
|
var NEVER = INVALID;
|
3443
|
-
var
|
4019
|
+
var z = /* @__PURE__ */ Object.freeze({
|
3444
4020
|
__proto__: null,
|
3445
4021
|
defaultErrorMap: errorMap,
|
3446
4022
|
setErrorMap,
|
@@ -3459,9 +4035,13 @@ var require_types_cjs_development = __commonJS({
|
|
3459
4035
|
get util() {
|
3460
4036
|
return util;
|
3461
4037
|
},
|
4038
|
+
get objectUtil() {
|
4039
|
+
return objectUtil;
|
4040
|
+
},
|
3462
4041
|
ZodParsedType,
|
3463
4042
|
getParsedType,
|
3464
4043
|
ZodType,
|
4044
|
+
datetimeRegex,
|
3465
4045
|
ZodString,
|
3466
4046
|
ZodNumber,
|
3467
4047
|
ZodBigInt,
|
@@ -3475,9 +4055,6 @@ var require_types_cjs_development = __commonJS({
|
|
3475
4055
|
ZodNever,
|
3476
4056
|
ZodVoid,
|
3477
4057
|
ZodArray,
|
3478
|
-
get objectUtil() {
|
3479
|
-
return objectUtil;
|
3480
|
-
},
|
3481
4058
|
ZodObject,
|
3482
4059
|
ZodUnion,
|
3483
4060
|
ZodDiscriminatedUnion,
|
@@ -3502,6 +4079,7 @@ var require_types_cjs_development = __commonJS({
|
|
3502
4079
|
BRAND,
|
3503
4080
|
ZodBranded,
|
3504
4081
|
ZodPipeline,
|
4082
|
+
ZodReadonly,
|
3505
4083
|
custom,
|
3506
4084
|
Schema: ZodType,
|
3507
4085
|
ZodSchema: ZodType,
|
@@ -3554,35 +4132,133 @@ var require_types_cjs_development = __commonJS({
|
|
3554
4132
|
quotelessJson,
|
3555
4133
|
ZodError
|
3556
4134
|
});
|
3557
|
-
var
|
3558
|
-
var
|
3559
|
-
|
3560
|
-
|
4135
|
+
var currentSymbol = Symbol("current");
|
4136
|
+
var previousSymbol = Symbol("previous");
|
4137
|
+
var mergeOpenApi = /* @__PURE__ */ __name22((openapi, {
|
4138
|
+
ref: _ref,
|
4139
|
+
refType: _refType,
|
4140
|
+
param: _param,
|
4141
|
+
header: _header,
|
4142
|
+
...rest
|
4143
|
+
} = {}) => ({
|
4144
|
+
...rest,
|
4145
|
+
...openapi
|
4146
|
+
}), "mergeOpenApi");
|
4147
|
+
function extendZodWithOpenApi(zod) {
|
4148
|
+
if (typeof zod.ZodType.prototype.openapi !== "undefined") {
|
4149
|
+
return;
|
4150
|
+
}
|
4151
|
+
zod.ZodType.prototype.openapi = function(openapi) {
|
4152
|
+
const { zodOpenApi, ...rest } = this._def;
|
4153
|
+
const result = new this.constructor({
|
4154
|
+
...rest,
|
4155
|
+
zodOpenApi: {
|
4156
|
+
openapi: mergeOpenApi(
|
4157
|
+
openapi,
|
4158
|
+
zodOpenApi == null ? void 0 : zodOpenApi.openapi
|
4159
|
+
)
|
4160
|
+
}
|
4161
|
+
});
|
4162
|
+
result._def.zodOpenApi[currentSymbol] = result;
|
4163
|
+
if (zodOpenApi) {
|
4164
|
+
result._def.zodOpenApi[previousSymbol] = this;
|
4165
|
+
}
|
4166
|
+
return result;
|
4167
|
+
};
|
4168
|
+
const zodDescribe = zod.ZodType.prototype.describe;
|
4169
|
+
zod.ZodType.prototype.describe = function(...args) {
|
4170
|
+
const result = zodDescribe.apply(this, args);
|
4171
|
+
const def = result._def;
|
4172
|
+
if (def.zodOpenApi) {
|
4173
|
+
const cloned = { ...def.zodOpenApi };
|
4174
|
+
cloned.openapi = mergeOpenApi({ description: args[0] }, cloned.openapi);
|
4175
|
+
cloned[previousSymbol] = this;
|
4176
|
+
cloned[currentSymbol] = result;
|
4177
|
+
def.zodOpenApi = cloned;
|
4178
|
+
} else {
|
4179
|
+
def.zodOpenApi = {
|
4180
|
+
openapi: { description: args[0] },
|
4181
|
+
[currentSymbol]: result
|
4182
|
+
};
|
4183
|
+
}
|
4184
|
+
return result;
|
4185
|
+
};
|
4186
|
+
const zodObjectExtend = zod.ZodObject.prototype.extend;
|
4187
|
+
zod.ZodObject.prototype.extend = function(...args) {
|
4188
|
+
const extendResult = zodObjectExtend.apply(this, args);
|
4189
|
+
const zodOpenApi = extendResult._def.zodOpenApi;
|
4190
|
+
if (zodOpenApi) {
|
4191
|
+
const cloned = { ...zodOpenApi };
|
4192
|
+
cloned.openapi = mergeOpenApi({}, cloned.openapi);
|
4193
|
+
cloned[previousSymbol] = this;
|
4194
|
+
extendResult._def.zodOpenApi = cloned;
|
4195
|
+
} else {
|
4196
|
+
extendResult._def.zodOpenApi = {
|
4197
|
+
[previousSymbol]: this
|
4198
|
+
};
|
4199
|
+
}
|
4200
|
+
return extendResult;
|
4201
|
+
};
|
4202
|
+
const zodObjectOmit = zod.ZodObject.prototype.omit;
|
4203
|
+
zod.ZodObject.prototype.omit = function(...args) {
|
4204
|
+
const omitResult = zodObjectOmit.apply(this, args);
|
4205
|
+
const zodOpenApi = omitResult._def.zodOpenApi;
|
4206
|
+
if (zodOpenApi) {
|
4207
|
+
const cloned = { ...zodOpenApi };
|
4208
|
+
cloned.openapi = mergeOpenApi({}, cloned.openapi);
|
4209
|
+
delete cloned[previousSymbol];
|
4210
|
+
delete cloned[currentSymbol];
|
4211
|
+
omitResult._def.zodOpenApi = cloned;
|
4212
|
+
}
|
4213
|
+
return omitResult;
|
4214
|
+
};
|
4215
|
+
const zodObjectPick = zod.ZodObject.prototype.pick;
|
4216
|
+
zod.ZodObject.prototype.pick = function(...args) {
|
4217
|
+
const pickResult = zodObjectPick.apply(this, args);
|
4218
|
+
const zodOpenApi = pickResult._def.zodOpenApi;
|
4219
|
+
if (zodOpenApi) {
|
4220
|
+
const cloned = { ...zodOpenApi };
|
4221
|
+
cloned.openapi = mergeOpenApi({}, cloned.openapi);
|
4222
|
+
delete cloned[previousSymbol];
|
4223
|
+
delete cloned[currentSymbol];
|
4224
|
+
pickResult._def.zodOpenApi = cloned;
|
4225
|
+
}
|
4226
|
+
return pickResult;
|
4227
|
+
};
|
4228
|
+
}
|
4229
|
+
__name(extendZodWithOpenApi, "extendZodWithOpenApi");
|
4230
|
+
__name2(extendZodWithOpenApi, "extendZodWithOpenApi");
|
4231
|
+
__name22(extendZodWithOpenApi, "extendZodWithOpenApi");
|
4232
|
+
extendZodWithOpenApi(z);
|
4233
|
+
var ContextValidator = z.array(z.string().or(z.record(z.any())));
|
4234
|
+
var AchievementCriteriaValidator = z.object({
|
4235
|
+
type: z.string().optional(),
|
4236
|
+
narrative: z.string().optional()
|
3561
4237
|
});
|
3562
|
-
var ImageValidator =
|
3563
|
-
|
3564
|
-
id:
|
3565
|
-
type:
|
3566
|
-
caption:
|
4238
|
+
var ImageValidator = z.string().or(
|
4239
|
+
z.object({
|
4240
|
+
id: z.string(),
|
4241
|
+
type: z.string(),
|
4242
|
+
caption: z.string().optional()
|
3567
4243
|
})
|
3568
4244
|
);
|
3569
|
-
var GeoCoordinatesValidator =
|
3570
|
-
type:
|
3571
|
-
latitude:
|
3572
|
-
longitude:
|
4245
|
+
var GeoCoordinatesValidator = z.object({
|
4246
|
+
type: z.string().min(1).or(z.string().array().nonempty()),
|
4247
|
+
latitude: z.number(),
|
4248
|
+
longitude: z.number()
|
3573
4249
|
});
|
3574
|
-
var AddressValidator =
|
3575
|
-
type:
|
3576
|
-
addressCountry:
|
3577
|
-
addressCountryCode:
|
3578
|
-
addressRegion:
|
3579
|
-
addressLocality:
|
3580
|
-
streetAddress:
|
3581
|
-
postOfficeBoxNumber:
|
3582
|
-
postalCode:
|
4250
|
+
var AddressValidator = z.object({
|
4251
|
+
type: z.string().min(1).or(z.string().array().nonempty()),
|
4252
|
+
addressCountry: z.string().optional(),
|
4253
|
+
addressCountryCode: z.string().optional(),
|
4254
|
+
addressRegion: z.string().optional(),
|
4255
|
+
addressLocality: z.string().optional(),
|
4256
|
+
streetAddress: z.string().optional(),
|
4257
|
+
postOfficeBoxNumber: z.string().optional(),
|
4258
|
+
postalCode: z.string().optional(),
|
3583
4259
|
geo: GeoCoordinatesValidator.optional()
|
3584
4260
|
});
|
3585
|
-
var IdentifierTypeValidator =
|
4261
|
+
var IdentifierTypeValidator = z.enum([
|
3586
4262
|
"sourcedId",
|
3587
4263
|
"systemId",
|
3588
4264
|
"productId",
|
@@ -3601,140 +4277,140 @@ var require_types_cjs_development = __commonJS({
|
|
3601
4277
|
"ltiPlatformId",
|
3602
4278
|
"ltiUserId",
|
3603
4279
|
"identifier"
|
3604
|
-
]).or(
|
3605
|
-
var IdentifierEntryValidator =
|
3606
|
-
type:
|
3607
|
-
identifier:
|
4280
|
+
]).or(z.string());
|
4281
|
+
var IdentifierEntryValidator = z.object({
|
4282
|
+
type: z.string().min(1).or(z.string().array().nonempty()),
|
4283
|
+
identifier: z.string(),
|
3608
4284
|
identifierType: IdentifierTypeValidator
|
3609
4285
|
});
|
3610
|
-
var ProfileValidator =
|
3611
|
-
|
3612
|
-
id:
|
3613
|
-
type:
|
3614
|
-
name:
|
3615
|
-
url:
|
3616
|
-
phone:
|
3617
|
-
description:
|
3618
|
-
endorsement:
|
4286
|
+
var ProfileValidator = z.string().or(
|
4287
|
+
z.object({
|
4288
|
+
id: z.string().optional(),
|
4289
|
+
type: z.string().or(z.string().array().nonempty().optional()),
|
4290
|
+
name: z.string().optional(),
|
4291
|
+
url: z.string().optional(),
|
4292
|
+
phone: z.string().optional(),
|
4293
|
+
description: z.string().optional(),
|
4294
|
+
endorsement: z.any().array().optional(),
|
3619
4295
|
image: ImageValidator.optional(),
|
3620
|
-
email:
|
4296
|
+
email: z.string().email().optional(),
|
3621
4297
|
address: AddressValidator.optional(),
|
3622
4298
|
otherIdentifier: IdentifierEntryValidator.array().optional(),
|
3623
|
-
official:
|
3624
|
-
parentOrg:
|
3625
|
-
familyName:
|
3626
|
-
givenName:
|
3627
|
-
additionalName:
|
3628
|
-
patronymicName:
|
3629
|
-
honorificPrefix:
|
3630
|
-
honorificSuffix:
|
3631
|
-
familyNamePrefix:
|
3632
|
-
dateOfBirth:
|
3633
|
-
}).catchall(
|
4299
|
+
official: z.string().optional(),
|
4300
|
+
parentOrg: z.any().optional(),
|
4301
|
+
familyName: z.string().optional(),
|
4302
|
+
givenName: z.string().optional(),
|
4303
|
+
additionalName: z.string().optional(),
|
4304
|
+
patronymicName: z.string().optional(),
|
4305
|
+
honorificPrefix: z.string().optional(),
|
4306
|
+
honorificSuffix: z.string().optional(),
|
4307
|
+
familyNamePrefix: z.string().optional(),
|
4308
|
+
dateOfBirth: z.string().optional()
|
4309
|
+
}).catchall(z.any())
|
3634
4310
|
);
|
3635
|
-
var CredentialSubjectValidator =
|
3636
|
-
var CredentialStatusValidator =
|
3637
|
-
var CredentialSchemaValidator =
|
3638
|
-
var RefreshServiceValidator =
|
3639
|
-
var TermsOfUseValidator =
|
3640
|
-
var VC2EvidenceValidator =
|
3641
|
-
var UnsignedVCValidator =
|
4311
|
+
var CredentialSubjectValidator = z.object({ id: z.string().optional() }).catchall(z.any());
|
4312
|
+
var CredentialStatusValidator = z.object({ type: z.string(), id: z.string() }).catchall(z.any());
|
4313
|
+
var CredentialSchemaValidator = z.object({ id: z.string(), type: z.string() }).catchall(z.any());
|
4314
|
+
var RefreshServiceValidator = z.object({ id: z.string().optional(), type: z.string() }).catchall(z.any());
|
4315
|
+
var TermsOfUseValidator = z.object({ type: z.string(), id: z.string().optional() }).catchall(z.any());
|
4316
|
+
var VC2EvidenceValidator = z.object({ type: z.string().or(z.string().array().nonempty()), id: z.string().optional() }).catchall(z.any());
|
4317
|
+
var UnsignedVCValidator = z.object({
|
3642
4318
|
"@context": ContextValidator,
|
3643
|
-
id:
|
3644
|
-
type:
|
4319
|
+
id: z.string().optional(),
|
4320
|
+
type: z.string().array().nonempty(),
|
3645
4321
|
issuer: ProfileValidator,
|
3646
4322
|
credentialSubject: CredentialSubjectValidator.or(CredentialSubjectValidator.array()),
|
3647
4323
|
refreshService: RefreshServiceValidator.or(RefreshServiceValidator.array()).optional(),
|
3648
4324
|
credentialSchema: CredentialSchemaValidator.or(
|
3649
4325
|
CredentialSchemaValidator.array()
|
3650
4326
|
).optional(),
|
3651
|
-
issuanceDate:
|
3652
|
-
expirationDate:
|
4327
|
+
issuanceDate: z.string().optional(),
|
4328
|
+
expirationDate: z.string().optional(),
|
3653
4329
|
credentialStatus: CredentialStatusValidator.or(
|
3654
4330
|
CredentialStatusValidator.array()
|
3655
4331
|
).optional(),
|
3656
|
-
name:
|
3657
|
-
description:
|
3658
|
-
validFrom:
|
3659
|
-
validUntil:
|
4332
|
+
name: z.string().optional(),
|
4333
|
+
description: z.string().optional(),
|
4334
|
+
validFrom: z.string().optional(),
|
4335
|
+
validUntil: z.string().optional(),
|
3660
4336
|
status: CredentialStatusValidator.or(CredentialStatusValidator.array()).optional(),
|
3661
4337
|
termsOfUse: TermsOfUseValidator.or(TermsOfUseValidator.array()).optional(),
|
3662
4338
|
evidence: VC2EvidenceValidator.or(VC2EvidenceValidator.array()).optional()
|
3663
|
-
}).catchall(
|
3664
|
-
var ProofValidator =
|
3665
|
-
type:
|
3666
|
-
created:
|
3667
|
-
challenge:
|
3668
|
-
domain:
|
3669
|
-
nonce:
|
3670
|
-
proofPurpose:
|
3671
|
-
verificationMethod:
|
3672
|
-
jws:
|
3673
|
-
}).catchall(
|
4339
|
+
}).catchall(z.any());
|
4340
|
+
var ProofValidator = z.object({
|
4341
|
+
type: z.string(),
|
4342
|
+
created: z.string(),
|
4343
|
+
challenge: z.string().optional(),
|
4344
|
+
domain: z.string().optional(),
|
4345
|
+
nonce: z.string().optional(),
|
4346
|
+
proofPurpose: z.string(),
|
4347
|
+
verificationMethod: z.string(),
|
4348
|
+
jws: z.string().optional()
|
4349
|
+
}).catchall(z.any());
|
3674
4350
|
var VCValidator = UnsignedVCValidator.extend({
|
3675
4351
|
proof: ProofValidator.or(ProofValidator.array())
|
3676
4352
|
});
|
3677
|
-
var UnsignedVPValidator =
|
4353
|
+
var UnsignedVPValidator = z.object({
|
3678
4354
|
"@context": ContextValidator,
|
3679
|
-
id:
|
3680
|
-
type:
|
4355
|
+
id: z.string().optional(),
|
4356
|
+
type: z.string().or(z.string().array().nonempty()),
|
3681
4357
|
verifiableCredential: VCValidator.or(VCValidator.array()).optional(),
|
3682
|
-
holder:
|
3683
|
-
}).catchall(
|
4358
|
+
holder: z.string().optional()
|
4359
|
+
}).catchall(z.any());
|
3684
4360
|
var VPValidator = UnsignedVPValidator.extend({
|
3685
4361
|
proof: ProofValidator.or(ProofValidator.array())
|
3686
4362
|
});
|
3687
|
-
var JWKValidator =
|
3688
|
-
kty:
|
3689
|
-
crv:
|
3690
|
-
x:
|
3691
|
-
y:
|
3692
|
-
n:
|
3693
|
-
d:
|
4363
|
+
var JWKValidator = z.object({
|
4364
|
+
kty: z.string(),
|
4365
|
+
crv: z.string(),
|
4366
|
+
x: z.string(),
|
4367
|
+
y: z.string().optional(),
|
4368
|
+
n: z.string().optional(),
|
4369
|
+
d: z.string().optional()
|
3694
4370
|
});
|
3695
|
-
var JWKWithPrivateKeyValidator = JWKValidator.omit({ d: true }).extend({ d:
|
3696
|
-
var JWERecipientHeaderValidator =
|
3697
|
-
alg:
|
3698
|
-
iv:
|
3699
|
-
tag:
|
4371
|
+
var JWKWithPrivateKeyValidator = JWKValidator.omit({ d: true }).extend({ d: z.string() });
|
4372
|
+
var JWERecipientHeaderValidator = z.object({
|
4373
|
+
alg: z.string(),
|
4374
|
+
iv: z.string(),
|
4375
|
+
tag: z.string(),
|
3700
4376
|
epk: JWKValidator.partial().optional(),
|
3701
|
-
kid:
|
3702
|
-
apv:
|
3703
|
-
apu:
|
4377
|
+
kid: z.string().optional(),
|
4378
|
+
apv: z.string().optional(),
|
4379
|
+
apu: z.string().optional()
|
3704
4380
|
});
|
3705
|
-
var JWERecipientValidator =
|
4381
|
+
var JWERecipientValidator = z.object({
|
3706
4382
|
header: JWERecipientHeaderValidator,
|
3707
|
-
encrypted_key:
|
4383
|
+
encrypted_key: z.string()
|
3708
4384
|
});
|
3709
|
-
var JWEValidator2 =
|
3710
|
-
protected:
|
3711
|
-
iv:
|
3712
|
-
ciphertext:
|
3713
|
-
tag:
|
3714
|
-
aad:
|
4385
|
+
var JWEValidator2 = z.object({
|
4386
|
+
protected: z.string(),
|
4387
|
+
iv: z.string(),
|
4388
|
+
ciphertext: z.string(),
|
4389
|
+
tag: z.string(),
|
4390
|
+
aad: z.string().optional(),
|
3715
4391
|
recipients: JWERecipientValidator.array().optional()
|
3716
4392
|
});
|
3717
|
-
var VerificationMethodValidator =
|
3718
|
-
|
4393
|
+
var VerificationMethodValidator = z.string().or(
|
4394
|
+
z.object({
|
3719
4395
|
"@context": ContextValidator.optional(),
|
3720
|
-
id:
|
3721
|
-
type:
|
3722
|
-
controller:
|
4396
|
+
id: z.string(),
|
4397
|
+
type: z.string(),
|
4398
|
+
controller: z.string(),
|
3723
4399
|
publicKeyJwk: JWKValidator.optional(),
|
3724
|
-
publicKeyBase58:
|
3725
|
-
blockChainAccountId:
|
3726
|
-
}).catchall(
|
4400
|
+
publicKeyBase58: z.string().optional(),
|
4401
|
+
blockChainAccountId: z.string().optional()
|
4402
|
+
}).catchall(z.any())
|
3727
4403
|
);
|
3728
|
-
var ServiceValidator =
|
3729
|
-
id:
|
3730
|
-
type:
|
3731
|
-
serviceEndpoint:
|
3732
|
-
}).catchall(
|
3733
|
-
var DidDocumentValidator =
|
4404
|
+
var ServiceValidator = z.object({
|
4405
|
+
id: z.string(),
|
4406
|
+
type: z.string().or(z.string().array().nonempty()),
|
4407
|
+
serviceEndpoint: z.any().or(z.any().array().nonempty())
|
4408
|
+
}).catchall(z.any());
|
4409
|
+
var DidDocumentValidator = z.object({
|
3734
4410
|
"@context": ContextValidator,
|
3735
|
-
id:
|
3736
|
-
alsoKnownAs:
|
3737
|
-
controller:
|
4411
|
+
id: z.string(),
|
4412
|
+
alsoKnownAs: z.string().optional(),
|
4413
|
+
controller: z.string().or(z.string().array().nonempty()).optional(),
|
3738
4414
|
verificationMethod: VerificationMethodValidator.array().optional(),
|
3739
4415
|
authentication: VerificationMethodValidator.array().optional(),
|
3740
4416
|
assertionMethod: VerificationMethodValidator.array().optional(),
|
@@ -3744,8 +4420,8 @@ var require_types_cjs_development = __commonJS({
|
|
3744
4420
|
publicKey: VerificationMethodValidator.array().optional(),
|
3745
4421
|
service: ServiceValidator.array().optional(),
|
3746
4422
|
proof: ProofValidator.or(ProofValidator.array()).optional()
|
3747
|
-
}).catchall(
|
3748
|
-
var AlignmentTargetTypeValidator =
|
4423
|
+
}).catchall(z.any());
|
4424
|
+
var AlignmentTargetTypeValidator = z.enum([
|
3749
4425
|
"ceasn:Competency",
|
3750
4426
|
"ceterms:Credential",
|
3751
4427
|
"CFItem",
|
@@ -3753,17 +4429,17 @@ var require_types_cjs_development = __commonJS({
|
|
3753
4429
|
"CFRubricCriterion",
|
3754
4430
|
"CFRubricCriterionLevel",
|
3755
4431
|
"CTDL"
|
3756
|
-
]).or(
|
3757
|
-
var AlignmentValidator =
|
3758
|
-
type:
|
3759
|
-
targetCode:
|
3760
|
-
targetDescription:
|
3761
|
-
targetName:
|
3762
|
-
targetFramework:
|
4432
|
+
]).or(z.string());
|
4433
|
+
var AlignmentValidator = z.object({
|
4434
|
+
type: z.string().array().nonempty(),
|
4435
|
+
targetCode: z.string().optional(),
|
4436
|
+
targetDescription: z.string().optional(),
|
4437
|
+
targetName: z.string(),
|
4438
|
+
targetFramework: z.string().optional(),
|
3763
4439
|
targetType: AlignmentTargetTypeValidator.optional(),
|
3764
|
-
targetUrl:
|
4440
|
+
targetUrl: z.string()
|
3765
4441
|
});
|
3766
|
-
var KnownAchievementTypeValidator =
|
4442
|
+
var KnownAchievementTypeValidator = z.enum([
|
3767
4443
|
"Achievement",
|
3768
4444
|
"ApprenticeshipCertificate",
|
3769
4445
|
"Assessment",
|
@@ -3796,23 +4472,23 @@ var require_types_cjs_development = __commonJS({
|
|
3796
4472
|
"ResearchDoctorate",
|
3797
4473
|
"SecondarySchoolDiploma"
|
3798
4474
|
]);
|
3799
|
-
var AchievementTypeValidator = KnownAchievementTypeValidator.or(
|
3800
|
-
var CriteriaValidator =
|
3801
|
-
var EndorsementSubjectValidator =
|
3802
|
-
id:
|
3803
|
-
type:
|
3804
|
-
endorsementComment:
|
4475
|
+
var AchievementTypeValidator = KnownAchievementTypeValidator.or(z.string());
|
4476
|
+
var CriteriaValidator = z.object({ id: z.string().optional(), narrative: z.string().optional() }).catchall(z.any());
|
4477
|
+
var EndorsementSubjectValidator = z.object({
|
4478
|
+
id: z.string(),
|
4479
|
+
type: z.string().array().nonempty(),
|
4480
|
+
endorsementComment: z.string().optional()
|
3805
4481
|
});
|
3806
4482
|
var EndorsementCredentialValidator = UnsignedVCValidator.extend({
|
3807
4483
|
credentialSubject: EndorsementSubjectValidator,
|
3808
4484
|
proof: ProofValidator.or(ProofValidator.array()).optional()
|
3809
4485
|
});
|
3810
|
-
var RelatedValidator =
|
3811
|
-
id:
|
3812
|
-
"@language":
|
3813
|
-
version:
|
4486
|
+
var RelatedValidator = z.object({
|
4487
|
+
id: z.string(),
|
4488
|
+
"@language": z.string().optional(),
|
4489
|
+
version: z.string().optional()
|
3814
4490
|
});
|
3815
|
-
var ResultTypeValidator =
|
4491
|
+
var ResultTypeValidator = z.enum([
|
3816
4492
|
"GradePointAverage",
|
3817
4493
|
"LetterGrade",
|
3818
4494
|
"Percent",
|
@@ -3825,59 +4501,59 @@ var require_types_cjs_development = __commonJS({
|
|
3825
4501
|
"RubricScore",
|
3826
4502
|
"ScaledScore",
|
3827
4503
|
"Status"
|
3828
|
-
]).or(
|
3829
|
-
var RubricCriterionValidator =
|
3830
|
-
id:
|
3831
|
-
type:
|
4504
|
+
]).or(z.string());
|
4505
|
+
var RubricCriterionValidator = z.object({
|
4506
|
+
id: z.string(),
|
4507
|
+
type: z.string().array().nonempty(),
|
3832
4508
|
alignment: AlignmentValidator.array().optional(),
|
3833
|
-
description:
|
3834
|
-
level:
|
3835
|
-
name:
|
3836
|
-
points:
|
3837
|
-
}).catchall(
|
3838
|
-
var ResultDescriptionValidator =
|
3839
|
-
id:
|
3840
|
-
type:
|
4509
|
+
description: z.string().optional(),
|
4510
|
+
level: z.string().optional(),
|
4511
|
+
name: z.string(),
|
4512
|
+
points: z.string().optional()
|
4513
|
+
}).catchall(z.any());
|
4514
|
+
var ResultDescriptionValidator = z.object({
|
4515
|
+
id: z.string(),
|
4516
|
+
type: z.string().array().nonempty(),
|
3841
4517
|
alignment: AlignmentValidator.array().optional(),
|
3842
|
-
allowedValue:
|
3843
|
-
name:
|
3844
|
-
requiredLevel:
|
3845
|
-
requiredValue:
|
4518
|
+
allowedValue: z.string().array().optional(),
|
4519
|
+
name: z.string(),
|
4520
|
+
requiredLevel: z.string().optional(),
|
4521
|
+
requiredValue: z.string().optional(),
|
3846
4522
|
resultType: ResultTypeValidator,
|
3847
4523
|
rubricCriterionLevel: RubricCriterionValidator.array().optional(),
|
3848
|
-
valueMax:
|
3849
|
-
valueMin:
|
3850
|
-
}).catchall(
|
3851
|
-
var AchievementValidator =
|
3852
|
-
id:
|
3853
|
-
type:
|
4524
|
+
valueMax: z.string().optional(),
|
4525
|
+
valueMin: z.string().optional()
|
4526
|
+
}).catchall(z.any());
|
4527
|
+
var AchievementValidator = z.object({
|
4528
|
+
id: z.string().optional(),
|
4529
|
+
type: z.string().array().nonempty(),
|
3854
4530
|
alignment: AlignmentValidator.array().optional(),
|
3855
4531
|
achievementType: AchievementTypeValidator.optional(),
|
3856
4532
|
creator: ProfileValidator.optional(),
|
3857
|
-
creditsAvailable:
|
4533
|
+
creditsAvailable: z.number().optional(),
|
3858
4534
|
criteria: CriteriaValidator,
|
3859
|
-
description:
|
4535
|
+
description: z.string(),
|
3860
4536
|
endorsement: EndorsementCredentialValidator.array().optional(),
|
3861
|
-
fieldOfStudy:
|
3862
|
-
humanCode:
|
4537
|
+
fieldOfStudy: z.string().optional(),
|
4538
|
+
humanCode: z.string().optional(),
|
3863
4539
|
image: ImageValidator.optional(),
|
3864
|
-
"@language":
|
3865
|
-
name:
|
4540
|
+
"@language": z.string().optional(),
|
4541
|
+
name: z.string(),
|
3866
4542
|
otherIdentifier: IdentifierEntryValidator.array().optional(),
|
3867
4543
|
related: RelatedValidator.array().optional(),
|
3868
4544
|
resultDescription: ResultDescriptionValidator.array().optional(),
|
3869
|
-
specialization:
|
3870
|
-
tag:
|
3871
|
-
version:
|
3872
|
-
}).catchall(
|
3873
|
-
var IdentityObjectValidator =
|
3874
|
-
type:
|
3875
|
-
hashed:
|
3876
|
-
identityHash:
|
3877
|
-
identityType:
|
3878
|
-
salt:
|
4545
|
+
specialization: z.string().optional(),
|
4546
|
+
tag: z.string().array().optional(),
|
4547
|
+
version: z.string().optional()
|
4548
|
+
}).catchall(z.any());
|
4549
|
+
var IdentityObjectValidator = z.object({
|
4550
|
+
type: z.string(),
|
4551
|
+
hashed: z.boolean(),
|
4552
|
+
identityHash: z.string(),
|
4553
|
+
identityType: z.string(),
|
4554
|
+
salt: z.string().optional()
|
3879
4555
|
});
|
3880
|
-
var ResultStatusTypeValidator =
|
4556
|
+
var ResultStatusTypeValidator = z.enum([
|
3881
4557
|
"Completed",
|
3882
4558
|
"Enrolled",
|
3883
4559
|
"Failed",
|
@@ -3885,42 +4561,42 @@ var require_types_cjs_development = __commonJS({
|
|
3885
4561
|
"OnHold",
|
3886
4562
|
"Withdrew"
|
3887
4563
|
]);
|
3888
|
-
var ResultValidator =
|
3889
|
-
type:
|
3890
|
-
achievedLevel:
|
4564
|
+
var ResultValidator = z.object({
|
4565
|
+
type: z.string().array().nonempty(),
|
4566
|
+
achievedLevel: z.string().optional(),
|
3891
4567
|
alignment: AlignmentValidator.array().optional(),
|
3892
|
-
resultDescription:
|
4568
|
+
resultDescription: z.string().optional(),
|
3893
4569
|
status: ResultStatusTypeValidator.optional(),
|
3894
|
-
value:
|
3895
|
-
}).catchall(
|
3896
|
-
var AchievementSubjectValidator =
|
3897
|
-
id:
|
3898
|
-
type:
|
3899
|
-
activityEndDate:
|
3900
|
-
activityStartDate:
|
3901
|
-
creditsEarned:
|
4570
|
+
value: z.string().optional()
|
4571
|
+
}).catchall(z.any());
|
4572
|
+
var AchievementSubjectValidator = z.object({
|
4573
|
+
id: z.string().optional(),
|
4574
|
+
type: z.string().array().nonempty(),
|
4575
|
+
activityEndDate: z.string().optional(),
|
4576
|
+
activityStartDate: z.string().optional(),
|
4577
|
+
creditsEarned: z.number().optional(),
|
3902
4578
|
achievement: AchievementValidator.optional(),
|
3903
4579
|
identifier: IdentityObjectValidator.array().optional(),
|
3904
4580
|
image: ImageValidator.optional(),
|
3905
|
-
licenseNumber:
|
3906
|
-
narrative:
|
4581
|
+
licenseNumber: z.string().optional(),
|
4582
|
+
narrative: z.string().optional(),
|
3907
4583
|
result: ResultValidator.array().optional(),
|
3908
|
-
role:
|
4584
|
+
role: z.string().optional(),
|
3909
4585
|
source: ProfileValidator.optional(),
|
3910
|
-
term:
|
3911
|
-
}).catchall(
|
3912
|
-
var EvidenceValidator =
|
3913
|
-
id:
|
3914
|
-
type:
|
3915
|
-
narrative:
|
3916
|
-
name:
|
3917
|
-
description:
|
3918
|
-
genre:
|
3919
|
-
audience:
|
3920
|
-
}).catchall(
|
4586
|
+
term: z.string().optional()
|
4587
|
+
}).catchall(z.any());
|
4588
|
+
var EvidenceValidator = z.object({
|
4589
|
+
id: z.string().optional(),
|
4590
|
+
type: z.string().or(z.string().array().nonempty()),
|
4591
|
+
narrative: z.string().optional(),
|
4592
|
+
name: z.string().optional(),
|
4593
|
+
description: z.string().optional(),
|
4594
|
+
genre: z.string().optional(),
|
4595
|
+
audience: z.string().optional()
|
4596
|
+
}).catchall(z.any());
|
3921
4597
|
var UnsignedAchievementCredentialValidator = UnsignedVCValidator.extend({
|
3922
|
-
name:
|
3923
|
-
description:
|
4598
|
+
name: z.string().optional(),
|
4599
|
+
description: z.string().optional(),
|
3924
4600
|
image: ImageValidator.optional(),
|
3925
4601
|
credentialSubject: AchievementSubjectValidator.or(
|
3926
4602
|
AchievementSubjectValidator.array()
|
@@ -3931,42 +4607,42 @@ var require_types_cjs_development = __commonJS({
|
|
3931
4607
|
var AchievementCredentialValidator = UnsignedAchievementCredentialValidator.extend({
|
3932
4608
|
proof: ProofValidator.or(ProofValidator.array())
|
3933
4609
|
});
|
3934
|
-
var VerificationCheckValidator =
|
3935
|
-
checks:
|
3936
|
-
warnings:
|
3937
|
-
errors:
|
4610
|
+
var VerificationCheckValidator = z.object({
|
4611
|
+
checks: z.string().array(),
|
4612
|
+
warnings: z.string().array(),
|
4613
|
+
errors: z.string().array()
|
3938
4614
|
});
|
3939
|
-
var VerificationStatusValidator =
|
4615
|
+
var VerificationStatusValidator = z.enum(["Success", "Failed", "Error"]);
|
3940
4616
|
var VerificationStatusEnum = VerificationStatusValidator.enum;
|
3941
|
-
var VerificationItemValidator =
|
3942
|
-
check:
|
4617
|
+
var VerificationItemValidator = z.object({
|
4618
|
+
check: z.string(),
|
3943
4619
|
status: VerificationStatusValidator,
|
3944
|
-
message:
|
3945
|
-
details:
|
4620
|
+
message: z.string().optional(),
|
4621
|
+
details: z.string().optional()
|
3946
4622
|
});
|
3947
|
-
var CredentialInfoValidator =
|
3948
|
-
title:
|
3949
|
-
createdAt:
|
4623
|
+
var CredentialInfoValidator = z.object({
|
4624
|
+
title: z.string().optional(),
|
4625
|
+
createdAt: z.string().optional(),
|
3950
4626
|
issuer: ProfileValidator.optional(),
|
3951
4627
|
issuee: ProfileValidator.optional(),
|
3952
4628
|
credentialSubject: CredentialSubjectValidator.optional()
|
3953
4629
|
});
|
3954
|
-
var CredentialRecordValidator =
|
3955
|
-
var PaginationOptionsValidator =
|
3956
|
-
limit:
|
3957
|
-
cursor:
|
3958
|
-
sort:
|
4630
|
+
var CredentialRecordValidator = z.object({ id: z.string(), uri: z.string() }).catchall(z.any());
|
4631
|
+
var PaginationOptionsValidator = z.object({
|
4632
|
+
limit: z.number(),
|
4633
|
+
cursor: z.string().optional(),
|
4634
|
+
sort: z.string().optional()
|
3959
4635
|
});
|
3960
|
-
var PaginationResponseValidator =
|
3961
|
-
cursor:
|
3962
|
-
hasMore:
|
4636
|
+
var PaginationResponseValidator = z.object({
|
4637
|
+
cursor: z.string().optional(),
|
4638
|
+
hasMore: z.boolean()
|
3963
4639
|
});
|
3964
|
-
var EncryptedRecordValidator =
|
4640
|
+
var EncryptedRecordValidator = z.object({ encryptedRecord: JWEValidator2, fields: z.string().array() }).catchall(z.any());
|
3965
4641
|
var PaginatedEncryptedRecordsValidator = PaginationResponseValidator.extend({
|
3966
4642
|
records: EncryptedRecordValidator.array()
|
3967
4643
|
});
|
3968
4644
|
var EncryptedCredentialRecordValidator = EncryptedRecordValidator.extend({
|
3969
|
-
id:
|
4645
|
+
id: z.string()
|
3970
4646
|
});
|
3971
4647
|
var PaginatedEncryptedCredentialRecordsValidator = PaginationResponseValidator.extend({
|
3972
4648
|
records: EncryptedCredentialRecordValidator.array()
|
@@ -3977,8 +4653,8 @@ var require_types_cjs_development = __commonJS({
|
|
3977
4653
|
throw new Error("Invalid RegExp string format");
|
3978
4654
|
return { pattern: match[1], flags: match[2] };
|
3979
4655
|
}, "parseRegexString");
|
3980
|
-
var RegExpValidator =
|
3981
|
-
|
4656
|
+
var RegExpValidator = z.instanceof(RegExp).or(
|
4657
|
+
z.string().refine(
|
3982
4658
|
(str) => {
|
3983
4659
|
try {
|
3984
4660
|
parseRegexString(str);
|
@@ -3999,71 +4675,71 @@ var require_types_cjs_development = __commonJS({
|
|
3999
4675
|
}
|
4000
4676
|
})
|
4001
4677
|
);
|
4002
|
-
var StringQuery =
|
4003
|
-
var LCNProfileDisplayValidator =
|
4004
|
-
backgroundColor:
|
4005
|
-
backgroundImage:
|
4006
|
-
fadeBackgroundImage:
|
4007
|
-
repeatBackgroundImage:
|
4008
|
-
fontColor:
|
4009
|
-
accentColor:
|
4010
|
-
accentFontColor:
|
4011
|
-
idBackgroundImage:
|
4012
|
-
fadeIdBackgroundImage:
|
4013
|
-
idBackgroundColor:
|
4014
|
-
repeatIdBackgroundImage:
|
4678
|
+
var StringQuery = z.string().or(z.object({ $in: z.string().array() })).or(z.object({ $regex: RegExpValidator }));
|
4679
|
+
var LCNProfileDisplayValidator = z.object({
|
4680
|
+
backgroundColor: z.string().optional(),
|
4681
|
+
backgroundImage: z.string().optional(),
|
4682
|
+
fadeBackgroundImage: z.boolean().optional(),
|
4683
|
+
repeatBackgroundImage: z.boolean().optional(),
|
4684
|
+
fontColor: z.string().optional(),
|
4685
|
+
accentColor: z.string().optional(),
|
4686
|
+
accentFontColor: z.string().optional(),
|
4687
|
+
idBackgroundImage: z.string().optional(),
|
4688
|
+
fadeIdBackgroundImage: z.boolean().optional(),
|
4689
|
+
idBackgroundColor: z.string().optional(),
|
4690
|
+
repeatIdBackgroundImage: z.boolean().optional()
|
4015
4691
|
});
|
4016
|
-
var LCNProfileValidator =
|
4017
|
-
profileId:
|
4018
|
-
displayName:
|
4019
|
-
shortBio:
|
4020
|
-
bio:
|
4021
|
-
did:
|
4022
|
-
isPrivate:
|
4023
|
-
email:
|
4024
|
-
image:
|
4025
|
-
heroImage:
|
4026
|
-
websiteLink:
|
4027
|
-
isServiceProfile:
|
4028
|
-
type:
|
4029
|
-
notificationsWebhook:
|
4692
|
+
var LCNProfileValidator = z.object({
|
4693
|
+
profileId: z.string().min(3).max(40).describe("Unique, URL-safe identifier for the profile."),
|
4694
|
+
displayName: z.string().default("").describe("Human-readable display name for the profile."),
|
4695
|
+
shortBio: z.string().default("").describe("Short bio for the profile."),
|
4696
|
+
bio: z.string().default("").describe("Longer bio for the profile."),
|
4697
|
+
did: z.string().describe("Decentralized Identifier for the profile. (auto-assigned)"),
|
4698
|
+
isPrivate: z.boolean().optional().describe("Whether the profile is private or not and shows up in search results."),
|
4699
|
+
email: z.string().optional().describe("Contact email address for the profile."),
|
4700
|
+
image: z.string().optional().describe("Profile image URL for the profile."),
|
4701
|
+
heroImage: z.string().optional().describe("Hero image URL for the profile."),
|
4702
|
+
websiteLink: z.string().optional().describe("Website link for the profile."),
|
4703
|
+
isServiceProfile: z.boolean().default(false).optional().describe("Whether the profile is a service profile or not."),
|
4704
|
+
type: z.string().optional().describe('Profile type: e.g. "person", "organization", "service".'),
|
4705
|
+
notificationsWebhook: z.string().url().startsWith("http").optional().describe("URL to send notifications to."),
|
4030
4706
|
display: LCNProfileDisplayValidator.optional().describe("Display settings for the profile."),
|
4031
|
-
role:
|
4032
|
-
dob:
|
4707
|
+
role: z.string().default("").optional().describe('Role of the profile: e.g. "teacher", "student".'),
|
4708
|
+
dob: z.string().default("").optional().describe('Date of birth of the profile: e.g. "1990-01-01".')
|
4033
4709
|
});
|
4034
|
-
var LCNProfileQueryValidator =
|
4710
|
+
var LCNProfileQueryValidator = z.object({
|
4035
4711
|
profileId: StringQuery,
|
4036
4712
|
displayName: StringQuery,
|
4037
4713
|
shortBio: StringQuery,
|
4038
4714
|
bio: StringQuery,
|
4039
4715
|
email: StringQuery,
|
4040
4716
|
websiteLink: StringQuery,
|
4041
|
-
isServiceProfile:
|
4717
|
+
isServiceProfile: z.boolean(),
|
4042
4718
|
type: StringQuery
|
4043
4719
|
}).partial();
|
4044
4720
|
var PaginatedLCNProfilesValidator = PaginationResponseValidator.extend({
|
4045
4721
|
records: LCNProfileValidator.array()
|
4046
4722
|
});
|
4047
|
-
var LCNProfileConnectionStatusEnum =
|
4723
|
+
var LCNProfileConnectionStatusEnum = z.enum([
|
4048
4724
|
"CONNECTED",
|
4049
4725
|
"PENDING_REQUEST_SENT",
|
4050
4726
|
"PENDING_REQUEST_RECEIVED",
|
4051
4727
|
"NOT_CONNECTED"
|
4052
4728
|
]);
|
4053
|
-
var LCNProfileManagerValidator =
|
4054
|
-
id:
|
4055
|
-
created:
|
4056
|
-
displayName:
|
4057
|
-
shortBio:
|
4058
|
-
bio:
|
4059
|
-
email:
|
4060
|
-
image:
|
4061
|
-
heroImage:
|
4729
|
+
var LCNProfileManagerValidator = z.object({
|
4730
|
+
id: z.string(),
|
4731
|
+
created: z.string(),
|
4732
|
+
displayName: z.string().default("").optional(),
|
4733
|
+
shortBio: z.string().default("").optional(),
|
4734
|
+
bio: z.string().default("").optional(),
|
4735
|
+
email: z.string().optional(),
|
4736
|
+
image: z.string().optional(),
|
4737
|
+
heroImage: z.string().optional()
|
4062
4738
|
});
|
4063
4739
|
var PaginatedLCNProfileManagersValidator = PaginationResponseValidator.extend({
|
4064
|
-
records: LCNProfileManagerValidator.extend({ did:
|
4740
|
+
records: LCNProfileManagerValidator.extend({ did: z.string() }).array()
|
4065
4741
|
});
|
4066
|
-
var LCNProfileManagerQueryValidator =
|
4742
|
+
var LCNProfileManagerQueryValidator = z.object({
|
4067
4743
|
id: StringQuery,
|
4068
4744
|
displayName: StringQuery,
|
4069
4745
|
shortBio: StringQuery,
|
@@ -4071,296 +4747,296 @@ var require_types_cjs_development = __commonJS({
|
|
4071
4747
|
email: StringQuery
|
4072
4748
|
}).partial();
|
4073
4749
|
var PaginatedLCNProfilesAndManagersValidator = PaginationResponseValidator.extend({
|
4074
|
-
records:
|
4750
|
+
records: z.object({
|
4075
4751
|
profile: LCNProfileValidator,
|
4076
|
-
manager: LCNProfileManagerValidator.extend({ did:
|
4752
|
+
manager: LCNProfileManagerValidator.extend({ did: z.string() }).optional()
|
4077
4753
|
}).array()
|
4078
4754
|
});
|
4079
|
-
var SentCredentialInfoValidator =
|
4080
|
-
uri:
|
4081
|
-
to:
|
4082
|
-
from:
|
4083
|
-
sent:
|
4084
|
-
received:
|
4755
|
+
var SentCredentialInfoValidator = z.object({
|
4756
|
+
uri: z.string(),
|
4757
|
+
to: z.string(),
|
4758
|
+
from: z.string(),
|
4759
|
+
sent: z.string().datetime(),
|
4760
|
+
received: z.string().datetime().optional()
|
4085
4761
|
});
|
4086
|
-
var BoostPermissionsValidator =
|
4087
|
-
role:
|
4088
|
-
canEdit:
|
4089
|
-
canIssue:
|
4090
|
-
canRevoke:
|
4091
|
-
canManagePermissions:
|
4092
|
-
canIssueChildren:
|
4093
|
-
canCreateChildren:
|
4094
|
-
canEditChildren:
|
4095
|
-
canRevokeChildren:
|
4096
|
-
canManageChildrenPermissions:
|
4097
|
-
canManageChildrenProfiles:
|
4098
|
-
canViewAnalytics:
|
4762
|
+
var BoostPermissionsValidator = z.object({
|
4763
|
+
role: z.string(),
|
4764
|
+
canEdit: z.boolean(),
|
4765
|
+
canIssue: z.boolean(),
|
4766
|
+
canRevoke: z.boolean(),
|
4767
|
+
canManagePermissions: z.boolean(),
|
4768
|
+
canIssueChildren: z.string(),
|
4769
|
+
canCreateChildren: z.string(),
|
4770
|
+
canEditChildren: z.string(),
|
4771
|
+
canRevokeChildren: z.string(),
|
4772
|
+
canManageChildrenPermissions: z.string(),
|
4773
|
+
canManageChildrenProfiles: z.boolean().default(false).optional(),
|
4774
|
+
canViewAnalytics: z.boolean()
|
4099
4775
|
});
|
4100
|
-
var BoostPermissionsQueryValidator =
|
4776
|
+
var BoostPermissionsQueryValidator = z.object({
|
4101
4777
|
role: StringQuery,
|
4102
|
-
canEdit:
|
4103
|
-
canIssue:
|
4104
|
-
canRevoke:
|
4105
|
-
canManagePermissions:
|
4778
|
+
canEdit: z.boolean(),
|
4779
|
+
canIssue: z.boolean(),
|
4780
|
+
canRevoke: z.boolean(),
|
4781
|
+
canManagePermissions: z.boolean(),
|
4106
4782
|
canIssueChildren: StringQuery,
|
4107
4783
|
canCreateChildren: StringQuery,
|
4108
4784
|
canEditChildren: StringQuery,
|
4109
4785
|
canRevokeChildren: StringQuery,
|
4110
4786
|
canManageChildrenPermissions: StringQuery,
|
4111
|
-
canManageChildrenProfiles:
|
4112
|
-
canViewAnalytics:
|
4787
|
+
canManageChildrenProfiles: z.boolean(),
|
4788
|
+
canViewAnalytics: z.boolean()
|
4113
4789
|
}).partial();
|
4114
|
-
var ClaimHookTypeValidator =
|
4115
|
-
var ClaimHookValidator =
|
4116
|
-
|
4117
|
-
type:
|
4118
|
-
data:
|
4119
|
-
claimUri:
|
4120
|
-
targetUri:
|
4790
|
+
var ClaimHookTypeValidator = z.enum(["GRANT_PERMISSIONS", "ADD_ADMIN"]);
|
4791
|
+
var ClaimHookValidator = z.discriminatedUnion("type", [
|
4792
|
+
z.object({
|
4793
|
+
type: z.literal(ClaimHookTypeValidator.Values.GRANT_PERMISSIONS),
|
4794
|
+
data: z.object({
|
4795
|
+
claimUri: z.string(),
|
4796
|
+
targetUri: z.string(),
|
4121
4797
|
permissions: BoostPermissionsValidator.partial()
|
4122
4798
|
})
|
4123
4799
|
}),
|
4124
|
-
|
4125
|
-
type:
|
4126
|
-
data:
|
4800
|
+
z.object({
|
4801
|
+
type: z.literal(ClaimHookTypeValidator.Values.ADD_ADMIN),
|
4802
|
+
data: z.object({ claimUri: z.string(), targetUri: z.string() })
|
4127
4803
|
})
|
4128
4804
|
]);
|
4129
|
-
var ClaimHookQueryValidator =
|
4805
|
+
var ClaimHookQueryValidator = z.object({
|
4130
4806
|
type: StringQuery,
|
4131
|
-
data:
|
4807
|
+
data: z.object({
|
4132
4808
|
claimUri: StringQuery,
|
4133
4809
|
targetUri: StringQuery,
|
4134
4810
|
permissions: BoostPermissionsQueryValidator
|
4135
4811
|
})
|
4136
4812
|
}).deepPartial();
|
4137
|
-
var FullClaimHookValidator =
|
4813
|
+
var FullClaimHookValidator = z.object({ id: z.string(), createdAt: z.string(), updatedAt: z.string() }).and(ClaimHookValidator);
|
4138
4814
|
var PaginatedClaimHooksValidator = PaginationResponseValidator.extend({
|
4139
4815
|
records: FullClaimHookValidator.array()
|
4140
4816
|
});
|
4141
|
-
var LCNBoostStatus =
|
4142
|
-
var BoostValidator =
|
4143
|
-
uri:
|
4144
|
-
name:
|
4145
|
-
type:
|
4146
|
-
category:
|
4817
|
+
var LCNBoostStatus = z.enum(["DRAFT", "LIVE"]);
|
4818
|
+
var BoostValidator = z.object({
|
4819
|
+
uri: z.string(),
|
4820
|
+
name: z.string().optional(),
|
4821
|
+
type: z.string().optional(),
|
4822
|
+
category: z.string().optional(),
|
4147
4823
|
status: LCNBoostStatus.optional(),
|
4148
|
-
autoConnectRecipients:
|
4149
|
-
meta:
|
4824
|
+
autoConnectRecipients: z.boolean().optional(),
|
4825
|
+
meta: z.record(z.any()).optional(),
|
4150
4826
|
claimPermissions: BoostPermissionsValidator.optional()
|
4151
4827
|
});
|
4152
|
-
var BoostQueryValidator =
|
4828
|
+
var BoostQueryValidator = z.object({
|
4153
4829
|
uri: StringQuery,
|
4154
4830
|
name: StringQuery,
|
4155
4831
|
type: StringQuery,
|
4156
4832
|
category: StringQuery,
|
4157
|
-
meta:
|
4158
|
-
status: LCNBoostStatus.or(
|
4159
|
-
autoConnectRecipients:
|
4833
|
+
meta: z.record(StringQuery),
|
4834
|
+
status: LCNBoostStatus.or(z.object({ $in: LCNBoostStatus.array() })),
|
4835
|
+
autoConnectRecipients: z.boolean()
|
4160
4836
|
}).partial();
|
4161
4837
|
var PaginatedBoostsValidator = PaginationResponseValidator.extend({
|
4162
4838
|
records: BoostValidator.array()
|
4163
4839
|
});
|
4164
|
-
var BoostRecipientValidator =
|
4840
|
+
var BoostRecipientValidator = z.object({
|
4165
4841
|
to: LCNProfileValidator,
|
4166
|
-
from:
|
4167
|
-
received:
|
4168
|
-
uri:
|
4842
|
+
from: z.string(),
|
4843
|
+
received: z.string().optional(),
|
4844
|
+
uri: z.string().optional()
|
4169
4845
|
});
|
4170
4846
|
var PaginatedBoostRecipientsValidator = PaginationResponseValidator.extend({
|
4171
4847
|
records: BoostRecipientValidator.array()
|
4172
4848
|
});
|
4173
|
-
var LCNBoostClaimLinkSigningAuthorityValidator =
|
4174
|
-
endpoint:
|
4175
|
-
name:
|
4176
|
-
did:
|
4849
|
+
var LCNBoostClaimLinkSigningAuthorityValidator = z.object({
|
4850
|
+
endpoint: z.string(),
|
4851
|
+
name: z.string(),
|
4852
|
+
did: z.string().optional()
|
4177
4853
|
});
|
4178
|
-
var LCNBoostClaimLinkOptionsValidator =
|
4179
|
-
ttlSeconds:
|
4180
|
-
totalUses:
|
4854
|
+
var LCNBoostClaimLinkOptionsValidator = z.object({
|
4855
|
+
ttlSeconds: z.number().optional(),
|
4856
|
+
totalUses: z.number().optional()
|
4181
4857
|
});
|
4182
|
-
var LCNSigningAuthorityValidator =
|
4183
|
-
endpoint:
|
4858
|
+
var LCNSigningAuthorityValidator = z.object({
|
4859
|
+
endpoint: z.string()
|
4184
4860
|
});
|
4185
|
-
var LCNSigningAuthorityForUserValidator =
|
4861
|
+
var LCNSigningAuthorityForUserValidator = z.object({
|
4186
4862
|
signingAuthority: LCNSigningAuthorityValidator,
|
4187
|
-
relationship:
|
4188
|
-
name:
|
4863
|
+
relationship: z.object({
|
4864
|
+
name: z.string().max(15).regex(/^[a-z0-9-]+$/, {
|
4189
4865
|
message: "The input string must contain only lowercase letters, numbers, and hyphens."
|
4190
4866
|
}),
|
4191
|
-
did:
|
4867
|
+
did: z.string()
|
4192
4868
|
})
|
4193
4869
|
});
|
4194
|
-
var AutoBoostConfigValidator =
|
4195
|
-
boostUri:
|
4196
|
-
signingAuthority:
|
4197
|
-
endpoint:
|
4198
|
-
name:
|
4870
|
+
var AutoBoostConfigValidator = z.object({
|
4871
|
+
boostUri: z.string(),
|
4872
|
+
signingAuthority: z.object({
|
4873
|
+
endpoint: z.string(),
|
4874
|
+
name: z.string()
|
4199
4875
|
})
|
4200
4876
|
});
|
4201
|
-
var ConsentFlowTermsStatusValidator =
|
4202
|
-
var ConsentFlowContractValidator =
|
4203
|
-
read:
|
4204
|
-
anonymize:
|
4205
|
-
credentials:
|
4206
|
-
personal:
|
4877
|
+
var ConsentFlowTermsStatusValidator = z.enum(["live", "stale", "withdrawn"]);
|
4878
|
+
var ConsentFlowContractValidator = z.object({
|
4879
|
+
read: z.object({
|
4880
|
+
anonymize: z.boolean().optional(),
|
4881
|
+
credentials: z.object({ categories: z.record(z.object({ required: z.boolean() })).default({}) }).default({}),
|
4882
|
+
personal: z.record(z.object({ required: z.boolean() })).default({})
|
4207
4883
|
}).default({}),
|
4208
|
-
write:
|
4209
|
-
credentials:
|
4210
|
-
personal:
|
4884
|
+
write: z.object({
|
4885
|
+
credentials: z.object({ categories: z.record(z.object({ required: z.boolean() })).default({}) }).default({}),
|
4886
|
+
personal: z.record(z.object({ required: z.boolean() })).default({})
|
4211
4887
|
}).default({})
|
4212
4888
|
});
|
4213
|
-
var ConsentFlowContractDetailsValidator =
|
4889
|
+
var ConsentFlowContractDetailsValidator = z.object({
|
4214
4890
|
contract: ConsentFlowContractValidator,
|
4215
4891
|
owner: LCNProfileValidator,
|
4216
|
-
name:
|
4217
|
-
subtitle:
|
4218
|
-
description:
|
4219
|
-
reasonForAccessing:
|
4220
|
-
image:
|
4221
|
-
uri:
|
4222
|
-
needsGuardianConsent:
|
4223
|
-
redirectUrl:
|
4224
|
-
frontDoorBoostUri:
|
4225
|
-
createdAt:
|
4226
|
-
updatedAt:
|
4227
|
-
expiresAt:
|
4228
|
-
autoBoosts:
|
4229
|
-
writers:
|
4892
|
+
name: z.string(),
|
4893
|
+
subtitle: z.string().optional(),
|
4894
|
+
description: z.string().optional(),
|
4895
|
+
reasonForAccessing: z.string().optional(),
|
4896
|
+
image: z.string().optional(),
|
4897
|
+
uri: z.string(),
|
4898
|
+
needsGuardianConsent: z.boolean().optional(),
|
4899
|
+
redirectUrl: z.string().optional(),
|
4900
|
+
frontDoorBoostUri: z.string().optional(),
|
4901
|
+
createdAt: z.string(),
|
4902
|
+
updatedAt: z.string(),
|
4903
|
+
expiresAt: z.string().optional(),
|
4904
|
+
autoBoosts: z.string().array().optional(),
|
4905
|
+
writers: z.array(LCNProfileValidator).optional()
|
4230
4906
|
});
|
4231
4907
|
var PaginatedConsentFlowContractsValidator = PaginationResponseValidator.extend({
|
4232
4908
|
records: ConsentFlowContractDetailsValidator.omit({ owner: true }).array()
|
4233
4909
|
});
|
4234
|
-
var ConsentFlowContractDataValidator =
|
4235
|
-
credentials:
|
4236
|
-
personal:
|
4237
|
-
date:
|
4910
|
+
var ConsentFlowContractDataValidator = z.object({
|
4911
|
+
credentials: z.object({ categories: z.record(z.string().array()).default({}) }),
|
4912
|
+
personal: z.record(z.string()).default({}),
|
4913
|
+
date: z.string()
|
4238
4914
|
});
|
4239
4915
|
var PaginatedConsentFlowDataValidator = PaginationResponseValidator.extend({
|
4240
4916
|
records: ConsentFlowContractDataValidator.array()
|
4241
4917
|
});
|
4242
|
-
var ConsentFlowContractDataForDidValidator =
|
4243
|
-
credentials:
|
4244
|
-
personal:
|
4245
|
-
date:
|
4246
|
-
contractUri:
|
4918
|
+
var ConsentFlowContractDataForDidValidator = z.object({
|
4919
|
+
credentials: z.object({ category: z.string(), uri: z.string() }).array(),
|
4920
|
+
personal: z.record(z.string()).default({}),
|
4921
|
+
date: z.string(),
|
4922
|
+
contractUri: z.string()
|
4247
4923
|
});
|
4248
4924
|
var PaginatedConsentFlowDataForDidValidator = PaginationResponseValidator.extend({
|
4249
4925
|
records: ConsentFlowContractDataForDidValidator.array()
|
4250
4926
|
});
|
4251
|
-
var ConsentFlowTermValidator =
|
4252
|
-
sharing:
|
4253
|
-
shared:
|
4254
|
-
shareAll:
|
4255
|
-
shareUntil:
|
4927
|
+
var ConsentFlowTermValidator = z.object({
|
4928
|
+
sharing: z.boolean().optional(),
|
4929
|
+
shared: z.string().array().optional(),
|
4930
|
+
shareAll: z.boolean().optional(),
|
4931
|
+
shareUntil: z.string().optional()
|
4256
4932
|
});
|
4257
|
-
var ConsentFlowTermsValidator =
|
4258
|
-
read:
|
4259
|
-
anonymize:
|
4260
|
-
credentials:
|
4261
|
-
shareAll:
|
4262
|
-
sharing:
|
4263
|
-
categories:
|
4933
|
+
var ConsentFlowTermsValidator = z.object({
|
4934
|
+
read: z.object({
|
4935
|
+
anonymize: z.boolean().optional(),
|
4936
|
+
credentials: z.object({
|
4937
|
+
shareAll: z.boolean().optional(),
|
4938
|
+
sharing: z.boolean().optional(),
|
4939
|
+
categories: z.record(ConsentFlowTermValidator).default({})
|
4264
4940
|
}).default({}),
|
4265
|
-
personal:
|
4941
|
+
personal: z.record(z.string()).default({})
|
4266
4942
|
}).default({}),
|
4267
|
-
write:
|
4268
|
-
credentials:
|
4269
|
-
personal:
|
4943
|
+
write: z.object({
|
4944
|
+
credentials: z.object({ categories: z.record(z.boolean()).default({}) }).default({}),
|
4945
|
+
personal: z.record(z.boolean()).default({})
|
4270
4946
|
}).default({}),
|
4271
|
-
deniedWriters:
|
4947
|
+
deniedWriters: z.array(z.string()).optional()
|
4272
4948
|
});
|
4273
4949
|
var PaginatedConsentFlowTermsValidator = PaginationResponseValidator.extend({
|
4274
|
-
records:
|
4275
|
-
expiresAt:
|
4276
|
-
oneTime:
|
4950
|
+
records: z.object({
|
4951
|
+
expiresAt: z.string().optional(),
|
4952
|
+
oneTime: z.boolean().optional(),
|
4277
4953
|
terms: ConsentFlowTermsValidator,
|
4278
4954
|
contract: ConsentFlowContractDetailsValidator,
|
4279
|
-
uri:
|
4955
|
+
uri: z.string(),
|
4280
4956
|
consenter: LCNProfileValidator,
|
4281
4957
|
status: ConsentFlowTermsStatusValidator
|
4282
4958
|
}).array()
|
4283
4959
|
});
|
4284
|
-
var ConsentFlowContractQueryValidator =
|
4285
|
-
read:
|
4286
|
-
anonymize:
|
4287
|
-
credentials:
|
4288
|
-
categories:
|
4960
|
+
var ConsentFlowContractQueryValidator = z.object({
|
4961
|
+
read: z.object({
|
4962
|
+
anonymize: z.boolean().optional(),
|
4963
|
+
credentials: z.object({
|
4964
|
+
categories: z.record(z.object({ required: z.boolean().optional() })).optional()
|
4289
4965
|
}).optional(),
|
4290
|
-
personal:
|
4966
|
+
personal: z.record(z.object({ required: z.boolean().optional() })).optional()
|
4291
4967
|
}).optional(),
|
4292
|
-
write:
|
4293
|
-
credentials:
|
4294
|
-
categories:
|
4968
|
+
write: z.object({
|
4969
|
+
credentials: z.object({
|
4970
|
+
categories: z.record(z.object({ required: z.boolean().optional() })).optional()
|
4295
4971
|
}).optional(),
|
4296
|
-
personal:
|
4972
|
+
personal: z.record(z.object({ required: z.boolean().optional() })).optional()
|
4297
4973
|
}).optional()
|
4298
4974
|
});
|
4299
|
-
var ConsentFlowDataQueryValidator =
|
4300
|
-
anonymize:
|
4301
|
-
credentials:
|
4302
|
-
personal:
|
4975
|
+
var ConsentFlowDataQueryValidator = z.object({
|
4976
|
+
anonymize: z.boolean().optional(),
|
4977
|
+
credentials: z.object({ categories: z.record(z.boolean()).optional() }).optional(),
|
4978
|
+
personal: z.record(z.boolean()).optional()
|
4303
4979
|
});
|
4304
|
-
var ConsentFlowDataForDidQueryValidator =
|
4305
|
-
credentials:
|
4306
|
-
personal:
|
4980
|
+
var ConsentFlowDataForDidQueryValidator = z.object({
|
4981
|
+
credentials: z.object({ categories: z.record(z.boolean()).optional() }).optional(),
|
4982
|
+
personal: z.record(z.boolean()).optional(),
|
4307
4983
|
id: StringQuery.optional()
|
4308
4984
|
});
|
4309
|
-
var ConsentFlowTermsQueryValidator =
|
4310
|
-
read:
|
4311
|
-
anonymize:
|
4312
|
-
credentials:
|
4313
|
-
shareAll:
|
4314
|
-
sharing:
|
4315
|
-
categories:
|
4985
|
+
var ConsentFlowTermsQueryValidator = z.object({
|
4986
|
+
read: z.object({
|
4987
|
+
anonymize: z.boolean().optional(),
|
4988
|
+
credentials: z.object({
|
4989
|
+
shareAll: z.boolean().optional(),
|
4990
|
+
sharing: z.boolean().optional(),
|
4991
|
+
categories: z.record(ConsentFlowTermValidator.optional()).optional()
|
4316
4992
|
}).optional(),
|
4317
|
-
personal:
|
4993
|
+
personal: z.record(z.string()).optional()
|
4318
4994
|
}).optional(),
|
4319
|
-
write:
|
4320
|
-
credentials:
|
4321
|
-
personal:
|
4995
|
+
write: z.object({
|
4996
|
+
credentials: z.object({ categories: z.record(z.boolean()).optional() }).optional(),
|
4997
|
+
personal: z.record(z.boolean()).optional()
|
4322
4998
|
}).optional()
|
4323
4999
|
});
|
4324
|
-
var ConsentFlowTransactionActionValidator =
|
5000
|
+
var ConsentFlowTransactionActionValidator = z.enum([
|
4325
5001
|
"consent",
|
4326
5002
|
"update",
|
4327
5003
|
"sync",
|
4328
5004
|
"withdraw",
|
4329
5005
|
"write"
|
4330
5006
|
]);
|
4331
|
-
var ConsentFlowTransactionsQueryValidator =
|
5007
|
+
var ConsentFlowTransactionsQueryValidator = z.object({
|
4332
5008
|
terms: ConsentFlowTermsQueryValidator.optional(),
|
4333
5009
|
action: ConsentFlowTransactionActionValidator.or(
|
4334
5010
|
ConsentFlowTransactionActionValidator.array()
|
4335
5011
|
).optional(),
|
4336
|
-
date:
|
4337
|
-
expiresAt:
|
4338
|
-
oneTime:
|
5012
|
+
date: z.object({ $gt: z.string() }).or(z.object({ $lt: z.string() })).or(z.object({ $eq: z.string() })).optional(),
|
5013
|
+
expiresAt: z.object({ $gt: z.string() }).or(z.object({ $lt: z.string() })).or(z.object({ $eq: z.string() })).optional(),
|
5014
|
+
oneTime: z.boolean().optional()
|
4339
5015
|
});
|
4340
|
-
var ConsentFlowTransactionValidator =
|
4341
|
-
expiresAt:
|
4342
|
-
oneTime:
|
5016
|
+
var ConsentFlowTransactionValidator = z.object({
|
5017
|
+
expiresAt: z.string().optional(),
|
5018
|
+
oneTime: z.boolean().optional(),
|
4343
5019
|
terms: ConsentFlowTermsValidator.optional(),
|
4344
|
-
id:
|
5020
|
+
id: z.string(),
|
4345
5021
|
action: ConsentFlowTransactionActionValidator,
|
4346
|
-
date:
|
4347
|
-
uris:
|
5022
|
+
date: z.string(),
|
5023
|
+
uris: z.string().array().optional()
|
4348
5024
|
});
|
4349
5025
|
var PaginatedConsentFlowTransactionsValidator = PaginationResponseValidator.extend({
|
4350
5026
|
records: ConsentFlowTransactionValidator.array()
|
4351
5027
|
});
|
4352
|
-
var ContractCredentialValidator =
|
4353
|
-
credentialUri:
|
4354
|
-
termsUri:
|
4355
|
-
contractUri:
|
4356
|
-
boostUri:
|
4357
|
-
category:
|
4358
|
-
date:
|
5028
|
+
var ContractCredentialValidator = z.object({
|
5029
|
+
credentialUri: z.string(),
|
5030
|
+
termsUri: z.string(),
|
5031
|
+
contractUri: z.string(),
|
5032
|
+
boostUri: z.string(),
|
5033
|
+
category: z.string().optional(),
|
5034
|
+
date: z.string()
|
4359
5035
|
});
|
4360
5036
|
var PaginatedContractCredentialsValidator = PaginationResponseValidator.extend({
|
4361
5037
|
records: ContractCredentialValidator.array()
|
4362
5038
|
});
|
4363
|
-
var LCNNotificationTypeEnumValidator =
|
5039
|
+
var LCNNotificationTypeEnumValidator = z.enum([
|
4364
5040
|
"CONNECTION_REQUEST",
|
4365
5041
|
"CONNECTION_ACCEPTED",
|
4366
5042
|
"CREDENTIAL_RECEIVED",
|
@@ -4371,40 +5047,40 @@ var require_types_cjs_development = __commonJS({
|
|
4371
5047
|
"PRESENTATION_RECEIVED",
|
4372
5048
|
"CONSENT_FLOW_TRANSACTION"
|
4373
5049
|
]);
|
4374
|
-
var LCNNotificationMessageValidator =
|
4375
|
-
title:
|
4376
|
-
body:
|
5050
|
+
var LCNNotificationMessageValidator = z.object({
|
5051
|
+
title: z.string().optional(),
|
5052
|
+
body: z.string().optional()
|
4377
5053
|
});
|
4378
|
-
var LCNNotificationDataValidator =
|
4379
|
-
vcUris:
|
4380
|
-
vpUris:
|
5054
|
+
var LCNNotificationDataValidator = z.object({
|
5055
|
+
vcUris: z.array(z.string()).optional(),
|
5056
|
+
vpUris: z.array(z.string()).optional(),
|
4381
5057
|
transaction: ConsentFlowTransactionValidator.optional()
|
4382
5058
|
});
|
4383
|
-
var LCNNotificationValidator =
|
5059
|
+
var LCNNotificationValidator = z.object({
|
4384
5060
|
type: LCNNotificationTypeEnumValidator,
|
4385
|
-
to: LCNProfileValidator.partial().and(
|
4386
|
-
from: LCNProfileValidator.partial().and(
|
5061
|
+
to: LCNProfileValidator.partial().and(z.object({ did: z.string() })),
|
5062
|
+
from: LCNProfileValidator.partial().and(z.object({ did: z.string() })),
|
4387
5063
|
message: LCNNotificationMessageValidator.optional(),
|
4388
5064
|
data: LCNNotificationDataValidator.optional(),
|
4389
|
-
sent:
|
5065
|
+
sent: z.string().datetime().optional()
|
4390
5066
|
});
|
4391
5067
|
var AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX = "auth-grant:";
|
4392
|
-
var AuthGrantValidator =
|
4393
|
-
id:
|
4394
|
-
name:
|
4395
|
-
description:
|
4396
|
-
challenge:
|
4397
|
-
status:
|
5068
|
+
var AuthGrantValidator = z.object({
|
5069
|
+
id: z.string(),
|
5070
|
+
name: z.string(),
|
5071
|
+
description: z.string().optional(),
|
5072
|
+
challenge: z.string().startsWith(AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX).min(10, { message: "Challenge is too short" }).max(100, { message: "Challenge is too long" }),
|
5073
|
+
status: z.enum(["revoked", "active"], {
|
4398
5074
|
required_error: "Status is required",
|
4399
5075
|
invalid_type_error: "Status must be either active or revoked"
|
4400
5076
|
}),
|
4401
|
-
scope:
|
4402
|
-
createdAt:
|
4403
|
-
expiresAt:
|
5077
|
+
scope: z.string(),
|
5078
|
+
createdAt: z.string().datetime({ message: "createdAt must be a valid ISO 8601 datetime string" }),
|
5079
|
+
expiresAt: z.string().datetime({ message: "expiresAt must be a valid ISO 8601 datetime string" }).nullish().optional()
|
4404
5080
|
});
|
4405
|
-
var FlatAuthGrantValidator =
|
4406
|
-
var AuthGrantStatusValidator =
|
4407
|
-
var AuthGrantQueryValidator =
|
5081
|
+
var FlatAuthGrantValidator = z.object({ id: z.string() }).catchall(z.any());
|
5082
|
+
var AuthGrantStatusValidator = z.enum(["active", "revoked"]);
|
5083
|
+
var AuthGrantQueryValidator = z.object({
|
4408
5084
|
id: StringQuery,
|
4409
5085
|
name: StringQuery,
|
4410
5086
|
description: StringQuery,
|