@learncard/learn-cloud-plugin 1.0.6 → 1.1.1
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.d.ts +3 -3
- package/dist/learn-cloud-plugin.cjs.development.js +386 -447
- package/dist/learn-cloud-plugin.cjs.development.js.map +4 -4
- package/dist/learn-cloud-plugin.cjs.production.min.js +15 -15
- package/dist/learn-cloud-plugin.cjs.production.min.js.map +4 -4
- package/dist/learn-cloud-plugin.esm.js +386 -446
- package/dist/learn-cloud-plugin.esm.js.map +4 -4
- package/dist/plugin.d.ts +1 -1
- package/dist/types.d.ts +15 -4
- package/package.json +7 -6
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -21,10 +20,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
21
20
|
}
|
|
22
21
|
return to;
|
|
23
22
|
};
|
|
24
|
-
var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__getProtoOf(mod2)) : {}, __copyProps(
|
|
25
|
-
isNodeMode || !mod2 || !mod2.__esModule ? __defProp(target, "default", { value: mod2, enumerable: true }) : target,
|
|
26
|
-
mod2
|
|
27
|
-
));
|
|
23
|
+
var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__getProtoOf(mod2)) : {}, __copyProps(isNodeMode || !mod2 || !mod2.__esModule ? __defProp(target, "default", { value: mod2, enumerable: true }) : target, mod2));
|
|
28
24
|
var __toCommonJS = (mod2) => __copyProps(__defProp({}, "__esModule", { value: true }), mod2);
|
|
29
25
|
|
|
30
26
|
// ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js
|
|
@@ -782,9 +778,7 @@ var require_lodash = __commonJS({
|
|
|
782
778
|
var nativeObjectToString = objectProto.toString;
|
|
783
779
|
var objectCtorString = funcToString.call(Object2);
|
|
784
780
|
var oldDash = root._;
|
|
785
|
-
var reIsNative = RegExp2(
|
|
786
|
-
"^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
787
|
-
);
|
|
781
|
+
var reIsNative = RegExp2("^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
|
|
788
782
|
var Buffer2 = moduleExports ? context.Buffer : undefined2, Symbol2 = context.Symbol, Uint8Array2 = context.Uint8Array, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : undefined2, getPrototype = overArg(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : undefined2, symIterator = Symbol2 ? Symbol2.iterator : undefined2, symToStringTag = Symbol2 ? Symbol2.toStringTag : undefined2;
|
|
789
783
|
var defineProperty = function() {
|
|
790
784
|
try {
|
|
@@ -2413,18 +2407,7 @@ var require_lodash = __commonJS({
|
|
|
2413
2407
|
var holders = length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder ? [] : replaceHolders(args, placeholder);
|
|
2414
2408
|
length -= holders.length;
|
|
2415
2409
|
if (length < arity) {
|
|
2416
|
-
return createRecurry(
|
|
2417
|
-
func,
|
|
2418
|
-
bitmask,
|
|
2419
|
-
createHybrid,
|
|
2420
|
-
wrapper.placeholder,
|
|
2421
|
-
undefined2,
|
|
2422
|
-
args,
|
|
2423
|
-
holders,
|
|
2424
|
-
undefined2,
|
|
2425
|
-
undefined2,
|
|
2426
|
-
arity - length
|
|
2427
|
-
);
|
|
2410
|
+
return createRecurry(func, bitmask, createHybrid, wrapper.placeholder, undefined2, args, holders, undefined2, undefined2, arity - length);
|
|
2428
2411
|
}
|
|
2429
2412
|
var fn = this && this !== root && this instanceof wrapper ? Ctor : func;
|
|
2430
2413
|
return apply(fn, this, args);
|
|
@@ -2506,18 +2489,7 @@ var require_lodash = __commonJS({
|
|
|
2506
2489
|
length -= holdersCount;
|
|
2507
2490
|
if (isCurried && length < arity) {
|
|
2508
2491
|
var newHolders = replaceHolders(args, placeholder);
|
|
2509
|
-
return createRecurry(
|
|
2510
|
-
func,
|
|
2511
|
-
bitmask,
|
|
2512
|
-
createHybrid,
|
|
2513
|
-
wrapper.placeholder,
|
|
2514
|
-
thisArg,
|
|
2515
|
-
args,
|
|
2516
|
-
newHolders,
|
|
2517
|
-
argPos,
|
|
2518
|
-
ary2,
|
|
2519
|
-
arity - length
|
|
2520
|
-
);
|
|
2492
|
+
return createRecurry(func, bitmask, createHybrid, wrapper.placeholder, thisArg, args, newHolders, argPos, ary2, arity - length);
|
|
2521
2493
|
}
|
|
2522
2494
|
var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func;
|
|
2523
2495
|
length = args.length;
|
|
@@ -5084,10 +5056,7 @@ var require_lodash = __commonJS({
|
|
|
5084
5056
|
options = assignInWith({}, options, settings, customDefaultsAssignIn);
|
|
5085
5057
|
var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys);
|
|
5086
5058
|
var isEscaping, isEvaluating, index = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '";
|
|
5087
|
-
var reDelimiters = RegExp2(
|
|
5088
|
-
(options.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$",
|
|
5089
|
-
"g"
|
|
5090
|
-
);
|
|
5059
|
+
var reDelimiters = RegExp2((options.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$", "g");
|
|
5091
5060
|
var sourceURL = "//# sourceURL=" + (hasOwnProperty.call(options, "sourceURL") ? (options.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n";
|
|
5092
5061
|
string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
|
|
5093
5062
|
interpolateValue || (interpolateValue = esTemplateValue);
|
|
@@ -6927,10 +6896,7 @@ var __copyProps2 = /* @__PURE__ */ __name((to, from, except, desc) => {
|
|
|
6927
6896
|
}
|
|
6928
6897
|
return to;
|
|
6929
6898
|
}, "__copyProps");
|
|
6930
|
-
var __toESM2 = /* @__PURE__ */ __name((mod2, isNodeMode, target) => (target = mod2 != null ? __create2(__getProtoOf2(mod2)) : {}, __copyProps2(
|
|
6931
|
-
isNodeMode || !mod2 || !mod2.__esModule ? __defProp3(target, "default", { value: mod2, enumerable: true }) : target,
|
|
6932
|
-
mod2
|
|
6933
|
-
)), "__toESM");
|
|
6899
|
+
var __toESM2 = /* @__PURE__ */ __name((mod2, isNodeMode, target) => (target = mod2 != null ? __create2(__getProtoOf2(mod2)) : {}, __copyProps2(isNodeMode || !mod2 || !mod2.__esModule ? __defProp3(target, "default", { value: mod2, enumerable: true }) : target, mod2)), "__toESM");
|
|
6934
6900
|
var require_types_cjs_development = __commonJS2({
|
|
6935
6901
|
"../learn-card-types/dist/types.cjs.development.js"(exports, module2) {
|
|
6936
6902
|
"use strict";
|
|
@@ -6972,6 +6938,7 @@ var require_types_cjs_development = __commonJS2({
|
|
|
6972
6938
|
CredentialSubjectValidator: () => CredentialSubjectValidator2,
|
|
6973
6939
|
CriteriaValidator: () => CriteriaValidator2,
|
|
6974
6940
|
EncryptedCredentialRecordValidator: () => EncryptedCredentialRecordValidator2,
|
|
6941
|
+
EncryptedRecordValidator: () => EncryptedRecordValidator2,
|
|
6975
6942
|
EndorsementCredentialValidator: () => EndorsementCredentialValidator2,
|
|
6976
6943
|
EndorsementSubjectValidator: () => EndorsementSubjectValidator2,
|
|
6977
6944
|
EvidenceValidator: () => EvidenceValidator2,
|
|
@@ -6997,6 +6964,7 @@ var require_types_cjs_development = __commonJS2({
|
|
|
6997
6964
|
LCNSigningAuthorityForUserValidator: () => LCNSigningAuthorityForUserValidator2,
|
|
6998
6965
|
LCNSigningAuthorityValidator: () => LCNSigningAuthorityValidator2,
|
|
6999
6966
|
PaginatedEncryptedCredentialRecordsValidator: () => PaginatedEncryptedCredentialRecordsValidator2,
|
|
6967
|
+
PaginatedEncryptedRecordsValidator: () => PaginatedEncryptedRecordsValidator2,
|
|
7000
6968
|
PaginationOptionsValidator: () => PaginationOptionsValidator2,
|
|
7001
6969
|
PaginationResponseValidator: () => PaginationResponseValidator2,
|
|
7002
6970
|
ProfileValidator: () => ProfileValidator2,
|
|
@@ -7462,7 +7430,7 @@ var require_types_cjs_development = __commonJS2({
|
|
|
7462
7430
|
var isAborted2 = /* @__PURE__ */ __name22((x) => x.status === "aborted", "isAborted");
|
|
7463
7431
|
var isDirty2 = /* @__PURE__ */ __name22((x) => x.status === "dirty", "isDirty");
|
|
7464
7432
|
var isValid2 = /* @__PURE__ */ __name22((x) => x.status === "valid", "isValid");
|
|
7465
|
-
var isAsync2 = /* @__PURE__ */ __name22((x) => typeof Promise !==
|
|
7433
|
+
var isAsync2 = /* @__PURE__ */ __name22((x) => typeof Promise !== void 0 && x instanceof Promise, "isAsync");
|
|
7466
7434
|
var errorUtil2;
|
|
7467
7435
|
(function(errorUtil22) {
|
|
7468
7436
|
errorUtil22.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
@@ -7682,29 +7650,28 @@ var require_types_cjs_development = __commonJS2({
|
|
|
7682
7650
|
return this._refinement(refinement);
|
|
7683
7651
|
}
|
|
7684
7652
|
optional() {
|
|
7685
|
-
return ZodOptional2.create(this
|
|
7653
|
+
return ZodOptional2.create(this);
|
|
7686
7654
|
}
|
|
7687
7655
|
nullable() {
|
|
7688
|
-
return ZodNullable2.create(this
|
|
7656
|
+
return ZodNullable2.create(this);
|
|
7689
7657
|
}
|
|
7690
7658
|
nullish() {
|
|
7691
|
-
return this.
|
|
7659
|
+
return this.optional().nullable();
|
|
7692
7660
|
}
|
|
7693
7661
|
array() {
|
|
7694
|
-
return ZodArray2.create(this
|
|
7662
|
+
return ZodArray2.create(this);
|
|
7695
7663
|
}
|
|
7696
7664
|
promise() {
|
|
7697
|
-
return ZodPromise2.create(this
|
|
7665
|
+
return ZodPromise2.create(this);
|
|
7698
7666
|
}
|
|
7699
7667
|
or(option) {
|
|
7700
|
-
return ZodUnion2.create([this, option]
|
|
7668
|
+
return ZodUnion2.create([this, option]);
|
|
7701
7669
|
}
|
|
7702
7670
|
and(incoming) {
|
|
7703
|
-
return ZodIntersection2.create(this, incoming
|
|
7671
|
+
return ZodIntersection2.create(this, incoming);
|
|
7704
7672
|
}
|
|
7705
7673
|
transform(transform) {
|
|
7706
7674
|
return new ZodEffects2({
|
|
7707
|
-
...processCreateParams2(this._def),
|
|
7708
7675
|
schema: this,
|
|
7709
7676
|
typeName: ZodFirstPartyTypeKind2.ZodEffects,
|
|
7710
7677
|
effect: { type: "transform", transform }
|
|
@@ -7713,7 +7680,6 @@ var require_types_cjs_development = __commonJS2({
|
|
|
7713
7680
|
default(def) {
|
|
7714
7681
|
const defaultValueFunc = typeof def === "function" ? def : () => def;
|
|
7715
7682
|
return new ZodDefault2({
|
|
7716
|
-
...processCreateParams2(this._def),
|
|
7717
7683
|
innerType: this,
|
|
7718
7684
|
defaultValue: defaultValueFunc,
|
|
7719
7685
|
typeName: ZodFirstPartyTypeKind2.ZodDefault
|
|
@@ -7723,15 +7689,14 @@ var require_types_cjs_development = __commonJS2({
|
|
|
7723
7689
|
return new ZodBranded2({
|
|
7724
7690
|
typeName: ZodFirstPartyTypeKind2.ZodBranded,
|
|
7725
7691
|
type: this,
|
|
7726
|
-
...processCreateParams2(
|
|
7692
|
+
...processCreateParams2(void 0)
|
|
7727
7693
|
});
|
|
7728
7694
|
}
|
|
7729
7695
|
catch(def) {
|
|
7730
|
-
const
|
|
7696
|
+
const defaultValueFunc = typeof def === "function" ? def : () => def;
|
|
7731
7697
|
return new ZodCatch2({
|
|
7732
|
-
...processCreateParams2(this._def),
|
|
7733
7698
|
innerType: this,
|
|
7734
|
-
|
|
7699
|
+
defaultValue: defaultValueFunc,
|
|
7735
7700
|
typeName: ZodFirstPartyTypeKind2.ZodCatch
|
|
7736
7701
|
});
|
|
7737
7702
|
}
|
|
@@ -7754,25 +7719,24 @@ var require_types_cjs_development = __commonJS2({
|
|
|
7754
7719
|
}, "ZodType");
|
|
7755
7720
|
__name22(ZodType2, "ZodType");
|
|
7756
7721
|
var cuidRegex2 = /^c[^\s-]{8,}$/i;
|
|
7757
|
-
var cuid2Regex2 = /^[a-z][a-z0-9]*$/;
|
|
7758
7722
|
var uuidRegex2 = /^([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;
|
|
7759
|
-
var emailRegex2 = /^(([^<>()[\]
|
|
7723
|
+
var emailRegex2 = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;
|
|
7760
7724
|
var datetimeRegex2 = /* @__PURE__ */ __name22((args) => {
|
|
7761
7725
|
if (args.precision) {
|
|
7762
7726
|
if (args.offset) {
|
|
7763
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}
|
|
7727
|
+
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}:\\d{2})|Z)$`);
|
|
7764
7728
|
} else {
|
|
7765
7729
|
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
|
|
7766
7730
|
}
|
|
7767
7731
|
} else if (args.precision === 0) {
|
|
7768
7732
|
if (args.offset) {
|
|
7769
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}
|
|
7733
|
+
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$`);
|
|
7770
7734
|
} else {
|
|
7771
7735
|
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
|
|
7772
7736
|
}
|
|
7773
7737
|
} else {
|
|
7774
7738
|
if (args.offset) {
|
|
7775
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}
|
|
7739
|
+
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$`);
|
|
7776
7740
|
} else {
|
|
7777
7741
|
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
|
|
7778
7742
|
}
|
|
@@ -7799,14 +7763,11 @@ var require_types_cjs_development = __commonJS2({
|
|
|
7799
7763
|
const parsedType = this._getType(input);
|
|
7800
7764
|
if (parsedType !== ZodParsedType2.string) {
|
|
7801
7765
|
const ctx2 = this._getOrReturnCtx(input);
|
|
7802
|
-
addIssueToContext2(
|
|
7803
|
-
|
|
7804
|
-
|
|
7805
|
-
|
|
7806
|
-
|
|
7807
|
-
received: ctx2.parsedType
|
|
7808
|
-
}
|
|
7809
|
-
);
|
|
7766
|
+
addIssueToContext2(ctx2, {
|
|
7767
|
+
code: ZodIssueCode2.invalid_type,
|
|
7768
|
+
expected: ZodParsedType2.string,
|
|
7769
|
+
received: ctx2.parsedType
|
|
7770
|
+
});
|
|
7810
7771
|
return INVALID2;
|
|
7811
7772
|
}
|
|
7812
7773
|
const status = new ParseStatus2();
|
|
@@ -7894,16 +7855,6 @@ var require_types_cjs_development = __commonJS2({
|
|
|
7894
7855
|
});
|
|
7895
7856
|
status.dirty();
|
|
7896
7857
|
}
|
|
7897
|
-
} else if (check.kind === "cuid2") {
|
|
7898
|
-
if (!cuid2Regex2.test(input.data)) {
|
|
7899
|
-
ctx = this._getOrReturnCtx(input, ctx);
|
|
7900
|
-
addIssueToContext2(ctx, {
|
|
7901
|
-
validation: "cuid2",
|
|
7902
|
-
code: ZodIssueCode2.invalid_string,
|
|
7903
|
-
message: check.message
|
|
7904
|
-
});
|
|
7905
|
-
status.dirty();
|
|
7906
|
-
}
|
|
7907
7858
|
} else if (check.kind === "url") {
|
|
7908
7859
|
try {
|
|
7909
7860
|
new URL(input.data);
|
|
@@ -7985,9 +7936,6 @@ var require_types_cjs_development = __commonJS2({
|
|
|
7985
7936
|
cuid(message) {
|
|
7986
7937
|
return this._addCheck({ kind: "cuid", ...errorUtil2.errToObj(message) });
|
|
7987
7938
|
}
|
|
7988
|
-
cuid2(message) {
|
|
7989
|
-
return this._addCheck({ kind: "cuid2", ...errorUtil2.errToObj(message) });
|
|
7990
|
-
}
|
|
7991
7939
|
datetime(options) {
|
|
7992
7940
|
var _a;
|
|
7993
7941
|
if (typeof options === "string") {
|
|
@@ -8062,9 +8010,6 @@ var require_types_cjs_development = __commonJS2({
|
|
|
8062
8010
|
get isCUID() {
|
|
8063
8011
|
return !!this._def.checks.find((ch) => ch.kind === "cuid");
|
|
8064
8012
|
}
|
|
8065
|
-
get isCUID2() {
|
|
8066
|
-
return !!this._def.checks.find((ch) => ch.kind === "cuid2");
|
|
8067
|
-
}
|
|
8068
8013
|
get minLength() {
|
|
8069
8014
|
let min = null;
|
|
8070
8015
|
for (const ch of this._def.checks) {
|
|
@@ -8299,22 +8244,7 @@ var require_types_cjs_development = __commonJS2({
|
|
|
8299
8244
|
return max;
|
|
8300
8245
|
}
|
|
8301
8246
|
get isInt() {
|
|
8302
|
-
return !!this._def.checks.find((ch) => ch.kind === "int"
|
|
8303
|
-
}
|
|
8304
|
-
get isFinite() {
|
|
8305
|
-
let max = null, min = null;
|
|
8306
|
-
for (const ch of this._def.checks) {
|
|
8307
|
-
if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
|
|
8308
|
-
return true;
|
|
8309
|
-
} else if (ch.kind === "min") {
|
|
8310
|
-
if (min === null || ch.value > min)
|
|
8311
|
-
min = ch.value;
|
|
8312
|
-
} else if (ch.kind === "max") {
|
|
8313
|
-
if (max === null || ch.value < max)
|
|
8314
|
-
max = ch.value;
|
|
8315
|
-
}
|
|
8316
|
-
}
|
|
8317
|
-
return Number.isFinite(min) && Number.isFinite(max);
|
|
8247
|
+
return !!this._def.checks.find((ch) => ch.kind === "int");
|
|
8318
8248
|
}
|
|
8319
8249
|
}, "ZodNumber");
|
|
8320
8250
|
__name22(ZodNumber2, "ZodNumber");
|
|
@@ -8682,13 +8612,13 @@ var require_types_cjs_development = __commonJS2({
|
|
|
8682
8612
|
}
|
|
8683
8613
|
}
|
|
8684
8614
|
if (ctx.common.async) {
|
|
8685
|
-
return Promise.all(
|
|
8615
|
+
return Promise.all(ctx.data.map((item, i) => {
|
|
8686
8616
|
return def.type._parseAsync(new ParseInputLazyPath2(ctx, item, ctx.path, i));
|
|
8687
8617
|
})).then((result2) => {
|
|
8688
8618
|
return ParseStatus2.mergeArray(status, result2);
|
|
8689
8619
|
});
|
|
8690
8620
|
}
|
|
8691
|
-
const result =
|
|
8621
|
+
const result = ctx.data.map((item, i) => {
|
|
8692
8622
|
return def.type._parseSync(new ParseInputLazyPath2(ctx, item, ctx.path, i));
|
|
8693
8623
|
});
|
|
8694
8624
|
return ParseStatus2.mergeArray(status, result);
|
|
@@ -8738,6 +8668,15 @@ var require_types_cjs_development = __commonJS2({
|
|
|
8738
8668
|
};
|
|
8739
8669
|
};
|
|
8740
8670
|
})(objectUtil2 || (objectUtil2 = {}));
|
|
8671
|
+
var AugmentFactory2 = /* @__PURE__ */ __name22((def) => (augmentation) => {
|
|
8672
|
+
return new ZodObject2({
|
|
8673
|
+
...def,
|
|
8674
|
+
shape: () => ({
|
|
8675
|
+
...def.shape(),
|
|
8676
|
+
...augmentation
|
|
8677
|
+
})
|
|
8678
|
+
});
|
|
8679
|
+
}, "AugmentFactory");
|
|
8741
8680
|
function deepPartialify2(schema) {
|
|
8742
8681
|
if (schema instanceof ZodObject2) {
|
|
8743
8682
|
const newShape = {};
|
|
@@ -8769,7 +8708,8 @@ var require_types_cjs_development = __commonJS2({
|
|
|
8769
8708
|
super(...arguments);
|
|
8770
8709
|
this._cached = null;
|
|
8771
8710
|
this.nonstrict = this.passthrough;
|
|
8772
|
-
this.augment = this.
|
|
8711
|
+
this.augment = AugmentFactory2(this._def);
|
|
8712
|
+
this.extend = AugmentFactory2(this._def);
|
|
8773
8713
|
}
|
|
8774
8714
|
_getCached() {
|
|
8775
8715
|
if (this._cached !== null)
|
|
@@ -8837,9 +8777,7 @@ var require_types_cjs_development = __commonJS2({
|
|
|
8837
8777
|
const value = ctx.data[key];
|
|
8838
8778
|
pairs.push({
|
|
8839
8779
|
key: { status: "valid", value: key },
|
|
8840
|
-
value: catchall._parse(
|
|
8841
|
-
new ParseInputLazyPath2(ctx, value, ctx.path, key)
|
|
8842
|
-
),
|
|
8780
|
+
value: catchall._parse(new ParseInputLazyPath2(ctx, value, ctx.path, key)),
|
|
8843
8781
|
alwaysSet: key in ctx.data
|
|
8844
8782
|
});
|
|
8845
8783
|
}
|
|
@@ -8898,14 +8836,8 @@ var require_types_cjs_development = __commonJS2({
|
|
|
8898
8836
|
unknownKeys: "passthrough"
|
|
8899
8837
|
});
|
|
8900
8838
|
}
|
|
8901
|
-
|
|
8902
|
-
return
|
|
8903
|
-
...this._def,
|
|
8904
|
-
shape: () => ({
|
|
8905
|
-
...this._def.shape(),
|
|
8906
|
-
...augmentation
|
|
8907
|
-
})
|
|
8908
|
-
});
|
|
8839
|
+
setKey(key, schema) {
|
|
8840
|
+
return this.augment({ [key]: schema });
|
|
8909
8841
|
}
|
|
8910
8842
|
merge(merging) {
|
|
8911
8843
|
const merged = new ZodObject2({
|
|
@@ -8916,9 +8848,6 @@ var require_types_cjs_development = __commonJS2({
|
|
|
8916
8848
|
});
|
|
8917
8849
|
return merged;
|
|
8918
8850
|
}
|
|
8919
|
-
setKey(key, schema) {
|
|
8920
|
-
return this.augment({ [key]: schema });
|
|
8921
|
-
}
|
|
8922
8851
|
catchall(index) {
|
|
8923
8852
|
return new ZodObject2({
|
|
8924
8853
|
...this._def,
|
|
@@ -8927,10 +8856,9 @@ var require_types_cjs_development = __commonJS2({
|
|
|
8927
8856
|
}
|
|
8928
8857
|
pick(mask) {
|
|
8929
8858
|
const shape = {};
|
|
8930
|
-
util2.objectKeys(mask).
|
|
8931
|
-
if (
|
|
8859
|
+
util2.objectKeys(mask).map((key) => {
|
|
8860
|
+
if (this.shape[key])
|
|
8932
8861
|
shape[key] = this.shape[key];
|
|
8933
|
-
}
|
|
8934
8862
|
});
|
|
8935
8863
|
return new ZodObject2({
|
|
8936
8864
|
...this._def,
|
|
@@ -8939,8 +8867,8 @@ var require_types_cjs_development = __commonJS2({
|
|
|
8939
8867
|
}
|
|
8940
8868
|
omit(mask) {
|
|
8941
8869
|
const shape = {};
|
|
8942
|
-
util2.objectKeys(this.shape).
|
|
8943
|
-
if (
|
|
8870
|
+
util2.objectKeys(this.shape).map((key) => {
|
|
8871
|
+
if (util2.objectKeys(mask).indexOf(key) === -1) {
|
|
8944
8872
|
shape[key] = this.shape[key];
|
|
8945
8873
|
}
|
|
8946
8874
|
});
|
|
@@ -8954,14 +8882,24 @@ var require_types_cjs_development = __commonJS2({
|
|
|
8954
8882
|
}
|
|
8955
8883
|
partial(mask) {
|
|
8956
8884
|
const newShape = {};
|
|
8957
|
-
|
|
8958
|
-
|
|
8959
|
-
|
|
8960
|
-
|
|
8961
|
-
|
|
8885
|
+
if (mask) {
|
|
8886
|
+
util2.objectKeys(this.shape).map((key) => {
|
|
8887
|
+
if (util2.objectKeys(mask).indexOf(key) === -1) {
|
|
8888
|
+
newShape[key] = this.shape[key];
|
|
8889
|
+
} else {
|
|
8890
|
+
newShape[key] = this.shape[key].optional();
|
|
8891
|
+
}
|
|
8892
|
+
});
|
|
8893
|
+
return new ZodObject2({
|
|
8894
|
+
...this._def,
|
|
8895
|
+
shape: () => newShape
|
|
8896
|
+
});
|
|
8897
|
+
} else {
|
|
8898
|
+
for (const key in this.shape) {
|
|
8899
|
+
const fieldSchema = this.shape[key];
|
|
8962
8900
|
newShape[key] = fieldSchema.optional();
|
|
8963
8901
|
}
|
|
8964
|
-
}
|
|
8902
|
+
}
|
|
8965
8903
|
return new ZodObject2({
|
|
8966
8904
|
...this._def,
|
|
8967
8905
|
shape: () => newShape
|
|
@@ -8969,10 +8907,21 @@ var require_types_cjs_development = __commonJS2({
|
|
|
8969
8907
|
}
|
|
8970
8908
|
required(mask) {
|
|
8971
8909
|
const newShape = {};
|
|
8972
|
-
|
|
8973
|
-
|
|
8974
|
-
|
|
8975
|
-
|
|
8910
|
+
if (mask) {
|
|
8911
|
+
util2.objectKeys(this.shape).map((key) => {
|
|
8912
|
+
if (util2.objectKeys(mask).indexOf(key) === -1) {
|
|
8913
|
+
newShape[key] = this.shape[key];
|
|
8914
|
+
} else {
|
|
8915
|
+
const fieldSchema = this.shape[key];
|
|
8916
|
+
let newField = fieldSchema;
|
|
8917
|
+
while (newField instanceof ZodOptional2) {
|
|
8918
|
+
newField = newField._def.innerType;
|
|
8919
|
+
}
|
|
8920
|
+
newShape[key] = newField;
|
|
8921
|
+
}
|
|
8922
|
+
});
|
|
8923
|
+
} else {
|
|
8924
|
+
for (const key in this.shape) {
|
|
8976
8925
|
const fieldSchema = this.shape[key];
|
|
8977
8926
|
let newField = fieldSchema;
|
|
8978
8927
|
while (newField instanceof ZodOptional2) {
|
|
@@ -8980,7 +8929,7 @@ var require_types_cjs_development = __commonJS2({
|
|
|
8980
8929
|
}
|
|
8981
8930
|
newShape[key] = newField;
|
|
8982
8931
|
}
|
|
8983
|
-
}
|
|
8932
|
+
}
|
|
8984
8933
|
return new ZodObject2({
|
|
8985
8934
|
...this._def,
|
|
8986
8935
|
shape: () => newShape
|
|
@@ -9330,7 +9279,7 @@ var require_types_cjs_development = __commonJS2({
|
|
|
9330
9279
|
});
|
|
9331
9280
|
status.dirty();
|
|
9332
9281
|
}
|
|
9333
|
-
const items =
|
|
9282
|
+
const items = ctx.data.map((item, itemIndex) => {
|
|
9334
9283
|
const schema = this._def.items[itemIndex] || this._def.rest;
|
|
9335
9284
|
if (!schema)
|
|
9336
9285
|
return null;
|
|
@@ -9712,7 +9661,6 @@ var require_types_cjs_development = __commonJS2({
|
|
|
9712
9661
|
if (input.data !== this._def.value) {
|
|
9713
9662
|
const ctx = this._getOrReturnCtx(input);
|
|
9714
9663
|
addIssueToContext2(ctx, {
|
|
9715
|
-
received: ctx.data,
|
|
9716
9664
|
code: ZodIssueCode2.invalid_literal,
|
|
9717
9665
|
expected: this._def.value
|
|
9718
9666
|
});
|
|
@@ -9790,12 +9738,6 @@ var require_types_cjs_development = __commonJS2({
|
|
|
9790
9738
|
}
|
|
9791
9739
|
return enumValues;
|
|
9792
9740
|
}
|
|
9793
|
-
extract(values) {
|
|
9794
|
-
return ZodEnum2.create(values);
|
|
9795
|
-
}
|
|
9796
|
-
exclude(values) {
|
|
9797
|
-
return ZodEnum2.create(this.options.filter((opt) => !values.includes(opt)));
|
|
9798
|
-
}
|
|
9799
9741
|
}, "ZodEnum");
|
|
9800
9742
|
__name22(ZodEnum2, "ZodEnum");
|
|
9801
9743
|
ZodEnum2.create = createZodEnum2;
|
|
@@ -9836,9 +9778,6 @@ var require_types_cjs_development = __commonJS2({
|
|
|
9836
9778
|
});
|
|
9837
9779
|
};
|
|
9838
9780
|
var ZodPromise2 = /* @__PURE__ */ __name3(class extends ZodType2 {
|
|
9839
|
-
unwrap() {
|
|
9840
|
-
return this._def.type;
|
|
9841
|
-
}
|
|
9842
9781
|
_parse(input) {
|
|
9843
9782
|
const { ctx } = this._processInputParams(input);
|
|
9844
9783
|
if (ctx.parsedType !== ZodParsedType2.promise && ctx.common.async === false) {
|
|
@@ -10057,29 +9996,23 @@ var require_types_cjs_development = __commonJS2({
|
|
|
10057
9996
|
const result = this._def.innerType._parse({
|
|
10058
9997
|
data: ctx.data,
|
|
10059
9998
|
path: ctx.path,
|
|
10060
|
-
parent:
|
|
10061
|
-
...ctx,
|
|
10062
|
-
common: {
|
|
10063
|
-
...ctx.common,
|
|
10064
|
-
issues: []
|
|
10065
|
-
}
|
|
10066
|
-
}
|
|
9999
|
+
parent: ctx
|
|
10067
10000
|
});
|
|
10068
10001
|
if (isAsync2(result)) {
|
|
10069
10002
|
return result.then((result2) => {
|
|
10070
10003
|
return {
|
|
10071
10004
|
status: "valid",
|
|
10072
|
-
value: result2.status === "valid" ? result2.value : this._def.
|
|
10005
|
+
value: result2.status === "valid" ? result2.value : this._def.defaultValue()
|
|
10073
10006
|
};
|
|
10074
10007
|
});
|
|
10075
10008
|
} else {
|
|
10076
10009
|
return {
|
|
10077
10010
|
status: "valid",
|
|
10078
|
-
value: result.status === "valid" ? result.value : this._def.
|
|
10011
|
+
value: result.status === "valid" ? result.value : this._def.defaultValue()
|
|
10079
10012
|
};
|
|
10080
10013
|
}
|
|
10081
10014
|
}
|
|
10082
|
-
|
|
10015
|
+
removeDefault() {
|
|
10083
10016
|
return this._def.innerType;
|
|
10084
10017
|
}
|
|
10085
10018
|
}, "ZodCatch");
|
|
@@ -10088,7 +10021,7 @@ var require_types_cjs_development = __commonJS2({
|
|
|
10088
10021
|
return new ZodCatch2({
|
|
10089
10022
|
innerType: type,
|
|
10090
10023
|
typeName: ZodFirstPartyTypeKind2.ZodCatch,
|
|
10091
|
-
|
|
10024
|
+
defaultValue: typeof params.default === "function" ? params.default : () => params.default,
|
|
10092
10025
|
...processCreateParams2(params)
|
|
10093
10026
|
});
|
|
10094
10027
|
};
|
|
@@ -10281,10 +10214,7 @@ var require_types_cjs_development = __commonJS2({
|
|
|
10281
10214
|
var coerce2 = {
|
|
10282
10215
|
string: (arg) => ZodString2.create({ ...arg, coerce: true }),
|
|
10283
10216
|
number: (arg) => ZodNumber2.create({ ...arg, coerce: true }),
|
|
10284
|
-
boolean: (arg) => ZodBoolean2.create({
|
|
10285
|
-
...arg,
|
|
10286
|
-
coerce: true
|
|
10287
|
-
}),
|
|
10217
|
+
boolean: (arg) => ZodBoolean2.create({ ...arg, coerce: true }),
|
|
10288
10218
|
bigint: (arg) => ZodBigInt2.create({ ...arg, coerce: true }),
|
|
10289
10219
|
date: (arg) => ZodDate2.create({ ...arg, coerce: true })
|
|
10290
10220
|
};
|
|
@@ -10408,13 +10338,11 @@ var require_types_cjs_development = __commonJS2({
|
|
|
10408
10338
|
type: mod2.string().optional(),
|
|
10409
10339
|
narrative: mod2.string().optional()
|
|
10410
10340
|
});
|
|
10411
|
-
var ImageValidator2 = mod2.string().or(
|
|
10412
|
-
mod2.
|
|
10413
|
-
|
|
10414
|
-
|
|
10415
|
-
|
|
10416
|
-
})
|
|
10417
|
-
);
|
|
10341
|
+
var ImageValidator2 = mod2.string().or(mod2.object({
|
|
10342
|
+
id: mod2.string(),
|
|
10343
|
+
type: mod2.string(),
|
|
10344
|
+
caption: mod2.string().optional()
|
|
10345
|
+
}));
|
|
10418
10346
|
var GeoCoordinatesValidator2 = mod2.object({
|
|
10419
10347
|
type: mod2.string().min(1).or(mod2.string().array().nonempty()),
|
|
10420
10348
|
latitude: mod2.number(),
|
|
@@ -10456,31 +10384,29 @@ var require_types_cjs_development = __commonJS2({
|
|
|
10456
10384
|
identifier: mod2.string(),
|
|
10457
10385
|
identifierType: IdentifierTypeValidator2
|
|
10458
10386
|
});
|
|
10459
|
-
var ProfileValidator2 = mod2.string().or(
|
|
10460
|
-
mod2.
|
|
10461
|
-
|
|
10462
|
-
|
|
10463
|
-
|
|
10464
|
-
|
|
10465
|
-
|
|
10466
|
-
|
|
10467
|
-
|
|
10468
|
-
|
|
10469
|
-
|
|
10470
|
-
|
|
10471
|
-
|
|
10472
|
-
|
|
10473
|
-
|
|
10474
|
-
|
|
10475
|
-
|
|
10476
|
-
|
|
10477
|
-
|
|
10478
|
-
|
|
10479
|
-
|
|
10480
|
-
|
|
10481
|
-
|
|
10482
|
-
}).catchall(mod2.any())
|
|
10483
|
-
);
|
|
10387
|
+
var ProfileValidator2 = mod2.string().or(mod2.object({
|
|
10388
|
+
id: mod2.string().optional(),
|
|
10389
|
+
type: mod2.string().or(mod2.string().array().nonempty().optional()),
|
|
10390
|
+
name: mod2.string().optional(),
|
|
10391
|
+
url: mod2.string().optional(),
|
|
10392
|
+
phone: mod2.string().optional(),
|
|
10393
|
+
description: mod2.string().optional(),
|
|
10394
|
+
endorsement: mod2.any().array().optional(),
|
|
10395
|
+
image: ImageValidator2.optional(),
|
|
10396
|
+
email: mod2.string().email().optional(),
|
|
10397
|
+
address: AddressValidator2.optional(),
|
|
10398
|
+
otherIdentifier: IdentifierEntryValidator2.array().optional(),
|
|
10399
|
+
official: mod2.string().optional(),
|
|
10400
|
+
parentOrg: mod2.any().optional(),
|
|
10401
|
+
familyName: mod2.string().optional(),
|
|
10402
|
+
givenName: mod2.string().optional(),
|
|
10403
|
+
additionalName: mod2.string().optional(),
|
|
10404
|
+
patronymicName: mod2.string().optional(),
|
|
10405
|
+
honorificPrefix: mod2.string().optional(),
|
|
10406
|
+
honorificSuffix: mod2.string().optional(),
|
|
10407
|
+
familyNamePrefix: mod2.string().optional(),
|
|
10408
|
+
dateOfBirth: mod2.string().optional()
|
|
10409
|
+
}).catchall(mod2.any()));
|
|
10484
10410
|
var CredentialSubjectValidator2 = mod2.object({ id: mod2.string().optional() }).catchall(mod2.any());
|
|
10485
10411
|
var CredentialStatusValidator2 = mod2.object({ type: mod2.string(), id: mod2.string() });
|
|
10486
10412
|
var CredentialSchemaValidator2 = mod2.object({ id: mod2.string(), type: mod2.string() });
|
|
@@ -10762,11 +10688,13 @@ var require_types_cjs_development = __commonJS2({
|
|
|
10762
10688
|
aad: mod2.string().optional(),
|
|
10763
10689
|
recipients: JWERecipientValidator2.array().optional()
|
|
10764
10690
|
});
|
|
10765
|
-
var
|
|
10766
|
-
|
|
10767
|
-
|
|
10691
|
+
var EncryptedRecordValidator2 = mod2.object({ encryptedRecord: JWEValidator2, fields: mod2.string().array() }).catchall(mod2.any());
|
|
10692
|
+
var PaginatedEncryptedRecordsValidator2 = PaginationResponseValidator2.extend({
|
|
10693
|
+
records: EncryptedRecordValidator2.array()
|
|
10694
|
+
});
|
|
10695
|
+
var EncryptedCredentialRecordValidator2 = EncryptedRecordValidator2.extend({
|
|
10768
10696
|
id: mod2.string()
|
|
10769
|
-
})
|
|
10697
|
+
});
|
|
10770
10698
|
var PaginatedEncryptedCredentialRecordsValidator2 = PaginationResponseValidator2.extend({
|
|
10771
10699
|
records: EncryptedCredentialRecordValidator2.array()
|
|
10772
10700
|
});
|
|
@@ -10869,7 +10797,7 @@ var isEncrypted = /* @__PURE__ */ __name3((item) => {
|
|
|
10869
10797
|
return import_types.JWEValidator.safeParse(item).success;
|
|
10870
10798
|
}, "isEncrypted");
|
|
10871
10799
|
|
|
10872
|
-
// ../../../node_modules/.pnpm/zod@3.20.
|
|
10800
|
+
// ../../../node_modules/.pnpm/zod@3.20.2/node_modules/zod/lib/index.mjs
|
|
10873
10801
|
var util;
|
|
10874
10802
|
(function(util2) {
|
|
10875
10803
|
util2.assertEqual = (val) => val;
|
|
@@ -11300,7 +11228,7 @@ var OK = /* @__PURE__ */ __name((value) => ({ status: "valid", value }), "OK");
|
|
|
11300
11228
|
var isAborted = /* @__PURE__ */ __name((x) => x.status === "aborted", "isAborted");
|
|
11301
11229
|
var isDirty = /* @__PURE__ */ __name((x) => x.status === "dirty", "isDirty");
|
|
11302
11230
|
var isValid = /* @__PURE__ */ __name((x) => x.status === "valid", "isValid");
|
|
11303
|
-
var isAsync = /* @__PURE__ */ __name((x) => typeof Promise !==
|
|
11231
|
+
var isAsync = /* @__PURE__ */ __name((x) => typeof Promise !== void 0 && x instanceof Promise, "isAsync");
|
|
11304
11232
|
var errorUtil;
|
|
11305
11233
|
(function(errorUtil2) {
|
|
11306
11234
|
errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
@@ -11518,29 +11446,28 @@ var ZodType = class {
|
|
|
11518
11446
|
return this._refinement(refinement);
|
|
11519
11447
|
}
|
|
11520
11448
|
optional() {
|
|
11521
|
-
return ZodOptional.create(this
|
|
11449
|
+
return ZodOptional.create(this);
|
|
11522
11450
|
}
|
|
11523
11451
|
nullable() {
|
|
11524
|
-
return ZodNullable.create(this
|
|
11452
|
+
return ZodNullable.create(this);
|
|
11525
11453
|
}
|
|
11526
11454
|
nullish() {
|
|
11527
|
-
return this.
|
|
11455
|
+
return this.optional().nullable();
|
|
11528
11456
|
}
|
|
11529
11457
|
array() {
|
|
11530
|
-
return ZodArray.create(this
|
|
11458
|
+
return ZodArray.create(this);
|
|
11531
11459
|
}
|
|
11532
11460
|
promise() {
|
|
11533
|
-
return ZodPromise.create(this
|
|
11461
|
+
return ZodPromise.create(this);
|
|
11534
11462
|
}
|
|
11535
11463
|
or(option) {
|
|
11536
|
-
return ZodUnion.create([this, option]
|
|
11464
|
+
return ZodUnion.create([this, option]);
|
|
11537
11465
|
}
|
|
11538
11466
|
and(incoming) {
|
|
11539
|
-
return ZodIntersection.create(this, incoming
|
|
11467
|
+
return ZodIntersection.create(this, incoming);
|
|
11540
11468
|
}
|
|
11541
11469
|
transform(transform) {
|
|
11542
11470
|
return new ZodEffects({
|
|
11543
|
-
...processCreateParams(this._def),
|
|
11544
11471
|
schema: this,
|
|
11545
11472
|
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
|
11546
11473
|
effect: { type: "transform", transform }
|
|
@@ -11549,7 +11476,6 @@ var ZodType = class {
|
|
|
11549
11476
|
default(def) {
|
|
11550
11477
|
const defaultValueFunc = typeof def === "function" ? def : () => def;
|
|
11551
11478
|
return new ZodDefault({
|
|
11552
|
-
...processCreateParams(this._def),
|
|
11553
11479
|
innerType: this,
|
|
11554
11480
|
defaultValue: defaultValueFunc,
|
|
11555
11481
|
typeName: ZodFirstPartyTypeKind.ZodDefault
|
|
@@ -11559,15 +11485,14 @@ var ZodType = class {
|
|
|
11559
11485
|
return new ZodBranded({
|
|
11560
11486
|
typeName: ZodFirstPartyTypeKind.ZodBranded,
|
|
11561
11487
|
type: this,
|
|
11562
|
-
...processCreateParams(
|
|
11488
|
+
...processCreateParams(void 0)
|
|
11563
11489
|
});
|
|
11564
11490
|
}
|
|
11565
11491
|
catch(def) {
|
|
11566
|
-
const
|
|
11492
|
+
const defaultValueFunc = typeof def === "function" ? def : () => def;
|
|
11567
11493
|
return new ZodCatch({
|
|
11568
|
-
...processCreateParams(this._def),
|
|
11569
11494
|
innerType: this,
|
|
11570
|
-
|
|
11495
|
+
defaultValue: defaultValueFunc,
|
|
11571
11496
|
typeName: ZodFirstPartyTypeKind.ZodCatch
|
|
11572
11497
|
});
|
|
11573
11498
|
}
|
|
@@ -11590,25 +11515,24 @@ var ZodType = class {
|
|
|
11590
11515
|
};
|
|
11591
11516
|
__name(ZodType, "ZodType");
|
|
11592
11517
|
var cuidRegex = /^c[^\s-]{8,}$/i;
|
|
11593
|
-
var cuid2Regex = /^[a-z][a-z0-9]*$/;
|
|
11594
11518
|
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;
|
|
11595
|
-
var emailRegex = /^(([^<>()[\]
|
|
11519
|
+
var emailRegex = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;
|
|
11596
11520
|
var datetimeRegex = /* @__PURE__ */ __name((args) => {
|
|
11597
11521
|
if (args.precision) {
|
|
11598
11522
|
if (args.offset) {
|
|
11599
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}
|
|
11523
|
+
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}:\\d{2})|Z)$`);
|
|
11600
11524
|
} else {
|
|
11601
11525
|
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
|
|
11602
11526
|
}
|
|
11603
11527
|
} else if (args.precision === 0) {
|
|
11604
11528
|
if (args.offset) {
|
|
11605
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}
|
|
11529
|
+
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$`);
|
|
11606
11530
|
} else {
|
|
11607
11531
|
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
|
|
11608
11532
|
}
|
|
11609
11533
|
} else {
|
|
11610
11534
|
if (args.offset) {
|
|
11611
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}
|
|
11535
|
+
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$`);
|
|
11612
11536
|
} else {
|
|
11613
11537
|
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
|
|
11614
11538
|
}
|
|
@@ -11635,14 +11559,11 @@ var ZodString = class extends ZodType {
|
|
|
11635
11559
|
const parsedType = this._getType(input);
|
|
11636
11560
|
if (parsedType !== ZodParsedType.string) {
|
|
11637
11561
|
const ctx2 = this._getOrReturnCtx(input);
|
|
11638
|
-
addIssueToContext(
|
|
11639
|
-
|
|
11640
|
-
|
|
11641
|
-
|
|
11642
|
-
|
|
11643
|
-
received: ctx2.parsedType
|
|
11644
|
-
}
|
|
11645
|
-
);
|
|
11562
|
+
addIssueToContext(ctx2, {
|
|
11563
|
+
code: ZodIssueCode.invalid_type,
|
|
11564
|
+
expected: ZodParsedType.string,
|
|
11565
|
+
received: ctx2.parsedType
|
|
11566
|
+
});
|
|
11646
11567
|
return INVALID;
|
|
11647
11568
|
}
|
|
11648
11569
|
const status = new ParseStatus();
|
|
@@ -11730,16 +11651,6 @@ var ZodString = class extends ZodType {
|
|
|
11730
11651
|
});
|
|
11731
11652
|
status.dirty();
|
|
11732
11653
|
}
|
|
11733
|
-
} else if (check.kind === "cuid2") {
|
|
11734
|
-
if (!cuid2Regex.test(input.data)) {
|
|
11735
|
-
ctx = this._getOrReturnCtx(input, ctx);
|
|
11736
|
-
addIssueToContext(ctx, {
|
|
11737
|
-
validation: "cuid2",
|
|
11738
|
-
code: ZodIssueCode.invalid_string,
|
|
11739
|
-
message: check.message
|
|
11740
|
-
});
|
|
11741
|
-
status.dirty();
|
|
11742
|
-
}
|
|
11743
11654
|
} else if (check.kind === "url") {
|
|
11744
11655
|
try {
|
|
11745
11656
|
new URL(input.data);
|
|
@@ -11821,9 +11732,6 @@ var ZodString = class extends ZodType {
|
|
|
11821
11732
|
cuid(message) {
|
|
11822
11733
|
return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
|
|
11823
11734
|
}
|
|
11824
|
-
cuid2(message) {
|
|
11825
|
-
return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
|
|
11826
|
-
}
|
|
11827
11735
|
datetime(options) {
|
|
11828
11736
|
var _a;
|
|
11829
11737
|
if (typeof options === "string") {
|
|
@@ -11898,9 +11806,6 @@ var ZodString = class extends ZodType {
|
|
|
11898
11806
|
get isCUID() {
|
|
11899
11807
|
return !!this._def.checks.find((ch) => ch.kind === "cuid");
|
|
11900
11808
|
}
|
|
11901
|
-
get isCUID2() {
|
|
11902
|
-
return !!this._def.checks.find((ch) => ch.kind === "cuid2");
|
|
11903
|
-
}
|
|
11904
11809
|
get minLength() {
|
|
11905
11810
|
let min = null;
|
|
11906
11811
|
for (const ch of this._def.checks) {
|
|
@@ -12133,22 +12038,7 @@ var ZodNumber = class extends ZodType {
|
|
|
12133
12038
|
return max;
|
|
12134
12039
|
}
|
|
12135
12040
|
get isInt() {
|
|
12136
|
-
return !!this._def.checks.find((ch) => ch.kind === "int"
|
|
12137
|
-
}
|
|
12138
|
-
get isFinite() {
|
|
12139
|
-
let max = null, min = null;
|
|
12140
|
-
for (const ch of this._def.checks) {
|
|
12141
|
-
if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
|
|
12142
|
-
return true;
|
|
12143
|
-
} else if (ch.kind === "min") {
|
|
12144
|
-
if (min === null || ch.value > min)
|
|
12145
|
-
min = ch.value;
|
|
12146
|
-
} else if (ch.kind === "max") {
|
|
12147
|
-
if (max === null || ch.value < max)
|
|
12148
|
-
max = ch.value;
|
|
12149
|
-
}
|
|
12150
|
-
}
|
|
12151
|
-
return Number.isFinite(min) && Number.isFinite(max);
|
|
12041
|
+
return !!this._def.checks.find((ch) => ch.kind === "int");
|
|
12152
12042
|
}
|
|
12153
12043
|
};
|
|
12154
12044
|
__name(ZodNumber, "ZodNumber");
|
|
@@ -12516,13 +12406,13 @@ var ZodArray = class extends ZodType {
|
|
|
12516
12406
|
}
|
|
12517
12407
|
}
|
|
12518
12408
|
if (ctx.common.async) {
|
|
12519
|
-
return Promise.all(
|
|
12409
|
+
return Promise.all(ctx.data.map((item, i) => {
|
|
12520
12410
|
return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
|
|
12521
12411
|
})).then((result2) => {
|
|
12522
12412
|
return ParseStatus.mergeArray(status, result2);
|
|
12523
12413
|
});
|
|
12524
12414
|
}
|
|
12525
|
-
const result =
|
|
12415
|
+
const result = ctx.data.map((item, i) => {
|
|
12526
12416
|
return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
|
|
12527
12417
|
});
|
|
12528
12418
|
return ParseStatus.mergeArray(status, result);
|
|
@@ -12572,6 +12462,15 @@ var objectUtil;
|
|
|
12572
12462
|
};
|
|
12573
12463
|
};
|
|
12574
12464
|
})(objectUtil || (objectUtil = {}));
|
|
12465
|
+
var AugmentFactory = /* @__PURE__ */ __name((def) => (augmentation) => {
|
|
12466
|
+
return new ZodObject({
|
|
12467
|
+
...def,
|
|
12468
|
+
shape: () => ({
|
|
12469
|
+
...def.shape(),
|
|
12470
|
+
...augmentation
|
|
12471
|
+
})
|
|
12472
|
+
});
|
|
12473
|
+
}, "AugmentFactory");
|
|
12575
12474
|
function deepPartialify(schema) {
|
|
12576
12475
|
if (schema instanceof ZodObject) {
|
|
12577
12476
|
const newShape = {};
|
|
@@ -12601,7 +12500,8 @@ var ZodObject = class extends ZodType {
|
|
|
12601
12500
|
super(...arguments);
|
|
12602
12501
|
this._cached = null;
|
|
12603
12502
|
this.nonstrict = this.passthrough;
|
|
12604
|
-
this.augment = this.
|
|
12503
|
+
this.augment = AugmentFactory(this._def);
|
|
12504
|
+
this.extend = AugmentFactory(this._def);
|
|
12605
12505
|
}
|
|
12606
12506
|
_getCached() {
|
|
12607
12507
|
if (this._cached !== null)
|
|
@@ -12669,9 +12569,7 @@ var ZodObject = class extends ZodType {
|
|
|
12669
12569
|
const value = ctx.data[key];
|
|
12670
12570
|
pairs.push({
|
|
12671
12571
|
key: { status: "valid", value: key },
|
|
12672
|
-
value: catchall._parse(
|
|
12673
|
-
new ParseInputLazyPath(ctx, value, ctx.path, key)
|
|
12674
|
-
),
|
|
12572
|
+
value: catchall._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
|
|
12675
12573
|
alwaysSet: key in ctx.data
|
|
12676
12574
|
});
|
|
12677
12575
|
}
|
|
@@ -12730,14 +12628,8 @@ var ZodObject = class extends ZodType {
|
|
|
12730
12628
|
unknownKeys: "passthrough"
|
|
12731
12629
|
});
|
|
12732
12630
|
}
|
|
12733
|
-
|
|
12734
|
-
return
|
|
12735
|
-
...this._def,
|
|
12736
|
-
shape: () => ({
|
|
12737
|
-
...this._def.shape(),
|
|
12738
|
-
...augmentation
|
|
12739
|
-
})
|
|
12740
|
-
});
|
|
12631
|
+
setKey(key, schema) {
|
|
12632
|
+
return this.augment({ [key]: schema });
|
|
12741
12633
|
}
|
|
12742
12634
|
merge(merging) {
|
|
12743
12635
|
const merged = new ZodObject({
|
|
@@ -12748,9 +12640,6 @@ var ZodObject = class extends ZodType {
|
|
|
12748
12640
|
});
|
|
12749
12641
|
return merged;
|
|
12750
12642
|
}
|
|
12751
|
-
setKey(key, schema) {
|
|
12752
|
-
return this.augment({ [key]: schema });
|
|
12753
|
-
}
|
|
12754
12643
|
catchall(index) {
|
|
12755
12644
|
return new ZodObject({
|
|
12756
12645
|
...this._def,
|
|
@@ -12759,10 +12648,9 @@ var ZodObject = class extends ZodType {
|
|
|
12759
12648
|
}
|
|
12760
12649
|
pick(mask) {
|
|
12761
12650
|
const shape = {};
|
|
12762
|
-
util.objectKeys(mask).
|
|
12763
|
-
if (
|
|
12651
|
+
util.objectKeys(mask).map((key) => {
|
|
12652
|
+
if (this.shape[key])
|
|
12764
12653
|
shape[key] = this.shape[key];
|
|
12765
|
-
}
|
|
12766
12654
|
});
|
|
12767
12655
|
return new ZodObject({
|
|
12768
12656
|
...this._def,
|
|
@@ -12771,8 +12659,8 @@ var ZodObject = class extends ZodType {
|
|
|
12771
12659
|
}
|
|
12772
12660
|
omit(mask) {
|
|
12773
12661
|
const shape = {};
|
|
12774
|
-
util.objectKeys(this.shape).
|
|
12775
|
-
if (
|
|
12662
|
+
util.objectKeys(this.shape).map((key) => {
|
|
12663
|
+
if (util.objectKeys(mask).indexOf(key) === -1) {
|
|
12776
12664
|
shape[key] = this.shape[key];
|
|
12777
12665
|
}
|
|
12778
12666
|
});
|
|
@@ -12786,14 +12674,24 @@ var ZodObject = class extends ZodType {
|
|
|
12786
12674
|
}
|
|
12787
12675
|
partial(mask) {
|
|
12788
12676
|
const newShape = {};
|
|
12789
|
-
|
|
12790
|
-
|
|
12791
|
-
|
|
12792
|
-
|
|
12793
|
-
|
|
12677
|
+
if (mask) {
|
|
12678
|
+
util.objectKeys(this.shape).map((key) => {
|
|
12679
|
+
if (util.objectKeys(mask).indexOf(key) === -1) {
|
|
12680
|
+
newShape[key] = this.shape[key];
|
|
12681
|
+
} else {
|
|
12682
|
+
newShape[key] = this.shape[key].optional();
|
|
12683
|
+
}
|
|
12684
|
+
});
|
|
12685
|
+
return new ZodObject({
|
|
12686
|
+
...this._def,
|
|
12687
|
+
shape: () => newShape
|
|
12688
|
+
});
|
|
12689
|
+
} else {
|
|
12690
|
+
for (const key in this.shape) {
|
|
12691
|
+
const fieldSchema = this.shape[key];
|
|
12794
12692
|
newShape[key] = fieldSchema.optional();
|
|
12795
12693
|
}
|
|
12796
|
-
}
|
|
12694
|
+
}
|
|
12797
12695
|
return new ZodObject({
|
|
12798
12696
|
...this._def,
|
|
12799
12697
|
shape: () => newShape
|
|
@@ -12801,10 +12699,21 @@ var ZodObject = class extends ZodType {
|
|
|
12801
12699
|
}
|
|
12802
12700
|
required(mask) {
|
|
12803
12701
|
const newShape = {};
|
|
12804
|
-
|
|
12805
|
-
|
|
12806
|
-
|
|
12807
|
-
|
|
12702
|
+
if (mask) {
|
|
12703
|
+
util.objectKeys(this.shape).map((key) => {
|
|
12704
|
+
if (util.objectKeys(mask).indexOf(key) === -1) {
|
|
12705
|
+
newShape[key] = this.shape[key];
|
|
12706
|
+
} else {
|
|
12707
|
+
const fieldSchema = this.shape[key];
|
|
12708
|
+
let newField = fieldSchema;
|
|
12709
|
+
while (newField instanceof ZodOptional) {
|
|
12710
|
+
newField = newField._def.innerType;
|
|
12711
|
+
}
|
|
12712
|
+
newShape[key] = newField;
|
|
12713
|
+
}
|
|
12714
|
+
});
|
|
12715
|
+
} else {
|
|
12716
|
+
for (const key in this.shape) {
|
|
12808
12717
|
const fieldSchema = this.shape[key];
|
|
12809
12718
|
let newField = fieldSchema;
|
|
12810
12719
|
while (newField instanceof ZodOptional) {
|
|
@@ -12812,7 +12721,7 @@ var ZodObject = class extends ZodType {
|
|
|
12812
12721
|
}
|
|
12813
12722
|
newShape[key] = newField;
|
|
12814
12723
|
}
|
|
12815
|
-
}
|
|
12724
|
+
}
|
|
12816
12725
|
return new ZodObject({
|
|
12817
12726
|
...this._def,
|
|
12818
12727
|
shape: () => newShape
|
|
@@ -13158,7 +13067,7 @@ var ZodTuple = class extends ZodType {
|
|
|
13158
13067
|
});
|
|
13159
13068
|
status.dirty();
|
|
13160
13069
|
}
|
|
13161
|
-
const items =
|
|
13070
|
+
const items = ctx.data.map((item, itemIndex) => {
|
|
13162
13071
|
const schema = this._def.items[itemIndex] || this._def.rest;
|
|
13163
13072
|
if (!schema)
|
|
13164
13073
|
return null;
|
|
@@ -13534,7 +13443,6 @@ var ZodLiteral = class extends ZodType {
|
|
|
13534
13443
|
if (input.data !== this._def.value) {
|
|
13535
13444
|
const ctx = this._getOrReturnCtx(input);
|
|
13536
13445
|
addIssueToContext(ctx, {
|
|
13537
|
-
received: ctx.data,
|
|
13538
13446
|
code: ZodIssueCode.invalid_literal,
|
|
13539
13447
|
expected: this._def.value
|
|
13540
13448
|
});
|
|
@@ -13610,12 +13518,6 @@ var ZodEnum = class extends ZodType {
|
|
|
13610
13518
|
}
|
|
13611
13519
|
return enumValues;
|
|
13612
13520
|
}
|
|
13613
|
-
extract(values) {
|
|
13614
|
-
return ZodEnum.create(values);
|
|
13615
|
-
}
|
|
13616
|
-
exclude(values) {
|
|
13617
|
-
return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)));
|
|
13618
|
-
}
|
|
13619
13521
|
};
|
|
13620
13522
|
__name(ZodEnum, "ZodEnum");
|
|
13621
13523
|
ZodEnum.create = createZodEnum;
|
|
@@ -13656,9 +13558,6 @@ ZodNativeEnum.create = (values, params) => {
|
|
|
13656
13558
|
});
|
|
13657
13559
|
};
|
|
13658
13560
|
var ZodPromise = class extends ZodType {
|
|
13659
|
-
unwrap() {
|
|
13660
|
-
return this._def.type;
|
|
13661
|
-
}
|
|
13662
13561
|
_parse(input) {
|
|
13663
13562
|
const { ctx } = this._processInputParams(input);
|
|
13664
13563
|
if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
|
|
@@ -13877,29 +13776,23 @@ var ZodCatch = class extends ZodType {
|
|
|
13877
13776
|
const result = this._def.innerType._parse({
|
|
13878
13777
|
data: ctx.data,
|
|
13879
13778
|
path: ctx.path,
|
|
13880
|
-
parent:
|
|
13881
|
-
...ctx,
|
|
13882
|
-
common: {
|
|
13883
|
-
...ctx.common,
|
|
13884
|
-
issues: []
|
|
13885
|
-
}
|
|
13886
|
-
}
|
|
13779
|
+
parent: ctx
|
|
13887
13780
|
});
|
|
13888
13781
|
if (isAsync(result)) {
|
|
13889
13782
|
return result.then((result2) => {
|
|
13890
13783
|
return {
|
|
13891
13784
|
status: "valid",
|
|
13892
|
-
value: result2.status === "valid" ? result2.value : this._def.
|
|
13785
|
+
value: result2.status === "valid" ? result2.value : this._def.defaultValue()
|
|
13893
13786
|
};
|
|
13894
13787
|
});
|
|
13895
13788
|
} else {
|
|
13896
13789
|
return {
|
|
13897
13790
|
status: "valid",
|
|
13898
|
-
value: result.status === "valid" ? result.value : this._def.
|
|
13791
|
+
value: result.status === "valid" ? result.value : this._def.defaultValue()
|
|
13899
13792
|
};
|
|
13900
13793
|
}
|
|
13901
13794
|
}
|
|
13902
|
-
|
|
13795
|
+
removeDefault() {
|
|
13903
13796
|
return this._def.innerType;
|
|
13904
13797
|
}
|
|
13905
13798
|
};
|
|
@@ -13908,7 +13801,7 @@ ZodCatch.create = (type, params) => {
|
|
|
13908
13801
|
return new ZodCatch({
|
|
13909
13802
|
innerType: type,
|
|
13910
13803
|
typeName: ZodFirstPartyTypeKind.ZodCatch,
|
|
13911
|
-
|
|
13804
|
+
defaultValue: typeof params.default === "function" ? params.default : () => params.default,
|
|
13912
13805
|
...processCreateParams(params)
|
|
13913
13806
|
});
|
|
13914
13807
|
};
|
|
@@ -14101,10 +13994,7 @@ var oboolean = /* @__PURE__ */ __name(() => booleanType().optional(), "oboolean"
|
|
|
14101
13994
|
var coerce = {
|
|
14102
13995
|
string: (arg) => ZodString.create({ ...arg, coerce: true }),
|
|
14103
13996
|
number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
|
|
14104
|
-
boolean: (arg) => ZodBoolean.create({
|
|
14105
|
-
...arg,
|
|
14106
|
-
coerce: true
|
|
14107
|
-
}),
|
|
13997
|
+
boolean: (arg) => ZodBoolean.create({ ...arg, coerce: true }),
|
|
14108
13998
|
bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
|
|
14109
13999
|
date: (arg) => ZodDate.create({ ...arg, coerce: true })
|
|
14110
14000
|
};
|
|
@@ -14230,13 +14120,11 @@ var AchievementCriteriaValidator = mod.object({
|
|
|
14230
14120
|
type: mod.string().optional(),
|
|
14231
14121
|
narrative: mod.string().optional()
|
|
14232
14122
|
});
|
|
14233
|
-
var ImageValidator = mod.string().or(
|
|
14234
|
-
mod.
|
|
14235
|
-
|
|
14236
|
-
|
|
14237
|
-
|
|
14238
|
-
})
|
|
14239
|
-
);
|
|
14123
|
+
var ImageValidator = mod.string().or(mod.object({
|
|
14124
|
+
id: mod.string(),
|
|
14125
|
+
type: mod.string(),
|
|
14126
|
+
caption: mod.string().optional()
|
|
14127
|
+
}));
|
|
14240
14128
|
var GeoCoordinatesValidator = mod.object({
|
|
14241
14129
|
type: mod.string().min(1).or(mod.string().array().nonempty()),
|
|
14242
14130
|
latitude: mod.number(),
|
|
@@ -14278,31 +14166,29 @@ var IdentifierEntryValidator = mod.object({
|
|
|
14278
14166
|
identifier: mod.string(),
|
|
14279
14167
|
identifierType: IdentifierTypeValidator
|
|
14280
14168
|
});
|
|
14281
|
-
var ProfileValidator = mod.string().or(
|
|
14282
|
-
mod.
|
|
14283
|
-
|
|
14284
|
-
|
|
14285
|
-
|
|
14286
|
-
|
|
14287
|
-
|
|
14288
|
-
|
|
14289
|
-
|
|
14290
|
-
|
|
14291
|
-
|
|
14292
|
-
|
|
14293
|
-
|
|
14294
|
-
|
|
14295
|
-
|
|
14296
|
-
|
|
14297
|
-
|
|
14298
|
-
|
|
14299
|
-
|
|
14300
|
-
|
|
14301
|
-
|
|
14302
|
-
|
|
14303
|
-
|
|
14304
|
-
}).catchall(mod.any())
|
|
14305
|
-
);
|
|
14169
|
+
var ProfileValidator = mod.string().or(mod.object({
|
|
14170
|
+
id: mod.string().optional(),
|
|
14171
|
+
type: mod.string().or(mod.string().array().nonempty().optional()),
|
|
14172
|
+
name: mod.string().optional(),
|
|
14173
|
+
url: mod.string().optional(),
|
|
14174
|
+
phone: mod.string().optional(),
|
|
14175
|
+
description: mod.string().optional(),
|
|
14176
|
+
endorsement: mod.any().array().optional(),
|
|
14177
|
+
image: ImageValidator.optional(),
|
|
14178
|
+
email: mod.string().email().optional(),
|
|
14179
|
+
address: AddressValidator.optional(),
|
|
14180
|
+
otherIdentifier: IdentifierEntryValidator.array().optional(),
|
|
14181
|
+
official: mod.string().optional(),
|
|
14182
|
+
parentOrg: mod.any().optional(),
|
|
14183
|
+
familyName: mod.string().optional(),
|
|
14184
|
+
givenName: mod.string().optional(),
|
|
14185
|
+
additionalName: mod.string().optional(),
|
|
14186
|
+
patronymicName: mod.string().optional(),
|
|
14187
|
+
honorificPrefix: mod.string().optional(),
|
|
14188
|
+
honorificSuffix: mod.string().optional(),
|
|
14189
|
+
familyNamePrefix: mod.string().optional(),
|
|
14190
|
+
dateOfBirth: mod.string().optional()
|
|
14191
|
+
}).catchall(mod.any()));
|
|
14306
14192
|
var CredentialSubjectValidator = mod.object({ id: mod.string().optional() }).catchall(mod.any());
|
|
14307
14193
|
var CredentialStatusValidator = mod.object({ type: mod.string(), id: mod.string() });
|
|
14308
14194
|
var CredentialSchemaValidator = mod.object({ id: mod.string(), type: mod.string() });
|
|
@@ -14584,11 +14470,13 @@ var JWEValidator = mod.object({
|
|
|
14584
14470
|
aad: mod.string().optional(),
|
|
14585
14471
|
recipients: JWERecipientValidator.array().optional()
|
|
14586
14472
|
});
|
|
14587
|
-
var
|
|
14588
|
-
|
|
14589
|
-
|
|
14473
|
+
var EncryptedRecordValidator = mod.object({ encryptedRecord: JWEValidator, fields: mod.string().array() }).catchall(mod.any());
|
|
14474
|
+
var PaginatedEncryptedRecordsValidator = PaginationResponseValidator.extend({
|
|
14475
|
+
records: EncryptedRecordValidator.array()
|
|
14476
|
+
});
|
|
14477
|
+
var EncryptedCredentialRecordValidator = EncryptedRecordValidator.extend({
|
|
14590
14478
|
id: mod.string()
|
|
14591
|
-
})
|
|
14479
|
+
});
|
|
14592
14480
|
var PaginatedEncryptedCredentialRecordsValidator = PaginationResponseValidator.extend({
|
|
14593
14481
|
records: EncryptedCredentialRecordValidator.array()
|
|
14594
14482
|
});
|
|
@@ -14682,7 +14570,7 @@ var import_json_stringify_deterministic = __toESM(require_lib());
|
|
|
14682
14570
|
var e = { "SHA-1": { outputLength: 20, blockSize: 64 }, "SHA-256": { outputLength: 32, blockSize: 64 }, "SHA-384": { outputLength: 48, blockSize: 128 }, "SHA-512": { outputLength: 64, blockSize: 128 } };
|
|
14683
14571
|
function t(t2, a, o, i, s = "SHA-256") {
|
|
14684
14572
|
return new Promise((u, c) => {
|
|
14685
|
-
s in e || c(new RangeError(`Valid hash algorithm values are any of ${Object.keys(e).toString()}`)), "string"
|
|
14573
|
+
s in e || c(new RangeError(`Valid hash algorithm values are any of ${Object.keys(e).toString()}`)), typeof t2 == "string" ? t2 = new TextEncoder().encode(t2) : t2 instanceof ArrayBuffer ? t2 = new Uint8Array(t2) : ArrayBuffer.isView(t2) || c(RangeError("P should be string, ArrayBuffer, TypedArray, DataView")), typeof a == "string" ? a = new TextEncoder().encode(a) : a instanceof ArrayBuffer ? a = new Uint8Array(a) : ArrayBuffer.isView(a) ? a = new Uint8Array(a.buffer, a.byteOffset, a.byteLength) : c(RangeError("S should be string, ArrayBuffer, TypedArray, DataView")), crypto.subtle.importKey("raw", t2, "PBKDF2", false, ["deriveBits"]).then((f) => {
|
|
14686
14574
|
const y = { name: "PBKDF2", hash: s, salt: a, iterations: o };
|
|
14687
14575
|
crypto.subtle.deriveBits(y, f, 8 * i).then((e2) => u(e2), (f2) => {
|
|
14688
14576
|
(async function(t3, a2, o2, i2, s2) {
|
|
@@ -14694,7 +14582,7 @@ function t(t2, a, o, i, s = "SHA-256") {
|
|
|
14694
14582
|
if (!Number.isInteger(i2) || i2 <= 0 || i2 >= (2 ** 32 - 1) * u2)
|
|
14695
14583
|
throw new RangeError("dkLen must be a positive integer < (2 ** 32 - 1) * hLen");
|
|
14696
14584
|
const c2 = Math.ceil(i2 / u2), f3 = i2 - (c2 - 1) * u2, y2 = new Array(c2);
|
|
14697
|
-
|
|
14585
|
+
t3.byteLength === 0 && (t3 = new Uint8Array(e[s2].blockSize));
|
|
14698
14586
|
const w = await crypto.subtle.importKey("raw", t3, { name: "HMAC", hash: { name: s2 } }, true, ["sign"]), g = /* @__PURE__ */ __name(async function(e2, t4) {
|
|
14699
14587
|
const r2 = await crypto.subtle.sign("HMAC", e2, t4);
|
|
14700
14588
|
return new Uint8Array(r2);
|
|
@@ -14723,7 +14611,7 @@ function t(t2, a, o, i, s = "SHA-256") {
|
|
|
14723
14611
|
__name(t, "t");
|
|
14724
14612
|
function r(...e2) {
|
|
14725
14613
|
const t2 = e2.reduce((e3, t3) => e3 + t3.length, 0);
|
|
14726
|
-
if (
|
|
14614
|
+
if (e2.length === 0)
|
|
14727
14615
|
throw new RangeError("Cannot concat no arrays");
|
|
14728
14616
|
const r2 = new Uint8Array(t2);
|
|
14729
14617
|
let n2 = 0;
|
|
@@ -14744,13 +14632,7 @@ var hash = /* @__PURE__ */ __name(async (learnCard, message) => {
|
|
|
14744
14632
|
const uint8Message = new TextEncoder().encode(message);
|
|
14745
14633
|
const pk = learnCard.id.keypair("secp256k1").d;
|
|
14746
14634
|
const hmacKey = await t(pk, "salt", 1e3, 32);
|
|
14747
|
-
const cryptoKey = await crypto2.subtle.importKey(
|
|
14748
|
-
"raw",
|
|
14749
|
-
hmacKey,
|
|
14750
|
-
{ name: "HMAC", hash: "SHA-256" },
|
|
14751
|
-
false,
|
|
14752
|
-
["sign"]
|
|
14753
|
-
);
|
|
14635
|
+
const cryptoKey = await crypto2.subtle.importKey("raw", hmacKey, { name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
|
|
14754
14636
|
const digestBuffer = await crypto2.subtle.sign("HMAC", cryptoKey, uint8Message);
|
|
14755
14637
|
const digestArray = Array.from(new Uint8Array(digestBuffer));
|
|
14756
14638
|
return digestArray.map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
@@ -14763,22 +14645,18 @@ var decryptJWE = /* @__PURE__ */ __name(async (learnCard, jwe) => {
|
|
|
14763
14645
|
}, "decryptJWE");
|
|
14764
14646
|
var generateEncryptedFieldsArray = /* @__PURE__ */ __name(async (learnCard, record, unencryptedFields = []) => {
|
|
14765
14647
|
const entries = Object.entries(record);
|
|
14766
|
-
return (await Promise.all(
|
|
14767
|
-
|
|
14768
|
-
|
|
14769
|
-
|
|
14770
|
-
|
|
14771
|
-
|
|
14772
|
-
|
|
14773
|
-
})
|
|
14774
|
-
)).filter(Boolean);
|
|
14648
|
+
return (await Promise.all(entries.map(async ([key, value]) => {
|
|
14649
|
+
if (!unencryptedFields.includes(key)) {
|
|
14650
|
+
const result = await hash(learnCard, `${key}:${(0, import_json_stringify_deterministic.default)(value)}`);
|
|
14651
|
+
return result;
|
|
14652
|
+
}
|
|
14653
|
+
return "";
|
|
14654
|
+
}))).filter(Boolean);
|
|
14775
14655
|
}, "generateEncryptedFieldsArray");
|
|
14776
14656
|
var generateEncryptedRecord = /* @__PURE__ */ __name(async (learnCard, record, unencryptedFields = []) => {
|
|
14777
14657
|
const encryptedRecord = await learnCard.invoke.getDIDObject().createDagJWE(record, [learnCard.id.did()]);
|
|
14778
14658
|
const fields = await generateEncryptedFieldsArray(learnCard, record, unencryptedFields);
|
|
14779
|
-
const unencryptedEntries = Object.fromEntries(
|
|
14780
|
-
Object.entries(record).filter(([key]) => unencryptedFields.includes(key))
|
|
14781
|
-
);
|
|
14659
|
+
const unencryptedEntries = Object.fromEntries(Object.entries(record).filter(([key]) => unencryptedFields.includes(key)));
|
|
14782
14660
|
return { ...unencryptedEntries, encryptedRecord, fields };
|
|
14783
14661
|
}, "generateEncryptedRecord");
|
|
14784
14662
|
|
|
@@ -14791,7 +14669,7 @@ var getLearnCloudClient = /* @__PURE__ */ __name(async (url, learnCard) => {
|
|
|
14791
14669
|
return jwt;
|
|
14792
14670
|
});
|
|
14793
14671
|
}, "getLearnCloudClient");
|
|
14794
|
-
var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, unencryptedFields = []) => {
|
|
14672
|
+
var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, unencryptedFields = [], unencryptedCustomFields = []) => {
|
|
14795
14673
|
let learnCard = initialLearnCard;
|
|
14796
14674
|
learnCard.debug?.("Adding LearnCloud Plugin");
|
|
14797
14675
|
let client = await getLearnCloudClient(url, learnCard);
|
|
@@ -14817,7 +14695,116 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
14817
14695
|
name: "LearnCloud",
|
|
14818
14696
|
displayName: "LearnCloud",
|
|
14819
14697
|
description: "LearnCloud Integration",
|
|
14820
|
-
methods: {
|
|
14698
|
+
methods: {
|
|
14699
|
+
learnCloudCreate: async (_learnCard, document) => {
|
|
14700
|
+
await updateLearnCard(_learnCard);
|
|
14701
|
+
const item = await generateEncryptedRecord(_learnCard, document, unencryptedCustomFields);
|
|
14702
|
+
return client.customStorage.create.mutate({
|
|
14703
|
+
item: await generateJWE(_learnCard, learnCloudDid, item)
|
|
14704
|
+
});
|
|
14705
|
+
},
|
|
14706
|
+
learnCloudCreateMany: async (_learnCard, documents) => {
|
|
14707
|
+
await updateLearnCard(_learnCard);
|
|
14708
|
+
const items = await Promise.all(documents.map(async (document) => generateEncryptedRecord(_learnCard, document, unencryptedCustomFields)));
|
|
14709
|
+
return client.customStorage.createMany.mutate({
|
|
14710
|
+
items: await generateJWE(_learnCard, learnCloudDid, items)
|
|
14711
|
+
});
|
|
14712
|
+
},
|
|
14713
|
+
learnCloudRead: async (_learnCard, query, includeAssociatedDids) => {
|
|
14714
|
+
await updateLearnCard(_learnCard);
|
|
14715
|
+
const documents = [];
|
|
14716
|
+
let result = await _learnCard.invoke.learnCloudReadPage(query, {}, includeAssociatedDids);
|
|
14717
|
+
documents.push(...result.records);
|
|
14718
|
+
while (result.hasMore) {
|
|
14719
|
+
result = await _learnCard.invoke.learnCloudReadPage(query, {}, includeAssociatedDids);
|
|
14720
|
+
documents.push(...result.records);
|
|
14721
|
+
}
|
|
14722
|
+
return documents;
|
|
14723
|
+
},
|
|
14724
|
+
learnCloudReadPage: async (_learnCard, query, paginationOptions, includeAssociatedDids) => {
|
|
14725
|
+
await updateLearnCard(_learnCard);
|
|
14726
|
+
if (!query) {
|
|
14727
|
+
const jwe2 = await client.customStorage.read.query({
|
|
14728
|
+
includeAssociatedDids,
|
|
14729
|
+
...paginationOptions
|
|
14730
|
+
});
|
|
14731
|
+
const encryptedRecords2 = isEncrypted(jwe2) ? await decryptJWE(_learnCard, jwe2) : jwe2;
|
|
14732
|
+
return {
|
|
14733
|
+
...encryptedRecords2,
|
|
14734
|
+
records: await Promise.all(encryptedRecords2.records.map(async (record) => ({
|
|
14735
|
+
...await decryptJWE(_learnCard, record.encryptedRecord),
|
|
14736
|
+
_id: record._id
|
|
14737
|
+
})))
|
|
14738
|
+
};
|
|
14739
|
+
}
|
|
14740
|
+
const fields = await generateEncryptedFieldsArray(_learnCard, query, [
|
|
14741
|
+
...unencryptedCustomFields,
|
|
14742
|
+
"_id"
|
|
14743
|
+
]);
|
|
14744
|
+
const unencryptedEntries = Object.fromEntries(Object.entries(query).filter(([key]) => [...unencryptedCustomFields, "_id"].includes(key)));
|
|
14745
|
+
const jwe = await client.customStorage.read.query({
|
|
14746
|
+
query: await generateJWE(_learnCard, learnCloudDid, {
|
|
14747
|
+
...unencryptedEntries,
|
|
14748
|
+
...fields.length > 0 ? { fields: { $in: fields } } : {}
|
|
14749
|
+
}),
|
|
14750
|
+
...paginationOptions,
|
|
14751
|
+
includeAssociatedDids
|
|
14752
|
+
});
|
|
14753
|
+
const encryptedRecords = isEncrypted(jwe) ? await decryptJWE(_learnCard, jwe) : jwe;
|
|
14754
|
+
return {
|
|
14755
|
+
...encryptedRecords,
|
|
14756
|
+
records: await Promise.all(encryptedRecords.records.map(async (record) => ({
|
|
14757
|
+
...await decryptJWE(_learnCard, record.encryptedRecord),
|
|
14758
|
+
_id: record._id
|
|
14759
|
+
})))
|
|
14760
|
+
};
|
|
14761
|
+
},
|
|
14762
|
+
learnCloudCount: async (_learnCard, query, includeAssociatedDids) => {
|
|
14763
|
+
await updateLearnCard(_learnCard);
|
|
14764
|
+
if (!query)
|
|
14765
|
+
return client.customStorage.count.query({ includeAssociatedDids });
|
|
14766
|
+
const fields = await generateEncryptedFieldsArray(_learnCard, query, [
|
|
14767
|
+
...unencryptedCustomFields,
|
|
14768
|
+
"_id"
|
|
14769
|
+
]);
|
|
14770
|
+
const unencryptedEntries = Object.fromEntries(Object.entries(query).filter(([key]) => [...unencryptedCustomFields, "_id"].includes(key)));
|
|
14771
|
+
return client.customStorage.count.query({
|
|
14772
|
+
query: await generateJWE(_learnCard, learnCloudDid, {
|
|
14773
|
+
...unencryptedEntries,
|
|
14774
|
+
...fields.length > 0 ? { fields: { $in: fields } } : {}
|
|
14775
|
+
}),
|
|
14776
|
+
includeAssociatedDids
|
|
14777
|
+
});
|
|
14778
|
+
},
|
|
14779
|
+
learnCloudUpdate: async (_learnCard, query, update) => {
|
|
14780
|
+
await updateLearnCard(_learnCard);
|
|
14781
|
+
const documents = await _learnCard.invoke.learnCloudRead(query);
|
|
14782
|
+
const updates = await Promise.all(documents.map(async (document) => client.customStorage.update.mutate({
|
|
14783
|
+
query: await generateJWE(_learnCard, learnCloudDid, {
|
|
14784
|
+
_id: document._id
|
|
14785
|
+
}),
|
|
14786
|
+
update: await generateJWE(_learnCard, learnCloudDid, await generateEncryptedRecord(_learnCard, { ...document, ...update }, unencryptedCustomFields))
|
|
14787
|
+
})));
|
|
14788
|
+
return updates.reduce((sum, current) => current + sum, 0);
|
|
14789
|
+
},
|
|
14790
|
+
learnCloudDelete: async (_learnCard, query, includeAssociatedDids) => {
|
|
14791
|
+
await updateLearnCard(_learnCard);
|
|
14792
|
+
if (!query)
|
|
14793
|
+
return client.customStorage.delete.mutate({ includeAssociatedDids });
|
|
14794
|
+
const fields = await generateEncryptedFieldsArray(_learnCard, query, [
|
|
14795
|
+
...unencryptedCustomFields,
|
|
14796
|
+
"_id"
|
|
14797
|
+
]);
|
|
14798
|
+
const unencryptedEntries = Object.fromEntries(Object.entries(query).filter(([key]) => [...unencryptedCustomFields, "_id"].includes(key)));
|
|
14799
|
+
return client.customStorage.delete.mutate({
|
|
14800
|
+
query: await generateJWE(_learnCard, learnCloudDid, {
|
|
14801
|
+
...unencryptedEntries,
|
|
14802
|
+
...fields.length > 0 ? { fields: { $in: fields } } : {}
|
|
14803
|
+
}),
|
|
14804
|
+
includeAssociatedDids
|
|
14805
|
+
});
|
|
14806
|
+
}
|
|
14807
|
+
},
|
|
14821
14808
|
read: {
|
|
14822
14809
|
get: async (_learnCard, uri) => {
|
|
14823
14810
|
if (!uri)
|
|
@@ -14871,53 +14858,30 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
14871
14858
|
const jwe2 = await client.index.get.query(paginationOptions);
|
|
14872
14859
|
_learnCard.debug?.("LearnCloud index.get (no query response)", jwe2);
|
|
14873
14860
|
const encryptedRecords2 = isEncrypted(jwe2) ? await decryptJWE(_learnCard, jwe2) : jwe2;
|
|
14874
|
-
_learnCard.debug?.(
|
|
14875
|
-
"LearnCloud index.get (no query encryptedRecords)",
|
|
14876
|
-
encryptedRecords2
|
|
14877
|
-
);
|
|
14861
|
+
_learnCard.debug?.("LearnCloud index.get (no query encryptedRecords)", encryptedRecords2);
|
|
14878
14862
|
return {
|
|
14879
14863
|
...encryptedRecords2,
|
|
14880
|
-
records: await Promise.all(
|
|
14881
|
-
encryptedRecords2.records.map(
|
|
14882
|
-
async (record) => decryptJWE(_learnCard, record.encryptedRecord)
|
|
14883
|
-
)
|
|
14884
|
-
)
|
|
14864
|
+
records: await Promise.all(encryptedRecords2.records.map(async (record) => decryptJWE(_learnCard, record.encryptedRecord)))
|
|
14885
14865
|
};
|
|
14886
14866
|
}
|
|
14887
14867
|
_learnCard.debug?.("LearnCloud index.get (query)");
|
|
14888
|
-
const fields = await generateEncryptedFieldsArray(
|
|
14889
|
-
_learnCard,
|
|
14890
|
-
query,
|
|
14891
|
-
unencryptedFields
|
|
14892
|
-
);
|
|
14868
|
+
const fields = await generateEncryptedFieldsArray(_learnCard, query, unencryptedFields);
|
|
14893
14869
|
_learnCard.debug?.("LearnCloud index.get (query fields)", fields);
|
|
14894
|
-
const unencryptedEntries = Object.fromEntries(
|
|
14895
|
-
|
|
14896
|
-
);
|
|
14897
|
-
_learnCard.debug?.(
|
|
14898
|
-
"LearnCloud index.get (query unencryptedEntries)",
|
|
14899
|
-
unencryptedEntries
|
|
14900
|
-
);
|
|
14870
|
+
const unencryptedEntries = Object.fromEntries(Object.entries(query).filter(([key]) => unencryptedFields.includes(key)));
|
|
14871
|
+
_learnCard.debug?.("LearnCloud index.get (query unencryptedEntries)", unencryptedEntries);
|
|
14901
14872
|
const jwe = await client.index.get.query({
|
|
14902
14873
|
query: await generateJWE(_learnCard, learnCloudDid, {
|
|
14903
14874
|
...unencryptedEntries,
|
|
14904
|
-
fields: { $in: fields }
|
|
14875
|
+
...fields.length > 0 ? { fields: { $in: fields } } : {}
|
|
14905
14876
|
}),
|
|
14906
14877
|
...paginationOptions
|
|
14907
14878
|
});
|
|
14908
14879
|
_learnCard.debug?.("LearnCloud index.get (query jwe)", jwe);
|
|
14909
14880
|
const encryptedRecords = isEncrypted(jwe) ? await decryptJWE(_learnCard, jwe) : jwe;
|
|
14910
|
-
_learnCard.debug?.(
|
|
14911
|
-
"LearnCloud index.get (query encryptedRecords)",
|
|
14912
|
-
encryptedRecords
|
|
14913
|
-
);
|
|
14881
|
+
_learnCard.debug?.("LearnCloud index.get (query encryptedRecords)", encryptedRecords);
|
|
14914
14882
|
return {
|
|
14915
14883
|
...encryptedRecords,
|
|
14916
|
-
records: await Promise.all(
|
|
14917
|
-
encryptedRecords.records.map(
|
|
14918
|
-
async (record) => decryptJWE(_learnCard, record.encryptedRecord)
|
|
14919
|
-
)
|
|
14920
|
-
)
|
|
14884
|
+
records: await Promise.all(encryptedRecords.records.map(async (record) => decryptJWE(_learnCard, record.encryptedRecord)))
|
|
14921
14885
|
};
|
|
14922
14886
|
},
|
|
14923
14887
|
getCount: async (_learnCard, query) => {
|
|
@@ -14931,23 +14895,14 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
14931
14895
|
return count2;
|
|
14932
14896
|
}
|
|
14933
14897
|
_learnCard.debug?.("LearnCloud index.getCount (query)");
|
|
14934
|
-
const fields = await generateEncryptedFieldsArray(
|
|
14935
|
-
_learnCard,
|
|
14936
|
-
query,
|
|
14937
|
-
unencryptedFields
|
|
14938
|
-
);
|
|
14898
|
+
const fields = await generateEncryptedFieldsArray(_learnCard, query, unencryptedFields);
|
|
14939
14899
|
_learnCard.debug?.("LearnCloud index.getCount (query fields)", fields);
|
|
14940
|
-
const unencryptedEntries = Object.fromEntries(
|
|
14941
|
-
|
|
14942
|
-
);
|
|
14943
|
-
_learnCard.debug?.(
|
|
14944
|
-
"LearnCloud index.getCount (query unencryptedEntries)",
|
|
14945
|
-
unencryptedEntries
|
|
14946
|
-
);
|
|
14900
|
+
const unencryptedEntries = Object.fromEntries(Object.entries(query).filter(([key]) => unencryptedFields.includes(key)));
|
|
14901
|
+
_learnCard.debug?.("LearnCloud index.getCount (query unencryptedEntries)", unencryptedEntries);
|
|
14947
14902
|
const jwe = await client.index.count.query({
|
|
14948
14903
|
query: await generateJWE(_learnCard, learnCloudDid, {
|
|
14949
14904
|
...unencryptedEntries,
|
|
14950
|
-
fields: { $in: fields }
|
|
14905
|
+
...fields.length > 0 ? { fields: { $in: fields } } : {}
|
|
14951
14906
|
})
|
|
14952
14907
|
});
|
|
14953
14908
|
_learnCard.debug?.("LearnCloud index.count (query response)", jwe);
|
|
@@ -14960,37 +14915,25 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
14960
14915
|
const id = record.id || _learnCard.invoke.crypto().randomUUID();
|
|
14961
14916
|
return client.index.add.mutate({
|
|
14962
14917
|
record: await generateJWE(_learnCard, learnCloudDid, {
|
|
14963
|
-
...await generateEncryptedRecord(
|
|
14964
|
-
_learnCard,
|
|
14965
|
-
{ ...record, id },
|
|
14966
|
-
unencryptedFields
|
|
14967
|
-
),
|
|
14918
|
+
...await generateEncryptedRecord(_learnCard, { ...record, id }, unencryptedFields),
|
|
14968
14919
|
id: await hash(_learnCard, id)
|
|
14969
14920
|
})
|
|
14970
14921
|
});
|
|
14971
14922
|
},
|
|
14972
14923
|
addMany: async (_learnCard, _records) => {
|
|
14973
14924
|
await updateLearnCard(_learnCard);
|
|
14974
|
-
const results = await Promise.all(
|
|
14975
|
-
|
|
14976
|
-
const
|
|
14977
|
-
|
|
14978
|
-
|
|
14979
|
-
|
|
14980
|
-
|
|
14981
|
-
|
|
14982
|
-
|
|
14983
|
-
|
|
14984
|
-
|
|
14985
|
-
|
|
14986
|
-
};
|
|
14987
|
-
})
|
|
14988
|
-
);
|
|
14989
|
-
return client.index.addMany.mutate({
|
|
14990
|
-
records: await generateJWE(_learnCard, learnCloudDid, records)
|
|
14991
|
-
});
|
|
14992
|
-
})
|
|
14993
|
-
);
|
|
14925
|
+
const results = await Promise.all((0, import_lodash.chunk)(_records, 25).map(async (batch) => {
|
|
14926
|
+
const records = await Promise.all(batch.map(async (record) => {
|
|
14927
|
+
const id = record.id || _learnCard.invoke.crypto().randomUUID();
|
|
14928
|
+
return {
|
|
14929
|
+
...await generateEncryptedRecord(_learnCard, { ...record, id }, unencryptedFields),
|
|
14930
|
+
id: await hash(_learnCard, id)
|
|
14931
|
+
};
|
|
14932
|
+
}));
|
|
14933
|
+
return client.index.addMany.mutate({
|
|
14934
|
+
records: await generateJWE(_learnCard, learnCloudDid, records)
|
|
14935
|
+
});
|
|
14936
|
+
}));
|
|
14994
14937
|
return results.every(Boolean);
|
|
14995
14938
|
},
|
|
14996
14939
|
update: async (_learnCard, id, updates) => {
|
|
@@ -15002,11 +14945,7 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15002
14945
|
const newRecord = { ...record, ...updates };
|
|
15003
14946
|
return client.index.update.mutate({
|
|
15004
14947
|
id: await hash(_learnCard, id),
|
|
15005
|
-
updates: await generateJWE(
|
|
15006
|
-
_learnCard,
|
|
15007
|
-
learnCloudDid,
|
|
15008
|
-
await generateEncryptedRecord(_learnCard, newRecord, unencryptedFields)
|
|
15009
|
-
)
|
|
14948
|
+
updates: await generateJWE(_learnCard, learnCloudDid, await generateEncryptedRecord(_learnCard, newRecord, unencryptedFields))
|
|
15010
14949
|
});
|
|
15011
14950
|
},
|
|
15012
14951
|
remove: async (_learnCard, id) => {
|