@learncard/network-brain-client 2.2.33 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/brain-client.cjs.development.js +1353 -675
- package/dist/brain-client.cjs.development.js.map +2 -2
- package/dist/brain-client.cjs.production.min.js +1 -1
- package/dist/brain-client.cjs.production.min.js.map +3 -3
- package/dist/brain-client.esm.js +1354 -676
- package/dist/brain-client.esm.js.map +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/package.json +5 -6
- package/src/index.ts +16 -14
package/dist/brain-client.esm.js
CHANGED
|
@@ -75,7 +75,7 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
75
75
|
}
|
|
76
76
|
return to;
|
|
77
77
|
}, "__copyProps");
|
|
78
|
-
var __toCommonJS2 = /* @__PURE__ */ __name2((
|
|
78
|
+
var __toCommonJS2 = /* @__PURE__ */ __name2((mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod), "__toCommonJS");
|
|
79
79
|
var src_exports2 = {};
|
|
80
80
|
__export2(src_exports2, {
|
|
81
81
|
AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX: () => AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX,
|
|
@@ -265,6 +265,15 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
265
265
|
return value;
|
|
266
266
|
};
|
|
267
267
|
})(util || (util = {}));
|
|
268
|
+
var objectUtil;
|
|
269
|
+
(function(objectUtil2) {
|
|
270
|
+
objectUtil2.mergeShapes = (first, second) => {
|
|
271
|
+
return {
|
|
272
|
+
...first,
|
|
273
|
+
...second
|
|
274
|
+
};
|
|
275
|
+
};
|
|
276
|
+
})(objectUtil || (objectUtil = {}));
|
|
268
277
|
var ZodParsedType = util.arrayToEnum([
|
|
269
278
|
"string",
|
|
270
279
|
"nan",
|
|
@@ -408,6 +417,11 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
408
417
|
processError(this);
|
|
409
418
|
return fieldErrors;
|
|
410
419
|
}
|
|
420
|
+
static assert(value) {
|
|
421
|
+
if (!(value instanceof ZodError)) {
|
|
422
|
+
throw new Error(`Not a ZodError: ${value}`);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
411
425
|
toString() {
|
|
412
426
|
return this.message;
|
|
413
427
|
}
|
|
@@ -475,7 +489,12 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
475
489
|
break;
|
|
476
490
|
case ZodIssueCode.invalid_string:
|
|
477
491
|
if (typeof issue.validation === "object") {
|
|
478
|
-
if ("
|
|
492
|
+
if ("includes" in issue.validation) {
|
|
493
|
+
message = `Invalid input: must include "${issue.validation.includes}"`;
|
|
494
|
+
if (typeof issue.validation.position === "number") {
|
|
495
|
+
message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;
|
|
496
|
+
}
|
|
497
|
+
} else if ("startsWith" in issue.validation) {
|
|
479
498
|
message = `Invalid input: must start with "${issue.validation.startsWith}"`;
|
|
480
499
|
} else if ("endsWith" in issue.validation) {
|
|
481
500
|
message = `Invalid input: must end with "${issue.validation.endsWith}"`;
|
|
@@ -496,7 +515,7 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
496
515
|
else if (issue.type === "number")
|
|
497
516
|
message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
|
|
498
517
|
else if (issue.type === "date")
|
|
499
|
-
message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(issue.minimum)}`;
|
|
518
|
+
message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
|
|
500
519
|
else
|
|
501
520
|
message = "Invalid input";
|
|
502
521
|
break;
|
|
@@ -507,8 +526,10 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
507
526
|
message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
|
|
508
527
|
else if (issue.type === "number")
|
|
509
528
|
message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
|
|
529
|
+
else if (issue.type === "bigint")
|
|
530
|
+
message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
|
|
510
531
|
else if (issue.type === "date")
|
|
511
|
-
message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(issue.maximum)}`;
|
|
532
|
+
message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`;
|
|
512
533
|
else
|
|
513
534
|
message = "Invalid input";
|
|
514
535
|
break;
|
|
@@ -550,6 +571,13 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
550
571
|
...issueData,
|
|
551
572
|
path: fullPath
|
|
552
573
|
};
|
|
574
|
+
if (issueData.message !== void 0) {
|
|
575
|
+
return {
|
|
576
|
+
...issueData,
|
|
577
|
+
path: fullPath,
|
|
578
|
+
message: issueData.message
|
|
579
|
+
};
|
|
580
|
+
}
|
|
553
581
|
let errorMessage = "";
|
|
554
582
|
const maps = errorMaps.filter((m) => !!m).slice().reverse();
|
|
555
583
|
for (const map of maps) {
|
|
@@ -558,11 +586,12 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
558
586
|
return {
|
|
559
587
|
...issueData,
|
|
560
588
|
path: fullPath,
|
|
561
|
-
message:
|
|
589
|
+
message: errorMessage
|
|
562
590
|
};
|
|
563
591
|
}, "makeIssue");
|
|
564
592
|
var EMPTY_PATH = [];
|
|
565
593
|
function addIssueToContext(ctx, issueData) {
|
|
594
|
+
const overrideMap = getErrorMap();
|
|
566
595
|
const issue = makeIssue({
|
|
567
596
|
issueData,
|
|
568
597
|
data: ctx.data,
|
|
@@ -570,8 +599,8 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
570
599
|
errorMaps: [
|
|
571
600
|
ctx.common.contextualErrorMap,
|
|
572
601
|
ctx.schemaErrorMap,
|
|
573
|
-
|
|
574
|
-
errorMap
|
|
602
|
+
overrideMap,
|
|
603
|
+
overrideMap === errorMap ? void 0 : errorMap
|
|
575
604
|
].filter((x) => !!x)
|
|
576
605
|
});
|
|
577
606
|
ctx.common.issues.push(issue);
|
|
@@ -605,9 +634,11 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
605
634
|
static async mergeObjectAsync(status, pairs) {
|
|
606
635
|
const syncPairs = [];
|
|
607
636
|
for (const pair of pairs) {
|
|
637
|
+
const key = await pair.key;
|
|
638
|
+
const value = await pair.value;
|
|
608
639
|
syncPairs.push({
|
|
609
|
-
key
|
|
610
|
-
value
|
|
640
|
+
key,
|
|
641
|
+
value
|
|
611
642
|
});
|
|
612
643
|
}
|
|
613
644
|
return ParseStatus.mergeObjectSync(status, syncPairs);
|
|
@@ -624,7 +655,7 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
624
655
|
status.dirty();
|
|
625
656
|
if (value.status === "dirty")
|
|
626
657
|
status.dirty();
|
|
627
|
-
if (typeof value.value !== "undefined" || pair.alwaysSet) {
|
|
658
|
+
if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) {
|
|
628
659
|
finalObject[key.value] = value.value;
|
|
629
660
|
}
|
|
630
661
|
}
|
|
@@ -640,21 +671,53 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
640
671
|
var isAborted = /* @__PURE__ */ __name22((x) => x.status === "aborted", "isAborted");
|
|
641
672
|
var isDirty = /* @__PURE__ */ __name22((x) => x.status === "dirty", "isDirty");
|
|
642
673
|
var isValid = /* @__PURE__ */ __name22((x) => x.status === "valid", "isValid");
|
|
643
|
-
var isAsync = /* @__PURE__ */ __name22((x) => typeof Promise !==
|
|
674
|
+
var isAsync = /* @__PURE__ */ __name22((x) => typeof Promise !== "undefined" && x instanceof Promise, "isAsync");
|
|
675
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
676
|
+
if (kind === "a" && !f)
|
|
677
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
678
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
679
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
680
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
681
|
+
}
|
|
682
|
+
__name(__classPrivateFieldGet, "__classPrivateFieldGet");
|
|
683
|
+
__name2(__classPrivateFieldGet, "__classPrivateFieldGet");
|
|
684
|
+
__name22(__classPrivateFieldGet, "__classPrivateFieldGet");
|
|
685
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
686
|
+
if (kind === "m")
|
|
687
|
+
throw new TypeError("Private method is not writable");
|
|
688
|
+
if (kind === "a" && !f)
|
|
689
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
690
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
691
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
692
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
693
|
+
}
|
|
694
|
+
__name(__classPrivateFieldSet, "__classPrivateFieldSet");
|
|
695
|
+
__name2(__classPrivateFieldSet, "__classPrivateFieldSet");
|
|
696
|
+
__name22(__classPrivateFieldSet, "__classPrivateFieldSet");
|
|
644
697
|
var errorUtil;
|
|
645
698
|
(function(errorUtil2) {
|
|
646
699
|
errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
647
700
|
errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
|
|
648
701
|
})(errorUtil || (errorUtil = {}));
|
|
702
|
+
var _ZodEnum_cache;
|
|
703
|
+
var _ZodNativeEnum_cache;
|
|
649
704
|
var ParseInputLazyPath = /* @__PURE__ */ __name2(class {
|
|
650
705
|
constructor(parent, value, path, key) {
|
|
706
|
+
this._cachedPath = [];
|
|
651
707
|
this.parent = parent;
|
|
652
708
|
this.data = value;
|
|
653
709
|
this._path = path;
|
|
654
710
|
this._key = key;
|
|
655
711
|
}
|
|
656
712
|
get path() {
|
|
657
|
-
|
|
713
|
+
if (!this._cachedPath.length) {
|
|
714
|
+
if (this._key instanceof Array) {
|
|
715
|
+
this._cachedPath.push(...this._path, ...this._key);
|
|
716
|
+
} else {
|
|
717
|
+
this._cachedPath.push(...this._path, this._key);
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
return this._cachedPath;
|
|
658
721
|
}
|
|
659
722
|
}, "ParseInputLazyPath");
|
|
660
723
|
__name22(ParseInputLazyPath, "ParseInputLazyPath");
|
|
@@ -665,8 +728,16 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
665
728
|
if (!ctx.common.issues.length) {
|
|
666
729
|
throw new Error("Validation failed but no issues detected.");
|
|
667
730
|
}
|
|
668
|
-
|
|
669
|
-
|
|
731
|
+
return {
|
|
732
|
+
success: false,
|
|
733
|
+
get error() {
|
|
734
|
+
if (this._error)
|
|
735
|
+
return this._error;
|
|
736
|
+
const error = new ZodError(ctx.common.issues);
|
|
737
|
+
this._error = error;
|
|
738
|
+
return this._error;
|
|
739
|
+
}
|
|
740
|
+
};
|
|
670
741
|
}
|
|
671
742
|
}, "handleResult");
|
|
672
743
|
function processCreateParams(params) {
|
|
@@ -679,12 +750,17 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
679
750
|
if (errorMap2)
|
|
680
751
|
return { errorMap: errorMap2, description };
|
|
681
752
|
const customMap = /* @__PURE__ */ __name22((iss, ctx) => {
|
|
682
|
-
|
|
683
|
-
|
|
753
|
+
var _a, _b;
|
|
754
|
+
const { message } = params;
|
|
755
|
+
if (iss.code === "invalid_enum_value") {
|
|
756
|
+
return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
|
|
757
|
+
}
|
|
684
758
|
if (typeof ctx.data === "undefined") {
|
|
685
|
-
return { message:
|
|
759
|
+
return { message: (_a = message !== null && message !== void 0 ? message : required_error) !== null && _a !== void 0 ? _a : ctx.defaultError };
|
|
686
760
|
}
|
|
687
|
-
|
|
761
|
+
if (iss.code !== "invalid_type")
|
|
762
|
+
return { message: ctx.defaultError };
|
|
763
|
+
return { message: (_b = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b !== void 0 ? _b : ctx.defaultError };
|
|
688
764
|
}, "customMap");
|
|
689
765
|
return { errorMap: customMap, description };
|
|
690
766
|
}
|
|
@@ -716,6 +792,7 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
716
792
|
this.catch = this.catch.bind(this);
|
|
717
793
|
this.describe = this.describe.bind(this);
|
|
718
794
|
this.pipe = this.pipe.bind(this);
|
|
795
|
+
this.readonly = this.readonly.bind(this);
|
|
719
796
|
this.isNullable = this.isNullable.bind(this);
|
|
720
797
|
this.isOptional = this.isOptional.bind(this);
|
|
721
798
|
}
|
|
@@ -860,28 +937,29 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
860
937
|
return this._refinement(refinement);
|
|
861
938
|
}
|
|
862
939
|
optional() {
|
|
863
|
-
return ZodOptional.create(this);
|
|
940
|
+
return ZodOptional.create(this, this._def);
|
|
864
941
|
}
|
|
865
942
|
nullable() {
|
|
866
|
-
return ZodNullable.create(this);
|
|
943
|
+
return ZodNullable.create(this, this._def);
|
|
867
944
|
}
|
|
868
945
|
nullish() {
|
|
869
|
-
return this.
|
|
946
|
+
return this.nullable().optional();
|
|
870
947
|
}
|
|
871
948
|
array() {
|
|
872
|
-
return ZodArray.create(this);
|
|
949
|
+
return ZodArray.create(this, this._def);
|
|
873
950
|
}
|
|
874
951
|
promise() {
|
|
875
|
-
return ZodPromise.create(this);
|
|
952
|
+
return ZodPromise.create(this, this._def);
|
|
876
953
|
}
|
|
877
954
|
or(option) {
|
|
878
|
-
return ZodUnion.create([this, option]);
|
|
955
|
+
return ZodUnion.create([this, option], this._def);
|
|
879
956
|
}
|
|
880
957
|
and(incoming) {
|
|
881
|
-
return ZodIntersection.create(this, incoming);
|
|
958
|
+
return ZodIntersection.create(this, incoming, this._def);
|
|
882
959
|
}
|
|
883
960
|
transform(transform) {
|
|
884
961
|
return new ZodEffects({
|
|
962
|
+
...processCreateParams(this._def),
|
|
885
963
|
schema: this,
|
|
886
964
|
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
|
887
965
|
effect: { type: "transform", transform }
|
|
@@ -890,6 +968,7 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
890
968
|
default(def) {
|
|
891
969
|
const defaultValueFunc = typeof def === "function" ? def : () => def;
|
|
892
970
|
return new ZodDefault({
|
|
971
|
+
...processCreateParams(this._def),
|
|
893
972
|
innerType: this,
|
|
894
973
|
defaultValue: defaultValueFunc,
|
|
895
974
|
typeName: ZodFirstPartyTypeKind.ZodDefault
|
|
@@ -899,14 +978,15 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
899
978
|
return new ZodBranded({
|
|
900
979
|
typeName: ZodFirstPartyTypeKind.ZodBranded,
|
|
901
980
|
type: this,
|
|
902
|
-
...processCreateParams(
|
|
981
|
+
...processCreateParams(this._def)
|
|
903
982
|
});
|
|
904
983
|
}
|
|
905
984
|
catch(def) {
|
|
906
|
-
const
|
|
985
|
+
const catchValueFunc = typeof def === "function" ? def : () => def;
|
|
907
986
|
return new ZodCatch({
|
|
987
|
+
...processCreateParams(this._def),
|
|
908
988
|
innerType: this,
|
|
909
|
-
|
|
989
|
+
catchValue: catchValueFunc,
|
|
910
990
|
typeName: ZodFirstPartyTypeKind.ZodCatch
|
|
911
991
|
});
|
|
912
992
|
}
|
|
@@ -920,6 +1000,9 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
920
1000
|
pipe(target) {
|
|
921
1001
|
return ZodPipeline.create(this, target);
|
|
922
1002
|
}
|
|
1003
|
+
readonly() {
|
|
1004
|
+
return ZodReadonly.create(this);
|
|
1005
|
+
}
|
|
923
1006
|
isOptional() {
|
|
924
1007
|
return this.safeParse(void 0).success;
|
|
925
1008
|
}
|
|
@@ -929,43 +1012,62 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
929
1012
|
}, "ZodType");
|
|
930
1013
|
__name22(ZodType, "ZodType");
|
|
931
1014
|
var cuidRegex = /^c[^\s-]{8,}$/i;
|
|
932
|
-
var
|
|
933
|
-
var
|
|
934
|
-
var
|
|
1015
|
+
var cuid2Regex = /^[0-9a-z]+$/;
|
|
1016
|
+
var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;
|
|
1017
|
+
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;
|
|
1018
|
+
var nanoidRegex = /^[a-z0-9_-]{21}$/i;
|
|
1019
|
+
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)?)??$/;
|
|
1020
|
+
var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
|
|
1021
|
+
var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
|
|
1022
|
+
var emojiRegex;
|
|
1023
|
+
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])$/;
|
|
1024
|
+
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})))$/;
|
|
1025
|
+
var base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
|
|
1026
|
+
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])))`;
|
|
1027
|
+
var dateRegex = new RegExp(`^${dateRegexSource}$`);
|
|
1028
|
+
function timeRegexSource(args) {
|
|
1029
|
+
let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
|
|
935
1030
|
if (args.precision) {
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
|
|
940
|
-
}
|
|
941
|
-
} else if (args.precision === 0) {
|
|
942
|
-
if (args.offset) {
|
|
943
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$`);
|
|
944
|
-
} else {
|
|
945
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
|
|
946
|
-
}
|
|
947
|
-
} else {
|
|
948
|
-
if (args.offset) {
|
|
949
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$`);
|
|
950
|
-
} else {
|
|
951
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
|
|
952
|
-
}
|
|
1031
|
+
regex = `${regex}\\.\\d{${args.precision}}`;
|
|
1032
|
+
} else if (args.precision == null) {
|
|
1033
|
+
regex = `${regex}(\\.\\d+)?`;
|
|
953
1034
|
}
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
1035
|
+
return regex;
|
|
1036
|
+
}
|
|
1037
|
+
__name(timeRegexSource, "timeRegexSource");
|
|
1038
|
+
__name2(timeRegexSource, "timeRegexSource");
|
|
1039
|
+
__name22(timeRegexSource, "timeRegexSource");
|
|
1040
|
+
function timeRegex(args) {
|
|
1041
|
+
return new RegExp(`^${timeRegexSource(args)}$`);
|
|
1042
|
+
}
|
|
1043
|
+
__name(timeRegex, "timeRegex");
|
|
1044
|
+
__name2(timeRegex, "timeRegex");
|
|
1045
|
+
__name22(timeRegex, "timeRegex");
|
|
1046
|
+
function datetimeRegex(args) {
|
|
1047
|
+
let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
|
|
1048
|
+
const opts = [];
|
|
1049
|
+
opts.push(args.local ? `Z?` : `Z`);
|
|
1050
|
+
if (args.offset)
|
|
1051
|
+
opts.push(`([+-]\\d{2}:?\\d{2})`);
|
|
1052
|
+
regex = `${regex}(${opts.join("|")})`;
|
|
1053
|
+
return new RegExp(`^${regex}$`);
|
|
1054
|
+
}
|
|
1055
|
+
__name(datetimeRegex, "datetimeRegex");
|
|
1056
|
+
__name2(datetimeRegex, "datetimeRegex");
|
|
1057
|
+
__name22(datetimeRegex, "datetimeRegex");
|
|
1058
|
+
function isValidIP(ip, version) {
|
|
1059
|
+
if ((version === "v4" || !version) && ipv4Regex.test(ip)) {
|
|
1060
|
+
return true;
|
|
968
1061
|
}
|
|
1062
|
+
if ((version === "v6" || !version) && ipv6Regex.test(ip)) {
|
|
1063
|
+
return true;
|
|
1064
|
+
}
|
|
1065
|
+
return false;
|
|
1066
|
+
}
|
|
1067
|
+
__name(isValidIP, "isValidIP");
|
|
1068
|
+
__name2(isValidIP, "isValidIP");
|
|
1069
|
+
__name22(isValidIP, "isValidIP");
|
|
1070
|
+
var ZodString = /* @__PURE__ */ __name2(class extends ZodType {
|
|
969
1071
|
_parse(input) {
|
|
970
1072
|
if (this._def.coerce) {
|
|
971
1073
|
input.data = String(input.data);
|
|
@@ -973,14 +1075,11 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
973
1075
|
const parsedType = this._getType(input);
|
|
974
1076
|
if (parsedType !== ZodParsedType.string) {
|
|
975
1077
|
const ctx2 = this._getOrReturnCtx(input);
|
|
976
|
-
addIssueToContext(
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
received: ctx2.parsedType
|
|
982
|
-
}
|
|
983
|
-
);
|
|
1078
|
+
addIssueToContext(ctx2, {
|
|
1079
|
+
code: ZodIssueCode.invalid_type,
|
|
1080
|
+
expected: ZodParsedType.string,
|
|
1081
|
+
received: ctx2.parsedType
|
|
1082
|
+
});
|
|
984
1083
|
return INVALID;
|
|
985
1084
|
}
|
|
986
1085
|
const status = new ParseStatus();
|
|
@@ -1048,6 +1147,19 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
1048
1147
|
});
|
|
1049
1148
|
status.dirty();
|
|
1050
1149
|
}
|
|
1150
|
+
} else if (check.kind === "emoji") {
|
|
1151
|
+
if (!emojiRegex) {
|
|
1152
|
+
emojiRegex = new RegExp(_emojiRegex, "u");
|
|
1153
|
+
}
|
|
1154
|
+
if (!emojiRegex.test(input.data)) {
|
|
1155
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1156
|
+
addIssueToContext(ctx, {
|
|
1157
|
+
validation: "emoji",
|
|
1158
|
+
code: ZodIssueCode.invalid_string,
|
|
1159
|
+
message: check.message
|
|
1160
|
+
});
|
|
1161
|
+
status.dirty();
|
|
1162
|
+
}
|
|
1051
1163
|
} else if (check.kind === "uuid") {
|
|
1052
1164
|
if (!uuidRegex.test(input.data)) {
|
|
1053
1165
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
@@ -1058,6 +1170,16 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
1058
1170
|
});
|
|
1059
1171
|
status.dirty();
|
|
1060
1172
|
}
|
|
1173
|
+
} else if (check.kind === "nanoid") {
|
|
1174
|
+
if (!nanoidRegex.test(input.data)) {
|
|
1175
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1176
|
+
addIssueToContext(ctx, {
|
|
1177
|
+
validation: "nanoid",
|
|
1178
|
+
code: ZodIssueCode.invalid_string,
|
|
1179
|
+
message: check.message
|
|
1180
|
+
});
|
|
1181
|
+
status.dirty();
|
|
1182
|
+
}
|
|
1061
1183
|
} else if (check.kind === "cuid") {
|
|
1062
1184
|
if (!cuidRegex.test(input.data)) {
|
|
1063
1185
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
@@ -1068,6 +1190,26 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
1068
1190
|
});
|
|
1069
1191
|
status.dirty();
|
|
1070
1192
|
}
|
|
1193
|
+
} else if (check.kind === "cuid2") {
|
|
1194
|
+
if (!cuid2Regex.test(input.data)) {
|
|
1195
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1196
|
+
addIssueToContext(ctx, {
|
|
1197
|
+
validation: "cuid2",
|
|
1198
|
+
code: ZodIssueCode.invalid_string,
|
|
1199
|
+
message: check.message
|
|
1200
|
+
});
|
|
1201
|
+
status.dirty();
|
|
1202
|
+
}
|
|
1203
|
+
} else if (check.kind === "ulid") {
|
|
1204
|
+
if (!ulidRegex.test(input.data)) {
|
|
1205
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1206
|
+
addIssueToContext(ctx, {
|
|
1207
|
+
validation: "ulid",
|
|
1208
|
+
code: ZodIssueCode.invalid_string,
|
|
1209
|
+
message: check.message
|
|
1210
|
+
});
|
|
1211
|
+
status.dirty();
|
|
1212
|
+
}
|
|
1071
1213
|
} else if (check.kind === "url") {
|
|
1072
1214
|
try {
|
|
1073
1215
|
new URL(input.data);
|
|
@@ -1094,6 +1236,20 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
1094
1236
|
}
|
|
1095
1237
|
} else if (check.kind === "trim") {
|
|
1096
1238
|
input.data = input.data.trim();
|
|
1239
|
+
} else if (check.kind === "includes") {
|
|
1240
|
+
if (!input.data.includes(check.value, check.position)) {
|
|
1241
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1242
|
+
addIssueToContext(ctx, {
|
|
1243
|
+
code: ZodIssueCode.invalid_string,
|
|
1244
|
+
validation: { includes: check.value, position: check.position },
|
|
1245
|
+
message: check.message
|
|
1246
|
+
});
|
|
1247
|
+
status.dirty();
|
|
1248
|
+
}
|
|
1249
|
+
} else if (check.kind === "toLowerCase") {
|
|
1250
|
+
input.data = input.data.toLowerCase();
|
|
1251
|
+
} else if (check.kind === "toUpperCase") {
|
|
1252
|
+
input.data = input.data.toUpperCase();
|
|
1097
1253
|
} else if (check.kind === "startsWith") {
|
|
1098
1254
|
if (!input.data.startsWith(check.value)) {
|
|
1099
1255
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
@@ -1125,12 +1281,71 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
1125
1281
|
});
|
|
1126
1282
|
status.dirty();
|
|
1127
1283
|
}
|
|
1284
|
+
} else if (check.kind === "date") {
|
|
1285
|
+
const regex = dateRegex;
|
|
1286
|
+
if (!regex.test(input.data)) {
|
|
1287
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1288
|
+
addIssueToContext(ctx, {
|
|
1289
|
+
code: ZodIssueCode.invalid_string,
|
|
1290
|
+
validation: "date",
|
|
1291
|
+
message: check.message
|
|
1292
|
+
});
|
|
1293
|
+
status.dirty();
|
|
1294
|
+
}
|
|
1295
|
+
} else if (check.kind === "time") {
|
|
1296
|
+
const regex = timeRegex(check);
|
|
1297
|
+
if (!regex.test(input.data)) {
|
|
1298
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1299
|
+
addIssueToContext(ctx, {
|
|
1300
|
+
code: ZodIssueCode.invalid_string,
|
|
1301
|
+
validation: "time",
|
|
1302
|
+
message: check.message
|
|
1303
|
+
});
|
|
1304
|
+
status.dirty();
|
|
1305
|
+
}
|
|
1306
|
+
} else if (check.kind === "duration") {
|
|
1307
|
+
if (!durationRegex.test(input.data)) {
|
|
1308
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1309
|
+
addIssueToContext(ctx, {
|
|
1310
|
+
validation: "duration",
|
|
1311
|
+
code: ZodIssueCode.invalid_string,
|
|
1312
|
+
message: check.message
|
|
1313
|
+
});
|
|
1314
|
+
status.dirty();
|
|
1315
|
+
}
|
|
1316
|
+
} else if (check.kind === "ip") {
|
|
1317
|
+
if (!isValidIP(input.data, check.version)) {
|
|
1318
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1319
|
+
addIssueToContext(ctx, {
|
|
1320
|
+
validation: "ip",
|
|
1321
|
+
code: ZodIssueCode.invalid_string,
|
|
1322
|
+
message: check.message
|
|
1323
|
+
});
|
|
1324
|
+
status.dirty();
|
|
1325
|
+
}
|
|
1326
|
+
} else if (check.kind === "base64") {
|
|
1327
|
+
if (!base64Regex.test(input.data)) {
|
|
1328
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1329
|
+
addIssueToContext(ctx, {
|
|
1330
|
+
validation: "base64",
|
|
1331
|
+
code: ZodIssueCode.invalid_string,
|
|
1332
|
+
message: check.message
|
|
1333
|
+
});
|
|
1334
|
+
status.dirty();
|
|
1335
|
+
}
|
|
1128
1336
|
} else {
|
|
1129
1337
|
util.assertNever(check);
|
|
1130
1338
|
}
|
|
1131
1339
|
}
|
|
1132
1340
|
return { status: status.value, value: input.data };
|
|
1133
1341
|
}
|
|
1342
|
+
_regex(regex, validation, message) {
|
|
1343
|
+
return this.refinement((data) => regex.test(data), {
|
|
1344
|
+
validation,
|
|
1345
|
+
code: ZodIssueCode.invalid_string,
|
|
1346
|
+
...errorUtil.errToObj(message)
|
|
1347
|
+
});
|
|
1348
|
+
}
|
|
1134
1349
|
_addCheck(check) {
|
|
1135
1350
|
return new ZodString({
|
|
1136
1351
|
...this._def,
|
|
@@ -1143,19 +1358,38 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
1143
1358
|
url(message) {
|
|
1144
1359
|
return this._addCheck({ kind: "url", ...errorUtil.errToObj(message) });
|
|
1145
1360
|
}
|
|
1361
|
+
emoji(message) {
|
|
1362
|
+
return this._addCheck({ kind: "emoji", ...errorUtil.errToObj(message) });
|
|
1363
|
+
}
|
|
1146
1364
|
uuid(message) {
|
|
1147
1365
|
return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) });
|
|
1148
1366
|
}
|
|
1367
|
+
nanoid(message) {
|
|
1368
|
+
return this._addCheck({ kind: "nanoid", ...errorUtil.errToObj(message) });
|
|
1369
|
+
}
|
|
1149
1370
|
cuid(message) {
|
|
1150
1371
|
return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
|
|
1151
1372
|
}
|
|
1373
|
+
cuid2(message) {
|
|
1374
|
+
return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
|
|
1375
|
+
}
|
|
1376
|
+
ulid(message) {
|
|
1377
|
+
return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) });
|
|
1378
|
+
}
|
|
1379
|
+
base64(message) {
|
|
1380
|
+
return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
|
|
1381
|
+
}
|
|
1382
|
+
ip(options) {
|
|
1383
|
+
return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
|
|
1384
|
+
}
|
|
1152
1385
|
datetime(options) {
|
|
1153
|
-
var _a;
|
|
1386
|
+
var _a, _b;
|
|
1154
1387
|
if (typeof options === "string") {
|
|
1155
1388
|
return this._addCheck({
|
|
1156
1389
|
kind: "datetime",
|
|
1157
1390
|
precision: null,
|
|
1158
1391
|
offset: false,
|
|
1392
|
+
local: false,
|
|
1159
1393
|
message: options
|
|
1160
1394
|
});
|
|
1161
1395
|
}
|
|
@@ -1163,9 +1397,30 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
1163
1397
|
kind: "datetime",
|
|
1164
1398
|
precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
|
|
1165
1399
|
offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
|
|
1400
|
+
local: (_b = options === null || options === void 0 ? void 0 : options.local) !== null && _b !== void 0 ? _b : false,
|
|
1401
|
+
...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
|
|
1402
|
+
});
|
|
1403
|
+
}
|
|
1404
|
+
date(message) {
|
|
1405
|
+
return this._addCheck({ kind: "date", message });
|
|
1406
|
+
}
|
|
1407
|
+
time(options) {
|
|
1408
|
+
if (typeof options === "string") {
|
|
1409
|
+
return this._addCheck({
|
|
1410
|
+
kind: "time",
|
|
1411
|
+
precision: null,
|
|
1412
|
+
message: options
|
|
1413
|
+
});
|
|
1414
|
+
}
|
|
1415
|
+
return this._addCheck({
|
|
1416
|
+
kind: "time",
|
|
1417
|
+
precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
|
|
1166
1418
|
...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
|
|
1167
1419
|
});
|
|
1168
1420
|
}
|
|
1421
|
+
duration(message) {
|
|
1422
|
+
return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) });
|
|
1423
|
+
}
|
|
1169
1424
|
regex(regex, message) {
|
|
1170
1425
|
return this._addCheck({
|
|
1171
1426
|
kind: "regex",
|
|
@@ -1173,6 +1428,14 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
1173
1428
|
...errorUtil.errToObj(message)
|
|
1174
1429
|
});
|
|
1175
1430
|
}
|
|
1431
|
+
includes(value, options) {
|
|
1432
|
+
return this._addCheck({
|
|
1433
|
+
kind: "includes",
|
|
1434
|
+
value,
|
|
1435
|
+
position: options === null || options === void 0 ? void 0 : options.position,
|
|
1436
|
+
...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
|
|
1437
|
+
});
|
|
1438
|
+
}
|
|
1176
1439
|
startsWith(value, message) {
|
|
1177
1440
|
return this._addCheck({
|
|
1178
1441
|
kind: "startsWith",
|
|
@@ -1208,21 +1471,69 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
1208
1471
|
...errorUtil.errToObj(message)
|
|
1209
1472
|
});
|
|
1210
1473
|
}
|
|
1474
|
+
nonempty(message) {
|
|
1475
|
+
return this.min(1, errorUtil.errToObj(message));
|
|
1476
|
+
}
|
|
1477
|
+
trim() {
|
|
1478
|
+
return new ZodString({
|
|
1479
|
+
...this._def,
|
|
1480
|
+
checks: [...this._def.checks, { kind: "trim" }]
|
|
1481
|
+
});
|
|
1482
|
+
}
|
|
1483
|
+
toLowerCase() {
|
|
1484
|
+
return new ZodString({
|
|
1485
|
+
...this._def,
|
|
1486
|
+
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
1487
|
+
});
|
|
1488
|
+
}
|
|
1489
|
+
toUpperCase() {
|
|
1490
|
+
return new ZodString({
|
|
1491
|
+
...this._def,
|
|
1492
|
+
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
1493
|
+
});
|
|
1494
|
+
}
|
|
1211
1495
|
get isDatetime() {
|
|
1212
1496
|
return !!this._def.checks.find((ch) => ch.kind === "datetime");
|
|
1213
1497
|
}
|
|
1498
|
+
get isDate() {
|
|
1499
|
+
return !!this._def.checks.find((ch) => ch.kind === "date");
|
|
1500
|
+
}
|
|
1501
|
+
get isTime() {
|
|
1502
|
+
return !!this._def.checks.find((ch) => ch.kind === "time");
|
|
1503
|
+
}
|
|
1504
|
+
get isDuration() {
|
|
1505
|
+
return !!this._def.checks.find((ch) => ch.kind === "duration");
|
|
1506
|
+
}
|
|
1214
1507
|
get isEmail() {
|
|
1215
1508
|
return !!this._def.checks.find((ch) => ch.kind === "email");
|
|
1216
1509
|
}
|
|
1217
1510
|
get isURL() {
|
|
1218
1511
|
return !!this._def.checks.find((ch) => ch.kind === "url");
|
|
1219
1512
|
}
|
|
1513
|
+
get isEmoji() {
|
|
1514
|
+
return !!this._def.checks.find((ch) => ch.kind === "emoji");
|
|
1515
|
+
}
|
|
1220
1516
|
get isUUID() {
|
|
1221
1517
|
return !!this._def.checks.find((ch) => ch.kind === "uuid");
|
|
1222
1518
|
}
|
|
1519
|
+
get isNANOID() {
|
|
1520
|
+
return !!this._def.checks.find((ch) => ch.kind === "nanoid");
|
|
1521
|
+
}
|
|
1223
1522
|
get isCUID() {
|
|
1224
1523
|
return !!this._def.checks.find((ch) => ch.kind === "cuid");
|
|
1225
1524
|
}
|
|
1525
|
+
get isCUID2() {
|
|
1526
|
+
return !!this._def.checks.find((ch) => ch.kind === "cuid2");
|
|
1527
|
+
}
|
|
1528
|
+
get isULID() {
|
|
1529
|
+
return !!this._def.checks.find((ch) => ch.kind === "ulid");
|
|
1530
|
+
}
|
|
1531
|
+
get isIP() {
|
|
1532
|
+
return !!this._def.checks.find((ch) => ch.kind === "ip");
|
|
1533
|
+
}
|
|
1534
|
+
get isBase64() {
|
|
1535
|
+
return !!this._def.checks.find((ch) => ch.kind === "base64");
|
|
1536
|
+
}
|
|
1226
1537
|
get minLength() {
|
|
1227
1538
|
let min = null;
|
|
1228
1539
|
for (const ch of this._def.checks) {
|
|
@@ -1436,6 +1747,19 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
1436
1747
|
message: errorUtil.toString(message)
|
|
1437
1748
|
});
|
|
1438
1749
|
}
|
|
1750
|
+
safe(message) {
|
|
1751
|
+
return this._addCheck({
|
|
1752
|
+
kind: "min",
|
|
1753
|
+
inclusive: true,
|
|
1754
|
+
value: Number.MIN_SAFE_INTEGER,
|
|
1755
|
+
message: errorUtil.toString(message)
|
|
1756
|
+
})._addCheck({
|
|
1757
|
+
kind: "max",
|
|
1758
|
+
inclusive: true,
|
|
1759
|
+
value: Number.MAX_SAFE_INTEGER,
|
|
1760
|
+
message: errorUtil.toString(message)
|
|
1761
|
+
});
|
|
1762
|
+
}
|
|
1439
1763
|
get minValue() {
|
|
1440
1764
|
let min = null;
|
|
1441
1765
|
for (const ch of this._def.checks) {
|
|
@@ -1457,7 +1781,22 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
1457
1781
|
return max;
|
|
1458
1782
|
}
|
|
1459
1783
|
get isInt() {
|
|
1460
|
-
return !!this._def.checks.find((ch) => ch.kind === "int");
|
|
1784
|
+
return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
|
|
1785
|
+
}
|
|
1786
|
+
get isFinite() {
|
|
1787
|
+
let max = null, min = null;
|
|
1788
|
+
for (const ch of this._def.checks) {
|
|
1789
|
+
if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
|
|
1790
|
+
return true;
|
|
1791
|
+
} else if (ch.kind === "min") {
|
|
1792
|
+
if (min === null || ch.value > min)
|
|
1793
|
+
min = ch.value;
|
|
1794
|
+
} else if (ch.kind === "max") {
|
|
1795
|
+
if (max === null || ch.value < max)
|
|
1796
|
+
max = ch.value;
|
|
1797
|
+
}
|
|
1798
|
+
}
|
|
1799
|
+
return Number.isFinite(min) && Number.isFinite(max);
|
|
1461
1800
|
}
|
|
1462
1801
|
}, "ZodNumber");
|
|
1463
1802
|
__name22(ZodNumber, "ZodNumber");
|
|
@@ -1470,27 +1809,167 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
1470
1809
|
});
|
|
1471
1810
|
};
|
|
1472
1811
|
var ZodBigInt = /* @__PURE__ */ __name2(class extends ZodType {
|
|
1812
|
+
constructor() {
|
|
1813
|
+
super(...arguments);
|
|
1814
|
+
this.min = this.gte;
|
|
1815
|
+
this.max = this.lte;
|
|
1816
|
+
}
|
|
1473
1817
|
_parse(input) {
|
|
1474
1818
|
if (this._def.coerce) {
|
|
1475
1819
|
input.data = BigInt(input.data);
|
|
1476
1820
|
}
|
|
1477
1821
|
const parsedType = this._getType(input);
|
|
1478
1822
|
if (parsedType !== ZodParsedType.bigint) {
|
|
1479
|
-
const
|
|
1480
|
-
addIssueToContext(
|
|
1823
|
+
const ctx2 = this._getOrReturnCtx(input);
|
|
1824
|
+
addIssueToContext(ctx2, {
|
|
1481
1825
|
code: ZodIssueCode.invalid_type,
|
|
1482
1826
|
expected: ZodParsedType.bigint,
|
|
1483
|
-
received:
|
|
1827
|
+
received: ctx2.parsedType
|
|
1484
1828
|
});
|
|
1485
1829
|
return INVALID;
|
|
1486
1830
|
}
|
|
1487
|
-
|
|
1831
|
+
let ctx = void 0;
|
|
1832
|
+
const status = new ParseStatus();
|
|
1833
|
+
for (const check of this._def.checks) {
|
|
1834
|
+
if (check.kind === "min") {
|
|
1835
|
+
const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
|
|
1836
|
+
if (tooSmall) {
|
|
1837
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1838
|
+
addIssueToContext(ctx, {
|
|
1839
|
+
code: ZodIssueCode.too_small,
|
|
1840
|
+
type: "bigint",
|
|
1841
|
+
minimum: check.value,
|
|
1842
|
+
inclusive: check.inclusive,
|
|
1843
|
+
message: check.message
|
|
1844
|
+
});
|
|
1845
|
+
status.dirty();
|
|
1846
|
+
}
|
|
1847
|
+
} else if (check.kind === "max") {
|
|
1848
|
+
const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
|
|
1849
|
+
if (tooBig) {
|
|
1850
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1851
|
+
addIssueToContext(ctx, {
|
|
1852
|
+
code: ZodIssueCode.too_big,
|
|
1853
|
+
type: "bigint",
|
|
1854
|
+
maximum: check.value,
|
|
1855
|
+
inclusive: check.inclusive,
|
|
1856
|
+
message: check.message
|
|
1857
|
+
});
|
|
1858
|
+
status.dirty();
|
|
1859
|
+
}
|
|
1860
|
+
} else if (check.kind === "multipleOf") {
|
|
1861
|
+
if (input.data % check.value !== BigInt(0)) {
|
|
1862
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1863
|
+
addIssueToContext(ctx, {
|
|
1864
|
+
code: ZodIssueCode.not_multiple_of,
|
|
1865
|
+
multipleOf: check.value,
|
|
1866
|
+
message: check.message
|
|
1867
|
+
});
|
|
1868
|
+
status.dirty();
|
|
1869
|
+
}
|
|
1870
|
+
} else {
|
|
1871
|
+
util.assertNever(check);
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
return { status: status.value, value: input.data };
|
|
1875
|
+
}
|
|
1876
|
+
gte(value, message) {
|
|
1877
|
+
return this.setLimit("min", value, true, errorUtil.toString(message));
|
|
1878
|
+
}
|
|
1879
|
+
gt(value, message) {
|
|
1880
|
+
return this.setLimit("min", value, false, errorUtil.toString(message));
|
|
1881
|
+
}
|
|
1882
|
+
lte(value, message) {
|
|
1883
|
+
return this.setLimit("max", value, true, errorUtil.toString(message));
|
|
1884
|
+
}
|
|
1885
|
+
lt(value, message) {
|
|
1886
|
+
return this.setLimit("max", value, false, errorUtil.toString(message));
|
|
1887
|
+
}
|
|
1888
|
+
setLimit(kind, value, inclusive, message) {
|
|
1889
|
+
return new ZodBigInt({
|
|
1890
|
+
...this._def,
|
|
1891
|
+
checks: [
|
|
1892
|
+
...this._def.checks,
|
|
1893
|
+
{
|
|
1894
|
+
kind,
|
|
1895
|
+
value,
|
|
1896
|
+
inclusive,
|
|
1897
|
+
message: errorUtil.toString(message)
|
|
1898
|
+
}
|
|
1899
|
+
]
|
|
1900
|
+
});
|
|
1901
|
+
}
|
|
1902
|
+
_addCheck(check) {
|
|
1903
|
+
return new ZodBigInt({
|
|
1904
|
+
...this._def,
|
|
1905
|
+
checks: [...this._def.checks, check]
|
|
1906
|
+
});
|
|
1907
|
+
}
|
|
1908
|
+
positive(message) {
|
|
1909
|
+
return this._addCheck({
|
|
1910
|
+
kind: "min",
|
|
1911
|
+
value: BigInt(0),
|
|
1912
|
+
inclusive: false,
|
|
1913
|
+
message: errorUtil.toString(message)
|
|
1914
|
+
});
|
|
1915
|
+
}
|
|
1916
|
+
negative(message) {
|
|
1917
|
+
return this._addCheck({
|
|
1918
|
+
kind: "max",
|
|
1919
|
+
value: BigInt(0),
|
|
1920
|
+
inclusive: false,
|
|
1921
|
+
message: errorUtil.toString(message)
|
|
1922
|
+
});
|
|
1923
|
+
}
|
|
1924
|
+
nonpositive(message) {
|
|
1925
|
+
return this._addCheck({
|
|
1926
|
+
kind: "max",
|
|
1927
|
+
value: BigInt(0),
|
|
1928
|
+
inclusive: true,
|
|
1929
|
+
message: errorUtil.toString(message)
|
|
1930
|
+
});
|
|
1931
|
+
}
|
|
1932
|
+
nonnegative(message) {
|
|
1933
|
+
return this._addCheck({
|
|
1934
|
+
kind: "min",
|
|
1935
|
+
value: BigInt(0),
|
|
1936
|
+
inclusive: true,
|
|
1937
|
+
message: errorUtil.toString(message)
|
|
1938
|
+
});
|
|
1939
|
+
}
|
|
1940
|
+
multipleOf(value, message) {
|
|
1941
|
+
return this._addCheck({
|
|
1942
|
+
kind: "multipleOf",
|
|
1943
|
+
value,
|
|
1944
|
+
message: errorUtil.toString(message)
|
|
1945
|
+
});
|
|
1946
|
+
}
|
|
1947
|
+
get minValue() {
|
|
1948
|
+
let min = null;
|
|
1949
|
+
for (const ch of this._def.checks) {
|
|
1950
|
+
if (ch.kind === "min") {
|
|
1951
|
+
if (min === null || ch.value > min)
|
|
1952
|
+
min = ch.value;
|
|
1953
|
+
}
|
|
1954
|
+
}
|
|
1955
|
+
return min;
|
|
1956
|
+
}
|
|
1957
|
+
get maxValue() {
|
|
1958
|
+
let max = null;
|
|
1959
|
+
for (const ch of this._def.checks) {
|
|
1960
|
+
if (ch.kind === "max") {
|
|
1961
|
+
if (max === null || ch.value < max)
|
|
1962
|
+
max = ch.value;
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
return max;
|
|
1488
1966
|
}
|
|
1489
1967
|
}, "ZodBigInt");
|
|
1490
1968
|
__name22(ZodBigInt, "ZodBigInt");
|
|
1491
1969
|
ZodBigInt.create = (params) => {
|
|
1492
1970
|
var _a;
|
|
1493
1971
|
return new ZodBigInt({
|
|
1972
|
+
checks: [],
|
|
1494
1973
|
typeName: ZodFirstPartyTypeKind.ZodBigInt,
|
|
1495
1974
|
coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
|
|
1496
1975
|
...processCreateParams(params)
|
|
@@ -1825,13 +2304,13 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
1825
2304
|
}
|
|
1826
2305
|
}
|
|
1827
2306
|
if (ctx.common.async) {
|
|
1828
|
-
return Promise.all(ctx.data.map((item, i) => {
|
|
2307
|
+
return Promise.all([...ctx.data].map((item, i) => {
|
|
1829
2308
|
return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
|
|
1830
2309
|
})).then((result2) => {
|
|
1831
2310
|
return ParseStatus.mergeArray(status, result2);
|
|
1832
2311
|
});
|
|
1833
2312
|
}
|
|
1834
|
-
const result = ctx.data.map((item, i) => {
|
|
2313
|
+
const result = [...ctx.data].map((item, i) => {
|
|
1835
2314
|
return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
|
|
1836
2315
|
});
|
|
1837
2316
|
return ParseStatus.mergeArray(status, result);
|
|
@@ -1872,24 +2351,6 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
1872
2351
|
...processCreateParams(params)
|
|
1873
2352
|
});
|
|
1874
2353
|
};
|
|
1875
|
-
var objectUtil;
|
|
1876
|
-
(function(objectUtil2) {
|
|
1877
|
-
objectUtil2.mergeShapes = (first, second) => {
|
|
1878
|
-
return {
|
|
1879
|
-
...first,
|
|
1880
|
-
...second
|
|
1881
|
-
};
|
|
1882
|
-
};
|
|
1883
|
-
})(objectUtil || (objectUtil = {}));
|
|
1884
|
-
var AugmentFactory = /* @__PURE__ */ __name22((def) => (augmentation) => {
|
|
1885
|
-
return new ZodObject({
|
|
1886
|
-
...def,
|
|
1887
|
-
shape: () => ({
|
|
1888
|
-
...def.shape(),
|
|
1889
|
-
...augmentation
|
|
1890
|
-
})
|
|
1891
|
-
});
|
|
1892
|
-
}, "AugmentFactory");
|
|
1893
2354
|
function deepPartialify(schema) {
|
|
1894
2355
|
if (schema instanceof ZodObject) {
|
|
1895
2356
|
const newShape = {};
|
|
@@ -1902,7 +2363,10 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
1902
2363
|
shape: () => newShape
|
|
1903
2364
|
});
|
|
1904
2365
|
} else if (schema instanceof ZodArray) {
|
|
1905
|
-
return ZodArray
|
|
2366
|
+
return new ZodArray({
|
|
2367
|
+
...schema._def,
|
|
2368
|
+
type: deepPartialify(schema.element)
|
|
2369
|
+
});
|
|
1906
2370
|
} else if (schema instanceof ZodOptional) {
|
|
1907
2371
|
return ZodOptional.create(deepPartialify(schema.unwrap()));
|
|
1908
2372
|
} else if (schema instanceof ZodNullable) {
|
|
@@ -1921,8 +2385,7 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
1921
2385
|
super(...arguments);
|
|
1922
2386
|
this._cached = null;
|
|
1923
2387
|
this.nonstrict = this.passthrough;
|
|
1924
|
-
this.augment =
|
|
1925
|
-
this.extend = AugmentFactory(this._def);
|
|
2388
|
+
this.augment = this.extend;
|
|
1926
2389
|
}
|
|
1927
2390
|
_getCached() {
|
|
1928
2391
|
if (this._cached !== null)
|
|
@@ -2002,9 +2465,10 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
2002
2465
|
const syncPairs = [];
|
|
2003
2466
|
for (const pair of pairs) {
|
|
2004
2467
|
const key = await pair.key;
|
|
2468
|
+
const value = await pair.value;
|
|
2005
2469
|
syncPairs.push({
|
|
2006
2470
|
key,
|
|
2007
|
-
value
|
|
2471
|
+
value,
|
|
2008
2472
|
alwaysSet: pair.alwaysSet
|
|
2009
2473
|
});
|
|
2010
2474
|
}
|
|
@@ -2051,18 +2515,30 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
2051
2515
|
unknownKeys: "passthrough"
|
|
2052
2516
|
});
|
|
2053
2517
|
}
|
|
2054
|
-
|
|
2055
|
-
return
|
|
2518
|
+
extend(augmentation) {
|
|
2519
|
+
return new ZodObject({
|
|
2520
|
+
...this._def,
|
|
2521
|
+
shape: () => ({
|
|
2522
|
+
...this._def.shape(),
|
|
2523
|
+
...augmentation
|
|
2524
|
+
})
|
|
2525
|
+
});
|
|
2056
2526
|
}
|
|
2057
2527
|
merge(merging) {
|
|
2058
2528
|
const merged = new ZodObject({
|
|
2059
2529
|
unknownKeys: merging._def.unknownKeys,
|
|
2060
2530
|
catchall: merging._def.catchall,
|
|
2061
|
-
shape: () =>
|
|
2531
|
+
shape: () => ({
|
|
2532
|
+
...this._def.shape(),
|
|
2533
|
+
...merging._def.shape()
|
|
2534
|
+
}),
|
|
2062
2535
|
typeName: ZodFirstPartyTypeKind.ZodObject
|
|
2063
2536
|
});
|
|
2064
2537
|
return merged;
|
|
2065
2538
|
}
|
|
2539
|
+
setKey(key, schema) {
|
|
2540
|
+
return this.augment({ [key]: schema });
|
|
2541
|
+
}
|
|
2066
2542
|
catchall(index) {
|
|
2067
2543
|
return new ZodObject({
|
|
2068
2544
|
...this._def,
|
|
@@ -2071,9 +2547,10 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
2071
2547
|
}
|
|
2072
2548
|
pick(mask) {
|
|
2073
2549
|
const shape = {};
|
|
2074
|
-
util.objectKeys(mask).
|
|
2075
|
-
if (this.shape[key])
|
|
2550
|
+
util.objectKeys(mask).forEach((key) => {
|
|
2551
|
+
if (mask[key] && this.shape[key]) {
|
|
2076
2552
|
shape[key] = this.shape[key];
|
|
2553
|
+
}
|
|
2077
2554
|
});
|
|
2078
2555
|
return new ZodObject({
|
|
2079
2556
|
...this._def,
|
|
@@ -2082,8 +2559,8 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
2082
2559
|
}
|
|
2083
2560
|
omit(mask) {
|
|
2084
2561
|
const shape = {};
|
|
2085
|
-
util.objectKeys(this.shape).
|
|
2086
|
-
if (
|
|
2562
|
+
util.objectKeys(this.shape).forEach((key) => {
|
|
2563
|
+
if (!mask[key]) {
|
|
2087
2564
|
shape[key] = this.shape[key];
|
|
2088
2565
|
}
|
|
2089
2566
|
});
|
|
@@ -2097,24 +2574,14 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
2097
2574
|
}
|
|
2098
2575
|
partial(mask) {
|
|
2099
2576
|
const newShape = {};
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
newShape[key] = this.shape[key].optional();
|
|
2106
|
-
}
|
|
2107
|
-
});
|
|
2108
|
-
return new ZodObject({
|
|
2109
|
-
...this._def,
|
|
2110
|
-
shape: () => newShape
|
|
2111
|
-
});
|
|
2112
|
-
} else {
|
|
2113
|
-
for (const key in this.shape) {
|
|
2114
|
-
const fieldSchema = this.shape[key];
|
|
2577
|
+
util.objectKeys(this.shape).forEach((key) => {
|
|
2578
|
+
const fieldSchema = this.shape[key];
|
|
2579
|
+
if (mask && !mask[key]) {
|
|
2580
|
+
newShape[key] = fieldSchema;
|
|
2581
|
+
} else {
|
|
2115
2582
|
newShape[key] = fieldSchema.optional();
|
|
2116
2583
|
}
|
|
2117
|
-
}
|
|
2584
|
+
});
|
|
2118
2585
|
return new ZodObject({
|
|
2119
2586
|
...this._def,
|
|
2120
2587
|
shape: () => newShape
|
|
@@ -2122,21 +2589,10 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
2122
2589
|
}
|
|
2123
2590
|
required(mask) {
|
|
2124
2591
|
const newShape = {};
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
} else {
|
|
2130
|
-
const fieldSchema = this.shape[key];
|
|
2131
|
-
let newField = fieldSchema;
|
|
2132
|
-
while (newField instanceof ZodOptional) {
|
|
2133
|
-
newField = newField._def.innerType;
|
|
2134
|
-
}
|
|
2135
|
-
newShape[key] = newField;
|
|
2136
|
-
}
|
|
2137
|
-
});
|
|
2138
|
-
} else {
|
|
2139
|
-
for (const key in this.shape) {
|
|
2592
|
+
util.objectKeys(this.shape).forEach((key) => {
|
|
2593
|
+
if (mask && !mask[key]) {
|
|
2594
|
+
newShape[key] = this.shape[key];
|
|
2595
|
+
} else {
|
|
2140
2596
|
const fieldSchema = this.shape[key];
|
|
2141
2597
|
let newField = fieldSchema;
|
|
2142
2598
|
while (newField instanceof ZodOptional) {
|
|
@@ -2144,7 +2600,7 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
2144
2600
|
}
|
|
2145
2601
|
newShape[key] = newField;
|
|
2146
2602
|
}
|
|
2147
|
-
}
|
|
2603
|
+
});
|
|
2148
2604
|
return new ZodObject({
|
|
2149
2605
|
...this._def,
|
|
2150
2606
|
shape: () => newShape
|
|
@@ -2287,15 +2743,25 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
2287
2743
|
} else if (type instanceof ZodEnum) {
|
|
2288
2744
|
return type.options;
|
|
2289
2745
|
} else if (type instanceof ZodNativeEnum) {
|
|
2290
|
-
return
|
|
2746
|
+
return util.objectValues(type.enum);
|
|
2291
2747
|
} else if (type instanceof ZodDefault) {
|
|
2292
2748
|
return getDiscriminator(type._def.innerType);
|
|
2293
2749
|
} else if (type instanceof ZodUndefined) {
|
|
2294
2750
|
return [void 0];
|
|
2295
2751
|
} else if (type instanceof ZodNull) {
|
|
2296
2752
|
return [null];
|
|
2753
|
+
} else if (type instanceof ZodOptional) {
|
|
2754
|
+
return [void 0, ...getDiscriminator(type.unwrap())];
|
|
2755
|
+
} else if (type instanceof ZodNullable) {
|
|
2756
|
+
return [null, ...getDiscriminator(type.unwrap())];
|
|
2757
|
+
} else if (type instanceof ZodBranded) {
|
|
2758
|
+
return getDiscriminator(type.unwrap());
|
|
2759
|
+
} else if (type instanceof ZodReadonly) {
|
|
2760
|
+
return getDiscriminator(type.unwrap());
|
|
2761
|
+
} else if (type instanceof ZodCatch) {
|
|
2762
|
+
return getDiscriminator(type._def.innerType);
|
|
2297
2763
|
} else {
|
|
2298
|
-
return
|
|
2764
|
+
return [];
|
|
2299
2765
|
}
|
|
2300
2766
|
}, "getDiscriminator");
|
|
2301
2767
|
var ZodDiscriminatedUnion = /* @__PURE__ */ __name2(class extends ZodType {
|
|
@@ -2347,7 +2813,7 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
2347
2813
|
const optionsMap = /* @__PURE__ */ new Map();
|
|
2348
2814
|
for (const type of options) {
|
|
2349
2815
|
const discriminatorValues = getDiscriminator(type.shape[discriminator]);
|
|
2350
|
-
if (!discriminatorValues) {
|
|
2816
|
+
if (!discriminatorValues.length) {
|
|
2351
2817
|
throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
|
|
2352
2818
|
}
|
|
2353
2819
|
for (const value of discriminatorValues) {
|
|
@@ -2494,7 +2960,7 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
2494
2960
|
});
|
|
2495
2961
|
status.dirty();
|
|
2496
2962
|
}
|
|
2497
|
-
const items = ctx.data.map((item, itemIndex) => {
|
|
2963
|
+
const items = [...ctx.data].map((item, itemIndex) => {
|
|
2498
2964
|
const schema = this._def.items[itemIndex] || this._def.rest;
|
|
2499
2965
|
if (!schema)
|
|
2500
2966
|
return null;
|
|
@@ -2553,7 +3019,8 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
2553
3019
|
for (const key in ctx.data) {
|
|
2554
3020
|
pairs.push({
|
|
2555
3021
|
key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
|
|
2556
|
-
value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key))
|
|
3022
|
+
value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),
|
|
3023
|
+
alwaysSet: key in ctx.data
|
|
2557
3024
|
});
|
|
2558
3025
|
}
|
|
2559
3026
|
if (ctx.common.async) {
|
|
@@ -2584,6 +3051,12 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
2584
3051
|
}, "ZodRecord");
|
|
2585
3052
|
__name22(ZodRecord, "ZodRecord");
|
|
2586
3053
|
var ZodMap = /* @__PURE__ */ __name2(class extends ZodType {
|
|
3054
|
+
get keySchema() {
|
|
3055
|
+
return this._def.keyType;
|
|
3056
|
+
}
|
|
3057
|
+
get valueSchema() {
|
|
3058
|
+
return this._def.valueType;
|
|
3059
|
+
}
|
|
2587
3060
|
_parse(input) {
|
|
2588
3061
|
const { status, ctx } = this._processInputParams(input);
|
|
2589
3062
|
if (ctx.parsedType !== ZodParsedType.map) {
|
|
@@ -2789,27 +3262,29 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
2789
3262
|
const params = { errorMap: ctx.common.contextualErrorMap };
|
|
2790
3263
|
const fn = ctx.data;
|
|
2791
3264
|
if (this._def.returns instanceof ZodPromise) {
|
|
2792
|
-
|
|
3265
|
+
const me = this;
|
|
3266
|
+
return OK(async function(...args) {
|
|
2793
3267
|
const error = new ZodError([]);
|
|
2794
|
-
const parsedArgs = await
|
|
3268
|
+
const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
|
|
2795
3269
|
error.addIssue(makeArgsIssue(args, e));
|
|
2796
3270
|
throw error;
|
|
2797
3271
|
});
|
|
2798
|
-
const result = await fn
|
|
2799
|
-
const parsedReturns = await
|
|
3272
|
+
const result = await Reflect.apply(fn, this, parsedArgs);
|
|
3273
|
+
const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e) => {
|
|
2800
3274
|
error.addIssue(makeReturnsIssue(result, e));
|
|
2801
3275
|
throw error;
|
|
2802
3276
|
});
|
|
2803
3277
|
return parsedReturns;
|
|
2804
3278
|
});
|
|
2805
3279
|
} else {
|
|
2806
|
-
|
|
2807
|
-
|
|
3280
|
+
const me = this;
|
|
3281
|
+
return OK(function(...args) {
|
|
3282
|
+
const parsedArgs = me._def.args.safeParse(args, params);
|
|
2808
3283
|
if (!parsedArgs.success) {
|
|
2809
3284
|
throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
|
|
2810
3285
|
}
|
|
2811
|
-
const result = fn
|
|
2812
|
-
const parsedReturns =
|
|
3286
|
+
const result = Reflect.apply(fn, this, parsedArgs.data);
|
|
3287
|
+
const parsedReturns = me._def.returns.safeParse(result, params);
|
|
2813
3288
|
if (!parsedReturns.success) {
|
|
2814
3289
|
throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
|
|
2815
3290
|
}
|
|
@@ -2876,6 +3351,7 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
2876
3351
|
if (input.data !== this._def.value) {
|
|
2877
3352
|
const ctx = this._getOrReturnCtx(input);
|
|
2878
3353
|
addIssueToContext(ctx, {
|
|
3354
|
+
received: ctx.data,
|
|
2879
3355
|
code: ZodIssueCode.invalid_literal,
|
|
2880
3356
|
expected: this._def.value
|
|
2881
3357
|
});
|
|
@@ -2906,6 +3382,10 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
2906
3382
|
__name2(createZodEnum, "createZodEnum");
|
|
2907
3383
|
__name22(createZodEnum, "createZodEnum");
|
|
2908
3384
|
var ZodEnum = /* @__PURE__ */ __name2(class extends ZodType {
|
|
3385
|
+
constructor() {
|
|
3386
|
+
super(...arguments);
|
|
3387
|
+
_ZodEnum_cache.set(this, void 0);
|
|
3388
|
+
}
|
|
2909
3389
|
_parse(input) {
|
|
2910
3390
|
if (typeof input.data !== "string") {
|
|
2911
3391
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -2917,7 +3397,10 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
2917
3397
|
});
|
|
2918
3398
|
return INVALID;
|
|
2919
3399
|
}
|
|
2920
|
-
if (this
|
|
3400
|
+
if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f")) {
|
|
3401
|
+
__classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values), "f");
|
|
3402
|
+
}
|
|
3403
|
+
if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f").has(input.data)) {
|
|
2921
3404
|
const ctx = this._getOrReturnCtx(input);
|
|
2922
3405
|
const expectedValues = this._def.values;
|
|
2923
3406
|
addIssueToContext(ctx, {
|
|
@@ -2953,10 +3436,27 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
2953
3436
|
}
|
|
2954
3437
|
return enumValues;
|
|
2955
3438
|
}
|
|
3439
|
+
extract(values, newDef = this._def) {
|
|
3440
|
+
return ZodEnum.create(values, {
|
|
3441
|
+
...this._def,
|
|
3442
|
+
...newDef
|
|
3443
|
+
});
|
|
3444
|
+
}
|
|
3445
|
+
exclude(values, newDef = this._def) {
|
|
3446
|
+
return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {
|
|
3447
|
+
...this._def,
|
|
3448
|
+
...newDef
|
|
3449
|
+
});
|
|
3450
|
+
}
|
|
2956
3451
|
}, "ZodEnum");
|
|
2957
3452
|
__name22(ZodEnum, "ZodEnum");
|
|
3453
|
+
_ZodEnum_cache = /* @__PURE__ */ new WeakMap();
|
|
2958
3454
|
ZodEnum.create = createZodEnum;
|
|
2959
3455
|
var ZodNativeEnum = /* @__PURE__ */ __name2(class extends ZodType {
|
|
3456
|
+
constructor() {
|
|
3457
|
+
super(...arguments);
|
|
3458
|
+
_ZodNativeEnum_cache.set(this, void 0);
|
|
3459
|
+
}
|
|
2960
3460
|
_parse(input) {
|
|
2961
3461
|
const nativeEnumValues = util.getValidEnumValues(this._def.values);
|
|
2962
3462
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -2969,7 +3469,10 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
2969
3469
|
});
|
|
2970
3470
|
return INVALID;
|
|
2971
3471
|
}
|
|
2972
|
-
if (
|
|
3472
|
+
if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f")) {
|
|
3473
|
+
__classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util.getValidEnumValues(this._def.values)), "f");
|
|
3474
|
+
}
|
|
3475
|
+
if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f").has(input.data)) {
|
|
2973
3476
|
const expectedValues = util.objectValues(nativeEnumValues);
|
|
2974
3477
|
addIssueToContext(ctx, {
|
|
2975
3478
|
received: ctx.data,
|
|
@@ -2985,6 +3488,7 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
2985
3488
|
}
|
|
2986
3489
|
}, "ZodNativeEnum");
|
|
2987
3490
|
__name22(ZodNativeEnum, "ZodNativeEnum");
|
|
3491
|
+
_ZodNativeEnum_cache = /* @__PURE__ */ new WeakMap();
|
|
2988
3492
|
ZodNativeEnum.create = (values, params) => {
|
|
2989
3493
|
return new ZodNativeEnum({
|
|
2990
3494
|
values,
|
|
@@ -2993,6 +3497,9 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
2993
3497
|
});
|
|
2994
3498
|
};
|
|
2995
3499
|
var ZodPromise = /* @__PURE__ */ __name2(class extends ZodType {
|
|
3500
|
+
unwrap() {
|
|
3501
|
+
return this._def.type;
|
|
3502
|
+
}
|
|
2996
3503
|
_parse(input) {
|
|
2997
3504
|
const { ctx } = this._processInputParams(input);
|
|
2998
3505
|
if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
|
|
@@ -3030,24 +3537,6 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
3030
3537
|
_parse(input) {
|
|
3031
3538
|
const { status, ctx } = this._processInputParams(input);
|
|
3032
3539
|
const effect = this._def.effect || null;
|
|
3033
|
-
if (effect.type === "preprocess") {
|
|
3034
|
-
const processed = effect.transform(ctx.data);
|
|
3035
|
-
if (ctx.common.async) {
|
|
3036
|
-
return Promise.resolve(processed).then((processed2) => {
|
|
3037
|
-
return this._def.schema._parseAsync({
|
|
3038
|
-
data: processed2,
|
|
3039
|
-
path: ctx.path,
|
|
3040
|
-
parent: ctx
|
|
3041
|
-
});
|
|
3042
|
-
});
|
|
3043
|
-
} else {
|
|
3044
|
-
return this._def.schema._parseSync({
|
|
3045
|
-
data: processed,
|
|
3046
|
-
path: ctx.path,
|
|
3047
|
-
parent: ctx
|
|
3048
|
-
});
|
|
3049
|
-
}
|
|
3050
|
-
}
|
|
3051
3540
|
const checkCtx = {
|
|
3052
3541
|
addIssue: (arg) => {
|
|
3053
3542
|
addIssueToContext(ctx, arg);
|
|
@@ -3062,6 +3551,42 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
3062
3551
|
}
|
|
3063
3552
|
};
|
|
3064
3553
|
checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
|
|
3554
|
+
if (effect.type === "preprocess") {
|
|
3555
|
+
const processed = effect.transform(ctx.data, checkCtx);
|
|
3556
|
+
if (ctx.common.async) {
|
|
3557
|
+
return Promise.resolve(processed).then(async (processed2) => {
|
|
3558
|
+
if (status.value === "aborted")
|
|
3559
|
+
return INVALID;
|
|
3560
|
+
const result = await this._def.schema._parseAsync({
|
|
3561
|
+
data: processed2,
|
|
3562
|
+
path: ctx.path,
|
|
3563
|
+
parent: ctx
|
|
3564
|
+
});
|
|
3565
|
+
if (result.status === "aborted")
|
|
3566
|
+
return INVALID;
|
|
3567
|
+
if (result.status === "dirty")
|
|
3568
|
+
return DIRTY(result.value);
|
|
3569
|
+
if (status.value === "dirty")
|
|
3570
|
+
return DIRTY(result.value);
|
|
3571
|
+
return result;
|
|
3572
|
+
});
|
|
3573
|
+
} else {
|
|
3574
|
+
if (status.value === "aborted")
|
|
3575
|
+
return INVALID;
|
|
3576
|
+
const result = this._def.schema._parseSync({
|
|
3577
|
+
data: processed,
|
|
3578
|
+
path: ctx.path,
|
|
3579
|
+
parent: ctx
|
|
3580
|
+
});
|
|
3581
|
+
if (result.status === "aborted")
|
|
3582
|
+
return INVALID;
|
|
3583
|
+
if (result.status === "dirty")
|
|
3584
|
+
return DIRTY(result.value);
|
|
3585
|
+
if (status.value === "dirty")
|
|
3586
|
+
return DIRTY(result.value);
|
|
3587
|
+
return result;
|
|
3588
|
+
}
|
|
3589
|
+
}
|
|
3065
3590
|
if (effect.type === "refinement") {
|
|
3066
3591
|
const executeRefinement = /* @__PURE__ */ __name22((acc) => {
|
|
3067
3592
|
const result = effect.refinement(acc, checkCtx);
|
|
@@ -3208,26 +3733,45 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
3208
3733
|
var ZodCatch = /* @__PURE__ */ __name2(class extends ZodType {
|
|
3209
3734
|
_parse(input) {
|
|
3210
3735
|
const { ctx } = this._processInputParams(input);
|
|
3736
|
+
const newCtx = {
|
|
3737
|
+
...ctx,
|
|
3738
|
+
common: {
|
|
3739
|
+
...ctx.common,
|
|
3740
|
+
issues: []
|
|
3741
|
+
}
|
|
3742
|
+
};
|
|
3211
3743
|
const result = this._def.innerType._parse({
|
|
3212
|
-
data:
|
|
3213
|
-
path:
|
|
3214
|
-
parent:
|
|
3744
|
+
data: newCtx.data,
|
|
3745
|
+
path: newCtx.path,
|
|
3746
|
+
parent: {
|
|
3747
|
+
...newCtx
|
|
3748
|
+
}
|
|
3215
3749
|
});
|
|
3216
3750
|
if (isAsync(result)) {
|
|
3217
3751
|
return result.then((result2) => {
|
|
3218
3752
|
return {
|
|
3219
3753
|
status: "valid",
|
|
3220
|
-
value: result2.status === "valid" ? result2.value : this._def.
|
|
3754
|
+
value: result2.status === "valid" ? result2.value : this._def.catchValue({
|
|
3755
|
+
get error() {
|
|
3756
|
+
return new ZodError(newCtx.common.issues);
|
|
3757
|
+
},
|
|
3758
|
+
input: newCtx.data
|
|
3759
|
+
})
|
|
3221
3760
|
};
|
|
3222
3761
|
});
|
|
3223
3762
|
} else {
|
|
3224
3763
|
return {
|
|
3225
3764
|
status: "valid",
|
|
3226
|
-
value: result.status === "valid" ? result.value : this._def.
|
|
3765
|
+
value: result.status === "valid" ? result.value : this._def.catchValue({
|
|
3766
|
+
get error() {
|
|
3767
|
+
return new ZodError(newCtx.common.issues);
|
|
3768
|
+
},
|
|
3769
|
+
input: newCtx.data
|
|
3770
|
+
})
|
|
3227
3771
|
};
|
|
3228
3772
|
}
|
|
3229
3773
|
}
|
|
3230
|
-
|
|
3774
|
+
removeCatch() {
|
|
3231
3775
|
return this._def.innerType;
|
|
3232
3776
|
}
|
|
3233
3777
|
}, "ZodCatch");
|
|
@@ -3236,7 +3780,7 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
3236
3780
|
return new ZodCatch({
|
|
3237
3781
|
innerType: type,
|
|
3238
3782
|
typeName: ZodFirstPartyTypeKind.ZodCatch,
|
|
3239
|
-
|
|
3783
|
+
catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
|
|
3240
3784
|
...processCreateParams(params)
|
|
3241
3785
|
});
|
|
3242
3786
|
};
|
|
@@ -3334,17 +3878,45 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
3334
3878
|
}
|
|
3335
3879
|
}, "ZodPipeline");
|
|
3336
3880
|
__name22(ZodPipeline, "ZodPipeline");
|
|
3337
|
-
var
|
|
3881
|
+
var ZodReadonly = /* @__PURE__ */ __name2(class extends ZodType {
|
|
3882
|
+
_parse(input) {
|
|
3883
|
+
const result = this._def.innerType._parse(input);
|
|
3884
|
+
const freeze = /* @__PURE__ */ __name22((data) => {
|
|
3885
|
+
if (isValid(data)) {
|
|
3886
|
+
data.value = Object.freeze(data.value);
|
|
3887
|
+
}
|
|
3888
|
+
return data;
|
|
3889
|
+
}, "freeze");
|
|
3890
|
+
return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
|
|
3891
|
+
}
|
|
3892
|
+
unwrap() {
|
|
3893
|
+
return this._def.innerType;
|
|
3894
|
+
}
|
|
3895
|
+
}, "ZodReadonly");
|
|
3896
|
+
__name22(ZodReadonly, "ZodReadonly");
|
|
3897
|
+
ZodReadonly.create = (type, params) => {
|
|
3898
|
+
return new ZodReadonly({
|
|
3899
|
+
innerType: type,
|
|
3900
|
+
typeName: ZodFirstPartyTypeKind.ZodReadonly,
|
|
3901
|
+
...processCreateParams(params)
|
|
3902
|
+
});
|
|
3903
|
+
};
|
|
3904
|
+
function custom(check, params = {}, fatal) {
|
|
3338
3905
|
if (check)
|
|
3339
3906
|
return ZodAny.create().superRefine((data, ctx) => {
|
|
3907
|
+
var _a, _b;
|
|
3340
3908
|
if (!check(data)) {
|
|
3341
|
-
const p = typeof params === "function" ? params(data) : params;
|
|
3909
|
+
const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
|
|
3910
|
+
const _fatal = (_b = (_a = p.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
|
|
3342
3911
|
const p2 = typeof p === "string" ? { message: p } : p;
|
|
3343
|
-
ctx.addIssue({ code: "custom", ...p2, fatal });
|
|
3912
|
+
ctx.addIssue({ code: "custom", ...p2, fatal: _fatal });
|
|
3344
3913
|
}
|
|
3345
3914
|
});
|
|
3346
3915
|
return ZodAny.create();
|
|
3347
|
-
}
|
|
3916
|
+
}
|
|
3917
|
+
__name(custom, "custom");
|
|
3918
|
+
__name2(custom, "custom");
|
|
3919
|
+
__name22(custom, "custom");
|
|
3348
3920
|
var late = {
|
|
3349
3921
|
object: ZodObject.lazycreate
|
|
3350
3922
|
};
|
|
@@ -3385,10 +3957,11 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
3385
3957
|
ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";
|
|
3386
3958
|
ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";
|
|
3387
3959
|
ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
|
|
3960
|
+
ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly";
|
|
3388
3961
|
})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
|
|
3389
3962
|
var instanceOfType = /* @__PURE__ */ __name22((cls, params = {
|
|
3390
3963
|
message: `Input not instance of ${cls.name}`
|
|
3391
|
-
}) => custom((data) => data instanceof cls, params
|
|
3964
|
+
}) => custom((data) => data instanceof cls, params), "instanceOfType");
|
|
3392
3965
|
var stringType = ZodString.create;
|
|
3393
3966
|
var numberType = ZodNumber.create;
|
|
3394
3967
|
var nanType = ZodNaN.create;
|
|
@@ -3429,12 +4002,15 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
3429
4002
|
var coerce = {
|
|
3430
4003
|
string: (arg) => ZodString.create({ ...arg, coerce: true }),
|
|
3431
4004
|
number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
|
|
3432
|
-
boolean: (arg) => ZodBoolean.create({
|
|
4005
|
+
boolean: (arg) => ZodBoolean.create({
|
|
4006
|
+
...arg,
|
|
4007
|
+
coerce: true
|
|
4008
|
+
}),
|
|
3433
4009
|
bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
|
|
3434
4010
|
date: (arg) => ZodDate.create({ ...arg, coerce: true })
|
|
3435
4011
|
};
|
|
3436
4012
|
var NEVER = INVALID;
|
|
3437
|
-
var
|
|
4013
|
+
var z = /* @__PURE__ */ Object.freeze({
|
|
3438
4014
|
__proto__: null,
|
|
3439
4015
|
defaultErrorMap: errorMap,
|
|
3440
4016
|
setErrorMap,
|
|
@@ -3453,9 +4029,13 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
3453
4029
|
get util() {
|
|
3454
4030
|
return util;
|
|
3455
4031
|
},
|
|
4032
|
+
get objectUtil() {
|
|
4033
|
+
return objectUtil;
|
|
4034
|
+
},
|
|
3456
4035
|
ZodParsedType,
|
|
3457
4036
|
getParsedType,
|
|
3458
4037
|
ZodType,
|
|
4038
|
+
datetimeRegex,
|
|
3459
4039
|
ZodString,
|
|
3460
4040
|
ZodNumber,
|
|
3461
4041
|
ZodBigInt,
|
|
@@ -3469,9 +4049,6 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
3469
4049
|
ZodNever,
|
|
3470
4050
|
ZodVoid,
|
|
3471
4051
|
ZodArray,
|
|
3472
|
-
get objectUtil() {
|
|
3473
|
-
return objectUtil;
|
|
3474
|
-
},
|
|
3475
4052
|
ZodObject,
|
|
3476
4053
|
ZodUnion,
|
|
3477
4054
|
ZodDiscriminatedUnion,
|
|
@@ -3496,6 +4073,7 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
3496
4073
|
BRAND,
|
|
3497
4074
|
ZodBranded,
|
|
3498
4075
|
ZodPipeline,
|
|
4076
|
+
ZodReadonly,
|
|
3499
4077
|
custom,
|
|
3500
4078
|
Schema: ZodType,
|
|
3501
4079
|
ZodSchema: ZodType,
|
|
@@ -3548,35 +4126,133 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
3548
4126
|
quotelessJson,
|
|
3549
4127
|
ZodError
|
|
3550
4128
|
});
|
|
3551
|
-
var
|
|
3552
|
-
var
|
|
3553
|
-
|
|
3554
|
-
|
|
4129
|
+
var currentSymbol = Symbol("current");
|
|
4130
|
+
var previousSymbol = Symbol("previous");
|
|
4131
|
+
var mergeOpenApi = /* @__PURE__ */ __name22((openapi, {
|
|
4132
|
+
ref: _ref,
|
|
4133
|
+
refType: _refType,
|
|
4134
|
+
param: _param,
|
|
4135
|
+
header: _header,
|
|
4136
|
+
...rest
|
|
4137
|
+
} = {}) => ({
|
|
4138
|
+
...rest,
|
|
4139
|
+
...openapi
|
|
4140
|
+
}), "mergeOpenApi");
|
|
4141
|
+
function extendZodWithOpenApi(zod) {
|
|
4142
|
+
if (typeof zod.ZodType.prototype.openapi !== "undefined") {
|
|
4143
|
+
return;
|
|
4144
|
+
}
|
|
4145
|
+
zod.ZodType.prototype.openapi = function(openapi) {
|
|
4146
|
+
const { zodOpenApi, ...rest } = this._def;
|
|
4147
|
+
const result = new this.constructor({
|
|
4148
|
+
...rest,
|
|
4149
|
+
zodOpenApi: {
|
|
4150
|
+
openapi: mergeOpenApi(
|
|
4151
|
+
openapi,
|
|
4152
|
+
zodOpenApi == null ? void 0 : zodOpenApi.openapi
|
|
4153
|
+
)
|
|
4154
|
+
}
|
|
4155
|
+
});
|
|
4156
|
+
result._def.zodOpenApi[currentSymbol] = result;
|
|
4157
|
+
if (zodOpenApi) {
|
|
4158
|
+
result._def.zodOpenApi[previousSymbol] = this;
|
|
4159
|
+
}
|
|
4160
|
+
return result;
|
|
4161
|
+
};
|
|
4162
|
+
const zodDescribe = zod.ZodType.prototype.describe;
|
|
4163
|
+
zod.ZodType.prototype.describe = function(...args) {
|
|
4164
|
+
const result = zodDescribe.apply(this, args);
|
|
4165
|
+
const def = result._def;
|
|
4166
|
+
if (def.zodOpenApi) {
|
|
4167
|
+
const cloned = { ...def.zodOpenApi };
|
|
4168
|
+
cloned.openapi = mergeOpenApi({ description: args[0] }, cloned.openapi);
|
|
4169
|
+
cloned[previousSymbol] = this;
|
|
4170
|
+
cloned[currentSymbol] = result;
|
|
4171
|
+
def.zodOpenApi = cloned;
|
|
4172
|
+
} else {
|
|
4173
|
+
def.zodOpenApi = {
|
|
4174
|
+
openapi: { description: args[0] },
|
|
4175
|
+
[currentSymbol]: result
|
|
4176
|
+
};
|
|
4177
|
+
}
|
|
4178
|
+
return result;
|
|
4179
|
+
};
|
|
4180
|
+
const zodObjectExtend = zod.ZodObject.prototype.extend;
|
|
4181
|
+
zod.ZodObject.prototype.extend = function(...args) {
|
|
4182
|
+
const extendResult = zodObjectExtend.apply(this, args);
|
|
4183
|
+
const zodOpenApi = extendResult._def.zodOpenApi;
|
|
4184
|
+
if (zodOpenApi) {
|
|
4185
|
+
const cloned = { ...zodOpenApi };
|
|
4186
|
+
cloned.openapi = mergeOpenApi({}, cloned.openapi);
|
|
4187
|
+
cloned[previousSymbol] = this;
|
|
4188
|
+
extendResult._def.zodOpenApi = cloned;
|
|
4189
|
+
} else {
|
|
4190
|
+
extendResult._def.zodOpenApi = {
|
|
4191
|
+
[previousSymbol]: this
|
|
4192
|
+
};
|
|
4193
|
+
}
|
|
4194
|
+
return extendResult;
|
|
4195
|
+
};
|
|
4196
|
+
const zodObjectOmit = zod.ZodObject.prototype.omit;
|
|
4197
|
+
zod.ZodObject.prototype.omit = function(...args) {
|
|
4198
|
+
const omitResult = zodObjectOmit.apply(this, args);
|
|
4199
|
+
const zodOpenApi = omitResult._def.zodOpenApi;
|
|
4200
|
+
if (zodOpenApi) {
|
|
4201
|
+
const cloned = { ...zodOpenApi };
|
|
4202
|
+
cloned.openapi = mergeOpenApi({}, cloned.openapi);
|
|
4203
|
+
delete cloned[previousSymbol];
|
|
4204
|
+
delete cloned[currentSymbol];
|
|
4205
|
+
omitResult._def.zodOpenApi = cloned;
|
|
4206
|
+
}
|
|
4207
|
+
return omitResult;
|
|
4208
|
+
};
|
|
4209
|
+
const zodObjectPick = zod.ZodObject.prototype.pick;
|
|
4210
|
+
zod.ZodObject.prototype.pick = function(...args) {
|
|
4211
|
+
const pickResult = zodObjectPick.apply(this, args);
|
|
4212
|
+
const zodOpenApi = pickResult._def.zodOpenApi;
|
|
4213
|
+
if (zodOpenApi) {
|
|
4214
|
+
const cloned = { ...zodOpenApi };
|
|
4215
|
+
cloned.openapi = mergeOpenApi({}, cloned.openapi);
|
|
4216
|
+
delete cloned[previousSymbol];
|
|
4217
|
+
delete cloned[currentSymbol];
|
|
4218
|
+
pickResult._def.zodOpenApi = cloned;
|
|
4219
|
+
}
|
|
4220
|
+
return pickResult;
|
|
4221
|
+
};
|
|
4222
|
+
}
|
|
4223
|
+
__name(extendZodWithOpenApi, "extendZodWithOpenApi");
|
|
4224
|
+
__name2(extendZodWithOpenApi, "extendZodWithOpenApi");
|
|
4225
|
+
__name22(extendZodWithOpenApi, "extendZodWithOpenApi");
|
|
4226
|
+
extendZodWithOpenApi(z);
|
|
4227
|
+
var ContextValidator = z.array(z.string().or(z.record(z.any())));
|
|
4228
|
+
var AchievementCriteriaValidator = z.object({
|
|
4229
|
+
type: z.string().optional(),
|
|
4230
|
+
narrative: z.string().optional()
|
|
3555
4231
|
});
|
|
3556
|
-
var ImageValidator =
|
|
3557
|
-
|
|
3558
|
-
id:
|
|
3559
|
-
type:
|
|
3560
|
-
caption:
|
|
4232
|
+
var ImageValidator = z.string().or(
|
|
4233
|
+
z.object({
|
|
4234
|
+
id: z.string(),
|
|
4235
|
+
type: z.string(),
|
|
4236
|
+
caption: z.string().optional()
|
|
3561
4237
|
})
|
|
3562
4238
|
);
|
|
3563
|
-
var GeoCoordinatesValidator =
|
|
3564
|
-
type:
|
|
3565
|
-
latitude:
|
|
3566
|
-
longitude:
|
|
4239
|
+
var GeoCoordinatesValidator = z.object({
|
|
4240
|
+
type: z.string().min(1).or(z.string().array().nonempty()),
|
|
4241
|
+
latitude: z.number(),
|
|
4242
|
+
longitude: z.number()
|
|
3567
4243
|
});
|
|
3568
|
-
var AddressValidator =
|
|
3569
|
-
type:
|
|
3570
|
-
addressCountry:
|
|
3571
|
-
addressCountryCode:
|
|
3572
|
-
addressRegion:
|
|
3573
|
-
addressLocality:
|
|
3574
|
-
streetAddress:
|
|
3575
|
-
postOfficeBoxNumber:
|
|
3576
|
-
postalCode:
|
|
4244
|
+
var AddressValidator = z.object({
|
|
4245
|
+
type: z.string().min(1).or(z.string().array().nonempty()),
|
|
4246
|
+
addressCountry: z.string().optional(),
|
|
4247
|
+
addressCountryCode: z.string().optional(),
|
|
4248
|
+
addressRegion: z.string().optional(),
|
|
4249
|
+
addressLocality: z.string().optional(),
|
|
4250
|
+
streetAddress: z.string().optional(),
|
|
4251
|
+
postOfficeBoxNumber: z.string().optional(),
|
|
4252
|
+
postalCode: z.string().optional(),
|
|
3577
4253
|
geo: GeoCoordinatesValidator.optional()
|
|
3578
4254
|
});
|
|
3579
|
-
var IdentifierTypeValidator =
|
|
4255
|
+
var IdentifierTypeValidator = z.enum([
|
|
3580
4256
|
"sourcedId",
|
|
3581
4257
|
"systemId",
|
|
3582
4258
|
"productId",
|
|
@@ -3595,140 +4271,140 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
3595
4271
|
"ltiPlatformId",
|
|
3596
4272
|
"ltiUserId",
|
|
3597
4273
|
"identifier"
|
|
3598
|
-
]).or(
|
|
3599
|
-
var IdentifierEntryValidator =
|
|
3600
|
-
type:
|
|
3601
|
-
identifier:
|
|
4274
|
+
]).or(z.string());
|
|
4275
|
+
var IdentifierEntryValidator = z.object({
|
|
4276
|
+
type: z.string().min(1).or(z.string().array().nonempty()),
|
|
4277
|
+
identifier: z.string(),
|
|
3602
4278
|
identifierType: IdentifierTypeValidator
|
|
3603
4279
|
});
|
|
3604
|
-
var ProfileValidator =
|
|
3605
|
-
|
|
3606
|
-
id:
|
|
3607
|
-
type:
|
|
3608
|
-
name:
|
|
3609
|
-
url:
|
|
3610
|
-
phone:
|
|
3611
|
-
description:
|
|
3612
|
-
endorsement:
|
|
4280
|
+
var ProfileValidator = z.string().or(
|
|
4281
|
+
z.object({
|
|
4282
|
+
id: z.string().optional(),
|
|
4283
|
+
type: z.string().or(z.string().array().nonempty().optional()),
|
|
4284
|
+
name: z.string().optional(),
|
|
4285
|
+
url: z.string().optional(),
|
|
4286
|
+
phone: z.string().optional(),
|
|
4287
|
+
description: z.string().optional(),
|
|
4288
|
+
endorsement: z.any().array().optional(),
|
|
3613
4289
|
image: ImageValidator.optional(),
|
|
3614
|
-
email:
|
|
4290
|
+
email: z.string().email().optional(),
|
|
3615
4291
|
address: AddressValidator.optional(),
|
|
3616
4292
|
otherIdentifier: IdentifierEntryValidator.array().optional(),
|
|
3617
|
-
official:
|
|
3618
|
-
parentOrg:
|
|
3619
|
-
familyName:
|
|
3620
|
-
givenName:
|
|
3621
|
-
additionalName:
|
|
3622
|
-
patronymicName:
|
|
3623
|
-
honorificPrefix:
|
|
3624
|
-
honorificSuffix:
|
|
3625
|
-
familyNamePrefix:
|
|
3626
|
-
dateOfBirth:
|
|
3627
|
-
}).catchall(
|
|
4293
|
+
official: z.string().optional(),
|
|
4294
|
+
parentOrg: z.any().optional(),
|
|
4295
|
+
familyName: z.string().optional(),
|
|
4296
|
+
givenName: z.string().optional(),
|
|
4297
|
+
additionalName: z.string().optional(),
|
|
4298
|
+
patronymicName: z.string().optional(),
|
|
4299
|
+
honorificPrefix: z.string().optional(),
|
|
4300
|
+
honorificSuffix: z.string().optional(),
|
|
4301
|
+
familyNamePrefix: z.string().optional(),
|
|
4302
|
+
dateOfBirth: z.string().optional()
|
|
4303
|
+
}).catchall(z.any())
|
|
3628
4304
|
);
|
|
3629
|
-
var CredentialSubjectValidator =
|
|
3630
|
-
var CredentialStatusValidator =
|
|
3631
|
-
var CredentialSchemaValidator =
|
|
3632
|
-
var RefreshServiceValidator =
|
|
3633
|
-
var TermsOfUseValidator =
|
|
3634
|
-
var VC2EvidenceValidator =
|
|
3635
|
-
var UnsignedVCValidator =
|
|
4305
|
+
var CredentialSubjectValidator = z.object({ id: z.string().optional() }).catchall(z.any());
|
|
4306
|
+
var CredentialStatusValidator = z.object({ type: z.string(), id: z.string() }).catchall(z.any());
|
|
4307
|
+
var CredentialSchemaValidator = z.object({ id: z.string(), type: z.string() }).catchall(z.any());
|
|
4308
|
+
var RefreshServiceValidator = z.object({ id: z.string().optional(), type: z.string() }).catchall(z.any());
|
|
4309
|
+
var TermsOfUseValidator = z.object({ type: z.string(), id: z.string().optional() }).catchall(z.any());
|
|
4310
|
+
var VC2EvidenceValidator = z.object({ type: z.string().or(z.string().array().nonempty()), id: z.string().optional() }).catchall(z.any());
|
|
4311
|
+
var UnsignedVCValidator = z.object({
|
|
3636
4312
|
"@context": ContextValidator,
|
|
3637
|
-
id:
|
|
3638
|
-
type:
|
|
4313
|
+
id: z.string().optional(),
|
|
4314
|
+
type: z.string().array().nonempty(),
|
|
3639
4315
|
issuer: ProfileValidator,
|
|
3640
4316
|
credentialSubject: CredentialSubjectValidator.or(CredentialSubjectValidator.array()),
|
|
3641
4317
|
refreshService: RefreshServiceValidator.or(RefreshServiceValidator.array()).optional(),
|
|
3642
4318
|
credentialSchema: CredentialSchemaValidator.or(
|
|
3643
4319
|
CredentialSchemaValidator.array()
|
|
3644
4320
|
).optional(),
|
|
3645
|
-
issuanceDate:
|
|
3646
|
-
expirationDate:
|
|
4321
|
+
issuanceDate: z.string().optional(),
|
|
4322
|
+
expirationDate: z.string().optional(),
|
|
3647
4323
|
credentialStatus: CredentialStatusValidator.or(
|
|
3648
4324
|
CredentialStatusValidator.array()
|
|
3649
4325
|
).optional(),
|
|
3650
|
-
name:
|
|
3651
|
-
description:
|
|
3652
|
-
validFrom:
|
|
3653
|
-
validUntil:
|
|
4326
|
+
name: z.string().optional(),
|
|
4327
|
+
description: z.string().optional(),
|
|
4328
|
+
validFrom: z.string().optional(),
|
|
4329
|
+
validUntil: z.string().optional(),
|
|
3654
4330
|
status: CredentialStatusValidator.or(CredentialStatusValidator.array()).optional(),
|
|
3655
4331
|
termsOfUse: TermsOfUseValidator.or(TermsOfUseValidator.array()).optional(),
|
|
3656
4332
|
evidence: VC2EvidenceValidator.or(VC2EvidenceValidator.array()).optional()
|
|
3657
|
-
}).catchall(
|
|
3658
|
-
var ProofValidator =
|
|
3659
|
-
type:
|
|
3660
|
-
created:
|
|
3661
|
-
challenge:
|
|
3662
|
-
domain:
|
|
3663
|
-
nonce:
|
|
3664
|
-
proofPurpose:
|
|
3665
|
-
verificationMethod:
|
|
3666
|
-
jws:
|
|
3667
|
-
}).catchall(
|
|
4333
|
+
}).catchall(z.any());
|
|
4334
|
+
var ProofValidator = z.object({
|
|
4335
|
+
type: z.string(),
|
|
4336
|
+
created: z.string(),
|
|
4337
|
+
challenge: z.string().optional(),
|
|
4338
|
+
domain: z.string().optional(),
|
|
4339
|
+
nonce: z.string().optional(),
|
|
4340
|
+
proofPurpose: z.string(),
|
|
4341
|
+
verificationMethod: z.string(),
|
|
4342
|
+
jws: z.string().optional()
|
|
4343
|
+
}).catchall(z.any());
|
|
3668
4344
|
var VCValidator = UnsignedVCValidator.extend({
|
|
3669
4345
|
proof: ProofValidator.or(ProofValidator.array())
|
|
3670
4346
|
});
|
|
3671
|
-
var UnsignedVPValidator =
|
|
4347
|
+
var UnsignedVPValidator = z.object({
|
|
3672
4348
|
"@context": ContextValidator,
|
|
3673
|
-
id:
|
|
3674
|
-
type:
|
|
4349
|
+
id: z.string().optional(),
|
|
4350
|
+
type: z.string().or(z.string().array().nonempty()),
|
|
3675
4351
|
verifiableCredential: VCValidator.or(VCValidator.array()).optional(),
|
|
3676
|
-
holder:
|
|
3677
|
-
}).catchall(
|
|
4352
|
+
holder: z.string().optional()
|
|
4353
|
+
}).catchall(z.any());
|
|
3678
4354
|
var VPValidator = UnsignedVPValidator.extend({
|
|
3679
4355
|
proof: ProofValidator.or(ProofValidator.array())
|
|
3680
4356
|
});
|
|
3681
|
-
var JWKValidator =
|
|
3682
|
-
kty:
|
|
3683
|
-
crv:
|
|
3684
|
-
x:
|
|
3685
|
-
y:
|
|
3686
|
-
n:
|
|
3687
|
-
d:
|
|
4357
|
+
var JWKValidator = z.object({
|
|
4358
|
+
kty: z.string(),
|
|
4359
|
+
crv: z.string(),
|
|
4360
|
+
x: z.string(),
|
|
4361
|
+
y: z.string().optional(),
|
|
4362
|
+
n: z.string().optional(),
|
|
4363
|
+
d: z.string().optional()
|
|
3688
4364
|
});
|
|
3689
|
-
var JWKWithPrivateKeyValidator = JWKValidator.omit({ d: true }).extend({ d:
|
|
3690
|
-
var JWERecipientHeaderValidator =
|
|
3691
|
-
alg:
|
|
3692
|
-
iv:
|
|
3693
|
-
tag:
|
|
4365
|
+
var JWKWithPrivateKeyValidator = JWKValidator.omit({ d: true }).extend({ d: z.string() });
|
|
4366
|
+
var JWERecipientHeaderValidator = z.object({
|
|
4367
|
+
alg: z.string(),
|
|
4368
|
+
iv: z.string(),
|
|
4369
|
+
tag: z.string(),
|
|
3694
4370
|
epk: JWKValidator.partial().optional(),
|
|
3695
|
-
kid:
|
|
3696
|
-
apv:
|
|
3697
|
-
apu:
|
|
4371
|
+
kid: z.string().optional(),
|
|
4372
|
+
apv: z.string().optional(),
|
|
4373
|
+
apu: z.string().optional()
|
|
3698
4374
|
});
|
|
3699
|
-
var JWERecipientValidator =
|
|
4375
|
+
var JWERecipientValidator = z.object({
|
|
3700
4376
|
header: JWERecipientHeaderValidator,
|
|
3701
|
-
encrypted_key:
|
|
4377
|
+
encrypted_key: z.string()
|
|
3702
4378
|
});
|
|
3703
|
-
var JWEValidator2 =
|
|
3704
|
-
protected:
|
|
3705
|
-
iv:
|
|
3706
|
-
ciphertext:
|
|
3707
|
-
tag:
|
|
3708
|
-
aad:
|
|
4379
|
+
var JWEValidator2 = z.object({
|
|
4380
|
+
protected: z.string(),
|
|
4381
|
+
iv: z.string(),
|
|
4382
|
+
ciphertext: z.string(),
|
|
4383
|
+
tag: z.string(),
|
|
4384
|
+
aad: z.string().optional(),
|
|
3709
4385
|
recipients: JWERecipientValidator.array().optional()
|
|
3710
4386
|
});
|
|
3711
|
-
var VerificationMethodValidator =
|
|
3712
|
-
|
|
4387
|
+
var VerificationMethodValidator = z.string().or(
|
|
4388
|
+
z.object({
|
|
3713
4389
|
"@context": ContextValidator.optional(),
|
|
3714
|
-
id:
|
|
3715
|
-
type:
|
|
3716
|
-
controller:
|
|
4390
|
+
id: z.string(),
|
|
4391
|
+
type: z.string(),
|
|
4392
|
+
controller: z.string(),
|
|
3717
4393
|
publicKeyJwk: JWKValidator.optional(),
|
|
3718
|
-
publicKeyBase58:
|
|
3719
|
-
blockChainAccountId:
|
|
3720
|
-
}).catchall(
|
|
4394
|
+
publicKeyBase58: z.string().optional(),
|
|
4395
|
+
blockChainAccountId: z.string().optional()
|
|
4396
|
+
}).catchall(z.any())
|
|
3721
4397
|
);
|
|
3722
|
-
var ServiceValidator =
|
|
3723
|
-
id:
|
|
3724
|
-
type:
|
|
3725
|
-
serviceEndpoint:
|
|
3726
|
-
}).catchall(
|
|
3727
|
-
var DidDocumentValidator =
|
|
4398
|
+
var ServiceValidator = z.object({
|
|
4399
|
+
id: z.string(),
|
|
4400
|
+
type: z.string().or(z.string().array().nonempty()),
|
|
4401
|
+
serviceEndpoint: z.any().or(z.any().array().nonempty())
|
|
4402
|
+
}).catchall(z.any());
|
|
4403
|
+
var DidDocumentValidator = z.object({
|
|
3728
4404
|
"@context": ContextValidator,
|
|
3729
|
-
id:
|
|
3730
|
-
alsoKnownAs:
|
|
3731
|
-
controller:
|
|
4405
|
+
id: z.string(),
|
|
4406
|
+
alsoKnownAs: z.string().optional(),
|
|
4407
|
+
controller: z.string().or(z.string().array().nonempty()).optional(),
|
|
3732
4408
|
verificationMethod: VerificationMethodValidator.array().optional(),
|
|
3733
4409
|
authentication: VerificationMethodValidator.array().optional(),
|
|
3734
4410
|
assertionMethod: VerificationMethodValidator.array().optional(),
|
|
@@ -3738,8 +4414,8 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
3738
4414
|
publicKey: VerificationMethodValidator.array().optional(),
|
|
3739
4415
|
service: ServiceValidator.array().optional(),
|
|
3740
4416
|
proof: ProofValidator.or(ProofValidator.array()).optional()
|
|
3741
|
-
}).catchall(
|
|
3742
|
-
var AlignmentTargetTypeValidator =
|
|
4417
|
+
}).catchall(z.any());
|
|
4418
|
+
var AlignmentTargetTypeValidator = z.enum([
|
|
3743
4419
|
"ceasn:Competency",
|
|
3744
4420
|
"ceterms:Credential",
|
|
3745
4421
|
"CFItem",
|
|
@@ -3747,17 +4423,17 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
3747
4423
|
"CFRubricCriterion",
|
|
3748
4424
|
"CFRubricCriterionLevel",
|
|
3749
4425
|
"CTDL"
|
|
3750
|
-
]).or(
|
|
3751
|
-
var AlignmentValidator =
|
|
3752
|
-
type:
|
|
3753
|
-
targetCode:
|
|
3754
|
-
targetDescription:
|
|
3755
|
-
targetName:
|
|
3756
|
-
targetFramework:
|
|
4426
|
+
]).or(z.string());
|
|
4427
|
+
var AlignmentValidator = z.object({
|
|
4428
|
+
type: z.string().array().nonempty(),
|
|
4429
|
+
targetCode: z.string().optional(),
|
|
4430
|
+
targetDescription: z.string().optional(),
|
|
4431
|
+
targetName: z.string(),
|
|
4432
|
+
targetFramework: z.string().optional(),
|
|
3757
4433
|
targetType: AlignmentTargetTypeValidator.optional(),
|
|
3758
|
-
targetUrl:
|
|
4434
|
+
targetUrl: z.string()
|
|
3759
4435
|
});
|
|
3760
|
-
var KnownAchievementTypeValidator =
|
|
4436
|
+
var KnownAchievementTypeValidator = z.enum([
|
|
3761
4437
|
"Achievement",
|
|
3762
4438
|
"ApprenticeshipCertificate",
|
|
3763
4439
|
"Assessment",
|
|
@@ -3790,23 +4466,23 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
3790
4466
|
"ResearchDoctorate",
|
|
3791
4467
|
"SecondarySchoolDiploma"
|
|
3792
4468
|
]);
|
|
3793
|
-
var AchievementTypeValidator = KnownAchievementTypeValidator.or(
|
|
3794
|
-
var CriteriaValidator =
|
|
3795
|
-
var EndorsementSubjectValidator =
|
|
3796
|
-
id:
|
|
3797
|
-
type:
|
|
3798
|
-
endorsementComment:
|
|
4469
|
+
var AchievementTypeValidator = KnownAchievementTypeValidator.or(z.string());
|
|
4470
|
+
var CriteriaValidator = z.object({ id: z.string().optional(), narrative: z.string().optional() }).catchall(z.any());
|
|
4471
|
+
var EndorsementSubjectValidator = z.object({
|
|
4472
|
+
id: z.string(),
|
|
4473
|
+
type: z.string().array().nonempty(),
|
|
4474
|
+
endorsementComment: z.string().optional()
|
|
3799
4475
|
});
|
|
3800
4476
|
var EndorsementCredentialValidator = UnsignedVCValidator.extend({
|
|
3801
4477
|
credentialSubject: EndorsementSubjectValidator,
|
|
3802
4478
|
proof: ProofValidator.or(ProofValidator.array()).optional()
|
|
3803
4479
|
});
|
|
3804
|
-
var RelatedValidator =
|
|
3805
|
-
id:
|
|
3806
|
-
"@language":
|
|
3807
|
-
version:
|
|
4480
|
+
var RelatedValidator = z.object({
|
|
4481
|
+
id: z.string(),
|
|
4482
|
+
"@language": z.string().optional(),
|
|
4483
|
+
version: z.string().optional()
|
|
3808
4484
|
});
|
|
3809
|
-
var ResultTypeValidator =
|
|
4485
|
+
var ResultTypeValidator = z.enum([
|
|
3810
4486
|
"GradePointAverage",
|
|
3811
4487
|
"LetterGrade",
|
|
3812
4488
|
"Percent",
|
|
@@ -3819,59 +4495,59 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
3819
4495
|
"RubricScore",
|
|
3820
4496
|
"ScaledScore",
|
|
3821
4497
|
"Status"
|
|
3822
|
-
]).or(
|
|
3823
|
-
var RubricCriterionValidator =
|
|
3824
|
-
id:
|
|
3825
|
-
type:
|
|
4498
|
+
]).or(z.string());
|
|
4499
|
+
var RubricCriterionValidator = z.object({
|
|
4500
|
+
id: z.string(),
|
|
4501
|
+
type: z.string().array().nonempty(),
|
|
3826
4502
|
alignment: AlignmentValidator.array().optional(),
|
|
3827
|
-
description:
|
|
3828
|
-
level:
|
|
3829
|
-
name:
|
|
3830
|
-
points:
|
|
3831
|
-
}).catchall(
|
|
3832
|
-
var ResultDescriptionValidator =
|
|
3833
|
-
id:
|
|
3834
|
-
type:
|
|
4503
|
+
description: z.string().optional(),
|
|
4504
|
+
level: z.string().optional(),
|
|
4505
|
+
name: z.string(),
|
|
4506
|
+
points: z.string().optional()
|
|
4507
|
+
}).catchall(z.any());
|
|
4508
|
+
var ResultDescriptionValidator = z.object({
|
|
4509
|
+
id: z.string(),
|
|
4510
|
+
type: z.string().array().nonempty(),
|
|
3835
4511
|
alignment: AlignmentValidator.array().optional(),
|
|
3836
|
-
allowedValue:
|
|
3837
|
-
name:
|
|
3838
|
-
requiredLevel:
|
|
3839
|
-
requiredValue:
|
|
4512
|
+
allowedValue: z.string().array().optional(),
|
|
4513
|
+
name: z.string(),
|
|
4514
|
+
requiredLevel: z.string().optional(),
|
|
4515
|
+
requiredValue: z.string().optional(),
|
|
3840
4516
|
resultType: ResultTypeValidator,
|
|
3841
4517
|
rubricCriterionLevel: RubricCriterionValidator.array().optional(),
|
|
3842
|
-
valueMax:
|
|
3843
|
-
valueMin:
|
|
3844
|
-
}).catchall(
|
|
3845
|
-
var AchievementValidator =
|
|
3846
|
-
id:
|
|
3847
|
-
type:
|
|
4518
|
+
valueMax: z.string().optional(),
|
|
4519
|
+
valueMin: z.string().optional()
|
|
4520
|
+
}).catchall(z.any());
|
|
4521
|
+
var AchievementValidator = z.object({
|
|
4522
|
+
id: z.string().optional(),
|
|
4523
|
+
type: z.string().array().nonempty(),
|
|
3848
4524
|
alignment: AlignmentValidator.array().optional(),
|
|
3849
4525
|
achievementType: AchievementTypeValidator.optional(),
|
|
3850
4526
|
creator: ProfileValidator.optional(),
|
|
3851
|
-
creditsAvailable:
|
|
4527
|
+
creditsAvailable: z.number().optional(),
|
|
3852
4528
|
criteria: CriteriaValidator,
|
|
3853
|
-
description:
|
|
4529
|
+
description: z.string(),
|
|
3854
4530
|
endorsement: EndorsementCredentialValidator.array().optional(),
|
|
3855
|
-
fieldOfStudy:
|
|
3856
|
-
humanCode:
|
|
4531
|
+
fieldOfStudy: z.string().optional(),
|
|
4532
|
+
humanCode: z.string().optional(),
|
|
3857
4533
|
image: ImageValidator.optional(),
|
|
3858
|
-
"@language":
|
|
3859
|
-
name:
|
|
4534
|
+
"@language": z.string().optional(),
|
|
4535
|
+
name: z.string(),
|
|
3860
4536
|
otherIdentifier: IdentifierEntryValidator.array().optional(),
|
|
3861
4537
|
related: RelatedValidator.array().optional(),
|
|
3862
4538
|
resultDescription: ResultDescriptionValidator.array().optional(),
|
|
3863
|
-
specialization:
|
|
3864
|
-
tag:
|
|
3865
|
-
version:
|
|
3866
|
-
}).catchall(
|
|
3867
|
-
var IdentityObjectValidator =
|
|
3868
|
-
type:
|
|
3869
|
-
hashed:
|
|
3870
|
-
identityHash:
|
|
3871
|
-
identityType:
|
|
3872
|
-
salt:
|
|
4539
|
+
specialization: z.string().optional(),
|
|
4540
|
+
tag: z.string().array().optional(),
|
|
4541
|
+
version: z.string().optional()
|
|
4542
|
+
}).catchall(z.any());
|
|
4543
|
+
var IdentityObjectValidator = z.object({
|
|
4544
|
+
type: z.string(),
|
|
4545
|
+
hashed: z.boolean(),
|
|
4546
|
+
identityHash: z.string(),
|
|
4547
|
+
identityType: z.string(),
|
|
4548
|
+
salt: z.string().optional()
|
|
3873
4549
|
});
|
|
3874
|
-
var ResultStatusTypeValidator =
|
|
4550
|
+
var ResultStatusTypeValidator = z.enum([
|
|
3875
4551
|
"Completed",
|
|
3876
4552
|
"Enrolled",
|
|
3877
4553
|
"Failed",
|
|
@@ -3879,42 +4555,42 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
3879
4555
|
"OnHold",
|
|
3880
4556
|
"Withdrew"
|
|
3881
4557
|
]);
|
|
3882
|
-
var ResultValidator =
|
|
3883
|
-
type:
|
|
3884
|
-
achievedLevel:
|
|
4558
|
+
var ResultValidator = z.object({
|
|
4559
|
+
type: z.string().array().nonempty(),
|
|
4560
|
+
achievedLevel: z.string().optional(),
|
|
3885
4561
|
alignment: AlignmentValidator.array().optional(),
|
|
3886
|
-
resultDescription:
|
|
4562
|
+
resultDescription: z.string().optional(),
|
|
3887
4563
|
status: ResultStatusTypeValidator.optional(),
|
|
3888
|
-
value:
|
|
3889
|
-
}).catchall(
|
|
3890
|
-
var AchievementSubjectValidator =
|
|
3891
|
-
id:
|
|
3892
|
-
type:
|
|
3893
|
-
activityEndDate:
|
|
3894
|
-
activityStartDate:
|
|
3895
|
-
creditsEarned:
|
|
4564
|
+
value: z.string().optional()
|
|
4565
|
+
}).catchall(z.any());
|
|
4566
|
+
var AchievementSubjectValidator = z.object({
|
|
4567
|
+
id: z.string().optional(),
|
|
4568
|
+
type: z.string().array().nonempty(),
|
|
4569
|
+
activityEndDate: z.string().optional(),
|
|
4570
|
+
activityStartDate: z.string().optional(),
|
|
4571
|
+
creditsEarned: z.number().optional(),
|
|
3896
4572
|
achievement: AchievementValidator.optional(),
|
|
3897
4573
|
identifier: IdentityObjectValidator.array().optional(),
|
|
3898
4574
|
image: ImageValidator.optional(),
|
|
3899
|
-
licenseNumber:
|
|
3900
|
-
narrative:
|
|
4575
|
+
licenseNumber: z.string().optional(),
|
|
4576
|
+
narrative: z.string().optional(),
|
|
3901
4577
|
result: ResultValidator.array().optional(),
|
|
3902
|
-
role:
|
|
4578
|
+
role: z.string().optional(),
|
|
3903
4579
|
source: ProfileValidator.optional(),
|
|
3904
|
-
term:
|
|
3905
|
-
}).catchall(
|
|
3906
|
-
var EvidenceValidator =
|
|
3907
|
-
id:
|
|
3908
|
-
type:
|
|
3909
|
-
narrative:
|
|
3910
|
-
name:
|
|
3911
|
-
description:
|
|
3912
|
-
genre:
|
|
3913
|
-
audience:
|
|
3914
|
-
}).catchall(
|
|
4580
|
+
term: z.string().optional()
|
|
4581
|
+
}).catchall(z.any());
|
|
4582
|
+
var EvidenceValidator = z.object({
|
|
4583
|
+
id: z.string().optional(),
|
|
4584
|
+
type: z.string().or(z.string().array().nonempty()),
|
|
4585
|
+
narrative: z.string().optional(),
|
|
4586
|
+
name: z.string().optional(),
|
|
4587
|
+
description: z.string().optional(),
|
|
4588
|
+
genre: z.string().optional(),
|
|
4589
|
+
audience: z.string().optional()
|
|
4590
|
+
}).catchall(z.any());
|
|
3915
4591
|
var UnsignedAchievementCredentialValidator = UnsignedVCValidator.extend({
|
|
3916
|
-
name:
|
|
3917
|
-
description:
|
|
4592
|
+
name: z.string().optional(),
|
|
4593
|
+
description: z.string().optional(),
|
|
3918
4594
|
image: ImageValidator.optional(),
|
|
3919
4595
|
credentialSubject: AchievementSubjectValidator.or(
|
|
3920
4596
|
AchievementSubjectValidator.array()
|
|
@@ -3925,42 +4601,42 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
3925
4601
|
var AchievementCredentialValidator = UnsignedAchievementCredentialValidator.extend({
|
|
3926
4602
|
proof: ProofValidator.or(ProofValidator.array())
|
|
3927
4603
|
});
|
|
3928
|
-
var VerificationCheckValidator =
|
|
3929
|
-
checks:
|
|
3930
|
-
warnings:
|
|
3931
|
-
errors:
|
|
4604
|
+
var VerificationCheckValidator = z.object({
|
|
4605
|
+
checks: z.string().array(),
|
|
4606
|
+
warnings: z.string().array(),
|
|
4607
|
+
errors: z.string().array()
|
|
3932
4608
|
});
|
|
3933
|
-
var VerificationStatusValidator =
|
|
4609
|
+
var VerificationStatusValidator = z.enum(["Success", "Failed", "Error"]);
|
|
3934
4610
|
var VerificationStatusEnum = VerificationStatusValidator.enum;
|
|
3935
|
-
var VerificationItemValidator =
|
|
3936
|
-
check:
|
|
4611
|
+
var VerificationItemValidator = z.object({
|
|
4612
|
+
check: z.string(),
|
|
3937
4613
|
status: VerificationStatusValidator,
|
|
3938
|
-
message:
|
|
3939
|
-
details:
|
|
4614
|
+
message: z.string().optional(),
|
|
4615
|
+
details: z.string().optional()
|
|
3940
4616
|
});
|
|
3941
|
-
var CredentialInfoValidator =
|
|
3942
|
-
title:
|
|
3943
|
-
createdAt:
|
|
4617
|
+
var CredentialInfoValidator = z.object({
|
|
4618
|
+
title: z.string().optional(),
|
|
4619
|
+
createdAt: z.string().optional(),
|
|
3944
4620
|
issuer: ProfileValidator.optional(),
|
|
3945
4621
|
issuee: ProfileValidator.optional(),
|
|
3946
4622
|
credentialSubject: CredentialSubjectValidator.optional()
|
|
3947
4623
|
});
|
|
3948
|
-
var CredentialRecordValidator =
|
|
3949
|
-
var PaginationOptionsValidator =
|
|
3950
|
-
limit:
|
|
3951
|
-
cursor:
|
|
3952
|
-
sort:
|
|
4624
|
+
var CredentialRecordValidator = z.object({ id: z.string(), uri: z.string() }).catchall(z.any());
|
|
4625
|
+
var PaginationOptionsValidator = z.object({
|
|
4626
|
+
limit: z.number(),
|
|
4627
|
+
cursor: z.string().optional(),
|
|
4628
|
+
sort: z.string().optional()
|
|
3953
4629
|
});
|
|
3954
|
-
var PaginationResponseValidator =
|
|
3955
|
-
cursor:
|
|
3956
|
-
hasMore:
|
|
4630
|
+
var PaginationResponseValidator = z.object({
|
|
4631
|
+
cursor: z.string().optional(),
|
|
4632
|
+
hasMore: z.boolean()
|
|
3957
4633
|
});
|
|
3958
|
-
var EncryptedRecordValidator =
|
|
4634
|
+
var EncryptedRecordValidator = z.object({ encryptedRecord: JWEValidator2, fields: z.string().array() }).catchall(z.any());
|
|
3959
4635
|
var PaginatedEncryptedRecordsValidator = PaginationResponseValidator.extend({
|
|
3960
4636
|
records: EncryptedRecordValidator.array()
|
|
3961
4637
|
});
|
|
3962
4638
|
var EncryptedCredentialRecordValidator = EncryptedRecordValidator.extend({
|
|
3963
|
-
id:
|
|
4639
|
+
id: z.string()
|
|
3964
4640
|
});
|
|
3965
4641
|
var PaginatedEncryptedCredentialRecordsValidator = PaginationResponseValidator.extend({
|
|
3966
4642
|
records: EncryptedCredentialRecordValidator.array()
|
|
@@ -3971,8 +4647,8 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
3971
4647
|
throw new Error("Invalid RegExp string format");
|
|
3972
4648
|
return { pattern: match[1], flags: match[2] };
|
|
3973
4649
|
}, "parseRegexString");
|
|
3974
|
-
var RegExpValidator =
|
|
3975
|
-
|
|
4650
|
+
var RegExpValidator = z.instanceof(RegExp).or(
|
|
4651
|
+
z.string().refine(
|
|
3976
4652
|
(str) => {
|
|
3977
4653
|
try {
|
|
3978
4654
|
parseRegexString(str);
|
|
@@ -3993,71 +4669,71 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
3993
4669
|
}
|
|
3994
4670
|
})
|
|
3995
4671
|
);
|
|
3996
|
-
var StringQuery =
|
|
3997
|
-
var LCNProfileDisplayValidator =
|
|
3998
|
-
backgroundColor:
|
|
3999
|
-
backgroundImage:
|
|
4000
|
-
fadeBackgroundImage:
|
|
4001
|
-
repeatBackgroundImage:
|
|
4002
|
-
fontColor:
|
|
4003
|
-
accentColor:
|
|
4004
|
-
accentFontColor:
|
|
4005
|
-
idBackgroundImage:
|
|
4006
|
-
fadeIdBackgroundImage:
|
|
4007
|
-
idBackgroundColor:
|
|
4008
|
-
repeatIdBackgroundImage:
|
|
4672
|
+
var StringQuery = z.string().or(z.object({ $in: z.string().array() })).or(z.object({ $regex: RegExpValidator }));
|
|
4673
|
+
var LCNProfileDisplayValidator = z.object({
|
|
4674
|
+
backgroundColor: z.string().optional(),
|
|
4675
|
+
backgroundImage: z.string().optional(),
|
|
4676
|
+
fadeBackgroundImage: z.boolean().optional(),
|
|
4677
|
+
repeatBackgroundImage: z.boolean().optional(),
|
|
4678
|
+
fontColor: z.string().optional(),
|
|
4679
|
+
accentColor: z.string().optional(),
|
|
4680
|
+
accentFontColor: z.string().optional(),
|
|
4681
|
+
idBackgroundImage: z.string().optional(),
|
|
4682
|
+
fadeIdBackgroundImage: z.boolean().optional(),
|
|
4683
|
+
idBackgroundColor: z.string().optional(),
|
|
4684
|
+
repeatIdBackgroundImage: z.boolean().optional()
|
|
4009
4685
|
});
|
|
4010
|
-
var LCNProfileValidator =
|
|
4011
|
-
profileId:
|
|
4012
|
-
displayName:
|
|
4013
|
-
shortBio:
|
|
4014
|
-
bio:
|
|
4015
|
-
did:
|
|
4016
|
-
isPrivate:
|
|
4017
|
-
email:
|
|
4018
|
-
image:
|
|
4019
|
-
heroImage:
|
|
4020
|
-
websiteLink:
|
|
4021
|
-
isServiceProfile:
|
|
4022
|
-
type:
|
|
4023
|
-
notificationsWebhook:
|
|
4686
|
+
var LCNProfileValidator = z.object({
|
|
4687
|
+
profileId: z.string().min(3).max(40).describe("Unique, URL-safe identifier for the profile."),
|
|
4688
|
+
displayName: z.string().default("").describe("Human-readable display name for the profile."),
|
|
4689
|
+
shortBio: z.string().default("").describe("Short bio for the profile."),
|
|
4690
|
+
bio: z.string().default("").describe("Longer bio for the profile."),
|
|
4691
|
+
did: z.string().describe("Decentralized Identifier for the profile. (auto-assigned)"),
|
|
4692
|
+
isPrivate: z.boolean().optional().describe("Whether the profile is private or not and shows up in search results."),
|
|
4693
|
+
email: z.string().optional().describe("Contact email address for the profile."),
|
|
4694
|
+
image: z.string().optional().describe("Profile image URL for the profile."),
|
|
4695
|
+
heroImage: z.string().optional().describe("Hero image URL for the profile."),
|
|
4696
|
+
websiteLink: z.string().optional().describe("Website link for the profile."),
|
|
4697
|
+
isServiceProfile: z.boolean().default(false).optional().describe("Whether the profile is a service profile or not."),
|
|
4698
|
+
type: z.string().optional().describe('Profile type: e.g. "person", "organization", "service".'),
|
|
4699
|
+
notificationsWebhook: z.string().url().startsWith("http").optional().describe("URL to send notifications to."),
|
|
4024
4700
|
display: LCNProfileDisplayValidator.optional().describe("Display settings for the profile."),
|
|
4025
|
-
role:
|
|
4026
|
-
dob:
|
|
4701
|
+
role: z.string().default("").optional().describe('Role of the profile: e.g. "teacher", "student".'),
|
|
4702
|
+
dob: z.string().default("").optional().describe('Date of birth of the profile: e.g. "1990-01-01".')
|
|
4027
4703
|
});
|
|
4028
|
-
var LCNProfileQueryValidator =
|
|
4704
|
+
var LCNProfileQueryValidator = z.object({
|
|
4029
4705
|
profileId: StringQuery,
|
|
4030
4706
|
displayName: StringQuery,
|
|
4031
4707
|
shortBio: StringQuery,
|
|
4032
4708
|
bio: StringQuery,
|
|
4033
4709
|
email: StringQuery,
|
|
4034
4710
|
websiteLink: StringQuery,
|
|
4035
|
-
isServiceProfile:
|
|
4711
|
+
isServiceProfile: z.boolean(),
|
|
4036
4712
|
type: StringQuery
|
|
4037
4713
|
}).partial();
|
|
4038
4714
|
var PaginatedLCNProfilesValidator = PaginationResponseValidator.extend({
|
|
4039
4715
|
records: LCNProfileValidator.array()
|
|
4040
4716
|
});
|
|
4041
|
-
var LCNProfileConnectionStatusEnum =
|
|
4717
|
+
var LCNProfileConnectionStatusEnum = z.enum([
|
|
4042
4718
|
"CONNECTED",
|
|
4043
4719
|
"PENDING_REQUEST_SENT",
|
|
4044
4720
|
"PENDING_REQUEST_RECEIVED",
|
|
4045
4721
|
"NOT_CONNECTED"
|
|
4046
4722
|
]);
|
|
4047
|
-
var LCNProfileManagerValidator =
|
|
4048
|
-
id:
|
|
4049
|
-
created:
|
|
4050
|
-
displayName:
|
|
4051
|
-
shortBio:
|
|
4052
|
-
bio:
|
|
4053
|
-
email:
|
|
4054
|
-
image:
|
|
4055
|
-
heroImage:
|
|
4723
|
+
var LCNProfileManagerValidator = z.object({
|
|
4724
|
+
id: z.string(),
|
|
4725
|
+
created: z.string(),
|
|
4726
|
+
displayName: z.string().default("").optional(),
|
|
4727
|
+
shortBio: z.string().default("").optional(),
|
|
4728
|
+
bio: z.string().default("").optional(),
|
|
4729
|
+
email: z.string().optional(),
|
|
4730
|
+
image: z.string().optional(),
|
|
4731
|
+
heroImage: z.string().optional()
|
|
4056
4732
|
});
|
|
4057
4733
|
var PaginatedLCNProfileManagersValidator = PaginationResponseValidator.extend({
|
|
4058
|
-
records: LCNProfileManagerValidator.extend({ did:
|
|
4734
|
+
records: LCNProfileManagerValidator.extend({ did: z.string() }).array()
|
|
4059
4735
|
});
|
|
4060
|
-
var LCNProfileManagerQueryValidator =
|
|
4736
|
+
var LCNProfileManagerQueryValidator = z.object({
|
|
4061
4737
|
id: StringQuery,
|
|
4062
4738
|
displayName: StringQuery,
|
|
4063
4739
|
shortBio: StringQuery,
|
|
@@ -4065,296 +4741,296 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
4065
4741
|
email: StringQuery
|
|
4066
4742
|
}).partial();
|
|
4067
4743
|
var PaginatedLCNProfilesAndManagersValidator = PaginationResponseValidator.extend({
|
|
4068
|
-
records:
|
|
4744
|
+
records: z.object({
|
|
4069
4745
|
profile: LCNProfileValidator,
|
|
4070
|
-
manager: LCNProfileManagerValidator.extend({ did:
|
|
4746
|
+
manager: LCNProfileManagerValidator.extend({ did: z.string() }).optional()
|
|
4071
4747
|
}).array()
|
|
4072
4748
|
});
|
|
4073
|
-
var SentCredentialInfoValidator =
|
|
4074
|
-
uri:
|
|
4075
|
-
to:
|
|
4076
|
-
from:
|
|
4077
|
-
sent:
|
|
4078
|
-
received:
|
|
4749
|
+
var SentCredentialInfoValidator = z.object({
|
|
4750
|
+
uri: z.string(),
|
|
4751
|
+
to: z.string(),
|
|
4752
|
+
from: z.string(),
|
|
4753
|
+
sent: z.string().datetime(),
|
|
4754
|
+
received: z.string().datetime().optional()
|
|
4079
4755
|
});
|
|
4080
|
-
var BoostPermissionsValidator =
|
|
4081
|
-
role:
|
|
4082
|
-
canEdit:
|
|
4083
|
-
canIssue:
|
|
4084
|
-
canRevoke:
|
|
4085
|
-
canManagePermissions:
|
|
4086
|
-
canIssueChildren:
|
|
4087
|
-
canCreateChildren:
|
|
4088
|
-
canEditChildren:
|
|
4089
|
-
canRevokeChildren:
|
|
4090
|
-
canManageChildrenPermissions:
|
|
4091
|
-
canManageChildrenProfiles:
|
|
4092
|
-
canViewAnalytics:
|
|
4756
|
+
var BoostPermissionsValidator = z.object({
|
|
4757
|
+
role: z.string(),
|
|
4758
|
+
canEdit: z.boolean(),
|
|
4759
|
+
canIssue: z.boolean(),
|
|
4760
|
+
canRevoke: z.boolean(),
|
|
4761
|
+
canManagePermissions: z.boolean(),
|
|
4762
|
+
canIssueChildren: z.string(),
|
|
4763
|
+
canCreateChildren: z.string(),
|
|
4764
|
+
canEditChildren: z.string(),
|
|
4765
|
+
canRevokeChildren: z.string(),
|
|
4766
|
+
canManageChildrenPermissions: z.string(),
|
|
4767
|
+
canManageChildrenProfiles: z.boolean().default(false).optional(),
|
|
4768
|
+
canViewAnalytics: z.boolean()
|
|
4093
4769
|
});
|
|
4094
|
-
var BoostPermissionsQueryValidator =
|
|
4770
|
+
var BoostPermissionsQueryValidator = z.object({
|
|
4095
4771
|
role: StringQuery,
|
|
4096
|
-
canEdit:
|
|
4097
|
-
canIssue:
|
|
4098
|
-
canRevoke:
|
|
4099
|
-
canManagePermissions:
|
|
4772
|
+
canEdit: z.boolean(),
|
|
4773
|
+
canIssue: z.boolean(),
|
|
4774
|
+
canRevoke: z.boolean(),
|
|
4775
|
+
canManagePermissions: z.boolean(),
|
|
4100
4776
|
canIssueChildren: StringQuery,
|
|
4101
4777
|
canCreateChildren: StringQuery,
|
|
4102
4778
|
canEditChildren: StringQuery,
|
|
4103
4779
|
canRevokeChildren: StringQuery,
|
|
4104
4780
|
canManageChildrenPermissions: StringQuery,
|
|
4105
|
-
canManageChildrenProfiles:
|
|
4106
|
-
canViewAnalytics:
|
|
4781
|
+
canManageChildrenProfiles: z.boolean(),
|
|
4782
|
+
canViewAnalytics: z.boolean()
|
|
4107
4783
|
}).partial();
|
|
4108
|
-
var ClaimHookTypeValidator =
|
|
4109
|
-
var ClaimHookValidator =
|
|
4110
|
-
|
|
4111
|
-
type:
|
|
4112
|
-
data:
|
|
4113
|
-
claimUri:
|
|
4114
|
-
targetUri:
|
|
4784
|
+
var ClaimHookTypeValidator = z.enum(["GRANT_PERMISSIONS", "ADD_ADMIN"]);
|
|
4785
|
+
var ClaimHookValidator = z.discriminatedUnion("type", [
|
|
4786
|
+
z.object({
|
|
4787
|
+
type: z.literal(ClaimHookTypeValidator.Values.GRANT_PERMISSIONS),
|
|
4788
|
+
data: z.object({
|
|
4789
|
+
claimUri: z.string(),
|
|
4790
|
+
targetUri: z.string(),
|
|
4115
4791
|
permissions: BoostPermissionsValidator.partial()
|
|
4116
4792
|
})
|
|
4117
4793
|
}),
|
|
4118
|
-
|
|
4119
|
-
type:
|
|
4120
|
-
data:
|
|
4794
|
+
z.object({
|
|
4795
|
+
type: z.literal(ClaimHookTypeValidator.Values.ADD_ADMIN),
|
|
4796
|
+
data: z.object({ claimUri: z.string(), targetUri: z.string() })
|
|
4121
4797
|
})
|
|
4122
4798
|
]);
|
|
4123
|
-
var ClaimHookQueryValidator =
|
|
4799
|
+
var ClaimHookQueryValidator = z.object({
|
|
4124
4800
|
type: StringQuery,
|
|
4125
|
-
data:
|
|
4801
|
+
data: z.object({
|
|
4126
4802
|
claimUri: StringQuery,
|
|
4127
4803
|
targetUri: StringQuery,
|
|
4128
4804
|
permissions: BoostPermissionsQueryValidator
|
|
4129
4805
|
})
|
|
4130
4806
|
}).deepPartial();
|
|
4131
|
-
var FullClaimHookValidator =
|
|
4807
|
+
var FullClaimHookValidator = z.object({ id: z.string(), createdAt: z.string(), updatedAt: z.string() }).and(ClaimHookValidator);
|
|
4132
4808
|
var PaginatedClaimHooksValidator = PaginationResponseValidator.extend({
|
|
4133
4809
|
records: FullClaimHookValidator.array()
|
|
4134
4810
|
});
|
|
4135
|
-
var LCNBoostStatus =
|
|
4136
|
-
var BoostValidator =
|
|
4137
|
-
uri:
|
|
4138
|
-
name:
|
|
4139
|
-
type:
|
|
4140
|
-
category:
|
|
4811
|
+
var LCNBoostStatus = z.enum(["DRAFT", "LIVE"]);
|
|
4812
|
+
var BoostValidator = z.object({
|
|
4813
|
+
uri: z.string(),
|
|
4814
|
+
name: z.string().optional(),
|
|
4815
|
+
type: z.string().optional(),
|
|
4816
|
+
category: z.string().optional(),
|
|
4141
4817
|
status: LCNBoostStatus.optional(),
|
|
4142
|
-
autoConnectRecipients:
|
|
4143
|
-
meta:
|
|
4818
|
+
autoConnectRecipients: z.boolean().optional(),
|
|
4819
|
+
meta: z.record(z.any()).optional(),
|
|
4144
4820
|
claimPermissions: BoostPermissionsValidator.optional()
|
|
4145
4821
|
});
|
|
4146
|
-
var BoostQueryValidator =
|
|
4822
|
+
var BoostQueryValidator = z.object({
|
|
4147
4823
|
uri: StringQuery,
|
|
4148
4824
|
name: StringQuery,
|
|
4149
4825
|
type: StringQuery,
|
|
4150
4826
|
category: StringQuery,
|
|
4151
|
-
meta:
|
|
4152
|
-
status: LCNBoostStatus.or(
|
|
4153
|
-
autoConnectRecipients:
|
|
4827
|
+
meta: z.record(StringQuery),
|
|
4828
|
+
status: LCNBoostStatus.or(z.object({ $in: LCNBoostStatus.array() })),
|
|
4829
|
+
autoConnectRecipients: z.boolean()
|
|
4154
4830
|
}).partial();
|
|
4155
4831
|
var PaginatedBoostsValidator = PaginationResponseValidator.extend({
|
|
4156
4832
|
records: BoostValidator.array()
|
|
4157
4833
|
});
|
|
4158
|
-
var BoostRecipientValidator =
|
|
4834
|
+
var BoostRecipientValidator = z.object({
|
|
4159
4835
|
to: LCNProfileValidator,
|
|
4160
|
-
from:
|
|
4161
|
-
received:
|
|
4162
|
-
uri:
|
|
4836
|
+
from: z.string(),
|
|
4837
|
+
received: z.string().optional(),
|
|
4838
|
+
uri: z.string().optional()
|
|
4163
4839
|
});
|
|
4164
4840
|
var PaginatedBoostRecipientsValidator = PaginationResponseValidator.extend({
|
|
4165
4841
|
records: BoostRecipientValidator.array()
|
|
4166
4842
|
});
|
|
4167
|
-
var LCNBoostClaimLinkSigningAuthorityValidator =
|
|
4168
|
-
endpoint:
|
|
4169
|
-
name:
|
|
4170
|
-
did:
|
|
4843
|
+
var LCNBoostClaimLinkSigningAuthorityValidator = z.object({
|
|
4844
|
+
endpoint: z.string(),
|
|
4845
|
+
name: z.string(),
|
|
4846
|
+
did: z.string().optional()
|
|
4171
4847
|
});
|
|
4172
|
-
var LCNBoostClaimLinkOptionsValidator =
|
|
4173
|
-
ttlSeconds:
|
|
4174
|
-
totalUses:
|
|
4848
|
+
var LCNBoostClaimLinkOptionsValidator = z.object({
|
|
4849
|
+
ttlSeconds: z.number().optional(),
|
|
4850
|
+
totalUses: z.number().optional()
|
|
4175
4851
|
});
|
|
4176
|
-
var LCNSigningAuthorityValidator =
|
|
4177
|
-
endpoint:
|
|
4852
|
+
var LCNSigningAuthorityValidator = z.object({
|
|
4853
|
+
endpoint: z.string()
|
|
4178
4854
|
});
|
|
4179
|
-
var LCNSigningAuthorityForUserValidator =
|
|
4855
|
+
var LCNSigningAuthorityForUserValidator = z.object({
|
|
4180
4856
|
signingAuthority: LCNSigningAuthorityValidator,
|
|
4181
|
-
relationship:
|
|
4182
|
-
name:
|
|
4857
|
+
relationship: z.object({
|
|
4858
|
+
name: z.string().max(15).regex(/^[a-z0-9-]+$/, {
|
|
4183
4859
|
message: "The input string must contain only lowercase letters, numbers, and hyphens."
|
|
4184
4860
|
}),
|
|
4185
|
-
did:
|
|
4861
|
+
did: z.string()
|
|
4186
4862
|
})
|
|
4187
4863
|
});
|
|
4188
|
-
var AutoBoostConfigValidator =
|
|
4189
|
-
boostUri:
|
|
4190
|
-
signingAuthority:
|
|
4191
|
-
endpoint:
|
|
4192
|
-
name:
|
|
4864
|
+
var AutoBoostConfigValidator = z.object({
|
|
4865
|
+
boostUri: z.string(),
|
|
4866
|
+
signingAuthority: z.object({
|
|
4867
|
+
endpoint: z.string(),
|
|
4868
|
+
name: z.string()
|
|
4193
4869
|
})
|
|
4194
4870
|
});
|
|
4195
|
-
var ConsentFlowTermsStatusValidator =
|
|
4196
|
-
var ConsentFlowContractValidator =
|
|
4197
|
-
read:
|
|
4198
|
-
anonymize:
|
|
4199
|
-
credentials:
|
|
4200
|
-
personal:
|
|
4871
|
+
var ConsentFlowTermsStatusValidator = z.enum(["live", "stale", "withdrawn"]);
|
|
4872
|
+
var ConsentFlowContractValidator = z.object({
|
|
4873
|
+
read: z.object({
|
|
4874
|
+
anonymize: z.boolean().optional(),
|
|
4875
|
+
credentials: z.object({ categories: z.record(z.object({ required: z.boolean() })).default({}) }).default({}),
|
|
4876
|
+
personal: z.record(z.object({ required: z.boolean() })).default({})
|
|
4201
4877
|
}).default({}),
|
|
4202
|
-
write:
|
|
4203
|
-
credentials:
|
|
4204
|
-
personal:
|
|
4878
|
+
write: z.object({
|
|
4879
|
+
credentials: z.object({ categories: z.record(z.object({ required: z.boolean() })).default({}) }).default({}),
|
|
4880
|
+
personal: z.record(z.object({ required: z.boolean() })).default({})
|
|
4205
4881
|
}).default({})
|
|
4206
4882
|
});
|
|
4207
|
-
var ConsentFlowContractDetailsValidator =
|
|
4883
|
+
var ConsentFlowContractDetailsValidator = z.object({
|
|
4208
4884
|
contract: ConsentFlowContractValidator,
|
|
4209
4885
|
owner: LCNProfileValidator,
|
|
4210
|
-
name:
|
|
4211
|
-
subtitle:
|
|
4212
|
-
description:
|
|
4213
|
-
reasonForAccessing:
|
|
4214
|
-
image:
|
|
4215
|
-
uri:
|
|
4216
|
-
needsGuardianConsent:
|
|
4217
|
-
redirectUrl:
|
|
4218
|
-
frontDoorBoostUri:
|
|
4219
|
-
createdAt:
|
|
4220
|
-
updatedAt:
|
|
4221
|
-
expiresAt:
|
|
4222
|
-
autoBoosts:
|
|
4223
|
-
writers:
|
|
4886
|
+
name: z.string(),
|
|
4887
|
+
subtitle: z.string().optional(),
|
|
4888
|
+
description: z.string().optional(),
|
|
4889
|
+
reasonForAccessing: z.string().optional(),
|
|
4890
|
+
image: z.string().optional(),
|
|
4891
|
+
uri: z.string(),
|
|
4892
|
+
needsGuardianConsent: z.boolean().optional(),
|
|
4893
|
+
redirectUrl: z.string().optional(),
|
|
4894
|
+
frontDoorBoostUri: z.string().optional(),
|
|
4895
|
+
createdAt: z.string(),
|
|
4896
|
+
updatedAt: z.string(),
|
|
4897
|
+
expiresAt: z.string().optional(),
|
|
4898
|
+
autoBoosts: z.string().array().optional(),
|
|
4899
|
+
writers: z.array(LCNProfileValidator).optional()
|
|
4224
4900
|
});
|
|
4225
4901
|
var PaginatedConsentFlowContractsValidator = PaginationResponseValidator.extend({
|
|
4226
4902
|
records: ConsentFlowContractDetailsValidator.omit({ owner: true }).array()
|
|
4227
4903
|
});
|
|
4228
|
-
var ConsentFlowContractDataValidator =
|
|
4229
|
-
credentials:
|
|
4230
|
-
personal:
|
|
4231
|
-
date:
|
|
4904
|
+
var ConsentFlowContractDataValidator = z.object({
|
|
4905
|
+
credentials: z.object({ categories: z.record(z.string().array()).default({}) }),
|
|
4906
|
+
personal: z.record(z.string()).default({}),
|
|
4907
|
+
date: z.string()
|
|
4232
4908
|
});
|
|
4233
4909
|
var PaginatedConsentFlowDataValidator = PaginationResponseValidator.extend({
|
|
4234
4910
|
records: ConsentFlowContractDataValidator.array()
|
|
4235
4911
|
});
|
|
4236
|
-
var ConsentFlowContractDataForDidValidator =
|
|
4237
|
-
credentials:
|
|
4238
|
-
personal:
|
|
4239
|
-
date:
|
|
4240
|
-
contractUri:
|
|
4912
|
+
var ConsentFlowContractDataForDidValidator = z.object({
|
|
4913
|
+
credentials: z.object({ category: z.string(), uri: z.string() }).array(),
|
|
4914
|
+
personal: z.record(z.string()).default({}),
|
|
4915
|
+
date: z.string(),
|
|
4916
|
+
contractUri: z.string()
|
|
4241
4917
|
});
|
|
4242
4918
|
var PaginatedConsentFlowDataForDidValidator = PaginationResponseValidator.extend({
|
|
4243
4919
|
records: ConsentFlowContractDataForDidValidator.array()
|
|
4244
4920
|
});
|
|
4245
|
-
var ConsentFlowTermValidator =
|
|
4246
|
-
sharing:
|
|
4247
|
-
shared:
|
|
4248
|
-
shareAll:
|
|
4249
|
-
shareUntil:
|
|
4921
|
+
var ConsentFlowTermValidator = z.object({
|
|
4922
|
+
sharing: z.boolean().optional(),
|
|
4923
|
+
shared: z.string().array().optional(),
|
|
4924
|
+
shareAll: z.boolean().optional(),
|
|
4925
|
+
shareUntil: z.string().optional()
|
|
4250
4926
|
});
|
|
4251
|
-
var ConsentFlowTermsValidator =
|
|
4252
|
-
read:
|
|
4253
|
-
anonymize:
|
|
4254
|
-
credentials:
|
|
4255
|
-
shareAll:
|
|
4256
|
-
sharing:
|
|
4257
|
-
categories:
|
|
4927
|
+
var ConsentFlowTermsValidator = z.object({
|
|
4928
|
+
read: z.object({
|
|
4929
|
+
anonymize: z.boolean().optional(),
|
|
4930
|
+
credentials: z.object({
|
|
4931
|
+
shareAll: z.boolean().optional(),
|
|
4932
|
+
sharing: z.boolean().optional(),
|
|
4933
|
+
categories: z.record(ConsentFlowTermValidator).default({})
|
|
4258
4934
|
}).default({}),
|
|
4259
|
-
personal:
|
|
4935
|
+
personal: z.record(z.string()).default({})
|
|
4260
4936
|
}).default({}),
|
|
4261
|
-
write:
|
|
4262
|
-
credentials:
|
|
4263
|
-
personal:
|
|
4937
|
+
write: z.object({
|
|
4938
|
+
credentials: z.object({ categories: z.record(z.boolean()).default({}) }).default({}),
|
|
4939
|
+
personal: z.record(z.boolean()).default({})
|
|
4264
4940
|
}).default({}),
|
|
4265
|
-
deniedWriters:
|
|
4941
|
+
deniedWriters: z.array(z.string()).optional()
|
|
4266
4942
|
});
|
|
4267
4943
|
var PaginatedConsentFlowTermsValidator = PaginationResponseValidator.extend({
|
|
4268
|
-
records:
|
|
4269
|
-
expiresAt:
|
|
4270
|
-
oneTime:
|
|
4944
|
+
records: z.object({
|
|
4945
|
+
expiresAt: z.string().optional(),
|
|
4946
|
+
oneTime: z.boolean().optional(),
|
|
4271
4947
|
terms: ConsentFlowTermsValidator,
|
|
4272
4948
|
contract: ConsentFlowContractDetailsValidator,
|
|
4273
|
-
uri:
|
|
4949
|
+
uri: z.string(),
|
|
4274
4950
|
consenter: LCNProfileValidator,
|
|
4275
4951
|
status: ConsentFlowTermsStatusValidator
|
|
4276
4952
|
}).array()
|
|
4277
4953
|
});
|
|
4278
|
-
var ConsentFlowContractQueryValidator =
|
|
4279
|
-
read:
|
|
4280
|
-
anonymize:
|
|
4281
|
-
credentials:
|
|
4282
|
-
categories:
|
|
4954
|
+
var ConsentFlowContractQueryValidator = z.object({
|
|
4955
|
+
read: z.object({
|
|
4956
|
+
anonymize: z.boolean().optional(),
|
|
4957
|
+
credentials: z.object({
|
|
4958
|
+
categories: z.record(z.object({ required: z.boolean().optional() })).optional()
|
|
4283
4959
|
}).optional(),
|
|
4284
|
-
personal:
|
|
4960
|
+
personal: z.record(z.object({ required: z.boolean().optional() })).optional()
|
|
4285
4961
|
}).optional(),
|
|
4286
|
-
write:
|
|
4287
|
-
credentials:
|
|
4288
|
-
categories:
|
|
4962
|
+
write: z.object({
|
|
4963
|
+
credentials: z.object({
|
|
4964
|
+
categories: z.record(z.object({ required: z.boolean().optional() })).optional()
|
|
4289
4965
|
}).optional(),
|
|
4290
|
-
personal:
|
|
4966
|
+
personal: z.record(z.object({ required: z.boolean().optional() })).optional()
|
|
4291
4967
|
}).optional()
|
|
4292
4968
|
});
|
|
4293
|
-
var ConsentFlowDataQueryValidator =
|
|
4294
|
-
anonymize:
|
|
4295
|
-
credentials:
|
|
4296
|
-
personal:
|
|
4969
|
+
var ConsentFlowDataQueryValidator = z.object({
|
|
4970
|
+
anonymize: z.boolean().optional(),
|
|
4971
|
+
credentials: z.object({ categories: z.record(z.boolean()).optional() }).optional(),
|
|
4972
|
+
personal: z.record(z.boolean()).optional()
|
|
4297
4973
|
});
|
|
4298
|
-
var ConsentFlowDataForDidQueryValidator =
|
|
4299
|
-
credentials:
|
|
4300
|
-
personal:
|
|
4974
|
+
var ConsentFlowDataForDidQueryValidator = z.object({
|
|
4975
|
+
credentials: z.object({ categories: z.record(z.boolean()).optional() }).optional(),
|
|
4976
|
+
personal: z.record(z.boolean()).optional(),
|
|
4301
4977
|
id: StringQuery.optional()
|
|
4302
4978
|
});
|
|
4303
|
-
var ConsentFlowTermsQueryValidator =
|
|
4304
|
-
read:
|
|
4305
|
-
anonymize:
|
|
4306
|
-
credentials:
|
|
4307
|
-
shareAll:
|
|
4308
|
-
sharing:
|
|
4309
|
-
categories:
|
|
4979
|
+
var ConsentFlowTermsQueryValidator = z.object({
|
|
4980
|
+
read: z.object({
|
|
4981
|
+
anonymize: z.boolean().optional(),
|
|
4982
|
+
credentials: z.object({
|
|
4983
|
+
shareAll: z.boolean().optional(),
|
|
4984
|
+
sharing: z.boolean().optional(),
|
|
4985
|
+
categories: z.record(ConsentFlowTermValidator.optional()).optional()
|
|
4310
4986
|
}).optional(),
|
|
4311
|
-
personal:
|
|
4987
|
+
personal: z.record(z.string()).optional()
|
|
4312
4988
|
}).optional(),
|
|
4313
|
-
write:
|
|
4314
|
-
credentials:
|
|
4315
|
-
personal:
|
|
4989
|
+
write: z.object({
|
|
4990
|
+
credentials: z.object({ categories: z.record(z.boolean()).optional() }).optional(),
|
|
4991
|
+
personal: z.record(z.boolean()).optional()
|
|
4316
4992
|
}).optional()
|
|
4317
4993
|
});
|
|
4318
|
-
var ConsentFlowTransactionActionValidator =
|
|
4994
|
+
var ConsentFlowTransactionActionValidator = z.enum([
|
|
4319
4995
|
"consent",
|
|
4320
4996
|
"update",
|
|
4321
4997
|
"sync",
|
|
4322
4998
|
"withdraw",
|
|
4323
4999
|
"write"
|
|
4324
5000
|
]);
|
|
4325
|
-
var ConsentFlowTransactionsQueryValidator =
|
|
5001
|
+
var ConsentFlowTransactionsQueryValidator = z.object({
|
|
4326
5002
|
terms: ConsentFlowTermsQueryValidator.optional(),
|
|
4327
5003
|
action: ConsentFlowTransactionActionValidator.or(
|
|
4328
5004
|
ConsentFlowTransactionActionValidator.array()
|
|
4329
5005
|
).optional(),
|
|
4330
|
-
date:
|
|
4331
|
-
expiresAt:
|
|
4332
|
-
oneTime:
|
|
5006
|
+
date: z.object({ $gt: z.string() }).or(z.object({ $lt: z.string() })).or(z.object({ $eq: z.string() })).optional(),
|
|
5007
|
+
expiresAt: z.object({ $gt: z.string() }).or(z.object({ $lt: z.string() })).or(z.object({ $eq: z.string() })).optional(),
|
|
5008
|
+
oneTime: z.boolean().optional()
|
|
4333
5009
|
});
|
|
4334
|
-
var ConsentFlowTransactionValidator =
|
|
4335
|
-
expiresAt:
|
|
4336
|
-
oneTime:
|
|
5010
|
+
var ConsentFlowTransactionValidator = z.object({
|
|
5011
|
+
expiresAt: z.string().optional(),
|
|
5012
|
+
oneTime: z.boolean().optional(),
|
|
4337
5013
|
terms: ConsentFlowTermsValidator.optional(),
|
|
4338
|
-
id:
|
|
5014
|
+
id: z.string(),
|
|
4339
5015
|
action: ConsentFlowTransactionActionValidator,
|
|
4340
|
-
date:
|
|
4341
|
-
uris:
|
|
5016
|
+
date: z.string(),
|
|
5017
|
+
uris: z.string().array().optional()
|
|
4342
5018
|
});
|
|
4343
5019
|
var PaginatedConsentFlowTransactionsValidator = PaginationResponseValidator.extend({
|
|
4344
5020
|
records: ConsentFlowTransactionValidator.array()
|
|
4345
5021
|
});
|
|
4346
|
-
var ContractCredentialValidator =
|
|
4347
|
-
credentialUri:
|
|
4348
|
-
termsUri:
|
|
4349
|
-
contractUri:
|
|
4350
|
-
boostUri:
|
|
4351
|
-
category:
|
|
4352
|
-
date:
|
|
5022
|
+
var ContractCredentialValidator = z.object({
|
|
5023
|
+
credentialUri: z.string(),
|
|
5024
|
+
termsUri: z.string(),
|
|
5025
|
+
contractUri: z.string(),
|
|
5026
|
+
boostUri: z.string(),
|
|
5027
|
+
category: z.string().optional(),
|
|
5028
|
+
date: z.string()
|
|
4353
5029
|
});
|
|
4354
5030
|
var PaginatedContractCredentialsValidator = PaginationResponseValidator.extend({
|
|
4355
5031
|
records: ContractCredentialValidator.array()
|
|
4356
5032
|
});
|
|
4357
|
-
var LCNNotificationTypeEnumValidator =
|
|
5033
|
+
var LCNNotificationTypeEnumValidator = z.enum([
|
|
4358
5034
|
"CONNECTION_REQUEST",
|
|
4359
5035
|
"CONNECTION_ACCEPTED",
|
|
4360
5036
|
"CREDENTIAL_RECEIVED",
|
|
@@ -4365,40 +5041,40 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
4365
5041
|
"PRESENTATION_RECEIVED",
|
|
4366
5042
|
"CONSENT_FLOW_TRANSACTION"
|
|
4367
5043
|
]);
|
|
4368
|
-
var LCNNotificationMessageValidator =
|
|
4369
|
-
title:
|
|
4370
|
-
body:
|
|
5044
|
+
var LCNNotificationMessageValidator = z.object({
|
|
5045
|
+
title: z.string().optional(),
|
|
5046
|
+
body: z.string().optional()
|
|
4371
5047
|
});
|
|
4372
|
-
var LCNNotificationDataValidator =
|
|
4373
|
-
vcUris:
|
|
4374
|
-
vpUris:
|
|
5048
|
+
var LCNNotificationDataValidator = z.object({
|
|
5049
|
+
vcUris: z.array(z.string()).optional(),
|
|
5050
|
+
vpUris: z.array(z.string()).optional(),
|
|
4375
5051
|
transaction: ConsentFlowTransactionValidator.optional()
|
|
4376
5052
|
});
|
|
4377
|
-
var LCNNotificationValidator =
|
|
5053
|
+
var LCNNotificationValidator = z.object({
|
|
4378
5054
|
type: LCNNotificationTypeEnumValidator,
|
|
4379
|
-
to: LCNProfileValidator.partial().and(
|
|
4380
|
-
from: LCNProfileValidator.partial().and(
|
|
5055
|
+
to: LCNProfileValidator.partial().and(z.object({ did: z.string() })),
|
|
5056
|
+
from: LCNProfileValidator.partial().and(z.object({ did: z.string() })),
|
|
4381
5057
|
message: LCNNotificationMessageValidator.optional(),
|
|
4382
5058
|
data: LCNNotificationDataValidator.optional(),
|
|
4383
|
-
sent:
|
|
5059
|
+
sent: z.string().datetime().optional()
|
|
4384
5060
|
});
|
|
4385
5061
|
var AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX = "auth-grant:";
|
|
4386
|
-
var AuthGrantValidator =
|
|
4387
|
-
id:
|
|
4388
|
-
name:
|
|
4389
|
-
description:
|
|
4390
|
-
challenge:
|
|
4391
|
-
status:
|
|
5062
|
+
var AuthGrantValidator = z.object({
|
|
5063
|
+
id: z.string(),
|
|
5064
|
+
name: z.string(),
|
|
5065
|
+
description: z.string().optional(),
|
|
5066
|
+
challenge: z.string().startsWith(AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX).min(10, { message: "Challenge is too short" }).max(100, { message: "Challenge is too long" }),
|
|
5067
|
+
status: z.enum(["revoked", "active"], {
|
|
4392
5068
|
required_error: "Status is required",
|
|
4393
5069
|
invalid_type_error: "Status must be either active or revoked"
|
|
4394
5070
|
}),
|
|
4395
|
-
scope:
|
|
4396
|
-
createdAt:
|
|
4397
|
-
expiresAt:
|
|
5071
|
+
scope: z.string(),
|
|
5072
|
+
createdAt: z.string().datetime({ message: "createdAt must be a valid ISO 8601 datetime string" }),
|
|
5073
|
+
expiresAt: z.string().datetime({ message: "expiresAt must be a valid ISO 8601 datetime string" }).nullish().optional()
|
|
4398
5074
|
});
|
|
4399
|
-
var FlatAuthGrantValidator =
|
|
4400
|
-
var AuthGrantStatusValidator =
|
|
4401
|
-
var AuthGrantQueryValidator =
|
|
5075
|
+
var FlatAuthGrantValidator = z.object({ id: z.string() }).catchall(z.any());
|
|
5076
|
+
var AuthGrantStatusValidator = z.enum(["active", "revoked"]);
|
|
5077
|
+
var AuthGrantQueryValidator = z.object({
|
|
4402
5078
|
id: StringQuery,
|
|
4403
5079
|
name: StringQuery,
|
|
4404
5080
|
description: StringQuery,
|
|
@@ -4472,7 +5148,7 @@ var require_dist = __commonJS({
|
|
|
4472
5148
|
|
|
4473
5149
|
// src/index.ts
|
|
4474
5150
|
var import_helpers = __toESM(require_dist());
|
|
4475
|
-
import {
|
|
5151
|
+
import { createTRPCClient, httpBatchLink } from "@trpc/client";
|
|
4476
5152
|
|
|
4477
5153
|
// src/callbackLink.ts
|
|
4478
5154
|
import { observable } from "@trpc/server/observable";
|
|
@@ -4514,16 +5190,17 @@ var callbackLink = /* @__PURE__ */ __name((callback) => {
|
|
|
4514
5190
|
// src/index.ts
|
|
4515
5191
|
var getClient = /* @__PURE__ */ __name(async (url, didAuthFunction) => {
|
|
4516
5192
|
let challenges = [];
|
|
4517
|
-
const challengeRequester =
|
|
4518
|
-
transformer: {
|
|
4519
|
-
input: import_helpers.RegExpTransformer,
|
|
4520
|
-
output: { serialize: (o) => o, deserialize: (o) => o }
|
|
4521
|
-
},
|
|
5193
|
+
const challengeRequester = createTRPCClient({
|
|
4522
5194
|
links: [
|
|
4523
5195
|
httpBatchLink({
|
|
5196
|
+
methodOverride: "POST",
|
|
4524
5197
|
url,
|
|
4525
|
-
maxURLLength:
|
|
4526
|
-
headers: { Authorization: `Bearer ${await didAuthFunction()}` }
|
|
5198
|
+
maxURLLength: 3072,
|
|
5199
|
+
headers: { Authorization: `Bearer ${await didAuthFunction()}` },
|
|
5200
|
+
transformer: {
|
|
5201
|
+
input: import_helpers.RegExpTransformer,
|
|
5202
|
+
output: { serialize: (o) => o, deserialize: (o) => o }
|
|
5203
|
+
}
|
|
4527
5204
|
})
|
|
4528
5205
|
]
|
|
4529
5206
|
});
|
|
@@ -4531,22 +5208,23 @@ var getClient = /* @__PURE__ */ __name(async (url, didAuthFunction) => {
|
|
|
4531
5208
|
return challengeRequester.utilities.getChallenges.query({ amount });
|
|
4532
5209
|
}, "getChallenges");
|
|
4533
5210
|
getChallenges().then((result) => challenges = result);
|
|
4534
|
-
const trpc =
|
|
4535
|
-
transformer: {
|
|
4536
|
-
input: import_helpers.RegExpTransformer,
|
|
4537
|
-
output: { serialize: (o) => o, deserialize: (o) => o }
|
|
4538
|
-
},
|
|
5211
|
+
const trpc = createTRPCClient({
|
|
4539
5212
|
links: [
|
|
4540
5213
|
callbackLink(async () => {
|
|
4541
5214
|
challenges = await getChallenges();
|
|
4542
5215
|
}),
|
|
4543
5216
|
httpBatchLink({
|
|
4544
|
-
|
|
5217
|
+
methodOverride: "POST",
|
|
5218
|
+
maxURLLength: 3072,
|
|
4545
5219
|
url,
|
|
4546
5220
|
headers: async () => {
|
|
4547
5221
|
if (challenges.length === 0)
|
|
4548
5222
|
challenges.push(...await getChallenges());
|
|
4549
5223
|
return { Authorization: `Bearer ${await didAuthFunction(challenges.pop())}` };
|
|
5224
|
+
},
|
|
5225
|
+
transformer: {
|
|
5226
|
+
input: import_helpers.RegExpTransformer,
|
|
5227
|
+
output: { serialize: (o) => o, deserialize: (o) => o }
|
|
4550
5228
|
}
|
|
4551
5229
|
})
|
|
4552
5230
|
]
|