@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.
@@ -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";
@@ -7464,7 +7430,7 @@ var require_types_cjs_development = __commonJS2({
7464
7430
  var isAborted2 = /* @__PURE__ */ __name22((x) => x.status === "aborted", "isAborted");
7465
7431
  var isDirty2 = /* @__PURE__ */ __name22((x) => x.status === "dirty", "isDirty");
7466
7432
  var isValid2 = /* @__PURE__ */ __name22((x) => x.status === "valid", "isValid");
7467
- var isAsync2 = /* @__PURE__ */ __name22((x) => typeof Promise !== "undefined" && x instanceof Promise, "isAsync");
7433
+ var isAsync2 = /* @__PURE__ */ __name22((x) => typeof Promise !== void 0 && x instanceof Promise, "isAsync");
7468
7434
  var errorUtil2;
7469
7435
  (function(errorUtil22) {
7470
7436
  errorUtil22.errToObj = (message) => typeof message === "string" ? { message } : message || {};
@@ -7684,29 +7650,28 @@ var require_types_cjs_development = __commonJS2({
7684
7650
  return this._refinement(refinement);
7685
7651
  }
7686
7652
  optional() {
7687
- return ZodOptional2.create(this, this._def);
7653
+ return ZodOptional2.create(this);
7688
7654
  }
7689
7655
  nullable() {
7690
- return ZodNullable2.create(this, this._def);
7656
+ return ZodNullable2.create(this);
7691
7657
  }
7692
7658
  nullish() {
7693
- return this.nullable().optional();
7659
+ return this.optional().nullable();
7694
7660
  }
7695
7661
  array() {
7696
- return ZodArray2.create(this, this._def);
7662
+ return ZodArray2.create(this);
7697
7663
  }
7698
7664
  promise() {
7699
- return ZodPromise2.create(this, this._def);
7665
+ return ZodPromise2.create(this);
7700
7666
  }
7701
7667
  or(option) {
7702
- return ZodUnion2.create([this, option], this._def);
7668
+ return ZodUnion2.create([this, option]);
7703
7669
  }
7704
7670
  and(incoming) {
7705
- return ZodIntersection2.create(this, incoming, this._def);
7671
+ return ZodIntersection2.create(this, incoming);
7706
7672
  }
7707
7673
  transform(transform) {
7708
7674
  return new ZodEffects2({
7709
- ...processCreateParams2(this._def),
7710
7675
  schema: this,
7711
7676
  typeName: ZodFirstPartyTypeKind2.ZodEffects,
7712
7677
  effect: { type: "transform", transform }
@@ -7715,7 +7680,6 @@ var require_types_cjs_development = __commonJS2({
7715
7680
  default(def) {
7716
7681
  const defaultValueFunc = typeof def === "function" ? def : () => def;
7717
7682
  return new ZodDefault2({
7718
- ...processCreateParams2(this._def),
7719
7683
  innerType: this,
7720
7684
  defaultValue: defaultValueFunc,
7721
7685
  typeName: ZodFirstPartyTypeKind2.ZodDefault
@@ -7725,15 +7689,14 @@ var require_types_cjs_development = __commonJS2({
7725
7689
  return new ZodBranded2({
7726
7690
  typeName: ZodFirstPartyTypeKind2.ZodBranded,
7727
7691
  type: this,
7728
- ...processCreateParams2(this._def)
7692
+ ...processCreateParams2(void 0)
7729
7693
  });
7730
7694
  }
7731
7695
  catch(def) {
7732
- const catchValueFunc = typeof def === "function" ? def : () => def;
7696
+ const defaultValueFunc = typeof def === "function" ? def : () => def;
7733
7697
  return new ZodCatch2({
7734
- ...processCreateParams2(this._def),
7735
7698
  innerType: this,
7736
- catchValue: catchValueFunc,
7699
+ defaultValue: defaultValueFunc,
7737
7700
  typeName: ZodFirstPartyTypeKind2.ZodCatch
7738
7701
  });
7739
7702
  }
@@ -7756,25 +7719,24 @@ var require_types_cjs_development = __commonJS2({
7756
7719
  }, "ZodType");
7757
7720
  __name22(ZodType2, "ZodType");
7758
7721
  var cuidRegex2 = /^c[^\s-]{8,}$/i;
7759
- var cuid2Regex2 = /^[a-z][a-z0-9]*$/;
7760
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;
7761
- var emailRegex2 = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|([^-]([a-zA-Z0-9-]*\.)+[a-zA-Z]{2,}))$/;
7723
+ var emailRegex2 = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;
7762
7724
  var datetimeRegex2 = /* @__PURE__ */ __name22((args) => {
7763
7725
  if (args.precision) {
7764
7726
  if (args.offset) {
7765
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
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)$`);
7766
7728
  } else {
7767
7729
  return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
7768
7730
  }
7769
7731
  } else if (args.precision === 0) {
7770
7732
  if (args.offset) {
7771
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
7733
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$`);
7772
7734
  } else {
7773
7735
  return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
7774
7736
  }
7775
7737
  } else {
7776
7738
  if (args.offset) {
7777
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
7739
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$`);
7778
7740
  } else {
7779
7741
  return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
7780
7742
  }
@@ -7801,14 +7763,11 @@ var require_types_cjs_development = __commonJS2({
7801
7763
  const parsedType = this._getType(input);
7802
7764
  if (parsedType !== ZodParsedType2.string) {
7803
7765
  const ctx2 = this._getOrReturnCtx(input);
7804
- addIssueToContext2(
7805
- ctx2,
7806
- {
7807
- code: ZodIssueCode2.invalid_type,
7808
- expected: ZodParsedType2.string,
7809
- received: ctx2.parsedType
7810
- }
7811
- );
7766
+ addIssueToContext2(ctx2, {
7767
+ code: ZodIssueCode2.invalid_type,
7768
+ expected: ZodParsedType2.string,
7769
+ received: ctx2.parsedType
7770
+ });
7812
7771
  return INVALID2;
7813
7772
  }
7814
7773
  const status = new ParseStatus2();
@@ -7896,16 +7855,6 @@ var require_types_cjs_development = __commonJS2({
7896
7855
  });
7897
7856
  status.dirty();
7898
7857
  }
7899
- } else if (check.kind === "cuid2") {
7900
- if (!cuid2Regex2.test(input.data)) {
7901
- ctx = this._getOrReturnCtx(input, ctx);
7902
- addIssueToContext2(ctx, {
7903
- validation: "cuid2",
7904
- code: ZodIssueCode2.invalid_string,
7905
- message: check.message
7906
- });
7907
- status.dirty();
7908
- }
7909
7858
  } else if (check.kind === "url") {
7910
7859
  try {
7911
7860
  new URL(input.data);
@@ -7987,9 +7936,6 @@ var require_types_cjs_development = __commonJS2({
7987
7936
  cuid(message) {
7988
7937
  return this._addCheck({ kind: "cuid", ...errorUtil2.errToObj(message) });
7989
7938
  }
7990
- cuid2(message) {
7991
- return this._addCheck({ kind: "cuid2", ...errorUtil2.errToObj(message) });
7992
- }
7993
7939
  datetime(options) {
7994
7940
  var _a;
7995
7941
  if (typeof options === "string") {
@@ -8064,9 +8010,6 @@ var require_types_cjs_development = __commonJS2({
8064
8010
  get isCUID() {
8065
8011
  return !!this._def.checks.find((ch) => ch.kind === "cuid");
8066
8012
  }
8067
- get isCUID2() {
8068
- return !!this._def.checks.find((ch) => ch.kind === "cuid2");
8069
- }
8070
8013
  get minLength() {
8071
8014
  let min = null;
8072
8015
  for (const ch of this._def.checks) {
@@ -8301,22 +8244,7 @@ var require_types_cjs_development = __commonJS2({
8301
8244
  return max;
8302
8245
  }
8303
8246
  get isInt() {
8304
- return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util2.isInteger(ch.value));
8305
- }
8306
- get isFinite() {
8307
- let max = null, min = null;
8308
- for (const ch of this._def.checks) {
8309
- if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
8310
- return true;
8311
- } else if (ch.kind === "min") {
8312
- if (min === null || ch.value > min)
8313
- min = ch.value;
8314
- } else if (ch.kind === "max") {
8315
- if (max === null || ch.value < max)
8316
- max = ch.value;
8317
- }
8318
- }
8319
- return Number.isFinite(min) && Number.isFinite(max);
8247
+ return !!this._def.checks.find((ch) => ch.kind === "int");
8320
8248
  }
8321
8249
  }, "ZodNumber");
8322
8250
  __name22(ZodNumber2, "ZodNumber");
@@ -8684,13 +8612,13 @@ var require_types_cjs_development = __commonJS2({
8684
8612
  }
8685
8613
  }
8686
8614
  if (ctx.common.async) {
8687
- return Promise.all([...ctx.data].map((item, i) => {
8615
+ return Promise.all(ctx.data.map((item, i) => {
8688
8616
  return def.type._parseAsync(new ParseInputLazyPath2(ctx, item, ctx.path, i));
8689
8617
  })).then((result2) => {
8690
8618
  return ParseStatus2.mergeArray(status, result2);
8691
8619
  });
8692
8620
  }
8693
- const result = [...ctx.data].map((item, i) => {
8621
+ const result = ctx.data.map((item, i) => {
8694
8622
  return def.type._parseSync(new ParseInputLazyPath2(ctx, item, ctx.path, i));
8695
8623
  });
8696
8624
  return ParseStatus2.mergeArray(status, result);
@@ -8740,6 +8668,15 @@ var require_types_cjs_development = __commonJS2({
8740
8668
  };
8741
8669
  };
8742
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");
8743
8680
  function deepPartialify2(schema) {
8744
8681
  if (schema instanceof ZodObject2) {
8745
8682
  const newShape = {};
@@ -8771,7 +8708,8 @@ var require_types_cjs_development = __commonJS2({
8771
8708
  super(...arguments);
8772
8709
  this._cached = null;
8773
8710
  this.nonstrict = this.passthrough;
8774
- this.augment = this.extend;
8711
+ this.augment = AugmentFactory2(this._def);
8712
+ this.extend = AugmentFactory2(this._def);
8775
8713
  }
8776
8714
  _getCached() {
8777
8715
  if (this._cached !== null)
@@ -8839,9 +8777,7 @@ var require_types_cjs_development = __commonJS2({
8839
8777
  const value = ctx.data[key];
8840
8778
  pairs.push({
8841
8779
  key: { status: "valid", value: key },
8842
- value: catchall._parse(
8843
- new ParseInputLazyPath2(ctx, value, ctx.path, key)
8844
- ),
8780
+ value: catchall._parse(new ParseInputLazyPath2(ctx, value, ctx.path, key)),
8845
8781
  alwaysSet: key in ctx.data
8846
8782
  });
8847
8783
  }
@@ -8900,14 +8836,8 @@ var require_types_cjs_development = __commonJS2({
8900
8836
  unknownKeys: "passthrough"
8901
8837
  });
8902
8838
  }
8903
- extend(augmentation) {
8904
- return new ZodObject2({
8905
- ...this._def,
8906
- shape: () => ({
8907
- ...this._def.shape(),
8908
- ...augmentation
8909
- })
8910
- });
8839
+ setKey(key, schema) {
8840
+ return this.augment({ [key]: schema });
8911
8841
  }
8912
8842
  merge(merging) {
8913
8843
  const merged = new ZodObject2({
@@ -8918,9 +8848,6 @@ var require_types_cjs_development = __commonJS2({
8918
8848
  });
8919
8849
  return merged;
8920
8850
  }
8921
- setKey(key, schema) {
8922
- return this.augment({ [key]: schema });
8923
- }
8924
8851
  catchall(index) {
8925
8852
  return new ZodObject2({
8926
8853
  ...this._def,
@@ -8929,10 +8856,9 @@ var require_types_cjs_development = __commonJS2({
8929
8856
  }
8930
8857
  pick(mask) {
8931
8858
  const shape = {};
8932
- util2.objectKeys(mask).forEach((key) => {
8933
- if (mask[key] && this.shape[key]) {
8859
+ util2.objectKeys(mask).map((key) => {
8860
+ if (this.shape[key])
8934
8861
  shape[key] = this.shape[key];
8935
- }
8936
8862
  });
8937
8863
  return new ZodObject2({
8938
8864
  ...this._def,
@@ -8941,8 +8867,8 @@ var require_types_cjs_development = __commonJS2({
8941
8867
  }
8942
8868
  omit(mask) {
8943
8869
  const shape = {};
8944
- util2.objectKeys(this.shape).forEach((key) => {
8945
- if (!mask[key]) {
8870
+ util2.objectKeys(this.shape).map((key) => {
8871
+ if (util2.objectKeys(mask).indexOf(key) === -1) {
8946
8872
  shape[key] = this.shape[key];
8947
8873
  }
8948
8874
  });
@@ -8956,14 +8882,24 @@ var require_types_cjs_development = __commonJS2({
8956
8882
  }
8957
8883
  partial(mask) {
8958
8884
  const newShape = {};
8959
- util2.objectKeys(this.shape).forEach((key) => {
8960
- const fieldSchema = this.shape[key];
8961
- if (mask && !mask[key]) {
8962
- newShape[key] = fieldSchema;
8963
- } else {
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];
8964
8900
  newShape[key] = fieldSchema.optional();
8965
8901
  }
8966
- });
8902
+ }
8967
8903
  return new ZodObject2({
8968
8904
  ...this._def,
8969
8905
  shape: () => newShape
@@ -8971,10 +8907,21 @@ var require_types_cjs_development = __commonJS2({
8971
8907
  }
8972
8908
  required(mask) {
8973
8909
  const newShape = {};
8974
- util2.objectKeys(this.shape).forEach((key) => {
8975
- if (mask && !mask[key]) {
8976
- newShape[key] = this.shape[key];
8977
- } else {
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) {
8978
8925
  const fieldSchema = this.shape[key];
8979
8926
  let newField = fieldSchema;
8980
8927
  while (newField instanceof ZodOptional2) {
@@ -8982,7 +8929,7 @@ var require_types_cjs_development = __commonJS2({
8982
8929
  }
8983
8930
  newShape[key] = newField;
8984
8931
  }
8985
- });
8932
+ }
8986
8933
  return new ZodObject2({
8987
8934
  ...this._def,
8988
8935
  shape: () => newShape
@@ -9332,7 +9279,7 @@ var require_types_cjs_development = __commonJS2({
9332
9279
  });
9333
9280
  status.dirty();
9334
9281
  }
9335
- const items = [...ctx.data].map((item, itemIndex) => {
9282
+ const items = ctx.data.map((item, itemIndex) => {
9336
9283
  const schema = this._def.items[itemIndex] || this._def.rest;
9337
9284
  if (!schema)
9338
9285
  return null;
@@ -9714,7 +9661,6 @@ var require_types_cjs_development = __commonJS2({
9714
9661
  if (input.data !== this._def.value) {
9715
9662
  const ctx = this._getOrReturnCtx(input);
9716
9663
  addIssueToContext2(ctx, {
9717
- received: ctx.data,
9718
9664
  code: ZodIssueCode2.invalid_literal,
9719
9665
  expected: this._def.value
9720
9666
  });
@@ -9792,12 +9738,6 @@ var require_types_cjs_development = __commonJS2({
9792
9738
  }
9793
9739
  return enumValues;
9794
9740
  }
9795
- extract(values) {
9796
- return ZodEnum2.create(values);
9797
- }
9798
- exclude(values) {
9799
- return ZodEnum2.create(this.options.filter((opt) => !values.includes(opt)));
9800
- }
9801
9741
  }, "ZodEnum");
9802
9742
  __name22(ZodEnum2, "ZodEnum");
9803
9743
  ZodEnum2.create = createZodEnum2;
@@ -9838,9 +9778,6 @@ var require_types_cjs_development = __commonJS2({
9838
9778
  });
9839
9779
  };
9840
9780
  var ZodPromise2 = /* @__PURE__ */ __name3(class extends ZodType2 {
9841
- unwrap() {
9842
- return this._def.type;
9843
- }
9844
9781
  _parse(input) {
9845
9782
  const { ctx } = this._processInputParams(input);
9846
9783
  if (ctx.parsedType !== ZodParsedType2.promise && ctx.common.async === false) {
@@ -10059,29 +9996,23 @@ var require_types_cjs_development = __commonJS2({
10059
9996
  const result = this._def.innerType._parse({
10060
9997
  data: ctx.data,
10061
9998
  path: ctx.path,
10062
- parent: {
10063
- ...ctx,
10064
- common: {
10065
- ...ctx.common,
10066
- issues: []
10067
- }
10068
- }
9999
+ parent: ctx
10069
10000
  });
10070
10001
  if (isAsync2(result)) {
10071
10002
  return result.then((result2) => {
10072
10003
  return {
10073
10004
  status: "valid",
10074
- value: result2.status === "valid" ? result2.value : this._def.catchValue()
10005
+ value: result2.status === "valid" ? result2.value : this._def.defaultValue()
10075
10006
  };
10076
10007
  });
10077
10008
  } else {
10078
10009
  return {
10079
10010
  status: "valid",
10080
- value: result.status === "valid" ? result.value : this._def.catchValue()
10011
+ value: result.status === "valid" ? result.value : this._def.defaultValue()
10081
10012
  };
10082
10013
  }
10083
10014
  }
10084
- removeCatch() {
10015
+ removeDefault() {
10085
10016
  return this._def.innerType;
10086
10017
  }
10087
10018
  }, "ZodCatch");
@@ -10090,7 +10021,7 @@ var require_types_cjs_development = __commonJS2({
10090
10021
  return new ZodCatch2({
10091
10022
  innerType: type,
10092
10023
  typeName: ZodFirstPartyTypeKind2.ZodCatch,
10093
- catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
10024
+ defaultValue: typeof params.default === "function" ? params.default : () => params.default,
10094
10025
  ...processCreateParams2(params)
10095
10026
  });
10096
10027
  };
@@ -10283,10 +10214,7 @@ var require_types_cjs_development = __commonJS2({
10283
10214
  var coerce2 = {
10284
10215
  string: (arg) => ZodString2.create({ ...arg, coerce: true }),
10285
10216
  number: (arg) => ZodNumber2.create({ ...arg, coerce: true }),
10286
- boolean: (arg) => ZodBoolean2.create({
10287
- ...arg,
10288
- coerce: true
10289
- }),
10217
+ boolean: (arg) => ZodBoolean2.create({ ...arg, coerce: true }),
10290
10218
  bigint: (arg) => ZodBigInt2.create({ ...arg, coerce: true }),
10291
10219
  date: (arg) => ZodDate2.create({ ...arg, coerce: true })
10292
10220
  };
@@ -10410,13 +10338,11 @@ var require_types_cjs_development = __commonJS2({
10410
10338
  type: mod2.string().optional(),
10411
10339
  narrative: mod2.string().optional()
10412
10340
  });
10413
- var ImageValidator2 = mod2.string().or(
10414
- mod2.object({
10415
- id: mod2.string(),
10416
- type: mod2.string(),
10417
- caption: mod2.string().optional()
10418
- })
10419
- );
10341
+ var ImageValidator2 = mod2.string().or(mod2.object({
10342
+ id: mod2.string(),
10343
+ type: mod2.string(),
10344
+ caption: mod2.string().optional()
10345
+ }));
10420
10346
  var GeoCoordinatesValidator2 = mod2.object({
10421
10347
  type: mod2.string().min(1).or(mod2.string().array().nonempty()),
10422
10348
  latitude: mod2.number(),
@@ -10458,31 +10384,29 @@ var require_types_cjs_development = __commonJS2({
10458
10384
  identifier: mod2.string(),
10459
10385
  identifierType: IdentifierTypeValidator2
10460
10386
  });
10461
- var ProfileValidator2 = mod2.string().or(
10462
- mod2.object({
10463
- id: mod2.string().optional(),
10464
- type: mod2.string().or(mod2.string().array().nonempty().optional()),
10465
- name: mod2.string().optional(),
10466
- url: mod2.string().optional(),
10467
- phone: mod2.string().optional(),
10468
- description: mod2.string().optional(),
10469
- endorsement: mod2.any().array().optional(),
10470
- image: ImageValidator2.optional(),
10471
- email: mod2.string().email().optional(),
10472
- address: AddressValidator2.optional(),
10473
- otherIdentifier: IdentifierEntryValidator2.array().optional(),
10474
- official: mod2.string().optional(),
10475
- parentOrg: mod2.any().optional(),
10476
- familyName: mod2.string().optional(),
10477
- givenName: mod2.string().optional(),
10478
- additionalName: mod2.string().optional(),
10479
- patronymicName: mod2.string().optional(),
10480
- honorificPrefix: mod2.string().optional(),
10481
- honorificSuffix: mod2.string().optional(),
10482
- familyNamePrefix: mod2.string().optional(),
10483
- dateOfBirth: mod2.string().optional()
10484
- }).catchall(mod2.any())
10485
- );
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()));
10486
10410
  var CredentialSubjectValidator2 = mod2.object({ id: mod2.string().optional() }).catchall(mod2.any());
10487
10411
  var CredentialStatusValidator2 = mod2.object({ type: mod2.string(), id: mod2.string() });
10488
10412
  var CredentialSchemaValidator2 = mod2.object({ id: mod2.string(), type: mod2.string() });
@@ -10873,7 +10797,7 @@ var isEncrypted = /* @__PURE__ */ __name3((item) => {
10873
10797
  return import_types.JWEValidator.safeParse(item).success;
10874
10798
  }, "isEncrypted");
10875
10799
 
10876
- // ../../../node_modules/.pnpm/zod@3.20.6/node_modules/zod/lib/index.mjs
10800
+ // ../../../node_modules/.pnpm/zod@3.20.2/node_modules/zod/lib/index.mjs
10877
10801
  var util;
10878
10802
  (function(util2) {
10879
10803
  util2.assertEqual = (val) => val;
@@ -11304,7 +11228,7 @@ var OK = /* @__PURE__ */ __name((value) => ({ status: "valid", value }), "OK");
11304
11228
  var isAborted = /* @__PURE__ */ __name((x) => x.status === "aborted", "isAborted");
11305
11229
  var isDirty = /* @__PURE__ */ __name((x) => x.status === "dirty", "isDirty");
11306
11230
  var isValid = /* @__PURE__ */ __name((x) => x.status === "valid", "isValid");
11307
- var isAsync = /* @__PURE__ */ __name((x) => typeof Promise !== "undefined" && x instanceof Promise, "isAsync");
11231
+ var isAsync = /* @__PURE__ */ __name((x) => typeof Promise !== void 0 && x instanceof Promise, "isAsync");
11308
11232
  var errorUtil;
11309
11233
  (function(errorUtil2) {
11310
11234
  errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
@@ -11522,29 +11446,28 @@ var ZodType = class {
11522
11446
  return this._refinement(refinement);
11523
11447
  }
11524
11448
  optional() {
11525
- return ZodOptional.create(this, this._def);
11449
+ return ZodOptional.create(this);
11526
11450
  }
11527
11451
  nullable() {
11528
- return ZodNullable.create(this, this._def);
11452
+ return ZodNullable.create(this);
11529
11453
  }
11530
11454
  nullish() {
11531
- return this.nullable().optional();
11455
+ return this.optional().nullable();
11532
11456
  }
11533
11457
  array() {
11534
- return ZodArray.create(this, this._def);
11458
+ return ZodArray.create(this);
11535
11459
  }
11536
11460
  promise() {
11537
- return ZodPromise.create(this, this._def);
11461
+ return ZodPromise.create(this);
11538
11462
  }
11539
11463
  or(option) {
11540
- return ZodUnion.create([this, option], this._def);
11464
+ return ZodUnion.create([this, option]);
11541
11465
  }
11542
11466
  and(incoming) {
11543
- return ZodIntersection.create(this, incoming, this._def);
11467
+ return ZodIntersection.create(this, incoming);
11544
11468
  }
11545
11469
  transform(transform) {
11546
11470
  return new ZodEffects({
11547
- ...processCreateParams(this._def),
11548
11471
  schema: this,
11549
11472
  typeName: ZodFirstPartyTypeKind.ZodEffects,
11550
11473
  effect: { type: "transform", transform }
@@ -11553,7 +11476,6 @@ var ZodType = class {
11553
11476
  default(def) {
11554
11477
  const defaultValueFunc = typeof def === "function" ? def : () => def;
11555
11478
  return new ZodDefault({
11556
- ...processCreateParams(this._def),
11557
11479
  innerType: this,
11558
11480
  defaultValue: defaultValueFunc,
11559
11481
  typeName: ZodFirstPartyTypeKind.ZodDefault
@@ -11563,15 +11485,14 @@ var ZodType = class {
11563
11485
  return new ZodBranded({
11564
11486
  typeName: ZodFirstPartyTypeKind.ZodBranded,
11565
11487
  type: this,
11566
- ...processCreateParams(this._def)
11488
+ ...processCreateParams(void 0)
11567
11489
  });
11568
11490
  }
11569
11491
  catch(def) {
11570
- const catchValueFunc = typeof def === "function" ? def : () => def;
11492
+ const defaultValueFunc = typeof def === "function" ? def : () => def;
11571
11493
  return new ZodCatch({
11572
- ...processCreateParams(this._def),
11573
11494
  innerType: this,
11574
- catchValue: catchValueFunc,
11495
+ defaultValue: defaultValueFunc,
11575
11496
  typeName: ZodFirstPartyTypeKind.ZodCatch
11576
11497
  });
11577
11498
  }
@@ -11594,25 +11515,24 @@ var ZodType = class {
11594
11515
  };
11595
11516
  __name(ZodType, "ZodType");
11596
11517
  var cuidRegex = /^c[^\s-]{8,}$/i;
11597
- var cuid2Regex = /^[a-z][a-z0-9]*$/;
11598
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;
11599
- var emailRegex = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|([^-]([a-zA-Z0-9-]*\.)+[a-zA-Z]{2,}))$/;
11519
+ var emailRegex = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;
11600
11520
  var datetimeRegex = /* @__PURE__ */ __name((args) => {
11601
11521
  if (args.precision) {
11602
11522
  if (args.offset) {
11603
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
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)$`);
11604
11524
  } else {
11605
11525
  return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
11606
11526
  }
11607
11527
  } else if (args.precision === 0) {
11608
11528
  if (args.offset) {
11609
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
11529
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$`);
11610
11530
  } else {
11611
11531
  return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
11612
11532
  }
11613
11533
  } else {
11614
11534
  if (args.offset) {
11615
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
11535
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$`);
11616
11536
  } else {
11617
11537
  return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
11618
11538
  }
@@ -11639,14 +11559,11 @@ var ZodString = class extends ZodType {
11639
11559
  const parsedType = this._getType(input);
11640
11560
  if (parsedType !== ZodParsedType.string) {
11641
11561
  const ctx2 = this._getOrReturnCtx(input);
11642
- addIssueToContext(
11643
- ctx2,
11644
- {
11645
- code: ZodIssueCode.invalid_type,
11646
- expected: ZodParsedType.string,
11647
- received: ctx2.parsedType
11648
- }
11649
- );
11562
+ addIssueToContext(ctx2, {
11563
+ code: ZodIssueCode.invalid_type,
11564
+ expected: ZodParsedType.string,
11565
+ received: ctx2.parsedType
11566
+ });
11650
11567
  return INVALID;
11651
11568
  }
11652
11569
  const status = new ParseStatus();
@@ -11734,16 +11651,6 @@ var ZodString = class extends ZodType {
11734
11651
  });
11735
11652
  status.dirty();
11736
11653
  }
11737
- } else if (check.kind === "cuid2") {
11738
- if (!cuid2Regex.test(input.data)) {
11739
- ctx = this._getOrReturnCtx(input, ctx);
11740
- addIssueToContext(ctx, {
11741
- validation: "cuid2",
11742
- code: ZodIssueCode.invalid_string,
11743
- message: check.message
11744
- });
11745
- status.dirty();
11746
- }
11747
11654
  } else if (check.kind === "url") {
11748
11655
  try {
11749
11656
  new URL(input.data);
@@ -11825,9 +11732,6 @@ var ZodString = class extends ZodType {
11825
11732
  cuid(message) {
11826
11733
  return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
11827
11734
  }
11828
- cuid2(message) {
11829
- return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
11830
- }
11831
11735
  datetime(options) {
11832
11736
  var _a;
11833
11737
  if (typeof options === "string") {
@@ -11902,9 +11806,6 @@ var ZodString = class extends ZodType {
11902
11806
  get isCUID() {
11903
11807
  return !!this._def.checks.find((ch) => ch.kind === "cuid");
11904
11808
  }
11905
- get isCUID2() {
11906
- return !!this._def.checks.find((ch) => ch.kind === "cuid2");
11907
- }
11908
11809
  get minLength() {
11909
11810
  let min = null;
11910
11811
  for (const ch of this._def.checks) {
@@ -12137,22 +12038,7 @@ var ZodNumber = class extends ZodType {
12137
12038
  return max;
12138
12039
  }
12139
12040
  get isInt() {
12140
- return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
12141
- }
12142
- get isFinite() {
12143
- let max = null, min = null;
12144
- for (const ch of this._def.checks) {
12145
- if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
12146
- return true;
12147
- } else if (ch.kind === "min") {
12148
- if (min === null || ch.value > min)
12149
- min = ch.value;
12150
- } else if (ch.kind === "max") {
12151
- if (max === null || ch.value < max)
12152
- max = ch.value;
12153
- }
12154
- }
12155
- return Number.isFinite(min) && Number.isFinite(max);
12041
+ return !!this._def.checks.find((ch) => ch.kind === "int");
12156
12042
  }
12157
12043
  };
12158
12044
  __name(ZodNumber, "ZodNumber");
@@ -12520,13 +12406,13 @@ var ZodArray = class extends ZodType {
12520
12406
  }
12521
12407
  }
12522
12408
  if (ctx.common.async) {
12523
- return Promise.all([...ctx.data].map((item, i) => {
12409
+ return Promise.all(ctx.data.map((item, i) => {
12524
12410
  return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
12525
12411
  })).then((result2) => {
12526
12412
  return ParseStatus.mergeArray(status, result2);
12527
12413
  });
12528
12414
  }
12529
- const result = [...ctx.data].map((item, i) => {
12415
+ const result = ctx.data.map((item, i) => {
12530
12416
  return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
12531
12417
  });
12532
12418
  return ParseStatus.mergeArray(status, result);
@@ -12576,6 +12462,15 @@ var objectUtil;
12576
12462
  };
12577
12463
  };
12578
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");
12579
12474
  function deepPartialify(schema) {
12580
12475
  if (schema instanceof ZodObject) {
12581
12476
  const newShape = {};
@@ -12605,7 +12500,8 @@ var ZodObject = class extends ZodType {
12605
12500
  super(...arguments);
12606
12501
  this._cached = null;
12607
12502
  this.nonstrict = this.passthrough;
12608
- this.augment = this.extend;
12503
+ this.augment = AugmentFactory(this._def);
12504
+ this.extend = AugmentFactory(this._def);
12609
12505
  }
12610
12506
  _getCached() {
12611
12507
  if (this._cached !== null)
@@ -12673,9 +12569,7 @@ var ZodObject = class extends ZodType {
12673
12569
  const value = ctx.data[key];
12674
12570
  pairs.push({
12675
12571
  key: { status: "valid", value: key },
12676
- value: catchall._parse(
12677
- new ParseInputLazyPath(ctx, value, ctx.path, key)
12678
- ),
12572
+ value: catchall._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
12679
12573
  alwaysSet: key in ctx.data
12680
12574
  });
12681
12575
  }
@@ -12734,14 +12628,8 @@ var ZodObject = class extends ZodType {
12734
12628
  unknownKeys: "passthrough"
12735
12629
  });
12736
12630
  }
12737
- extend(augmentation) {
12738
- return new ZodObject({
12739
- ...this._def,
12740
- shape: () => ({
12741
- ...this._def.shape(),
12742
- ...augmentation
12743
- })
12744
- });
12631
+ setKey(key, schema) {
12632
+ return this.augment({ [key]: schema });
12745
12633
  }
12746
12634
  merge(merging) {
12747
12635
  const merged = new ZodObject({
@@ -12752,9 +12640,6 @@ var ZodObject = class extends ZodType {
12752
12640
  });
12753
12641
  return merged;
12754
12642
  }
12755
- setKey(key, schema) {
12756
- return this.augment({ [key]: schema });
12757
- }
12758
12643
  catchall(index) {
12759
12644
  return new ZodObject({
12760
12645
  ...this._def,
@@ -12763,10 +12648,9 @@ var ZodObject = class extends ZodType {
12763
12648
  }
12764
12649
  pick(mask) {
12765
12650
  const shape = {};
12766
- util.objectKeys(mask).forEach((key) => {
12767
- if (mask[key] && this.shape[key]) {
12651
+ util.objectKeys(mask).map((key) => {
12652
+ if (this.shape[key])
12768
12653
  shape[key] = this.shape[key];
12769
- }
12770
12654
  });
12771
12655
  return new ZodObject({
12772
12656
  ...this._def,
@@ -12775,8 +12659,8 @@ var ZodObject = class extends ZodType {
12775
12659
  }
12776
12660
  omit(mask) {
12777
12661
  const shape = {};
12778
- util.objectKeys(this.shape).forEach((key) => {
12779
- if (!mask[key]) {
12662
+ util.objectKeys(this.shape).map((key) => {
12663
+ if (util.objectKeys(mask).indexOf(key) === -1) {
12780
12664
  shape[key] = this.shape[key];
12781
12665
  }
12782
12666
  });
@@ -12790,14 +12674,24 @@ var ZodObject = class extends ZodType {
12790
12674
  }
12791
12675
  partial(mask) {
12792
12676
  const newShape = {};
12793
- util.objectKeys(this.shape).forEach((key) => {
12794
- const fieldSchema = this.shape[key];
12795
- if (mask && !mask[key]) {
12796
- newShape[key] = fieldSchema;
12797
- } else {
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];
12798
12692
  newShape[key] = fieldSchema.optional();
12799
12693
  }
12800
- });
12694
+ }
12801
12695
  return new ZodObject({
12802
12696
  ...this._def,
12803
12697
  shape: () => newShape
@@ -12805,10 +12699,21 @@ var ZodObject = class extends ZodType {
12805
12699
  }
12806
12700
  required(mask) {
12807
12701
  const newShape = {};
12808
- util.objectKeys(this.shape).forEach((key) => {
12809
- if (mask && !mask[key]) {
12810
- newShape[key] = this.shape[key];
12811
- } else {
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) {
12812
12717
  const fieldSchema = this.shape[key];
12813
12718
  let newField = fieldSchema;
12814
12719
  while (newField instanceof ZodOptional) {
@@ -12816,7 +12721,7 @@ var ZodObject = class extends ZodType {
12816
12721
  }
12817
12722
  newShape[key] = newField;
12818
12723
  }
12819
- });
12724
+ }
12820
12725
  return new ZodObject({
12821
12726
  ...this._def,
12822
12727
  shape: () => newShape
@@ -13162,7 +13067,7 @@ var ZodTuple = class extends ZodType {
13162
13067
  });
13163
13068
  status.dirty();
13164
13069
  }
13165
- const items = [...ctx.data].map((item, itemIndex) => {
13070
+ const items = ctx.data.map((item, itemIndex) => {
13166
13071
  const schema = this._def.items[itemIndex] || this._def.rest;
13167
13072
  if (!schema)
13168
13073
  return null;
@@ -13538,7 +13443,6 @@ var ZodLiteral = class extends ZodType {
13538
13443
  if (input.data !== this._def.value) {
13539
13444
  const ctx = this._getOrReturnCtx(input);
13540
13445
  addIssueToContext(ctx, {
13541
- received: ctx.data,
13542
13446
  code: ZodIssueCode.invalid_literal,
13543
13447
  expected: this._def.value
13544
13448
  });
@@ -13614,12 +13518,6 @@ var ZodEnum = class extends ZodType {
13614
13518
  }
13615
13519
  return enumValues;
13616
13520
  }
13617
- extract(values) {
13618
- return ZodEnum.create(values);
13619
- }
13620
- exclude(values) {
13621
- return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)));
13622
- }
13623
13521
  };
13624
13522
  __name(ZodEnum, "ZodEnum");
13625
13523
  ZodEnum.create = createZodEnum;
@@ -13660,9 +13558,6 @@ ZodNativeEnum.create = (values, params) => {
13660
13558
  });
13661
13559
  };
13662
13560
  var ZodPromise = class extends ZodType {
13663
- unwrap() {
13664
- return this._def.type;
13665
- }
13666
13561
  _parse(input) {
13667
13562
  const { ctx } = this._processInputParams(input);
13668
13563
  if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
@@ -13881,29 +13776,23 @@ var ZodCatch = class extends ZodType {
13881
13776
  const result = this._def.innerType._parse({
13882
13777
  data: ctx.data,
13883
13778
  path: ctx.path,
13884
- parent: {
13885
- ...ctx,
13886
- common: {
13887
- ...ctx.common,
13888
- issues: []
13889
- }
13890
- }
13779
+ parent: ctx
13891
13780
  });
13892
13781
  if (isAsync(result)) {
13893
13782
  return result.then((result2) => {
13894
13783
  return {
13895
13784
  status: "valid",
13896
- value: result2.status === "valid" ? result2.value : this._def.catchValue()
13785
+ value: result2.status === "valid" ? result2.value : this._def.defaultValue()
13897
13786
  };
13898
13787
  });
13899
13788
  } else {
13900
13789
  return {
13901
13790
  status: "valid",
13902
- value: result.status === "valid" ? result.value : this._def.catchValue()
13791
+ value: result.status === "valid" ? result.value : this._def.defaultValue()
13903
13792
  };
13904
13793
  }
13905
13794
  }
13906
- removeCatch() {
13795
+ removeDefault() {
13907
13796
  return this._def.innerType;
13908
13797
  }
13909
13798
  };
@@ -13912,7 +13801,7 @@ ZodCatch.create = (type, params) => {
13912
13801
  return new ZodCatch({
13913
13802
  innerType: type,
13914
13803
  typeName: ZodFirstPartyTypeKind.ZodCatch,
13915
- catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
13804
+ defaultValue: typeof params.default === "function" ? params.default : () => params.default,
13916
13805
  ...processCreateParams(params)
13917
13806
  });
13918
13807
  };
@@ -14105,10 +13994,7 @@ var oboolean = /* @__PURE__ */ __name(() => booleanType().optional(), "oboolean"
14105
13994
  var coerce = {
14106
13995
  string: (arg) => ZodString.create({ ...arg, coerce: true }),
14107
13996
  number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
14108
- boolean: (arg) => ZodBoolean.create({
14109
- ...arg,
14110
- coerce: true
14111
- }),
13997
+ boolean: (arg) => ZodBoolean.create({ ...arg, coerce: true }),
14112
13998
  bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
14113
13999
  date: (arg) => ZodDate.create({ ...arg, coerce: true })
14114
14000
  };
@@ -14234,13 +14120,11 @@ var AchievementCriteriaValidator = mod.object({
14234
14120
  type: mod.string().optional(),
14235
14121
  narrative: mod.string().optional()
14236
14122
  });
14237
- var ImageValidator = mod.string().or(
14238
- mod.object({
14239
- id: mod.string(),
14240
- type: mod.string(),
14241
- caption: mod.string().optional()
14242
- })
14243
- );
14123
+ var ImageValidator = mod.string().or(mod.object({
14124
+ id: mod.string(),
14125
+ type: mod.string(),
14126
+ caption: mod.string().optional()
14127
+ }));
14244
14128
  var GeoCoordinatesValidator = mod.object({
14245
14129
  type: mod.string().min(1).or(mod.string().array().nonempty()),
14246
14130
  latitude: mod.number(),
@@ -14282,31 +14166,29 @@ var IdentifierEntryValidator = mod.object({
14282
14166
  identifier: mod.string(),
14283
14167
  identifierType: IdentifierTypeValidator
14284
14168
  });
14285
- var ProfileValidator = mod.string().or(
14286
- mod.object({
14287
- id: mod.string().optional(),
14288
- type: mod.string().or(mod.string().array().nonempty().optional()),
14289
- name: mod.string().optional(),
14290
- url: mod.string().optional(),
14291
- phone: mod.string().optional(),
14292
- description: mod.string().optional(),
14293
- endorsement: mod.any().array().optional(),
14294
- image: ImageValidator.optional(),
14295
- email: mod.string().email().optional(),
14296
- address: AddressValidator.optional(),
14297
- otherIdentifier: IdentifierEntryValidator.array().optional(),
14298
- official: mod.string().optional(),
14299
- parentOrg: mod.any().optional(),
14300
- familyName: mod.string().optional(),
14301
- givenName: mod.string().optional(),
14302
- additionalName: mod.string().optional(),
14303
- patronymicName: mod.string().optional(),
14304
- honorificPrefix: mod.string().optional(),
14305
- honorificSuffix: mod.string().optional(),
14306
- familyNamePrefix: mod.string().optional(),
14307
- dateOfBirth: mod.string().optional()
14308
- }).catchall(mod.any())
14309
- );
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()));
14310
14192
  var CredentialSubjectValidator = mod.object({ id: mod.string().optional() }).catchall(mod.any());
14311
14193
  var CredentialStatusValidator = mod.object({ type: mod.string(), id: mod.string() });
14312
14194
  var CredentialSchemaValidator = mod.object({ id: mod.string(), type: mod.string() });
@@ -14688,7 +14570,7 @@ var import_json_stringify_deterministic = __toESM(require_lib());
14688
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 } };
14689
14571
  function t(t2, a, o, i, s = "SHA-256") {
14690
14572
  return new Promise((u, c) => {
14691
- s in e || c(new RangeError(`Valid hash algorithm values are any of ${Object.keys(e).toString()}`)), "string" == typeof t2 ? t2 = new TextEncoder().encode(t2) : t2 instanceof ArrayBuffer ? t2 = new Uint8Array(t2) : ArrayBuffer.isView(t2) || c(RangeError("P should be string, ArrayBuffer, TypedArray, DataView")), "string" == typeof a ? 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) => {
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) => {
14692
14574
  const y = { name: "PBKDF2", hash: s, salt: a, iterations: o };
14693
14575
  crypto.subtle.deriveBits(y, f, 8 * i).then((e2) => u(e2), (f2) => {
14694
14576
  (async function(t3, a2, o2, i2, s2) {
@@ -14700,7 +14582,7 @@ function t(t2, a, o, i, s = "SHA-256") {
14700
14582
  if (!Number.isInteger(i2) || i2 <= 0 || i2 >= (2 ** 32 - 1) * u2)
14701
14583
  throw new RangeError("dkLen must be a positive integer < (2 ** 32 - 1) * hLen");
14702
14584
  const c2 = Math.ceil(i2 / u2), f3 = i2 - (c2 - 1) * u2, y2 = new Array(c2);
14703
- 0 === t3.byteLength && (t3 = new Uint8Array(e[s2].blockSize));
14585
+ t3.byteLength === 0 && (t3 = new Uint8Array(e[s2].blockSize));
14704
14586
  const w = await crypto.subtle.importKey("raw", t3, { name: "HMAC", hash: { name: s2 } }, true, ["sign"]), g = /* @__PURE__ */ __name(async function(e2, t4) {
14705
14587
  const r2 = await crypto.subtle.sign("HMAC", e2, t4);
14706
14588
  return new Uint8Array(r2);
@@ -14729,7 +14611,7 @@ function t(t2, a, o, i, s = "SHA-256") {
14729
14611
  __name(t, "t");
14730
14612
  function r(...e2) {
14731
14613
  const t2 = e2.reduce((e3, t3) => e3 + t3.length, 0);
14732
- if (0 === e2.length)
14614
+ if (e2.length === 0)
14733
14615
  throw new RangeError("Cannot concat no arrays");
14734
14616
  const r2 = new Uint8Array(t2);
14735
14617
  let n2 = 0;
@@ -14750,13 +14632,7 @@ var hash = /* @__PURE__ */ __name(async (learnCard, message) => {
14750
14632
  const uint8Message = new TextEncoder().encode(message);
14751
14633
  const pk = learnCard.id.keypair("secp256k1").d;
14752
14634
  const hmacKey = await t(pk, "salt", 1e3, 32);
14753
- const cryptoKey = await crypto2.subtle.importKey(
14754
- "raw",
14755
- hmacKey,
14756
- { name: "HMAC", hash: "SHA-256" },
14757
- false,
14758
- ["sign"]
14759
- );
14635
+ const cryptoKey = await crypto2.subtle.importKey("raw", hmacKey, { name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
14760
14636
  const digestBuffer = await crypto2.subtle.sign("HMAC", cryptoKey, uint8Message);
14761
14637
  const digestArray = Array.from(new Uint8Array(digestBuffer));
14762
14638
  return digestArray.map((byte) => byte.toString(16).padStart(2, "0")).join("");
@@ -14769,22 +14645,18 @@ var decryptJWE = /* @__PURE__ */ __name(async (learnCard, jwe) => {
14769
14645
  }, "decryptJWE");
14770
14646
  var generateEncryptedFieldsArray = /* @__PURE__ */ __name(async (learnCard, record, unencryptedFields = []) => {
14771
14647
  const entries = Object.entries(record);
14772
- return (await Promise.all(
14773
- entries.map(async ([key, value]) => {
14774
- if (!unencryptedFields.includes(key)) {
14775
- const result = await hash(learnCard, `${key}:${(0, import_json_stringify_deterministic.default)(value)}`);
14776
- return result;
14777
- }
14778
- return "";
14779
- })
14780
- )).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);
14781
14655
  }, "generateEncryptedFieldsArray");
14782
14656
  var generateEncryptedRecord = /* @__PURE__ */ __name(async (learnCard, record, unencryptedFields = []) => {
14783
14657
  const encryptedRecord = await learnCard.invoke.getDIDObject().createDagJWE(record, [learnCard.id.did()]);
14784
14658
  const fields = await generateEncryptedFieldsArray(learnCard, record, unencryptedFields);
14785
- const unencryptedEntries = Object.fromEntries(
14786
- Object.entries(record).filter(([key]) => unencryptedFields.includes(key))
14787
- );
14659
+ const unencryptedEntries = Object.fromEntries(Object.entries(record).filter(([key]) => unencryptedFields.includes(key)));
14788
14660
  return { ...unencryptedEntries, encryptedRecord, fields };
14789
14661
  }, "generateEncryptedRecord");
14790
14662
 
@@ -14826,22 +14698,14 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
14826
14698
  methods: {
14827
14699
  learnCloudCreate: async (_learnCard, document) => {
14828
14700
  await updateLearnCard(_learnCard);
14829
- const item = await generateEncryptedRecord(
14830
- _learnCard,
14831
- document,
14832
- unencryptedCustomFields
14833
- );
14701
+ const item = await generateEncryptedRecord(_learnCard, document, unencryptedCustomFields);
14834
14702
  return client.customStorage.create.mutate({
14835
14703
  item: await generateJWE(_learnCard, learnCloudDid, item)
14836
14704
  });
14837
14705
  },
14838
14706
  learnCloudCreateMany: async (_learnCard, documents) => {
14839
14707
  await updateLearnCard(_learnCard);
14840
- const items = await Promise.all(
14841
- documents.map(
14842
- async (document) => generateEncryptedRecord(_learnCard, document, unencryptedCustomFields)
14843
- )
14844
- );
14708
+ const items = await Promise.all(documents.map(async (document) => generateEncryptedRecord(_learnCard, document, unencryptedCustomFields)));
14845
14709
  return client.customStorage.createMany.mutate({
14846
14710
  items: await generateJWE(_learnCard, learnCloudDid, items)
14847
14711
  });
@@ -14849,18 +14713,10 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
14849
14713
  learnCloudRead: async (_learnCard, query, includeAssociatedDids) => {
14850
14714
  await updateLearnCard(_learnCard);
14851
14715
  const documents = [];
14852
- let result = await _learnCard.invoke.learnCloudReadPage(
14853
- query,
14854
- {},
14855
- includeAssociatedDids
14856
- );
14716
+ let result = await _learnCard.invoke.learnCloudReadPage(query, {}, includeAssociatedDids);
14857
14717
  documents.push(...result.records);
14858
14718
  while (result.hasMore) {
14859
- result = await _learnCard.invoke.learnCloudReadPage(
14860
- query,
14861
- {},
14862
- includeAssociatedDids
14863
- );
14719
+ result = await _learnCard.invoke.learnCloudReadPage(query, {}, includeAssociatedDids);
14864
14720
  documents.push(...result.records);
14865
14721
  }
14866
14722
  return documents;
@@ -14875,26 +14731,17 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
14875
14731
  const encryptedRecords2 = isEncrypted(jwe2) ? await decryptJWE(_learnCard, jwe2) : jwe2;
14876
14732
  return {
14877
14733
  ...encryptedRecords2,
14878
- records: await Promise.all(
14879
- encryptedRecords2.records.map(async (record) => ({
14880
- ...await decryptJWE(
14881
- _learnCard,
14882
- record.encryptedRecord
14883
- ),
14884
- _id: record._id
14885
- }))
14886
- )
14734
+ records: await Promise.all(encryptedRecords2.records.map(async (record) => ({
14735
+ ...await decryptJWE(_learnCard, record.encryptedRecord),
14736
+ _id: record._id
14737
+ })))
14887
14738
  };
14888
14739
  }
14889
14740
  const fields = await generateEncryptedFieldsArray(_learnCard, query, [
14890
14741
  ...unencryptedCustomFields,
14891
14742
  "_id"
14892
14743
  ]);
14893
- const unencryptedEntries = Object.fromEntries(
14894
- Object.entries(query).filter(
14895
- ([key]) => [...unencryptedCustomFields, "_id"].includes(key)
14896
- )
14897
- );
14744
+ const unencryptedEntries = Object.fromEntries(Object.entries(query).filter(([key]) => [...unencryptedCustomFields, "_id"].includes(key)));
14898
14745
  const jwe = await client.customStorage.read.query({
14899
14746
  query: await generateJWE(_learnCard, learnCloudDid, {
14900
14747
  ...unencryptedEntries,
@@ -14906,15 +14753,10 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
14906
14753
  const encryptedRecords = isEncrypted(jwe) ? await decryptJWE(_learnCard, jwe) : jwe;
14907
14754
  return {
14908
14755
  ...encryptedRecords,
14909
- records: await Promise.all(
14910
- encryptedRecords.records.map(async (record) => ({
14911
- ...await decryptJWE(
14912
- _learnCard,
14913
- record.encryptedRecord
14914
- ),
14915
- _id: record._id
14916
- }))
14917
- )
14756
+ records: await Promise.all(encryptedRecords.records.map(async (record) => ({
14757
+ ...await decryptJWE(_learnCard, record.encryptedRecord),
14758
+ _id: record._id
14759
+ })))
14918
14760
  };
14919
14761
  },
14920
14762
  learnCloudCount: async (_learnCard, query, includeAssociatedDids) => {
@@ -14925,11 +14767,7 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
14925
14767
  ...unencryptedCustomFields,
14926
14768
  "_id"
14927
14769
  ]);
14928
- const unencryptedEntries = Object.fromEntries(
14929
- Object.entries(query).filter(
14930
- ([key]) => [...unencryptedCustomFields, "_id"].includes(key)
14931
- )
14932
- );
14770
+ const unencryptedEntries = Object.fromEntries(Object.entries(query).filter(([key]) => [...unencryptedCustomFields, "_id"].includes(key)));
14933
14771
  return client.customStorage.count.query({
14934
14772
  query: await generateJWE(_learnCard, learnCloudDid, {
14935
14773
  ...unencryptedEntries,
@@ -14941,24 +14779,12 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
14941
14779
  learnCloudUpdate: async (_learnCard, query, update) => {
14942
14780
  await updateLearnCard(_learnCard);
14943
14781
  const documents = await _learnCard.invoke.learnCloudRead(query);
14944
- const updates = await Promise.all(
14945
- documents.map(
14946
- async (document) => client.customStorage.update.mutate({
14947
- query: await generateJWE(_learnCard, learnCloudDid, {
14948
- _id: document._id
14949
- }),
14950
- update: await generateJWE(
14951
- _learnCard,
14952
- learnCloudDid,
14953
- await generateEncryptedRecord(
14954
- _learnCard,
14955
- { ...document, ...update },
14956
- unencryptedCustomFields
14957
- )
14958
- )
14959
- })
14960
- )
14961
- );
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
+ })));
14962
14788
  return updates.reduce((sum, current) => current + sum, 0);
14963
14789
  },
14964
14790
  learnCloudDelete: async (_learnCard, query, includeAssociatedDids) => {
@@ -14969,11 +14795,7 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
14969
14795
  ...unencryptedCustomFields,
14970
14796
  "_id"
14971
14797
  ]);
14972
- const unencryptedEntries = Object.fromEntries(
14973
- Object.entries(query).filter(
14974
- ([key]) => [...unencryptedCustomFields, "_id"].includes(key)
14975
- )
14976
- );
14798
+ const unencryptedEntries = Object.fromEntries(Object.entries(query).filter(([key]) => [...unencryptedCustomFields, "_id"].includes(key)));
14977
14799
  return client.customStorage.delete.mutate({
14978
14800
  query: await generateJWE(_learnCard, learnCloudDid, {
14979
14801
  ...unencryptedEntries,
@@ -15036,33 +14858,17 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
15036
14858
  const jwe2 = await client.index.get.query(paginationOptions);
15037
14859
  _learnCard.debug?.("LearnCloud index.get (no query response)", jwe2);
15038
14860
  const encryptedRecords2 = isEncrypted(jwe2) ? await decryptJWE(_learnCard, jwe2) : jwe2;
15039
- _learnCard.debug?.(
15040
- "LearnCloud index.get (no query encryptedRecords)",
15041
- encryptedRecords2
15042
- );
14861
+ _learnCard.debug?.("LearnCloud index.get (no query encryptedRecords)", encryptedRecords2);
15043
14862
  return {
15044
14863
  ...encryptedRecords2,
15045
- records: await Promise.all(
15046
- encryptedRecords2.records.map(
15047
- async (record) => decryptJWE(_learnCard, record.encryptedRecord)
15048
- )
15049
- )
14864
+ records: await Promise.all(encryptedRecords2.records.map(async (record) => decryptJWE(_learnCard, record.encryptedRecord)))
15050
14865
  };
15051
14866
  }
15052
14867
  _learnCard.debug?.("LearnCloud index.get (query)");
15053
- const fields = await generateEncryptedFieldsArray(
15054
- _learnCard,
15055
- query,
15056
- unencryptedFields
15057
- );
14868
+ const fields = await generateEncryptedFieldsArray(_learnCard, query, unencryptedFields);
15058
14869
  _learnCard.debug?.("LearnCloud index.get (query fields)", fields);
15059
- const unencryptedEntries = Object.fromEntries(
15060
- Object.entries(query).filter(([key]) => unencryptedFields.includes(key))
15061
- );
15062
- _learnCard.debug?.(
15063
- "LearnCloud index.get (query unencryptedEntries)",
15064
- unencryptedEntries
15065
- );
14870
+ const unencryptedEntries = Object.fromEntries(Object.entries(query).filter(([key]) => unencryptedFields.includes(key)));
14871
+ _learnCard.debug?.("LearnCloud index.get (query unencryptedEntries)", unencryptedEntries);
15066
14872
  const jwe = await client.index.get.query({
15067
14873
  query: await generateJWE(_learnCard, learnCloudDid, {
15068
14874
  ...unencryptedEntries,
@@ -15072,17 +14878,10 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
15072
14878
  });
15073
14879
  _learnCard.debug?.("LearnCloud index.get (query jwe)", jwe);
15074
14880
  const encryptedRecords = isEncrypted(jwe) ? await decryptJWE(_learnCard, jwe) : jwe;
15075
- _learnCard.debug?.(
15076
- "LearnCloud index.get (query encryptedRecords)",
15077
- encryptedRecords
15078
- );
14881
+ _learnCard.debug?.("LearnCloud index.get (query encryptedRecords)", encryptedRecords);
15079
14882
  return {
15080
14883
  ...encryptedRecords,
15081
- records: await Promise.all(
15082
- encryptedRecords.records.map(
15083
- async (record) => decryptJWE(_learnCard, record.encryptedRecord)
15084
- )
15085
- )
14884
+ records: await Promise.all(encryptedRecords.records.map(async (record) => decryptJWE(_learnCard, record.encryptedRecord)))
15086
14885
  };
15087
14886
  },
15088
14887
  getCount: async (_learnCard, query) => {
@@ -15096,19 +14895,10 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
15096
14895
  return count2;
15097
14896
  }
15098
14897
  _learnCard.debug?.("LearnCloud index.getCount (query)");
15099
- const fields = await generateEncryptedFieldsArray(
15100
- _learnCard,
15101
- query,
15102
- unencryptedFields
15103
- );
14898
+ const fields = await generateEncryptedFieldsArray(_learnCard, query, unencryptedFields);
15104
14899
  _learnCard.debug?.("LearnCloud index.getCount (query fields)", fields);
15105
- const unencryptedEntries = Object.fromEntries(
15106
- Object.entries(query).filter(([key]) => unencryptedFields.includes(key))
15107
- );
15108
- _learnCard.debug?.(
15109
- "LearnCloud index.getCount (query unencryptedEntries)",
15110
- unencryptedEntries
15111
- );
14900
+ const unencryptedEntries = Object.fromEntries(Object.entries(query).filter(([key]) => unencryptedFields.includes(key)));
14901
+ _learnCard.debug?.("LearnCloud index.getCount (query unencryptedEntries)", unencryptedEntries);
15112
14902
  const jwe = await client.index.count.query({
15113
14903
  query: await generateJWE(_learnCard, learnCloudDid, {
15114
14904
  ...unencryptedEntries,
@@ -15125,37 +14915,25 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
15125
14915
  const id = record.id || _learnCard.invoke.crypto().randomUUID();
15126
14916
  return client.index.add.mutate({
15127
14917
  record: await generateJWE(_learnCard, learnCloudDid, {
15128
- ...await generateEncryptedRecord(
15129
- _learnCard,
15130
- { ...record, id },
15131
- unencryptedFields
15132
- ),
14918
+ ...await generateEncryptedRecord(_learnCard, { ...record, id }, unencryptedFields),
15133
14919
  id: await hash(_learnCard, id)
15134
14920
  })
15135
14921
  });
15136
14922
  },
15137
14923
  addMany: async (_learnCard, _records) => {
15138
14924
  await updateLearnCard(_learnCard);
15139
- const results = await Promise.all(
15140
- (0, import_lodash.chunk)(_records, 25).map(async (batch) => {
15141
- const records = await Promise.all(
15142
- batch.map(async (record) => {
15143
- const id = record.id || _learnCard.invoke.crypto().randomUUID();
15144
- return {
15145
- ...await generateEncryptedRecord(
15146
- _learnCard,
15147
- { ...record, id },
15148
- unencryptedFields
15149
- ),
15150
- id: await hash(_learnCard, id)
15151
- };
15152
- })
15153
- );
15154
- return client.index.addMany.mutate({
15155
- records: await generateJWE(_learnCard, learnCloudDid, records)
15156
- });
15157
- })
15158
- );
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
+ }));
15159
14937
  return results.every(Boolean);
15160
14938
  },
15161
14939
  update: async (_learnCard, id, updates) => {
@@ -15167,11 +14945,7 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
15167
14945
  const newRecord = { ...record, ...updates };
15168
14946
  return client.index.update.mutate({
15169
14947
  id: await hash(_learnCard, id),
15170
- updates: await generateJWE(
15171
- _learnCard,
15172
- learnCloudDid,
15173
- await generateEncryptedRecord(_learnCard, newRecord, unencryptedFields)
15174
- )
14948
+ updates: await generateJWE(_learnCard, learnCloudDid, await generateEncryptedRecord(_learnCard, newRecord, unencryptedFields))
15175
14949
  });
15176
14950
  },
15177
14951
  remove: async (_learnCard, id) => {