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