@learncard/didkey-plugin 1.0.2 → 1.0.3
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/didkey-plugin.cjs.development.js +112 -164
- package/dist/didkey-plugin.cjs.development.js.map +3 -3
- package/dist/didkey-plugin.cjs.production.min.js +1 -1
- package/dist/didkey-plugin.cjs.production.min.js.map +3 -3
- package/dist/didkey-plugin.esm.js +112 -163
- package/dist/didkey-plugin.esm.js.map +3 -3
- package/package.json +3 -3
@@ -33,10 +33,7 @@ var __copyProps = /* @__PURE__ */ __name((to, from, except, desc) => {
|
|
33
33
|
}
|
34
34
|
return to;
|
35
35
|
}, "__copyProps");
|
36
|
-
var __toESM = /* @__PURE__ */ __name((mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
37
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
|
38
|
-
mod
|
39
|
-
)), "__toESM");
|
36
|
+
var __toESM = /* @__PURE__ */ __name((mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target, mod)), "__toESM");
|
40
37
|
var require_types_cjs_development = __commonJS({
|
41
38
|
"../learn-card-types/dist/types.cjs.development.js"(exports, module) {
|
42
39
|
"use strict";
|
@@ -570,7 +567,7 @@ var require_types_cjs_development = __commonJS({
|
|
570
567
|
var isAborted = /* @__PURE__ */ __name22((x) => x.status === "aborted", "isAborted");
|
571
568
|
var isDirty = /* @__PURE__ */ __name22((x) => x.status === "dirty", "isDirty");
|
572
569
|
var isValid = /* @__PURE__ */ __name22((x) => x.status === "valid", "isValid");
|
573
|
-
var isAsync = /* @__PURE__ */ __name22((x) => typeof Promise !==
|
570
|
+
var isAsync = /* @__PURE__ */ __name22((x) => typeof Promise !== void 0 && x instanceof Promise, "isAsync");
|
574
571
|
var errorUtil;
|
575
572
|
(function(errorUtil2) {
|
576
573
|
errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
@@ -790,29 +787,28 @@ var require_types_cjs_development = __commonJS({
|
|
790
787
|
return this._refinement(refinement);
|
791
788
|
}
|
792
789
|
optional() {
|
793
|
-
return ZodOptional.create(this
|
790
|
+
return ZodOptional.create(this);
|
794
791
|
}
|
795
792
|
nullable() {
|
796
|
-
return ZodNullable.create(this
|
793
|
+
return ZodNullable.create(this);
|
797
794
|
}
|
798
795
|
nullish() {
|
799
|
-
return this.
|
796
|
+
return this.optional().nullable();
|
800
797
|
}
|
801
798
|
array() {
|
802
|
-
return ZodArray.create(this
|
799
|
+
return ZodArray.create(this);
|
803
800
|
}
|
804
801
|
promise() {
|
805
|
-
return ZodPromise.create(this
|
802
|
+
return ZodPromise.create(this);
|
806
803
|
}
|
807
804
|
or(option) {
|
808
|
-
return ZodUnion.create([this, option]
|
805
|
+
return ZodUnion.create([this, option]);
|
809
806
|
}
|
810
807
|
and(incoming) {
|
811
|
-
return ZodIntersection.create(this, incoming
|
808
|
+
return ZodIntersection.create(this, incoming);
|
812
809
|
}
|
813
810
|
transform(transform) {
|
814
811
|
return new ZodEffects({
|
815
|
-
...processCreateParams(this._def),
|
816
812
|
schema: this,
|
817
813
|
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
818
814
|
effect: { type: "transform", transform }
|
@@ -821,7 +817,6 @@ var require_types_cjs_development = __commonJS({
|
|
821
817
|
default(def) {
|
822
818
|
const defaultValueFunc = typeof def === "function" ? def : () => def;
|
823
819
|
return new ZodDefault({
|
824
|
-
...processCreateParams(this._def),
|
825
820
|
innerType: this,
|
826
821
|
defaultValue: defaultValueFunc,
|
827
822
|
typeName: ZodFirstPartyTypeKind.ZodDefault
|
@@ -831,15 +826,14 @@ var require_types_cjs_development = __commonJS({
|
|
831
826
|
return new ZodBranded({
|
832
827
|
typeName: ZodFirstPartyTypeKind.ZodBranded,
|
833
828
|
type: this,
|
834
|
-
...processCreateParams(
|
829
|
+
...processCreateParams(void 0)
|
835
830
|
});
|
836
831
|
}
|
837
832
|
catch(def) {
|
838
|
-
const
|
833
|
+
const defaultValueFunc = typeof def === "function" ? def : () => def;
|
839
834
|
return new ZodCatch({
|
840
|
-
...processCreateParams(this._def),
|
841
835
|
innerType: this,
|
842
|
-
|
836
|
+
defaultValue: defaultValueFunc,
|
843
837
|
typeName: ZodFirstPartyTypeKind.ZodCatch
|
844
838
|
});
|
845
839
|
}
|
@@ -862,25 +856,24 @@ var require_types_cjs_development = __commonJS({
|
|
862
856
|
}, "ZodType");
|
863
857
|
__name22(ZodType, "ZodType");
|
864
858
|
var cuidRegex = /^c[^\s-]{8,}$/i;
|
865
|
-
var cuid2Regex = /^[a-z][a-z0-9]*$/;
|
866
859
|
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;
|
867
|
-
var emailRegex = /^(([^<>()[\]
|
860
|
+
var emailRegex = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;
|
868
861
|
var datetimeRegex = /* @__PURE__ */ __name22((args) => {
|
869
862
|
if (args.precision) {
|
870
863
|
if (args.offset) {
|
871
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}
|
864
|
+
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}:\\d{2})|Z)$`);
|
872
865
|
} else {
|
873
866
|
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
|
874
867
|
}
|
875
868
|
} else if (args.precision === 0) {
|
876
869
|
if (args.offset) {
|
877
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}
|
870
|
+
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$`);
|
878
871
|
} else {
|
879
872
|
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
|
880
873
|
}
|
881
874
|
} else {
|
882
875
|
if (args.offset) {
|
883
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}
|
876
|
+
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$`);
|
884
877
|
} else {
|
885
878
|
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
|
886
879
|
}
|
@@ -907,14 +900,11 @@ var require_types_cjs_development = __commonJS({
|
|
907
900
|
const parsedType = this._getType(input);
|
908
901
|
if (parsedType !== ZodParsedType.string) {
|
909
902
|
const ctx2 = this._getOrReturnCtx(input);
|
910
|
-
addIssueToContext(
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
received: ctx2.parsedType
|
916
|
-
}
|
917
|
-
);
|
903
|
+
addIssueToContext(ctx2, {
|
904
|
+
code: ZodIssueCode.invalid_type,
|
905
|
+
expected: ZodParsedType.string,
|
906
|
+
received: ctx2.parsedType
|
907
|
+
});
|
918
908
|
return INVALID;
|
919
909
|
}
|
920
910
|
const status = new ParseStatus();
|
@@ -1002,16 +992,6 @@ var require_types_cjs_development = __commonJS({
|
|
1002
992
|
});
|
1003
993
|
status.dirty();
|
1004
994
|
}
|
1005
|
-
} else if (check.kind === "cuid2") {
|
1006
|
-
if (!cuid2Regex.test(input.data)) {
|
1007
|
-
ctx = this._getOrReturnCtx(input, ctx);
|
1008
|
-
addIssueToContext(ctx, {
|
1009
|
-
validation: "cuid2",
|
1010
|
-
code: ZodIssueCode.invalid_string,
|
1011
|
-
message: check.message
|
1012
|
-
});
|
1013
|
-
status.dirty();
|
1014
|
-
}
|
1015
995
|
} else if (check.kind === "url") {
|
1016
996
|
try {
|
1017
997
|
new URL(input.data);
|
@@ -1093,9 +1073,6 @@ var require_types_cjs_development = __commonJS({
|
|
1093
1073
|
cuid(message) {
|
1094
1074
|
return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
|
1095
1075
|
}
|
1096
|
-
cuid2(message) {
|
1097
|
-
return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
|
1098
|
-
}
|
1099
1076
|
datetime(options) {
|
1100
1077
|
var _a;
|
1101
1078
|
if (typeof options === "string") {
|
@@ -1170,9 +1147,6 @@ var require_types_cjs_development = __commonJS({
|
|
1170
1147
|
get isCUID() {
|
1171
1148
|
return !!this._def.checks.find((ch) => ch.kind === "cuid");
|
1172
1149
|
}
|
1173
|
-
get isCUID2() {
|
1174
|
-
return !!this._def.checks.find((ch) => ch.kind === "cuid2");
|
1175
|
-
}
|
1176
1150
|
get minLength() {
|
1177
1151
|
let min = null;
|
1178
1152
|
for (const ch of this._def.checks) {
|
@@ -1407,22 +1381,7 @@ var require_types_cjs_development = __commonJS({
|
|
1407
1381
|
return max;
|
1408
1382
|
}
|
1409
1383
|
get isInt() {
|
1410
|
-
return !!this._def.checks.find((ch) => ch.kind === "int"
|
1411
|
-
}
|
1412
|
-
get isFinite() {
|
1413
|
-
let max = null, min = null;
|
1414
|
-
for (const ch of this._def.checks) {
|
1415
|
-
if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
|
1416
|
-
return true;
|
1417
|
-
} else if (ch.kind === "min") {
|
1418
|
-
if (min === null || ch.value > min)
|
1419
|
-
min = ch.value;
|
1420
|
-
} else if (ch.kind === "max") {
|
1421
|
-
if (max === null || ch.value < max)
|
1422
|
-
max = ch.value;
|
1423
|
-
}
|
1424
|
-
}
|
1425
|
-
return Number.isFinite(min) && Number.isFinite(max);
|
1384
|
+
return !!this._def.checks.find((ch) => ch.kind === "int");
|
1426
1385
|
}
|
1427
1386
|
}, "ZodNumber");
|
1428
1387
|
__name22(ZodNumber, "ZodNumber");
|
@@ -1790,13 +1749,13 @@ var require_types_cjs_development = __commonJS({
|
|
1790
1749
|
}
|
1791
1750
|
}
|
1792
1751
|
if (ctx.common.async) {
|
1793
|
-
return Promise.all(
|
1752
|
+
return Promise.all(ctx.data.map((item, i) => {
|
1794
1753
|
return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
|
1795
1754
|
})).then((result2) => {
|
1796
1755
|
return ParseStatus.mergeArray(status, result2);
|
1797
1756
|
});
|
1798
1757
|
}
|
1799
|
-
const result =
|
1758
|
+
const result = ctx.data.map((item, i) => {
|
1800
1759
|
return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
|
1801
1760
|
});
|
1802
1761
|
return ParseStatus.mergeArray(status, result);
|
@@ -1846,6 +1805,15 @@ var require_types_cjs_development = __commonJS({
|
|
1846
1805
|
};
|
1847
1806
|
};
|
1848
1807
|
})(objectUtil || (objectUtil = {}));
|
1808
|
+
var AugmentFactory = /* @__PURE__ */ __name22((def) => (augmentation) => {
|
1809
|
+
return new ZodObject({
|
1810
|
+
...def,
|
1811
|
+
shape: () => ({
|
1812
|
+
...def.shape(),
|
1813
|
+
...augmentation
|
1814
|
+
})
|
1815
|
+
});
|
1816
|
+
}, "AugmentFactory");
|
1849
1817
|
function deepPartialify(schema) {
|
1850
1818
|
if (schema instanceof ZodObject) {
|
1851
1819
|
const newShape = {};
|
@@ -1877,7 +1845,8 @@ var require_types_cjs_development = __commonJS({
|
|
1877
1845
|
super(...arguments);
|
1878
1846
|
this._cached = null;
|
1879
1847
|
this.nonstrict = this.passthrough;
|
1880
|
-
this.augment = this.
|
1848
|
+
this.augment = AugmentFactory(this._def);
|
1849
|
+
this.extend = AugmentFactory(this._def);
|
1881
1850
|
}
|
1882
1851
|
_getCached() {
|
1883
1852
|
if (this._cached !== null)
|
@@ -1945,9 +1914,7 @@ var require_types_cjs_development = __commonJS({
|
|
1945
1914
|
const value = ctx.data[key];
|
1946
1915
|
pairs.push({
|
1947
1916
|
key: { status: "valid", value: key },
|
1948
|
-
value: catchall._parse(
|
1949
|
-
new ParseInputLazyPath(ctx, value, ctx.path, key)
|
1950
|
-
),
|
1917
|
+
value: catchall._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
|
1951
1918
|
alwaysSet: key in ctx.data
|
1952
1919
|
});
|
1953
1920
|
}
|
@@ -2006,14 +1973,8 @@ var require_types_cjs_development = __commonJS({
|
|
2006
1973
|
unknownKeys: "passthrough"
|
2007
1974
|
});
|
2008
1975
|
}
|
2009
|
-
|
2010
|
-
return
|
2011
|
-
...this._def,
|
2012
|
-
shape: () => ({
|
2013
|
-
...this._def.shape(),
|
2014
|
-
...augmentation
|
2015
|
-
})
|
2016
|
-
});
|
1976
|
+
setKey(key, schema) {
|
1977
|
+
return this.augment({ [key]: schema });
|
2017
1978
|
}
|
2018
1979
|
merge(merging) {
|
2019
1980
|
const merged = new ZodObject({
|
@@ -2024,9 +1985,6 @@ var require_types_cjs_development = __commonJS({
|
|
2024
1985
|
});
|
2025
1986
|
return merged;
|
2026
1987
|
}
|
2027
|
-
setKey(key, schema) {
|
2028
|
-
return this.augment({ [key]: schema });
|
2029
|
-
}
|
2030
1988
|
catchall(index) {
|
2031
1989
|
return new ZodObject({
|
2032
1990
|
...this._def,
|
@@ -2035,10 +1993,9 @@ var require_types_cjs_development = __commonJS({
|
|
2035
1993
|
}
|
2036
1994
|
pick(mask) {
|
2037
1995
|
const shape = {};
|
2038
|
-
util.objectKeys(mask).
|
2039
|
-
if (
|
1996
|
+
util.objectKeys(mask).map((key) => {
|
1997
|
+
if (this.shape[key])
|
2040
1998
|
shape[key] = this.shape[key];
|
2041
|
-
}
|
2042
1999
|
});
|
2043
2000
|
return new ZodObject({
|
2044
2001
|
...this._def,
|
@@ -2047,8 +2004,8 @@ var require_types_cjs_development = __commonJS({
|
|
2047
2004
|
}
|
2048
2005
|
omit(mask) {
|
2049
2006
|
const shape = {};
|
2050
|
-
util.objectKeys(this.shape).
|
2051
|
-
if (
|
2007
|
+
util.objectKeys(this.shape).map((key) => {
|
2008
|
+
if (util.objectKeys(mask).indexOf(key) === -1) {
|
2052
2009
|
shape[key] = this.shape[key];
|
2053
2010
|
}
|
2054
2011
|
});
|
@@ -2062,14 +2019,24 @@ var require_types_cjs_development = __commonJS({
|
|
2062
2019
|
}
|
2063
2020
|
partial(mask) {
|
2064
2021
|
const newShape = {};
|
2065
|
-
|
2066
|
-
|
2067
|
-
|
2068
|
-
|
2069
|
-
|
2022
|
+
if (mask) {
|
2023
|
+
util.objectKeys(this.shape).map((key) => {
|
2024
|
+
if (util.objectKeys(mask).indexOf(key) === -1) {
|
2025
|
+
newShape[key] = this.shape[key];
|
2026
|
+
} else {
|
2027
|
+
newShape[key] = this.shape[key].optional();
|
2028
|
+
}
|
2029
|
+
});
|
2030
|
+
return new ZodObject({
|
2031
|
+
...this._def,
|
2032
|
+
shape: () => newShape
|
2033
|
+
});
|
2034
|
+
} else {
|
2035
|
+
for (const key in this.shape) {
|
2036
|
+
const fieldSchema = this.shape[key];
|
2070
2037
|
newShape[key] = fieldSchema.optional();
|
2071
2038
|
}
|
2072
|
-
}
|
2039
|
+
}
|
2073
2040
|
return new ZodObject({
|
2074
2041
|
...this._def,
|
2075
2042
|
shape: () => newShape
|
@@ -2077,10 +2044,21 @@ var require_types_cjs_development = __commonJS({
|
|
2077
2044
|
}
|
2078
2045
|
required(mask) {
|
2079
2046
|
const newShape = {};
|
2080
|
-
|
2081
|
-
|
2082
|
-
|
2083
|
-
|
2047
|
+
if (mask) {
|
2048
|
+
util.objectKeys(this.shape).map((key) => {
|
2049
|
+
if (util.objectKeys(mask).indexOf(key) === -1) {
|
2050
|
+
newShape[key] = this.shape[key];
|
2051
|
+
} else {
|
2052
|
+
const fieldSchema = this.shape[key];
|
2053
|
+
let newField = fieldSchema;
|
2054
|
+
while (newField instanceof ZodOptional) {
|
2055
|
+
newField = newField._def.innerType;
|
2056
|
+
}
|
2057
|
+
newShape[key] = newField;
|
2058
|
+
}
|
2059
|
+
});
|
2060
|
+
} else {
|
2061
|
+
for (const key in this.shape) {
|
2084
2062
|
const fieldSchema = this.shape[key];
|
2085
2063
|
let newField = fieldSchema;
|
2086
2064
|
while (newField instanceof ZodOptional) {
|
@@ -2088,7 +2066,7 @@ var require_types_cjs_development = __commonJS({
|
|
2088
2066
|
}
|
2089
2067
|
newShape[key] = newField;
|
2090
2068
|
}
|
2091
|
-
}
|
2069
|
+
}
|
2092
2070
|
return new ZodObject({
|
2093
2071
|
...this._def,
|
2094
2072
|
shape: () => newShape
|
@@ -2438,7 +2416,7 @@ var require_types_cjs_development = __commonJS({
|
|
2438
2416
|
});
|
2439
2417
|
status.dirty();
|
2440
2418
|
}
|
2441
|
-
const items =
|
2419
|
+
const items = ctx.data.map((item, itemIndex) => {
|
2442
2420
|
const schema = this._def.items[itemIndex] || this._def.rest;
|
2443
2421
|
if (!schema)
|
2444
2422
|
return null;
|
@@ -2820,7 +2798,6 @@ var require_types_cjs_development = __commonJS({
|
|
2820
2798
|
if (input.data !== this._def.value) {
|
2821
2799
|
const ctx = this._getOrReturnCtx(input);
|
2822
2800
|
addIssueToContext(ctx, {
|
2823
|
-
received: ctx.data,
|
2824
2801
|
code: ZodIssueCode.invalid_literal,
|
2825
2802
|
expected: this._def.value
|
2826
2803
|
});
|
@@ -2898,12 +2875,6 @@ var require_types_cjs_development = __commonJS({
|
|
2898
2875
|
}
|
2899
2876
|
return enumValues;
|
2900
2877
|
}
|
2901
|
-
extract(values) {
|
2902
|
-
return ZodEnum.create(values);
|
2903
|
-
}
|
2904
|
-
exclude(values) {
|
2905
|
-
return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)));
|
2906
|
-
}
|
2907
2878
|
}, "ZodEnum");
|
2908
2879
|
__name22(ZodEnum, "ZodEnum");
|
2909
2880
|
ZodEnum.create = createZodEnum;
|
@@ -2944,9 +2915,6 @@ var require_types_cjs_development = __commonJS({
|
|
2944
2915
|
});
|
2945
2916
|
};
|
2946
2917
|
var ZodPromise = /* @__PURE__ */ __name2(class extends ZodType {
|
2947
|
-
unwrap() {
|
2948
|
-
return this._def.type;
|
2949
|
-
}
|
2950
2918
|
_parse(input) {
|
2951
2919
|
const { ctx } = this._processInputParams(input);
|
2952
2920
|
if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
|
@@ -3165,29 +3133,23 @@ var require_types_cjs_development = __commonJS({
|
|
3165
3133
|
const result = this._def.innerType._parse({
|
3166
3134
|
data: ctx.data,
|
3167
3135
|
path: ctx.path,
|
3168
|
-
parent:
|
3169
|
-
...ctx,
|
3170
|
-
common: {
|
3171
|
-
...ctx.common,
|
3172
|
-
issues: []
|
3173
|
-
}
|
3174
|
-
}
|
3136
|
+
parent: ctx
|
3175
3137
|
});
|
3176
3138
|
if (isAsync(result)) {
|
3177
3139
|
return result.then((result2) => {
|
3178
3140
|
return {
|
3179
3141
|
status: "valid",
|
3180
|
-
value: result2.status === "valid" ? result2.value : this._def.
|
3142
|
+
value: result2.status === "valid" ? result2.value : this._def.defaultValue()
|
3181
3143
|
};
|
3182
3144
|
});
|
3183
3145
|
} else {
|
3184
3146
|
return {
|
3185
3147
|
status: "valid",
|
3186
|
-
value: result.status === "valid" ? result.value : this._def.
|
3148
|
+
value: result.status === "valid" ? result.value : this._def.defaultValue()
|
3187
3149
|
};
|
3188
3150
|
}
|
3189
3151
|
}
|
3190
|
-
|
3152
|
+
removeDefault() {
|
3191
3153
|
return this._def.innerType;
|
3192
3154
|
}
|
3193
3155
|
}, "ZodCatch");
|
@@ -3196,7 +3158,7 @@ var require_types_cjs_development = __commonJS({
|
|
3196
3158
|
return new ZodCatch({
|
3197
3159
|
innerType: type,
|
3198
3160
|
typeName: ZodFirstPartyTypeKind.ZodCatch,
|
3199
|
-
|
3161
|
+
defaultValue: typeof params.default === "function" ? params.default : () => params.default,
|
3200
3162
|
...processCreateParams(params)
|
3201
3163
|
});
|
3202
3164
|
};
|
@@ -3389,10 +3351,7 @@ var require_types_cjs_development = __commonJS({
|
|
3389
3351
|
var coerce = {
|
3390
3352
|
string: (arg) => ZodString.create({ ...arg, coerce: true }),
|
3391
3353
|
number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
|
3392
|
-
boolean: (arg) => ZodBoolean.create({
|
3393
|
-
...arg,
|
3394
|
-
coerce: true
|
3395
|
-
}),
|
3354
|
+
boolean: (arg) => ZodBoolean.create({ ...arg, coerce: true }),
|
3396
3355
|
bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
|
3397
3356
|
date: (arg) => ZodDate.create({ ...arg, coerce: true })
|
3398
3357
|
};
|
@@ -3516,13 +3475,11 @@ var require_types_cjs_development = __commonJS({
|
|
3516
3475
|
type: mod.string().optional(),
|
3517
3476
|
narrative: mod.string().optional()
|
3518
3477
|
});
|
3519
|
-
var ImageValidator = mod.string().or(
|
3520
|
-
mod.
|
3521
|
-
|
3522
|
-
|
3523
|
-
|
3524
|
-
})
|
3525
|
-
);
|
3478
|
+
var ImageValidator = mod.string().or(mod.object({
|
3479
|
+
id: mod.string(),
|
3480
|
+
type: mod.string(),
|
3481
|
+
caption: mod.string().optional()
|
3482
|
+
}));
|
3526
3483
|
var GeoCoordinatesValidator = mod.object({
|
3527
3484
|
type: mod.string().min(1).or(mod.string().array().nonempty()),
|
3528
3485
|
latitude: mod.number(),
|
@@ -3564,31 +3521,29 @@ var require_types_cjs_development = __commonJS({
|
|
3564
3521
|
identifier: mod.string(),
|
3565
3522
|
identifierType: IdentifierTypeValidator
|
3566
3523
|
});
|
3567
|
-
var ProfileValidator = mod.string().or(
|
3568
|
-
mod.
|
3569
|
-
|
3570
|
-
|
3571
|
-
|
3572
|
-
|
3573
|
-
|
3574
|
-
|
3575
|
-
|
3576
|
-
|
3577
|
-
|
3578
|
-
|
3579
|
-
|
3580
|
-
|
3581
|
-
|
3582
|
-
|
3583
|
-
|
3584
|
-
|
3585
|
-
|
3586
|
-
|
3587
|
-
|
3588
|
-
|
3589
|
-
|
3590
|
-
}).catchall(mod.any())
|
3591
|
-
);
|
3524
|
+
var ProfileValidator = mod.string().or(mod.object({
|
3525
|
+
id: mod.string().optional(),
|
3526
|
+
type: mod.string().or(mod.string().array().nonempty().optional()),
|
3527
|
+
name: mod.string().optional(),
|
3528
|
+
url: mod.string().optional(),
|
3529
|
+
phone: mod.string().optional(),
|
3530
|
+
description: mod.string().optional(),
|
3531
|
+
endorsement: mod.any().array().optional(),
|
3532
|
+
image: ImageValidator.optional(),
|
3533
|
+
email: mod.string().email().optional(),
|
3534
|
+
address: AddressValidator.optional(),
|
3535
|
+
otherIdentifier: IdentifierEntryValidator.array().optional(),
|
3536
|
+
official: mod.string().optional(),
|
3537
|
+
parentOrg: mod.any().optional(),
|
3538
|
+
familyName: mod.string().optional(),
|
3539
|
+
givenName: mod.string().optional(),
|
3540
|
+
additionalName: mod.string().optional(),
|
3541
|
+
patronymicName: mod.string().optional(),
|
3542
|
+
honorificPrefix: mod.string().optional(),
|
3543
|
+
honorificSuffix: mod.string().optional(),
|
3544
|
+
familyNamePrefix: mod.string().optional(),
|
3545
|
+
dateOfBirth: mod.string().optional()
|
3546
|
+
}).catchall(mod.any()));
|
3592
3547
|
var CredentialSubjectValidator = mod.object({ id: mod.string().optional() }).catchall(mod.any());
|
3593
3548
|
var CredentialStatusValidator = mod.object({ type: mod.string(), id: mod.string() });
|
3594
3549
|
var CredentialSchemaValidator = mod.object({ id: mod.string(), type: mod.string() });
|
@@ -4011,15 +3966,9 @@ var getDidKeyPlugin = /* @__PURE__ */ __name(async (learnCard, key, defaultDidMe
|
|
4011
3966
|
if (key.length > 64)
|
4012
3967
|
throw new Error("Key must be less than 64 characters");
|
4013
3968
|
if (key.length < 64) {
|
4014
|
-
console.warn(
|
4015
|
-
|
4016
|
-
);
|
4017
|
-
console.warn(
|
4018
|
-
"Please instantiate LearnCards using 32 bytes that have been randomly generated in a cryptographically secure fashion!"
|
4019
|
-
);
|
4020
|
-
console.warn(
|
4021
|
-
"See https://app.gitbook.com/o/6uDv1QDlxaaZC7i8EaGb/s/FXvEJ9j3Vf3FW5Nc557n/learn-card-packages/learncard-core/instantiation#key-generation for details"
|
4022
|
-
);
|
3969
|
+
console.warn("Warning: A LearnCard has been initialized with a seed that is less than 32 bytes, and will be padded with zeroes");
|
3970
|
+
console.warn("Please instantiate LearnCards using 32 bytes that have been randomly generated in a cryptographically secure fashion!");
|
3971
|
+
console.warn("See https://app.gitbook.com/o/6uDv1QDlxaaZC7i8EaGb/s/FXvEJ9j3Vf3FW5Nc557n/learn-card-packages/learncard-core/instantiation#key-generation for details");
|
4023
3972
|
}
|
4024
3973
|
const seed = key.padStart(64, "0");
|
4025
3974
|
const seedBytes = toUint8Array(seed);
|