@learncard/helpers 1.0.6 → 1.0.8
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 +112 -157
- package/dist/helpers.cjs.development.js.map +3 -3
- package/dist/helpers.cjs.production.min.js +1 -1
- package/dist/helpers.cjs.production.min.js.map +3 -3
- package/dist/helpers.d.ts +1 -1
- package/dist/helpers.esm.js +112 -157
- package/dist/helpers.esm.js.map +3 -3
- package/package.json +3 -4
@@ -20,10 +20,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
20
20
|
}
|
21
21
|
return to;
|
22
22
|
};
|
23
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
25
|
-
mod
|
26
|
-
));
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
27
24
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
28
25
|
|
29
26
|
// ../learn-card-types/dist/types.cjs.development.js
|
@@ -554,7 +551,7 @@ var require_types_cjs_development = __commonJS({
|
|
554
551
|
var isAborted = /* @__PURE__ */ __name2((x) => x.status === "aborted", "isAborted");
|
555
552
|
var isDirty = /* @__PURE__ */ __name2((x) => x.status === "dirty", "isDirty");
|
556
553
|
var isValid = /* @__PURE__ */ __name2((x) => x.status === "valid", "isValid");
|
557
|
-
var isAsync = /* @__PURE__ */ __name2((x) => typeof Promise !==
|
554
|
+
var isAsync = /* @__PURE__ */ __name2((x) => typeof Promise !== void 0 && x instanceof Promise, "isAsync");
|
558
555
|
var errorUtil;
|
559
556
|
(function(errorUtil2) {
|
560
557
|
errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
@@ -773,29 +770,28 @@ var require_types_cjs_development = __commonJS({
|
|
773
770
|
return this._refinement(refinement);
|
774
771
|
}
|
775
772
|
optional() {
|
776
|
-
return ZodOptional.create(this
|
773
|
+
return ZodOptional.create(this);
|
777
774
|
}
|
778
775
|
nullable() {
|
779
|
-
return ZodNullable.create(this
|
776
|
+
return ZodNullable.create(this);
|
780
777
|
}
|
781
778
|
nullish() {
|
782
|
-
return this.
|
779
|
+
return this.optional().nullable();
|
783
780
|
}
|
784
781
|
array() {
|
785
|
-
return ZodArray.create(this
|
782
|
+
return ZodArray.create(this);
|
786
783
|
}
|
787
784
|
promise() {
|
788
|
-
return ZodPromise.create(this
|
785
|
+
return ZodPromise.create(this);
|
789
786
|
}
|
790
787
|
or(option) {
|
791
|
-
return ZodUnion.create([this, option]
|
788
|
+
return ZodUnion.create([this, option]);
|
792
789
|
}
|
793
790
|
and(incoming) {
|
794
|
-
return ZodIntersection.create(this, incoming
|
791
|
+
return ZodIntersection.create(this, incoming);
|
795
792
|
}
|
796
793
|
transform(transform) {
|
797
794
|
return new ZodEffects({
|
798
|
-
...processCreateParams(this._def),
|
799
795
|
schema: this,
|
800
796
|
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
801
797
|
effect: { type: "transform", transform }
|
@@ -804,7 +800,6 @@ var require_types_cjs_development = __commonJS({
|
|
804
800
|
default(def) {
|
805
801
|
const defaultValueFunc = typeof def === "function" ? def : () => def;
|
806
802
|
return new ZodDefault({
|
807
|
-
...processCreateParams(this._def),
|
808
803
|
innerType: this,
|
809
804
|
defaultValue: defaultValueFunc,
|
810
805
|
typeName: ZodFirstPartyTypeKind.ZodDefault
|
@@ -814,15 +809,14 @@ var require_types_cjs_development = __commonJS({
|
|
814
809
|
return new ZodBranded({
|
815
810
|
typeName: ZodFirstPartyTypeKind.ZodBranded,
|
816
811
|
type: this,
|
817
|
-
...processCreateParams(
|
812
|
+
...processCreateParams(void 0)
|
818
813
|
});
|
819
814
|
}
|
820
815
|
catch(def) {
|
821
|
-
const
|
816
|
+
const defaultValueFunc = typeof def === "function" ? def : () => def;
|
822
817
|
return new ZodCatch({
|
823
|
-
...processCreateParams(this._def),
|
824
818
|
innerType: this,
|
825
|
-
|
819
|
+
defaultValue: defaultValueFunc,
|
826
820
|
typeName: ZodFirstPartyTypeKind.ZodCatch
|
827
821
|
});
|
828
822
|
}
|
@@ -845,25 +839,24 @@ var require_types_cjs_development = __commonJS({
|
|
845
839
|
}, "ZodType");
|
846
840
|
__name2(ZodType, "ZodType");
|
847
841
|
var cuidRegex = /^c[^\s-]{8,}$/i;
|
848
|
-
var cuid2Regex = /^[a-z][a-z0-9]*$/;
|
849
842
|
var uuidRegex = /^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
850
|
-
var emailRegex = /^(([^<>()[\]
|
843
|
+
var emailRegex = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;
|
851
844
|
var datetimeRegex = /* @__PURE__ */ __name2((args) => {
|
852
845
|
if (args.precision) {
|
853
846
|
if (args.offset) {
|
854
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}
|
847
|
+
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}:\\d{2})|Z)$`);
|
855
848
|
} else {
|
856
849
|
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
|
857
850
|
}
|
858
851
|
} else if (args.precision === 0) {
|
859
852
|
if (args.offset) {
|
860
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}
|
853
|
+
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$`);
|
861
854
|
} else {
|
862
855
|
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
|
863
856
|
}
|
864
857
|
} else {
|
865
858
|
if (args.offset) {
|
866
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}
|
859
|
+
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$`);
|
867
860
|
} else {
|
868
861
|
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
|
869
862
|
}
|
@@ -890,14 +883,11 @@ var require_types_cjs_development = __commonJS({
|
|
890
883
|
const parsedType = this._getType(input);
|
891
884
|
if (parsedType !== ZodParsedType.string) {
|
892
885
|
const ctx2 = this._getOrReturnCtx(input);
|
893
|
-
addIssueToContext(
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
received: ctx2.parsedType
|
899
|
-
}
|
900
|
-
);
|
886
|
+
addIssueToContext(ctx2, {
|
887
|
+
code: ZodIssueCode.invalid_type,
|
888
|
+
expected: ZodParsedType.string,
|
889
|
+
received: ctx2.parsedType
|
890
|
+
});
|
901
891
|
return INVALID;
|
902
892
|
}
|
903
893
|
const status = new ParseStatus();
|
@@ -985,16 +975,6 @@ var require_types_cjs_development = __commonJS({
|
|
985
975
|
});
|
986
976
|
status.dirty();
|
987
977
|
}
|
988
|
-
} else if (check.kind === "cuid2") {
|
989
|
-
if (!cuid2Regex.test(input.data)) {
|
990
|
-
ctx = this._getOrReturnCtx(input, ctx);
|
991
|
-
addIssueToContext(ctx, {
|
992
|
-
validation: "cuid2",
|
993
|
-
code: ZodIssueCode.invalid_string,
|
994
|
-
message: check.message
|
995
|
-
});
|
996
|
-
status.dirty();
|
997
|
-
}
|
998
978
|
} else if (check.kind === "url") {
|
999
979
|
try {
|
1000
980
|
new URL(input.data);
|
@@ -1076,9 +1056,6 @@ var require_types_cjs_development = __commonJS({
|
|
1076
1056
|
cuid(message) {
|
1077
1057
|
return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
|
1078
1058
|
}
|
1079
|
-
cuid2(message) {
|
1080
|
-
return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
|
1081
|
-
}
|
1082
1059
|
datetime(options) {
|
1083
1060
|
var _a;
|
1084
1061
|
if (typeof options === "string") {
|
@@ -1153,9 +1130,6 @@ var require_types_cjs_development = __commonJS({
|
|
1153
1130
|
get isCUID() {
|
1154
1131
|
return !!this._def.checks.find((ch) => ch.kind === "cuid");
|
1155
1132
|
}
|
1156
|
-
get isCUID2() {
|
1157
|
-
return !!this._def.checks.find((ch) => ch.kind === "cuid2");
|
1158
|
-
}
|
1159
1133
|
get minLength() {
|
1160
1134
|
let min = null;
|
1161
1135
|
for (const ch of this._def.checks) {
|
@@ -1389,22 +1363,7 @@ var require_types_cjs_development = __commonJS({
|
|
1389
1363
|
return max;
|
1390
1364
|
}
|
1391
1365
|
get isInt() {
|
1392
|
-
return !!this._def.checks.find((ch) => ch.kind === "int"
|
1393
|
-
}
|
1394
|
-
get isFinite() {
|
1395
|
-
let max = null, min = null;
|
1396
|
-
for (const ch of this._def.checks) {
|
1397
|
-
if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
|
1398
|
-
return true;
|
1399
|
-
} else if (ch.kind === "min") {
|
1400
|
-
if (min === null || ch.value > min)
|
1401
|
-
min = ch.value;
|
1402
|
-
} else if (ch.kind === "max") {
|
1403
|
-
if (max === null || ch.value < max)
|
1404
|
-
max = ch.value;
|
1405
|
-
}
|
1406
|
-
}
|
1407
|
-
return Number.isFinite(min) && Number.isFinite(max);
|
1366
|
+
return !!this._def.checks.find((ch) => ch.kind === "int");
|
1408
1367
|
}
|
1409
1368
|
}, "ZodNumber");
|
1410
1369
|
__name2(ZodNumber, "ZodNumber");
|
@@ -1772,13 +1731,13 @@ var require_types_cjs_development = __commonJS({
|
|
1772
1731
|
}
|
1773
1732
|
}
|
1774
1733
|
if (ctx.common.async) {
|
1775
|
-
return Promise.all(
|
1734
|
+
return Promise.all(ctx.data.map((item, i) => {
|
1776
1735
|
return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
|
1777
1736
|
})).then((result2) => {
|
1778
1737
|
return ParseStatus.mergeArray(status, result2);
|
1779
1738
|
});
|
1780
1739
|
}
|
1781
|
-
const result =
|
1740
|
+
const result = ctx.data.map((item, i) => {
|
1782
1741
|
return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
|
1783
1742
|
});
|
1784
1743
|
return ParseStatus.mergeArray(status, result);
|
@@ -1828,6 +1787,15 @@ var require_types_cjs_development = __commonJS({
|
|
1828
1787
|
};
|
1829
1788
|
};
|
1830
1789
|
})(objectUtil || (objectUtil = {}));
|
1790
|
+
var AugmentFactory = /* @__PURE__ */ __name2((def) => (augmentation) => {
|
1791
|
+
return new ZodObject({
|
1792
|
+
...def,
|
1793
|
+
shape: () => ({
|
1794
|
+
...def.shape(),
|
1795
|
+
...augmentation
|
1796
|
+
})
|
1797
|
+
});
|
1798
|
+
}, "AugmentFactory");
|
1831
1799
|
function deepPartialify(schema) {
|
1832
1800
|
if (schema instanceof ZodObject) {
|
1833
1801
|
const newShape = {};
|
@@ -1858,7 +1826,8 @@ var require_types_cjs_development = __commonJS({
|
|
1858
1826
|
super(...arguments);
|
1859
1827
|
this._cached = null;
|
1860
1828
|
this.nonstrict = this.passthrough;
|
1861
|
-
this.augment = this.
|
1829
|
+
this.augment = AugmentFactory(this._def);
|
1830
|
+
this.extend = AugmentFactory(this._def);
|
1862
1831
|
}
|
1863
1832
|
_getCached() {
|
1864
1833
|
if (this._cached !== null)
|
@@ -1926,9 +1895,7 @@ var require_types_cjs_development = __commonJS({
|
|
1926
1895
|
const value = ctx.data[key];
|
1927
1896
|
pairs.push({
|
1928
1897
|
key: { status: "valid", value: key },
|
1929
|
-
value: catchall._parse(
|
1930
|
-
new ParseInputLazyPath(ctx, value, ctx.path, key)
|
1931
|
-
),
|
1898
|
+
value: catchall._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
|
1932
1899
|
alwaysSet: key in ctx.data
|
1933
1900
|
});
|
1934
1901
|
}
|
@@ -1987,14 +1954,8 @@ var require_types_cjs_development = __commonJS({
|
|
1987
1954
|
unknownKeys: "passthrough"
|
1988
1955
|
});
|
1989
1956
|
}
|
1990
|
-
|
1991
|
-
return
|
1992
|
-
...this._def,
|
1993
|
-
shape: () => ({
|
1994
|
-
...this._def.shape(),
|
1995
|
-
...augmentation
|
1996
|
-
})
|
1997
|
-
});
|
1957
|
+
setKey(key, schema) {
|
1958
|
+
return this.augment({ [key]: schema });
|
1998
1959
|
}
|
1999
1960
|
merge(merging) {
|
2000
1961
|
const merged = new ZodObject({
|
@@ -2005,9 +1966,6 @@ var require_types_cjs_development = __commonJS({
|
|
2005
1966
|
});
|
2006
1967
|
return merged;
|
2007
1968
|
}
|
2008
|
-
setKey(key, schema) {
|
2009
|
-
return this.augment({ [key]: schema });
|
2010
|
-
}
|
2011
1969
|
catchall(index) {
|
2012
1970
|
return new ZodObject({
|
2013
1971
|
...this._def,
|
@@ -2016,10 +1974,9 @@ var require_types_cjs_development = __commonJS({
|
|
2016
1974
|
}
|
2017
1975
|
pick(mask) {
|
2018
1976
|
const shape = {};
|
2019
|
-
util.objectKeys(mask).
|
2020
|
-
if (
|
1977
|
+
util.objectKeys(mask).map((key) => {
|
1978
|
+
if (this.shape[key])
|
2021
1979
|
shape[key] = this.shape[key];
|
2022
|
-
}
|
2023
1980
|
});
|
2024
1981
|
return new ZodObject({
|
2025
1982
|
...this._def,
|
@@ -2028,8 +1985,8 @@ var require_types_cjs_development = __commonJS({
|
|
2028
1985
|
}
|
2029
1986
|
omit(mask) {
|
2030
1987
|
const shape = {};
|
2031
|
-
util.objectKeys(this.shape).
|
2032
|
-
if (
|
1988
|
+
util.objectKeys(this.shape).map((key) => {
|
1989
|
+
if (util.objectKeys(mask).indexOf(key) === -1) {
|
2033
1990
|
shape[key] = this.shape[key];
|
2034
1991
|
}
|
2035
1992
|
});
|
@@ -2043,14 +2000,24 @@ var require_types_cjs_development = __commonJS({
|
|
2043
2000
|
}
|
2044
2001
|
partial(mask) {
|
2045
2002
|
const newShape = {};
|
2046
|
-
|
2047
|
-
|
2048
|
-
|
2049
|
-
|
2050
|
-
|
2003
|
+
if (mask) {
|
2004
|
+
util.objectKeys(this.shape).map((key) => {
|
2005
|
+
if (util.objectKeys(mask).indexOf(key) === -1) {
|
2006
|
+
newShape[key] = this.shape[key];
|
2007
|
+
} else {
|
2008
|
+
newShape[key] = this.shape[key].optional();
|
2009
|
+
}
|
2010
|
+
});
|
2011
|
+
return new ZodObject({
|
2012
|
+
...this._def,
|
2013
|
+
shape: () => newShape
|
2014
|
+
});
|
2015
|
+
} else {
|
2016
|
+
for (const key in this.shape) {
|
2017
|
+
const fieldSchema = this.shape[key];
|
2051
2018
|
newShape[key] = fieldSchema.optional();
|
2052
2019
|
}
|
2053
|
-
}
|
2020
|
+
}
|
2054
2021
|
return new ZodObject({
|
2055
2022
|
...this._def,
|
2056
2023
|
shape: () => newShape
|
@@ -2058,10 +2025,21 @@ var require_types_cjs_development = __commonJS({
|
|
2058
2025
|
}
|
2059
2026
|
required(mask) {
|
2060
2027
|
const newShape = {};
|
2061
|
-
|
2062
|
-
|
2063
|
-
|
2064
|
-
|
2028
|
+
if (mask) {
|
2029
|
+
util.objectKeys(this.shape).map((key) => {
|
2030
|
+
if (util.objectKeys(mask).indexOf(key) === -1) {
|
2031
|
+
newShape[key] = this.shape[key];
|
2032
|
+
} else {
|
2033
|
+
const fieldSchema = this.shape[key];
|
2034
|
+
let newField = fieldSchema;
|
2035
|
+
while (newField instanceof ZodOptional) {
|
2036
|
+
newField = newField._def.innerType;
|
2037
|
+
}
|
2038
|
+
newShape[key] = newField;
|
2039
|
+
}
|
2040
|
+
});
|
2041
|
+
} else {
|
2042
|
+
for (const key in this.shape) {
|
2065
2043
|
const fieldSchema = this.shape[key];
|
2066
2044
|
let newField = fieldSchema;
|
2067
2045
|
while (newField instanceof ZodOptional) {
|
@@ -2069,7 +2047,7 @@ var require_types_cjs_development = __commonJS({
|
|
2069
2047
|
}
|
2070
2048
|
newShape[key] = newField;
|
2071
2049
|
}
|
2072
|
-
}
|
2050
|
+
}
|
2073
2051
|
return new ZodObject({
|
2074
2052
|
...this._def,
|
2075
2053
|
shape: () => newShape
|
@@ -2417,7 +2395,7 @@ var require_types_cjs_development = __commonJS({
|
|
2417
2395
|
});
|
2418
2396
|
status.dirty();
|
2419
2397
|
}
|
2420
|
-
const items =
|
2398
|
+
const items = ctx.data.map((item, itemIndex) => {
|
2421
2399
|
const schema = this._def.items[itemIndex] || this._def.rest;
|
2422
2400
|
if (!schema)
|
2423
2401
|
return null;
|
@@ -2796,7 +2774,6 @@ var require_types_cjs_development = __commonJS({
|
|
2796
2774
|
if (input.data !== this._def.value) {
|
2797
2775
|
const ctx = this._getOrReturnCtx(input);
|
2798
2776
|
addIssueToContext(ctx, {
|
2799
|
-
received: ctx.data,
|
2800
2777
|
code: ZodIssueCode.invalid_literal,
|
2801
2778
|
expected: this._def.value
|
2802
2779
|
});
|
@@ -2873,12 +2850,6 @@ var require_types_cjs_development = __commonJS({
|
|
2873
2850
|
}
|
2874
2851
|
return enumValues;
|
2875
2852
|
}
|
2876
|
-
extract(values) {
|
2877
|
-
return ZodEnum.create(values);
|
2878
|
-
}
|
2879
|
-
exclude(values) {
|
2880
|
-
return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)));
|
2881
|
-
}
|
2882
2853
|
}, "ZodEnum");
|
2883
2854
|
__name2(ZodEnum, "ZodEnum");
|
2884
2855
|
ZodEnum.create = createZodEnum;
|
@@ -2919,9 +2890,6 @@ var require_types_cjs_development = __commonJS({
|
|
2919
2890
|
});
|
2920
2891
|
};
|
2921
2892
|
var ZodPromise = /* @__PURE__ */ __name(class extends ZodType {
|
2922
|
-
unwrap() {
|
2923
|
-
return this._def.type;
|
2924
|
-
}
|
2925
2893
|
_parse(input) {
|
2926
2894
|
const { ctx } = this._processInputParams(input);
|
2927
2895
|
if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
|
@@ -3140,29 +3108,23 @@ var require_types_cjs_development = __commonJS({
|
|
3140
3108
|
const result = this._def.innerType._parse({
|
3141
3109
|
data: ctx.data,
|
3142
3110
|
path: ctx.path,
|
3143
|
-
parent:
|
3144
|
-
...ctx,
|
3145
|
-
common: {
|
3146
|
-
...ctx.common,
|
3147
|
-
issues: []
|
3148
|
-
}
|
3149
|
-
}
|
3111
|
+
parent: ctx
|
3150
3112
|
});
|
3151
3113
|
if (isAsync(result)) {
|
3152
3114
|
return result.then((result2) => {
|
3153
3115
|
return {
|
3154
3116
|
status: "valid",
|
3155
|
-
value: result2.status === "valid" ? result2.value : this._def.
|
3117
|
+
value: result2.status === "valid" ? result2.value : this._def.defaultValue()
|
3156
3118
|
};
|
3157
3119
|
});
|
3158
3120
|
} else {
|
3159
3121
|
return {
|
3160
3122
|
status: "valid",
|
3161
|
-
value: result.status === "valid" ? result.value : this._def.
|
3123
|
+
value: result.status === "valid" ? result.value : this._def.defaultValue()
|
3162
3124
|
};
|
3163
3125
|
}
|
3164
3126
|
}
|
3165
|
-
|
3127
|
+
removeDefault() {
|
3166
3128
|
return this._def.innerType;
|
3167
3129
|
}
|
3168
3130
|
}, "ZodCatch");
|
@@ -3171,7 +3133,7 @@ var require_types_cjs_development = __commonJS({
|
|
3171
3133
|
return new ZodCatch({
|
3172
3134
|
innerType: type,
|
3173
3135
|
typeName: ZodFirstPartyTypeKind.ZodCatch,
|
3174
|
-
|
3136
|
+
defaultValue: typeof params.default === "function" ? params.default : () => params.default,
|
3175
3137
|
...processCreateParams(params)
|
3176
3138
|
});
|
3177
3139
|
};
|
@@ -3364,10 +3326,7 @@ var require_types_cjs_development = __commonJS({
|
|
3364
3326
|
var coerce = {
|
3365
3327
|
string: (arg) => ZodString.create({ ...arg, coerce: true }),
|
3366
3328
|
number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
|
3367
|
-
boolean: (arg) => ZodBoolean.create({
|
3368
|
-
...arg,
|
3369
|
-
coerce: true
|
3370
|
-
}),
|
3329
|
+
boolean: (arg) => ZodBoolean.create({ ...arg, coerce: true }),
|
3371
3330
|
bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
|
3372
3331
|
date: (arg) => ZodDate.create({ ...arg, coerce: true })
|
3373
3332
|
};
|
@@ -3491,13 +3450,11 @@ var require_types_cjs_development = __commonJS({
|
|
3491
3450
|
type: mod.string().optional(),
|
3492
3451
|
narrative: mod.string().optional()
|
3493
3452
|
});
|
3494
|
-
var ImageValidator = mod.string().or(
|
3495
|
-
mod.
|
3496
|
-
|
3497
|
-
|
3498
|
-
|
3499
|
-
})
|
3500
|
-
);
|
3453
|
+
var ImageValidator = mod.string().or(mod.object({
|
3454
|
+
id: mod.string(),
|
3455
|
+
type: mod.string(),
|
3456
|
+
caption: mod.string().optional()
|
3457
|
+
}));
|
3501
3458
|
var GeoCoordinatesValidator = mod.object({
|
3502
3459
|
type: mod.string().min(1).or(mod.string().array().nonempty()),
|
3503
3460
|
latitude: mod.number(),
|
@@ -3539,34 +3496,32 @@ var require_types_cjs_development = __commonJS({
|
|
3539
3496
|
identifier: mod.string(),
|
3540
3497
|
identifierType: IdentifierTypeValidator
|
3541
3498
|
});
|
3542
|
-
var ProfileValidator = mod.string().or(
|
3543
|
-
mod.
|
3544
|
-
|
3545
|
-
|
3546
|
-
|
3547
|
-
|
3548
|
-
|
3549
|
-
|
3550
|
-
|
3551
|
-
|
3552
|
-
|
3553
|
-
|
3554
|
-
|
3555
|
-
|
3556
|
-
|
3557
|
-
|
3558
|
-
|
3559
|
-
|
3560
|
-
|
3561
|
-
|
3562
|
-
|
3563
|
-
|
3564
|
-
|
3565
|
-
}).catchall(mod.any())
|
3566
|
-
);
|
3499
|
+
var ProfileValidator = mod.string().or(mod.object({
|
3500
|
+
id: mod.string().optional(),
|
3501
|
+
type: mod.string().or(mod.string().array().nonempty().optional()),
|
3502
|
+
name: mod.string().optional(),
|
3503
|
+
url: mod.string().optional(),
|
3504
|
+
phone: mod.string().optional(),
|
3505
|
+
description: mod.string().optional(),
|
3506
|
+
endorsement: mod.any().array().optional(),
|
3507
|
+
image: ImageValidator.optional(),
|
3508
|
+
email: mod.string().email().optional(),
|
3509
|
+
address: AddressValidator.optional(),
|
3510
|
+
otherIdentifier: IdentifierEntryValidator.array().optional(),
|
3511
|
+
official: mod.string().optional(),
|
3512
|
+
parentOrg: mod.any().optional(),
|
3513
|
+
familyName: mod.string().optional(),
|
3514
|
+
givenName: mod.string().optional(),
|
3515
|
+
additionalName: mod.string().optional(),
|
3516
|
+
patronymicName: mod.string().optional(),
|
3517
|
+
honorificPrefix: mod.string().optional(),
|
3518
|
+
honorificSuffix: mod.string().optional(),
|
3519
|
+
familyNamePrefix: mod.string().optional(),
|
3520
|
+
dateOfBirth: mod.string().optional()
|
3521
|
+
}).catchall(mod.any()));
|
3567
3522
|
var CredentialSubjectValidator = mod.object({ id: mod.string().optional() }).catchall(mod.any());
|
3568
|
-
var CredentialStatusValidator = mod.object({ type: mod.string(), id: mod.string() });
|
3569
|
-
var CredentialSchemaValidator = mod.object({ id: mod.string(), type: mod.string() });
|
3523
|
+
var CredentialStatusValidator = mod.object({ type: mod.string(), id: mod.string() }).catchall(mod.any());
|
3524
|
+
var CredentialSchemaValidator = mod.object({ id: mod.string(), type: mod.string() }).catchall(mod.any());
|
3570
3525
|
var RefreshServiceValidator = mod.object({ id: mod.string(), type: mod.string() }).catchall(mod.any());
|
3571
3526
|
var UnsignedVCValidator = mod.object({
|
3572
3527
|
"@context": ContextValidator,
|
@@ -3596,7 +3551,7 @@ var require_types_cjs_development = __commonJS({
|
|
3596
3551
|
var UnsignedVPValidator = mod.object({
|
3597
3552
|
"@context": ContextValidator,
|
3598
3553
|
id: mod.string().optional(),
|
3599
|
-
type: mod.string().array().nonempty(),
|
3554
|
+
type: mod.string().or(mod.string().array().nonempty()),
|
3600
3555
|
verifiableCredential: VCValidator.or(VCValidator.array()).optional(),
|
3601
3556
|
holder: mod.string().optional()
|
3602
3557
|
}).catchall(mod.any());
|