@learncard/learn-cloud-plugin 1.1.0 → 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/learn-cloud-plugin.cjs.development.js +280 -506
- package/dist/learn-cloud-plugin.cjs.development.js.map +4 -4
- package/dist/learn-cloud-plugin.cjs.production.min.js +12 -12
- package/dist/learn-cloud-plugin.cjs.production.min.js.map +4 -4
- package/dist/learn-cloud-plugin.esm.js +280 -505
- package/dist/learn-cloud-plugin.esm.js.map +4 -4
- package/package.json +6 -6
|
@@ -16,10 +16,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
}
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
|
-
var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__getProtoOf(mod2)) : {}, __copyProps(
|
|
20
|
-
isNodeMode || !mod2 || !mod2.__esModule ? __defProp(target, "default", { value: mod2, enumerable: true }) : target,
|
|
21
|
-
mod2
|
|
22
|
-
));
|
|
19
|
+
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));
|
|
23
20
|
|
|
24
21
|
// ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js
|
|
25
22
|
var require_lodash = __commonJS({
|
|
@@ -776,9 +773,7 @@ var require_lodash = __commonJS({
|
|
|
776
773
|
var nativeObjectToString = objectProto.toString;
|
|
777
774
|
var objectCtorString = funcToString.call(Object2);
|
|
778
775
|
var oldDash = root._;
|
|
779
|
-
var reIsNative = RegExp2(
|
|
780
|
-
"^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
781
|
-
);
|
|
776
|
+
var reIsNative = RegExp2("^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
|
|
782
777
|
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;
|
|
783
778
|
var defineProperty = function() {
|
|
784
779
|
try {
|
|
@@ -2407,18 +2402,7 @@ var require_lodash = __commonJS({
|
|
|
2407
2402
|
var holders = length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder ? [] : replaceHolders(args, placeholder);
|
|
2408
2403
|
length -= holders.length;
|
|
2409
2404
|
if (length < arity) {
|
|
2410
|
-
return createRecurry(
|
|
2411
|
-
func,
|
|
2412
|
-
bitmask,
|
|
2413
|
-
createHybrid,
|
|
2414
|
-
wrapper.placeholder,
|
|
2415
|
-
undefined2,
|
|
2416
|
-
args,
|
|
2417
|
-
holders,
|
|
2418
|
-
undefined2,
|
|
2419
|
-
undefined2,
|
|
2420
|
-
arity - length
|
|
2421
|
-
);
|
|
2405
|
+
return createRecurry(func, bitmask, createHybrid, wrapper.placeholder, undefined2, args, holders, undefined2, undefined2, arity - length);
|
|
2422
2406
|
}
|
|
2423
2407
|
var fn = this && this !== root && this instanceof wrapper ? Ctor : func;
|
|
2424
2408
|
return apply(fn, this, args);
|
|
@@ -2500,18 +2484,7 @@ var require_lodash = __commonJS({
|
|
|
2500
2484
|
length -= holdersCount;
|
|
2501
2485
|
if (isCurried && length < arity) {
|
|
2502
2486
|
var newHolders = replaceHolders(args, placeholder);
|
|
2503
|
-
return createRecurry(
|
|
2504
|
-
func,
|
|
2505
|
-
bitmask,
|
|
2506
|
-
createHybrid,
|
|
2507
|
-
wrapper.placeholder,
|
|
2508
|
-
thisArg,
|
|
2509
|
-
args,
|
|
2510
|
-
newHolders,
|
|
2511
|
-
argPos,
|
|
2512
|
-
ary2,
|
|
2513
|
-
arity - length
|
|
2514
|
-
);
|
|
2487
|
+
return createRecurry(func, bitmask, createHybrid, wrapper.placeholder, thisArg, args, newHolders, argPos, ary2, arity - length);
|
|
2515
2488
|
}
|
|
2516
2489
|
var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func;
|
|
2517
2490
|
length = args.length;
|
|
@@ -5078,10 +5051,7 @@ var require_lodash = __commonJS({
|
|
|
5078
5051
|
options = assignInWith({}, options, settings, customDefaultsAssignIn);
|
|
5079
5052
|
var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys);
|
|
5080
5053
|
var isEscaping, isEvaluating, index = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '";
|
|
5081
|
-
var reDelimiters = RegExp2(
|
|
5082
|
-
(options.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$",
|
|
5083
|
-
"g"
|
|
5084
|
-
);
|
|
5054
|
+
var reDelimiters = RegExp2((options.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$", "g");
|
|
5085
5055
|
var sourceURL = "//# sourceURL=" + (hasOwnProperty.call(options, "sourceURL") ? (options.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n";
|
|
5086
5056
|
string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
|
|
5087
5057
|
interpolateValue || (interpolateValue = esTemplateValue);
|
|
@@ -6914,10 +6884,7 @@ var __copyProps2 = /* @__PURE__ */ __name((to, from, except, desc) => {
|
|
|
6914
6884
|
}
|
|
6915
6885
|
return to;
|
|
6916
6886
|
}, "__copyProps");
|
|
6917
|
-
var __toESM2 = /* @__PURE__ */ __name((mod2, isNodeMode, target) => (target = mod2 != null ? __create2(__getProtoOf2(mod2)) : {}, __copyProps2(
|
|
6918
|
-
isNodeMode || !mod2 || !mod2.__esModule ? __defProp3(target, "default", { value: mod2, enumerable: true }) : target,
|
|
6919
|
-
mod2
|
|
6920
|
-
)), "__toESM");
|
|
6887
|
+
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");
|
|
6921
6888
|
var require_types_cjs_development = __commonJS2({
|
|
6922
6889
|
"../learn-card-types/dist/types.cjs.development.js"(exports, module) {
|
|
6923
6890
|
"use strict";
|
|
@@ -7451,7 +7418,7 @@ var require_types_cjs_development = __commonJS2({
|
|
|
7451
7418
|
var isAborted2 = /* @__PURE__ */ __name22((x) => x.status === "aborted", "isAborted");
|
|
7452
7419
|
var isDirty2 = /* @__PURE__ */ __name22((x) => x.status === "dirty", "isDirty");
|
|
7453
7420
|
var isValid2 = /* @__PURE__ */ __name22((x) => x.status === "valid", "isValid");
|
|
7454
|
-
var isAsync2 = /* @__PURE__ */ __name22((x) => typeof Promise !==
|
|
7421
|
+
var isAsync2 = /* @__PURE__ */ __name22((x) => typeof Promise !== void 0 && x instanceof Promise, "isAsync");
|
|
7455
7422
|
var errorUtil2;
|
|
7456
7423
|
(function(errorUtil22) {
|
|
7457
7424
|
errorUtil22.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
@@ -7671,29 +7638,28 @@ var require_types_cjs_development = __commonJS2({
|
|
|
7671
7638
|
return this._refinement(refinement);
|
|
7672
7639
|
}
|
|
7673
7640
|
optional() {
|
|
7674
|
-
return ZodOptional2.create(this
|
|
7641
|
+
return ZodOptional2.create(this);
|
|
7675
7642
|
}
|
|
7676
7643
|
nullable() {
|
|
7677
|
-
return ZodNullable2.create(this
|
|
7644
|
+
return ZodNullable2.create(this);
|
|
7678
7645
|
}
|
|
7679
7646
|
nullish() {
|
|
7680
|
-
return this.
|
|
7647
|
+
return this.optional().nullable();
|
|
7681
7648
|
}
|
|
7682
7649
|
array() {
|
|
7683
|
-
return ZodArray2.create(this
|
|
7650
|
+
return ZodArray2.create(this);
|
|
7684
7651
|
}
|
|
7685
7652
|
promise() {
|
|
7686
|
-
return ZodPromise2.create(this
|
|
7653
|
+
return ZodPromise2.create(this);
|
|
7687
7654
|
}
|
|
7688
7655
|
or(option) {
|
|
7689
|
-
return ZodUnion2.create([this, option]
|
|
7656
|
+
return ZodUnion2.create([this, option]);
|
|
7690
7657
|
}
|
|
7691
7658
|
and(incoming) {
|
|
7692
|
-
return ZodIntersection2.create(this, incoming
|
|
7659
|
+
return ZodIntersection2.create(this, incoming);
|
|
7693
7660
|
}
|
|
7694
7661
|
transform(transform) {
|
|
7695
7662
|
return new ZodEffects2({
|
|
7696
|
-
...processCreateParams2(this._def),
|
|
7697
7663
|
schema: this,
|
|
7698
7664
|
typeName: ZodFirstPartyTypeKind2.ZodEffects,
|
|
7699
7665
|
effect: { type: "transform", transform }
|
|
@@ -7702,7 +7668,6 @@ var require_types_cjs_development = __commonJS2({
|
|
|
7702
7668
|
default(def) {
|
|
7703
7669
|
const defaultValueFunc = typeof def === "function" ? def : () => def;
|
|
7704
7670
|
return new ZodDefault2({
|
|
7705
|
-
...processCreateParams2(this._def),
|
|
7706
7671
|
innerType: this,
|
|
7707
7672
|
defaultValue: defaultValueFunc,
|
|
7708
7673
|
typeName: ZodFirstPartyTypeKind2.ZodDefault
|
|
@@ -7712,15 +7677,14 @@ var require_types_cjs_development = __commonJS2({
|
|
|
7712
7677
|
return new ZodBranded2({
|
|
7713
7678
|
typeName: ZodFirstPartyTypeKind2.ZodBranded,
|
|
7714
7679
|
type: this,
|
|
7715
|
-
...processCreateParams2(
|
|
7680
|
+
...processCreateParams2(void 0)
|
|
7716
7681
|
});
|
|
7717
7682
|
}
|
|
7718
7683
|
catch(def) {
|
|
7719
|
-
const
|
|
7684
|
+
const defaultValueFunc = typeof def === "function" ? def : () => def;
|
|
7720
7685
|
return new ZodCatch2({
|
|
7721
|
-
...processCreateParams2(this._def),
|
|
7722
7686
|
innerType: this,
|
|
7723
|
-
|
|
7687
|
+
defaultValue: defaultValueFunc,
|
|
7724
7688
|
typeName: ZodFirstPartyTypeKind2.ZodCatch
|
|
7725
7689
|
});
|
|
7726
7690
|
}
|
|
@@ -7743,25 +7707,24 @@ var require_types_cjs_development = __commonJS2({
|
|
|
7743
7707
|
}, "ZodType");
|
|
7744
7708
|
__name22(ZodType2, "ZodType");
|
|
7745
7709
|
var cuidRegex2 = /^c[^\s-]{8,}$/i;
|
|
7746
|
-
var cuid2Regex2 = /^[a-z][a-z0-9]*$/;
|
|
7747
7710
|
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;
|
|
7748
|
-
var emailRegex2 = /^(([^<>()[\]
|
|
7711
|
+
var emailRegex2 = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;
|
|
7749
7712
|
var datetimeRegex2 = /* @__PURE__ */ __name22((args) => {
|
|
7750
7713
|
if (args.precision) {
|
|
7751
7714
|
if (args.offset) {
|
|
7752
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}
|
|
7715
|
+
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}:\\d{2})|Z)$`);
|
|
7753
7716
|
} else {
|
|
7754
7717
|
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
|
|
7755
7718
|
}
|
|
7756
7719
|
} else if (args.precision === 0) {
|
|
7757
7720
|
if (args.offset) {
|
|
7758
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}
|
|
7721
|
+
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$`);
|
|
7759
7722
|
} else {
|
|
7760
7723
|
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
|
|
7761
7724
|
}
|
|
7762
7725
|
} else {
|
|
7763
7726
|
if (args.offset) {
|
|
7764
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}
|
|
7727
|
+
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$`);
|
|
7765
7728
|
} else {
|
|
7766
7729
|
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
|
|
7767
7730
|
}
|
|
@@ -7788,14 +7751,11 @@ var require_types_cjs_development = __commonJS2({
|
|
|
7788
7751
|
const parsedType = this._getType(input);
|
|
7789
7752
|
if (parsedType !== ZodParsedType2.string) {
|
|
7790
7753
|
const ctx2 = this._getOrReturnCtx(input);
|
|
7791
|
-
addIssueToContext2(
|
|
7792
|
-
|
|
7793
|
-
|
|
7794
|
-
|
|
7795
|
-
|
|
7796
|
-
received: ctx2.parsedType
|
|
7797
|
-
}
|
|
7798
|
-
);
|
|
7754
|
+
addIssueToContext2(ctx2, {
|
|
7755
|
+
code: ZodIssueCode2.invalid_type,
|
|
7756
|
+
expected: ZodParsedType2.string,
|
|
7757
|
+
received: ctx2.parsedType
|
|
7758
|
+
});
|
|
7799
7759
|
return INVALID2;
|
|
7800
7760
|
}
|
|
7801
7761
|
const status = new ParseStatus2();
|
|
@@ -7883,16 +7843,6 @@ var require_types_cjs_development = __commonJS2({
|
|
|
7883
7843
|
});
|
|
7884
7844
|
status.dirty();
|
|
7885
7845
|
}
|
|
7886
|
-
} else if (check.kind === "cuid2") {
|
|
7887
|
-
if (!cuid2Regex2.test(input.data)) {
|
|
7888
|
-
ctx = this._getOrReturnCtx(input, ctx);
|
|
7889
|
-
addIssueToContext2(ctx, {
|
|
7890
|
-
validation: "cuid2",
|
|
7891
|
-
code: ZodIssueCode2.invalid_string,
|
|
7892
|
-
message: check.message
|
|
7893
|
-
});
|
|
7894
|
-
status.dirty();
|
|
7895
|
-
}
|
|
7896
7846
|
} else if (check.kind === "url") {
|
|
7897
7847
|
try {
|
|
7898
7848
|
new URL(input.data);
|
|
@@ -7974,9 +7924,6 @@ var require_types_cjs_development = __commonJS2({
|
|
|
7974
7924
|
cuid(message) {
|
|
7975
7925
|
return this._addCheck({ kind: "cuid", ...errorUtil2.errToObj(message) });
|
|
7976
7926
|
}
|
|
7977
|
-
cuid2(message) {
|
|
7978
|
-
return this._addCheck({ kind: "cuid2", ...errorUtil2.errToObj(message) });
|
|
7979
|
-
}
|
|
7980
7927
|
datetime(options) {
|
|
7981
7928
|
var _a;
|
|
7982
7929
|
if (typeof options === "string") {
|
|
@@ -8051,9 +7998,6 @@ var require_types_cjs_development = __commonJS2({
|
|
|
8051
7998
|
get isCUID() {
|
|
8052
7999
|
return !!this._def.checks.find((ch) => ch.kind === "cuid");
|
|
8053
8000
|
}
|
|
8054
|
-
get isCUID2() {
|
|
8055
|
-
return !!this._def.checks.find((ch) => ch.kind === "cuid2");
|
|
8056
|
-
}
|
|
8057
8001
|
get minLength() {
|
|
8058
8002
|
let min = null;
|
|
8059
8003
|
for (const ch of this._def.checks) {
|
|
@@ -8288,22 +8232,7 @@ var require_types_cjs_development = __commonJS2({
|
|
|
8288
8232
|
return max;
|
|
8289
8233
|
}
|
|
8290
8234
|
get isInt() {
|
|
8291
|
-
return !!this._def.checks.find((ch) => ch.kind === "int"
|
|
8292
|
-
}
|
|
8293
|
-
get isFinite() {
|
|
8294
|
-
let max = null, min = null;
|
|
8295
|
-
for (const ch of this._def.checks) {
|
|
8296
|
-
if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
|
|
8297
|
-
return true;
|
|
8298
|
-
} else if (ch.kind === "min") {
|
|
8299
|
-
if (min === null || ch.value > min)
|
|
8300
|
-
min = ch.value;
|
|
8301
|
-
} else if (ch.kind === "max") {
|
|
8302
|
-
if (max === null || ch.value < max)
|
|
8303
|
-
max = ch.value;
|
|
8304
|
-
}
|
|
8305
|
-
}
|
|
8306
|
-
return Number.isFinite(min) && Number.isFinite(max);
|
|
8235
|
+
return !!this._def.checks.find((ch) => ch.kind === "int");
|
|
8307
8236
|
}
|
|
8308
8237
|
}, "ZodNumber");
|
|
8309
8238
|
__name22(ZodNumber2, "ZodNumber");
|
|
@@ -8671,13 +8600,13 @@ var require_types_cjs_development = __commonJS2({
|
|
|
8671
8600
|
}
|
|
8672
8601
|
}
|
|
8673
8602
|
if (ctx.common.async) {
|
|
8674
|
-
return Promise.all(
|
|
8603
|
+
return Promise.all(ctx.data.map((item, i) => {
|
|
8675
8604
|
return def.type._parseAsync(new ParseInputLazyPath2(ctx, item, ctx.path, i));
|
|
8676
8605
|
})).then((result2) => {
|
|
8677
8606
|
return ParseStatus2.mergeArray(status, result2);
|
|
8678
8607
|
});
|
|
8679
8608
|
}
|
|
8680
|
-
const result =
|
|
8609
|
+
const result = ctx.data.map((item, i) => {
|
|
8681
8610
|
return def.type._parseSync(new ParseInputLazyPath2(ctx, item, ctx.path, i));
|
|
8682
8611
|
});
|
|
8683
8612
|
return ParseStatus2.mergeArray(status, result);
|
|
@@ -8727,6 +8656,15 @@ var require_types_cjs_development = __commonJS2({
|
|
|
8727
8656
|
};
|
|
8728
8657
|
};
|
|
8729
8658
|
})(objectUtil2 || (objectUtil2 = {}));
|
|
8659
|
+
var AugmentFactory2 = /* @__PURE__ */ __name22((def) => (augmentation) => {
|
|
8660
|
+
return new ZodObject2({
|
|
8661
|
+
...def,
|
|
8662
|
+
shape: () => ({
|
|
8663
|
+
...def.shape(),
|
|
8664
|
+
...augmentation
|
|
8665
|
+
})
|
|
8666
|
+
});
|
|
8667
|
+
}, "AugmentFactory");
|
|
8730
8668
|
function deepPartialify2(schema) {
|
|
8731
8669
|
if (schema instanceof ZodObject2) {
|
|
8732
8670
|
const newShape = {};
|
|
@@ -8758,7 +8696,8 @@ var require_types_cjs_development = __commonJS2({
|
|
|
8758
8696
|
super(...arguments);
|
|
8759
8697
|
this._cached = null;
|
|
8760
8698
|
this.nonstrict = this.passthrough;
|
|
8761
|
-
this.augment = this.
|
|
8699
|
+
this.augment = AugmentFactory2(this._def);
|
|
8700
|
+
this.extend = AugmentFactory2(this._def);
|
|
8762
8701
|
}
|
|
8763
8702
|
_getCached() {
|
|
8764
8703
|
if (this._cached !== null)
|
|
@@ -8826,9 +8765,7 @@ var require_types_cjs_development = __commonJS2({
|
|
|
8826
8765
|
const value = ctx.data[key];
|
|
8827
8766
|
pairs.push({
|
|
8828
8767
|
key: { status: "valid", value: key },
|
|
8829
|
-
value: catchall._parse(
|
|
8830
|
-
new ParseInputLazyPath2(ctx, value, ctx.path, key)
|
|
8831
|
-
),
|
|
8768
|
+
value: catchall._parse(new ParseInputLazyPath2(ctx, value, ctx.path, key)),
|
|
8832
8769
|
alwaysSet: key in ctx.data
|
|
8833
8770
|
});
|
|
8834
8771
|
}
|
|
@@ -8887,14 +8824,8 @@ var require_types_cjs_development = __commonJS2({
|
|
|
8887
8824
|
unknownKeys: "passthrough"
|
|
8888
8825
|
});
|
|
8889
8826
|
}
|
|
8890
|
-
|
|
8891
|
-
return
|
|
8892
|
-
...this._def,
|
|
8893
|
-
shape: () => ({
|
|
8894
|
-
...this._def.shape(),
|
|
8895
|
-
...augmentation
|
|
8896
|
-
})
|
|
8897
|
-
});
|
|
8827
|
+
setKey(key, schema) {
|
|
8828
|
+
return this.augment({ [key]: schema });
|
|
8898
8829
|
}
|
|
8899
8830
|
merge(merging) {
|
|
8900
8831
|
const merged = new ZodObject2({
|
|
@@ -8905,9 +8836,6 @@ var require_types_cjs_development = __commonJS2({
|
|
|
8905
8836
|
});
|
|
8906
8837
|
return merged;
|
|
8907
8838
|
}
|
|
8908
|
-
setKey(key, schema) {
|
|
8909
|
-
return this.augment({ [key]: schema });
|
|
8910
|
-
}
|
|
8911
8839
|
catchall(index) {
|
|
8912
8840
|
return new ZodObject2({
|
|
8913
8841
|
...this._def,
|
|
@@ -8916,10 +8844,9 @@ var require_types_cjs_development = __commonJS2({
|
|
|
8916
8844
|
}
|
|
8917
8845
|
pick(mask) {
|
|
8918
8846
|
const shape = {};
|
|
8919
|
-
util2.objectKeys(mask).
|
|
8920
|
-
if (
|
|
8847
|
+
util2.objectKeys(mask).map((key) => {
|
|
8848
|
+
if (this.shape[key])
|
|
8921
8849
|
shape[key] = this.shape[key];
|
|
8922
|
-
}
|
|
8923
8850
|
});
|
|
8924
8851
|
return new ZodObject2({
|
|
8925
8852
|
...this._def,
|
|
@@ -8928,8 +8855,8 @@ var require_types_cjs_development = __commonJS2({
|
|
|
8928
8855
|
}
|
|
8929
8856
|
omit(mask) {
|
|
8930
8857
|
const shape = {};
|
|
8931
|
-
util2.objectKeys(this.shape).
|
|
8932
|
-
if (
|
|
8858
|
+
util2.objectKeys(this.shape).map((key) => {
|
|
8859
|
+
if (util2.objectKeys(mask).indexOf(key) === -1) {
|
|
8933
8860
|
shape[key] = this.shape[key];
|
|
8934
8861
|
}
|
|
8935
8862
|
});
|
|
@@ -8943,14 +8870,24 @@ var require_types_cjs_development = __commonJS2({
|
|
|
8943
8870
|
}
|
|
8944
8871
|
partial(mask) {
|
|
8945
8872
|
const newShape = {};
|
|
8946
|
-
|
|
8947
|
-
|
|
8948
|
-
|
|
8949
|
-
|
|
8950
|
-
|
|
8873
|
+
if (mask) {
|
|
8874
|
+
util2.objectKeys(this.shape).map((key) => {
|
|
8875
|
+
if (util2.objectKeys(mask).indexOf(key) === -1) {
|
|
8876
|
+
newShape[key] = this.shape[key];
|
|
8877
|
+
} else {
|
|
8878
|
+
newShape[key] = this.shape[key].optional();
|
|
8879
|
+
}
|
|
8880
|
+
});
|
|
8881
|
+
return new ZodObject2({
|
|
8882
|
+
...this._def,
|
|
8883
|
+
shape: () => newShape
|
|
8884
|
+
});
|
|
8885
|
+
} else {
|
|
8886
|
+
for (const key in this.shape) {
|
|
8887
|
+
const fieldSchema = this.shape[key];
|
|
8951
8888
|
newShape[key] = fieldSchema.optional();
|
|
8952
8889
|
}
|
|
8953
|
-
}
|
|
8890
|
+
}
|
|
8954
8891
|
return new ZodObject2({
|
|
8955
8892
|
...this._def,
|
|
8956
8893
|
shape: () => newShape
|
|
@@ -8958,10 +8895,21 @@ var require_types_cjs_development = __commonJS2({
|
|
|
8958
8895
|
}
|
|
8959
8896
|
required(mask) {
|
|
8960
8897
|
const newShape = {};
|
|
8961
|
-
|
|
8962
|
-
|
|
8963
|
-
|
|
8964
|
-
|
|
8898
|
+
if (mask) {
|
|
8899
|
+
util2.objectKeys(this.shape).map((key) => {
|
|
8900
|
+
if (util2.objectKeys(mask).indexOf(key) === -1) {
|
|
8901
|
+
newShape[key] = this.shape[key];
|
|
8902
|
+
} else {
|
|
8903
|
+
const fieldSchema = this.shape[key];
|
|
8904
|
+
let newField = fieldSchema;
|
|
8905
|
+
while (newField instanceof ZodOptional2) {
|
|
8906
|
+
newField = newField._def.innerType;
|
|
8907
|
+
}
|
|
8908
|
+
newShape[key] = newField;
|
|
8909
|
+
}
|
|
8910
|
+
});
|
|
8911
|
+
} else {
|
|
8912
|
+
for (const key in this.shape) {
|
|
8965
8913
|
const fieldSchema = this.shape[key];
|
|
8966
8914
|
let newField = fieldSchema;
|
|
8967
8915
|
while (newField instanceof ZodOptional2) {
|
|
@@ -8969,7 +8917,7 @@ var require_types_cjs_development = __commonJS2({
|
|
|
8969
8917
|
}
|
|
8970
8918
|
newShape[key] = newField;
|
|
8971
8919
|
}
|
|
8972
|
-
}
|
|
8920
|
+
}
|
|
8973
8921
|
return new ZodObject2({
|
|
8974
8922
|
...this._def,
|
|
8975
8923
|
shape: () => newShape
|
|
@@ -9319,7 +9267,7 @@ var require_types_cjs_development = __commonJS2({
|
|
|
9319
9267
|
});
|
|
9320
9268
|
status.dirty();
|
|
9321
9269
|
}
|
|
9322
|
-
const items =
|
|
9270
|
+
const items = ctx.data.map((item, itemIndex) => {
|
|
9323
9271
|
const schema = this._def.items[itemIndex] || this._def.rest;
|
|
9324
9272
|
if (!schema)
|
|
9325
9273
|
return null;
|
|
@@ -9701,7 +9649,6 @@ var require_types_cjs_development = __commonJS2({
|
|
|
9701
9649
|
if (input.data !== this._def.value) {
|
|
9702
9650
|
const ctx = this._getOrReturnCtx(input);
|
|
9703
9651
|
addIssueToContext2(ctx, {
|
|
9704
|
-
received: ctx.data,
|
|
9705
9652
|
code: ZodIssueCode2.invalid_literal,
|
|
9706
9653
|
expected: this._def.value
|
|
9707
9654
|
});
|
|
@@ -9779,12 +9726,6 @@ var require_types_cjs_development = __commonJS2({
|
|
|
9779
9726
|
}
|
|
9780
9727
|
return enumValues;
|
|
9781
9728
|
}
|
|
9782
|
-
extract(values) {
|
|
9783
|
-
return ZodEnum2.create(values);
|
|
9784
|
-
}
|
|
9785
|
-
exclude(values) {
|
|
9786
|
-
return ZodEnum2.create(this.options.filter((opt) => !values.includes(opt)));
|
|
9787
|
-
}
|
|
9788
9729
|
}, "ZodEnum");
|
|
9789
9730
|
__name22(ZodEnum2, "ZodEnum");
|
|
9790
9731
|
ZodEnum2.create = createZodEnum2;
|
|
@@ -9825,9 +9766,6 @@ var require_types_cjs_development = __commonJS2({
|
|
|
9825
9766
|
});
|
|
9826
9767
|
};
|
|
9827
9768
|
var ZodPromise2 = /* @__PURE__ */ __name3(class extends ZodType2 {
|
|
9828
|
-
unwrap() {
|
|
9829
|
-
return this._def.type;
|
|
9830
|
-
}
|
|
9831
9769
|
_parse(input) {
|
|
9832
9770
|
const { ctx } = this._processInputParams(input);
|
|
9833
9771
|
if (ctx.parsedType !== ZodParsedType2.promise && ctx.common.async === false) {
|
|
@@ -10046,29 +9984,23 @@ var require_types_cjs_development = __commonJS2({
|
|
|
10046
9984
|
const result = this._def.innerType._parse({
|
|
10047
9985
|
data: ctx.data,
|
|
10048
9986
|
path: ctx.path,
|
|
10049
|
-
parent:
|
|
10050
|
-
...ctx,
|
|
10051
|
-
common: {
|
|
10052
|
-
...ctx.common,
|
|
10053
|
-
issues: []
|
|
10054
|
-
}
|
|
10055
|
-
}
|
|
9987
|
+
parent: ctx
|
|
10056
9988
|
});
|
|
10057
9989
|
if (isAsync2(result)) {
|
|
10058
9990
|
return result.then((result2) => {
|
|
10059
9991
|
return {
|
|
10060
9992
|
status: "valid",
|
|
10061
|
-
value: result2.status === "valid" ? result2.value : this._def.
|
|
9993
|
+
value: result2.status === "valid" ? result2.value : this._def.defaultValue()
|
|
10062
9994
|
};
|
|
10063
9995
|
});
|
|
10064
9996
|
} else {
|
|
10065
9997
|
return {
|
|
10066
9998
|
status: "valid",
|
|
10067
|
-
value: result.status === "valid" ? result.value : this._def.
|
|
9999
|
+
value: result.status === "valid" ? result.value : this._def.defaultValue()
|
|
10068
10000
|
};
|
|
10069
10001
|
}
|
|
10070
10002
|
}
|
|
10071
|
-
|
|
10003
|
+
removeDefault() {
|
|
10072
10004
|
return this._def.innerType;
|
|
10073
10005
|
}
|
|
10074
10006
|
}, "ZodCatch");
|
|
@@ -10077,7 +10009,7 @@ var require_types_cjs_development = __commonJS2({
|
|
|
10077
10009
|
return new ZodCatch2({
|
|
10078
10010
|
innerType: type,
|
|
10079
10011
|
typeName: ZodFirstPartyTypeKind2.ZodCatch,
|
|
10080
|
-
|
|
10012
|
+
defaultValue: typeof params.default === "function" ? params.default : () => params.default,
|
|
10081
10013
|
...processCreateParams2(params)
|
|
10082
10014
|
});
|
|
10083
10015
|
};
|
|
@@ -10270,10 +10202,7 @@ var require_types_cjs_development = __commonJS2({
|
|
|
10270
10202
|
var coerce2 = {
|
|
10271
10203
|
string: (arg) => ZodString2.create({ ...arg, coerce: true }),
|
|
10272
10204
|
number: (arg) => ZodNumber2.create({ ...arg, coerce: true }),
|
|
10273
|
-
boolean: (arg) => ZodBoolean2.create({
|
|
10274
|
-
...arg,
|
|
10275
|
-
coerce: true
|
|
10276
|
-
}),
|
|
10205
|
+
boolean: (arg) => ZodBoolean2.create({ ...arg, coerce: true }),
|
|
10277
10206
|
bigint: (arg) => ZodBigInt2.create({ ...arg, coerce: true }),
|
|
10278
10207
|
date: (arg) => ZodDate2.create({ ...arg, coerce: true })
|
|
10279
10208
|
};
|
|
@@ -10397,13 +10326,11 @@ var require_types_cjs_development = __commonJS2({
|
|
|
10397
10326
|
type: mod2.string().optional(),
|
|
10398
10327
|
narrative: mod2.string().optional()
|
|
10399
10328
|
});
|
|
10400
|
-
var ImageValidator2 = mod2.string().or(
|
|
10401
|
-
mod2.
|
|
10402
|
-
|
|
10403
|
-
|
|
10404
|
-
|
|
10405
|
-
})
|
|
10406
|
-
);
|
|
10329
|
+
var ImageValidator2 = mod2.string().or(mod2.object({
|
|
10330
|
+
id: mod2.string(),
|
|
10331
|
+
type: mod2.string(),
|
|
10332
|
+
caption: mod2.string().optional()
|
|
10333
|
+
}));
|
|
10407
10334
|
var GeoCoordinatesValidator2 = mod2.object({
|
|
10408
10335
|
type: mod2.string().min(1).or(mod2.string().array().nonempty()),
|
|
10409
10336
|
latitude: mod2.number(),
|
|
@@ -10445,31 +10372,29 @@ var require_types_cjs_development = __commonJS2({
|
|
|
10445
10372
|
identifier: mod2.string(),
|
|
10446
10373
|
identifierType: IdentifierTypeValidator2
|
|
10447
10374
|
});
|
|
10448
|
-
var ProfileValidator2 = mod2.string().or(
|
|
10449
|
-
mod2.
|
|
10450
|
-
|
|
10451
|
-
|
|
10452
|
-
|
|
10453
|
-
|
|
10454
|
-
|
|
10455
|
-
|
|
10456
|
-
|
|
10457
|
-
|
|
10458
|
-
|
|
10459
|
-
|
|
10460
|
-
|
|
10461
|
-
|
|
10462
|
-
|
|
10463
|
-
|
|
10464
|
-
|
|
10465
|
-
|
|
10466
|
-
|
|
10467
|
-
|
|
10468
|
-
|
|
10469
|
-
|
|
10470
|
-
|
|
10471
|
-
}).catchall(mod2.any())
|
|
10472
|
-
);
|
|
10375
|
+
var ProfileValidator2 = mod2.string().or(mod2.object({
|
|
10376
|
+
id: mod2.string().optional(),
|
|
10377
|
+
type: mod2.string().or(mod2.string().array().nonempty().optional()),
|
|
10378
|
+
name: mod2.string().optional(),
|
|
10379
|
+
url: mod2.string().optional(),
|
|
10380
|
+
phone: mod2.string().optional(),
|
|
10381
|
+
description: mod2.string().optional(),
|
|
10382
|
+
endorsement: mod2.any().array().optional(),
|
|
10383
|
+
image: ImageValidator2.optional(),
|
|
10384
|
+
email: mod2.string().email().optional(),
|
|
10385
|
+
address: AddressValidator2.optional(),
|
|
10386
|
+
otherIdentifier: IdentifierEntryValidator2.array().optional(),
|
|
10387
|
+
official: mod2.string().optional(),
|
|
10388
|
+
parentOrg: mod2.any().optional(),
|
|
10389
|
+
familyName: mod2.string().optional(),
|
|
10390
|
+
givenName: mod2.string().optional(),
|
|
10391
|
+
additionalName: mod2.string().optional(),
|
|
10392
|
+
patronymicName: mod2.string().optional(),
|
|
10393
|
+
honorificPrefix: mod2.string().optional(),
|
|
10394
|
+
honorificSuffix: mod2.string().optional(),
|
|
10395
|
+
familyNamePrefix: mod2.string().optional(),
|
|
10396
|
+
dateOfBirth: mod2.string().optional()
|
|
10397
|
+
}).catchall(mod2.any()));
|
|
10473
10398
|
var CredentialSubjectValidator2 = mod2.object({ id: mod2.string().optional() }).catchall(mod2.any());
|
|
10474
10399
|
var CredentialStatusValidator2 = mod2.object({ type: mod2.string(), id: mod2.string() });
|
|
10475
10400
|
var CredentialSchemaValidator2 = mod2.object({ id: mod2.string(), type: mod2.string() });
|
|
@@ -10860,7 +10785,7 @@ var isEncrypted = /* @__PURE__ */ __name3((item) => {
|
|
|
10860
10785
|
return import_types.JWEValidator.safeParse(item).success;
|
|
10861
10786
|
}, "isEncrypted");
|
|
10862
10787
|
|
|
10863
|
-
// ../../../node_modules/.pnpm/zod@3.20.
|
|
10788
|
+
// ../../../node_modules/.pnpm/zod@3.20.2/node_modules/zod/lib/index.mjs
|
|
10864
10789
|
var util;
|
|
10865
10790
|
(function(util2) {
|
|
10866
10791
|
util2.assertEqual = (val) => val;
|
|
@@ -11291,7 +11216,7 @@ var OK = /* @__PURE__ */ __name((value) => ({ status: "valid", value }), "OK");
|
|
|
11291
11216
|
var isAborted = /* @__PURE__ */ __name((x) => x.status === "aborted", "isAborted");
|
|
11292
11217
|
var isDirty = /* @__PURE__ */ __name((x) => x.status === "dirty", "isDirty");
|
|
11293
11218
|
var isValid = /* @__PURE__ */ __name((x) => x.status === "valid", "isValid");
|
|
11294
|
-
var isAsync = /* @__PURE__ */ __name((x) => typeof Promise !==
|
|
11219
|
+
var isAsync = /* @__PURE__ */ __name((x) => typeof Promise !== void 0 && x instanceof Promise, "isAsync");
|
|
11295
11220
|
var errorUtil;
|
|
11296
11221
|
(function(errorUtil2) {
|
|
11297
11222
|
errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
@@ -11509,29 +11434,28 @@ var ZodType = class {
|
|
|
11509
11434
|
return this._refinement(refinement);
|
|
11510
11435
|
}
|
|
11511
11436
|
optional() {
|
|
11512
|
-
return ZodOptional.create(this
|
|
11437
|
+
return ZodOptional.create(this);
|
|
11513
11438
|
}
|
|
11514
11439
|
nullable() {
|
|
11515
|
-
return ZodNullable.create(this
|
|
11440
|
+
return ZodNullable.create(this);
|
|
11516
11441
|
}
|
|
11517
11442
|
nullish() {
|
|
11518
|
-
return this.
|
|
11443
|
+
return this.optional().nullable();
|
|
11519
11444
|
}
|
|
11520
11445
|
array() {
|
|
11521
|
-
return ZodArray.create(this
|
|
11446
|
+
return ZodArray.create(this);
|
|
11522
11447
|
}
|
|
11523
11448
|
promise() {
|
|
11524
|
-
return ZodPromise.create(this
|
|
11449
|
+
return ZodPromise.create(this);
|
|
11525
11450
|
}
|
|
11526
11451
|
or(option) {
|
|
11527
|
-
return ZodUnion.create([this, option]
|
|
11452
|
+
return ZodUnion.create([this, option]);
|
|
11528
11453
|
}
|
|
11529
11454
|
and(incoming) {
|
|
11530
|
-
return ZodIntersection.create(this, incoming
|
|
11455
|
+
return ZodIntersection.create(this, incoming);
|
|
11531
11456
|
}
|
|
11532
11457
|
transform(transform) {
|
|
11533
11458
|
return new ZodEffects({
|
|
11534
|
-
...processCreateParams(this._def),
|
|
11535
11459
|
schema: this,
|
|
11536
11460
|
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
|
11537
11461
|
effect: { type: "transform", transform }
|
|
@@ -11540,7 +11464,6 @@ var ZodType = class {
|
|
|
11540
11464
|
default(def) {
|
|
11541
11465
|
const defaultValueFunc = typeof def === "function" ? def : () => def;
|
|
11542
11466
|
return new ZodDefault({
|
|
11543
|
-
...processCreateParams(this._def),
|
|
11544
11467
|
innerType: this,
|
|
11545
11468
|
defaultValue: defaultValueFunc,
|
|
11546
11469
|
typeName: ZodFirstPartyTypeKind.ZodDefault
|
|
@@ -11550,15 +11473,14 @@ var ZodType = class {
|
|
|
11550
11473
|
return new ZodBranded({
|
|
11551
11474
|
typeName: ZodFirstPartyTypeKind.ZodBranded,
|
|
11552
11475
|
type: this,
|
|
11553
|
-
...processCreateParams(
|
|
11476
|
+
...processCreateParams(void 0)
|
|
11554
11477
|
});
|
|
11555
11478
|
}
|
|
11556
11479
|
catch(def) {
|
|
11557
|
-
const
|
|
11480
|
+
const defaultValueFunc = typeof def === "function" ? def : () => def;
|
|
11558
11481
|
return new ZodCatch({
|
|
11559
|
-
...processCreateParams(this._def),
|
|
11560
11482
|
innerType: this,
|
|
11561
|
-
|
|
11483
|
+
defaultValue: defaultValueFunc,
|
|
11562
11484
|
typeName: ZodFirstPartyTypeKind.ZodCatch
|
|
11563
11485
|
});
|
|
11564
11486
|
}
|
|
@@ -11581,25 +11503,24 @@ var ZodType = class {
|
|
|
11581
11503
|
};
|
|
11582
11504
|
__name(ZodType, "ZodType");
|
|
11583
11505
|
var cuidRegex = /^c[^\s-]{8,}$/i;
|
|
11584
|
-
var cuid2Regex = /^[a-z][a-z0-9]*$/;
|
|
11585
11506
|
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;
|
|
11586
|
-
var emailRegex = /^(([^<>()[\]
|
|
11507
|
+
var emailRegex = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;
|
|
11587
11508
|
var datetimeRegex = /* @__PURE__ */ __name((args) => {
|
|
11588
11509
|
if (args.precision) {
|
|
11589
11510
|
if (args.offset) {
|
|
11590
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}
|
|
11511
|
+
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}:\\d{2})|Z)$`);
|
|
11591
11512
|
} else {
|
|
11592
11513
|
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
|
|
11593
11514
|
}
|
|
11594
11515
|
} else if (args.precision === 0) {
|
|
11595
11516
|
if (args.offset) {
|
|
11596
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}
|
|
11517
|
+
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$`);
|
|
11597
11518
|
} else {
|
|
11598
11519
|
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
|
|
11599
11520
|
}
|
|
11600
11521
|
} else {
|
|
11601
11522
|
if (args.offset) {
|
|
11602
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}
|
|
11523
|
+
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$`);
|
|
11603
11524
|
} else {
|
|
11604
11525
|
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
|
|
11605
11526
|
}
|
|
@@ -11626,14 +11547,11 @@ var ZodString = class extends ZodType {
|
|
|
11626
11547
|
const parsedType = this._getType(input);
|
|
11627
11548
|
if (parsedType !== ZodParsedType.string) {
|
|
11628
11549
|
const ctx2 = this._getOrReturnCtx(input);
|
|
11629
|
-
addIssueToContext(
|
|
11630
|
-
|
|
11631
|
-
|
|
11632
|
-
|
|
11633
|
-
|
|
11634
|
-
received: ctx2.parsedType
|
|
11635
|
-
}
|
|
11636
|
-
);
|
|
11550
|
+
addIssueToContext(ctx2, {
|
|
11551
|
+
code: ZodIssueCode.invalid_type,
|
|
11552
|
+
expected: ZodParsedType.string,
|
|
11553
|
+
received: ctx2.parsedType
|
|
11554
|
+
});
|
|
11637
11555
|
return INVALID;
|
|
11638
11556
|
}
|
|
11639
11557
|
const status = new ParseStatus();
|
|
@@ -11721,16 +11639,6 @@ var ZodString = class extends ZodType {
|
|
|
11721
11639
|
});
|
|
11722
11640
|
status.dirty();
|
|
11723
11641
|
}
|
|
11724
|
-
} else if (check.kind === "cuid2") {
|
|
11725
|
-
if (!cuid2Regex.test(input.data)) {
|
|
11726
|
-
ctx = this._getOrReturnCtx(input, ctx);
|
|
11727
|
-
addIssueToContext(ctx, {
|
|
11728
|
-
validation: "cuid2",
|
|
11729
|
-
code: ZodIssueCode.invalid_string,
|
|
11730
|
-
message: check.message
|
|
11731
|
-
});
|
|
11732
|
-
status.dirty();
|
|
11733
|
-
}
|
|
11734
11642
|
} else if (check.kind === "url") {
|
|
11735
11643
|
try {
|
|
11736
11644
|
new URL(input.data);
|
|
@@ -11812,9 +11720,6 @@ var ZodString = class extends ZodType {
|
|
|
11812
11720
|
cuid(message) {
|
|
11813
11721
|
return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
|
|
11814
11722
|
}
|
|
11815
|
-
cuid2(message) {
|
|
11816
|
-
return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
|
|
11817
|
-
}
|
|
11818
11723
|
datetime(options) {
|
|
11819
11724
|
var _a;
|
|
11820
11725
|
if (typeof options === "string") {
|
|
@@ -11889,9 +11794,6 @@ var ZodString = class extends ZodType {
|
|
|
11889
11794
|
get isCUID() {
|
|
11890
11795
|
return !!this._def.checks.find((ch) => ch.kind === "cuid");
|
|
11891
11796
|
}
|
|
11892
|
-
get isCUID2() {
|
|
11893
|
-
return !!this._def.checks.find((ch) => ch.kind === "cuid2");
|
|
11894
|
-
}
|
|
11895
11797
|
get minLength() {
|
|
11896
11798
|
let min = null;
|
|
11897
11799
|
for (const ch of this._def.checks) {
|
|
@@ -12124,22 +12026,7 @@ var ZodNumber = class extends ZodType {
|
|
|
12124
12026
|
return max;
|
|
12125
12027
|
}
|
|
12126
12028
|
get isInt() {
|
|
12127
|
-
return !!this._def.checks.find((ch) => ch.kind === "int"
|
|
12128
|
-
}
|
|
12129
|
-
get isFinite() {
|
|
12130
|
-
let max = null, min = null;
|
|
12131
|
-
for (const ch of this._def.checks) {
|
|
12132
|
-
if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
|
|
12133
|
-
return true;
|
|
12134
|
-
} else if (ch.kind === "min") {
|
|
12135
|
-
if (min === null || ch.value > min)
|
|
12136
|
-
min = ch.value;
|
|
12137
|
-
} else if (ch.kind === "max") {
|
|
12138
|
-
if (max === null || ch.value < max)
|
|
12139
|
-
max = ch.value;
|
|
12140
|
-
}
|
|
12141
|
-
}
|
|
12142
|
-
return Number.isFinite(min) && Number.isFinite(max);
|
|
12029
|
+
return !!this._def.checks.find((ch) => ch.kind === "int");
|
|
12143
12030
|
}
|
|
12144
12031
|
};
|
|
12145
12032
|
__name(ZodNumber, "ZodNumber");
|
|
@@ -12507,13 +12394,13 @@ var ZodArray = class extends ZodType {
|
|
|
12507
12394
|
}
|
|
12508
12395
|
}
|
|
12509
12396
|
if (ctx.common.async) {
|
|
12510
|
-
return Promise.all(
|
|
12397
|
+
return Promise.all(ctx.data.map((item, i) => {
|
|
12511
12398
|
return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
|
|
12512
12399
|
})).then((result2) => {
|
|
12513
12400
|
return ParseStatus.mergeArray(status, result2);
|
|
12514
12401
|
});
|
|
12515
12402
|
}
|
|
12516
|
-
const result =
|
|
12403
|
+
const result = ctx.data.map((item, i) => {
|
|
12517
12404
|
return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
|
|
12518
12405
|
});
|
|
12519
12406
|
return ParseStatus.mergeArray(status, result);
|
|
@@ -12563,6 +12450,15 @@ var objectUtil;
|
|
|
12563
12450
|
};
|
|
12564
12451
|
};
|
|
12565
12452
|
})(objectUtil || (objectUtil = {}));
|
|
12453
|
+
var AugmentFactory = /* @__PURE__ */ __name((def) => (augmentation) => {
|
|
12454
|
+
return new ZodObject({
|
|
12455
|
+
...def,
|
|
12456
|
+
shape: () => ({
|
|
12457
|
+
...def.shape(),
|
|
12458
|
+
...augmentation
|
|
12459
|
+
})
|
|
12460
|
+
});
|
|
12461
|
+
}, "AugmentFactory");
|
|
12566
12462
|
function deepPartialify(schema) {
|
|
12567
12463
|
if (schema instanceof ZodObject) {
|
|
12568
12464
|
const newShape = {};
|
|
@@ -12592,7 +12488,8 @@ var ZodObject = class extends ZodType {
|
|
|
12592
12488
|
super(...arguments);
|
|
12593
12489
|
this._cached = null;
|
|
12594
12490
|
this.nonstrict = this.passthrough;
|
|
12595
|
-
this.augment = this.
|
|
12491
|
+
this.augment = AugmentFactory(this._def);
|
|
12492
|
+
this.extend = AugmentFactory(this._def);
|
|
12596
12493
|
}
|
|
12597
12494
|
_getCached() {
|
|
12598
12495
|
if (this._cached !== null)
|
|
@@ -12660,9 +12557,7 @@ var ZodObject = class extends ZodType {
|
|
|
12660
12557
|
const value = ctx.data[key];
|
|
12661
12558
|
pairs.push({
|
|
12662
12559
|
key: { status: "valid", value: key },
|
|
12663
|
-
value: catchall._parse(
|
|
12664
|
-
new ParseInputLazyPath(ctx, value, ctx.path, key)
|
|
12665
|
-
),
|
|
12560
|
+
value: catchall._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
|
|
12666
12561
|
alwaysSet: key in ctx.data
|
|
12667
12562
|
});
|
|
12668
12563
|
}
|
|
@@ -12721,14 +12616,8 @@ var ZodObject = class extends ZodType {
|
|
|
12721
12616
|
unknownKeys: "passthrough"
|
|
12722
12617
|
});
|
|
12723
12618
|
}
|
|
12724
|
-
|
|
12725
|
-
return
|
|
12726
|
-
...this._def,
|
|
12727
|
-
shape: () => ({
|
|
12728
|
-
...this._def.shape(),
|
|
12729
|
-
...augmentation
|
|
12730
|
-
})
|
|
12731
|
-
});
|
|
12619
|
+
setKey(key, schema) {
|
|
12620
|
+
return this.augment({ [key]: schema });
|
|
12732
12621
|
}
|
|
12733
12622
|
merge(merging) {
|
|
12734
12623
|
const merged = new ZodObject({
|
|
@@ -12739,9 +12628,6 @@ var ZodObject = class extends ZodType {
|
|
|
12739
12628
|
});
|
|
12740
12629
|
return merged;
|
|
12741
12630
|
}
|
|
12742
|
-
setKey(key, schema) {
|
|
12743
|
-
return this.augment({ [key]: schema });
|
|
12744
|
-
}
|
|
12745
12631
|
catchall(index) {
|
|
12746
12632
|
return new ZodObject({
|
|
12747
12633
|
...this._def,
|
|
@@ -12750,10 +12636,9 @@ var ZodObject = class extends ZodType {
|
|
|
12750
12636
|
}
|
|
12751
12637
|
pick(mask) {
|
|
12752
12638
|
const shape = {};
|
|
12753
|
-
util.objectKeys(mask).
|
|
12754
|
-
if (
|
|
12639
|
+
util.objectKeys(mask).map((key) => {
|
|
12640
|
+
if (this.shape[key])
|
|
12755
12641
|
shape[key] = this.shape[key];
|
|
12756
|
-
}
|
|
12757
12642
|
});
|
|
12758
12643
|
return new ZodObject({
|
|
12759
12644
|
...this._def,
|
|
@@ -12762,8 +12647,8 @@ var ZodObject = class extends ZodType {
|
|
|
12762
12647
|
}
|
|
12763
12648
|
omit(mask) {
|
|
12764
12649
|
const shape = {};
|
|
12765
|
-
util.objectKeys(this.shape).
|
|
12766
|
-
if (
|
|
12650
|
+
util.objectKeys(this.shape).map((key) => {
|
|
12651
|
+
if (util.objectKeys(mask).indexOf(key) === -1) {
|
|
12767
12652
|
shape[key] = this.shape[key];
|
|
12768
12653
|
}
|
|
12769
12654
|
});
|
|
@@ -12777,14 +12662,24 @@ var ZodObject = class extends ZodType {
|
|
|
12777
12662
|
}
|
|
12778
12663
|
partial(mask) {
|
|
12779
12664
|
const newShape = {};
|
|
12780
|
-
|
|
12781
|
-
|
|
12782
|
-
|
|
12783
|
-
|
|
12784
|
-
|
|
12665
|
+
if (mask) {
|
|
12666
|
+
util.objectKeys(this.shape).map((key) => {
|
|
12667
|
+
if (util.objectKeys(mask).indexOf(key) === -1) {
|
|
12668
|
+
newShape[key] = this.shape[key];
|
|
12669
|
+
} else {
|
|
12670
|
+
newShape[key] = this.shape[key].optional();
|
|
12671
|
+
}
|
|
12672
|
+
});
|
|
12673
|
+
return new ZodObject({
|
|
12674
|
+
...this._def,
|
|
12675
|
+
shape: () => newShape
|
|
12676
|
+
});
|
|
12677
|
+
} else {
|
|
12678
|
+
for (const key in this.shape) {
|
|
12679
|
+
const fieldSchema = this.shape[key];
|
|
12785
12680
|
newShape[key] = fieldSchema.optional();
|
|
12786
12681
|
}
|
|
12787
|
-
}
|
|
12682
|
+
}
|
|
12788
12683
|
return new ZodObject({
|
|
12789
12684
|
...this._def,
|
|
12790
12685
|
shape: () => newShape
|
|
@@ -12792,10 +12687,21 @@ var ZodObject = class extends ZodType {
|
|
|
12792
12687
|
}
|
|
12793
12688
|
required(mask) {
|
|
12794
12689
|
const newShape = {};
|
|
12795
|
-
|
|
12796
|
-
|
|
12797
|
-
|
|
12798
|
-
|
|
12690
|
+
if (mask) {
|
|
12691
|
+
util.objectKeys(this.shape).map((key) => {
|
|
12692
|
+
if (util.objectKeys(mask).indexOf(key) === -1) {
|
|
12693
|
+
newShape[key] = this.shape[key];
|
|
12694
|
+
} else {
|
|
12695
|
+
const fieldSchema = this.shape[key];
|
|
12696
|
+
let newField = fieldSchema;
|
|
12697
|
+
while (newField instanceof ZodOptional) {
|
|
12698
|
+
newField = newField._def.innerType;
|
|
12699
|
+
}
|
|
12700
|
+
newShape[key] = newField;
|
|
12701
|
+
}
|
|
12702
|
+
});
|
|
12703
|
+
} else {
|
|
12704
|
+
for (const key in this.shape) {
|
|
12799
12705
|
const fieldSchema = this.shape[key];
|
|
12800
12706
|
let newField = fieldSchema;
|
|
12801
12707
|
while (newField instanceof ZodOptional) {
|
|
@@ -12803,7 +12709,7 @@ var ZodObject = class extends ZodType {
|
|
|
12803
12709
|
}
|
|
12804
12710
|
newShape[key] = newField;
|
|
12805
12711
|
}
|
|
12806
|
-
}
|
|
12712
|
+
}
|
|
12807
12713
|
return new ZodObject({
|
|
12808
12714
|
...this._def,
|
|
12809
12715
|
shape: () => newShape
|
|
@@ -13149,7 +13055,7 @@ var ZodTuple = class extends ZodType {
|
|
|
13149
13055
|
});
|
|
13150
13056
|
status.dirty();
|
|
13151
13057
|
}
|
|
13152
|
-
const items =
|
|
13058
|
+
const items = ctx.data.map((item, itemIndex) => {
|
|
13153
13059
|
const schema = this._def.items[itemIndex] || this._def.rest;
|
|
13154
13060
|
if (!schema)
|
|
13155
13061
|
return null;
|
|
@@ -13525,7 +13431,6 @@ var ZodLiteral = class extends ZodType {
|
|
|
13525
13431
|
if (input.data !== this._def.value) {
|
|
13526
13432
|
const ctx = this._getOrReturnCtx(input);
|
|
13527
13433
|
addIssueToContext(ctx, {
|
|
13528
|
-
received: ctx.data,
|
|
13529
13434
|
code: ZodIssueCode.invalid_literal,
|
|
13530
13435
|
expected: this._def.value
|
|
13531
13436
|
});
|
|
@@ -13601,12 +13506,6 @@ var ZodEnum = class extends ZodType {
|
|
|
13601
13506
|
}
|
|
13602
13507
|
return enumValues;
|
|
13603
13508
|
}
|
|
13604
|
-
extract(values) {
|
|
13605
|
-
return ZodEnum.create(values);
|
|
13606
|
-
}
|
|
13607
|
-
exclude(values) {
|
|
13608
|
-
return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)));
|
|
13609
|
-
}
|
|
13610
13509
|
};
|
|
13611
13510
|
__name(ZodEnum, "ZodEnum");
|
|
13612
13511
|
ZodEnum.create = createZodEnum;
|
|
@@ -13647,9 +13546,6 @@ ZodNativeEnum.create = (values, params) => {
|
|
|
13647
13546
|
});
|
|
13648
13547
|
};
|
|
13649
13548
|
var ZodPromise = class extends ZodType {
|
|
13650
|
-
unwrap() {
|
|
13651
|
-
return this._def.type;
|
|
13652
|
-
}
|
|
13653
13549
|
_parse(input) {
|
|
13654
13550
|
const { ctx } = this._processInputParams(input);
|
|
13655
13551
|
if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
|
|
@@ -13868,29 +13764,23 @@ var ZodCatch = class extends ZodType {
|
|
|
13868
13764
|
const result = this._def.innerType._parse({
|
|
13869
13765
|
data: ctx.data,
|
|
13870
13766
|
path: ctx.path,
|
|
13871
|
-
parent:
|
|
13872
|
-
...ctx,
|
|
13873
|
-
common: {
|
|
13874
|
-
...ctx.common,
|
|
13875
|
-
issues: []
|
|
13876
|
-
}
|
|
13877
|
-
}
|
|
13767
|
+
parent: ctx
|
|
13878
13768
|
});
|
|
13879
13769
|
if (isAsync(result)) {
|
|
13880
13770
|
return result.then((result2) => {
|
|
13881
13771
|
return {
|
|
13882
13772
|
status: "valid",
|
|
13883
|
-
value: result2.status === "valid" ? result2.value : this._def.
|
|
13773
|
+
value: result2.status === "valid" ? result2.value : this._def.defaultValue()
|
|
13884
13774
|
};
|
|
13885
13775
|
});
|
|
13886
13776
|
} else {
|
|
13887
13777
|
return {
|
|
13888
13778
|
status: "valid",
|
|
13889
|
-
value: result.status === "valid" ? result.value : this._def.
|
|
13779
|
+
value: result.status === "valid" ? result.value : this._def.defaultValue()
|
|
13890
13780
|
};
|
|
13891
13781
|
}
|
|
13892
13782
|
}
|
|
13893
|
-
|
|
13783
|
+
removeDefault() {
|
|
13894
13784
|
return this._def.innerType;
|
|
13895
13785
|
}
|
|
13896
13786
|
};
|
|
@@ -13899,7 +13789,7 @@ ZodCatch.create = (type, params) => {
|
|
|
13899
13789
|
return new ZodCatch({
|
|
13900
13790
|
innerType: type,
|
|
13901
13791
|
typeName: ZodFirstPartyTypeKind.ZodCatch,
|
|
13902
|
-
|
|
13792
|
+
defaultValue: typeof params.default === "function" ? params.default : () => params.default,
|
|
13903
13793
|
...processCreateParams(params)
|
|
13904
13794
|
});
|
|
13905
13795
|
};
|
|
@@ -14092,10 +13982,7 @@ var oboolean = /* @__PURE__ */ __name(() => booleanType().optional(), "oboolean"
|
|
|
14092
13982
|
var coerce = {
|
|
14093
13983
|
string: (arg) => ZodString.create({ ...arg, coerce: true }),
|
|
14094
13984
|
number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
|
|
14095
|
-
boolean: (arg) => ZodBoolean.create({
|
|
14096
|
-
...arg,
|
|
14097
|
-
coerce: true
|
|
14098
|
-
}),
|
|
13985
|
+
boolean: (arg) => ZodBoolean.create({ ...arg, coerce: true }),
|
|
14099
13986
|
bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
|
|
14100
13987
|
date: (arg) => ZodDate.create({ ...arg, coerce: true })
|
|
14101
13988
|
};
|
|
@@ -14221,13 +14108,11 @@ var AchievementCriteriaValidator = mod.object({
|
|
|
14221
14108
|
type: mod.string().optional(),
|
|
14222
14109
|
narrative: mod.string().optional()
|
|
14223
14110
|
});
|
|
14224
|
-
var ImageValidator = mod.string().or(
|
|
14225
|
-
mod.
|
|
14226
|
-
|
|
14227
|
-
|
|
14228
|
-
|
|
14229
|
-
})
|
|
14230
|
-
);
|
|
14111
|
+
var ImageValidator = mod.string().or(mod.object({
|
|
14112
|
+
id: mod.string(),
|
|
14113
|
+
type: mod.string(),
|
|
14114
|
+
caption: mod.string().optional()
|
|
14115
|
+
}));
|
|
14231
14116
|
var GeoCoordinatesValidator = mod.object({
|
|
14232
14117
|
type: mod.string().min(1).or(mod.string().array().nonempty()),
|
|
14233
14118
|
latitude: mod.number(),
|
|
@@ -14269,31 +14154,29 @@ var IdentifierEntryValidator = mod.object({
|
|
|
14269
14154
|
identifier: mod.string(),
|
|
14270
14155
|
identifierType: IdentifierTypeValidator
|
|
14271
14156
|
});
|
|
14272
|
-
var ProfileValidator = mod.string().or(
|
|
14273
|
-
mod.
|
|
14274
|
-
|
|
14275
|
-
|
|
14276
|
-
|
|
14277
|
-
|
|
14278
|
-
|
|
14279
|
-
|
|
14280
|
-
|
|
14281
|
-
|
|
14282
|
-
|
|
14283
|
-
|
|
14284
|
-
|
|
14285
|
-
|
|
14286
|
-
|
|
14287
|
-
|
|
14288
|
-
|
|
14289
|
-
|
|
14290
|
-
|
|
14291
|
-
|
|
14292
|
-
|
|
14293
|
-
|
|
14294
|
-
|
|
14295
|
-
}).catchall(mod.any())
|
|
14296
|
-
);
|
|
14157
|
+
var ProfileValidator = mod.string().or(mod.object({
|
|
14158
|
+
id: mod.string().optional(),
|
|
14159
|
+
type: mod.string().or(mod.string().array().nonempty().optional()),
|
|
14160
|
+
name: mod.string().optional(),
|
|
14161
|
+
url: mod.string().optional(),
|
|
14162
|
+
phone: mod.string().optional(),
|
|
14163
|
+
description: mod.string().optional(),
|
|
14164
|
+
endorsement: mod.any().array().optional(),
|
|
14165
|
+
image: ImageValidator.optional(),
|
|
14166
|
+
email: mod.string().email().optional(),
|
|
14167
|
+
address: AddressValidator.optional(),
|
|
14168
|
+
otherIdentifier: IdentifierEntryValidator.array().optional(),
|
|
14169
|
+
official: mod.string().optional(),
|
|
14170
|
+
parentOrg: mod.any().optional(),
|
|
14171
|
+
familyName: mod.string().optional(),
|
|
14172
|
+
givenName: mod.string().optional(),
|
|
14173
|
+
additionalName: mod.string().optional(),
|
|
14174
|
+
patronymicName: mod.string().optional(),
|
|
14175
|
+
honorificPrefix: mod.string().optional(),
|
|
14176
|
+
honorificSuffix: mod.string().optional(),
|
|
14177
|
+
familyNamePrefix: mod.string().optional(),
|
|
14178
|
+
dateOfBirth: mod.string().optional()
|
|
14179
|
+
}).catchall(mod.any()));
|
|
14297
14180
|
var CredentialSubjectValidator = mod.object({ id: mod.string().optional() }).catchall(mod.any());
|
|
14298
14181
|
var CredentialStatusValidator = mod.object({ type: mod.string(), id: mod.string() });
|
|
14299
14182
|
var CredentialSchemaValidator = mod.object({ id: mod.string(), type: mod.string() });
|
|
@@ -14675,7 +14558,7 @@ var import_json_stringify_deterministic = __toESM(require_lib());
|
|
|
14675
14558
|
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 } };
|
|
14676
14559
|
function t(t2, a, o, i, s = "SHA-256") {
|
|
14677
14560
|
return new Promise((u, c) => {
|
|
14678
|
-
s in e || c(new RangeError(`Valid hash algorithm values are any of ${Object.keys(e).toString()}`)), "string"
|
|
14561
|
+
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) => {
|
|
14679
14562
|
const y = { name: "PBKDF2", hash: s, salt: a, iterations: o };
|
|
14680
14563
|
crypto.subtle.deriveBits(y, f, 8 * i).then((e2) => u(e2), (f2) => {
|
|
14681
14564
|
(async function(t3, a2, o2, i2, s2) {
|
|
@@ -14687,7 +14570,7 @@ function t(t2, a, o, i, s = "SHA-256") {
|
|
|
14687
14570
|
if (!Number.isInteger(i2) || i2 <= 0 || i2 >= (2 ** 32 - 1) * u2)
|
|
14688
14571
|
throw new RangeError("dkLen must be a positive integer < (2 ** 32 - 1) * hLen");
|
|
14689
14572
|
const c2 = Math.ceil(i2 / u2), f3 = i2 - (c2 - 1) * u2, y2 = new Array(c2);
|
|
14690
|
-
|
|
14573
|
+
t3.byteLength === 0 && (t3 = new Uint8Array(e[s2].blockSize));
|
|
14691
14574
|
const w = await crypto.subtle.importKey("raw", t3, { name: "HMAC", hash: { name: s2 } }, true, ["sign"]), g = /* @__PURE__ */ __name(async function(e2, t4) {
|
|
14692
14575
|
const r2 = await crypto.subtle.sign("HMAC", e2, t4);
|
|
14693
14576
|
return new Uint8Array(r2);
|
|
@@ -14716,7 +14599,7 @@ function t(t2, a, o, i, s = "SHA-256") {
|
|
|
14716
14599
|
__name(t, "t");
|
|
14717
14600
|
function r(...e2) {
|
|
14718
14601
|
const t2 = e2.reduce((e3, t3) => e3 + t3.length, 0);
|
|
14719
|
-
if (
|
|
14602
|
+
if (e2.length === 0)
|
|
14720
14603
|
throw new RangeError("Cannot concat no arrays");
|
|
14721
14604
|
const r2 = new Uint8Array(t2);
|
|
14722
14605
|
let n2 = 0;
|
|
@@ -14737,13 +14620,7 @@ var hash = /* @__PURE__ */ __name(async (learnCard, message) => {
|
|
|
14737
14620
|
const uint8Message = new TextEncoder().encode(message);
|
|
14738
14621
|
const pk = learnCard.id.keypair("secp256k1").d;
|
|
14739
14622
|
const hmacKey = await t(pk, "salt", 1e3, 32);
|
|
14740
|
-
const cryptoKey = await crypto2.subtle.importKey(
|
|
14741
|
-
"raw",
|
|
14742
|
-
hmacKey,
|
|
14743
|
-
{ name: "HMAC", hash: "SHA-256" },
|
|
14744
|
-
false,
|
|
14745
|
-
["sign"]
|
|
14746
|
-
);
|
|
14623
|
+
const cryptoKey = await crypto2.subtle.importKey("raw", hmacKey, { name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
|
|
14747
14624
|
const digestBuffer = await crypto2.subtle.sign("HMAC", cryptoKey, uint8Message);
|
|
14748
14625
|
const digestArray = Array.from(new Uint8Array(digestBuffer));
|
|
14749
14626
|
return digestArray.map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
@@ -14756,22 +14633,18 @@ var decryptJWE = /* @__PURE__ */ __name(async (learnCard, jwe) => {
|
|
|
14756
14633
|
}, "decryptJWE");
|
|
14757
14634
|
var generateEncryptedFieldsArray = /* @__PURE__ */ __name(async (learnCard, record, unencryptedFields = []) => {
|
|
14758
14635
|
const entries = Object.entries(record);
|
|
14759
|
-
return (await Promise.all(
|
|
14760
|
-
|
|
14761
|
-
|
|
14762
|
-
|
|
14763
|
-
|
|
14764
|
-
|
|
14765
|
-
|
|
14766
|
-
})
|
|
14767
|
-
)).filter(Boolean);
|
|
14636
|
+
return (await Promise.all(entries.map(async ([key, value]) => {
|
|
14637
|
+
if (!unencryptedFields.includes(key)) {
|
|
14638
|
+
const result = await hash(learnCard, `${key}:${(0, import_json_stringify_deterministic.default)(value)}`);
|
|
14639
|
+
return result;
|
|
14640
|
+
}
|
|
14641
|
+
return "";
|
|
14642
|
+
}))).filter(Boolean);
|
|
14768
14643
|
}, "generateEncryptedFieldsArray");
|
|
14769
14644
|
var generateEncryptedRecord = /* @__PURE__ */ __name(async (learnCard, record, unencryptedFields = []) => {
|
|
14770
14645
|
const encryptedRecord = await learnCard.invoke.getDIDObject().createDagJWE(record, [learnCard.id.did()]);
|
|
14771
14646
|
const fields = await generateEncryptedFieldsArray(learnCard, record, unencryptedFields);
|
|
14772
|
-
const unencryptedEntries = Object.fromEntries(
|
|
14773
|
-
Object.entries(record).filter(([key]) => unencryptedFields.includes(key))
|
|
14774
|
-
);
|
|
14647
|
+
const unencryptedEntries = Object.fromEntries(Object.entries(record).filter(([key]) => unencryptedFields.includes(key)));
|
|
14775
14648
|
return { ...unencryptedEntries, encryptedRecord, fields };
|
|
14776
14649
|
}, "generateEncryptedRecord");
|
|
14777
14650
|
|
|
@@ -14813,22 +14686,14 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
14813
14686
|
methods: {
|
|
14814
14687
|
learnCloudCreate: async (_learnCard, document) => {
|
|
14815
14688
|
await updateLearnCard(_learnCard);
|
|
14816
|
-
const item = await generateEncryptedRecord(
|
|
14817
|
-
_learnCard,
|
|
14818
|
-
document,
|
|
14819
|
-
unencryptedCustomFields
|
|
14820
|
-
);
|
|
14689
|
+
const item = await generateEncryptedRecord(_learnCard, document, unencryptedCustomFields);
|
|
14821
14690
|
return client.customStorage.create.mutate({
|
|
14822
14691
|
item: await generateJWE(_learnCard, learnCloudDid, item)
|
|
14823
14692
|
});
|
|
14824
14693
|
},
|
|
14825
14694
|
learnCloudCreateMany: async (_learnCard, documents) => {
|
|
14826
14695
|
await updateLearnCard(_learnCard);
|
|
14827
|
-
const items = await Promise.all(
|
|
14828
|
-
documents.map(
|
|
14829
|
-
async (document) => generateEncryptedRecord(_learnCard, document, unencryptedCustomFields)
|
|
14830
|
-
)
|
|
14831
|
-
);
|
|
14696
|
+
const items = await Promise.all(documents.map(async (document) => generateEncryptedRecord(_learnCard, document, unencryptedCustomFields)));
|
|
14832
14697
|
return client.customStorage.createMany.mutate({
|
|
14833
14698
|
items: await generateJWE(_learnCard, learnCloudDid, items)
|
|
14834
14699
|
});
|
|
@@ -14836,18 +14701,10 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
14836
14701
|
learnCloudRead: async (_learnCard, query, includeAssociatedDids) => {
|
|
14837
14702
|
await updateLearnCard(_learnCard);
|
|
14838
14703
|
const documents = [];
|
|
14839
|
-
let result = await _learnCard.invoke.learnCloudReadPage(
|
|
14840
|
-
query,
|
|
14841
|
-
{},
|
|
14842
|
-
includeAssociatedDids
|
|
14843
|
-
);
|
|
14704
|
+
let result = await _learnCard.invoke.learnCloudReadPage(query, {}, includeAssociatedDids);
|
|
14844
14705
|
documents.push(...result.records);
|
|
14845
14706
|
while (result.hasMore) {
|
|
14846
|
-
result = await _learnCard.invoke.learnCloudReadPage(
|
|
14847
|
-
query,
|
|
14848
|
-
{},
|
|
14849
|
-
includeAssociatedDids
|
|
14850
|
-
);
|
|
14707
|
+
result = await _learnCard.invoke.learnCloudReadPage(query, {}, includeAssociatedDids);
|
|
14851
14708
|
documents.push(...result.records);
|
|
14852
14709
|
}
|
|
14853
14710
|
return documents;
|
|
@@ -14862,26 +14719,17 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
14862
14719
|
const encryptedRecords2 = isEncrypted(jwe2) ? await decryptJWE(_learnCard, jwe2) : jwe2;
|
|
14863
14720
|
return {
|
|
14864
14721
|
...encryptedRecords2,
|
|
14865
|
-
records: await Promise.all(
|
|
14866
|
-
|
|
14867
|
-
|
|
14868
|
-
|
|
14869
|
-
record.encryptedRecord
|
|
14870
|
-
),
|
|
14871
|
-
_id: record._id
|
|
14872
|
-
}))
|
|
14873
|
-
)
|
|
14722
|
+
records: await Promise.all(encryptedRecords2.records.map(async (record) => ({
|
|
14723
|
+
...await decryptJWE(_learnCard, record.encryptedRecord),
|
|
14724
|
+
_id: record._id
|
|
14725
|
+
})))
|
|
14874
14726
|
};
|
|
14875
14727
|
}
|
|
14876
14728
|
const fields = await generateEncryptedFieldsArray(_learnCard, query, [
|
|
14877
14729
|
...unencryptedCustomFields,
|
|
14878
14730
|
"_id"
|
|
14879
14731
|
]);
|
|
14880
|
-
const unencryptedEntries = Object.fromEntries(
|
|
14881
|
-
Object.entries(query).filter(
|
|
14882
|
-
([key]) => [...unencryptedCustomFields, "_id"].includes(key)
|
|
14883
|
-
)
|
|
14884
|
-
);
|
|
14732
|
+
const unencryptedEntries = Object.fromEntries(Object.entries(query).filter(([key]) => [...unencryptedCustomFields, "_id"].includes(key)));
|
|
14885
14733
|
const jwe = await client.customStorage.read.query({
|
|
14886
14734
|
query: await generateJWE(_learnCard, learnCloudDid, {
|
|
14887
14735
|
...unencryptedEntries,
|
|
@@ -14893,15 +14741,10 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
14893
14741
|
const encryptedRecords = isEncrypted(jwe) ? await decryptJWE(_learnCard, jwe) : jwe;
|
|
14894
14742
|
return {
|
|
14895
14743
|
...encryptedRecords,
|
|
14896
|
-
records: await Promise.all(
|
|
14897
|
-
|
|
14898
|
-
|
|
14899
|
-
|
|
14900
|
-
record.encryptedRecord
|
|
14901
|
-
),
|
|
14902
|
-
_id: record._id
|
|
14903
|
-
}))
|
|
14904
|
-
)
|
|
14744
|
+
records: await Promise.all(encryptedRecords.records.map(async (record) => ({
|
|
14745
|
+
...await decryptJWE(_learnCard, record.encryptedRecord),
|
|
14746
|
+
_id: record._id
|
|
14747
|
+
})))
|
|
14905
14748
|
};
|
|
14906
14749
|
},
|
|
14907
14750
|
learnCloudCount: async (_learnCard, query, includeAssociatedDids) => {
|
|
@@ -14912,11 +14755,7 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
14912
14755
|
...unencryptedCustomFields,
|
|
14913
14756
|
"_id"
|
|
14914
14757
|
]);
|
|
14915
|
-
const unencryptedEntries = Object.fromEntries(
|
|
14916
|
-
Object.entries(query).filter(
|
|
14917
|
-
([key]) => [...unencryptedCustomFields, "_id"].includes(key)
|
|
14918
|
-
)
|
|
14919
|
-
);
|
|
14758
|
+
const unencryptedEntries = Object.fromEntries(Object.entries(query).filter(([key]) => [...unencryptedCustomFields, "_id"].includes(key)));
|
|
14920
14759
|
return client.customStorage.count.query({
|
|
14921
14760
|
query: await generateJWE(_learnCard, learnCloudDid, {
|
|
14922
14761
|
...unencryptedEntries,
|
|
@@ -14928,24 +14767,12 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
14928
14767
|
learnCloudUpdate: async (_learnCard, query, update) => {
|
|
14929
14768
|
await updateLearnCard(_learnCard);
|
|
14930
14769
|
const documents = await _learnCard.invoke.learnCloudRead(query);
|
|
14931
|
-
const updates = await Promise.all(
|
|
14932
|
-
|
|
14933
|
-
|
|
14934
|
-
|
|
14935
|
-
|
|
14936
|
-
|
|
14937
|
-
update: await generateJWE(
|
|
14938
|
-
_learnCard,
|
|
14939
|
-
learnCloudDid,
|
|
14940
|
-
await generateEncryptedRecord(
|
|
14941
|
-
_learnCard,
|
|
14942
|
-
{ ...document, ...update },
|
|
14943
|
-
unencryptedCustomFields
|
|
14944
|
-
)
|
|
14945
|
-
)
|
|
14946
|
-
})
|
|
14947
|
-
)
|
|
14948
|
-
);
|
|
14770
|
+
const updates = await Promise.all(documents.map(async (document) => client.customStorage.update.mutate({
|
|
14771
|
+
query: await generateJWE(_learnCard, learnCloudDid, {
|
|
14772
|
+
_id: document._id
|
|
14773
|
+
}),
|
|
14774
|
+
update: await generateJWE(_learnCard, learnCloudDid, await generateEncryptedRecord(_learnCard, { ...document, ...update }, unencryptedCustomFields))
|
|
14775
|
+
})));
|
|
14949
14776
|
return updates.reduce((sum, current) => current + sum, 0);
|
|
14950
14777
|
},
|
|
14951
14778
|
learnCloudDelete: async (_learnCard, query, includeAssociatedDids) => {
|
|
@@ -14956,11 +14783,7 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
14956
14783
|
...unencryptedCustomFields,
|
|
14957
14784
|
"_id"
|
|
14958
14785
|
]);
|
|
14959
|
-
const unencryptedEntries = Object.fromEntries(
|
|
14960
|
-
Object.entries(query).filter(
|
|
14961
|
-
([key]) => [...unencryptedCustomFields, "_id"].includes(key)
|
|
14962
|
-
)
|
|
14963
|
-
);
|
|
14786
|
+
const unencryptedEntries = Object.fromEntries(Object.entries(query).filter(([key]) => [...unencryptedCustomFields, "_id"].includes(key)));
|
|
14964
14787
|
return client.customStorage.delete.mutate({
|
|
14965
14788
|
query: await generateJWE(_learnCard, learnCloudDid, {
|
|
14966
14789
|
...unencryptedEntries,
|
|
@@ -15023,33 +14846,17 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15023
14846
|
const jwe2 = await client.index.get.query(paginationOptions);
|
|
15024
14847
|
_learnCard.debug?.("LearnCloud index.get (no query response)", jwe2);
|
|
15025
14848
|
const encryptedRecords2 = isEncrypted(jwe2) ? await decryptJWE(_learnCard, jwe2) : jwe2;
|
|
15026
|
-
_learnCard.debug?.(
|
|
15027
|
-
"LearnCloud index.get (no query encryptedRecords)",
|
|
15028
|
-
encryptedRecords2
|
|
15029
|
-
);
|
|
14849
|
+
_learnCard.debug?.("LearnCloud index.get (no query encryptedRecords)", encryptedRecords2);
|
|
15030
14850
|
return {
|
|
15031
14851
|
...encryptedRecords2,
|
|
15032
|
-
records: await Promise.all(
|
|
15033
|
-
encryptedRecords2.records.map(
|
|
15034
|
-
async (record) => decryptJWE(_learnCard, record.encryptedRecord)
|
|
15035
|
-
)
|
|
15036
|
-
)
|
|
14852
|
+
records: await Promise.all(encryptedRecords2.records.map(async (record) => decryptJWE(_learnCard, record.encryptedRecord)))
|
|
15037
14853
|
};
|
|
15038
14854
|
}
|
|
15039
14855
|
_learnCard.debug?.("LearnCloud index.get (query)");
|
|
15040
|
-
const fields = await generateEncryptedFieldsArray(
|
|
15041
|
-
_learnCard,
|
|
15042
|
-
query,
|
|
15043
|
-
unencryptedFields
|
|
15044
|
-
);
|
|
14856
|
+
const fields = await generateEncryptedFieldsArray(_learnCard, query, unencryptedFields);
|
|
15045
14857
|
_learnCard.debug?.("LearnCloud index.get (query fields)", fields);
|
|
15046
|
-
const unencryptedEntries = Object.fromEntries(
|
|
15047
|
-
|
|
15048
|
-
);
|
|
15049
|
-
_learnCard.debug?.(
|
|
15050
|
-
"LearnCloud index.get (query unencryptedEntries)",
|
|
15051
|
-
unencryptedEntries
|
|
15052
|
-
);
|
|
14858
|
+
const unencryptedEntries = Object.fromEntries(Object.entries(query).filter(([key]) => unencryptedFields.includes(key)));
|
|
14859
|
+
_learnCard.debug?.("LearnCloud index.get (query unencryptedEntries)", unencryptedEntries);
|
|
15053
14860
|
const jwe = await client.index.get.query({
|
|
15054
14861
|
query: await generateJWE(_learnCard, learnCloudDid, {
|
|
15055
14862
|
...unencryptedEntries,
|
|
@@ -15059,17 +14866,10 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15059
14866
|
});
|
|
15060
14867
|
_learnCard.debug?.("LearnCloud index.get (query jwe)", jwe);
|
|
15061
14868
|
const encryptedRecords = isEncrypted(jwe) ? await decryptJWE(_learnCard, jwe) : jwe;
|
|
15062
|
-
_learnCard.debug?.(
|
|
15063
|
-
"LearnCloud index.get (query encryptedRecords)",
|
|
15064
|
-
encryptedRecords
|
|
15065
|
-
);
|
|
14869
|
+
_learnCard.debug?.("LearnCloud index.get (query encryptedRecords)", encryptedRecords);
|
|
15066
14870
|
return {
|
|
15067
14871
|
...encryptedRecords,
|
|
15068
|
-
records: await Promise.all(
|
|
15069
|
-
encryptedRecords.records.map(
|
|
15070
|
-
async (record) => decryptJWE(_learnCard, record.encryptedRecord)
|
|
15071
|
-
)
|
|
15072
|
-
)
|
|
14872
|
+
records: await Promise.all(encryptedRecords.records.map(async (record) => decryptJWE(_learnCard, record.encryptedRecord)))
|
|
15073
14873
|
};
|
|
15074
14874
|
},
|
|
15075
14875
|
getCount: async (_learnCard, query) => {
|
|
@@ -15083,19 +14883,10 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15083
14883
|
return count2;
|
|
15084
14884
|
}
|
|
15085
14885
|
_learnCard.debug?.("LearnCloud index.getCount (query)");
|
|
15086
|
-
const fields = await generateEncryptedFieldsArray(
|
|
15087
|
-
_learnCard,
|
|
15088
|
-
query,
|
|
15089
|
-
unencryptedFields
|
|
15090
|
-
);
|
|
14886
|
+
const fields = await generateEncryptedFieldsArray(_learnCard, query, unencryptedFields);
|
|
15091
14887
|
_learnCard.debug?.("LearnCloud index.getCount (query fields)", fields);
|
|
15092
|
-
const unencryptedEntries = Object.fromEntries(
|
|
15093
|
-
|
|
15094
|
-
);
|
|
15095
|
-
_learnCard.debug?.(
|
|
15096
|
-
"LearnCloud index.getCount (query unencryptedEntries)",
|
|
15097
|
-
unencryptedEntries
|
|
15098
|
-
);
|
|
14888
|
+
const unencryptedEntries = Object.fromEntries(Object.entries(query).filter(([key]) => unencryptedFields.includes(key)));
|
|
14889
|
+
_learnCard.debug?.("LearnCloud index.getCount (query unencryptedEntries)", unencryptedEntries);
|
|
15099
14890
|
const jwe = await client.index.count.query({
|
|
15100
14891
|
query: await generateJWE(_learnCard, learnCloudDid, {
|
|
15101
14892
|
...unencryptedEntries,
|
|
@@ -15112,37 +14903,25 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15112
14903
|
const id = record.id || _learnCard.invoke.crypto().randomUUID();
|
|
15113
14904
|
return client.index.add.mutate({
|
|
15114
14905
|
record: await generateJWE(_learnCard, learnCloudDid, {
|
|
15115
|
-
...await generateEncryptedRecord(
|
|
15116
|
-
_learnCard,
|
|
15117
|
-
{ ...record, id },
|
|
15118
|
-
unencryptedFields
|
|
15119
|
-
),
|
|
14906
|
+
...await generateEncryptedRecord(_learnCard, { ...record, id }, unencryptedFields),
|
|
15120
14907
|
id: await hash(_learnCard, id)
|
|
15121
14908
|
})
|
|
15122
14909
|
});
|
|
15123
14910
|
},
|
|
15124
14911
|
addMany: async (_learnCard, _records) => {
|
|
15125
14912
|
await updateLearnCard(_learnCard);
|
|
15126
|
-
const results = await Promise.all(
|
|
15127
|
-
|
|
15128
|
-
const
|
|
15129
|
-
|
|
15130
|
-
|
|
15131
|
-
|
|
15132
|
-
|
|
15133
|
-
|
|
15134
|
-
|
|
15135
|
-
|
|
15136
|
-
|
|
15137
|
-
|
|
15138
|
-
};
|
|
15139
|
-
})
|
|
15140
|
-
);
|
|
15141
|
-
return client.index.addMany.mutate({
|
|
15142
|
-
records: await generateJWE(_learnCard, learnCloudDid, records)
|
|
15143
|
-
});
|
|
15144
|
-
})
|
|
15145
|
-
);
|
|
14913
|
+
const results = await Promise.all((0, import_lodash.chunk)(_records, 25).map(async (batch) => {
|
|
14914
|
+
const records = await Promise.all(batch.map(async (record) => {
|
|
14915
|
+
const id = record.id || _learnCard.invoke.crypto().randomUUID();
|
|
14916
|
+
return {
|
|
14917
|
+
...await generateEncryptedRecord(_learnCard, { ...record, id }, unencryptedFields),
|
|
14918
|
+
id: await hash(_learnCard, id)
|
|
14919
|
+
};
|
|
14920
|
+
}));
|
|
14921
|
+
return client.index.addMany.mutate({
|
|
14922
|
+
records: await generateJWE(_learnCard, learnCloudDid, records)
|
|
14923
|
+
});
|
|
14924
|
+
}));
|
|
15146
14925
|
return results.every(Boolean);
|
|
15147
14926
|
},
|
|
15148
14927
|
update: async (_learnCard, id, updates) => {
|
|
@@ -15154,11 +14933,7 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15154
14933
|
const newRecord = { ...record, ...updates };
|
|
15155
14934
|
return client.index.update.mutate({
|
|
15156
14935
|
id: await hash(_learnCard, id),
|
|
15157
|
-
updates: await generateJWE(
|
|
15158
|
-
_learnCard,
|
|
15159
|
-
learnCloudDid,
|
|
15160
|
-
await generateEncryptedRecord(_learnCard, newRecord, unencryptedFields)
|
|
15161
|
-
)
|
|
14936
|
+
updates: await generateJWE(_learnCard, learnCloudDid, await generateEncryptedRecord(_learnCard, newRecord, unencryptedFields))
|
|
15162
14937
|
});
|
|
15163
14938
|
},
|
|
15164
14939
|
remove: async (_learnCard, id) => {
|