@learncard/learn-cloud-plugin 1.0.6 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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";
@@ -6959,6 +6926,7 @@ var require_types_cjs_development = __commonJS2({
6959
6926
  CredentialSubjectValidator: () => CredentialSubjectValidator2,
6960
6927
  CriteriaValidator: () => CriteriaValidator2,
6961
6928
  EncryptedCredentialRecordValidator: () => EncryptedCredentialRecordValidator2,
6929
+ EncryptedRecordValidator: () => EncryptedRecordValidator2,
6962
6930
  EndorsementCredentialValidator: () => EndorsementCredentialValidator2,
6963
6931
  EndorsementSubjectValidator: () => EndorsementSubjectValidator2,
6964
6932
  EvidenceValidator: () => EvidenceValidator2,
@@ -6984,6 +6952,7 @@ var require_types_cjs_development = __commonJS2({
6984
6952
  LCNSigningAuthorityForUserValidator: () => LCNSigningAuthorityForUserValidator2,
6985
6953
  LCNSigningAuthorityValidator: () => LCNSigningAuthorityValidator2,
6986
6954
  PaginatedEncryptedCredentialRecordsValidator: () => PaginatedEncryptedCredentialRecordsValidator2,
6955
+ PaginatedEncryptedRecordsValidator: () => PaginatedEncryptedRecordsValidator2,
6987
6956
  PaginationOptionsValidator: () => PaginationOptionsValidator2,
6988
6957
  PaginationResponseValidator: () => PaginationResponseValidator2,
6989
6958
  ProfileValidator: () => ProfileValidator2,
@@ -7449,7 +7418,7 @@ var require_types_cjs_development = __commonJS2({
7449
7418
  var isAborted2 = /* @__PURE__ */ __name22((x) => x.status === "aborted", "isAborted");
7450
7419
  var isDirty2 = /* @__PURE__ */ __name22((x) => x.status === "dirty", "isDirty");
7451
7420
  var isValid2 = /* @__PURE__ */ __name22((x) => x.status === "valid", "isValid");
7452
- var isAsync2 = /* @__PURE__ */ __name22((x) => typeof Promise !== "undefined" && x instanceof Promise, "isAsync");
7421
+ var isAsync2 = /* @__PURE__ */ __name22((x) => typeof Promise !== void 0 && x instanceof Promise, "isAsync");
7453
7422
  var errorUtil2;
7454
7423
  (function(errorUtil22) {
7455
7424
  errorUtil22.errToObj = (message) => typeof message === "string" ? { message } : message || {};
@@ -7669,29 +7638,28 @@ var require_types_cjs_development = __commonJS2({
7669
7638
  return this._refinement(refinement);
7670
7639
  }
7671
7640
  optional() {
7672
- return ZodOptional2.create(this, this._def);
7641
+ return ZodOptional2.create(this);
7673
7642
  }
7674
7643
  nullable() {
7675
- return ZodNullable2.create(this, this._def);
7644
+ return ZodNullable2.create(this);
7676
7645
  }
7677
7646
  nullish() {
7678
- return this.nullable().optional();
7647
+ return this.optional().nullable();
7679
7648
  }
7680
7649
  array() {
7681
- return ZodArray2.create(this, this._def);
7650
+ return ZodArray2.create(this);
7682
7651
  }
7683
7652
  promise() {
7684
- return ZodPromise2.create(this, this._def);
7653
+ return ZodPromise2.create(this);
7685
7654
  }
7686
7655
  or(option) {
7687
- return ZodUnion2.create([this, option], this._def);
7656
+ return ZodUnion2.create([this, option]);
7688
7657
  }
7689
7658
  and(incoming) {
7690
- return ZodIntersection2.create(this, incoming, this._def);
7659
+ return ZodIntersection2.create(this, incoming);
7691
7660
  }
7692
7661
  transform(transform) {
7693
7662
  return new ZodEffects2({
7694
- ...processCreateParams2(this._def),
7695
7663
  schema: this,
7696
7664
  typeName: ZodFirstPartyTypeKind2.ZodEffects,
7697
7665
  effect: { type: "transform", transform }
@@ -7700,7 +7668,6 @@ var require_types_cjs_development = __commonJS2({
7700
7668
  default(def) {
7701
7669
  const defaultValueFunc = typeof def === "function" ? def : () => def;
7702
7670
  return new ZodDefault2({
7703
- ...processCreateParams2(this._def),
7704
7671
  innerType: this,
7705
7672
  defaultValue: defaultValueFunc,
7706
7673
  typeName: ZodFirstPartyTypeKind2.ZodDefault
@@ -7710,15 +7677,14 @@ var require_types_cjs_development = __commonJS2({
7710
7677
  return new ZodBranded2({
7711
7678
  typeName: ZodFirstPartyTypeKind2.ZodBranded,
7712
7679
  type: this,
7713
- ...processCreateParams2(this._def)
7680
+ ...processCreateParams2(void 0)
7714
7681
  });
7715
7682
  }
7716
7683
  catch(def) {
7717
- const catchValueFunc = typeof def === "function" ? def : () => def;
7684
+ const defaultValueFunc = typeof def === "function" ? def : () => def;
7718
7685
  return new ZodCatch2({
7719
- ...processCreateParams2(this._def),
7720
7686
  innerType: this,
7721
- catchValue: catchValueFunc,
7687
+ defaultValue: defaultValueFunc,
7722
7688
  typeName: ZodFirstPartyTypeKind2.ZodCatch
7723
7689
  });
7724
7690
  }
@@ -7741,25 +7707,24 @@ var require_types_cjs_development = __commonJS2({
7741
7707
  }, "ZodType");
7742
7708
  __name22(ZodType2, "ZodType");
7743
7709
  var cuidRegex2 = /^c[^\s-]{8,}$/i;
7744
- var cuid2Regex2 = /^[a-z][a-z0-9]*$/;
7745
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;
7746
- 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,}))$/;
7711
+ var emailRegex2 = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;
7747
7712
  var datetimeRegex2 = /* @__PURE__ */ __name22((args) => {
7748
7713
  if (args.precision) {
7749
7714
  if (args.offset) {
7750
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
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)$`);
7751
7716
  } else {
7752
7717
  return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
7753
7718
  }
7754
7719
  } else if (args.precision === 0) {
7755
7720
  if (args.offset) {
7756
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
7721
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$`);
7757
7722
  } else {
7758
7723
  return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
7759
7724
  }
7760
7725
  } else {
7761
7726
  if (args.offset) {
7762
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
7727
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$`);
7763
7728
  } else {
7764
7729
  return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
7765
7730
  }
@@ -7786,14 +7751,11 @@ var require_types_cjs_development = __commonJS2({
7786
7751
  const parsedType = this._getType(input);
7787
7752
  if (parsedType !== ZodParsedType2.string) {
7788
7753
  const ctx2 = this._getOrReturnCtx(input);
7789
- addIssueToContext2(
7790
- ctx2,
7791
- {
7792
- code: ZodIssueCode2.invalid_type,
7793
- expected: ZodParsedType2.string,
7794
- received: ctx2.parsedType
7795
- }
7796
- );
7754
+ addIssueToContext2(ctx2, {
7755
+ code: ZodIssueCode2.invalid_type,
7756
+ expected: ZodParsedType2.string,
7757
+ received: ctx2.parsedType
7758
+ });
7797
7759
  return INVALID2;
7798
7760
  }
7799
7761
  const status = new ParseStatus2();
@@ -7881,16 +7843,6 @@ var require_types_cjs_development = __commonJS2({
7881
7843
  });
7882
7844
  status.dirty();
7883
7845
  }
7884
- } else if (check.kind === "cuid2") {
7885
- if (!cuid2Regex2.test(input.data)) {
7886
- ctx = this._getOrReturnCtx(input, ctx);
7887
- addIssueToContext2(ctx, {
7888
- validation: "cuid2",
7889
- code: ZodIssueCode2.invalid_string,
7890
- message: check.message
7891
- });
7892
- status.dirty();
7893
- }
7894
7846
  } else if (check.kind === "url") {
7895
7847
  try {
7896
7848
  new URL(input.data);
@@ -7972,9 +7924,6 @@ var require_types_cjs_development = __commonJS2({
7972
7924
  cuid(message) {
7973
7925
  return this._addCheck({ kind: "cuid", ...errorUtil2.errToObj(message) });
7974
7926
  }
7975
- cuid2(message) {
7976
- return this._addCheck({ kind: "cuid2", ...errorUtil2.errToObj(message) });
7977
- }
7978
7927
  datetime(options) {
7979
7928
  var _a;
7980
7929
  if (typeof options === "string") {
@@ -8049,9 +7998,6 @@ var require_types_cjs_development = __commonJS2({
8049
7998
  get isCUID() {
8050
7999
  return !!this._def.checks.find((ch) => ch.kind === "cuid");
8051
8000
  }
8052
- get isCUID2() {
8053
- return !!this._def.checks.find((ch) => ch.kind === "cuid2");
8054
- }
8055
8001
  get minLength() {
8056
8002
  let min = null;
8057
8003
  for (const ch of this._def.checks) {
@@ -8286,22 +8232,7 @@ var require_types_cjs_development = __commonJS2({
8286
8232
  return max;
8287
8233
  }
8288
8234
  get isInt() {
8289
- return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util2.isInteger(ch.value));
8290
- }
8291
- get isFinite() {
8292
- let max = null, min = null;
8293
- for (const ch of this._def.checks) {
8294
- if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
8295
- return true;
8296
- } else if (ch.kind === "min") {
8297
- if (min === null || ch.value > min)
8298
- min = ch.value;
8299
- } else if (ch.kind === "max") {
8300
- if (max === null || ch.value < max)
8301
- max = ch.value;
8302
- }
8303
- }
8304
- return Number.isFinite(min) && Number.isFinite(max);
8235
+ return !!this._def.checks.find((ch) => ch.kind === "int");
8305
8236
  }
8306
8237
  }, "ZodNumber");
8307
8238
  __name22(ZodNumber2, "ZodNumber");
@@ -8669,13 +8600,13 @@ var require_types_cjs_development = __commonJS2({
8669
8600
  }
8670
8601
  }
8671
8602
  if (ctx.common.async) {
8672
- return Promise.all([...ctx.data].map((item, i) => {
8603
+ return Promise.all(ctx.data.map((item, i) => {
8673
8604
  return def.type._parseAsync(new ParseInputLazyPath2(ctx, item, ctx.path, i));
8674
8605
  })).then((result2) => {
8675
8606
  return ParseStatus2.mergeArray(status, result2);
8676
8607
  });
8677
8608
  }
8678
- const result = [...ctx.data].map((item, i) => {
8609
+ const result = ctx.data.map((item, i) => {
8679
8610
  return def.type._parseSync(new ParseInputLazyPath2(ctx, item, ctx.path, i));
8680
8611
  });
8681
8612
  return ParseStatus2.mergeArray(status, result);
@@ -8725,6 +8656,15 @@ var require_types_cjs_development = __commonJS2({
8725
8656
  };
8726
8657
  };
8727
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");
8728
8668
  function deepPartialify2(schema) {
8729
8669
  if (schema instanceof ZodObject2) {
8730
8670
  const newShape = {};
@@ -8756,7 +8696,8 @@ var require_types_cjs_development = __commonJS2({
8756
8696
  super(...arguments);
8757
8697
  this._cached = null;
8758
8698
  this.nonstrict = this.passthrough;
8759
- this.augment = this.extend;
8699
+ this.augment = AugmentFactory2(this._def);
8700
+ this.extend = AugmentFactory2(this._def);
8760
8701
  }
8761
8702
  _getCached() {
8762
8703
  if (this._cached !== null)
@@ -8824,9 +8765,7 @@ var require_types_cjs_development = __commonJS2({
8824
8765
  const value = ctx.data[key];
8825
8766
  pairs.push({
8826
8767
  key: { status: "valid", value: key },
8827
- value: catchall._parse(
8828
- new ParseInputLazyPath2(ctx, value, ctx.path, key)
8829
- ),
8768
+ value: catchall._parse(new ParseInputLazyPath2(ctx, value, ctx.path, key)),
8830
8769
  alwaysSet: key in ctx.data
8831
8770
  });
8832
8771
  }
@@ -8885,14 +8824,8 @@ var require_types_cjs_development = __commonJS2({
8885
8824
  unknownKeys: "passthrough"
8886
8825
  });
8887
8826
  }
8888
- extend(augmentation) {
8889
- return new ZodObject2({
8890
- ...this._def,
8891
- shape: () => ({
8892
- ...this._def.shape(),
8893
- ...augmentation
8894
- })
8895
- });
8827
+ setKey(key, schema) {
8828
+ return this.augment({ [key]: schema });
8896
8829
  }
8897
8830
  merge(merging) {
8898
8831
  const merged = new ZodObject2({
@@ -8903,9 +8836,6 @@ var require_types_cjs_development = __commonJS2({
8903
8836
  });
8904
8837
  return merged;
8905
8838
  }
8906
- setKey(key, schema) {
8907
- return this.augment({ [key]: schema });
8908
- }
8909
8839
  catchall(index) {
8910
8840
  return new ZodObject2({
8911
8841
  ...this._def,
@@ -8914,10 +8844,9 @@ var require_types_cjs_development = __commonJS2({
8914
8844
  }
8915
8845
  pick(mask) {
8916
8846
  const shape = {};
8917
- util2.objectKeys(mask).forEach((key) => {
8918
- if (mask[key] && this.shape[key]) {
8847
+ util2.objectKeys(mask).map((key) => {
8848
+ if (this.shape[key])
8919
8849
  shape[key] = this.shape[key];
8920
- }
8921
8850
  });
8922
8851
  return new ZodObject2({
8923
8852
  ...this._def,
@@ -8926,8 +8855,8 @@ var require_types_cjs_development = __commonJS2({
8926
8855
  }
8927
8856
  omit(mask) {
8928
8857
  const shape = {};
8929
- util2.objectKeys(this.shape).forEach((key) => {
8930
- if (!mask[key]) {
8858
+ util2.objectKeys(this.shape).map((key) => {
8859
+ if (util2.objectKeys(mask).indexOf(key) === -1) {
8931
8860
  shape[key] = this.shape[key];
8932
8861
  }
8933
8862
  });
@@ -8941,14 +8870,24 @@ var require_types_cjs_development = __commonJS2({
8941
8870
  }
8942
8871
  partial(mask) {
8943
8872
  const newShape = {};
8944
- util2.objectKeys(this.shape).forEach((key) => {
8945
- const fieldSchema = this.shape[key];
8946
- if (mask && !mask[key]) {
8947
- newShape[key] = fieldSchema;
8948
- } else {
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];
8949
8888
  newShape[key] = fieldSchema.optional();
8950
8889
  }
8951
- });
8890
+ }
8952
8891
  return new ZodObject2({
8953
8892
  ...this._def,
8954
8893
  shape: () => newShape
@@ -8956,10 +8895,21 @@ var require_types_cjs_development = __commonJS2({
8956
8895
  }
8957
8896
  required(mask) {
8958
8897
  const newShape = {};
8959
- util2.objectKeys(this.shape).forEach((key) => {
8960
- if (mask && !mask[key]) {
8961
- newShape[key] = this.shape[key];
8962
- } else {
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) {
8963
8913
  const fieldSchema = this.shape[key];
8964
8914
  let newField = fieldSchema;
8965
8915
  while (newField instanceof ZodOptional2) {
@@ -8967,7 +8917,7 @@ var require_types_cjs_development = __commonJS2({
8967
8917
  }
8968
8918
  newShape[key] = newField;
8969
8919
  }
8970
- });
8920
+ }
8971
8921
  return new ZodObject2({
8972
8922
  ...this._def,
8973
8923
  shape: () => newShape
@@ -9317,7 +9267,7 @@ var require_types_cjs_development = __commonJS2({
9317
9267
  });
9318
9268
  status.dirty();
9319
9269
  }
9320
- const items = [...ctx.data].map((item, itemIndex) => {
9270
+ const items = ctx.data.map((item, itemIndex) => {
9321
9271
  const schema = this._def.items[itemIndex] || this._def.rest;
9322
9272
  if (!schema)
9323
9273
  return null;
@@ -9699,7 +9649,6 @@ var require_types_cjs_development = __commonJS2({
9699
9649
  if (input.data !== this._def.value) {
9700
9650
  const ctx = this._getOrReturnCtx(input);
9701
9651
  addIssueToContext2(ctx, {
9702
- received: ctx.data,
9703
9652
  code: ZodIssueCode2.invalid_literal,
9704
9653
  expected: this._def.value
9705
9654
  });
@@ -9777,12 +9726,6 @@ var require_types_cjs_development = __commonJS2({
9777
9726
  }
9778
9727
  return enumValues;
9779
9728
  }
9780
- extract(values) {
9781
- return ZodEnum2.create(values);
9782
- }
9783
- exclude(values) {
9784
- return ZodEnum2.create(this.options.filter((opt) => !values.includes(opt)));
9785
- }
9786
9729
  }, "ZodEnum");
9787
9730
  __name22(ZodEnum2, "ZodEnum");
9788
9731
  ZodEnum2.create = createZodEnum2;
@@ -9823,9 +9766,6 @@ var require_types_cjs_development = __commonJS2({
9823
9766
  });
9824
9767
  };
9825
9768
  var ZodPromise2 = /* @__PURE__ */ __name3(class extends ZodType2 {
9826
- unwrap() {
9827
- return this._def.type;
9828
- }
9829
9769
  _parse(input) {
9830
9770
  const { ctx } = this._processInputParams(input);
9831
9771
  if (ctx.parsedType !== ZodParsedType2.promise && ctx.common.async === false) {
@@ -10044,29 +9984,23 @@ var require_types_cjs_development = __commonJS2({
10044
9984
  const result = this._def.innerType._parse({
10045
9985
  data: ctx.data,
10046
9986
  path: ctx.path,
10047
- parent: {
10048
- ...ctx,
10049
- common: {
10050
- ...ctx.common,
10051
- issues: []
10052
- }
10053
- }
9987
+ parent: ctx
10054
9988
  });
10055
9989
  if (isAsync2(result)) {
10056
9990
  return result.then((result2) => {
10057
9991
  return {
10058
9992
  status: "valid",
10059
- value: result2.status === "valid" ? result2.value : this._def.catchValue()
9993
+ value: result2.status === "valid" ? result2.value : this._def.defaultValue()
10060
9994
  };
10061
9995
  });
10062
9996
  } else {
10063
9997
  return {
10064
9998
  status: "valid",
10065
- value: result.status === "valid" ? result.value : this._def.catchValue()
9999
+ value: result.status === "valid" ? result.value : this._def.defaultValue()
10066
10000
  };
10067
10001
  }
10068
10002
  }
10069
- removeCatch() {
10003
+ removeDefault() {
10070
10004
  return this._def.innerType;
10071
10005
  }
10072
10006
  }, "ZodCatch");
@@ -10075,7 +10009,7 @@ var require_types_cjs_development = __commonJS2({
10075
10009
  return new ZodCatch2({
10076
10010
  innerType: type,
10077
10011
  typeName: ZodFirstPartyTypeKind2.ZodCatch,
10078
- catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
10012
+ defaultValue: typeof params.default === "function" ? params.default : () => params.default,
10079
10013
  ...processCreateParams2(params)
10080
10014
  });
10081
10015
  };
@@ -10268,10 +10202,7 @@ var require_types_cjs_development = __commonJS2({
10268
10202
  var coerce2 = {
10269
10203
  string: (arg) => ZodString2.create({ ...arg, coerce: true }),
10270
10204
  number: (arg) => ZodNumber2.create({ ...arg, coerce: true }),
10271
- boolean: (arg) => ZodBoolean2.create({
10272
- ...arg,
10273
- coerce: true
10274
- }),
10205
+ boolean: (arg) => ZodBoolean2.create({ ...arg, coerce: true }),
10275
10206
  bigint: (arg) => ZodBigInt2.create({ ...arg, coerce: true }),
10276
10207
  date: (arg) => ZodDate2.create({ ...arg, coerce: true })
10277
10208
  };
@@ -10395,13 +10326,11 @@ var require_types_cjs_development = __commonJS2({
10395
10326
  type: mod2.string().optional(),
10396
10327
  narrative: mod2.string().optional()
10397
10328
  });
10398
- var ImageValidator2 = mod2.string().or(
10399
- mod2.object({
10400
- id: mod2.string(),
10401
- type: mod2.string(),
10402
- caption: mod2.string().optional()
10403
- })
10404
- );
10329
+ var ImageValidator2 = mod2.string().or(mod2.object({
10330
+ id: mod2.string(),
10331
+ type: mod2.string(),
10332
+ caption: mod2.string().optional()
10333
+ }));
10405
10334
  var GeoCoordinatesValidator2 = mod2.object({
10406
10335
  type: mod2.string().min(1).or(mod2.string().array().nonempty()),
10407
10336
  latitude: mod2.number(),
@@ -10443,31 +10372,29 @@ var require_types_cjs_development = __commonJS2({
10443
10372
  identifier: mod2.string(),
10444
10373
  identifierType: IdentifierTypeValidator2
10445
10374
  });
10446
- var ProfileValidator2 = mod2.string().or(
10447
- mod2.object({
10448
- id: mod2.string().optional(),
10449
- type: mod2.string().or(mod2.string().array().nonempty().optional()),
10450
- name: mod2.string().optional(),
10451
- url: mod2.string().optional(),
10452
- phone: mod2.string().optional(),
10453
- description: mod2.string().optional(),
10454
- endorsement: mod2.any().array().optional(),
10455
- image: ImageValidator2.optional(),
10456
- email: mod2.string().email().optional(),
10457
- address: AddressValidator2.optional(),
10458
- otherIdentifier: IdentifierEntryValidator2.array().optional(),
10459
- official: mod2.string().optional(),
10460
- parentOrg: mod2.any().optional(),
10461
- familyName: mod2.string().optional(),
10462
- givenName: mod2.string().optional(),
10463
- additionalName: mod2.string().optional(),
10464
- patronymicName: mod2.string().optional(),
10465
- honorificPrefix: mod2.string().optional(),
10466
- honorificSuffix: mod2.string().optional(),
10467
- familyNamePrefix: mod2.string().optional(),
10468
- dateOfBirth: mod2.string().optional()
10469
- }).catchall(mod2.any())
10470
- );
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()));
10471
10398
  var CredentialSubjectValidator2 = mod2.object({ id: mod2.string().optional() }).catchall(mod2.any());
10472
10399
  var CredentialStatusValidator2 = mod2.object({ type: mod2.string(), id: mod2.string() });
10473
10400
  var CredentialSchemaValidator2 = mod2.object({ id: mod2.string(), type: mod2.string() });
@@ -10749,11 +10676,13 @@ var require_types_cjs_development = __commonJS2({
10749
10676
  aad: mod2.string().optional(),
10750
10677
  recipients: JWERecipientValidator2.array().optional()
10751
10678
  });
10752
- var EncryptedCredentialRecordValidator2 = mod2.object({
10753
- encryptedRecord: JWEValidator2,
10754
- fields: mod2.string().array(),
10679
+ var EncryptedRecordValidator2 = mod2.object({ encryptedRecord: JWEValidator2, fields: mod2.string().array() }).catchall(mod2.any());
10680
+ var PaginatedEncryptedRecordsValidator2 = PaginationResponseValidator2.extend({
10681
+ records: EncryptedRecordValidator2.array()
10682
+ });
10683
+ var EncryptedCredentialRecordValidator2 = EncryptedRecordValidator2.extend({
10755
10684
  id: mod2.string()
10756
- }).catchall(mod2.any());
10685
+ });
10757
10686
  var PaginatedEncryptedCredentialRecordsValidator2 = PaginationResponseValidator2.extend({
10758
10687
  records: EncryptedCredentialRecordValidator2.array()
10759
10688
  });
@@ -10856,7 +10785,7 @@ var isEncrypted = /* @__PURE__ */ __name3((item) => {
10856
10785
  return import_types.JWEValidator.safeParse(item).success;
10857
10786
  }, "isEncrypted");
10858
10787
 
10859
- // ../../../node_modules/.pnpm/zod@3.20.6/node_modules/zod/lib/index.mjs
10788
+ // ../../../node_modules/.pnpm/zod@3.20.2/node_modules/zod/lib/index.mjs
10860
10789
  var util;
10861
10790
  (function(util2) {
10862
10791
  util2.assertEqual = (val) => val;
@@ -11287,7 +11216,7 @@ var OK = /* @__PURE__ */ __name((value) => ({ status: "valid", value }), "OK");
11287
11216
  var isAborted = /* @__PURE__ */ __name((x) => x.status === "aborted", "isAborted");
11288
11217
  var isDirty = /* @__PURE__ */ __name((x) => x.status === "dirty", "isDirty");
11289
11218
  var isValid = /* @__PURE__ */ __name((x) => x.status === "valid", "isValid");
11290
- var isAsync = /* @__PURE__ */ __name((x) => typeof Promise !== "undefined" && x instanceof Promise, "isAsync");
11219
+ var isAsync = /* @__PURE__ */ __name((x) => typeof Promise !== void 0 && x instanceof Promise, "isAsync");
11291
11220
  var errorUtil;
11292
11221
  (function(errorUtil2) {
11293
11222
  errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
@@ -11505,29 +11434,28 @@ var ZodType = class {
11505
11434
  return this._refinement(refinement);
11506
11435
  }
11507
11436
  optional() {
11508
- return ZodOptional.create(this, this._def);
11437
+ return ZodOptional.create(this);
11509
11438
  }
11510
11439
  nullable() {
11511
- return ZodNullable.create(this, this._def);
11440
+ return ZodNullable.create(this);
11512
11441
  }
11513
11442
  nullish() {
11514
- return this.nullable().optional();
11443
+ return this.optional().nullable();
11515
11444
  }
11516
11445
  array() {
11517
- return ZodArray.create(this, this._def);
11446
+ return ZodArray.create(this);
11518
11447
  }
11519
11448
  promise() {
11520
- return ZodPromise.create(this, this._def);
11449
+ return ZodPromise.create(this);
11521
11450
  }
11522
11451
  or(option) {
11523
- return ZodUnion.create([this, option], this._def);
11452
+ return ZodUnion.create([this, option]);
11524
11453
  }
11525
11454
  and(incoming) {
11526
- return ZodIntersection.create(this, incoming, this._def);
11455
+ return ZodIntersection.create(this, incoming);
11527
11456
  }
11528
11457
  transform(transform) {
11529
11458
  return new ZodEffects({
11530
- ...processCreateParams(this._def),
11531
11459
  schema: this,
11532
11460
  typeName: ZodFirstPartyTypeKind.ZodEffects,
11533
11461
  effect: { type: "transform", transform }
@@ -11536,7 +11464,6 @@ var ZodType = class {
11536
11464
  default(def) {
11537
11465
  const defaultValueFunc = typeof def === "function" ? def : () => def;
11538
11466
  return new ZodDefault({
11539
- ...processCreateParams(this._def),
11540
11467
  innerType: this,
11541
11468
  defaultValue: defaultValueFunc,
11542
11469
  typeName: ZodFirstPartyTypeKind.ZodDefault
@@ -11546,15 +11473,14 @@ var ZodType = class {
11546
11473
  return new ZodBranded({
11547
11474
  typeName: ZodFirstPartyTypeKind.ZodBranded,
11548
11475
  type: this,
11549
- ...processCreateParams(this._def)
11476
+ ...processCreateParams(void 0)
11550
11477
  });
11551
11478
  }
11552
11479
  catch(def) {
11553
- const catchValueFunc = typeof def === "function" ? def : () => def;
11480
+ const defaultValueFunc = typeof def === "function" ? def : () => def;
11554
11481
  return new ZodCatch({
11555
- ...processCreateParams(this._def),
11556
11482
  innerType: this,
11557
- catchValue: catchValueFunc,
11483
+ defaultValue: defaultValueFunc,
11558
11484
  typeName: ZodFirstPartyTypeKind.ZodCatch
11559
11485
  });
11560
11486
  }
@@ -11577,25 +11503,24 @@ var ZodType = class {
11577
11503
  };
11578
11504
  __name(ZodType, "ZodType");
11579
11505
  var cuidRegex = /^c[^\s-]{8,}$/i;
11580
- var cuid2Regex = /^[a-z][a-z0-9]*$/;
11581
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;
11582
- 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,}))$/;
11507
+ var emailRegex = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;
11583
11508
  var datetimeRegex = /* @__PURE__ */ __name((args) => {
11584
11509
  if (args.precision) {
11585
11510
  if (args.offset) {
11586
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
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)$`);
11587
11512
  } else {
11588
11513
  return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
11589
11514
  }
11590
11515
  } else if (args.precision === 0) {
11591
11516
  if (args.offset) {
11592
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
11517
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$`);
11593
11518
  } else {
11594
11519
  return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
11595
11520
  }
11596
11521
  } else {
11597
11522
  if (args.offset) {
11598
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
11523
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$`);
11599
11524
  } else {
11600
11525
  return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
11601
11526
  }
@@ -11622,14 +11547,11 @@ var ZodString = class extends ZodType {
11622
11547
  const parsedType = this._getType(input);
11623
11548
  if (parsedType !== ZodParsedType.string) {
11624
11549
  const ctx2 = this._getOrReturnCtx(input);
11625
- addIssueToContext(
11626
- ctx2,
11627
- {
11628
- code: ZodIssueCode.invalid_type,
11629
- expected: ZodParsedType.string,
11630
- received: ctx2.parsedType
11631
- }
11632
- );
11550
+ addIssueToContext(ctx2, {
11551
+ code: ZodIssueCode.invalid_type,
11552
+ expected: ZodParsedType.string,
11553
+ received: ctx2.parsedType
11554
+ });
11633
11555
  return INVALID;
11634
11556
  }
11635
11557
  const status = new ParseStatus();
@@ -11717,16 +11639,6 @@ var ZodString = class extends ZodType {
11717
11639
  });
11718
11640
  status.dirty();
11719
11641
  }
11720
- } else if (check.kind === "cuid2") {
11721
- if (!cuid2Regex.test(input.data)) {
11722
- ctx = this._getOrReturnCtx(input, ctx);
11723
- addIssueToContext(ctx, {
11724
- validation: "cuid2",
11725
- code: ZodIssueCode.invalid_string,
11726
- message: check.message
11727
- });
11728
- status.dirty();
11729
- }
11730
11642
  } else if (check.kind === "url") {
11731
11643
  try {
11732
11644
  new URL(input.data);
@@ -11808,9 +11720,6 @@ var ZodString = class extends ZodType {
11808
11720
  cuid(message) {
11809
11721
  return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
11810
11722
  }
11811
- cuid2(message) {
11812
- return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
11813
- }
11814
11723
  datetime(options) {
11815
11724
  var _a;
11816
11725
  if (typeof options === "string") {
@@ -11885,9 +11794,6 @@ var ZodString = class extends ZodType {
11885
11794
  get isCUID() {
11886
11795
  return !!this._def.checks.find((ch) => ch.kind === "cuid");
11887
11796
  }
11888
- get isCUID2() {
11889
- return !!this._def.checks.find((ch) => ch.kind === "cuid2");
11890
- }
11891
11797
  get minLength() {
11892
11798
  let min = null;
11893
11799
  for (const ch of this._def.checks) {
@@ -12120,22 +12026,7 @@ var ZodNumber = class extends ZodType {
12120
12026
  return max;
12121
12027
  }
12122
12028
  get isInt() {
12123
- return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
12124
- }
12125
- get isFinite() {
12126
- let max = null, min = null;
12127
- for (const ch of this._def.checks) {
12128
- if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
12129
- return true;
12130
- } else if (ch.kind === "min") {
12131
- if (min === null || ch.value > min)
12132
- min = ch.value;
12133
- } else if (ch.kind === "max") {
12134
- if (max === null || ch.value < max)
12135
- max = ch.value;
12136
- }
12137
- }
12138
- return Number.isFinite(min) && Number.isFinite(max);
12029
+ return !!this._def.checks.find((ch) => ch.kind === "int");
12139
12030
  }
12140
12031
  };
12141
12032
  __name(ZodNumber, "ZodNumber");
@@ -12503,13 +12394,13 @@ var ZodArray = class extends ZodType {
12503
12394
  }
12504
12395
  }
12505
12396
  if (ctx.common.async) {
12506
- return Promise.all([...ctx.data].map((item, i) => {
12397
+ return Promise.all(ctx.data.map((item, i) => {
12507
12398
  return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
12508
12399
  })).then((result2) => {
12509
12400
  return ParseStatus.mergeArray(status, result2);
12510
12401
  });
12511
12402
  }
12512
- const result = [...ctx.data].map((item, i) => {
12403
+ const result = ctx.data.map((item, i) => {
12513
12404
  return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
12514
12405
  });
12515
12406
  return ParseStatus.mergeArray(status, result);
@@ -12559,6 +12450,15 @@ var objectUtil;
12559
12450
  };
12560
12451
  };
12561
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");
12562
12462
  function deepPartialify(schema) {
12563
12463
  if (schema instanceof ZodObject) {
12564
12464
  const newShape = {};
@@ -12588,7 +12488,8 @@ var ZodObject = class extends ZodType {
12588
12488
  super(...arguments);
12589
12489
  this._cached = null;
12590
12490
  this.nonstrict = this.passthrough;
12591
- this.augment = this.extend;
12491
+ this.augment = AugmentFactory(this._def);
12492
+ this.extend = AugmentFactory(this._def);
12592
12493
  }
12593
12494
  _getCached() {
12594
12495
  if (this._cached !== null)
@@ -12656,9 +12557,7 @@ var ZodObject = class extends ZodType {
12656
12557
  const value = ctx.data[key];
12657
12558
  pairs.push({
12658
12559
  key: { status: "valid", value: key },
12659
- value: catchall._parse(
12660
- new ParseInputLazyPath(ctx, value, ctx.path, key)
12661
- ),
12560
+ value: catchall._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
12662
12561
  alwaysSet: key in ctx.data
12663
12562
  });
12664
12563
  }
@@ -12717,14 +12616,8 @@ var ZodObject = class extends ZodType {
12717
12616
  unknownKeys: "passthrough"
12718
12617
  });
12719
12618
  }
12720
- extend(augmentation) {
12721
- return new ZodObject({
12722
- ...this._def,
12723
- shape: () => ({
12724
- ...this._def.shape(),
12725
- ...augmentation
12726
- })
12727
- });
12619
+ setKey(key, schema) {
12620
+ return this.augment({ [key]: schema });
12728
12621
  }
12729
12622
  merge(merging) {
12730
12623
  const merged = new ZodObject({
@@ -12735,9 +12628,6 @@ var ZodObject = class extends ZodType {
12735
12628
  });
12736
12629
  return merged;
12737
12630
  }
12738
- setKey(key, schema) {
12739
- return this.augment({ [key]: schema });
12740
- }
12741
12631
  catchall(index) {
12742
12632
  return new ZodObject({
12743
12633
  ...this._def,
@@ -12746,10 +12636,9 @@ var ZodObject = class extends ZodType {
12746
12636
  }
12747
12637
  pick(mask) {
12748
12638
  const shape = {};
12749
- util.objectKeys(mask).forEach((key) => {
12750
- if (mask[key] && this.shape[key]) {
12639
+ util.objectKeys(mask).map((key) => {
12640
+ if (this.shape[key])
12751
12641
  shape[key] = this.shape[key];
12752
- }
12753
12642
  });
12754
12643
  return new ZodObject({
12755
12644
  ...this._def,
@@ -12758,8 +12647,8 @@ var ZodObject = class extends ZodType {
12758
12647
  }
12759
12648
  omit(mask) {
12760
12649
  const shape = {};
12761
- util.objectKeys(this.shape).forEach((key) => {
12762
- if (!mask[key]) {
12650
+ util.objectKeys(this.shape).map((key) => {
12651
+ if (util.objectKeys(mask).indexOf(key) === -1) {
12763
12652
  shape[key] = this.shape[key];
12764
12653
  }
12765
12654
  });
@@ -12773,14 +12662,24 @@ var ZodObject = class extends ZodType {
12773
12662
  }
12774
12663
  partial(mask) {
12775
12664
  const newShape = {};
12776
- util.objectKeys(this.shape).forEach((key) => {
12777
- const fieldSchema = this.shape[key];
12778
- if (mask && !mask[key]) {
12779
- newShape[key] = fieldSchema;
12780
- } else {
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];
12781
12680
  newShape[key] = fieldSchema.optional();
12782
12681
  }
12783
- });
12682
+ }
12784
12683
  return new ZodObject({
12785
12684
  ...this._def,
12786
12685
  shape: () => newShape
@@ -12788,10 +12687,21 @@ var ZodObject = class extends ZodType {
12788
12687
  }
12789
12688
  required(mask) {
12790
12689
  const newShape = {};
12791
- util.objectKeys(this.shape).forEach((key) => {
12792
- if (mask && !mask[key]) {
12793
- newShape[key] = this.shape[key];
12794
- } else {
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) {
12795
12705
  const fieldSchema = this.shape[key];
12796
12706
  let newField = fieldSchema;
12797
12707
  while (newField instanceof ZodOptional) {
@@ -12799,7 +12709,7 @@ var ZodObject = class extends ZodType {
12799
12709
  }
12800
12710
  newShape[key] = newField;
12801
12711
  }
12802
- });
12712
+ }
12803
12713
  return new ZodObject({
12804
12714
  ...this._def,
12805
12715
  shape: () => newShape
@@ -13145,7 +13055,7 @@ var ZodTuple = class extends ZodType {
13145
13055
  });
13146
13056
  status.dirty();
13147
13057
  }
13148
- const items = [...ctx.data].map((item, itemIndex) => {
13058
+ const items = ctx.data.map((item, itemIndex) => {
13149
13059
  const schema = this._def.items[itemIndex] || this._def.rest;
13150
13060
  if (!schema)
13151
13061
  return null;
@@ -13521,7 +13431,6 @@ var ZodLiteral = class extends ZodType {
13521
13431
  if (input.data !== this._def.value) {
13522
13432
  const ctx = this._getOrReturnCtx(input);
13523
13433
  addIssueToContext(ctx, {
13524
- received: ctx.data,
13525
13434
  code: ZodIssueCode.invalid_literal,
13526
13435
  expected: this._def.value
13527
13436
  });
@@ -13597,12 +13506,6 @@ var ZodEnum = class extends ZodType {
13597
13506
  }
13598
13507
  return enumValues;
13599
13508
  }
13600
- extract(values) {
13601
- return ZodEnum.create(values);
13602
- }
13603
- exclude(values) {
13604
- return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)));
13605
- }
13606
13509
  };
13607
13510
  __name(ZodEnum, "ZodEnum");
13608
13511
  ZodEnum.create = createZodEnum;
@@ -13643,9 +13546,6 @@ ZodNativeEnum.create = (values, params) => {
13643
13546
  });
13644
13547
  };
13645
13548
  var ZodPromise = class extends ZodType {
13646
- unwrap() {
13647
- return this._def.type;
13648
- }
13649
13549
  _parse(input) {
13650
13550
  const { ctx } = this._processInputParams(input);
13651
13551
  if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
@@ -13864,29 +13764,23 @@ var ZodCatch = class extends ZodType {
13864
13764
  const result = this._def.innerType._parse({
13865
13765
  data: ctx.data,
13866
13766
  path: ctx.path,
13867
- parent: {
13868
- ...ctx,
13869
- common: {
13870
- ...ctx.common,
13871
- issues: []
13872
- }
13873
- }
13767
+ parent: ctx
13874
13768
  });
13875
13769
  if (isAsync(result)) {
13876
13770
  return result.then((result2) => {
13877
13771
  return {
13878
13772
  status: "valid",
13879
- value: result2.status === "valid" ? result2.value : this._def.catchValue()
13773
+ value: result2.status === "valid" ? result2.value : this._def.defaultValue()
13880
13774
  };
13881
13775
  });
13882
13776
  } else {
13883
13777
  return {
13884
13778
  status: "valid",
13885
- value: result.status === "valid" ? result.value : this._def.catchValue()
13779
+ value: result.status === "valid" ? result.value : this._def.defaultValue()
13886
13780
  };
13887
13781
  }
13888
13782
  }
13889
- removeCatch() {
13783
+ removeDefault() {
13890
13784
  return this._def.innerType;
13891
13785
  }
13892
13786
  };
@@ -13895,7 +13789,7 @@ ZodCatch.create = (type, params) => {
13895
13789
  return new ZodCatch({
13896
13790
  innerType: type,
13897
13791
  typeName: ZodFirstPartyTypeKind.ZodCatch,
13898
- catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
13792
+ defaultValue: typeof params.default === "function" ? params.default : () => params.default,
13899
13793
  ...processCreateParams(params)
13900
13794
  });
13901
13795
  };
@@ -14088,10 +13982,7 @@ var oboolean = /* @__PURE__ */ __name(() => booleanType().optional(), "oboolean"
14088
13982
  var coerce = {
14089
13983
  string: (arg) => ZodString.create({ ...arg, coerce: true }),
14090
13984
  number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
14091
- boolean: (arg) => ZodBoolean.create({
14092
- ...arg,
14093
- coerce: true
14094
- }),
13985
+ boolean: (arg) => ZodBoolean.create({ ...arg, coerce: true }),
14095
13986
  bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
14096
13987
  date: (arg) => ZodDate.create({ ...arg, coerce: true })
14097
13988
  };
@@ -14217,13 +14108,11 @@ var AchievementCriteriaValidator = mod.object({
14217
14108
  type: mod.string().optional(),
14218
14109
  narrative: mod.string().optional()
14219
14110
  });
14220
- var ImageValidator = mod.string().or(
14221
- mod.object({
14222
- id: mod.string(),
14223
- type: mod.string(),
14224
- caption: mod.string().optional()
14225
- })
14226
- );
14111
+ var ImageValidator = mod.string().or(mod.object({
14112
+ id: mod.string(),
14113
+ type: mod.string(),
14114
+ caption: mod.string().optional()
14115
+ }));
14227
14116
  var GeoCoordinatesValidator = mod.object({
14228
14117
  type: mod.string().min(1).or(mod.string().array().nonempty()),
14229
14118
  latitude: mod.number(),
@@ -14265,31 +14154,29 @@ var IdentifierEntryValidator = mod.object({
14265
14154
  identifier: mod.string(),
14266
14155
  identifierType: IdentifierTypeValidator
14267
14156
  });
14268
- var ProfileValidator = mod.string().or(
14269
- mod.object({
14270
- id: mod.string().optional(),
14271
- type: mod.string().or(mod.string().array().nonempty().optional()),
14272
- name: mod.string().optional(),
14273
- url: mod.string().optional(),
14274
- phone: mod.string().optional(),
14275
- description: mod.string().optional(),
14276
- endorsement: mod.any().array().optional(),
14277
- image: ImageValidator.optional(),
14278
- email: mod.string().email().optional(),
14279
- address: AddressValidator.optional(),
14280
- otherIdentifier: IdentifierEntryValidator.array().optional(),
14281
- official: mod.string().optional(),
14282
- parentOrg: mod.any().optional(),
14283
- familyName: mod.string().optional(),
14284
- givenName: mod.string().optional(),
14285
- additionalName: mod.string().optional(),
14286
- patronymicName: mod.string().optional(),
14287
- honorificPrefix: mod.string().optional(),
14288
- honorificSuffix: mod.string().optional(),
14289
- familyNamePrefix: mod.string().optional(),
14290
- dateOfBirth: mod.string().optional()
14291
- }).catchall(mod.any())
14292
- );
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()));
14293
14180
  var CredentialSubjectValidator = mod.object({ id: mod.string().optional() }).catchall(mod.any());
14294
14181
  var CredentialStatusValidator = mod.object({ type: mod.string(), id: mod.string() });
14295
14182
  var CredentialSchemaValidator = mod.object({ id: mod.string(), type: mod.string() });
@@ -14571,11 +14458,13 @@ var JWEValidator = mod.object({
14571
14458
  aad: mod.string().optional(),
14572
14459
  recipients: JWERecipientValidator.array().optional()
14573
14460
  });
14574
- var EncryptedCredentialRecordValidator = mod.object({
14575
- encryptedRecord: JWEValidator,
14576
- fields: mod.string().array(),
14461
+ var EncryptedRecordValidator = mod.object({ encryptedRecord: JWEValidator, fields: mod.string().array() }).catchall(mod.any());
14462
+ var PaginatedEncryptedRecordsValidator = PaginationResponseValidator.extend({
14463
+ records: EncryptedRecordValidator.array()
14464
+ });
14465
+ var EncryptedCredentialRecordValidator = EncryptedRecordValidator.extend({
14577
14466
  id: mod.string()
14578
- }).catchall(mod.any());
14467
+ });
14579
14468
  var PaginatedEncryptedCredentialRecordsValidator = PaginationResponseValidator.extend({
14580
14469
  records: EncryptedCredentialRecordValidator.array()
14581
14470
  });
@@ -14669,7 +14558,7 @@ var import_json_stringify_deterministic = __toESM(require_lib());
14669
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 } };
14670
14559
  function t(t2, a, o, i, s = "SHA-256") {
14671
14560
  return new Promise((u, c) => {
14672
- 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) => {
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) => {
14673
14562
  const y = { name: "PBKDF2", hash: s, salt: a, iterations: o };
14674
14563
  crypto.subtle.deriveBits(y, f, 8 * i).then((e2) => u(e2), (f2) => {
14675
14564
  (async function(t3, a2, o2, i2, s2) {
@@ -14681,7 +14570,7 @@ function t(t2, a, o, i, s = "SHA-256") {
14681
14570
  if (!Number.isInteger(i2) || i2 <= 0 || i2 >= (2 ** 32 - 1) * u2)
14682
14571
  throw new RangeError("dkLen must be a positive integer < (2 ** 32 - 1) * hLen");
14683
14572
  const c2 = Math.ceil(i2 / u2), f3 = i2 - (c2 - 1) * u2, y2 = new Array(c2);
14684
- 0 === t3.byteLength && (t3 = new Uint8Array(e[s2].blockSize));
14573
+ t3.byteLength === 0 && (t3 = new Uint8Array(e[s2].blockSize));
14685
14574
  const w = await crypto.subtle.importKey("raw", t3, { name: "HMAC", hash: { name: s2 } }, true, ["sign"]), g = /* @__PURE__ */ __name(async function(e2, t4) {
14686
14575
  const r2 = await crypto.subtle.sign("HMAC", e2, t4);
14687
14576
  return new Uint8Array(r2);
@@ -14710,7 +14599,7 @@ function t(t2, a, o, i, s = "SHA-256") {
14710
14599
  __name(t, "t");
14711
14600
  function r(...e2) {
14712
14601
  const t2 = e2.reduce((e3, t3) => e3 + t3.length, 0);
14713
- if (0 === e2.length)
14602
+ if (e2.length === 0)
14714
14603
  throw new RangeError("Cannot concat no arrays");
14715
14604
  const r2 = new Uint8Array(t2);
14716
14605
  let n2 = 0;
@@ -14731,13 +14620,7 @@ var hash = /* @__PURE__ */ __name(async (learnCard, message) => {
14731
14620
  const uint8Message = new TextEncoder().encode(message);
14732
14621
  const pk = learnCard.id.keypair("secp256k1").d;
14733
14622
  const hmacKey = await t(pk, "salt", 1e3, 32);
14734
- const cryptoKey = await crypto2.subtle.importKey(
14735
- "raw",
14736
- hmacKey,
14737
- { name: "HMAC", hash: "SHA-256" },
14738
- false,
14739
- ["sign"]
14740
- );
14623
+ const cryptoKey = await crypto2.subtle.importKey("raw", hmacKey, { name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
14741
14624
  const digestBuffer = await crypto2.subtle.sign("HMAC", cryptoKey, uint8Message);
14742
14625
  const digestArray = Array.from(new Uint8Array(digestBuffer));
14743
14626
  return digestArray.map((byte) => byte.toString(16).padStart(2, "0")).join("");
@@ -14750,22 +14633,18 @@ var decryptJWE = /* @__PURE__ */ __name(async (learnCard, jwe) => {
14750
14633
  }, "decryptJWE");
14751
14634
  var generateEncryptedFieldsArray = /* @__PURE__ */ __name(async (learnCard, record, unencryptedFields = []) => {
14752
14635
  const entries = Object.entries(record);
14753
- return (await Promise.all(
14754
- entries.map(async ([key, value]) => {
14755
- if (!unencryptedFields.includes(key)) {
14756
- const result = await hash(learnCard, `${key}:${(0, import_json_stringify_deterministic.default)(value)}`);
14757
- return result;
14758
- }
14759
- return "";
14760
- })
14761
- )).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);
14762
14643
  }, "generateEncryptedFieldsArray");
14763
14644
  var generateEncryptedRecord = /* @__PURE__ */ __name(async (learnCard, record, unencryptedFields = []) => {
14764
14645
  const encryptedRecord = await learnCard.invoke.getDIDObject().createDagJWE(record, [learnCard.id.did()]);
14765
14646
  const fields = await generateEncryptedFieldsArray(learnCard, record, unencryptedFields);
14766
- const unencryptedEntries = Object.fromEntries(
14767
- Object.entries(record).filter(([key]) => unencryptedFields.includes(key))
14768
- );
14647
+ const unencryptedEntries = Object.fromEntries(Object.entries(record).filter(([key]) => unencryptedFields.includes(key)));
14769
14648
  return { ...unencryptedEntries, encryptedRecord, fields };
14770
14649
  }, "generateEncryptedRecord");
14771
14650
 
@@ -14778,7 +14657,7 @@ var getLearnCloudClient = /* @__PURE__ */ __name(async (url, learnCard) => {
14778
14657
  return jwt;
14779
14658
  });
14780
14659
  }, "getLearnCloudClient");
14781
- var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, unencryptedFields = []) => {
14660
+ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, unencryptedFields = [], unencryptedCustomFields = []) => {
14782
14661
  let learnCard = initialLearnCard;
14783
14662
  learnCard.debug?.("Adding LearnCloud Plugin");
14784
14663
  let client = await getLearnCloudClient(url, learnCard);
@@ -14804,7 +14683,116 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
14804
14683
  name: "LearnCloud",
14805
14684
  displayName: "LearnCloud",
14806
14685
  description: "LearnCloud Integration",
14807
- methods: {},
14686
+ methods: {
14687
+ learnCloudCreate: async (_learnCard, document) => {
14688
+ await updateLearnCard(_learnCard);
14689
+ const item = await generateEncryptedRecord(_learnCard, document, unencryptedCustomFields);
14690
+ return client.customStorage.create.mutate({
14691
+ item: await generateJWE(_learnCard, learnCloudDid, item)
14692
+ });
14693
+ },
14694
+ learnCloudCreateMany: async (_learnCard, documents) => {
14695
+ await updateLearnCard(_learnCard);
14696
+ const items = await Promise.all(documents.map(async (document) => generateEncryptedRecord(_learnCard, document, unencryptedCustomFields)));
14697
+ return client.customStorage.createMany.mutate({
14698
+ items: await generateJWE(_learnCard, learnCloudDid, items)
14699
+ });
14700
+ },
14701
+ learnCloudRead: async (_learnCard, query, includeAssociatedDids) => {
14702
+ await updateLearnCard(_learnCard);
14703
+ const documents = [];
14704
+ let result = await _learnCard.invoke.learnCloudReadPage(query, {}, includeAssociatedDids);
14705
+ documents.push(...result.records);
14706
+ while (result.hasMore) {
14707
+ result = await _learnCard.invoke.learnCloudReadPage(query, {}, includeAssociatedDids);
14708
+ documents.push(...result.records);
14709
+ }
14710
+ return documents;
14711
+ },
14712
+ learnCloudReadPage: async (_learnCard, query, paginationOptions, includeAssociatedDids) => {
14713
+ await updateLearnCard(_learnCard);
14714
+ if (!query) {
14715
+ const jwe2 = await client.customStorage.read.query({
14716
+ includeAssociatedDids,
14717
+ ...paginationOptions
14718
+ });
14719
+ const encryptedRecords2 = isEncrypted(jwe2) ? await decryptJWE(_learnCard, jwe2) : jwe2;
14720
+ return {
14721
+ ...encryptedRecords2,
14722
+ records: await Promise.all(encryptedRecords2.records.map(async (record) => ({
14723
+ ...await decryptJWE(_learnCard, record.encryptedRecord),
14724
+ _id: record._id
14725
+ })))
14726
+ };
14727
+ }
14728
+ const fields = await generateEncryptedFieldsArray(_learnCard, query, [
14729
+ ...unencryptedCustomFields,
14730
+ "_id"
14731
+ ]);
14732
+ const unencryptedEntries = Object.fromEntries(Object.entries(query).filter(([key]) => [...unencryptedCustomFields, "_id"].includes(key)));
14733
+ const jwe = await client.customStorage.read.query({
14734
+ query: await generateJWE(_learnCard, learnCloudDid, {
14735
+ ...unencryptedEntries,
14736
+ ...fields.length > 0 ? { fields: { $in: fields } } : {}
14737
+ }),
14738
+ ...paginationOptions,
14739
+ includeAssociatedDids
14740
+ });
14741
+ const encryptedRecords = isEncrypted(jwe) ? await decryptJWE(_learnCard, jwe) : jwe;
14742
+ return {
14743
+ ...encryptedRecords,
14744
+ records: await Promise.all(encryptedRecords.records.map(async (record) => ({
14745
+ ...await decryptJWE(_learnCard, record.encryptedRecord),
14746
+ _id: record._id
14747
+ })))
14748
+ };
14749
+ },
14750
+ learnCloudCount: async (_learnCard, query, includeAssociatedDids) => {
14751
+ await updateLearnCard(_learnCard);
14752
+ if (!query)
14753
+ return client.customStorage.count.query({ includeAssociatedDids });
14754
+ const fields = await generateEncryptedFieldsArray(_learnCard, query, [
14755
+ ...unencryptedCustomFields,
14756
+ "_id"
14757
+ ]);
14758
+ const unencryptedEntries = Object.fromEntries(Object.entries(query).filter(([key]) => [...unencryptedCustomFields, "_id"].includes(key)));
14759
+ return client.customStorage.count.query({
14760
+ query: await generateJWE(_learnCard, learnCloudDid, {
14761
+ ...unencryptedEntries,
14762
+ ...fields.length > 0 ? { fields: { $in: fields } } : {}
14763
+ }),
14764
+ includeAssociatedDids
14765
+ });
14766
+ },
14767
+ learnCloudUpdate: async (_learnCard, query, update) => {
14768
+ await updateLearnCard(_learnCard);
14769
+ const documents = await _learnCard.invoke.learnCloudRead(query);
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
+ })));
14776
+ return updates.reduce((sum, current) => current + sum, 0);
14777
+ },
14778
+ learnCloudDelete: async (_learnCard, query, includeAssociatedDids) => {
14779
+ await updateLearnCard(_learnCard);
14780
+ if (!query)
14781
+ return client.customStorage.delete.mutate({ includeAssociatedDids });
14782
+ const fields = await generateEncryptedFieldsArray(_learnCard, query, [
14783
+ ...unencryptedCustomFields,
14784
+ "_id"
14785
+ ]);
14786
+ const unencryptedEntries = Object.fromEntries(Object.entries(query).filter(([key]) => [...unencryptedCustomFields, "_id"].includes(key)));
14787
+ return client.customStorage.delete.mutate({
14788
+ query: await generateJWE(_learnCard, learnCloudDid, {
14789
+ ...unencryptedEntries,
14790
+ ...fields.length > 0 ? { fields: { $in: fields } } : {}
14791
+ }),
14792
+ includeAssociatedDids
14793
+ });
14794
+ }
14795
+ },
14808
14796
  read: {
14809
14797
  get: async (_learnCard, uri) => {
14810
14798
  if (!uri)
@@ -14858,53 +14846,30 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
14858
14846
  const jwe2 = await client.index.get.query(paginationOptions);
14859
14847
  _learnCard.debug?.("LearnCloud index.get (no query response)", jwe2);
14860
14848
  const encryptedRecords2 = isEncrypted(jwe2) ? await decryptJWE(_learnCard, jwe2) : jwe2;
14861
- _learnCard.debug?.(
14862
- "LearnCloud index.get (no query encryptedRecords)",
14863
- encryptedRecords2
14864
- );
14849
+ _learnCard.debug?.("LearnCloud index.get (no query encryptedRecords)", encryptedRecords2);
14865
14850
  return {
14866
14851
  ...encryptedRecords2,
14867
- records: await Promise.all(
14868
- encryptedRecords2.records.map(
14869
- async (record) => decryptJWE(_learnCard, record.encryptedRecord)
14870
- )
14871
- )
14852
+ records: await Promise.all(encryptedRecords2.records.map(async (record) => decryptJWE(_learnCard, record.encryptedRecord)))
14872
14853
  };
14873
14854
  }
14874
14855
  _learnCard.debug?.("LearnCloud index.get (query)");
14875
- const fields = await generateEncryptedFieldsArray(
14876
- _learnCard,
14877
- query,
14878
- unencryptedFields
14879
- );
14856
+ const fields = await generateEncryptedFieldsArray(_learnCard, query, unencryptedFields);
14880
14857
  _learnCard.debug?.("LearnCloud index.get (query fields)", fields);
14881
- const unencryptedEntries = Object.fromEntries(
14882
- Object.entries(query).filter(([key]) => unencryptedFields.includes(key))
14883
- );
14884
- _learnCard.debug?.(
14885
- "LearnCloud index.get (query unencryptedEntries)",
14886
- unencryptedEntries
14887
- );
14858
+ const unencryptedEntries = Object.fromEntries(Object.entries(query).filter(([key]) => unencryptedFields.includes(key)));
14859
+ _learnCard.debug?.("LearnCloud index.get (query unencryptedEntries)", unencryptedEntries);
14888
14860
  const jwe = await client.index.get.query({
14889
14861
  query: await generateJWE(_learnCard, learnCloudDid, {
14890
14862
  ...unencryptedEntries,
14891
- fields: { $in: fields }
14863
+ ...fields.length > 0 ? { fields: { $in: fields } } : {}
14892
14864
  }),
14893
14865
  ...paginationOptions
14894
14866
  });
14895
14867
  _learnCard.debug?.("LearnCloud index.get (query jwe)", jwe);
14896
14868
  const encryptedRecords = isEncrypted(jwe) ? await decryptJWE(_learnCard, jwe) : jwe;
14897
- _learnCard.debug?.(
14898
- "LearnCloud index.get (query encryptedRecords)",
14899
- encryptedRecords
14900
- );
14869
+ _learnCard.debug?.("LearnCloud index.get (query encryptedRecords)", encryptedRecords);
14901
14870
  return {
14902
14871
  ...encryptedRecords,
14903
- records: await Promise.all(
14904
- encryptedRecords.records.map(
14905
- async (record) => decryptJWE(_learnCard, record.encryptedRecord)
14906
- )
14907
- )
14872
+ records: await Promise.all(encryptedRecords.records.map(async (record) => decryptJWE(_learnCard, record.encryptedRecord)))
14908
14873
  };
14909
14874
  },
14910
14875
  getCount: async (_learnCard, query) => {
@@ -14918,23 +14883,14 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
14918
14883
  return count2;
14919
14884
  }
14920
14885
  _learnCard.debug?.("LearnCloud index.getCount (query)");
14921
- const fields = await generateEncryptedFieldsArray(
14922
- _learnCard,
14923
- query,
14924
- unencryptedFields
14925
- );
14886
+ const fields = await generateEncryptedFieldsArray(_learnCard, query, unencryptedFields);
14926
14887
  _learnCard.debug?.("LearnCloud index.getCount (query fields)", fields);
14927
- const unencryptedEntries = Object.fromEntries(
14928
- Object.entries(query).filter(([key]) => unencryptedFields.includes(key))
14929
- );
14930
- _learnCard.debug?.(
14931
- "LearnCloud index.getCount (query unencryptedEntries)",
14932
- unencryptedEntries
14933
- );
14888
+ const unencryptedEntries = Object.fromEntries(Object.entries(query).filter(([key]) => unencryptedFields.includes(key)));
14889
+ _learnCard.debug?.("LearnCloud index.getCount (query unencryptedEntries)", unencryptedEntries);
14934
14890
  const jwe = await client.index.count.query({
14935
14891
  query: await generateJWE(_learnCard, learnCloudDid, {
14936
14892
  ...unencryptedEntries,
14937
- fields: { $in: fields }
14893
+ ...fields.length > 0 ? { fields: { $in: fields } } : {}
14938
14894
  })
14939
14895
  });
14940
14896
  _learnCard.debug?.("LearnCloud index.count (query response)", jwe);
@@ -14947,37 +14903,25 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
14947
14903
  const id = record.id || _learnCard.invoke.crypto().randomUUID();
14948
14904
  return client.index.add.mutate({
14949
14905
  record: await generateJWE(_learnCard, learnCloudDid, {
14950
- ...await generateEncryptedRecord(
14951
- _learnCard,
14952
- { ...record, id },
14953
- unencryptedFields
14954
- ),
14906
+ ...await generateEncryptedRecord(_learnCard, { ...record, id }, unencryptedFields),
14955
14907
  id: await hash(_learnCard, id)
14956
14908
  })
14957
14909
  });
14958
14910
  },
14959
14911
  addMany: async (_learnCard, _records) => {
14960
14912
  await updateLearnCard(_learnCard);
14961
- const results = await Promise.all(
14962
- (0, import_lodash.chunk)(_records, 25).map(async (batch) => {
14963
- const records = await Promise.all(
14964
- batch.map(async (record) => {
14965
- const id = record.id || _learnCard.invoke.crypto().randomUUID();
14966
- return {
14967
- ...await generateEncryptedRecord(
14968
- _learnCard,
14969
- { ...record, id },
14970
- unencryptedFields
14971
- ),
14972
- id: await hash(_learnCard, id)
14973
- };
14974
- })
14975
- );
14976
- return client.index.addMany.mutate({
14977
- records: await generateJWE(_learnCard, learnCloudDid, records)
14978
- });
14979
- })
14980
- );
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
+ }));
14981
14925
  return results.every(Boolean);
14982
14926
  },
14983
14927
  update: async (_learnCard, id, updates) => {
@@ -14989,11 +14933,7 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
14989
14933
  const newRecord = { ...record, ...updates };
14990
14934
  return client.index.update.mutate({
14991
14935
  id: await hash(_learnCard, id),
14992
- updates: await generateJWE(
14993
- _learnCard,
14994
- learnCloudDid,
14995
- await generateEncryptedRecord(_learnCard, newRecord, unencryptedFields)
14996
- )
14936
+ updates: await generateJWE(_learnCard, learnCloudDid, await generateEncryptedRecord(_learnCard, newRecord, unencryptedFields))
14997
14937
  });
14998
14938
  },
14999
14939
  remove: async (_learnCard, id) => {