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