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