@learncard/didkey-plugin 1.0.39 → 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
@@ -57,7 +57,7 @@ var require_types_cjs_development = __commonJS({
|
|
57
57
|
}
|
58
58
|
return to;
|
59
59
|
}, "__copyProps");
|
60
|
-
var __toCommonJS = /* @__PURE__ */ __name2((
|
60
|
+
var __toCommonJS = /* @__PURE__ */ __name2((mod) => __copyProps2(__defProp22({}, "__esModule", { value: true }), mod), "__toCommonJS");
|
61
61
|
var src_exports = {};
|
62
62
|
__export(src_exports, {
|
63
63
|
AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX: () => AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX,
|
@@ -247,6 +247,15 @@ var require_types_cjs_development = __commonJS({
|
|
247
247
|
return value;
|
248
248
|
};
|
249
249
|
})(util || (util = {}));
|
250
|
+
var objectUtil;
|
251
|
+
(function(objectUtil2) {
|
252
|
+
objectUtil2.mergeShapes = (first, second) => {
|
253
|
+
return {
|
254
|
+
...first,
|
255
|
+
...second
|
256
|
+
};
|
257
|
+
};
|
258
|
+
})(objectUtil || (objectUtil = {}));
|
250
259
|
var ZodParsedType = util.arrayToEnum([
|
251
260
|
"string",
|
252
261
|
"nan",
|
@@ -390,6 +399,11 @@ var require_types_cjs_development = __commonJS({
|
|
390
399
|
processError(this);
|
391
400
|
return fieldErrors;
|
392
401
|
}
|
402
|
+
static assert(value) {
|
403
|
+
if (!(value instanceof ZodError)) {
|
404
|
+
throw new Error(`Not a ZodError: ${value}`);
|
405
|
+
}
|
406
|
+
}
|
393
407
|
toString() {
|
394
408
|
return this.message;
|
395
409
|
}
|
@@ -457,7 +471,12 @@ var require_types_cjs_development = __commonJS({
|
|
457
471
|
break;
|
458
472
|
case ZodIssueCode.invalid_string:
|
459
473
|
if (typeof issue.validation === "object") {
|
460
|
-
if ("
|
474
|
+
if ("includes" in issue.validation) {
|
475
|
+
message = `Invalid input: must include "${issue.validation.includes}"`;
|
476
|
+
if (typeof issue.validation.position === "number") {
|
477
|
+
message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;
|
478
|
+
}
|
479
|
+
} else if ("startsWith" in issue.validation) {
|
461
480
|
message = `Invalid input: must start with "${issue.validation.startsWith}"`;
|
462
481
|
} else if ("endsWith" in issue.validation) {
|
463
482
|
message = `Invalid input: must end with "${issue.validation.endsWith}"`;
|
@@ -478,7 +497,7 @@ var require_types_cjs_development = __commonJS({
|
|
478
497
|
else if (issue.type === "number")
|
479
498
|
message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
|
480
499
|
else if (issue.type === "date")
|
481
|
-
message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(issue.minimum)}`;
|
500
|
+
message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
|
482
501
|
else
|
483
502
|
message = "Invalid input";
|
484
503
|
break;
|
@@ -489,8 +508,10 @@ var require_types_cjs_development = __commonJS({
|
|
489
508
|
message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
|
490
509
|
else if (issue.type === "number")
|
491
510
|
message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
|
511
|
+
else if (issue.type === "bigint")
|
512
|
+
message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
|
492
513
|
else if (issue.type === "date")
|
493
|
-
message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(issue.maximum)}`;
|
514
|
+
message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`;
|
494
515
|
else
|
495
516
|
message = "Invalid input";
|
496
517
|
break;
|
@@ -532,6 +553,13 @@ var require_types_cjs_development = __commonJS({
|
|
532
553
|
...issueData,
|
533
554
|
path: fullPath
|
534
555
|
};
|
556
|
+
if (issueData.message !== void 0) {
|
557
|
+
return {
|
558
|
+
...issueData,
|
559
|
+
path: fullPath,
|
560
|
+
message: issueData.message
|
561
|
+
};
|
562
|
+
}
|
535
563
|
let errorMessage = "";
|
536
564
|
const maps = errorMaps.filter((m) => !!m).slice().reverse();
|
537
565
|
for (const map of maps) {
|
@@ -540,11 +568,12 @@ var require_types_cjs_development = __commonJS({
|
|
540
568
|
return {
|
541
569
|
...issueData,
|
542
570
|
path: fullPath,
|
543
|
-
message:
|
571
|
+
message: errorMessage
|
544
572
|
};
|
545
573
|
}, "makeIssue");
|
546
574
|
var EMPTY_PATH = [];
|
547
575
|
function addIssueToContext(ctx, issueData) {
|
576
|
+
const overrideMap = getErrorMap();
|
548
577
|
const issue = makeIssue({
|
549
578
|
issueData,
|
550
579
|
data: ctx.data,
|
@@ -552,8 +581,8 @@ var require_types_cjs_development = __commonJS({
|
|
552
581
|
errorMaps: [
|
553
582
|
ctx.common.contextualErrorMap,
|
554
583
|
ctx.schemaErrorMap,
|
555
|
-
|
556
|
-
errorMap
|
584
|
+
overrideMap,
|
585
|
+
overrideMap === errorMap ? void 0 : errorMap
|
557
586
|
].filter((x) => !!x)
|
558
587
|
});
|
559
588
|
ctx.common.issues.push(issue);
|
@@ -587,9 +616,11 @@ var require_types_cjs_development = __commonJS({
|
|
587
616
|
static async mergeObjectAsync(status, pairs) {
|
588
617
|
const syncPairs = [];
|
589
618
|
for (const pair of pairs) {
|
619
|
+
const key = await pair.key;
|
620
|
+
const value = await pair.value;
|
590
621
|
syncPairs.push({
|
591
|
-
key
|
592
|
-
value
|
622
|
+
key,
|
623
|
+
value
|
593
624
|
});
|
594
625
|
}
|
595
626
|
return ParseStatus.mergeObjectSync(status, syncPairs);
|
@@ -606,7 +637,7 @@ var require_types_cjs_development = __commonJS({
|
|
606
637
|
status.dirty();
|
607
638
|
if (value.status === "dirty")
|
608
639
|
status.dirty();
|
609
|
-
if (typeof value.value !== "undefined" || pair.alwaysSet) {
|
640
|
+
if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) {
|
610
641
|
finalObject[key.value] = value.value;
|
611
642
|
}
|
612
643
|
}
|
@@ -622,21 +653,53 @@ var require_types_cjs_development = __commonJS({
|
|
622
653
|
var isAborted = /* @__PURE__ */ __name22((x) => x.status === "aborted", "isAborted");
|
623
654
|
var isDirty = /* @__PURE__ */ __name22((x) => x.status === "dirty", "isDirty");
|
624
655
|
var isValid = /* @__PURE__ */ __name22((x) => x.status === "valid", "isValid");
|
625
|
-
var isAsync = /* @__PURE__ */ __name22((x) => typeof Promise !==
|
656
|
+
var isAsync = /* @__PURE__ */ __name22((x) => typeof Promise !== "undefined" && x instanceof Promise, "isAsync");
|
657
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
658
|
+
if (kind === "a" && !f)
|
659
|
+
throw new TypeError("Private accessor was defined without a getter");
|
660
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
661
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
662
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
663
|
+
}
|
664
|
+
__name(__classPrivateFieldGet, "__classPrivateFieldGet");
|
665
|
+
__name2(__classPrivateFieldGet, "__classPrivateFieldGet");
|
666
|
+
__name22(__classPrivateFieldGet, "__classPrivateFieldGet");
|
667
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
668
|
+
if (kind === "m")
|
669
|
+
throw new TypeError("Private method is not writable");
|
670
|
+
if (kind === "a" && !f)
|
671
|
+
throw new TypeError("Private accessor was defined without a setter");
|
672
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
673
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
674
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
675
|
+
}
|
676
|
+
__name(__classPrivateFieldSet, "__classPrivateFieldSet");
|
677
|
+
__name2(__classPrivateFieldSet, "__classPrivateFieldSet");
|
678
|
+
__name22(__classPrivateFieldSet, "__classPrivateFieldSet");
|
626
679
|
var errorUtil;
|
627
680
|
(function(errorUtil2) {
|
628
681
|
errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
629
682
|
errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
|
630
683
|
})(errorUtil || (errorUtil = {}));
|
684
|
+
var _ZodEnum_cache;
|
685
|
+
var _ZodNativeEnum_cache;
|
631
686
|
var ParseInputLazyPath = /* @__PURE__ */ __name2(class {
|
632
687
|
constructor(parent, value, path, key) {
|
688
|
+
this._cachedPath = [];
|
633
689
|
this.parent = parent;
|
634
690
|
this.data = value;
|
635
691
|
this._path = path;
|
636
692
|
this._key = key;
|
637
693
|
}
|
638
694
|
get path() {
|
639
|
-
|
695
|
+
if (!this._cachedPath.length) {
|
696
|
+
if (this._key instanceof Array) {
|
697
|
+
this._cachedPath.push(...this._path, ...this._key);
|
698
|
+
} else {
|
699
|
+
this._cachedPath.push(...this._path, this._key);
|
700
|
+
}
|
701
|
+
}
|
702
|
+
return this._cachedPath;
|
640
703
|
}
|
641
704
|
}, "ParseInputLazyPath");
|
642
705
|
__name22(ParseInputLazyPath, "ParseInputLazyPath");
|
@@ -647,8 +710,16 @@ var require_types_cjs_development = __commonJS({
|
|
647
710
|
if (!ctx.common.issues.length) {
|
648
711
|
throw new Error("Validation failed but no issues detected.");
|
649
712
|
}
|
650
|
-
|
651
|
-
|
713
|
+
return {
|
714
|
+
success: false,
|
715
|
+
get error() {
|
716
|
+
if (this._error)
|
717
|
+
return this._error;
|
718
|
+
const error = new ZodError(ctx.common.issues);
|
719
|
+
this._error = error;
|
720
|
+
return this._error;
|
721
|
+
}
|
722
|
+
};
|
652
723
|
}
|
653
724
|
}, "handleResult");
|
654
725
|
function processCreateParams(params) {
|
@@ -661,12 +732,17 @@ var require_types_cjs_development = __commonJS({
|
|
661
732
|
if (errorMap2)
|
662
733
|
return { errorMap: errorMap2, description };
|
663
734
|
const customMap = /* @__PURE__ */ __name22((iss, ctx) => {
|
664
|
-
|
665
|
-
|
735
|
+
var _a, _b;
|
736
|
+
const { message } = params;
|
737
|
+
if (iss.code === "invalid_enum_value") {
|
738
|
+
return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
|
739
|
+
}
|
666
740
|
if (typeof ctx.data === "undefined") {
|
667
|
-
return { message:
|
741
|
+
return { message: (_a = message !== null && message !== void 0 ? message : required_error) !== null && _a !== void 0 ? _a : ctx.defaultError };
|
668
742
|
}
|
669
|
-
|
743
|
+
if (iss.code !== "invalid_type")
|
744
|
+
return { message: ctx.defaultError };
|
745
|
+
return { message: (_b = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b !== void 0 ? _b : ctx.defaultError };
|
670
746
|
}, "customMap");
|
671
747
|
return { errorMap: customMap, description };
|
672
748
|
}
|
@@ -698,6 +774,7 @@ var require_types_cjs_development = __commonJS({
|
|
698
774
|
this.catch = this.catch.bind(this);
|
699
775
|
this.describe = this.describe.bind(this);
|
700
776
|
this.pipe = this.pipe.bind(this);
|
777
|
+
this.readonly = this.readonly.bind(this);
|
701
778
|
this.isNullable = this.isNullable.bind(this);
|
702
779
|
this.isOptional = this.isOptional.bind(this);
|
703
780
|
}
|
@@ -842,28 +919,29 @@ var require_types_cjs_development = __commonJS({
|
|
842
919
|
return this._refinement(refinement);
|
843
920
|
}
|
844
921
|
optional() {
|
845
|
-
return ZodOptional.create(this);
|
922
|
+
return ZodOptional.create(this, this._def);
|
846
923
|
}
|
847
924
|
nullable() {
|
848
|
-
return ZodNullable.create(this);
|
925
|
+
return ZodNullable.create(this, this._def);
|
849
926
|
}
|
850
927
|
nullish() {
|
851
|
-
return this.
|
928
|
+
return this.nullable().optional();
|
852
929
|
}
|
853
930
|
array() {
|
854
|
-
return ZodArray.create(this);
|
931
|
+
return ZodArray.create(this, this._def);
|
855
932
|
}
|
856
933
|
promise() {
|
857
|
-
return ZodPromise.create(this);
|
934
|
+
return ZodPromise.create(this, this._def);
|
858
935
|
}
|
859
936
|
or(option) {
|
860
|
-
return ZodUnion.create([this, option]);
|
937
|
+
return ZodUnion.create([this, option], this._def);
|
861
938
|
}
|
862
939
|
and(incoming) {
|
863
|
-
return ZodIntersection.create(this, incoming);
|
940
|
+
return ZodIntersection.create(this, incoming, this._def);
|
864
941
|
}
|
865
942
|
transform(transform) {
|
866
943
|
return new ZodEffects({
|
944
|
+
...processCreateParams(this._def),
|
867
945
|
schema: this,
|
868
946
|
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
869
947
|
effect: { type: "transform", transform }
|
@@ -872,6 +950,7 @@ var require_types_cjs_development = __commonJS({
|
|
872
950
|
default(def) {
|
873
951
|
const defaultValueFunc = typeof def === "function" ? def : () => def;
|
874
952
|
return new ZodDefault({
|
953
|
+
...processCreateParams(this._def),
|
875
954
|
innerType: this,
|
876
955
|
defaultValue: defaultValueFunc,
|
877
956
|
typeName: ZodFirstPartyTypeKind.ZodDefault
|
@@ -881,14 +960,15 @@ var require_types_cjs_development = __commonJS({
|
|
881
960
|
return new ZodBranded({
|
882
961
|
typeName: ZodFirstPartyTypeKind.ZodBranded,
|
883
962
|
type: this,
|
884
|
-
...processCreateParams(
|
963
|
+
...processCreateParams(this._def)
|
885
964
|
});
|
886
965
|
}
|
887
966
|
catch(def) {
|
888
|
-
const
|
967
|
+
const catchValueFunc = typeof def === "function" ? def : () => def;
|
889
968
|
return new ZodCatch({
|
969
|
+
...processCreateParams(this._def),
|
890
970
|
innerType: this,
|
891
|
-
|
971
|
+
catchValue: catchValueFunc,
|
892
972
|
typeName: ZodFirstPartyTypeKind.ZodCatch
|
893
973
|
});
|
894
974
|
}
|
@@ -902,6 +982,9 @@ var require_types_cjs_development = __commonJS({
|
|
902
982
|
pipe(target) {
|
903
983
|
return ZodPipeline.create(this, target);
|
904
984
|
}
|
985
|
+
readonly() {
|
986
|
+
return ZodReadonly.create(this);
|
987
|
+
}
|
905
988
|
isOptional() {
|
906
989
|
return this.safeParse(void 0).success;
|
907
990
|
}
|
@@ -911,43 +994,62 @@ var require_types_cjs_development = __commonJS({
|
|
911
994
|
}, "ZodType");
|
912
995
|
__name22(ZodType, "ZodType");
|
913
996
|
var cuidRegex = /^c[^\s-]{8,}$/i;
|
914
|
-
var
|
915
|
-
var
|
916
|
-
var
|
997
|
+
var cuid2Regex = /^[0-9a-z]+$/;
|
998
|
+
var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;
|
999
|
+
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;
|
1000
|
+
var nanoidRegex = /^[a-z0-9_-]{21}$/i;
|
1001
|
+
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)?)??$/;
|
1002
|
+
var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
|
1003
|
+
var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
|
1004
|
+
var emojiRegex;
|
1005
|
+
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])$/;
|
1006
|
+
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})))$/;
|
1007
|
+
var base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
|
1008
|
+
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])))`;
|
1009
|
+
var dateRegex = new RegExp(`^${dateRegexSource}$`);
|
1010
|
+
function timeRegexSource(args) {
|
1011
|
+
let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
|
917
1012
|
if (args.precision) {
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
|
922
|
-
}
|
923
|
-
} else if (args.precision === 0) {
|
924
|
-
if (args.offset) {
|
925
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$`);
|
926
|
-
} else {
|
927
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
|
928
|
-
}
|
929
|
-
} else {
|
930
|
-
if (args.offset) {
|
931
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$`);
|
932
|
-
} else {
|
933
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
|
934
|
-
}
|
1013
|
+
regex = `${regex}\\.\\d{${args.precision}}`;
|
1014
|
+
} else if (args.precision == null) {
|
1015
|
+
regex = `${regex}(\\.\\d+)?`;
|
935
1016
|
}
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
1017
|
+
return regex;
|
1018
|
+
}
|
1019
|
+
__name(timeRegexSource, "timeRegexSource");
|
1020
|
+
__name2(timeRegexSource, "timeRegexSource");
|
1021
|
+
__name22(timeRegexSource, "timeRegexSource");
|
1022
|
+
function timeRegex(args) {
|
1023
|
+
return new RegExp(`^${timeRegexSource(args)}$`);
|
1024
|
+
}
|
1025
|
+
__name(timeRegex, "timeRegex");
|
1026
|
+
__name2(timeRegex, "timeRegex");
|
1027
|
+
__name22(timeRegex, "timeRegex");
|
1028
|
+
function datetimeRegex(args) {
|
1029
|
+
let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
|
1030
|
+
const opts = [];
|
1031
|
+
opts.push(args.local ? `Z?` : `Z`);
|
1032
|
+
if (args.offset)
|
1033
|
+
opts.push(`([+-]\\d{2}:?\\d{2})`);
|
1034
|
+
regex = `${regex}(${opts.join("|")})`;
|
1035
|
+
return new RegExp(`^${regex}$`);
|
1036
|
+
}
|
1037
|
+
__name(datetimeRegex, "datetimeRegex");
|
1038
|
+
__name2(datetimeRegex, "datetimeRegex");
|
1039
|
+
__name22(datetimeRegex, "datetimeRegex");
|
1040
|
+
function isValidIP(ip, version) {
|
1041
|
+
if ((version === "v4" || !version) && ipv4Regex.test(ip)) {
|
1042
|
+
return true;
|
950
1043
|
}
|
1044
|
+
if ((version === "v6" || !version) && ipv6Regex.test(ip)) {
|
1045
|
+
return true;
|
1046
|
+
}
|
1047
|
+
return false;
|
1048
|
+
}
|
1049
|
+
__name(isValidIP, "isValidIP");
|
1050
|
+
__name2(isValidIP, "isValidIP");
|
1051
|
+
__name22(isValidIP, "isValidIP");
|
1052
|
+
var ZodString = /* @__PURE__ */ __name2(class extends ZodType {
|
951
1053
|
_parse(input) {
|
952
1054
|
if (this._def.coerce) {
|
953
1055
|
input.data = String(input.data);
|
@@ -955,14 +1057,11 @@ var require_types_cjs_development = __commonJS({
|
|
955
1057
|
const parsedType = this._getType(input);
|
956
1058
|
if (parsedType !== ZodParsedType.string) {
|
957
1059
|
const ctx2 = this._getOrReturnCtx(input);
|
958
|
-
addIssueToContext(
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
received: ctx2.parsedType
|
964
|
-
}
|
965
|
-
);
|
1060
|
+
addIssueToContext(ctx2, {
|
1061
|
+
code: ZodIssueCode.invalid_type,
|
1062
|
+
expected: ZodParsedType.string,
|
1063
|
+
received: ctx2.parsedType
|
1064
|
+
});
|
966
1065
|
return INVALID;
|
967
1066
|
}
|
968
1067
|
const status = new ParseStatus();
|
@@ -1030,6 +1129,19 @@ var require_types_cjs_development = __commonJS({
|
|
1030
1129
|
});
|
1031
1130
|
status.dirty();
|
1032
1131
|
}
|
1132
|
+
} else if (check.kind === "emoji") {
|
1133
|
+
if (!emojiRegex) {
|
1134
|
+
emojiRegex = new RegExp(_emojiRegex, "u");
|
1135
|
+
}
|
1136
|
+
if (!emojiRegex.test(input.data)) {
|
1137
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
1138
|
+
addIssueToContext(ctx, {
|
1139
|
+
validation: "emoji",
|
1140
|
+
code: ZodIssueCode.invalid_string,
|
1141
|
+
message: check.message
|
1142
|
+
});
|
1143
|
+
status.dirty();
|
1144
|
+
}
|
1033
1145
|
} else if (check.kind === "uuid") {
|
1034
1146
|
if (!uuidRegex.test(input.data)) {
|
1035
1147
|
ctx = this._getOrReturnCtx(input, ctx);
|
@@ -1040,6 +1152,16 @@ var require_types_cjs_development = __commonJS({
|
|
1040
1152
|
});
|
1041
1153
|
status.dirty();
|
1042
1154
|
}
|
1155
|
+
} else if (check.kind === "nanoid") {
|
1156
|
+
if (!nanoidRegex.test(input.data)) {
|
1157
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
1158
|
+
addIssueToContext(ctx, {
|
1159
|
+
validation: "nanoid",
|
1160
|
+
code: ZodIssueCode.invalid_string,
|
1161
|
+
message: check.message
|
1162
|
+
});
|
1163
|
+
status.dirty();
|
1164
|
+
}
|
1043
1165
|
} else if (check.kind === "cuid") {
|
1044
1166
|
if (!cuidRegex.test(input.data)) {
|
1045
1167
|
ctx = this._getOrReturnCtx(input, ctx);
|
@@ -1050,6 +1172,26 @@ var require_types_cjs_development = __commonJS({
|
|
1050
1172
|
});
|
1051
1173
|
status.dirty();
|
1052
1174
|
}
|
1175
|
+
} else if (check.kind === "cuid2") {
|
1176
|
+
if (!cuid2Regex.test(input.data)) {
|
1177
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
1178
|
+
addIssueToContext(ctx, {
|
1179
|
+
validation: "cuid2",
|
1180
|
+
code: ZodIssueCode.invalid_string,
|
1181
|
+
message: check.message
|
1182
|
+
});
|
1183
|
+
status.dirty();
|
1184
|
+
}
|
1185
|
+
} else if (check.kind === "ulid") {
|
1186
|
+
if (!ulidRegex.test(input.data)) {
|
1187
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
1188
|
+
addIssueToContext(ctx, {
|
1189
|
+
validation: "ulid",
|
1190
|
+
code: ZodIssueCode.invalid_string,
|
1191
|
+
message: check.message
|
1192
|
+
});
|
1193
|
+
status.dirty();
|
1194
|
+
}
|
1053
1195
|
} else if (check.kind === "url") {
|
1054
1196
|
try {
|
1055
1197
|
new URL(input.data);
|
@@ -1076,6 +1218,20 @@ var require_types_cjs_development = __commonJS({
|
|
1076
1218
|
}
|
1077
1219
|
} else if (check.kind === "trim") {
|
1078
1220
|
input.data = input.data.trim();
|
1221
|
+
} else if (check.kind === "includes") {
|
1222
|
+
if (!input.data.includes(check.value, check.position)) {
|
1223
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
1224
|
+
addIssueToContext(ctx, {
|
1225
|
+
code: ZodIssueCode.invalid_string,
|
1226
|
+
validation: { includes: check.value, position: check.position },
|
1227
|
+
message: check.message
|
1228
|
+
});
|
1229
|
+
status.dirty();
|
1230
|
+
}
|
1231
|
+
} else if (check.kind === "toLowerCase") {
|
1232
|
+
input.data = input.data.toLowerCase();
|
1233
|
+
} else if (check.kind === "toUpperCase") {
|
1234
|
+
input.data = input.data.toUpperCase();
|
1079
1235
|
} else if (check.kind === "startsWith") {
|
1080
1236
|
if (!input.data.startsWith(check.value)) {
|
1081
1237
|
ctx = this._getOrReturnCtx(input, ctx);
|
@@ -1107,12 +1263,71 @@ var require_types_cjs_development = __commonJS({
|
|
1107
1263
|
});
|
1108
1264
|
status.dirty();
|
1109
1265
|
}
|
1266
|
+
} else if (check.kind === "date") {
|
1267
|
+
const regex = dateRegex;
|
1268
|
+
if (!regex.test(input.data)) {
|
1269
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
1270
|
+
addIssueToContext(ctx, {
|
1271
|
+
code: ZodIssueCode.invalid_string,
|
1272
|
+
validation: "date",
|
1273
|
+
message: check.message
|
1274
|
+
});
|
1275
|
+
status.dirty();
|
1276
|
+
}
|
1277
|
+
} else if (check.kind === "time") {
|
1278
|
+
const regex = timeRegex(check);
|
1279
|
+
if (!regex.test(input.data)) {
|
1280
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
1281
|
+
addIssueToContext(ctx, {
|
1282
|
+
code: ZodIssueCode.invalid_string,
|
1283
|
+
validation: "time",
|
1284
|
+
message: check.message
|
1285
|
+
});
|
1286
|
+
status.dirty();
|
1287
|
+
}
|
1288
|
+
} else if (check.kind === "duration") {
|
1289
|
+
if (!durationRegex.test(input.data)) {
|
1290
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
1291
|
+
addIssueToContext(ctx, {
|
1292
|
+
validation: "duration",
|
1293
|
+
code: ZodIssueCode.invalid_string,
|
1294
|
+
message: check.message
|
1295
|
+
});
|
1296
|
+
status.dirty();
|
1297
|
+
}
|
1298
|
+
} else if (check.kind === "ip") {
|
1299
|
+
if (!isValidIP(input.data, check.version)) {
|
1300
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
1301
|
+
addIssueToContext(ctx, {
|
1302
|
+
validation: "ip",
|
1303
|
+
code: ZodIssueCode.invalid_string,
|
1304
|
+
message: check.message
|
1305
|
+
});
|
1306
|
+
status.dirty();
|
1307
|
+
}
|
1308
|
+
} else if (check.kind === "base64") {
|
1309
|
+
if (!base64Regex.test(input.data)) {
|
1310
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
1311
|
+
addIssueToContext(ctx, {
|
1312
|
+
validation: "base64",
|
1313
|
+
code: ZodIssueCode.invalid_string,
|
1314
|
+
message: check.message
|
1315
|
+
});
|
1316
|
+
status.dirty();
|
1317
|
+
}
|
1110
1318
|
} else {
|
1111
1319
|
util.assertNever(check);
|
1112
1320
|
}
|
1113
1321
|
}
|
1114
1322
|
return { status: status.value, value: input.data };
|
1115
1323
|
}
|
1324
|
+
_regex(regex, validation, message) {
|
1325
|
+
return this.refinement((data) => regex.test(data), {
|
1326
|
+
validation,
|
1327
|
+
code: ZodIssueCode.invalid_string,
|
1328
|
+
...errorUtil.errToObj(message)
|
1329
|
+
});
|
1330
|
+
}
|
1116
1331
|
_addCheck(check) {
|
1117
1332
|
return new ZodString({
|
1118
1333
|
...this._def,
|
@@ -1125,19 +1340,38 @@ var require_types_cjs_development = __commonJS({
|
|
1125
1340
|
url(message) {
|
1126
1341
|
return this._addCheck({ kind: "url", ...errorUtil.errToObj(message) });
|
1127
1342
|
}
|
1343
|
+
emoji(message) {
|
1344
|
+
return this._addCheck({ kind: "emoji", ...errorUtil.errToObj(message) });
|
1345
|
+
}
|
1128
1346
|
uuid(message) {
|
1129
1347
|
return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) });
|
1130
1348
|
}
|
1349
|
+
nanoid(message) {
|
1350
|
+
return this._addCheck({ kind: "nanoid", ...errorUtil.errToObj(message) });
|
1351
|
+
}
|
1131
1352
|
cuid(message) {
|
1132
1353
|
return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
|
1133
1354
|
}
|
1355
|
+
cuid2(message) {
|
1356
|
+
return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
|
1357
|
+
}
|
1358
|
+
ulid(message) {
|
1359
|
+
return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) });
|
1360
|
+
}
|
1361
|
+
base64(message) {
|
1362
|
+
return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
|
1363
|
+
}
|
1364
|
+
ip(options) {
|
1365
|
+
return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
|
1366
|
+
}
|
1134
1367
|
datetime(options) {
|
1135
|
-
var _a;
|
1368
|
+
var _a, _b;
|
1136
1369
|
if (typeof options === "string") {
|
1137
1370
|
return this._addCheck({
|
1138
1371
|
kind: "datetime",
|
1139
1372
|
precision: null,
|
1140
1373
|
offset: false,
|
1374
|
+
local: false,
|
1141
1375
|
message: options
|
1142
1376
|
});
|
1143
1377
|
}
|
@@ -1145,9 +1379,30 @@ var require_types_cjs_development = __commonJS({
|
|
1145
1379
|
kind: "datetime",
|
1146
1380
|
precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
|
1147
1381
|
offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
|
1382
|
+
local: (_b = options === null || options === void 0 ? void 0 : options.local) !== null && _b !== void 0 ? _b : false,
|
1383
|
+
...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
|
1384
|
+
});
|
1385
|
+
}
|
1386
|
+
date(message) {
|
1387
|
+
return this._addCheck({ kind: "date", message });
|
1388
|
+
}
|
1389
|
+
time(options) {
|
1390
|
+
if (typeof options === "string") {
|
1391
|
+
return this._addCheck({
|
1392
|
+
kind: "time",
|
1393
|
+
precision: null,
|
1394
|
+
message: options
|
1395
|
+
});
|
1396
|
+
}
|
1397
|
+
return this._addCheck({
|
1398
|
+
kind: "time",
|
1399
|
+
precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
|
1148
1400
|
...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
|
1149
1401
|
});
|
1150
1402
|
}
|
1403
|
+
duration(message) {
|
1404
|
+
return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) });
|
1405
|
+
}
|
1151
1406
|
regex(regex, message) {
|
1152
1407
|
return this._addCheck({
|
1153
1408
|
kind: "regex",
|
@@ -1155,6 +1410,14 @@ var require_types_cjs_development = __commonJS({
|
|
1155
1410
|
...errorUtil.errToObj(message)
|
1156
1411
|
});
|
1157
1412
|
}
|
1413
|
+
includes(value, options) {
|
1414
|
+
return this._addCheck({
|
1415
|
+
kind: "includes",
|
1416
|
+
value,
|
1417
|
+
position: options === null || options === void 0 ? void 0 : options.position,
|
1418
|
+
...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
|
1419
|
+
});
|
1420
|
+
}
|
1158
1421
|
startsWith(value, message) {
|
1159
1422
|
return this._addCheck({
|
1160
1423
|
kind: "startsWith",
|
@@ -1190,21 +1453,69 @@ var require_types_cjs_development = __commonJS({
|
|
1190
1453
|
...errorUtil.errToObj(message)
|
1191
1454
|
});
|
1192
1455
|
}
|
1456
|
+
nonempty(message) {
|
1457
|
+
return this.min(1, errorUtil.errToObj(message));
|
1458
|
+
}
|
1459
|
+
trim() {
|
1460
|
+
return new ZodString({
|
1461
|
+
...this._def,
|
1462
|
+
checks: [...this._def.checks, { kind: "trim" }]
|
1463
|
+
});
|
1464
|
+
}
|
1465
|
+
toLowerCase() {
|
1466
|
+
return new ZodString({
|
1467
|
+
...this._def,
|
1468
|
+
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
1469
|
+
});
|
1470
|
+
}
|
1471
|
+
toUpperCase() {
|
1472
|
+
return new ZodString({
|
1473
|
+
...this._def,
|
1474
|
+
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
1475
|
+
});
|
1476
|
+
}
|
1193
1477
|
get isDatetime() {
|
1194
1478
|
return !!this._def.checks.find((ch) => ch.kind === "datetime");
|
1195
1479
|
}
|
1480
|
+
get isDate() {
|
1481
|
+
return !!this._def.checks.find((ch) => ch.kind === "date");
|
1482
|
+
}
|
1483
|
+
get isTime() {
|
1484
|
+
return !!this._def.checks.find((ch) => ch.kind === "time");
|
1485
|
+
}
|
1486
|
+
get isDuration() {
|
1487
|
+
return !!this._def.checks.find((ch) => ch.kind === "duration");
|
1488
|
+
}
|
1196
1489
|
get isEmail() {
|
1197
1490
|
return !!this._def.checks.find((ch) => ch.kind === "email");
|
1198
1491
|
}
|
1199
1492
|
get isURL() {
|
1200
1493
|
return !!this._def.checks.find((ch) => ch.kind === "url");
|
1201
1494
|
}
|
1495
|
+
get isEmoji() {
|
1496
|
+
return !!this._def.checks.find((ch) => ch.kind === "emoji");
|
1497
|
+
}
|
1202
1498
|
get isUUID() {
|
1203
1499
|
return !!this._def.checks.find((ch) => ch.kind === "uuid");
|
1204
1500
|
}
|
1501
|
+
get isNANOID() {
|
1502
|
+
return !!this._def.checks.find((ch) => ch.kind === "nanoid");
|
1503
|
+
}
|
1205
1504
|
get isCUID() {
|
1206
1505
|
return !!this._def.checks.find((ch) => ch.kind === "cuid");
|
1207
1506
|
}
|
1507
|
+
get isCUID2() {
|
1508
|
+
return !!this._def.checks.find((ch) => ch.kind === "cuid2");
|
1509
|
+
}
|
1510
|
+
get isULID() {
|
1511
|
+
return !!this._def.checks.find((ch) => ch.kind === "ulid");
|
1512
|
+
}
|
1513
|
+
get isIP() {
|
1514
|
+
return !!this._def.checks.find((ch) => ch.kind === "ip");
|
1515
|
+
}
|
1516
|
+
get isBase64() {
|
1517
|
+
return !!this._def.checks.find((ch) => ch.kind === "base64");
|
1518
|
+
}
|
1208
1519
|
get minLength() {
|
1209
1520
|
let min = null;
|
1210
1521
|
for (const ch of this._def.checks) {
|
@@ -1418,6 +1729,19 @@ var require_types_cjs_development = __commonJS({
|
|
1418
1729
|
message: errorUtil.toString(message)
|
1419
1730
|
});
|
1420
1731
|
}
|
1732
|
+
safe(message) {
|
1733
|
+
return this._addCheck({
|
1734
|
+
kind: "min",
|
1735
|
+
inclusive: true,
|
1736
|
+
value: Number.MIN_SAFE_INTEGER,
|
1737
|
+
message: errorUtil.toString(message)
|
1738
|
+
})._addCheck({
|
1739
|
+
kind: "max",
|
1740
|
+
inclusive: true,
|
1741
|
+
value: Number.MAX_SAFE_INTEGER,
|
1742
|
+
message: errorUtil.toString(message)
|
1743
|
+
});
|
1744
|
+
}
|
1421
1745
|
get minValue() {
|
1422
1746
|
let min = null;
|
1423
1747
|
for (const ch of this._def.checks) {
|
@@ -1439,7 +1763,22 @@ var require_types_cjs_development = __commonJS({
|
|
1439
1763
|
return max;
|
1440
1764
|
}
|
1441
1765
|
get isInt() {
|
1442
|
-
return !!this._def.checks.find((ch) => ch.kind === "int");
|
1766
|
+
return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
|
1767
|
+
}
|
1768
|
+
get isFinite() {
|
1769
|
+
let max = null, min = null;
|
1770
|
+
for (const ch of this._def.checks) {
|
1771
|
+
if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
|
1772
|
+
return true;
|
1773
|
+
} else if (ch.kind === "min") {
|
1774
|
+
if (min === null || ch.value > min)
|
1775
|
+
min = ch.value;
|
1776
|
+
} else if (ch.kind === "max") {
|
1777
|
+
if (max === null || ch.value < max)
|
1778
|
+
max = ch.value;
|
1779
|
+
}
|
1780
|
+
}
|
1781
|
+
return Number.isFinite(min) && Number.isFinite(max);
|
1443
1782
|
}
|
1444
1783
|
}, "ZodNumber");
|
1445
1784
|
__name22(ZodNumber, "ZodNumber");
|
@@ -1452,27 +1791,167 @@ var require_types_cjs_development = __commonJS({
|
|
1452
1791
|
});
|
1453
1792
|
};
|
1454
1793
|
var ZodBigInt = /* @__PURE__ */ __name2(class extends ZodType {
|
1794
|
+
constructor() {
|
1795
|
+
super(...arguments);
|
1796
|
+
this.min = this.gte;
|
1797
|
+
this.max = this.lte;
|
1798
|
+
}
|
1455
1799
|
_parse(input) {
|
1456
1800
|
if (this._def.coerce) {
|
1457
1801
|
input.data = BigInt(input.data);
|
1458
1802
|
}
|
1459
1803
|
const parsedType = this._getType(input);
|
1460
1804
|
if (parsedType !== ZodParsedType.bigint) {
|
1461
|
-
const
|
1462
|
-
addIssueToContext(
|
1805
|
+
const ctx2 = this._getOrReturnCtx(input);
|
1806
|
+
addIssueToContext(ctx2, {
|
1463
1807
|
code: ZodIssueCode.invalid_type,
|
1464
1808
|
expected: ZodParsedType.bigint,
|
1465
|
-
received:
|
1809
|
+
received: ctx2.parsedType
|
1466
1810
|
});
|
1467
1811
|
return INVALID;
|
1468
1812
|
}
|
1469
|
-
|
1813
|
+
let ctx = void 0;
|
1814
|
+
const status = new ParseStatus();
|
1815
|
+
for (const check of this._def.checks) {
|
1816
|
+
if (check.kind === "min") {
|
1817
|
+
const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
|
1818
|
+
if (tooSmall) {
|
1819
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
1820
|
+
addIssueToContext(ctx, {
|
1821
|
+
code: ZodIssueCode.too_small,
|
1822
|
+
type: "bigint",
|
1823
|
+
minimum: check.value,
|
1824
|
+
inclusive: check.inclusive,
|
1825
|
+
message: check.message
|
1826
|
+
});
|
1827
|
+
status.dirty();
|
1828
|
+
}
|
1829
|
+
} else if (check.kind === "max") {
|
1830
|
+
const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
|
1831
|
+
if (tooBig) {
|
1832
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
1833
|
+
addIssueToContext(ctx, {
|
1834
|
+
code: ZodIssueCode.too_big,
|
1835
|
+
type: "bigint",
|
1836
|
+
maximum: check.value,
|
1837
|
+
inclusive: check.inclusive,
|
1838
|
+
message: check.message
|
1839
|
+
});
|
1840
|
+
status.dirty();
|
1841
|
+
}
|
1842
|
+
} else if (check.kind === "multipleOf") {
|
1843
|
+
if (input.data % check.value !== BigInt(0)) {
|
1844
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
1845
|
+
addIssueToContext(ctx, {
|
1846
|
+
code: ZodIssueCode.not_multiple_of,
|
1847
|
+
multipleOf: check.value,
|
1848
|
+
message: check.message
|
1849
|
+
});
|
1850
|
+
status.dirty();
|
1851
|
+
}
|
1852
|
+
} else {
|
1853
|
+
util.assertNever(check);
|
1854
|
+
}
|
1855
|
+
}
|
1856
|
+
return { status: status.value, value: input.data };
|
1857
|
+
}
|
1858
|
+
gte(value, message) {
|
1859
|
+
return this.setLimit("min", value, true, errorUtil.toString(message));
|
1860
|
+
}
|
1861
|
+
gt(value, message) {
|
1862
|
+
return this.setLimit("min", value, false, errorUtil.toString(message));
|
1863
|
+
}
|
1864
|
+
lte(value, message) {
|
1865
|
+
return this.setLimit("max", value, true, errorUtil.toString(message));
|
1866
|
+
}
|
1867
|
+
lt(value, message) {
|
1868
|
+
return this.setLimit("max", value, false, errorUtil.toString(message));
|
1869
|
+
}
|
1870
|
+
setLimit(kind, value, inclusive, message) {
|
1871
|
+
return new ZodBigInt({
|
1872
|
+
...this._def,
|
1873
|
+
checks: [
|
1874
|
+
...this._def.checks,
|
1875
|
+
{
|
1876
|
+
kind,
|
1877
|
+
value,
|
1878
|
+
inclusive,
|
1879
|
+
message: errorUtil.toString(message)
|
1880
|
+
}
|
1881
|
+
]
|
1882
|
+
});
|
1883
|
+
}
|
1884
|
+
_addCheck(check) {
|
1885
|
+
return new ZodBigInt({
|
1886
|
+
...this._def,
|
1887
|
+
checks: [...this._def.checks, check]
|
1888
|
+
});
|
1889
|
+
}
|
1890
|
+
positive(message) {
|
1891
|
+
return this._addCheck({
|
1892
|
+
kind: "min",
|
1893
|
+
value: BigInt(0),
|
1894
|
+
inclusive: false,
|
1895
|
+
message: errorUtil.toString(message)
|
1896
|
+
});
|
1897
|
+
}
|
1898
|
+
negative(message) {
|
1899
|
+
return this._addCheck({
|
1900
|
+
kind: "max",
|
1901
|
+
value: BigInt(0),
|
1902
|
+
inclusive: false,
|
1903
|
+
message: errorUtil.toString(message)
|
1904
|
+
});
|
1905
|
+
}
|
1906
|
+
nonpositive(message) {
|
1907
|
+
return this._addCheck({
|
1908
|
+
kind: "max",
|
1909
|
+
value: BigInt(0),
|
1910
|
+
inclusive: true,
|
1911
|
+
message: errorUtil.toString(message)
|
1912
|
+
});
|
1913
|
+
}
|
1914
|
+
nonnegative(message) {
|
1915
|
+
return this._addCheck({
|
1916
|
+
kind: "min",
|
1917
|
+
value: BigInt(0),
|
1918
|
+
inclusive: true,
|
1919
|
+
message: errorUtil.toString(message)
|
1920
|
+
});
|
1921
|
+
}
|
1922
|
+
multipleOf(value, message) {
|
1923
|
+
return this._addCheck({
|
1924
|
+
kind: "multipleOf",
|
1925
|
+
value,
|
1926
|
+
message: errorUtil.toString(message)
|
1927
|
+
});
|
1928
|
+
}
|
1929
|
+
get minValue() {
|
1930
|
+
let min = null;
|
1931
|
+
for (const ch of this._def.checks) {
|
1932
|
+
if (ch.kind === "min") {
|
1933
|
+
if (min === null || ch.value > min)
|
1934
|
+
min = ch.value;
|
1935
|
+
}
|
1936
|
+
}
|
1937
|
+
return min;
|
1938
|
+
}
|
1939
|
+
get maxValue() {
|
1940
|
+
let max = null;
|
1941
|
+
for (const ch of this._def.checks) {
|
1942
|
+
if (ch.kind === "max") {
|
1943
|
+
if (max === null || ch.value < max)
|
1944
|
+
max = ch.value;
|
1945
|
+
}
|
1946
|
+
}
|
1947
|
+
return max;
|
1470
1948
|
}
|
1471
1949
|
}, "ZodBigInt");
|
1472
1950
|
__name22(ZodBigInt, "ZodBigInt");
|
1473
1951
|
ZodBigInt.create = (params) => {
|
1474
1952
|
var _a;
|
1475
1953
|
return new ZodBigInt({
|
1954
|
+
checks: [],
|
1476
1955
|
typeName: ZodFirstPartyTypeKind.ZodBigInt,
|
1477
1956
|
coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
|
1478
1957
|
...processCreateParams(params)
|
@@ -1807,13 +2286,13 @@ var require_types_cjs_development = __commonJS({
|
|
1807
2286
|
}
|
1808
2287
|
}
|
1809
2288
|
if (ctx.common.async) {
|
1810
|
-
return Promise.all(ctx.data.map((item, i) => {
|
2289
|
+
return Promise.all([...ctx.data].map((item, i) => {
|
1811
2290
|
return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
|
1812
2291
|
})).then((result2) => {
|
1813
2292
|
return ParseStatus.mergeArray(status, result2);
|
1814
2293
|
});
|
1815
2294
|
}
|
1816
|
-
const result = ctx.data.map((item, i) => {
|
2295
|
+
const result = [...ctx.data].map((item, i) => {
|
1817
2296
|
return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
|
1818
2297
|
});
|
1819
2298
|
return ParseStatus.mergeArray(status, result);
|
@@ -1854,24 +2333,6 @@ var require_types_cjs_development = __commonJS({
|
|
1854
2333
|
...processCreateParams(params)
|
1855
2334
|
});
|
1856
2335
|
};
|
1857
|
-
var objectUtil;
|
1858
|
-
(function(objectUtil2) {
|
1859
|
-
objectUtil2.mergeShapes = (first, second) => {
|
1860
|
-
return {
|
1861
|
-
...first,
|
1862
|
-
...second
|
1863
|
-
};
|
1864
|
-
};
|
1865
|
-
})(objectUtil || (objectUtil = {}));
|
1866
|
-
var AugmentFactory = /* @__PURE__ */ __name22((def) => (augmentation) => {
|
1867
|
-
return new ZodObject({
|
1868
|
-
...def,
|
1869
|
-
shape: () => ({
|
1870
|
-
...def.shape(),
|
1871
|
-
...augmentation
|
1872
|
-
})
|
1873
|
-
});
|
1874
|
-
}, "AugmentFactory");
|
1875
2336
|
function deepPartialify(schema) {
|
1876
2337
|
if (schema instanceof ZodObject) {
|
1877
2338
|
const newShape = {};
|
@@ -1884,7 +2345,10 @@ var require_types_cjs_development = __commonJS({
|
|
1884
2345
|
shape: () => newShape
|
1885
2346
|
});
|
1886
2347
|
} else if (schema instanceof ZodArray) {
|
1887
|
-
return ZodArray
|
2348
|
+
return new ZodArray({
|
2349
|
+
...schema._def,
|
2350
|
+
type: deepPartialify(schema.element)
|
2351
|
+
});
|
1888
2352
|
} else if (schema instanceof ZodOptional) {
|
1889
2353
|
return ZodOptional.create(deepPartialify(schema.unwrap()));
|
1890
2354
|
} else if (schema instanceof ZodNullable) {
|
@@ -1903,8 +2367,7 @@ var require_types_cjs_development = __commonJS({
|
|
1903
2367
|
super(...arguments);
|
1904
2368
|
this._cached = null;
|
1905
2369
|
this.nonstrict = this.passthrough;
|
1906
|
-
this.augment =
|
1907
|
-
this.extend = AugmentFactory(this._def);
|
2370
|
+
this.augment = this.extend;
|
1908
2371
|
}
|
1909
2372
|
_getCached() {
|
1910
2373
|
if (this._cached !== null)
|
@@ -1984,9 +2447,10 @@ var require_types_cjs_development = __commonJS({
|
|
1984
2447
|
const syncPairs = [];
|
1985
2448
|
for (const pair of pairs) {
|
1986
2449
|
const key = await pair.key;
|
2450
|
+
const value = await pair.value;
|
1987
2451
|
syncPairs.push({
|
1988
2452
|
key,
|
1989
|
-
value
|
2453
|
+
value,
|
1990
2454
|
alwaysSet: pair.alwaysSet
|
1991
2455
|
});
|
1992
2456
|
}
|
@@ -2033,18 +2497,30 @@ var require_types_cjs_development = __commonJS({
|
|
2033
2497
|
unknownKeys: "passthrough"
|
2034
2498
|
});
|
2035
2499
|
}
|
2036
|
-
|
2037
|
-
return
|
2500
|
+
extend(augmentation) {
|
2501
|
+
return new ZodObject({
|
2502
|
+
...this._def,
|
2503
|
+
shape: () => ({
|
2504
|
+
...this._def.shape(),
|
2505
|
+
...augmentation
|
2506
|
+
})
|
2507
|
+
});
|
2038
2508
|
}
|
2039
2509
|
merge(merging) {
|
2040
2510
|
const merged = new ZodObject({
|
2041
2511
|
unknownKeys: merging._def.unknownKeys,
|
2042
2512
|
catchall: merging._def.catchall,
|
2043
|
-
shape: () =>
|
2513
|
+
shape: () => ({
|
2514
|
+
...this._def.shape(),
|
2515
|
+
...merging._def.shape()
|
2516
|
+
}),
|
2044
2517
|
typeName: ZodFirstPartyTypeKind.ZodObject
|
2045
2518
|
});
|
2046
2519
|
return merged;
|
2047
2520
|
}
|
2521
|
+
setKey(key, schema) {
|
2522
|
+
return this.augment({ [key]: schema });
|
2523
|
+
}
|
2048
2524
|
catchall(index) {
|
2049
2525
|
return new ZodObject({
|
2050
2526
|
...this._def,
|
@@ -2053,9 +2529,10 @@ var require_types_cjs_development = __commonJS({
|
|
2053
2529
|
}
|
2054
2530
|
pick(mask) {
|
2055
2531
|
const shape = {};
|
2056
|
-
util.objectKeys(mask).
|
2057
|
-
if (this.shape[key])
|
2532
|
+
util.objectKeys(mask).forEach((key) => {
|
2533
|
+
if (mask[key] && this.shape[key]) {
|
2058
2534
|
shape[key] = this.shape[key];
|
2535
|
+
}
|
2059
2536
|
});
|
2060
2537
|
return new ZodObject({
|
2061
2538
|
...this._def,
|
@@ -2064,8 +2541,8 @@ var require_types_cjs_development = __commonJS({
|
|
2064
2541
|
}
|
2065
2542
|
omit(mask) {
|
2066
2543
|
const shape = {};
|
2067
|
-
util.objectKeys(this.shape).
|
2068
|
-
if (
|
2544
|
+
util.objectKeys(this.shape).forEach((key) => {
|
2545
|
+
if (!mask[key]) {
|
2069
2546
|
shape[key] = this.shape[key];
|
2070
2547
|
}
|
2071
2548
|
});
|
@@ -2079,24 +2556,14 @@ var require_types_cjs_development = __commonJS({
|
|
2079
2556
|
}
|
2080
2557
|
partial(mask) {
|
2081
2558
|
const newShape = {};
|
2082
|
-
|
2083
|
-
|
2084
|
-
|
2085
|
-
|
2086
|
-
|
2087
|
-
newShape[key] = this.shape[key].optional();
|
2088
|
-
}
|
2089
|
-
});
|
2090
|
-
return new ZodObject({
|
2091
|
-
...this._def,
|
2092
|
-
shape: () => newShape
|
2093
|
-
});
|
2094
|
-
} else {
|
2095
|
-
for (const key in this.shape) {
|
2096
|
-
const fieldSchema = this.shape[key];
|
2559
|
+
util.objectKeys(this.shape).forEach((key) => {
|
2560
|
+
const fieldSchema = this.shape[key];
|
2561
|
+
if (mask && !mask[key]) {
|
2562
|
+
newShape[key] = fieldSchema;
|
2563
|
+
} else {
|
2097
2564
|
newShape[key] = fieldSchema.optional();
|
2098
2565
|
}
|
2099
|
-
}
|
2566
|
+
});
|
2100
2567
|
return new ZodObject({
|
2101
2568
|
...this._def,
|
2102
2569
|
shape: () => newShape
|
@@ -2104,21 +2571,10 @@ var require_types_cjs_development = __commonJS({
|
|
2104
2571
|
}
|
2105
2572
|
required(mask) {
|
2106
2573
|
const newShape = {};
|
2107
|
-
|
2108
|
-
|
2109
|
-
|
2110
|
-
|
2111
|
-
} else {
|
2112
|
-
const fieldSchema = this.shape[key];
|
2113
|
-
let newField = fieldSchema;
|
2114
|
-
while (newField instanceof ZodOptional) {
|
2115
|
-
newField = newField._def.innerType;
|
2116
|
-
}
|
2117
|
-
newShape[key] = newField;
|
2118
|
-
}
|
2119
|
-
});
|
2120
|
-
} else {
|
2121
|
-
for (const key in this.shape) {
|
2574
|
+
util.objectKeys(this.shape).forEach((key) => {
|
2575
|
+
if (mask && !mask[key]) {
|
2576
|
+
newShape[key] = this.shape[key];
|
2577
|
+
} else {
|
2122
2578
|
const fieldSchema = this.shape[key];
|
2123
2579
|
let newField = fieldSchema;
|
2124
2580
|
while (newField instanceof ZodOptional) {
|
@@ -2126,7 +2582,7 @@ var require_types_cjs_development = __commonJS({
|
|
2126
2582
|
}
|
2127
2583
|
newShape[key] = newField;
|
2128
2584
|
}
|
2129
|
-
}
|
2585
|
+
});
|
2130
2586
|
return new ZodObject({
|
2131
2587
|
...this._def,
|
2132
2588
|
shape: () => newShape
|
@@ -2269,15 +2725,25 @@ var require_types_cjs_development = __commonJS({
|
|
2269
2725
|
} else if (type instanceof ZodEnum) {
|
2270
2726
|
return type.options;
|
2271
2727
|
} else if (type instanceof ZodNativeEnum) {
|
2272
|
-
return
|
2728
|
+
return util.objectValues(type.enum);
|
2273
2729
|
} else if (type instanceof ZodDefault) {
|
2274
2730
|
return getDiscriminator(type._def.innerType);
|
2275
2731
|
} else if (type instanceof ZodUndefined) {
|
2276
2732
|
return [void 0];
|
2277
2733
|
} else if (type instanceof ZodNull) {
|
2278
2734
|
return [null];
|
2735
|
+
} else if (type instanceof ZodOptional) {
|
2736
|
+
return [void 0, ...getDiscriminator(type.unwrap())];
|
2737
|
+
} else if (type instanceof ZodNullable) {
|
2738
|
+
return [null, ...getDiscriminator(type.unwrap())];
|
2739
|
+
} else if (type instanceof ZodBranded) {
|
2740
|
+
return getDiscriminator(type.unwrap());
|
2741
|
+
} else if (type instanceof ZodReadonly) {
|
2742
|
+
return getDiscriminator(type.unwrap());
|
2743
|
+
} else if (type instanceof ZodCatch) {
|
2744
|
+
return getDiscriminator(type._def.innerType);
|
2279
2745
|
} else {
|
2280
|
-
return
|
2746
|
+
return [];
|
2281
2747
|
}
|
2282
2748
|
}, "getDiscriminator");
|
2283
2749
|
var ZodDiscriminatedUnion = /* @__PURE__ */ __name2(class extends ZodType {
|
@@ -2329,7 +2795,7 @@ var require_types_cjs_development = __commonJS({
|
|
2329
2795
|
const optionsMap = /* @__PURE__ */ new Map();
|
2330
2796
|
for (const type of options) {
|
2331
2797
|
const discriminatorValues = getDiscriminator(type.shape[discriminator]);
|
2332
|
-
if (!discriminatorValues) {
|
2798
|
+
if (!discriminatorValues.length) {
|
2333
2799
|
throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
|
2334
2800
|
}
|
2335
2801
|
for (const value of discriminatorValues) {
|
@@ -2476,7 +2942,7 @@ var require_types_cjs_development = __commonJS({
|
|
2476
2942
|
});
|
2477
2943
|
status.dirty();
|
2478
2944
|
}
|
2479
|
-
const items = ctx.data.map((item, itemIndex) => {
|
2945
|
+
const items = [...ctx.data].map((item, itemIndex) => {
|
2480
2946
|
const schema = this._def.items[itemIndex] || this._def.rest;
|
2481
2947
|
if (!schema)
|
2482
2948
|
return null;
|
@@ -2535,7 +3001,8 @@ var require_types_cjs_development = __commonJS({
|
|
2535
3001
|
for (const key in ctx.data) {
|
2536
3002
|
pairs.push({
|
2537
3003
|
key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
|
2538
|
-
value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key))
|
3004
|
+
value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),
|
3005
|
+
alwaysSet: key in ctx.data
|
2539
3006
|
});
|
2540
3007
|
}
|
2541
3008
|
if (ctx.common.async) {
|
@@ -2566,6 +3033,12 @@ var require_types_cjs_development = __commonJS({
|
|
2566
3033
|
}, "ZodRecord");
|
2567
3034
|
__name22(ZodRecord, "ZodRecord");
|
2568
3035
|
var ZodMap = /* @__PURE__ */ __name2(class extends ZodType {
|
3036
|
+
get keySchema() {
|
3037
|
+
return this._def.keyType;
|
3038
|
+
}
|
3039
|
+
get valueSchema() {
|
3040
|
+
return this._def.valueType;
|
3041
|
+
}
|
2569
3042
|
_parse(input) {
|
2570
3043
|
const { status, ctx } = this._processInputParams(input);
|
2571
3044
|
if (ctx.parsedType !== ZodParsedType.map) {
|
@@ -2771,27 +3244,29 @@ var require_types_cjs_development = __commonJS({
|
|
2771
3244
|
const params = { errorMap: ctx.common.contextualErrorMap };
|
2772
3245
|
const fn = ctx.data;
|
2773
3246
|
if (this._def.returns instanceof ZodPromise) {
|
2774
|
-
|
3247
|
+
const me = this;
|
3248
|
+
return OK(async function(...args) {
|
2775
3249
|
const error = new ZodError([]);
|
2776
|
-
const parsedArgs = await
|
3250
|
+
const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
|
2777
3251
|
error.addIssue(makeArgsIssue(args, e));
|
2778
3252
|
throw error;
|
2779
3253
|
});
|
2780
|
-
const result = await fn
|
2781
|
-
const parsedReturns = await
|
3254
|
+
const result = await Reflect.apply(fn, this, parsedArgs);
|
3255
|
+
const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e) => {
|
2782
3256
|
error.addIssue(makeReturnsIssue(result, e));
|
2783
3257
|
throw error;
|
2784
3258
|
});
|
2785
3259
|
return parsedReturns;
|
2786
3260
|
});
|
2787
3261
|
} else {
|
2788
|
-
|
2789
|
-
|
3262
|
+
const me = this;
|
3263
|
+
return OK(function(...args) {
|
3264
|
+
const parsedArgs = me._def.args.safeParse(args, params);
|
2790
3265
|
if (!parsedArgs.success) {
|
2791
3266
|
throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
|
2792
3267
|
}
|
2793
|
-
const result = fn
|
2794
|
-
const parsedReturns =
|
3268
|
+
const result = Reflect.apply(fn, this, parsedArgs.data);
|
3269
|
+
const parsedReturns = me._def.returns.safeParse(result, params);
|
2795
3270
|
if (!parsedReturns.success) {
|
2796
3271
|
throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
|
2797
3272
|
}
|
@@ -2858,6 +3333,7 @@ var require_types_cjs_development = __commonJS({
|
|
2858
3333
|
if (input.data !== this._def.value) {
|
2859
3334
|
const ctx = this._getOrReturnCtx(input);
|
2860
3335
|
addIssueToContext(ctx, {
|
3336
|
+
received: ctx.data,
|
2861
3337
|
code: ZodIssueCode.invalid_literal,
|
2862
3338
|
expected: this._def.value
|
2863
3339
|
});
|
@@ -2888,6 +3364,10 @@ var require_types_cjs_development = __commonJS({
|
|
2888
3364
|
__name2(createZodEnum, "createZodEnum");
|
2889
3365
|
__name22(createZodEnum, "createZodEnum");
|
2890
3366
|
var ZodEnum = /* @__PURE__ */ __name2(class extends ZodType {
|
3367
|
+
constructor() {
|
3368
|
+
super(...arguments);
|
3369
|
+
_ZodEnum_cache.set(this, void 0);
|
3370
|
+
}
|
2891
3371
|
_parse(input) {
|
2892
3372
|
if (typeof input.data !== "string") {
|
2893
3373
|
const ctx = this._getOrReturnCtx(input);
|
@@ -2899,7 +3379,10 @@ var require_types_cjs_development = __commonJS({
|
|
2899
3379
|
});
|
2900
3380
|
return INVALID;
|
2901
3381
|
}
|
2902
|
-
if (this
|
3382
|
+
if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f")) {
|
3383
|
+
__classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values), "f");
|
3384
|
+
}
|
3385
|
+
if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f").has(input.data)) {
|
2903
3386
|
const ctx = this._getOrReturnCtx(input);
|
2904
3387
|
const expectedValues = this._def.values;
|
2905
3388
|
addIssueToContext(ctx, {
|
@@ -2935,10 +3418,27 @@ var require_types_cjs_development = __commonJS({
|
|
2935
3418
|
}
|
2936
3419
|
return enumValues;
|
2937
3420
|
}
|
3421
|
+
extract(values, newDef = this._def) {
|
3422
|
+
return ZodEnum.create(values, {
|
3423
|
+
...this._def,
|
3424
|
+
...newDef
|
3425
|
+
});
|
3426
|
+
}
|
3427
|
+
exclude(values, newDef = this._def) {
|
3428
|
+
return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {
|
3429
|
+
...this._def,
|
3430
|
+
...newDef
|
3431
|
+
});
|
3432
|
+
}
|
2938
3433
|
}, "ZodEnum");
|
2939
3434
|
__name22(ZodEnum, "ZodEnum");
|
3435
|
+
_ZodEnum_cache = /* @__PURE__ */ new WeakMap();
|
2940
3436
|
ZodEnum.create = createZodEnum;
|
2941
3437
|
var ZodNativeEnum = /* @__PURE__ */ __name2(class extends ZodType {
|
3438
|
+
constructor() {
|
3439
|
+
super(...arguments);
|
3440
|
+
_ZodNativeEnum_cache.set(this, void 0);
|
3441
|
+
}
|
2942
3442
|
_parse(input) {
|
2943
3443
|
const nativeEnumValues = util.getValidEnumValues(this._def.values);
|
2944
3444
|
const ctx = this._getOrReturnCtx(input);
|
@@ -2951,7 +3451,10 @@ var require_types_cjs_development = __commonJS({
|
|
2951
3451
|
});
|
2952
3452
|
return INVALID;
|
2953
3453
|
}
|
2954
|
-
if (
|
3454
|
+
if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f")) {
|
3455
|
+
__classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util.getValidEnumValues(this._def.values)), "f");
|
3456
|
+
}
|
3457
|
+
if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f").has(input.data)) {
|
2955
3458
|
const expectedValues = util.objectValues(nativeEnumValues);
|
2956
3459
|
addIssueToContext(ctx, {
|
2957
3460
|
received: ctx.data,
|
@@ -2967,6 +3470,7 @@ var require_types_cjs_development = __commonJS({
|
|
2967
3470
|
}
|
2968
3471
|
}, "ZodNativeEnum");
|
2969
3472
|
__name22(ZodNativeEnum, "ZodNativeEnum");
|
3473
|
+
_ZodNativeEnum_cache = /* @__PURE__ */ new WeakMap();
|
2970
3474
|
ZodNativeEnum.create = (values, params) => {
|
2971
3475
|
return new ZodNativeEnum({
|
2972
3476
|
values,
|
@@ -2975,6 +3479,9 @@ var require_types_cjs_development = __commonJS({
|
|
2975
3479
|
});
|
2976
3480
|
};
|
2977
3481
|
var ZodPromise = /* @__PURE__ */ __name2(class extends ZodType {
|
3482
|
+
unwrap() {
|
3483
|
+
return this._def.type;
|
3484
|
+
}
|
2978
3485
|
_parse(input) {
|
2979
3486
|
const { ctx } = this._processInputParams(input);
|
2980
3487
|
if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
|
@@ -3012,24 +3519,6 @@ var require_types_cjs_development = __commonJS({
|
|
3012
3519
|
_parse(input) {
|
3013
3520
|
const { status, ctx } = this._processInputParams(input);
|
3014
3521
|
const effect = this._def.effect || null;
|
3015
|
-
if (effect.type === "preprocess") {
|
3016
|
-
const processed = effect.transform(ctx.data);
|
3017
|
-
if (ctx.common.async) {
|
3018
|
-
return Promise.resolve(processed).then((processed2) => {
|
3019
|
-
return this._def.schema._parseAsync({
|
3020
|
-
data: processed2,
|
3021
|
-
path: ctx.path,
|
3022
|
-
parent: ctx
|
3023
|
-
});
|
3024
|
-
});
|
3025
|
-
} else {
|
3026
|
-
return this._def.schema._parseSync({
|
3027
|
-
data: processed,
|
3028
|
-
path: ctx.path,
|
3029
|
-
parent: ctx
|
3030
|
-
});
|
3031
|
-
}
|
3032
|
-
}
|
3033
3522
|
const checkCtx = {
|
3034
3523
|
addIssue: (arg) => {
|
3035
3524
|
addIssueToContext(ctx, arg);
|
@@ -3044,6 +3533,42 @@ var require_types_cjs_development = __commonJS({
|
|
3044
3533
|
}
|
3045
3534
|
};
|
3046
3535
|
checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
|
3536
|
+
if (effect.type === "preprocess") {
|
3537
|
+
const processed = effect.transform(ctx.data, checkCtx);
|
3538
|
+
if (ctx.common.async) {
|
3539
|
+
return Promise.resolve(processed).then(async (processed2) => {
|
3540
|
+
if (status.value === "aborted")
|
3541
|
+
return INVALID;
|
3542
|
+
const result = await this._def.schema._parseAsync({
|
3543
|
+
data: processed2,
|
3544
|
+
path: ctx.path,
|
3545
|
+
parent: ctx
|
3546
|
+
});
|
3547
|
+
if (result.status === "aborted")
|
3548
|
+
return INVALID;
|
3549
|
+
if (result.status === "dirty")
|
3550
|
+
return DIRTY(result.value);
|
3551
|
+
if (status.value === "dirty")
|
3552
|
+
return DIRTY(result.value);
|
3553
|
+
return result;
|
3554
|
+
});
|
3555
|
+
} else {
|
3556
|
+
if (status.value === "aborted")
|
3557
|
+
return INVALID;
|
3558
|
+
const result = this._def.schema._parseSync({
|
3559
|
+
data: processed,
|
3560
|
+
path: ctx.path,
|
3561
|
+
parent: ctx
|
3562
|
+
});
|
3563
|
+
if (result.status === "aborted")
|
3564
|
+
return INVALID;
|
3565
|
+
if (result.status === "dirty")
|
3566
|
+
return DIRTY(result.value);
|
3567
|
+
if (status.value === "dirty")
|
3568
|
+
return DIRTY(result.value);
|
3569
|
+
return result;
|
3570
|
+
}
|
3571
|
+
}
|
3047
3572
|
if (effect.type === "refinement") {
|
3048
3573
|
const executeRefinement = /* @__PURE__ */ __name22((acc) => {
|
3049
3574
|
const result = effect.refinement(acc, checkCtx);
|
@@ -3190,26 +3715,45 @@ var require_types_cjs_development = __commonJS({
|
|
3190
3715
|
var ZodCatch = /* @__PURE__ */ __name2(class extends ZodType {
|
3191
3716
|
_parse(input) {
|
3192
3717
|
const { ctx } = this._processInputParams(input);
|
3718
|
+
const newCtx = {
|
3719
|
+
...ctx,
|
3720
|
+
common: {
|
3721
|
+
...ctx.common,
|
3722
|
+
issues: []
|
3723
|
+
}
|
3724
|
+
};
|
3193
3725
|
const result = this._def.innerType._parse({
|
3194
|
-
data:
|
3195
|
-
path:
|
3196
|
-
parent:
|
3726
|
+
data: newCtx.data,
|
3727
|
+
path: newCtx.path,
|
3728
|
+
parent: {
|
3729
|
+
...newCtx
|
3730
|
+
}
|
3197
3731
|
});
|
3198
3732
|
if (isAsync(result)) {
|
3199
3733
|
return result.then((result2) => {
|
3200
3734
|
return {
|
3201
3735
|
status: "valid",
|
3202
|
-
value: result2.status === "valid" ? result2.value : this._def.
|
3736
|
+
value: result2.status === "valid" ? result2.value : this._def.catchValue({
|
3737
|
+
get error() {
|
3738
|
+
return new ZodError(newCtx.common.issues);
|
3739
|
+
},
|
3740
|
+
input: newCtx.data
|
3741
|
+
})
|
3203
3742
|
};
|
3204
3743
|
});
|
3205
3744
|
} else {
|
3206
3745
|
return {
|
3207
3746
|
status: "valid",
|
3208
|
-
value: result.status === "valid" ? result.value : this._def.
|
3747
|
+
value: result.status === "valid" ? result.value : this._def.catchValue({
|
3748
|
+
get error() {
|
3749
|
+
return new ZodError(newCtx.common.issues);
|
3750
|
+
},
|
3751
|
+
input: newCtx.data
|
3752
|
+
})
|
3209
3753
|
};
|
3210
3754
|
}
|
3211
3755
|
}
|
3212
|
-
|
3756
|
+
removeCatch() {
|
3213
3757
|
return this._def.innerType;
|
3214
3758
|
}
|
3215
3759
|
}, "ZodCatch");
|
@@ -3218,7 +3762,7 @@ var require_types_cjs_development = __commonJS({
|
|
3218
3762
|
return new ZodCatch({
|
3219
3763
|
innerType: type,
|
3220
3764
|
typeName: ZodFirstPartyTypeKind.ZodCatch,
|
3221
|
-
|
3765
|
+
catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
|
3222
3766
|
...processCreateParams(params)
|
3223
3767
|
});
|
3224
3768
|
};
|
@@ -3316,17 +3860,45 @@ var require_types_cjs_development = __commonJS({
|
|
3316
3860
|
}
|
3317
3861
|
}, "ZodPipeline");
|
3318
3862
|
__name22(ZodPipeline, "ZodPipeline");
|
3319
|
-
var
|
3863
|
+
var ZodReadonly = /* @__PURE__ */ __name2(class extends ZodType {
|
3864
|
+
_parse(input) {
|
3865
|
+
const result = this._def.innerType._parse(input);
|
3866
|
+
const freeze = /* @__PURE__ */ __name22((data) => {
|
3867
|
+
if (isValid(data)) {
|
3868
|
+
data.value = Object.freeze(data.value);
|
3869
|
+
}
|
3870
|
+
return data;
|
3871
|
+
}, "freeze");
|
3872
|
+
return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
|
3873
|
+
}
|
3874
|
+
unwrap() {
|
3875
|
+
return this._def.innerType;
|
3876
|
+
}
|
3877
|
+
}, "ZodReadonly");
|
3878
|
+
__name22(ZodReadonly, "ZodReadonly");
|
3879
|
+
ZodReadonly.create = (type, params) => {
|
3880
|
+
return new ZodReadonly({
|
3881
|
+
innerType: type,
|
3882
|
+
typeName: ZodFirstPartyTypeKind.ZodReadonly,
|
3883
|
+
...processCreateParams(params)
|
3884
|
+
});
|
3885
|
+
};
|
3886
|
+
function custom(check, params = {}, fatal) {
|
3320
3887
|
if (check)
|
3321
3888
|
return ZodAny.create().superRefine((data, ctx) => {
|
3889
|
+
var _a, _b;
|
3322
3890
|
if (!check(data)) {
|
3323
|
-
const p = typeof params === "function" ? params(data) : params;
|
3891
|
+
const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
|
3892
|
+
const _fatal = (_b = (_a = p.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
|
3324
3893
|
const p2 = typeof p === "string" ? { message: p } : p;
|
3325
|
-
ctx.addIssue({ code: "custom", ...p2, fatal });
|
3894
|
+
ctx.addIssue({ code: "custom", ...p2, fatal: _fatal });
|
3326
3895
|
}
|
3327
3896
|
});
|
3328
3897
|
return ZodAny.create();
|
3329
|
-
}
|
3898
|
+
}
|
3899
|
+
__name(custom, "custom");
|
3900
|
+
__name2(custom, "custom");
|
3901
|
+
__name22(custom, "custom");
|
3330
3902
|
var late = {
|
3331
3903
|
object: ZodObject.lazycreate
|
3332
3904
|
};
|
@@ -3367,10 +3939,11 @@ var require_types_cjs_development = __commonJS({
|
|
3367
3939
|
ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";
|
3368
3940
|
ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";
|
3369
3941
|
ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
|
3942
|
+
ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly";
|
3370
3943
|
})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
|
3371
3944
|
var instanceOfType = /* @__PURE__ */ __name22((cls, params = {
|
3372
3945
|
message: `Input not instance of ${cls.name}`
|
3373
|
-
}) => custom((data) => data instanceof cls, params
|
3946
|
+
}) => custom((data) => data instanceof cls, params), "instanceOfType");
|
3374
3947
|
var stringType = ZodString.create;
|
3375
3948
|
var numberType = ZodNumber.create;
|
3376
3949
|
var nanType = ZodNaN.create;
|
@@ -3411,12 +3984,15 @@ var require_types_cjs_development = __commonJS({
|
|
3411
3984
|
var coerce = {
|
3412
3985
|
string: (arg) => ZodString.create({ ...arg, coerce: true }),
|
3413
3986
|
number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
|
3414
|
-
boolean: (arg) => ZodBoolean.create({
|
3987
|
+
boolean: (arg) => ZodBoolean.create({
|
3988
|
+
...arg,
|
3989
|
+
coerce: true
|
3990
|
+
}),
|
3415
3991
|
bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
|
3416
3992
|
date: (arg) => ZodDate.create({ ...arg, coerce: true })
|
3417
3993
|
};
|
3418
3994
|
var NEVER = INVALID;
|
3419
|
-
var
|
3995
|
+
var z = /* @__PURE__ */ Object.freeze({
|
3420
3996
|
__proto__: null,
|
3421
3997
|
defaultErrorMap: errorMap,
|
3422
3998
|
setErrorMap,
|
@@ -3435,9 +4011,13 @@ var require_types_cjs_development = __commonJS({
|
|
3435
4011
|
get util() {
|
3436
4012
|
return util;
|
3437
4013
|
},
|
4014
|
+
get objectUtil() {
|
4015
|
+
return objectUtil;
|
4016
|
+
},
|
3438
4017
|
ZodParsedType,
|
3439
4018
|
getParsedType,
|
3440
4019
|
ZodType,
|
4020
|
+
datetimeRegex,
|
3441
4021
|
ZodString,
|
3442
4022
|
ZodNumber,
|
3443
4023
|
ZodBigInt,
|
@@ -3451,9 +4031,6 @@ var require_types_cjs_development = __commonJS({
|
|
3451
4031
|
ZodNever,
|
3452
4032
|
ZodVoid,
|
3453
4033
|
ZodArray,
|
3454
|
-
get objectUtil() {
|
3455
|
-
return objectUtil;
|
3456
|
-
},
|
3457
4034
|
ZodObject,
|
3458
4035
|
ZodUnion,
|
3459
4036
|
ZodDiscriminatedUnion,
|
@@ -3478,6 +4055,7 @@ var require_types_cjs_development = __commonJS({
|
|
3478
4055
|
BRAND,
|
3479
4056
|
ZodBranded,
|
3480
4057
|
ZodPipeline,
|
4058
|
+
ZodReadonly,
|
3481
4059
|
custom,
|
3482
4060
|
Schema: ZodType,
|
3483
4061
|
ZodSchema: ZodType,
|
@@ -3530,35 +4108,133 @@ var require_types_cjs_development = __commonJS({
|
|
3530
4108
|
quotelessJson,
|
3531
4109
|
ZodError
|
3532
4110
|
});
|
3533
|
-
var
|
3534
|
-
var
|
3535
|
-
|
3536
|
-
|
4111
|
+
var currentSymbol = Symbol("current");
|
4112
|
+
var previousSymbol = Symbol("previous");
|
4113
|
+
var mergeOpenApi = /* @__PURE__ */ __name22((openapi, {
|
4114
|
+
ref: _ref,
|
4115
|
+
refType: _refType,
|
4116
|
+
param: _param,
|
4117
|
+
header: _header,
|
4118
|
+
...rest
|
4119
|
+
} = {}) => ({
|
4120
|
+
...rest,
|
4121
|
+
...openapi
|
4122
|
+
}), "mergeOpenApi");
|
4123
|
+
function extendZodWithOpenApi(zod) {
|
4124
|
+
if (typeof zod.ZodType.prototype.openapi !== "undefined") {
|
4125
|
+
return;
|
4126
|
+
}
|
4127
|
+
zod.ZodType.prototype.openapi = function(openapi) {
|
4128
|
+
const { zodOpenApi, ...rest } = this._def;
|
4129
|
+
const result = new this.constructor({
|
4130
|
+
...rest,
|
4131
|
+
zodOpenApi: {
|
4132
|
+
openapi: mergeOpenApi(
|
4133
|
+
openapi,
|
4134
|
+
zodOpenApi == null ? void 0 : zodOpenApi.openapi
|
4135
|
+
)
|
4136
|
+
}
|
4137
|
+
});
|
4138
|
+
result._def.zodOpenApi[currentSymbol] = result;
|
4139
|
+
if (zodOpenApi) {
|
4140
|
+
result._def.zodOpenApi[previousSymbol] = this;
|
4141
|
+
}
|
4142
|
+
return result;
|
4143
|
+
};
|
4144
|
+
const zodDescribe = zod.ZodType.prototype.describe;
|
4145
|
+
zod.ZodType.prototype.describe = function(...args) {
|
4146
|
+
const result = zodDescribe.apply(this, args);
|
4147
|
+
const def = result._def;
|
4148
|
+
if (def.zodOpenApi) {
|
4149
|
+
const cloned = { ...def.zodOpenApi };
|
4150
|
+
cloned.openapi = mergeOpenApi({ description: args[0] }, cloned.openapi);
|
4151
|
+
cloned[previousSymbol] = this;
|
4152
|
+
cloned[currentSymbol] = result;
|
4153
|
+
def.zodOpenApi = cloned;
|
4154
|
+
} else {
|
4155
|
+
def.zodOpenApi = {
|
4156
|
+
openapi: { description: args[0] },
|
4157
|
+
[currentSymbol]: result
|
4158
|
+
};
|
4159
|
+
}
|
4160
|
+
return result;
|
4161
|
+
};
|
4162
|
+
const zodObjectExtend = zod.ZodObject.prototype.extend;
|
4163
|
+
zod.ZodObject.prototype.extend = function(...args) {
|
4164
|
+
const extendResult = zodObjectExtend.apply(this, args);
|
4165
|
+
const zodOpenApi = extendResult._def.zodOpenApi;
|
4166
|
+
if (zodOpenApi) {
|
4167
|
+
const cloned = { ...zodOpenApi };
|
4168
|
+
cloned.openapi = mergeOpenApi({}, cloned.openapi);
|
4169
|
+
cloned[previousSymbol] = this;
|
4170
|
+
extendResult._def.zodOpenApi = cloned;
|
4171
|
+
} else {
|
4172
|
+
extendResult._def.zodOpenApi = {
|
4173
|
+
[previousSymbol]: this
|
4174
|
+
};
|
4175
|
+
}
|
4176
|
+
return extendResult;
|
4177
|
+
};
|
4178
|
+
const zodObjectOmit = zod.ZodObject.prototype.omit;
|
4179
|
+
zod.ZodObject.prototype.omit = function(...args) {
|
4180
|
+
const omitResult = zodObjectOmit.apply(this, args);
|
4181
|
+
const zodOpenApi = omitResult._def.zodOpenApi;
|
4182
|
+
if (zodOpenApi) {
|
4183
|
+
const cloned = { ...zodOpenApi };
|
4184
|
+
cloned.openapi = mergeOpenApi({}, cloned.openapi);
|
4185
|
+
delete cloned[previousSymbol];
|
4186
|
+
delete cloned[currentSymbol];
|
4187
|
+
omitResult._def.zodOpenApi = cloned;
|
4188
|
+
}
|
4189
|
+
return omitResult;
|
4190
|
+
};
|
4191
|
+
const zodObjectPick = zod.ZodObject.prototype.pick;
|
4192
|
+
zod.ZodObject.prototype.pick = function(...args) {
|
4193
|
+
const pickResult = zodObjectPick.apply(this, args);
|
4194
|
+
const zodOpenApi = pickResult._def.zodOpenApi;
|
4195
|
+
if (zodOpenApi) {
|
4196
|
+
const cloned = { ...zodOpenApi };
|
4197
|
+
cloned.openapi = mergeOpenApi({}, cloned.openapi);
|
4198
|
+
delete cloned[previousSymbol];
|
4199
|
+
delete cloned[currentSymbol];
|
4200
|
+
pickResult._def.zodOpenApi = cloned;
|
4201
|
+
}
|
4202
|
+
return pickResult;
|
4203
|
+
};
|
4204
|
+
}
|
4205
|
+
__name(extendZodWithOpenApi, "extendZodWithOpenApi");
|
4206
|
+
__name2(extendZodWithOpenApi, "extendZodWithOpenApi");
|
4207
|
+
__name22(extendZodWithOpenApi, "extendZodWithOpenApi");
|
4208
|
+
extendZodWithOpenApi(z);
|
4209
|
+
var ContextValidator = z.array(z.string().or(z.record(z.any())));
|
4210
|
+
var AchievementCriteriaValidator = z.object({
|
4211
|
+
type: z.string().optional(),
|
4212
|
+
narrative: z.string().optional()
|
3537
4213
|
});
|
3538
|
-
var ImageValidator =
|
3539
|
-
|
3540
|
-
id:
|
3541
|
-
type:
|
3542
|
-
caption:
|
4214
|
+
var ImageValidator = z.string().or(
|
4215
|
+
z.object({
|
4216
|
+
id: z.string(),
|
4217
|
+
type: z.string(),
|
4218
|
+
caption: z.string().optional()
|
3543
4219
|
})
|
3544
4220
|
);
|
3545
|
-
var GeoCoordinatesValidator =
|
3546
|
-
type:
|
3547
|
-
latitude:
|
3548
|
-
longitude:
|
4221
|
+
var GeoCoordinatesValidator = z.object({
|
4222
|
+
type: z.string().min(1).or(z.string().array().nonempty()),
|
4223
|
+
latitude: z.number(),
|
4224
|
+
longitude: z.number()
|
3549
4225
|
});
|
3550
|
-
var AddressValidator =
|
3551
|
-
type:
|
3552
|
-
addressCountry:
|
3553
|
-
addressCountryCode:
|
3554
|
-
addressRegion:
|
3555
|
-
addressLocality:
|
3556
|
-
streetAddress:
|
3557
|
-
postOfficeBoxNumber:
|
3558
|
-
postalCode:
|
4226
|
+
var AddressValidator = z.object({
|
4227
|
+
type: z.string().min(1).or(z.string().array().nonempty()),
|
4228
|
+
addressCountry: z.string().optional(),
|
4229
|
+
addressCountryCode: z.string().optional(),
|
4230
|
+
addressRegion: z.string().optional(),
|
4231
|
+
addressLocality: z.string().optional(),
|
4232
|
+
streetAddress: z.string().optional(),
|
4233
|
+
postOfficeBoxNumber: z.string().optional(),
|
4234
|
+
postalCode: z.string().optional(),
|
3559
4235
|
geo: GeoCoordinatesValidator.optional()
|
3560
4236
|
});
|
3561
|
-
var IdentifierTypeValidator =
|
4237
|
+
var IdentifierTypeValidator = z.enum([
|
3562
4238
|
"sourcedId",
|
3563
4239
|
"systemId",
|
3564
4240
|
"productId",
|
@@ -3577,140 +4253,140 @@ var require_types_cjs_development = __commonJS({
|
|
3577
4253
|
"ltiPlatformId",
|
3578
4254
|
"ltiUserId",
|
3579
4255
|
"identifier"
|
3580
|
-
]).or(
|
3581
|
-
var IdentifierEntryValidator =
|
3582
|
-
type:
|
3583
|
-
identifier:
|
4256
|
+
]).or(z.string());
|
4257
|
+
var IdentifierEntryValidator = z.object({
|
4258
|
+
type: z.string().min(1).or(z.string().array().nonempty()),
|
4259
|
+
identifier: z.string(),
|
3584
4260
|
identifierType: IdentifierTypeValidator
|
3585
4261
|
});
|
3586
|
-
var ProfileValidator =
|
3587
|
-
|
3588
|
-
id:
|
3589
|
-
type:
|
3590
|
-
name:
|
3591
|
-
url:
|
3592
|
-
phone:
|
3593
|
-
description:
|
3594
|
-
endorsement:
|
4262
|
+
var ProfileValidator = z.string().or(
|
4263
|
+
z.object({
|
4264
|
+
id: z.string().optional(),
|
4265
|
+
type: z.string().or(z.string().array().nonempty().optional()),
|
4266
|
+
name: z.string().optional(),
|
4267
|
+
url: z.string().optional(),
|
4268
|
+
phone: z.string().optional(),
|
4269
|
+
description: z.string().optional(),
|
4270
|
+
endorsement: z.any().array().optional(),
|
3595
4271
|
image: ImageValidator.optional(),
|
3596
|
-
email:
|
4272
|
+
email: z.string().email().optional(),
|
3597
4273
|
address: AddressValidator.optional(),
|
3598
4274
|
otherIdentifier: IdentifierEntryValidator.array().optional(),
|
3599
|
-
official:
|
3600
|
-
parentOrg:
|
3601
|
-
familyName:
|
3602
|
-
givenName:
|
3603
|
-
additionalName:
|
3604
|
-
patronymicName:
|
3605
|
-
honorificPrefix:
|
3606
|
-
honorificSuffix:
|
3607
|
-
familyNamePrefix:
|
3608
|
-
dateOfBirth:
|
3609
|
-
}).catchall(
|
4275
|
+
official: z.string().optional(),
|
4276
|
+
parentOrg: z.any().optional(),
|
4277
|
+
familyName: z.string().optional(),
|
4278
|
+
givenName: z.string().optional(),
|
4279
|
+
additionalName: z.string().optional(),
|
4280
|
+
patronymicName: z.string().optional(),
|
4281
|
+
honorificPrefix: z.string().optional(),
|
4282
|
+
honorificSuffix: z.string().optional(),
|
4283
|
+
familyNamePrefix: z.string().optional(),
|
4284
|
+
dateOfBirth: z.string().optional()
|
4285
|
+
}).catchall(z.any())
|
3610
4286
|
);
|
3611
|
-
var CredentialSubjectValidator =
|
3612
|
-
var CredentialStatusValidator =
|
3613
|
-
var CredentialSchemaValidator =
|
3614
|
-
var RefreshServiceValidator =
|
3615
|
-
var TermsOfUseValidator =
|
3616
|
-
var VC2EvidenceValidator =
|
3617
|
-
var UnsignedVCValidator =
|
4287
|
+
var CredentialSubjectValidator = z.object({ id: z.string().optional() }).catchall(z.any());
|
4288
|
+
var CredentialStatusValidator = z.object({ type: z.string(), id: z.string() }).catchall(z.any());
|
4289
|
+
var CredentialSchemaValidator = z.object({ id: z.string(), type: z.string() }).catchall(z.any());
|
4290
|
+
var RefreshServiceValidator = z.object({ id: z.string().optional(), type: z.string() }).catchall(z.any());
|
4291
|
+
var TermsOfUseValidator = z.object({ type: z.string(), id: z.string().optional() }).catchall(z.any());
|
4292
|
+
var VC2EvidenceValidator = z.object({ type: z.string().or(z.string().array().nonempty()), id: z.string().optional() }).catchall(z.any());
|
4293
|
+
var UnsignedVCValidator = z.object({
|
3618
4294
|
"@context": ContextValidator,
|
3619
|
-
id:
|
3620
|
-
type:
|
4295
|
+
id: z.string().optional(),
|
4296
|
+
type: z.string().array().nonempty(),
|
3621
4297
|
issuer: ProfileValidator,
|
3622
4298
|
credentialSubject: CredentialSubjectValidator.or(CredentialSubjectValidator.array()),
|
3623
4299
|
refreshService: RefreshServiceValidator.or(RefreshServiceValidator.array()).optional(),
|
3624
4300
|
credentialSchema: CredentialSchemaValidator.or(
|
3625
4301
|
CredentialSchemaValidator.array()
|
3626
4302
|
).optional(),
|
3627
|
-
issuanceDate:
|
3628
|
-
expirationDate:
|
4303
|
+
issuanceDate: z.string().optional(),
|
4304
|
+
expirationDate: z.string().optional(),
|
3629
4305
|
credentialStatus: CredentialStatusValidator.or(
|
3630
4306
|
CredentialStatusValidator.array()
|
3631
4307
|
).optional(),
|
3632
|
-
name:
|
3633
|
-
description:
|
3634
|
-
validFrom:
|
3635
|
-
validUntil:
|
4308
|
+
name: z.string().optional(),
|
4309
|
+
description: z.string().optional(),
|
4310
|
+
validFrom: z.string().optional(),
|
4311
|
+
validUntil: z.string().optional(),
|
3636
4312
|
status: CredentialStatusValidator.or(CredentialStatusValidator.array()).optional(),
|
3637
4313
|
termsOfUse: TermsOfUseValidator.or(TermsOfUseValidator.array()).optional(),
|
3638
4314
|
evidence: VC2EvidenceValidator.or(VC2EvidenceValidator.array()).optional()
|
3639
|
-
}).catchall(
|
3640
|
-
var ProofValidator =
|
3641
|
-
type:
|
3642
|
-
created:
|
3643
|
-
challenge:
|
3644
|
-
domain:
|
3645
|
-
nonce:
|
3646
|
-
proofPurpose:
|
3647
|
-
verificationMethod:
|
3648
|
-
jws:
|
3649
|
-
}).catchall(
|
4315
|
+
}).catchall(z.any());
|
4316
|
+
var ProofValidator = z.object({
|
4317
|
+
type: z.string(),
|
4318
|
+
created: z.string(),
|
4319
|
+
challenge: z.string().optional(),
|
4320
|
+
domain: z.string().optional(),
|
4321
|
+
nonce: z.string().optional(),
|
4322
|
+
proofPurpose: z.string(),
|
4323
|
+
verificationMethod: z.string(),
|
4324
|
+
jws: z.string().optional()
|
4325
|
+
}).catchall(z.any());
|
3650
4326
|
var VCValidator = UnsignedVCValidator.extend({
|
3651
4327
|
proof: ProofValidator.or(ProofValidator.array())
|
3652
4328
|
});
|
3653
|
-
var UnsignedVPValidator =
|
4329
|
+
var UnsignedVPValidator = z.object({
|
3654
4330
|
"@context": ContextValidator,
|
3655
|
-
id:
|
3656
|
-
type:
|
4331
|
+
id: z.string().optional(),
|
4332
|
+
type: z.string().or(z.string().array().nonempty()),
|
3657
4333
|
verifiableCredential: VCValidator.or(VCValidator.array()).optional(),
|
3658
|
-
holder:
|
3659
|
-
}).catchall(
|
4334
|
+
holder: z.string().optional()
|
4335
|
+
}).catchall(z.any());
|
3660
4336
|
var VPValidator = UnsignedVPValidator.extend({
|
3661
4337
|
proof: ProofValidator.or(ProofValidator.array())
|
3662
4338
|
});
|
3663
|
-
var JWKValidator =
|
3664
|
-
kty:
|
3665
|
-
crv:
|
3666
|
-
x:
|
3667
|
-
y:
|
3668
|
-
n:
|
3669
|
-
d:
|
4339
|
+
var JWKValidator = z.object({
|
4340
|
+
kty: z.string(),
|
4341
|
+
crv: z.string(),
|
4342
|
+
x: z.string(),
|
4343
|
+
y: z.string().optional(),
|
4344
|
+
n: z.string().optional(),
|
4345
|
+
d: z.string().optional()
|
3670
4346
|
});
|
3671
|
-
var JWKWithPrivateKeyValidator = JWKValidator.omit({ d: true }).extend({ d:
|
3672
|
-
var JWERecipientHeaderValidator =
|
3673
|
-
alg:
|
3674
|
-
iv:
|
3675
|
-
tag:
|
4347
|
+
var JWKWithPrivateKeyValidator = JWKValidator.omit({ d: true }).extend({ d: z.string() });
|
4348
|
+
var JWERecipientHeaderValidator = z.object({
|
4349
|
+
alg: z.string(),
|
4350
|
+
iv: z.string(),
|
4351
|
+
tag: z.string(),
|
3676
4352
|
epk: JWKValidator.partial().optional(),
|
3677
|
-
kid:
|
3678
|
-
apv:
|
3679
|
-
apu:
|
4353
|
+
kid: z.string().optional(),
|
4354
|
+
apv: z.string().optional(),
|
4355
|
+
apu: z.string().optional()
|
3680
4356
|
});
|
3681
|
-
var JWERecipientValidator =
|
4357
|
+
var JWERecipientValidator = z.object({
|
3682
4358
|
header: JWERecipientHeaderValidator,
|
3683
|
-
encrypted_key:
|
4359
|
+
encrypted_key: z.string()
|
3684
4360
|
});
|
3685
|
-
var JWEValidator2 =
|
3686
|
-
protected:
|
3687
|
-
iv:
|
3688
|
-
ciphertext:
|
3689
|
-
tag:
|
3690
|
-
aad:
|
4361
|
+
var JWEValidator2 = z.object({
|
4362
|
+
protected: z.string(),
|
4363
|
+
iv: z.string(),
|
4364
|
+
ciphertext: z.string(),
|
4365
|
+
tag: z.string(),
|
4366
|
+
aad: z.string().optional(),
|
3691
4367
|
recipients: JWERecipientValidator.array().optional()
|
3692
4368
|
});
|
3693
|
-
var VerificationMethodValidator =
|
3694
|
-
|
4369
|
+
var VerificationMethodValidator = z.string().or(
|
4370
|
+
z.object({
|
3695
4371
|
"@context": ContextValidator.optional(),
|
3696
|
-
id:
|
3697
|
-
type:
|
3698
|
-
controller:
|
4372
|
+
id: z.string(),
|
4373
|
+
type: z.string(),
|
4374
|
+
controller: z.string(),
|
3699
4375
|
publicKeyJwk: JWKValidator.optional(),
|
3700
|
-
publicKeyBase58:
|
3701
|
-
blockChainAccountId:
|
3702
|
-
}).catchall(
|
4376
|
+
publicKeyBase58: z.string().optional(),
|
4377
|
+
blockChainAccountId: z.string().optional()
|
4378
|
+
}).catchall(z.any())
|
3703
4379
|
);
|
3704
|
-
var ServiceValidator =
|
3705
|
-
id:
|
3706
|
-
type:
|
3707
|
-
serviceEndpoint:
|
3708
|
-
}).catchall(
|
3709
|
-
var DidDocumentValidator =
|
4380
|
+
var ServiceValidator = z.object({
|
4381
|
+
id: z.string(),
|
4382
|
+
type: z.string().or(z.string().array().nonempty()),
|
4383
|
+
serviceEndpoint: z.any().or(z.any().array().nonempty())
|
4384
|
+
}).catchall(z.any());
|
4385
|
+
var DidDocumentValidator = z.object({
|
3710
4386
|
"@context": ContextValidator,
|
3711
|
-
id:
|
3712
|
-
alsoKnownAs:
|
3713
|
-
controller:
|
4387
|
+
id: z.string(),
|
4388
|
+
alsoKnownAs: z.string().optional(),
|
4389
|
+
controller: z.string().or(z.string().array().nonempty()).optional(),
|
3714
4390
|
verificationMethod: VerificationMethodValidator.array().optional(),
|
3715
4391
|
authentication: VerificationMethodValidator.array().optional(),
|
3716
4392
|
assertionMethod: VerificationMethodValidator.array().optional(),
|
@@ -3720,8 +4396,8 @@ var require_types_cjs_development = __commonJS({
|
|
3720
4396
|
publicKey: VerificationMethodValidator.array().optional(),
|
3721
4397
|
service: ServiceValidator.array().optional(),
|
3722
4398
|
proof: ProofValidator.or(ProofValidator.array()).optional()
|
3723
|
-
}).catchall(
|
3724
|
-
var AlignmentTargetTypeValidator =
|
4399
|
+
}).catchall(z.any());
|
4400
|
+
var AlignmentTargetTypeValidator = z.enum([
|
3725
4401
|
"ceasn:Competency",
|
3726
4402
|
"ceterms:Credential",
|
3727
4403
|
"CFItem",
|
@@ -3729,17 +4405,17 @@ var require_types_cjs_development = __commonJS({
|
|
3729
4405
|
"CFRubricCriterion",
|
3730
4406
|
"CFRubricCriterionLevel",
|
3731
4407
|
"CTDL"
|
3732
|
-
]).or(
|
3733
|
-
var AlignmentValidator =
|
3734
|
-
type:
|
3735
|
-
targetCode:
|
3736
|
-
targetDescription:
|
3737
|
-
targetName:
|
3738
|
-
targetFramework:
|
4408
|
+
]).or(z.string());
|
4409
|
+
var AlignmentValidator = z.object({
|
4410
|
+
type: z.string().array().nonempty(),
|
4411
|
+
targetCode: z.string().optional(),
|
4412
|
+
targetDescription: z.string().optional(),
|
4413
|
+
targetName: z.string(),
|
4414
|
+
targetFramework: z.string().optional(),
|
3739
4415
|
targetType: AlignmentTargetTypeValidator.optional(),
|
3740
|
-
targetUrl:
|
4416
|
+
targetUrl: z.string()
|
3741
4417
|
});
|
3742
|
-
var KnownAchievementTypeValidator =
|
4418
|
+
var KnownAchievementTypeValidator = z.enum([
|
3743
4419
|
"Achievement",
|
3744
4420
|
"ApprenticeshipCertificate",
|
3745
4421
|
"Assessment",
|
@@ -3772,23 +4448,23 @@ var require_types_cjs_development = __commonJS({
|
|
3772
4448
|
"ResearchDoctorate",
|
3773
4449
|
"SecondarySchoolDiploma"
|
3774
4450
|
]);
|
3775
|
-
var AchievementTypeValidator = KnownAchievementTypeValidator.or(
|
3776
|
-
var CriteriaValidator =
|
3777
|
-
var EndorsementSubjectValidator =
|
3778
|
-
id:
|
3779
|
-
type:
|
3780
|
-
endorsementComment:
|
4451
|
+
var AchievementTypeValidator = KnownAchievementTypeValidator.or(z.string());
|
4452
|
+
var CriteriaValidator = z.object({ id: z.string().optional(), narrative: z.string().optional() }).catchall(z.any());
|
4453
|
+
var EndorsementSubjectValidator = z.object({
|
4454
|
+
id: z.string(),
|
4455
|
+
type: z.string().array().nonempty(),
|
4456
|
+
endorsementComment: z.string().optional()
|
3781
4457
|
});
|
3782
4458
|
var EndorsementCredentialValidator = UnsignedVCValidator.extend({
|
3783
4459
|
credentialSubject: EndorsementSubjectValidator,
|
3784
4460
|
proof: ProofValidator.or(ProofValidator.array()).optional()
|
3785
4461
|
});
|
3786
|
-
var RelatedValidator =
|
3787
|
-
id:
|
3788
|
-
"@language":
|
3789
|
-
version:
|
4462
|
+
var RelatedValidator = z.object({
|
4463
|
+
id: z.string(),
|
4464
|
+
"@language": z.string().optional(),
|
4465
|
+
version: z.string().optional()
|
3790
4466
|
});
|
3791
|
-
var ResultTypeValidator =
|
4467
|
+
var ResultTypeValidator = z.enum([
|
3792
4468
|
"GradePointAverage",
|
3793
4469
|
"LetterGrade",
|
3794
4470
|
"Percent",
|
@@ -3801,59 +4477,59 @@ var require_types_cjs_development = __commonJS({
|
|
3801
4477
|
"RubricScore",
|
3802
4478
|
"ScaledScore",
|
3803
4479
|
"Status"
|
3804
|
-
]).or(
|
3805
|
-
var RubricCriterionValidator =
|
3806
|
-
id:
|
3807
|
-
type:
|
4480
|
+
]).or(z.string());
|
4481
|
+
var RubricCriterionValidator = z.object({
|
4482
|
+
id: z.string(),
|
4483
|
+
type: z.string().array().nonempty(),
|
3808
4484
|
alignment: AlignmentValidator.array().optional(),
|
3809
|
-
description:
|
3810
|
-
level:
|
3811
|
-
name:
|
3812
|
-
points:
|
3813
|
-
}).catchall(
|
3814
|
-
var ResultDescriptionValidator =
|
3815
|
-
id:
|
3816
|
-
type:
|
4485
|
+
description: z.string().optional(),
|
4486
|
+
level: z.string().optional(),
|
4487
|
+
name: z.string(),
|
4488
|
+
points: z.string().optional()
|
4489
|
+
}).catchall(z.any());
|
4490
|
+
var ResultDescriptionValidator = z.object({
|
4491
|
+
id: z.string(),
|
4492
|
+
type: z.string().array().nonempty(),
|
3817
4493
|
alignment: AlignmentValidator.array().optional(),
|
3818
|
-
allowedValue:
|
3819
|
-
name:
|
3820
|
-
requiredLevel:
|
3821
|
-
requiredValue:
|
4494
|
+
allowedValue: z.string().array().optional(),
|
4495
|
+
name: z.string(),
|
4496
|
+
requiredLevel: z.string().optional(),
|
4497
|
+
requiredValue: z.string().optional(),
|
3822
4498
|
resultType: ResultTypeValidator,
|
3823
4499
|
rubricCriterionLevel: RubricCriterionValidator.array().optional(),
|
3824
|
-
valueMax:
|
3825
|
-
valueMin:
|
3826
|
-
}).catchall(
|
3827
|
-
var AchievementValidator =
|
3828
|
-
id:
|
3829
|
-
type:
|
4500
|
+
valueMax: z.string().optional(),
|
4501
|
+
valueMin: z.string().optional()
|
4502
|
+
}).catchall(z.any());
|
4503
|
+
var AchievementValidator = z.object({
|
4504
|
+
id: z.string().optional(),
|
4505
|
+
type: z.string().array().nonempty(),
|
3830
4506
|
alignment: AlignmentValidator.array().optional(),
|
3831
4507
|
achievementType: AchievementTypeValidator.optional(),
|
3832
4508
|
creator: ProfileValidator.optional(),
|
3833
|
-
creditsAvailable:
|
4509
|
+
creditsAvailable: z.number().optional(),
|
3834
4510
|
criteria: CriteriaValidator,
|
3835
|
-
description:
|
4511
|
+
description: z.string(),
|
3836
4512
|
endorsement: EndorsementCredentialValidator.array().optional(),
|
3837
|
-
fieldOfStudy:
|
3838
|
-
humanCode:
|
4513
|
+
fieldOfStudy: z.string().optional(),
|
4514
|
+
humanCode: z.string().optional(),
|
3839
4515
|
image: ImageValidator.optional(),
|
3840
|
-
"@language":
|
3841
|
-
name:
|
4516
|
+
"@language": z.string().optional(),
|
4517
|
+
name: z.string(),
|
3842
4518
|
otherIdentifier: IdentifierEntryValidator.array().optional(),
|
3843
4519
|
related: RelatedValidator.array().optional(),
|
3844
4520
|
resultDescription: ResultDescriptionValidator.array().optional(),
|
3845
|
-
specialization:
|
3846
|
-
tag:
|
3847
|
-
version:
|
3848
|
-
}).catchall(
|
3849
|
-
var IdentityObjectValidator =
|
3850
|
-
type:
|
3851
|
-
hashed:
|
3852
|
-
identityHash:
|
3853
|
-
identityType:
|
3854
|
-
salt:
|
4521
|
+
specialization: z.string().optional(),
|
4522
|
+
tag: z.string().array().optional(),
|
4523
|
+
version: z.string().optional()
|
4524
|
+
}).catchall(z.any());
|
4525
|
+
var IdentityObjectValidator = z.object({
|
4526
|
+
type: z.string(),
|
4527
|
+
hashed: z.boolean(),
|
4528
|
+
identityHash: z.string(),
|
4529
|
+
identityType: z.string(),
|
4530
|
+
salt: z.string().optional()
|
3855
4531
|
});
|
3856
|
-
var ResultStatusTypeValidator =
|
4532
|
+
var ResultStatusTypeValidator = z.enum([
|
3857
4533
|
"Completed",
|
3858
4534
|
"Enrolled",
|
3859
4535
|
"Failed",
|
@@ -3861,42 +4537,42 @@ var require_types_cjs_development = __commonJS({
|
|
3861
4537
|
"OnHold",
|
3862
4538
|
"Withdrew"
|
3863
4539
|
]);
|
3864
|
-
var ResultValidator =
|
3865
|
-
type:
|
3866
|
-
achievedLevel:
|
4540
|
+
var ResultValidator = z.object({
|
4541
|
+
type: z.string().array().nonempty(),
|
4542
|
+
achievedLevel: z.string().optional(),
|
3867
4543
|
alignment: AlignmentValidator.array().optional(),
|
3868
|
-
resultDescription:
|
4544
|
+
resultDescription: z.string().optional(),
|
3869
4545
|
status: ResultStatusTypeValidator.optional(),
|
3870
|
-
value:
|
3871
|
-
}).catchall(
|
3872
|
-
var AchievementSubjectValidator =
|
3873
|
-
id:
|
3874
|
-
type:
|
3875
|
-
activityEndDate:
|
3876
|
-
activityStartDate:
|
3877
|
-
creditsEarned:
|
4546
|
+
value: z.string().optional()
|
4547
|
+
}).catchall(z.any());
|
4548
|
+
var AchievementSubjectValidator = z.object({
|
4549
|
+
id: z.string().optional(),
|
4550
|
+
type: z.string().array().nonempty(),
|
4551
|
+
activityEndDate: z.string().optional(),
|
4552
|
+
activityStartDate: z.string().optional(),
|
4553
|
+
creditsEarned: z.number().optional(),
|
3878
4554
|
achievement: AchievementValidator.optional(),
|
3879
4555
|
identifier: IdentityObjectValidator.array().optional(),
|
3880
4556
|
image: ImageValidator.optional(),
|
3881
|
-
licenseNumber:
|
3882
|
-
narrative:
|
4557
|
+
licenseNumber: z.string().optional(),
|
4558
|
+
narrative: z.string().optional(),
|
3883
4559
|
result: ResultValidator.array().optional(),
|
3884
|
-
role:
|
4560
|
+
role: z.string().optional(),
|
3885
4561
|
source: ProfileValidator.optional(),
|
3886
|
-
term:
|
3887
|
-
}).catchall(
|
3888
|
-
var EvidenceValidator =
|
3889
|
-
id:
|
3890
|
-
type:
|
3891
|
-
narrative:
|
3892
|
-
name:
|
3893
|
-
description:
|
3894
|
-
genre:
|
3895
|
-
audience:
|
3896
|
-
}).catchall(
|
4562
|
+
term: z.string().optional()
|
4563
|
+
}).catchall(z.any());
|
4564
|
+
var EvidenceValidator = z.object({
|
4565
|
+
id: z.string().optional(),
|
4566
|
+
type: z.string().or(z.string().array().nonempty()),
|
4567
|
+
narrative: z.string().optional(),
|
4568
|
+
name: z.string().optional(),
|
4569
|
+
description: z.string().optional(),
|
4570
|
+
genre: z.string().optional(),
|
4571
|
+
audience: z.string().optional()
|
4572
|
+
}).catchall(z.any());
|
3897
4573
|
var UnsignedAchievementCredentialValidator = UnsignedVCValidator.extend({
|
3898
|
-
name:
|
3899
|
-
description:
|
4574
|
+
name: z.string().optional(),
|
4575
|
+
description: z.string().optional(),
|
3900
4576
|
image: ImageValidator.optional(),
|
3901
4577
|
credentialSubject: AchievementSubjectValidator.or(
|
3902
4578
|
AchievementSubjectValidator.array()
|
@@ -3907,42 +4583,42 @@ var require_types_cjs_development = __commonJS({
|
|
3907
4583
|
var AchievementCredentialValidator = UnsignedAchievementCredentialValidator.extend({
|
3908
4584
|
proof: ProofValidator.or(ProofValidator.array())
|
3909
4585
|
});
|
3910
|
-
var VerificationCheckValidator =
|
3911
|
-
checks:
|
3912
|
-
warnings:
|
3913
|
-
errors:
|
4586
|
+
var VerificationCheckValidator = z.object({
|
4587
|
+
checks: z.string().array(),
|
4588
|
+
warnings: z.string().array(),
|
4589
|
+
errors: z.string().array()
|
3914
4590
|
});
|
3915
|
-
var VerificationStatusValidator =
|
4591
|
+
var VerificationStatusValidator = z.enum(["Success", "Failed", "Error"]);
|
3916
4592
|
var VerificationStatusEnum = VerificationStatusValidator.enum;
|
3917
|
-
var VerificationItemValidator =
|
3918
|
-
check:
|
4593
|
+
var VerificationItemValidator = z.object({
|
4594
|
+
check: z.string(),
|
3919
4595
|
status: VerificationStatusValidator,
|
3920
|
-
message:
|
3921
|
-
details:
|
4596
|
+
message: z.string().optional(),
|
4597
|
+
details: z.string().optional()
|
3922
4598
|
});
|
3923
|
-
var CredentialInfoValidator =
|
3924
|
-
title:
|
3925
|
-
createdAt:
|
4599
|
+
var CredentialInfoValidator = z.object({
|
4600
|
+
title: z.string().optional(),
|
4601
|
+
createdAt: z.string().optional(),
|
3926
4602
|
issuer: ProfileValidator.optional(),
|
3927
4603
|
issuee: ProfileValidator.optional(),
|
3928
4604
|
credentialSubject: CredentialSubjectValidator.optional()
|
3929
4605
|
});
|
3930
|
-
var CredentialRecordValidator =
|
3931
|
-
var PaginationOptionsValidator =
|
3932
|
-
limit:
|
3933
|
-
cursor:
|
3934
|
-
sort:
|
4606
|
+
var CredentialRecordValidator = z.object({ id: z.string(), uri: z.string() }).catchall(z.any());
|
4607
|
+
var PaginationOptionsValidator = z.object({
|
4608
|
+
limit: z.number(),
|
4609
|
+
cursor: z.string().optional(),
|
4610
|
+
sort: z.string().optional()
|
3935
4611
|
});
|
3936
|
-
var PaginationResponseValidator =
|
3937
|
-
cursor:
|
3938
|
-
hasMore:
|
4612
|
+
var PaginationResponseValidator = z.object({
|
4613
|
+
cursor: z.string().optional(),
|
4614
|
+
hasMore: z.boolean()
|
3939
4615
|
});
|
3940
|
-
var EncryptedRecordValidator =
|
4616
|
+
var EncryptedRecordValidator = z.object({ encryptedRecord: JWEValidator2, fields: z.string().array() }).catchall(z.any());
|
3941
4617
|
var PaginatedEncryptedRecordsValidator = PaginationResponseValidator.extend({
|
3942
4618
|
records: EncryptedRecordValidator.array()
|
3943
4619
|
});
|
3944
4620
|
var EncryptedCredentialRecordValidator = EncryptedRecordValidator.extend({
|
3945
|
-
id:
|
4621
|
+
id: z.string()
|
3946
4622
|
});
|
3947
4623
|
var PaginatedEncryptedCredentialRecordsValidator = PaginationResponseValidator.extend({
|
3948
4624
|
records: EncryptedCredentialRecordValidator.array()
|
@@ -3953,8 +4629,8 @@ var require_types_cjs_development = __commonJS({
|
|
3953
4629
|
throw new Error("Invalid RegExp string format");
|
3954
4630
|
return { pattern: match[1], flags: match[2] };
|
3955
4631
|
}, "parseRegexString");
|
3956
|
-
var RegExpValidator =
|
3957
|
-
|
4632
|
+
var RegExpValidator = z.instanceof(RegExp).or(
|
4633
|
+
z.string().refine(
|
3958
4634
|
(str) => {
|
3959
4635
|
try {
|
3960
4636
|
parseRegexString(str);
|
@@ -3975,71 +4651,71 @@ var require_types_cjs_development = __commonJS({
|
|
3975
4651
|
}
|
3976
4652
|
})
|
3977
4653
|
);
|
3978
|
-
var StringQuery =
|
3979
|
-
var LCNProfileDisplayValidator =
|
3980
|
-
backgroundColor:
|
3981
|
-
backgroundImage:
|
3982
|
-
fadeBackgroundImage:
|
3983
|
-
repeatBackgroundImage:
|
3984
|
-
fontColor:
|
3985
|
-
accentColor:
|
3986
|
-
accentFontColor:
|
3987
|
-
idBackgroundImage:
|
3988
|
-
fadeIdBackgroundImage:
|
3989
|
-
idBackgroundColor:
|
3990
|
-
repeatIdBackgroundImage:
|
4654
|
+
var StringQuery = z.string().or(z.object({ $in: z.string().array() })).or(z.object({ $regex: RegExpValidator }));
|
4655
|
+
var LCNProfileDisplayValidator = z.object({
|
4656
|
+
backgroundColor: z.string().optional(),
|
4657
|
+
backgroundImage: z.string().optional(),
|
4658
|
+
fadeBackgroundImage: z.boolean().optional(),
|
4659
|
+
repeatBackgroundImage: z.boolean().optional(),
|
4660
|
+
fontColor: z.string().optional(),
|
4661
|
+
accentColor: z.string().optional(),
|
4662
|
+
accentFontColor: z.string().optional(),
|
4663
|
+
idBackgroundImage: z.string().optional(),
|
4664
|
+
fadeIdBackgroundImage: z.boolean().optional(),
|
4665
|
+
idBackgroundColor: z.string().optional(),
|
4666
|
+
repeatIdBackgroundImage: z.boolean().optional()
|
3991
4667
|
});
|
3992
|
-
var LCNProfileValidator =
|
3993
|
-
profileId:
|
3994
|
-
displayName:
|
3995
|
-
shortBio:
|
3996
|
-
bio:
|
3997
|
-
did:
|
3998
|
-
isPrivate:
|
3999
|
-
email:
|
4000
|
-
image:
|
4001
|
-
heroImage:
|
4002
|
-
websiteLink:
|
4003
|
-
isServiceProfile:
|
4004
|
-
type:
|
4005
|
-
notificationsWebhook:
|
4668
|
+
var LCNProfileValidator = z.object({
|
4669
|
+
profileId: z.string().min(3).max(40).describe("Unique, URL-safe identifier for the profile."),
|
4670
|
+
displayName: z.string().default("").describe("Human-readable display name for the profile."),
|
4671
|
+
shortBio: z.string().default("").describe("Short bio for the profile."),
|
4672
|
+
bio: z.string().default("").describe("Longer bio for the profile."),
|
4673
|
+
did: z.string().describe("Decentralized Identifier for the profile. (auto-assigned)"),
|
4674
|
+
isPrivate: z.boolean().optional().describe("Whether the profile is private or not and shows up in search results."),
|
4675
|
+
email: z.string().optional().describe("Contact email address for the profile."),
|
4676
|
+
image: z.string().optional().describe("Profile image URL for the profile."),
|
4677
|
+
heroImage: z.string().optional().describe("Hero image URL for the profile."),
|
4678
|
+
websiteLink: z.string().optional().describe("Website link for the profile."),
|
4679
|
+
isServiceProfile: z.boolean().default(false).optional().describe("Whether the profile is a service profile or not."),
|
4680
|
+
type: z.string().optional().describe('Profile type: e.g. "person", "organization", "service".'),
|
4681
|
+
notificationsWebhook: z.string().url().startsWith("http").optional().describe("URL to send notifications to."),
|
4006
4682
|
display: LCNProfileDisplayValidator.optional().describe("Display settings for the profile."),
|
4007
|
-
role:
|
4008
|
-
dob:
|
4683
|
+
role: z.string().default("").optional().describe('Role of the profile: e.g. "teacher", "student".'),
|
4684
|
+
dob: z.string().default("").optional().describe('Date of birth of the profile: e.g. "1990-01-01".')
|
4009
4685
|
});
|
4010
|
-
var LCNProfileQueryValidator =
|
4686
|
+
var LCNProfileQueryValidator = z.object({
|
4011
4687
|
profileId: StringQuery,
|
4012
4688
|
displayName: StringQuery,
|
4013
4689
|
shortBio: StringQuery,
|
4014
4690
|
bio: StringQuery,
|
4015
4691
|
email: StringQuery,
|
4016
4692
|
websiteLink: StringQuery,
|
4017
|
-
isServiceProfile:
|
4693
|
+
isServiceProfile: z.boolean(),
|
4018
4694
|
type: StringQuery
|
4019
4695
|
}).partial();
|
4020
4696
|
var PaginatedLCNProfilesValidator = PaginationResponseValidator.extend({
|
4021
4697
|
records: LCNProfileValidator.array()
|
4022
4698
|
});
|
4023
|
-
var LCNProfileConnectionStatusEnum =
|
4699
|
+
var LCNProfileConnectionStatusEnum = z.enum([
|
4024
4700
|
"CONNECTED",
|
4025
4701
|
"PENDING_REQUEST_SENT",
|
4026
4702
|
"PENDING_REQUEST_RECEIVED",
|
4027
4703
|
"NOT_CONNECTED"
|
4028
4704
|
]);
|
4029
|
-
var LCNProfileManagerValidator =
|
4030
|
-
id:
|
4031
|
-
created:
|
4032
|
-
displayName:
|
4033
|
-
shortBio:
|
4034
|
-
bio:
|
4035
|
-
email:
|
4036
|
-
image:
|
4037
|
-
heroImage:
|
4705
|
+
var LCNProfileManagerValidator = z.object({
|
4706
|
+
id: z.string(),
|
4707
|
+
created: z.string(),
|
4708
|
+
displayName: z.string().default("").optional(),
|
4709
|
+
shortBio: z.string().default("").optional(),
|
4710
|
+
bio: z.string().default("").optional(),
|
4711
|
+
email: z.string().optional(),
|
4712
|
+
image: z.string().optional(),
|
4713
|
+
heroImage: z.string().optional()
|
4038
4714
|
});
|
4039
4715
|
var PaginatedLCNProfileManagersValidator = PaginationResponseValidator.extend({
|
4040
|
-
records: LCNProfileManagerValidator.extend({ did:
|
4716
|
+
records: LCNProfileManagerValidator.extend({ did: z.string() }).array()
|
4041
4717
|
});
|
4042
|
-
var LCNProfileManagerQueryValidator =
|
4718
|
+
var LCNProfileManagerQueryValidator = z.object({
|
4043
4719
|
id: StringQuery,
|
4044
4720
|
displayName: StringQuery,
|
4045
4721
|
shortBio: StringQuery,
|
@@ -4047,296 +4723,296 @@ var require_types_cjs_development = __commonJS({
|
|
4047
4723
|
email: StringQuery
|
4048
4724
|
}).partial();
|
4049
4725
|
var PaginatedLCNProfilesAndManagersValidator = PaginationResponseValidator.extend({
|
4050
|
-
records:
|
4726
|
+
records: z.object({
|
4051
4727
|
profile: LCNProfileValidator,
|
4052
|
-
manager: LCNProfileManagerValidator.extend({ did:
|
4728
|
+
manager: LCNProfileManagerValidator.extend({ did: z.string() }).optional()
|
4053
4729
|
}).array()
|
4054
4730
|
});
|
4055
|
-
var SentCredentialInfoValidator =
|
4056
|
-
uri:
|
4057
|
-
to:
|
4058
|
-
from:
|
4059
|
-
sent:
|
4060
|
-
received:
|
4731
|
+
var SentCredentialInfoValidator = z.object({
|
4732
|
+
uri: z.string(),
|
4733
|
+
to: z.string(),
|
4734
|
+
from: z.string(),
|
4735
|
+
sent: z.string().datetime(),
|
4736
|
+
received: z.string().datetime().optional()
|
4061
4737
|
});
|
4062
|
-
var BoostPermissionsValidator =
|
4063
|
-
role:
|
4064
|
-
canEdit:
|
4065
|
-
canIssue:
|
4066
|
-
canRevoke:
|
4067
|
-
canManagePermissions:
|
4068
|
-
canIssueChildren:
|
4069
|
-
canCreateChildren:
|
4070
|
-
canEditChildren:
|
4071
|
-
canRevokeChildren:
|
4072
|
-
canManageChildrenPermissions:
|
4073
|
-
canManageChildrenProfiles:
|
4074
|
-
canViewAnalytics:
|
4738
|
+
var BoostPermissionsValidator = z.object({
|
4739
|
+
role: z.string(),
|
4740
|
+
canEdit: z.boolean(),
|
4741
|
+
canIssue: z.boolean(),
|
4742
|
+
canRevoke: z.boolean(),
|
4743
|
+
canManagePermissions: z.boolean(),
|
4744
|
+
canIssueChildren: z.string(),
|
4745
|
+
canCreateChildren: z.string(),
|
4746
|
+
canEditChildren: z.string(),
|
4747
|
+
canRevokeChildren: z.string(),
|
4748
|
+
canManageChildrenPermissions: z.string(),
|
4749
|
+
canManageChildrenProfiles: z.boolean().default(false).optional(),
|
4750
|
+
canViewAnalytics: z.boolean()
|
4075
4751
|
});
|
4076
|
-
var BoostPermissionsQueryValidator =
|
4752
|
+
var BoostPermissionsQueryValidator = z.object({
|
4077
4753
|
role: StringQuery,
|
4078
|
-
canEdit:
|
4079
|
-
canIssue:
|
4080
|
-
canRevoke:
|
4081
|
-
canManagePermissions:
|
4754
|
+
canEdit: z.boolean(),
|
4755
|
+
canIssue: z.boolean(),
|
4756
|
+
canRevoke: z.boolean(),
|
4757
|
+
canManagePermissions: z.boolean(),
|
4082
4758
|
canIssueChildren: StringQuery,
|
4083
4759
|
canCreateChildren: StringQuery,
|
4084
4760
|
canEditChildren: StringQuery,
|
4085
4761
|
canRevokeChildren: StringQuery,
|
4086
4762
|
canManageChildrenPermissions: StringQuery,
|
4087
|
-
canManageChildrenProfiles:
|
4088
|
-
canViewAnalytics:
|
4763
|
+
canManageChildrenProfiles: z.boolean(),
|
4764
|
+
canViewAnalytics: z.boolean()
|
4089
4765
|
}).partial();
|
4090
|
-
var ClaimHookTypeValidator =
|
4091
|
-
var ClaimHookValidator =
|
4092
|
-
|
4093
|
-
type:
|
4094
|
-
data:
|
4095
|
-
claimUri:
|
4096
|
-
targetUri:
|
4766
|
+
var ClaimHookTypeValidator = z.enum(["GRANT_PERMISSIONS", "ADD_ADMIN"]);
|
4767
|
+
var ClaimHookValidator = z.discriminatedUnion("type", [
|
4768
|
+
z.object({
|
4769
|
+
type: z.literal(ClaimHookTypeValidator.Values.GRANT_PERMISSIONS),
|
4770
|
+
data: z.object({
|
4771
|
+
claimUri: z.string(),
|
4772
|
+
targetUri: z.string(),
|
4097
4773
|
permissions: BoostPermissionsValidator.partial()
|
4098
4774
|
})
|
4099
4775
|
}),
|
4100
|
-
|
4101
|
-
type:
|
4102
|
-
data:
|
4776
|
+
z.object({
|
4777
|
+
type: z.literal(ClaimHookTypeValidator.Values.ADD_ADMIN),
|
4778
|
+
data: z.object({ claimUri: z.string(), targetUri: z.string() })
|
4103
4779
|
})
|
4104
4780
|
]);
|
4105
|
-
var ClaimHookQueryValidator =
|
4781
|
+
var ClaimHookQueryValidator = z.object({
|
4106
4782
|
type: StringQuery,
|
4107
|
-
data:
|
4783
|
+
data: z.object({
|
4108
4784
|
claimUri: StringQuery,
|
4109
4785
|
targetUri: StringQuery,
|
4110
4786
|
permissions: BoostPermissionsQueryValidator
|
4111
4787
|
})
|
4112
4788
|
}).deepPartial();
|
4113
|
-
var FullClaimHookValidator =
|
4789
|
+
var FullClaimHookValidator = z.object({ id: z.string(), createdAt: z.string(), updatedAt: z.string() }).and(ClaimHookValidator);
|
4114
4790
|
var PaginatedClaimHooksValidator = PaginationResponseValidator.extend({
|
4115
4791
|
records: FullClaimHookValidator.array()
|
4116
4792
|
});
|
4117
|
-
var LCNBoostStatus =
|
4118
|
-
var BoostValidator =
|
4119
|
-
uri:
|
4120
|
-
name:
|
4121
|
-
type:
|
4122
|
-
category:
|
4793
|
+
var LCNBoostStatus = z.enum(["DRAFT", "LIVE"]);
|
4794
|
+
var BoostValidator = z.object({
|
4795
|
+
uri: z.string(),
|
4796
|
+
name: z.string().optional(),
|
4797
|
+
type: z.string().optional(),
|
4798
|
+
category: z.string().optional(),
|
4123
4799
|
status: LCNBoostStatus.optional(),
|
4124
|
-
autoConnectRecipients:
|
4125
|
-
meta:
|
4800
|
+
autoConnectRecipients: z.boolean().optional(),
|
4801
|
+
meta: z.record(z.any()).optional(),
|
4126
4802
|
claimPermissions: BoostPermissionsValidator.optional()
|
4127
4803
|
});
|
4128
|
-
var BoostQueryValidator =
|
4804
|
+
var BoostQueryValidator = z.object({
|
4129
4805
|
uri: StringQuery,
|
4130
4806
|
name: StringQuery,
|
4131
4807
|
type: StringQuery,
|
4132
4808
|
category: StringQuery,
|
4133
|
-
meta:
|
4134
|
-
status: LCNBoostStatus.or(
|
4135
|
-
autoConnectRecipients:
|
4809
|
+
meta: z.record(StringQuery),
|
4810
|
+
status: LCNBoostStatus.or(z.object({ $in: LCNBoostStatus.array() })),
|
4811
|
+
autoConnectRecipients: z.boolean()
|
4136
4812
|
}).partial();
|
4137
4813
|
var PaginatedBoostsValidator = PaginationResponseValidator.extend({
|
4138
4814
|
records: BoostValidator.array()
|
4139
4815
|
});
|
4140
|
-
var BoostRecipientValidator =
|
4816
|
+
var BoostRecipientValidator = z.object({
|
4141
4817
|
to: LCNProfileValidator,
|
4142
|
-
from:
|
4143
|
-
received:
|
4144
|
-
uri:
|
4818
|
+
from: z.string(),
|
4819
|
+
received: z.string().optional(),
|
4820
|
+
uri: z.string().optional()
|
4145
4821
|
});
|
4146
4822
|
var PaginatedBoostRecipientsValidator = PaginationResponseValidator.extend({
|
4147
4823
|
records: BoostRecipientValidator.array()
|
4148
4824
|
});
|
4149
|
-
var LCNBoostClaimLinkSigningAuthorityValidator =
|
4150
|
-
endpoint:
|
4151
|
-
name:
|
4152
|
-
did:
|
4825
|
+
var LCNBoostClaimLinkSigningAuthorityValidator = z.object({
|
4826
|
+
endpoint: z.string(),
|
4827
|
+
name: z.string(),
|
4828
|
+
did: z.string().optional()
|
4153
4829
|
});
|
4154
|
-
var LCNBoostClaimLinkOptionsValidator =
|
4155
|
-
ttlSeconds:
|
4156
|
-
totalUses:
|
4830
|
+
var LCNBoostClaimLinkOptionsValidator = z.object({
|
4831
|
+
ttlSeconds: z.number().optional(),
|
4832
|
+
totalUses: z.number().optional()
|
4157
4833
|
});
|
4158
|
-
var LCNSigningAuthorityValidator =
|
4159
|
-
endpoint:
|
4834
|
+
var LCNSigningAuthorityValidator = z.object({
|
4835
|
+
endpoint: z.string()
|
4160
4836
|
});
|
4161
|
-
var LCNSigningAuthorityForUserValidator =
|
4837
|
+
var LCNSigningAuthorityForUserValidator = z.object({
|
4162
4838
|
signingAuthority: LCNSigningAuthorityValidator,
|
4163
|
-
relationship:
|
4164
|
-
name:
|
4839
|
+
relationship: z.object({
|
4840
|
+
name: z.string().max(15).regex(/^[a-z0-9-]+$/, {
|
4165
4841
|
message: "The input string must contain only lowercase letters, numbers, and hyphens."
|
4166
4842
|
}),
|
4167
|
-
did:
|
4843
|
+
did: z.string()
|
4168
4844
|
})
|
4169
4845
|
});
|
4170
|
-
var AutoBoostConfigValidator =
|
4171
|
-
boostUri:
|
4172
|
-
signingAuthority:
|
4173
|
-
endpoint:
|
4174
|
-
name:
|
4846
|
+
var AutoBoostConfigValidator = z.object({
|
4847
|
+
boostUri: z.string(),
|
4848
|
+
signingAuthority: z.object({
|
4849
|
+
endpoint: z.string(),
|
4850
|
+
name: z.string()
|
4175
4851
|
})
|
4176
4852
|
});
|
4177
|
-
var ConsentFlowTermsStatusValidator =
|
4178
|
-
var ConsentFlowContractValidator =
|
4179
|
-
read:
|
4180
|
-
anonymize:
|
4181
|
-
credentials:
|
4182
|
-
personal:
|
4853
|
+
var ConsentFlowTermsStatusValidator = z.enum(["live", "stale", "withdrawn"]);
|
4854
|
+
var ConsentFlowContractValidator = z.object({
|
4855
|
+
read: z.object({
|
4856
|
+
anonymize: z.boolean().optional(),
|
4857
|
+
credentials: z.object({ categories: z.record(z.object({ required: z.boolean() })).default({}) }).default({}),
|
4858
|
+
personal: z.record(z.object({ required: z.boolean() })).default({})
|
4183
4859
|
}).default({}),
|
4184
|
-
write:
|
4185
|
-
credentials:
|
4186
|
-
personal:
|
4860
|
+
write: z.object({
|
4861
|
+
credentials: z.object({ categories: z.record(z.object({ required: z.boolean() })).default({}) }).default({}),
|
4862
|
+
personal: z.record(z.object({ required: z.boolean() })).default({})
|
4187
4863
|
}).default({})
|
4188
4864
|
});
|
4189
|
-
var ConsentFlowContractDetailsValidator =
|
4865
|
+
var ConsentFlowContractDetailsValidator = z.object({
|
4190
4866
|
contract: ConsentFlowContractValidator,
|
4191
4867
|
owner: LCNProfileValidator,
|
4192
|
-
name:
|
4193
|
-
subtitle:
|
4194
|
-
description:
|
4195
|
-
reasonForAccessing:
|
4196
|
-
image:
|
4197
|
-
uri:
|
4198
|
-
needsGuardianConsent:
|
4199
|
-
redirectUrl:
|
4200
|
-
frontDoorBoostUri:
|
4201
|
-
createdAt:
|
4202
|
-
updatedAt:
|
4203
|
-
expiresAt:
|
4204
|
-
autoBoosts:
|
4205
|
-
writers:
|
4868
|
+
name: z.string(),
|
4869
|
+
subtitle: z.string().optional(),
|
4870
|
+
description: z.string().optional(),
|
4871
|
+
reasonForAccessing: z.string().optional(),
|
4872
|
+
image: z.string().optional(),
|
4873
|
+
uri: z.string(),
|
4874
|
+
needsGuardianConsent: z.boolean().optional(),
|
4875
|
+
redirectUrl: z.string().optional(),
|
4876
|
+
frontDoorBoostUri: z.string().optional(),
|
4877
|
+
createdAt: z.string(),
|
4878
|
+
updatedAt: z.string(),
|
4879
|
+
expiresAt: z.string().optional(),
|
4880
|
+
autoBoosts: z.string().array().optional(),
|
4881
|
+
writers: z.array(LCNProfileValidator).optional()
|
4206
4882
|
});
|
4207
4883
|
var PaginatedConsentFlowContractsValidator = PaginationResponseValidator.extend({
|
4208
4884
|
records: ConsentFlowContractDetailsValidator.omit({ owner: true }).array()
|
4209
4885
|
});
|
4210
|
-
var ConsentFlowContractDataValidator =
|
4211
|
-
credentials:
|
4212
|
-
personal:
|
4213
|
-
date:
|
4886
|
+
var ConsentFlowContractDataValidator = z.object({
|
4887
|
+
credentials: z.object({ categories: z.record(z.string().array()).default({}) }),
|
4888
|
+
personal: z.record(z.string()).default({}),
|
4889
|
+
date: z.string()
|
4214
4890
|
});
|
4215
4891
|
var PaginatedConsentFlowDataValidator = PaginationResponseValidator.extend({
|
4216
4892
|
records: ConsentFlowContractDataValidator.array()
|
4217
4893
|
});
|
4218
|
-
var ConsentFlowContractDataForDidValidator =
|
4219
|
-
credentials:
|
4220
|
-
personal:
|
4221
|
-
date:
|
4222
|
-
contractUri:
|
4894
|
+
var ConsentFlowContractDataForDidValidator = z.object({
|
4895
|
+
credentials: z.object({ category: z.string(), uri: z.string() }).array(),
|
4896
|
+
personal: z.record(z.string()).default({}),
|
4897
|
+
date: z.string(),
|
4898
|
+
contractUri: z.string()
|
4223
4899
|
});
|
4224
4900
|
var PaginatedConsentFlowDataForDidValidator = PaginationResponseValidator.extend({
|
4225
4901
|
records: ConsentFlowContractDataForDidValidator.array()
|
4226
4902
|
});
|
4227
|
-
var ConsentFlowTermValidator =
|
4228
|
-
sharing:
|
4229
|
-
shared:
|
4230
|
-
shareAll:
|
4231
|
-
shareUntil:
|
4903
|
+
var ConsentFlowTermValidator = z.object({
|
4904
|
+
sharing: z.boolean().optional(),
|
4905
|
+
shared: z.string().array().optional(),
|
4906
|
+
shareAll: z.boolean().optional(),
|
4907
|
+
shareUntil: z.string().optional()
|
4232
4908
|
});
|
4233
|
-
var ConsentFlowTermsValidator =
|
4234
|
-
read:
|
4235
|
-
anonymize:
|
4236
|
-
credentials:
|
4237
|
-
shareAll:
|
4238
|
-
sharing:
|
4239
|
-
categories:
|
4909
|
+
var ConsentFlowTermsValidator = z.object({
|
4910
|
+
read: z.object({
|
4911
|
+
anonymize: z.boolean().optional(),
|
4912
|
+
credentials: z.object({
|
4913
|
+
shareAll: z.boolean().optional(),
|
4914
|
+
sharing: z.boolean().optional(),
|
4915
|
+
categories: z.record(ConsentFlowTermValidator).default({})
|
4240
4916
|
}).default({}),
|
4241
|
-
personal:
|
4917
|
+
personal: z.record(z.string()).default({})
|
4242
4918
|
}).default({}),
|
4243
|
-
write:
|
4244
|
-
credentials:
|
4245
|
-
personal:
|
4919
|
+
write: z.object({
|
4920
|
+
credentials: z.object({ categories: z.record(z.boolean()).default({}) }).default({}),
|
4921
|
+
personal: z.record(z.boolean()).default({})
|
4246
4922
|
}).default({}),
|
4247
|
-
deniedWriters:
|
4923
|
+
deniedWriters: z.array(z.string()).optional()
|
4248
4924
|
});
|
4249
4925
|
var PaginatedConsentFlowTermsValidator = PaginationResponseValidator.extend({
|
4250
|
-
records:
|
4251
|
-
expiresAt:
|
4252
|
-
oneTime:
|
4926
|
+
records: z.object({
|
4927
|
+
expiresAt: z.string().optional(),
|
4928
|
+
oneTime: z.boolean().optional(),
|
4253
4929
|
terms: ConsentFlowTermsValidator,
|
4254
4930
|
contract: ConsentFlowContractDetailsValidator,
|
4255
|
-
uri:
|
4931
|
+
uri: z.string(),
|
4256
4932
|
consenter: LCNProfileValidator,
|
4257
4933
|
status: ConsentFlowTermsStatusValidator
|
4258
4934
|
}).array()
|
4259
4935
|
});
|
4260
|
-
var ConsentFlowContractQueryValidator =
|
4261
|
-
read:
|
4262
|
-
anonymize:
|
4263
|
-
credentials:
|
4264
|
-
categories:
|
4936
|
+
var ConsentFlowContractQueryValidator = z.object({
|
4937
|
+
read: z.object({
|
4938
|
+
anonymize: z.boolean().optional(),
|
4939
|
+
credentials: z.object({
|
4940
|
+
categories: z.record(z.object({ required: z.boolean().optional() })).optional()
|
4265
4941
|
}).optional(),
|
4266
|
-
personal:
|
4942
|
+
personal: z.record(z.object({ required: z.boolean().optional() })).optional()
|
4267
4943
|
}).optional(),
|
4268
|
-
write:
|
4269
|
-
credentials:
|
4270
|
-
categories:
|
4944
|
+
write: z.object({
|
4945
|
+
credentials: z.object({
|
4946
|
+
categories: z.record(z.object({ required: z.boolean().optional() })).optional()
|
4271
4947
|
}).optional(),
|
4272
|
-
personal:
|
4948
|
+
personal: z.record(z.object({ required: z.boolean().optional() })).optional()
|
4273
4949
|
}).optional()
|
4274
4950
|
});
|
4275
|
-
var ConsentFlowDataQueryValidator =
|
4276
|
-
anonymize:
|
4277
|
-
credentials:
|
4278
|
-
personal:
|
4951
|
+
var ConsentFlowDataQueryValidator = z.object({
|
4952
|
+
anonymize: z.boolean().optional(),
|
4953
|
+
credentials: z.object({ categories: z.record(z.boolean()).optional() }).optional(),
|
4954
|
+
personal: z.record(z.boolean()).optional()
|
4279
4955
|
});
|
4280
|
-
var ConsentFlowDataForDidQueryValidator =
|
4281
|
-
credentials:
|
4282
|
-
personal:
|
4956
|
+
var ConsentFlowDataForDidQueryValidator = z.object({
|
4957
|
+
credentials: z.object({ categories: z.record(z.boolean()).optional() }).optional(),
|
4958
|
+
personal: z.record(z.boolean()).optional(),
|
4283
4959
|
id: StringQuery.optional()
|
4284
4960
|
});
|
4285
|
-
var ConsentFlowTermsQueryValidator =
|
4286
|
-
read:
|
4287
|
-
anonymize:
|
4288
|
-
credentials:
|
4289
|
-
shareAll:
|
4290
|
-
sharing:
|
4291
|
-
categories:
|
4961
|
+
var ConsentFlowTermsQueryValidator = z.object({
|
4962
|
+
read: z.object({
|
4963
|
+
anonymize: z.boolean().optional(),
|
4964
|
+
credentials: z.object({
|
4965
|
+
shareAll: z.boolean().optional(),
|
4966
|
+
sharing: z.boolean().optional(),
|
4967
|
+
categories: z.record(ConsentFlowTermValidator.optional()).optional()
|
4292
4968
|
}).optional(),
|
4293
|
-
personal:
|
4969
|
+
personal: z.record(z.string()).optional()
|
4294
4970
|
}).optional(),
|
4295
|
-
write:
|
4296
|
-
credentials:
|
4297
|
-
personal:
|
4971
|
+
write: z.object({
|
4972
|
+
credentials: z.object({ categories: z.record(z.boolean()).optional() }).optional(),
|
4973
|
+
personal: z.record(z.boolean()).optional()
|
4298
4974
|
}).optional()
|
4299
4975
|
});
|
4300
|
-
var ConsentFlowTransactionActionValidator =
|
4976
|
+
var ConsentFlowTransactionActionValidator = z.enum([
|
4301
4977
|
"consent",
|
4302
4978
|
"update",
|
4303
4979
|
"sync",
|
4304
4980
|
"withdraw",
|
4305
4981
|
"write"
|
4306
4982
|
]);
|
4307
|
-
var ConsentFlowTransactionsQueryValidator =
|
4983
|
+
var ConsentFlowTransactionsQueryValidator = z.object({
|
4308
4984
|
terms: ConsentFlowTermsQueryValidator.optional(),
|
4309
4985
|
action: ConsentFlowTransactionActionValidator.or(
|
4310
4986
|
ConsentFlowTransactionActionValidator.array()
|
4311
4987
|
).optional(),
|
4312
|
-
date:
|
4313
|
-
expiresAt:
|
4314
|
-
oneTime:
|
4988
|
+
date: z.object({ $gt: z.string() }).or(z.object({ $lt: z.string() })).or(z.object({ $eq: z.string() })).optional(),
|
4989
|
+
expiresAt: z.object({ $gt: z.string() }).or(z.object({ $lt: z.string() })).or(z.object({ $eq: z.string() })).optional(),
|
4990
|
+
oneTime: z.boolean().optional()
|
4315
4991
|
});
|
4316
|
-
var ConsentFlowTransactionValidator =
|
4317
|
-
expiresAt:
|
4318
|
-
oneTime:
|
4992
|
+
var ConsentFlowTransactionValidator = z.object({
|
4993
|
+
expiresAt: z.string().optional(),
|
4994
|
+
oneTime: z.boolean().optional(),
|
4319
4995
|
terms: ConsentFlowTermsValidator.optional(),
|
4320
|
-
id:
|
4996
|
+
id: z.string(),
|
4321
4997
|
action: ConsentFlowTransactionActionValidator,
|
4322
|
-
date:
|
4323
|
-
uris:
|
4998
|
+
date: z.string(),
|
4999
|
+
uris: z.string().array().optional()
|
4324
5000
|
});
|
4325
5001
|
var PaginatedConsentFlowTransactionsValidator = PaginationResponseValidator.extend({
|
4326
5002
|
records: ConsentFlowTransactionValidator.array()
|
4327
5003
|
});
|
4328
|
-
var ContractCredentialValidator =
|
4329
|
-
credentialUri:
|
4330
|
-
termsUri:
|
4331
|
-
contractUri:
|
4332
|
-
boostUri:
|
4333
|
-
category:
|
4334
|
-
date:
|
5004
|
+
var ContractCredentialValidator = z.object({
|
5005
|
+
credentialUri: z.string(),
|
5006
|
+
termsUri: z.string(),
|
5007
|
+
contractUri: z.string(),
|
5008
|
+
boostUri: z.string(),
|
5009
|
+
category: z.string().optional(),
|
5010
|
+
date: z.string()
|
4335
5011
|
});
|
4336
5012
|
var PaginatedContractCredentialsValidator = PaginationResponseValidator.extend({
|
4337
5013
|
records: ContractCredentialValidator.array()
|
4338
5014
|
});
|
4339
|
-
var LCNNotificationTypeEnumValidator =
|
5015
|
+
var LCNNotificationTypeEnumValidator = z.enum([
|
4340
5016
|
"CONNECTION_REQUEST",
|
4341
5017
|
"CONNECTION_ACCEPTED",
|
4342
5018
|
"CREDENTIAL_RECEIVED",
|
@@ -4347,40 +5023,40 @@ var require_types_cjs_development = __commonJS({
|
|
4347
5023
|
"PRESENTATION_RECEIVED",
|
4348
5024
|
"CONSENT_FLOW_TRANSACTION"
|
4349
5025
|
]);
|
4350
|
-
var LCNNotificationMessageValidator =
|
4351
|
-
title:
|
4352
|
-
body:
|
5026
|
+
var LCNNotificationMessageValidator = z.object({
|
5027
|
+
title: z.string().optional(),
|
5028
|
+
body: z.string().optional()
|
4353
5029
|
});
|
4354
|
-
var LCNNotificationDataValidator =
|
4355
|
-
vcUris:
|
4356
|
-
vpUris:
|
5030
|
+
var LCNNotificationDataValidator = z.object({
|
5031
|
+
vcUris: z.array(z.string()).optional(),
|
5032
|
+
vpUris: z.array(z.string()).optional(),
|
4357
5033
|
transaction: ConsentFlowTransactionValidator.optional()
|
4358
5034
|
});
|
4359
|
-
var LCNNotificationValidator =
|
5035
|
+
var LCNNotificationValidator = z.object({
|
4360
5036
|
type: LCNNotificationTypeEnumValidator,
|
4361
|
-
to: LCNProfileValidator.partial().and(
|
4362
|
-
from: LCNProfileValidator.partial().and(
|
5037
|
+
to: LCNProfileValidator.partial().and(z.object({ did: z.string() })),
|
5038
|
+
from: LCNProfileValidator.partial().and(z.object({ did: z.string() })),
|
4363
5039
|
message: LCNNotificationMessageValidator.optional(),
|
4364
5040
|
data: LCNNotificationDataValidator.optional(),
|
4365
|
-
sent:
|
5041
|
+
sent: z.string().datetime().optional()
|
4366
5042
|
});
|
4367
5043
|
var AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX = "auth-grant:";
|
4368
|
-
var AuthGrantValidator =
|
4369
|
-
id:
|
4370
|
-
name:
|
4371
|
-
description:
|
4372
|
-
challenge:
|
4373
|
-
status:
|
5044
|
+
var AuthGrantValidator = z.object({
|
5045
|
+
id: z.string(),
|
5046
|
+
name: z.string(),
|
5047
|
+
description: z.string().optional(),
|
5048
|
+
challenge: z.string().startsWith(AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX).min(10, { message: "Challenge is too short" }).max(100, { message: "Challenge is too long" }),
|
5049
|
+
status: z.enum(["revoked", "active"], {
|
4374
5050
|
required_error: "Status is required",
|
4375
5051
|
invalid_type_error: "Status must be either active or revoked"
|
4376
5052
|
}),
|
4377
|
-
scope:
|
4378
|
-
createdAt:
|
4379
|
-
expiresAt:
|
5053
|
+
scope: z.string(),
|
5054
|
+
createdAt: z.string().datetime({ message: "createdAt must be a valid ISO 8601 datetime string" }),
|
5055
|
+
expiresAt: z.string().datetime({ message: "expiresAt must be a valid ISO 8601 datetime string" }).nullish().optional()
|
4380
5056
|
});
|
4381
|
-
var FlatAuthGrantValidator =
|
4382
|
-
var AuthGrantStatusValidator =
|
4383
|
-
var AuthGrantQueryValidator =
|
5057
|
+
var FlatAuthGrantValidator = z.object({ id: z.string() }).catchall(z.any());
|
5058
|
+
var AuthGrantStatusValidator = z.enum(["active", "revoked"]);
|
5059
|
+
var AuthGrantQueryValidator = z.object({
|
4384
5060
|
id: StringQuery,
|
4385
5061
|
name: StringQuery,
|
4386
5062
|
description: StringQuery,
|