@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
package/dist/helpers.d.ts
CHANGED
package/dist/helpers.esm.js
CHANGED
@@ -16,10 +16,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
16
16
|
}
|
17
17
|
return to;
|
18
18
|
};
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
|
-
mod
|
22
|
-
));
|
19
|
+
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));
|
23
20
|
|
24
21
|
// ../learn-card-types/dist/types.cjs.development.js
|
25
22
|
var require_types_cjs_development = __commonJS({
|
@@ -549,7 +546,7 @@ var require_types_cjs_development = __commonJS({
|
|
549
546
|
var isAborted = /* @__PURE__ */ __name2((x) => x.status === "aborted", "isAborted");
|
550
547
|
var isDirty = /* @__PURE__ */ __name2((x) => x.status === "dirty", "isDirty");
|
551
548
|
var isValid = /* @__PURE__ */ __name2((x) => x.status === "valid", "isValid");
|
552
|
-
var isAsync = /* @__PURE__ */ __name2((x) => typeof Promise !==
|
549
|
+
var isAsync = /* @__PURE__ */ __name2((x) => typeof Promise !== void 0 && x instanceof Promise, "isAsync");
|
553
550
|
var errorUtil;
|
554
551
|
(function(errorUtil2) {
|
555
552
|
errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
@@ -768,29 +765,28 @@ var require_types_cjs_development = __commonJS({
|
|
768
765
|
return this._refinement(refinement);
|
769
766
|
}
|
770
767
|
optional() {
|
771
|
-
return ZodOptional.create(this
|
768
|
+
return ZodOptional.create(this);
|
772
769
|
}
|
773
770
|
nullable() {
|
774
|
-
return ZodNullable.create(this
|
771
|
+
return ZodNullable.create(this);
|
775
772
|
}
|
776
773
|
nullish() {
|
777
|
-
return this.
|
774
|
+
return this.optional().nullable();
|
778
775
|
}
|
779
776
|
array() {
|
780
|
-
return ZodArray.create(this
|
777
|
+
return ZodArray.create(this);
|
781
778
|
}
|
782
779
|
promise() {
|
783
|
-
return ZodPromise.create(this
|
780
|
+
return ZodPromise.create(this);
|
784
781
|
}
|
785
782
|
or(option) {
|
786
|
-
return ZodUnion.create([this, option]
|
783
|
+
return ZodUnion.create([this, option]);
|
787
784
|
}
|
788
785
|
and(incoming) {
|
789
|
-
return ZodIntersection.create(this, incoming
|
786
|
+
return ZodIntersection.create(this, incoming);
|
790
787
|
}
|
791
788
|
transform(transform) {
|
792
789
|
return new ZodEffects({
|
793
|
-
...processCreateParams(this._def),
|
794
790
|
schema: this,
|
795
791
|
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
796
792
|
effect: { type: "transform", transform }
|
@@ -799,7 +795,6 @@ var require_types_cjs_development = __commonJS({
|
|
799
795
|
default(def) {
|
800
796
|
const defaultValueFunc = typeof def === "function" ? def : () => def;
|
801
797
|
return new ZodDefault({
|
802
|
-
...processCreateParams(this._def),
|
803
798
|
innerType: this,
|
804
799
|
defaultValue: defaultValueFunc,
|
805
800
|
typeName: ZodFirstPartyTypeKind.ZodDefault
|
@@ -809,15 +804,14 @@ var require_types_cjs_development = __commonJS({
|
|
809
804
|
return new ZodBranded({
|
810
805
|
typeName: ZodFirstPartyTypeKind.ZodBranded,
|
811
806
|
type: this,
|
812
|
-
...processCreateParams(
|
807
|
+
...processCreateParams(void 0)
|
813
808
|
});
|
814
809
|
}
|
815
810
|
catch(def) {
|
816
|
-
const
|
811
|
+
const defaultValueFunc = typeof def === "function" ? def : () => def;
|
817
812
|
return new ZodCatch({
|
818
|
-
...processCreateParams(this._def),
|
819
813
|
innerType: this,
|
820
|
-
|
814
|
+
defaultValue: defaultValueFunc,
|
821
815
|
typeName: ZodFirstPartyTypeKind.ZodCatch
|
822
816
|
});
|
823
817
|
}
|
@@ -840,25 +834,24 @@ var require_types_cjs_development = __commonJS({
|
|
840
834
|
}, "ZodType");
|
841
835
|
__name2(ZodType, "ZodType");
|
842
836
|
var cuidRegex = /^c[^\s-]{8,}$/i;
|
843
|
-
var cuid2Regex = /^[a-z][a-z0-9]*$/;
|
844
837
|
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;
|
845
|
-
var emailRegex = /^(([^<>()[\]
|
838
|
+
var emailRegex = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;
|
846
839
|
var datetimeRegex = /* @__PURE__ */ __name2((args) => {
|
847
840
|
if (args.precision) {
|
848
841
|
if (args.offset) {
|
849
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}
|
842
|
+
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}:\\d{2})|Z)$`);
|
850
843
|
} else {
|
851
844
|
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
|
852
845
|
}
|
853
846
|
} else if (args.precision === 0) {
|
854
847
|
if (args.offset) {
|
855
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}
|
848
|
+
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$`);
|
856
849
|
} else {
|
857
850
|
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
|
858
851
|
}
|
859
852
|
} else {
|
860
853
|
if (args.offset) {
|
861
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}
|
854
|
+
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$`);
|
862
855
|
} else {
|
863
856
|
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
|
864
857
|
}
|
@@ -885,14 +878,11 @@ var require_types_cjs_development = __commonJS({
|
|
885
878
|
const parsedType = this._getType(input);
|
886
879
|
if (parsedType !== ZodParsedType.string) {
|
887
880
|
const ctx2 = this._getOrReturnCtx(input);
|
888
|
-
addIssueToContext(
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
received: ctx2.parsedType
|
894
|
-
}
|
895
|
-
);
|
881
|
+
addIssueToContext(ctx2, {
|
882
|
+
code: ZodIssueCode.invalid_type,
|
883
|
+
expected: ZodParsedType.string,
|
884
|
+
received: ctx2.parsedType
|
885
|
+
});
|
896
886
|
return INVALID;
|
897
887
|
}
|
898
888
|
const status = new ParseStatus();
|
@@ -980,16 +970,6 @@ var require_types_cjs_development = __commonJS({
|
|
980
970
|
});
|
981
971
|
status.dirty();
|
982
972
|
}
|
983
|
-
} else if (check.kind === "cuid2") {
|
984
|
-
if (!cuid2Regex.test(input.data)) {
|
985
|
-
ctx = this._getOrReturnCtx(input, ctx);
|
986
|
-
addIssueToContext(ctx, {
|
987
|
-
validation: "cuid2",
|
988
|
-
code: ZodIssueCode.invalid_string,
|
989
|
-
message: check.message
|
990
|
-
});
|
991
|
-
status.dirty();
|
992
|
-
}
|
993
973
|
} else if (check.kind === "url") {
|
994
974
|
try {
|
995
975
|
new URL(input.data);
|
@@ -1071,9 +1051,6 @@ var require_types_cjs_development = __commonJS({
|
|
1071
1051
|
cuid(message) {
|
1072
1052
|
return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
|
1073
1053
|
}
|
1074
|
-
cuid2(message) {
|
1075
|
-
return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
|
1076
|
-
}
|
1077
1054
|
datetime(options) {
|
1078
1055
|
var _a;
|
1079
1056
|
if (typeof options === "string") {
|
@@ -1148,9 +1125,6 @@ var require_types_cjs_development = __commonJS({
|
|
1148
1125
|
get isCUID() {
|
1149
1126
|
return !!this._def.checks.find((ch) => ch.kind === "cuid");
|
1150
1127
|
}
|
1151
|
-
get isCUID2() {
|
1152
|
-
return !!this._def.checks.find((ch) => ch.kind === "cuid2");
|
1153
|
-
}
|
1154
1128
|
get minLength() {
|
1155
1129
|
let min = null;
|
1156
1130
|
for (const ch of this._def.checks) {
|
@@ -1384,22 +1358,7 @@ var require_types_cjs_development = __commonJS({
|
|
1384
1358
|
return max;
|
1385
1359
|
}
|
1386
1360
|
get isInt() {
|
1387
|
-
return !!this._def.checks.find((ch) => ch.kind === "int"
|
1388
|
-
}
|
1389
|
-
get isFinite() {
|
1390
|
-
let max = null, min = null;
|
1391
|
-
for (const ch of this._def.checks) {
|
1392
|
-
if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
|
1393
|
-
return true;
|
1394
|
-
} else if (ch.kind === "min") {
|
1395
|
-
if (min === null || ch.value > min)
|
1396
|
-
min = ch.value;
|
1397
|
-
} else if (ch.kind === "max") {
|
1398
|
-
if (max === null || ch.value < max)
|
1399
|
-
max = ch.value;
|
1400
|
-
}
|
1401
|
-
}
|
1402
|
-
return Number.isFinite(min) && Number.isFinite(max);
|
1361
|
+
return !!this._def.checks.find((ch) => ch.kind === "int");
|
1403
1362
|
}
|
1404
1363
|
}, "ZodNumber");
|
1405
1364
|
__name2(ZodNumber, "ZodNumber");
|
@@ -1767,13 +1726,13 @@ var require_types_cjs_development = __commonJS({
|
|
1767
1726
|
}
|
1768
1727
|
}
|
1769
1728
|
if (ctx.common.async) {
|
1770
|
-
return Promise.all(
|
1729
|
+
return Promise.all(ctx.data.map((item, i) => {
|
1771
1730
|
return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
|
1772
1731
|
})).then((result2) => {
|
1773
1732
|
return ParseStatus.mergeArray(status, result2);
|
1774
1733
|
});
|
1775
1734
|
}
|
1776
|
-
const result =
|
1735
|
+
const result = ctx.data.map((item, i) => {
|
1777
1736
|
return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
|
1778
1737
|
});
|
1779
1738
|
return ParseStatus.mergeArray(status, result);
|
@@ -1823,6 +1782,15 @@ var require_types_cjs_development = __commonJS({
|
|
1823
1782
|
};
|
1824
1783
|
};
|
1825
1784
|
})(objectUtil || (objectUtil = {}));
|
1785
|
+
var AugmentFactory = /* @__PURE__ */ __name2((def) => (augmentation) => {
|
1786
|
+
return new ZodObject({
|
1787
|
+
...def,
|
1788
|
+
shape: () => ({
|
1789
|
+
...def.shape(),
|
1790
|
+
...augmentation
|
1791
|
+
})
|
1792
|
+
});
|
1793
|
+
}, "AugmentFactory");
|
1826
1794
|
function deepPartialify(schema) {
|
1827
1795
|
if (schema instanceof ZodObject) {
|
1828
1796
|
const newShape = {};
|
@@ -1853,7 +1821,8 @@ var require_types_cjs_development = __commonJS({
|
|
1853
1821
|
super(...arguments);
|
1854
1822
|
this._cached = null;
|
1855
1823
|
this.nonstrict = this.passthrough;
|
1856
|
-
this.augment = this.
|
1824
|
+
this.augment = AugmentFactory(this._def);
|
1825
|
+
this.extend = AugmentFactory(this._def);
|
1857
1826
|
}
|
1858
1827
|
_getCached() {
|
1859
1828
|
if (this._cached !== null)
|
@@ -1921,9 +1890,7 @@ var require_types_cjs_development = __commonJS({
|
|
1921
1890
|
const value = ctx.data[key];
|
1922
1891
|
pairs.push({
|
1923
1892
|
key: { status: "valid", value: key },
|
1924
|
-
value: catchall._parse(
|
1925
|
-
new ParseInputLazyPath(ctx, value, ctx.path, key)
|
1926
|
-
),
|
1893
|
+
value: catchall._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
|
1927
1894
|
alwaysSet: key in ctx.data
|
1928
1895
|
});
|
1929
1896
|
}
|
@@ -1982,14 +1949,8 @@ var require_types_cjs_development = __commonJS({
|
|
1982
1949
|
unknownKeys: "passthrough"
|
1983
1950
|
});
|
1984
1951
|
}
|
1985
|
-
|
1986
|
-
return
|
1987
|
-
...this._def,
|
1988
|
-
shape: () => ({
|
1989
|
-
...this._def.shape(),
|
1990
|
-
...augmentation
|
1991
|
-
})
|
1992
|
-
});
|
1952
|
+
setKey(key, schema) {
|
1953
|
+
return this.augment({ [key]: schema });
|
1993
1954
|
}
|
1994
1955
|
merge(merging) {
|
1995
1956
|
const merged = new ZodObject({
|
@@ -2000,9 +1961,6 @@ var require_types_cjs_development = __commonJS({
|
|
2000
1961
|
});
|
2001
1962
|
return merged;
|
2002
1963
|
}
|
2003
|
-
setKey(key, schema) {
|
2004
|
-
return this.augment({ [key]: schema });
|
2005
|
-
}
|
2006
1964
|
catchall(index) {
|
2007
1965
|
return new ZodObject({
|
2008
1966
|
...this._def,
|
@@ -2011,10 +1969,9 @@ var require_types_cjs_development = __commonJS({
|
|
2011
1969
|
}
|
2012
1970
|
pick(mask) {
|
2013
1971
|
const shape = {};
|
2014
|
-
util.objectKeys(mask).
|
2015
|
-
if (
|
1972
|
+
util.objectKeys(mask).map((key) => {
|
1973
|
+
if (this.shape[key])
|
2016
1974
|
shape[key] = this.shape[key];
|
2017
|
-
}
|
2018
1975
|
});
|
2019
1976
|
return new ZodObject({
|
2020
1977
|
...this._def,
|
@@ -2023,8 +1980,8 @@ var require_types_cjs_development = __commonJS({
|
|
2023
1980
|
}
|
2024
1981
|
omit(mask) {
|
2025
1982
|
const shape = {};
|
2026
|
-
util.objectKeys(this.shape).
|
2027
|
-
if (
|
1983
|
+
util.objectKeys(this.shape).map((key) => {
|
1984
|
+
if (util.objectKeys(mask).indexOf(key) === -1) {
|
2028
1985
|
shape[key] = this.shape[key];
|
2029
1986
|
}
|
2030
1987
|
});
|
@@ -2038,14 +1995,24 @@ var require_types_cjs_development = __commonJS({
|
|
2038
1995
|
}
|
2039
1996
|
partial(mask) {
|
2040
1997
|
const newShape = {};
|
2041
|
-
|
2042
|
-
|
2043
|
-
|
2044
|
-
|
2045
|
-
|
1998
|
+
if (mask) {
|
1999
|
+
util.objectKeys(this.shape).map((key) => {
|
2000
|
+
if (util.objectKeys(mask).indexOf(key) === -1) {
|
2001
|
+
newShape[key] = this.shape[key];
|
2002
|
+
} else {
|
2003
|
+
newShape[key] = this.shape[key].optional();
|
2004
|
+
}
|
2005
|
+
});
|
2006
|
+
return new ZodObject({
|
2007
|
+
...this._def,
|
2008
|
+
shape: () => newShape
|
2009
|
+
});
|
2010
|
+
} else {
|
2011
|
+
for (const key in this.shape) {
|
2012
|
+
const fieldSchema = this.shape[key];
|
2046
2013
|
newShape[key] = fieldSchema.optional();
|
2047
2014
|
}
|
2048
|
-
}
|
2015
|
+
}
|
2049
2016
|
return new ZodObject({
|
2050
2017
|
...this._def,
|
2051
2018
|
shape: () => newShape
|
@@ -2053,10 +2020,21 @@ var require_types_cjs_development = __commonJS({
|
|
2053
2020
|
}
|
2054
2021
|
required(mask) {
|
2055
2022
|
const newShape = {};
|
2056
|
-
|
2057
|
-
|
2058
|
-
|
2059
|
-
|
2023
|
+
if (mask) {
|
2024
|
+
util.objectKeys(this.shape).map((key) => {
|
2025
|
+
if (util.objectKeys(mask).indexOf(key) === -1) {
|
2026
|
+
newShape[key] = this.shape[key];
|
2027
|
+
} else {
|
2028
|
+
const fieldSchema = this.shape[key];
|
2029
|
+
let newField = fieldSchema;
|
2030
|
+
while (newField instanceof ZodOptional) {
|
2031
|
+
newField = newField._def.innerType;
|
2032
|
+
}
|
2033
|
+
newShape[key] = newField;
|
2034
|
+
}
|
2035
|
+
});
|
2036
|
+
} else {
|
2037
|
+
for (const key in this.shape) {
|
2060
2038
|
const fieldSchema = this.shape[key];
|
2061
2039
|
let newField = fieldSchema;
|
2062
2040
|
while (newField instanceof ZodOptional) {
|
@@ -2064,7 +2042,7 @@ var require_types_cjs_development = __commonJS({
|
|
2064
2042
|
}
|
2065
2043
|
newShape[key] = newField;
|
2066
2044
|
}
|
2067
|
-
}
|
2045
|
+
}
|
2068
2046
|
return new ZodObject({
|
2069
2047
|
...this._def,
|
2070
2048
|
shape: () => newShape
|
@@ -2412,7 +2390,7 @@ var require_types_cjs_development = __commonJS({
|
|
2412
2390
|
});
|
2413
2391
|
status.dirty();
|
2414
2392
|
}
|
2415
|
-
const items =
|
2393
|
+
const items = ctx.data.map((item, itemIndex) => {
|
2416
2394
|
const schema = this._def.items[itemIndex] || this._def.rest;
|
2417
2395
|
if (!schema)
|
2418
2396
|
return null;
|
@@ -2791,7 +2769,6 @@ var require_types_cjs_development = __commonJS({
|
|
2791
2769
|
if (input.data !== this._def.value) {
|
2792
2770
|
const ctx = this._getOrReturnCtx(input);
|
2793
2771
|
addIssueToContext(ctx, {
|
2794
|
-
received: ctx.data,
|
2795
2772
|
code: ZodIssueCode.invalid_literal,
|
2796
2773
|
expected: this._def.value
|
2797
2774
|
});
|
@@ -2868,12 +2845,6 @@ var require_types_cjs_development = __commonJS({
|
|
2868
2845
|
}
|
2869
2846
|
return enumValues;
|
2870
2847
|
}
|
2871
|
-
extract(values) {
|
2872
|
-
return ZodEnum.create(values);
|
2873
|
-
}
|
2874
|
-
exclude(values) {
|
2875
|
-
return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)));
|
2876
|
-
}
|
2877
2848
|
}, "ZodEnum");
|
2878
2849
|
__name2(ZodEnum, "ZodEnum");
|
2879
2850
|
ZodEnum.create = createZodEnum;
|
@@ -2914,9 +2885,6 @@ var require_types_cjs_development = __commonJS({
|
|
2914
2885
|
});
|
2915
2886
|
};
|
2916
2887
|
var ZodPromise = /* @__PURE__ */ __name(class extends ZodType {
|
2917
|
-
unwrap() {
|
2918
|
-
return this._def.type;
|
2919
|
-
}
|
2920
2888
|
_parse(input) {
|
2921
2889
|
const { ctx } = this._processInputParams(input);
|
2922
2890
|
if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
|
@@ -3135,29 +3103,23 @@ var require_types_cjs_development = __commonJS({
|
|
3135
3103
|
const result = this._def.innerType._parse({
|
3136
3104
|
data: ctx.data,
|
3137
3105
|
path: ctx.path,
|
3138
|
-
parent:
|
3139
|
-
...ctx,
|
3140
|
-
common: {
|
3141
|
-
...ctx.common,
|
3142
|
-
issues: []
|
3143
|
-
}
|
3144
|
-
}
|
3106
|
+
parent: ctx
|
3145
3107
|
});
|
3146
3108
|
if (isAsync(result)) {
|
3147
3109
|
return result.then((result2) => {
|
3148
3110
|
return {
|
3149
3111
|
status: "valid",
|
3150
|
-
value: result2.status === "valid" ? result2.value : this._def.
|
3112
|
+
value: result2.status === "valid" ? result2.value : this._def.defaultValue()
|
3151
3113
|
};
|
3152
3114
|
});
|
3153
3115
|
} else {
|
3154
3116
|
return {
|
3155
3117
|
status: "valid",
|
3156
|
-
value: result.status === "valid" ? result.value : this._def.
|
3118
|
+
value: result.status === "valid" ? result.value : this._def.defaultValue()
|
3157
3119
|
};
|
3158
3120
|
}
|
3159
3121
|
}
|
3160
|
-
|
3122
|
+
removeDefault() {
|
3161
3123
|
return this._def.innerType;
|
3162
3124
|
}
|
3163
3125
|
}, "ZodCatch");
|
@@ -3166,7 +3128,7 @@ var require_types_cjs_development = __commonJS({
|
|
3166
3128
|
return new ZodCatch({
|
3167
3129
|
innerType: type,
|
3168
3130
|
typeName: ZodFirstPartyTypeKind.ZodCatch,
|
3169
|
-
|
3131
|
+
defaultValue: typeof params.default === "function" ? params.default : () => params.default,
|
3170
3132
|
...processCreateParams(params)
|
3171
3133
|
});
|
3172
3134
|
};
|
@@ -3359,10 +3321,7 @@ var require_types_cjs_development = __commonJS({
|
|
3359
3321
|
var coerce = {
|
3360
3322
|
string: (arg) => ZodString.create({ ...arg, coerce: true }),
|
3361
3323
|
number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
|
3362
|
-
boolean: (arg) => ZodBoolean.create({
|
3363
|
-
...arg,
|
3364
|
-
coerce: true
|
3365
|
-
}),
|
3324
|
+
boolean: (arg) => ZodBoolean.create({ ...arg, coerce: true }),
|
3366
3325
|
bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
|
3367
3326
|
date: (arg) => ZodDate.create({ ...arg, coerce: true })
|
3368
3327
|
};
|
@@ -3486,13 +3445,11 @@ var require_types_cjs_development = __commonJS({
|
|
3486
3445
|
type: mod.string().optional(),
|
3487
3446
|
narrative: mod.string().optional()
|
3488
3447
|
});
|
3489
|
-
var ImageValidator = mod.string().or(
|
3490
|
-
mod.
|
3491
|
-
|
3492
|
-
|
3493
|
-
|
3494
|
-
})
|
3495
|
-
);
|
3448
|
+
var ImageValidator = mod.string().or(mod.object({
|
3449
|
+
id: mod.string(),
|
3450
|
+
type: mod.string(),
|
3451
|
+
caption: mod.string().optional()
|
3452
|
+
}));
|
3496
3453
|
var GeoCoordinatesValidator = mod.object({
|
3497
3454
|
type: mod.string().min(1).or(mod.string().array().nonempty()),
|
3498
3455
|
latitude: mod.number(),
|
@@ -3534,34 +3491,32 @@ var require_types_cjs_development = __commonJS({
|
|
3534
3491
|
identifier: mod.string(),
|
3535
3492
|
identifierType: IdentifierTypeValidator
|
3536
3493
|
});
|
3537
|
-
var ProfileValidator = mod.string().or(
|
3538
|
-
mod.
|
3539
|
-
|
3540
|
-
|
3541
|
-
|
3542
|
-
|
3543
|
-
|
3544
|
-
|
3545
|
-
|
3546
|
-
|
3547
|
-
|
3548
|
-
|
3549
|
-
|
3550
|
-
|
3551
|
-
|
3552
|
-
|
3553
|
-
|
3554
|
-
|
3555
|
-
|
3556
|
-
|
3557
|
-
|
3558
|
-
|
3559
|
-
|
3560
|
-
}).catchall(mod.any())
|
3561
|
-
);
|
3494
|
+
var ProfileValidator = mod.string().or(mod.object({
|
3495
|
+
id: mod.string().optional(),
|
3496
|
+
type: mod.string().or(mod.string().array().nonempty().optional()),
|
3497
|
+
name: mod.string().optional(),
|
3498
|
+
url: mod.string().optional(),
|
3499
|
+
phone: mod.string().optional(),
|
3500
|
+
description: mod.string().optional(),
|
3501
|
+
endorsement: mod.any().array().optional(),
|
3502
|
+
image: ImageValidator.optional(),
|
3503
|
+
email: mod.string().email().optional(),
|
3504
|
+
address: AddressValidator.optional(),
|
3505
|
+
otherIdentifier: IdentifierEntryValidator.array().optional(),
|
3506
|
+
official: mod.string().optional(),
|
3507
|
+
parentOrg: mod.any().optional(),
|
3508
|
+
familyName: mod.string().optional(),
|
3509
|
+
givenName: mod.string().optional(),
|
3510
|
+
additionalName: mod.string().optional(),
|
3511
|
+
patronymicName: mod.string().optional(),
|
3512
|
+
honorificPrefix: mod.string().optional(),
|
3513
|
+
honorificSuffix: mod.string().optional(),
|
3514
|
+
familyNamePrefix: mod.string().optional(),
|
3515
|
+
dateOfBirth: mod.string().optional()
|
3516
|
+
}).catchall(mod.any()));
|
3562
3517
|
var CredentialSubjectValidator = mod.object({ id: mod.string().optional() }).catchall(mod.any());
|
3563
|
-
var CredentialStatusValidator = mod.object({ type: mod.string(), id: mod.string() });
|
3564
|
-
var CredentialSchemaValidator = mod.object({ id: mod.string(), type: mod.string() });
|
3518
|
+
var CredentialStatusValidator = mod.object({ type: mod.string(), id: mod.string() }).catchall(mod.any());
|
3519
|
+
var CredentialSchemaValidator = mod.object({ id: mod.string(), type: mod.string() }).catchall(mod.any());
|
3565
3520
|
var RefreshServiceValidator = mod.object({ id: mod.string(), type: mod.string() }).catchall(mod.any());
|
3566
3521
|
var UnsignedVCValidator = mod.object({
|
3567
3522
|
"@context": ContextValidator,
|
@@ -3591,7 +3546,7 @@ var require_types_cjs_development = __commonJS({
|
|
3591
3546
|
var UnsignedVPValidator = mod.object({
|
3592
3547
|
"@context": ContextValidator,
|
3593
3548
|
id: mod.string().optional(),
|
3594
|
-
type: mod.string().array().nonempty(),
|
3549
|
+
type: mod.string().or(mod.string().array().nonempty()),
|
3595
3550
|
verifiableCredential: VCValidator.or(VCValidator.array()).optional(),
|
3596
3551
|
holder: mod.string().optional()
|
3597
3552
|
}).catchall(mod.any());
|