@learncard/didkey-plugin 1.0.1 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/didkey-plugin.cjs.development.js +121 -169
- 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 +121 -168
- package/dist/didkey-plugin.esm.js.map +3 -3
- package/package.json +4 -4
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __defProp = Object.defineProperty;
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
@@ -57,10 +56,7 @@ var __copyProps2 = /* @__PURE__ */ __name((to, from, except, desc) => {
|
|
57
56
|
}
|
58
57
|
return to;
|
59
58
|
}, "__copyProps");
|
60
|
-
var __toESM = /* @__PURE__ */ __name((mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps2(
|
61
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
|
62
|
-
mod
|
63
|
-
)), "__toESM");
|
59
|
+
var __toESM = /* @__PURE__ */ __name((mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps2(isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target, mod)), "__toESM");
|
64
60
|
var require_types_cjs_development = __commonJS({
|
65
61
|
"../learn-card-types/dist/types.cjs.development.js"(exports, module2) {
|
66
62
|
"use strict";
|
@@ -102,6 +98,7 @@ var require_types_cjs_development = __commonJS({
|
|
102
98
|
CredentialSubjectValidator: () => CredentialSubjectValidator,
|
103
99
|
CriteriaValidator: () => CriteriaValidator,
|
104
100
|
EncryptedCredentialRecordValidator: () => EncryptedCredentialRecordValidator,
|
101
|
+
EncryptedRecordValidator: () => EncryptedRecordValidator,
|
105
102
|
EndorsementCredentialValidator: () => EndorsementCredentialValidator,
|
106
103
|
EndorsementSubjectValidator: () => EndorsementSubjectValidator,
|
107
104
|
EvidenceValidator: () => EvidenceValidator,
|
@@ -127,6 +124,7 @@ var require_types_cjs_development = __commonJS({
|
|
127
124
|
LCNSigningAuthorityForUserValidator: () => LCNSigningAuthorityForUserValidator,
|
128
125
|
LCNSigningAuthorityValidator: () => LCNSigningAuthorityValidator,
|
129
126
|
PaginatedEncryptedCredentialRecordsValidator: () => PaginatedEncryptedCredentialRecordsValidator,
|
127
|
+
PaginatedEncryptedRecordsValidator: () => PaginatedEncryptedRecordsValidator,
|
130
128
|
PaginationOptionsValidator: () => PaginationOptionsValidator,
|
131
129
|
PaginationResponseValidator: () => PaginationResponseValidator,
|
132
130
|
ProfileValidator: () => ProfileValidator,
|
@@ -592,7 +590,7 @@ var require_types_cjs_development = __commonJS({
|
|
592
590
|
var isAborted = /* @__PURE__ */ __name22((x) => x.status === "aborted", "isAborted");
|
593
591
|
var isDirty = /* @__PURE__ */ __name22((x) => x.status === "dirty", "isDirty");
|
594
592
|
var isValid = /* @__PURE__ */ __name22((x) => x.status === "valid", "isValid");
|
595
|
-
var isAsync = /* @__PURE__ */ __name22((x) => typeof Promise !==
|
593
|
+
var isAsync = /* @__PURE__ */ __name22((x) => typeof Promise !== void 0 && x instanceof Promise, "isAsync");
|
596
594
|
var errorUtil;
|
597
595
|
(function(errorUtil2) {
|
598
596
|
errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
@@ -812,29 +810,28 @@ var require_types_cjs_development = __commonJS({
|
|
812
810
|
return this._refinement(refinement);
|
813
811
|
}
|
814
812
|
optional() {
|
815
|
-
return ZodOptional.create(this
|
813
|
+
return ZodOptional.create(this);
|
816
814
|
}
|
817
815
|
nullable() {
|
818
|
-
return ZodNullable.create(this
|
816
|
+
return ZodNullable.create(this);
|
819
817
|
}
|
820
818
|
nullish() {
|
821
|
-
return this.
|
819
|
+
return this.optional().nullable();
|
822
820
|
}
|
823
821
|
array() {
|
824
|
-
return ZodArray.create(this
|
822
|
+
return ZodArray.create(this);
|
825
823
|
}
|
826
824
|
promise() {
|
827
|
-
return ZodPromise.create(this
|
825
|
+
return ZodPromise.create(this);
|
828
826
|
}
|
829
827
|
or(option) {
|
830
|
-
return ZodUnion.create([this, option]
|
828
|
+
return ZodUnion.create([this, option]);
|
831
829
|
}
|
832
830
|
and(incoming) {
|
833
|
-
return ZodIntersection.create(this, incoming
|
831
|
+
return ZodIntersection.create(this, incoming);
|
834
832
|
}
|
835
833
|
transform(transform) {
|
836
834
|
return new ZodEffects({
|
837
|
-
...processCreateParams(this._def),
|
838
835
|
schema: this,
|
839
836
|
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
840
837
|
effect: { type: "transform", transform }
|
@@ -843,7 +840,6 @@ var require_types_cjs_development = __commonJS({
|
|
843
840
|
default(def) {
|
844
841
|
const defaultValueFunc = typeof def === "function" ? def : () => def;
|
845
842
|
return new ZodDefault({
|
846
|
-
...processCreateParams(this._def),
|
847
843
|
innerType: this,
|
848
844
|
defaultValue: defaultValueFunc,
|
849
845
|
typeName: ZodFirstPartyTypeKind.ZodDefault
|
@@ -853,15 +849,14 @@ var require_types_cjs_development = __commonJS({
|
|
853
849
|
return new ZodBranded({
|
854
850
|
typeName: ZodFirstPartyTypeKind.ZodBranded,
|
855
851
|
type: this,
|
856
|
-
...processCreateParams(
|
852
|
+
...processCreateParams(void 0)
|
857
853
|
});
|
858
854
|
}
|
859
855
|
catch(def) {
|
860
|
-
const
|
856
|
+
const defaultValueFunc = typeof def === "function" ? def : () => def;
|
861
857
|
return new ZodCatch({
|
862
|
-
...processCreateParams(this._def),
|
863
858
|
innerType: this,
|
864
|
-
|
859
|
+
defaultValue: defaultValueFunc,
|
865
860
|
typeName: ZodFirstPartyTypeKind.ZodCatch
|
866
861
|
});
|
867
862
|
}
|
@@ -884,25 +879,24 @@ var require_types_cjs_development = __commonJS({
|
|
884
879
|
}, "ZodType");
|
885
880
|
__name22(ZodType, "ZodType");
|
886
881
|
var cuidRegex = /^c[^\s-]{8,}$/i;
|
887
|
-
var cuid2Regex = /^[a-z][a-z0-9]*$/;
|
888
882
|
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;
|
889
|
-
var emailRegex = /^(([^<>()[\]
|
883
|
+
var emailRegex = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;
|
890
884
|
var datetimeRegex = /* @__PURE__ */ __name22((args) => {
|
891
885
|
if (args.precision) {
|
892
886
|
if (args.offset) {
|
893
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}
|
887
|
+
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}:\\d{2})|Z)$`);
|
894
888
|
} else {
|
895
889
|
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
|
896
890
|
}
|
897
891
|
} else if (args.precision === 0) {
|
898
892
|
if (args.offset) {
|
899
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}
|
893
|
+
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$`);
|
900
894
|
} else {
|
901
895
|
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
|
902
896
|
}
|
903
897
|
} else {
|
904
898
|
if (args.offset) {
|
905
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}
|
899
|
+
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$`);
|
906
900
|
} else {
|
907
901
|
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
|
908
902
|
}
|
@@ -929,14 +923,11 @@ var require_types_cjs_development = __commonJS({
|
|
929
923
|
const parsedType = this._getType(input);
|
930
924
|
if (parsedType !== ZodParsedType.string) {
|
931
925
|
const ctx2 = this._getOrReturnCtx(input);
|
932
|
-
addIssueToContext(
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
received: ctx2.parsedType
|
938
|
-
}
|
939
|
-
);
|
926
|
+
addIssueToContext(ctx2, {
|
927
|
+
code: ZodIssueCode.invalid_type,
|
928
|
+
expected: ZodParsedType.string,
|
929
|
+
received: ctx2.parsedType
|
930
|
+
});
|
940
931
|
return INVALID;
|
941
932
|
}
|
942
933
|
const status = new ParseStatus();
|
@@ -1024,16 +1015,6 @@ var require_types_cjs_development = __commonJS({
|
|
1024
1015
|
});
|
1025
1016
|
status.dirty();
|
1026
1017
|
}
|
1027
|
-
} else if (check.kind === "cuid2") {
|
1028
|
-
if (!cuid2Regex.test(input.data)) {
|
1029
|
-
ctx = this._getOrReturnCtx(input, ctx);
|
1030
|
-
addIssueToContext(ctx, {
|
1031
|
-
validation: "cuid2",
|
1032
|
-
code: ZodIssueCode.invalid_string,
|
1033
|
-
message: check.message
|
1034
|
-
});
|
1035
|
-
status.dirty();
|
1036
|
-
}
|
1037
1018
|
} else if (check.kind === "url") {
|
1038
1019
|
try {
|
1039
1020
|
new URL(input.data);
|
@@ -1115,9 +1096,6 @@ var require_types_cjs_development = __commonJS({
|
|
1115
1096
|
cuid(message) {
|
1116
1097
|
return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
|
1117
1098
|
}
|
1118
|
-
cuid2(message) {
|
1119
|
-
return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
|
1120
|
-
}
|
1121
1099
|
datetime(options) {
|
1122
1100
|
var _a;
|
1123
1101
|
if (typeof options === "string") {
|
@@ -1192,9 +1170,6 @@ var require_types_cjs_development = __commonJS({
|
|
1192
1170
|
get isCUID() {
|
1193
1171
|
return !!this._def.checks.find((ch) => ch.kind === "cuid");
|
1194
1172
|
}
|
1195
|
-
get isCUID2() {
|
1196
|
-
return !!this._def.checks.find((ch) => ch.kind === "cuid2");
|
1197
|
-
}
|
1198
1173
|
get minLength() {
|
1199
1174
|
let min = null;
|
1200
1175
|
for (const ch of this._def.checks) {
|
@@ -1429,22 +1404,7 @@ var require_types_cjs_development = __commonJS({
|
|
1429
1404
|
return max;
|
1430
1405
|
}
|
1431
1406
|
get isInt() {
|
1432
|
-
return !!this._def.checks.find((ch) => ch.kind === "int"
|
1433
|
-
}
|
1434
|
-
get isFinite() {
|
1435
|
-
let max = null, min = null;
|
1436
|
-
for (const ch of this._def.checks) {
|
1437
|
-
if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
|
1438
|
-
return true;
|
1439
|
-
} else if (ch.kind === "min") {
|
1440
|
-
if (min === null || ch.value > min)
|
1441
|
-
min = ch.value;
|
1442
|
-
} else if (ch.kind === "max") {
|
1443
|
-
if (max === null || ch.value < max)
|
1444
|
-
max = ch.value;
|
1445
|
-
}
|
1446
|
-
}
|
1447
|
-
return Number.isFinite(min) && Number.isFinite(max);
|
1407
|
+
return !!this._def.checks.find((ch) => ch.kind === "int");
|
1448
1408
|
}
|
1449
1409
|
}, "ZodNumber");
|
1450
1410
|
__name22(ZodNumber, "ZodNumber");
|
@@ -1812,13 +1772,13 @@ var require_types_cjs_development = __commonJS({
|
|
1812
1772
|
}
|
1813
1773
|
}
|
1814
1774
|
if (ctx.common.async) {
|
1815
|
-
return Promise.all(
|
1775
|
+
return Promise.all(ctx.data.map((item, i) => {
|
1816
1776
|
return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
|
1817
1777
|
})).then((result2) => {
|
1818
1778
|
return ParseStatus.mergeArray(status, result2);
|
1819
1779
|
});
|
1820
1780
|
}
|
1821
|
-
const result =
|
1781
|
+
const result = ctx.data.map((item, i) => {
|
1822
1782
|
return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
|
1823
1783
|
});
|
1824
1784
|
return ParseStatus.mergeArray(status, result);
|
@@ -1868,6 +1828,15 @@ var require_types_cjs_development = __commonJS({
|
|
1868
1828
|
};
|
1869
1829
|
};
|
1870
1830
|
})(objectUtil || (objectUtil = {}));
|
1831
|
+
var AugmentFactory = /* @__PURE__ */ __name22((def) => (augmentation) => {
|
1832
|
+
return new ZodObject({
|
1833
|
+
...def,
|
1834
|
+
shape: () => ({
|
1835
|
+
...def.shape(),
|
1836
|
+
...augmentation
|
1837
|
+
})
|
1838
|
+
});
|
1839
|
+
}, "AugmentFactory");
|
1871
1840
|
function deepPartialify(schema) {
|
1872
1841
|
if (schema instanceof ZodObject) {
|
1873
1842
|
const newShape = {};
|
@@ -1899,7 +1868,8 @@ var require_types_cjs_development = __commonJS({
|
|
1899
1868
|
super(...arguments);
|
1900
1869
|
this._cached = null;
|
1901
1870
|
this.nonstrict = this.passthrough;
|
1902
|
-
this.augment = this.
|
1871
|
+
this.augment = AugmentFactory(this._def);
|
1872
|
+
this.extend = AugmentFactory(this._def);
|
1903
1873
|
}
|
1904
1874
|
_getCached() {
|
1905
1875
|
if (this._cached !== null)
|
@@ -1967,9 +1937,7 @@ var require_types_cjs_development = __commonJS({
|
|
1967
1937
|
const value = ctx.data[key];
|
1968
1938
|
pairs.push({
|
1969
1939
|
key: { status: "valid", value: key },
|
1970
|
-
value: catchall._parse(
|
1971
|
-
new ParseInputLazyPath(ctx, value, ctx.path, key)
|
1972
|
-
),
|
1940
|
+
value: catchall._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
|
1973
1941
|
alwaysSet: key in ctx.data
|
1974
1942
|
});
|
1975
1943
|
}
|
@@ -2028,14 +1996,8 @@ var require_types_cjs_development = __commonJS({
|
|
2028
1996
|
unknownKeys: "passthrough"
|
2029
1997
|
});
|
2030
1998
|
}
|
2031
|
-
|
2032
|
-
return
|
2033
|
-
...this._def,
|
2034
|
-
shape: () => ({
|
2035
|
-
...this._def.shape(),
|
2036
|
-
...augmentation
|
2037
|
-
})
|
2038
|
-
});
|
1999
|
+
setKey(key, schema) {
|
2000
|
+
return this.augment({ [key]: schema });
|
2039
2001
|
}
|
2040
2002
|
merge(merging) {
|
2041
2003
|
const merged = new ZodObject({
|
@@ -2046,9 +2008,6 @@ var require_types_cjs_development = __commonJS({
|
|
2046
2008
|
});
|
2047
2009
|
return merged;
|
2048
2010
|
}
|
2049
|
-
setKey(key, schema) {
|
2050
|
-
return this.augment({ [key]: schema });
|
2051
|
-
}
|
2052
2011
|
catchall(index) {
|
2053
2012
|
return new ZodObject({
|
2054
2013
|
...this._def,
|
@@ -2057,10 +2016,9 @@ var require_types_cjs_development = __commonJS({
|
|
2057
2016
|
}
|
2058
2017
|
pick(mask) {
|
2059
2018
|
const shape = {};
|
2060
|
-
util.objectKeys(mask).
|
2061
|
-
if (
|
2019
|
+
util.objectKeys(mask).map((key) => {
|
2020
|
+
if (this.shape[key])
|
2062
2021
|
shape[key] = this.shape[key];
|
2063
|
-
}
|
2064
2022
|
});
|
2065
2023
|
return new ZodObject({
|
2066
2024
|
...this._def,
|
@@ -2069,8 +2027,8 @@ var require_types_cjs_development = __commonJS({
|
|
2069
2027
|
}
|
2070
2028
|
omit(mask) {
|
2071
2029
|
const shape = {};
|
2072
|
-
util.objectKeys(this.shape).
|
2073
|
-
if (
|
2030
|
+
util.objectKeys(this.shape).map((key) => {
|
2031
|
+
if (util.objectKeys(mask).indexOf(key) === -1) {
|
2074
2032
|
shape[key] = this.shape[key];
|
2075
2033
|
}
|
2076
2034
|
});
|
@@ -2084,14 +2042,24 @@ var require_types_cjs_development = __commonJS({
|
|
2084
2042
|
}
|
2085
2043
|
partial(mask) {
|
2086
2044
|
const newShape = {};
|
2087
|
-
|
2088
|
-
|
2089
|
-
|
2090
|
-
|
2091
|
-
|
2045
|
+
if (mask) {
|
2046
|
+
util.objectKeys(this.shape).map((key) => {
|
2047
|
+
if (util.objectKeys(mask).indexOf(key) === -1) {
|
2048
|
+
newShape[key] = this.shape[key];
|
2049
|
+
} else {
|
2050
|
+
newShape[key] = this.shape[key].optional();
|
2051
|
+
}
|
2052
|
+
});
|
2053
|
+
return new ZodObject({
|
2054
|
+
...this._def,
|
2055
|
+
shape: () => newShape
|
2056
|
+
});
|
2057
|
+
} else {
|
2058
|
+
for (const key in this.shape) {
|
2059
|
+
const fieldSchema = this.shape[key];
|
2092
2060
|
newShape[key] = fieldSchema.optional();
|
2093
2061
|
}
|
2094
|
-
}
|
2062
|
+
}
|
2095
2063
|
return new ZodObject({
|
2096
2064
|
...this._def,
|
2097
2065
|
shape: () => newShape
|
@@ -2099,10 +2067,21 @@ var require_types_cjs_development = __commonJS({
|
|
2099
2067
|
}
|
2100
2068
|
required(mask) {
|
2101
2069
|
const newShape = {};
|
2102
|
-
|
2103
|
-
|
2104
|
-
|
2105
|
-
|
2070
|
+
if (mask) {
|
2071
|
+
util.objectKeys(this.shape).map((key) => {
|
2072
|
+
if (util.objectKeys(mask).indexOf(key) === -1) {
|
2073
|
+
newShape[key] = this.shape[key];
|
2074
|
+
} else {
|
2075
|
+
const fieldSchema = this.shape[key];
|
2076
|
+
let newField = fieldSchema;
|
2077
|
+
while (newField instanceof ZodOptional) {
|
2078
|
+
newField = newField._def.innerType;
|
2079
|
+
}
|
2080
|
+
newShape[key] = newField;
|
2081
|
+
}
|
2082
|
+
});
|
2083
|
+
} else {
|
2084
|
+
for (const key in this.shape) {
|
2106
2085
|
const fieldSchema = this.shape[key];
|
2107
2086
|
let newField = fieldSchema;
|
2108
2087
|
while (newField instanceof ZodOptional) {
|
@@ -2110,7 +2089,7 @@ var require_types_cjs_development = __commonJS({
|
|
2110
2089
|
}
|
2111
2090
|
newShape[key] = newField;
|
2112
2091
|
}
|
2113
|
-
}
|
2092
|
+
}
|
2114
2093
|
return new ZodObject({
|
2115
2094
|
...this._def,
|
2116
2095
|
shape: () => newShape
|
@@ -2460,7 +2439,7 @@ var require_types_cjs_development = __commonJS({
|
|
2460
2439
|
});
|
2461
2440
|
status.dirty();
|
2462
2441
|
}
|
2463
|
-
const items =
|
2442
|
+
const items = ctx.data.map((item, itemIndex) => {
|
2464
2443
|
const schema = this._def.items[itemIndex] || this._def.rest;
|
2465
2444
|
if (!schema)
|
2466
2445
|
return null;
|
@@ -2842,7 +2821,6 @@ var require_types_cjs_development = __commonJS({
|
|
2842
2821
|
if (input.data !== this._def.value) {
|
2843
2822
|
const ctx = this._getOrReturnCtx(input);
|
2844
2823
|
addIssueToContext(ctx, {
|
2845
|
-
received: ctx.data,
|
2846
2824
|
code: ZodIssueCode.invalid_literal,
|
2847
2825
|
expected: this._def.value
|
2848
2826
|
});
|
@@ -2920,12 +2898,6 @@ var require_types_cjs_development = __commonJS({
|
|
2920
2898
|
}
|
2921
2899
|
return enumValues;
|
2922
2900
|
}
|
2923
|
-
extract(values) {
|
2924
|
-
return ZodEnum.create(values);
|
2925
|
-
}
|
2926
|
-
exclude(values) {
|
2927
|
-
return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)));
|
2928
|
-
}
|
2929
2901
|
}, "ZodEnum");
|
2930
2902
|
__name22(ZodEnum, "ZodEnum");
|
2931
2903
|
ZodEnum.create = createZodEnum;
|
@@ -2966,9 +2938,6 @@ var require_types_cjs_development = __commonJS({
|
|
2966
2938
|
});
|
2967
2939
|
};
|
2968
2940
|
var ZodPromise = /* @__PURE__ */ __name2(class extends ZodType {
|
2969
|
-
unwrap() {
|
2970
|
-
return this._def.type;
|
2971
|
-
}
|
2972
2941
|
_parse(input) {
|
2973
2942
|
const { ctx } = this._processInputParams(input);
|
2974
2943
|
if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
|
@@ -3187,29 +3156,23 @@ var require_types_cjs_development = __commonJS({
|
|
3187
3156
|
const result = this._def.innerType._parse({
|
3188
3157
|
data: ctx.data,
|
3189
3158
|
path: ctx.path,
|
3190
|
-
parent:
|
3191
|
-
...ctx,
|
3192
|
-
common: {
|
3193
|
-
...ctx.common,
|
3194
|
-
issues: []
|
3195
|
-
}
|
3196
|
-
}
|
3159
|
+
parent: ctx
|
3197
3160
|
});
|
3198
3161
|
if (isAsync(result)) {
|
3199
3162
|
return result.then((result2) => {
|
3200
3163
|
return {
|
3201
3164
|
status: "valid",
|
3202
|
-
value: result2.status === "valid" ? result2.value : this._def.
|
3165
|
+
value: result2.status === "valid" ? result2.value : this._def.defaultValue()
|
3203
3166
|
};
|
3204
3167
|
});
|
3205
3168
|
} else {
|
3206
3169
|
return {
|
3207
3170
|
status: "valid",
|
3208
|
-
value: result.status === "valid" ? result.value : this._def.
|
3171
|
+
value: result.status === "valid" ? result.value : this._def.defaultValue()
|
3209
3172
|
};
|
3210
3173
|
}
|
3211
3174
|
}
|
3212
|
-
|
3175
|
+
removeDefault() {
|
3213
3176
|
return this._def.innerType;
|
3214
3177
|
}
|
3215
3178
|
}, "ZodCatch");
|
@@ -3218,7 +3181,7 @@ var require_types_cjs_development = __commonJS({
|
|
3218
3181
|
return new ZodCatch({
|
3219
3182
|
innerType: type,
|
3220
3183
|
typeName: ZodFirstPartyTypeKind.ZodCatch,
|
3221
|
-
|
3184
|
+
defaultValue: typeof params.default === "function" ? params.default : () => params.default,
|
3222
3185
|
...processCreateParams(params)
|
3223
3186
|
});
|
3224
3187
|
};
|
@@ -3411,10 +3374,7 @@ var require_types_cjs_development = __commonJS({
|
|
3411
3374
|
var coerce = {
|
3412
3375
|
string: (arg) => ZodString.create({ ...arg, coerce: true }),
|
3413
3376
|
number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
|
3414
|
-
boolean: (arg) => ZodBoolean.create({
|
3415
|
-
...arg,
|
3416
|
-
coerce: true
|
3417
|
-
}),
|
3377
|
+
boolean: (arg) => ZodBoolean.create({ ...arg, coerce: true }),
|
3418
3378
|
bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
|
3419
3379
|
date: (arg) => ZodDate.create({ ...arg, coerce: true })
|
3420
3380
|
};
|
@@ -3538,13 +3498,11 @@ var require_types_cjs_development = __commonJS({
|
|
3538
3498
|
type: mod.string().optional(),
|
3539
3499
|
narrative: mod.string().optional()
|
3540
3500
|
});
|
3541
|
-
var ImageValidator = mod.string().or(
|
3542
|
-
mod.
|
3543
|
-
|
3544
|
-
|
3545
|
-
|
3546
|
-
})
|
3547
|
-
);
|
3501
|
+
var ImageValidator = mod.string().or(mod.object({
|
3502
|
+
id: mod.string(),
|
3503
|
+
type: mod.string(),
|
3504
|
+
caption: mod.string().optional()
|
3505
|
+
}));
|
3548
3506
|
var GeoCoordinatesValidator = mod.object({
|
3549
3507
|
type: mod.string().min(1).or(mod.string().array().nonempty()),
|
3550
3508
|
latitude: mod.number(),
|
@@ -3586,31 +3544,29 @@ var require_types_cjs_development = __commonJS({
|
|
3586
3544
|
identifier: mod.string(),
|
3587
3545
|
identifierType: IdentifierTypeValidator
|
3588
3546
|
});
|
3589
|
-
var ProfileValidator = mod.string().or(
|
3590
|
-
mod.
|
3591
|
-
|
3592
|
-
|
3593
|
-
|
3594
|
-
|
3595
|
-
|
3596
|
-
|
3597
|
-
|
3598
|
-
|
3599
|
-
|
3600
|
-
|
3601
|
-
|
3602
|
-
|
3603
|
-
|
3604
|
-
|
3605
|
-
|
3606
|
-
|
3607
|
-
|
3608
|
-
|
3609
|
-
|
3610
|
-
|
3611
|
-
|
3612
|
-
}).catchall(mod.any())
|
3613
|
-
);
|
3547
|
+
var ProfileValidator = mod.string().or(mod.object({
|
3548
|
+
id: mod.string().optional(),
|
3549
|
+
type: mod.string().or(mod.string().array().nonempty().optional()),
|
3550
|
+
name: mod.string().optional(),
|
3551
|
+
url: mod.string().optional(),
|
3552
|
+
phone: mod.string().optional(),
|
3553
|
+
description: mod.string().optional(),
|
3554
|
+
endorsement: mod.any().array().optional(),
|
3555
|
+
image: ImageValidator.optional(),
|
3556
|
+
email: mod.string().email().optional(),
|
3557
|
+
address: AddressValidator.optional(),
|
3558
|
+
otherIdentifier: IdentifierEntryValidator.array().optional(),
|
3559
|
+
official: mod.string().optional(),
|
3560
|
+
parentOrg: mod.any().optional(),
|
3561
|
+
familyName: mod.string().optional(),
|
3562
|
+
givenName: mod.string().optional(),
|
3563
|
+
additionalName: mod.string().optional(),
|
3564
|
+
patronymicName: mod.string().optional(),
|
3565
|
+
honorificPrefix: mod.string().optional(),
|
3566
|
+
honorificSuffix: mod.string().optional(),
|
3567
|
+
familyNamePrefix: mod.string().optional(),
|
3568
|
+
dateOfBirth: mod.string().optional()
|
3569
|
+
}).catchall(mod.any()));
|
3614
3570
|
var CredentialSubjectValidator = mod.object({ id: mod.string().optional() }).catchall(mod.any());
|
3615
3571
|
var CredentialStatusValidator = mod.object({ type: mod.string(), id: mod.string() });
|
3616
3572
|
var CredentialSchemaValidator = mod.object({ id: mod.string(), type: mod.string() });
|
@@ -3892,11 +3848,13 @@ var require_types_cjs_development = __commonJS({
|
|
3892
3848
|
aad: mod.string().optional(),
|
3893
3849
|
recipients: JWERecipientValidator.array().optional()
|
3894
3850
|
});
|
3895
|
-
var
|
3896
|
-
|
3897
|
-
|
3851
|
+
var EncryptedRecordValidator = mod.object({ encryptedRecord: JWEValidator2, fields: mod.string().array() }).catchall(mod.any());
|
3852
|
+
var PaginatedEncryptedRecordsValidator = PaginationResponseValidator.extend({
|
3853
|
+
records: EncryptedRecordValidator.array()
|
3854
|
+
});
|
3855
|
+
var EncryptedCredentialRecordValidator = EncryptedRecordValidator.extend({
|
3898
3856
|
id: mod.string()
|
3899
|
-
})
|
3857
|
+
});
|
3900
3858
|
var PaginatedEncryptedCredentialRecordsValidator = PaginationResponseValidator.extend({
|
3901
3859
|
records: EncryptedCredentialRecordValidator.array()
|
3902
3860
|
});
|
@@ -3933,7 +3891,7 @@ var require_types_cjs_development = __commonJS({
|
|
3933
3891
|
var BoostRecipientValidator = mod.object({
|
3934
3892
|
to: LCNProfileValidator,
|
3935
3893
|
from: mod.string(),
|
3936
|
-
received: mod.string()
|
3894
|
+
received: mod.string().optional()
|
3937
3895
|
});
|
3938
3896
|
var LCNNotificationTypeEnumValidator = mod.enum([
|
3939
3897
|
"CONNECTION_REQUEST",
|
@@ -4031,15 +3989,9 @@ var getDidKeyPlugin = /* @__PURE__ */ __name(async (learnCard, key, defaultDidMe
|
|
4031
3989
|
if (key.length > 64)
|
4032
3990
|
throw new Error("Key must be less than 64 characters");
|
4033
3991
|
if (key.length < 64) {
|
4034
|
-
console.warn(
|
4035
|
-
|
4036
|
-
);
|
4037
|
-
console.warn(
|
4038
|
-
"Please instantiate LearnCards using 32 bytes that have been randomly generated in a cryptographically secure fashion!"
|
4039
|
-
);
|
4040
|
-
console.warn(
|
4041
|
-
"See https://app.gitbook.com/o/6uDv1QDlxaaZC7i8EaGb/s/FXvEJ9j3Vf3FW5Nc557n/learn-card-packages/learncard-core/instantiation#key-generation for details"
|
4042
|
-
);
|
3992
|
+
console.warn("Warning: A LearnCard has been initialized with a seed that is less than 32 bytes, and will be padded with zeroes");
|
3993
|
+
console.warn("Please instantiate LearnCards using 32 bytes that have been randomly generated in a cryptographically secure fashion!");
|
3994
|
+
console.warn("See https://app.gitbook.com/o/6uDv1QDlxaaZC7i8EaGb/s/FXvEJ9j3Vf3FW5Nc557n/learn-card-packages/learncard-core/instantiation#key-generation for details");
|
4043
3995
|
}
|
4044
3996
|
const seed = key.padStart(64, "0");
|
4045
3997
|
const seedBytes = toUint8Array(seed);
|