@learncard/types 5.3.2 → 5.3.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -90,7 +90,7 @@ __export(src_exports, {
90
90
  });
91
91
  module.exports = __toCommonJS(src_exports);
92
92
 
93
- // ../../node_modules/.pnpm/zod@3.20.6/node_modules/zod/lib/index.mjs
93
+ // ../../node_modules/.pnpm/zod@3.20.2/node_modules/zod/lib/index.mjs
94
94
  var util;
95
95
  (function(util2) {
96
96
  util2.assertEqual = (val) => val;
@@ -522,7 +522,7 @@ var OK = /* @__PURE__ */ __name((value) => ({ status: "valid", value }), "OK");
522
522
  var isAborted = /* @__PURE__ */ __name((x) => x.status === "aborted", "isAborted");
523
523
  var isDirty = /* @__PURE__ */ __name((x) => x.status === "dirty", "isDirty");
524
524
  var isValid = /* @__PURE__ */ __name((x) => x.status === "valid", "isValid");
525
- var isAsync = /* @__PURE__ */ __name((x) => typeof Promise !== "undefined" && x instanceof Promise, "isAsync");
525
+ var isAsync = /* @__PURE__ */ __name((x) => typeof Promise !== void 0 && x instanceof Promise, "isAsync");
526
526
  var errorUtil;
527
527
  (function(errorUtil2) {
528
528
  errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
@@ -740,29 +740,28 @@ var ZodType = class {
740
740
  return this._refinement(refinement);
741
741
  }
742
742
  optional() {
743
- return ZodOptional.create(this, this._def);
743
+ return ZodOptional.create(this);
744
744
  }
745
745
  nullable() {
746
- return ZodNullable.create(this, this._def);
746
+ return ZodNullable.create(this);
747
747
  }
748
748
  nullish() {
749
- return this.nullable().optional();
749
+ return this.optional().nullable();
750
750
  }
751
751
  array() {
752
- return ZodArray.create(this, this._def);
752
+ return ZodArray.create(this);
753
753
  }
754
754
  promise() {
755
- return ZodPromise.create(this, this._def);
755
+ return ZodPromise.create(this);
756
756
  }
757
757
  or(option) {
758
- return ZodUnion.create([this, option], this._def);
758
+ return ZodUnion.create([this, option]);
759
759
  }
760
760
  and(incoming) {
761
- return ZodIntersection.create(this, incoming, this._def);
761
+ return ZodIntersection.create(this, incoming);
762
762
  }
763
763
  transform(transform) {
764
764
  return new ZodEffects({
765
- ...processCreateParams(this._def),
766
765
  schema: this,
767
766
  typeName: ZodFirstPartyTypeKind.ZodEffects,
768
767
  effect: { type: "transform", transform }
@@ -771,7 +770,6 @@ var ZodType = class {
771
770
  default(def) {
772
771
  const defaultValueFunc = typeof def === "function" ? def : () => def;
773
772
  return new ZodDefault({
774
- ...processCreateParams(this._def),
775
773
  innerType: this,
776
774
  defaultValue: defaultValueFunc,
777
775
  typeName: ZodFirstPartyTypeKind.ZodDefault
@@ -781,15 +779,14 @@ var ZodType = class {
781
779
  return new ZodBranded({
782
780
  typeName: ZodFirstPartyTypeKind.ZodBranded,
783
781
  type: this,
784
- ...processCreateParams(this._def)
782
+ ...processCreateParams(void 0)
785
783
  });
786
784
  }
787
785
  catch(def) {
788
- const catchValueFunc = typeof def === "function" ? def : () => def;
786
+ const defaultValueFunc = typeof def === "function" ? def : () => def;
789
787
  return new ZodCatch({
790
- ...processCreateParams(this._def),
791
788
  innerType: this,
792
- catchValue: catchValueFunc,
789
+ defaultValue: defaultValueFunc,
793
790
  typeName: ZodFirstPartyTypeKind.ZodCatch
794
791
  });
795
792
  }
@@ -812,25 +809,24 @@ var ZodType = class {
812
809
  };
813
810
  __name(ZodType, "ZodType");
814
811
  var cuidRegex = /^c[^\s-]{8,}$/i;
815
- var cuid2Regex = /^[a-z][a-z0-9]*$/;
816
812
  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;
817
- 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,}))$/;
813
+ var emailRegex = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;
818
814
  var datetimeRegex = /* @__PURE__ */ __name((args) => {
819
815
  if (args.precision) {
820
816
  if (args.offset) {
821
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
817
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}:\\d{2})|Z)$`);
822
818
  } else {
823
819
  return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
824
820
  }
825
821
  } else if (args.precision === 0) {
826
822
  if (args.offset) {
827
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
823
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$`);
828
824
  } else {
829
825
  return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
830
826
  }
831
827
  } else {
832
828
  if (args.offset) {
833
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
829
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$`);
834
830
  } else {
835
831
  return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
836
832
  }
@@ -953,16 +949,6 @@ var ZodString = class extends ZodType {
953
949
  });
954
950
  status.dirty();
955
951
  }
956
- } else if (check.kind === "cuid2") {
957
- if (!cuid2Regex.test(input.data)) {
958
- ctx = this._getOrReturnCtx(input, ctx);
959
- addIssueToContext(ctx, {
960
- validation: "cuid2",
961
- code: ZodIssueCode.invalid_string,
962
- message: check.message
963
- });
964
- status.dirty();
965
- }
966
952
  } else if (check.kind === "url") {
967
953
  try {
968
954
  new URL(input.data);
@@ -1044,9 +1030,6 @@ var ZodString = class extends ZodType {
1044
1030
  cuid(message) {
1045
1031
  return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
1046
1032
  }
1047
- cuid2(message) {
1048
- return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
1049
- }
1050
1033
  datetime(options) {
1051
1034
  var _a;
1052
1035
  if (typeof options === "string") {
@@ -1121,9 +1104,6 @@ var ZodString = class extends ZodType {
1121
1104
  get isCUID() {
1122
1105
  return !!this._def.checks.find((ch) => ch.kind === "cuid");
1123
1106
  }
1124
- get isCUID2() {
1125
- return !!this._def.checks.find((ch) => ch.kind === "cuid2");
1126
- }
1127
1107
  get minLength() {
1128
1108
  let min = null;
1129
1109
  for (const ch of this._def.checks) {
@@ -1356,22 +1336,7 @@ var ZodNumber = class extends ZodType {
1356
1336
  return max;
1357
1337
  }
1358
1338
  get isInt() {
1359
- return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
1360
- }
1361
- get isFinite() {
1362
- let max = null, min = null;
1363
- for (const ch of this._def.checks) {
1364
- if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
1365
- return true;
1366
- } else if (ch.kind === "min") {
1367
- if (min === null || ch.value > min)
1368
- min = ch.value;
1369
- } else if (ch.kind === "max") {
1370
- if (max === null || ch.value < max)
1371
- max = ch.value;
1372
- }
1373
- }
1374
- return Number.isFinite(min) && Number.isFinite(max);
1339
+ return !!this._def.checks.find((ch) => ch.kind === "int");
1375
1340
  }
1376
1341
  };
1377
1342
  __name(ZodNumber, "ZodNumber");
@@ -1739,13 +1704,13 @@ var ZodArray = class extends ZodType {
1739
1704
  }
1740
1705
  }
1741
1706
  if (ctx.common.async) {
1742
- return Promise.all([...ctx.data].map((item, i) => {
1707
+ return Promise.all(ctx.data.map((item, i) => {
1743
1708
  return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
1744
1709
  })).then((result2) => {
1745
1710
  return ParseStatus.mergeArray(status, result2);
1746
1711
  });
1747
1712
  }
1748
- const result = [...ctx.data].map((item, i) => {
1713
+ const result = ctx.data.map((item, i) => {
1749
1714
  return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
1750
1715
  });
1751
1716
  return ParseStatus.mergeArray(status, result);
@@ -1796,6 +1761,15 @@ var objectUtil;
1796
1761
  };
1797
1762
  };
1798
1763
  })(objectUtil || (objectUtil = {}));
1764
+ var AugmentFactory = /* @__PURE__ */ __name((def) => (augmentation) => {
1765
+ return new ZodObject({
1766
+ ...def,
1767
+ shape: () => ({
1768
+ ...def.shape(),
1769
+ ...augmentation
1770
+ })
1771
+ });
1772
+ }, "AugmentFactory");
1799
1773
  function deepPartialify(schema) {
1800
1774
  if (schema instanceof ZodObject) {
1801
1775
  const newShape = {};
@@ -1825,7 +1799,8 @@ var ZodObject = class extends ZodType {
1825
1799
  super(...arguments);
1826
1800
  this._cached = null;
1827
1801
  this.nonstrict = this.passthrough;
1828
- this.augment = this.extend;
1802
+ this.augment = AugmentFactory(this._def);
1803
+ this.extend = AugmentFactory(this._def);
1829
1804
  }
1830
1805
  _getCached() {
1831
1806
  if (this._cached !== null)
@@ -1955,31 +1930,8 @@ var ZodObject = class extends ZodType {
1955
1930
  unknownKeys: "passthrough"
1956
1931
  });
1957
1932
  }
1958
- // const AugmentFactory =
1959
- // <Def extends ZodObjectDef>(def: Def) =>
1960
- // <Augmentation extends ZodRawShape>(
1961
- // augmentation: Augmentation
1962
- // ): ZodObject<
1963
- // extendShape<ReturnType<Def["shape"]>, Augmentation>,
1964
- // Def["unknownKeys"],
1965
- // Def["catchall"]
1966
- // > => {
1967
- // return new ZodObject({
1968
- // ...def,
1969
- // shape: () => ({
1970
- // ...def.shape(),
1971
- // ...augmentation,
1972
- // }),
1973
- // }) as any;
1974
- // };
1975
- extend(augmentation) {
1976
- return new ZodObject({
1977
- ...this._def,
1978
- shape: () => ({
1979
- ...this._def.shape(),
1980
- ...augmentation
1981
- })
1982
- });
1933
+ setKey(key, schema) {
1934
+ return this.augment({ [key]: schema });
1983
1935
  }
1984
1936
  /**
1985
1937
  * Prior to zod@1.0.12 there was a bug in the
@@ -1995,65 +1947,6 @@ var ZodObject = class extends ZodType {
1995
1947
  });
1996
1948
  return merged;
1997
1949
  }
1998
- // merge<
1999
- // Incoming extends AnyZodObject,
2000
- // Augmentation extends Incoming["shape"],
2001
- // NewOutput extends {
2002
- // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
2003
- // ? Augmentation[k]["_output"]
2004
- // : k extends keyof Output
2005
- // ? Output[k]
2006
- // : never;
2007
- // },
2008
- // NewInput extends {
2009
- // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
2010
- // ? Augmentation[k]["_input"]
2011
- // : k extends keyof Input
2012
- // ? Input[k]
2013
- // : never;
2014
- // }
2015
- // >(
2016
- // merging: Incoming
2017
- // ): ZodObject<
2018
- // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
2019
- // Incoming["_def"]["unknownKeys"],
2020
- // Incoming["_def"]["catchall"],
2021
- // NewOutput,
2022
- // NewInput
2023
- // > {
2024
- // const merged: any = new ZodObject({
2025
- // unknownKeys: merging._def.unknownKeys,
2026
- // catchall: merging._def.catchall,
2027
- // shape: () =>
2028
- // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
2029
- // typeName: ZodFirstPartyTypeKind.ZodObject,
2030
- // }) as any;
2031
- // return merged;
2032
- // }
2033
- setKey(key, schema) {
2034
- return this.augment({ [key]: schema });
2035
- }
2036
- // merge<Incoming extends AnyZodObject>(
2037
- // merging: Incoming
2038
- // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
2039
- // ZodObject<
2040
- // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
2041
- // Incoming["_def"]["unknownKeys"],
2042
- // Incoming["_def"]["catchall"]
2043
- // > {
2044
- // // const mergedShape = objectUtil.mergeShapes(
2045
- // // this._def.shape(),
2046
- // // merging._def.shape()
2047
- // // );
2048
- // const merged: any = new ZodObject({
2049
- // unknownKeys: merging._def.unknownKeys,
2050
- // catchall: merging._def.catchall,
2051
- // shape: () =>
2052
- // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
2053
- // typeName: ZodFirstPartyTypeKind.ZodObject,
2054
- // }) as any;
2055
- // return merged;
2056
- // }
2057
1950
  catchall(index) {
2058
1951
  return new ZodObject({
2059
1952
  ...this._def,
@@ -2062,10 +1955,9 @@ var ZodObject = class extends ZodType {
2062
1955
  }
2063
1956
  pick(mask) {
2064
1957
  const shape = {};
2065
- util.objectKeys(mask).forEach((key) => {
2066
- if (mask[key] && this.shape[key]) {
1958
+ util.objectKeys(mask).map((key) => {
1959
+ if (this.shape[key])
2067
1960
  shape[key] = this.shape[key];
2068
- }
2069
1961
  });
2070
1962
  return new ZodObject({
2071
1963
  ...this._def,
@@ -2074,8 +1966,8 @@ var ZodObject = class extends ZodType {
2074
1966
  }
2075
1967
  omit(mask) {
2076
1968
  const shape = {};
2077
- util.objectKeys(this.shape).forEach((key) => {
2078
- if (!mask[key]) {
1969
+ util.objectKeys(this.shape).map((key) => {
1970
+ if (util.objectKeys(mask).indexOf(key) === -1) {
2079
1971
  shape[key] = this.shape[key];
2080
1972
  }
2081
1973
  });
@@ -2089,14 +1981,24 @@ var ZodObject = class extends ZodType {
2089
1981
  }
2090
1982
  partial(mask) {
2091
1983
  const newShape = {};
2092
- util.objectKeys(this.shape).forEach((key) => {
2093
- const fieldSchema = this.shape[key];
2094
- if (mask && !mask[key]) {
2095
- newShape[key] = fieldSchema;
2096
- } else {
1984
+ if (mask) {
1985
+ util.objectKeys(this.shape).map((key) => {
1986
+ if (util.objectKeys(mask).indexOf(key) === -1) {
1987
+ newShape[key] = this.shape[key];
1988
+ } else {
1989
+ newShape[key] = this.shape[key].optional();
1990
+ }
1991
+ });
1992
+ return new ZodObject({
1993
+ ...this._def,
1994
+ shape: () => newShape
1995
+ });
1996
+ } else {
1997
+ for (const key in this.shape) {
1998
+ const fieldSchema = this.shape[key];
2097
1999
  newShape[key] = fieldSchema.optional();
2098
2000
  }
2099
- });
2001
+ }
2100
2002
  return new ZodObject({
2101
2003
  ...this._def,
2102
2004
  shape: () => newShape
@@ -2104,10 +2006,21 @@ var ZodObject = class extends ZodType {
2104
2006
  }
2105
2007
  required(mask) {
2106
2008
  const newShape = {};
2107
- util.objectKeys(this.shape).forEach((key) => {
2108
- if (mask && !mask[key]) {
2109
- newShape[key] = this.shape[key];
2110
- } else {
2009
+ if (mask) {
2010
+ util.objectKeys(this.shape).map((key) => {
2011
+ if (util.objectKeys(mask).indexOf(key) === -1) {
2012
+ newShape[key] = this.shape[key];
2013
+ } else {
2014
+ const fieldSchema = this.shape[key];
2015
+ let newField = fieldSchema;
2016
+ while (newField instanceof ZodOptional) {
2017
+ newField = newField._def.innerType;
2018
+ }
2019
+ newShape[key] = newField;
2020
+ }
2021
+ });
2022
+ } else {
2023
+ for (const key in this.shape) {
2111
2024
  const fieldSchema = this.shape[key];
2112
2025
  let newField = fieldSchema;
2113
2026
  while (newField instanceof ZodOptional) {
@@ -2115,7 +2028,7 @@ var ZodObject = class extends ZodType {
2115
2028
  }
2116
2029
  newShape[key] = newField;
2117
2030
  }
2118
- });
2031
+ }
2119
2032
  return new ZodObject({
2120
2033
  ...this._def,
2121
2034
  shape: () => newShape
@@ -2469,7 +2382,7 @@ var ZodTuple = class extends ZodType {
2469
2382
  });
2470
2383
  status.dirty();
2471
2384
  }
2472
- const items = [...ctx.data].map((item, itemIndex) => {
2385
+ const items = ctx.data.map((item, itemIndex) => {
2473
2386
  const schema = this._def.items[itemIndex] || this._def.rest;
2474
2387
  if (!schema)
2475
2388
  return null;
@@ -2845,7 +2758,6 @@ var ZodLiteral = class extends ZodType {
2845
2758
  if (input.data !== this._def.value) {
2846
2759
  const ctx = this._getOrReturnCtx(input);
2847
2760
  addIssueToContext(ctx, {
2848
- received: ctx.data,
2849
2761
  code: ZodIssueCode.invalid_literal,
2850
2762
  expected: this._def.value
2851
2763
  });
@@ -2921,12 +2833,6 @@ var ZodEnum = class extends ZodType {
2921
2833
  }
2922
2834
  return enumValues;
2923
2835
  }
2924
- extract(values) {
2925
- return ZodEnum.create(values);
2926
- }
2927
- exclude(values) {
2928
- return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)));
2929
- }
2930
2836
  };
2931
2837
  __name(ZodEnum, "ZodEnum");
2932
2838
  ZodEnum.create = createZodEnum;
@@ -2967,9 +2873,6 @@ ZodNativeEnum.create = (values, params) => {
2967
2873
  });
2968
2874
  };
2969
2875
  var ZodPromise = class extends ZodType {
2970
- unwrap() {
2971
- return this._def.type;
2972
- }
2973
2876
  _parse(input) {
2974
2877
  const { ctx } = this._processInputParams(input);
2975
2878
  if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
@@ -3188,30 +3091,23 @@ var ZodCatch = class extends ZodType {
3188
3091
  const result = this._def.innerType._parse({
3189
3092
  data: ctx.data,
3190
3093
  path: ctx.path,
3191
- parent: {
3192
- ...ctx,
3193
- common: {
3194
- ...ctx.common,
3195
- issues: []
3196
- // don't collect issues from inner type
3197
- }
3198
- }
3094
+ parent: ctx
3199
3095
  });
3200
3096
  if (isAsync(result)) {
3201
3097
  return result.then((result2) => {
3202
3098
  return {
3203
3099
  status: "valid",
3204
- value: result2.status === "valid" ? result2.value : this._def.catchValue()
3100
+ value: result2.status === "valid" ? result2.value : this._def.defaultValue()
3205
3101
  };
3206
3102
  });
3207
3103
  } else {
3208
3104
  return {
3209
3105
  status: "valid",
3210
- value: result.status === "valid" ? result.value : this._def.catchValue()
3106
+ value: result.status === "valid" ? result.value : this._def.defaultValue()
3211
3107
  };
3212
3108
  }
3213
3109
  }
3214
- removeCatch() {
3110
+ removeDefault() {
3215
3111
  return this._def.innerType;
3216
3112
  }
3217
3113
  };
@@ -3220,7 +3116,7 @@ ZodCatch.create = (type, params) => {
3220
3116
  return new ZodCatch({
3221
3117
  innerType: type,
3222
3118
  typeName: ZodFirstPartyTypeKind.ZodCatch,
3223
- catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
3119
+ defaultValue: typeof params.default === "function" ? params.default : () => params.default,
3224
3120
  ...processCreateParams(params)
3225
3121
  });
3226
3122
  };
@@ -3413,10 +3309,7 @@ var oboolean = /* @__PURE__ */ __name(() => booleanType().optional(), "oboolean"
3413
3309
  var coerce = {
3414
3310
  string: (arg) => ZodString.create({ ...arg, coerce: true }),
3415
3311
  number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
3416
- boolean: (arg) => ZodBoolean.create({
3417
- ...arg,
3418
- coerce: true
3419
- }),
3312
+ boolean: (arg) => ZodBoolean.create({ ...arg, coerce: true }),
3420
3313
  bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
3421
3314
  date: (arg) => ZodDate.create({ ...arg, coerce: true })
3422
3315
  };
@@ -3618,8 +3511,8 @@ var ProfileValidator = mod.string().or(
3618
3511
  }).catchall(mod.any())
3619
3512
  );
3620
3513
  var CredentialSubjectValidator = mod.object({ id: mod.string().optional() }).catchall(mod.any());
3621
- var CredentialStatusValidator = mod.object({ type: mod.string(), id: mod.string() });
3622
- var CredentialSchemaValidator = mod.object({ id: mod.string(), type: mod.string() });
3514
+ var CredentialStatusValidator = mod.object({ type: mod.string(), id: mod.string() }).catchall(mod.any());
3515
+ var CredentialSchemaValidator = mod.object({ id: mod.string(), type: mod.string() }).catchall(mod.any());
3623
3516
  var RefreshServiceValidator = mod.object({ id: mod.string(), type: mod.string() }).catchall(mod.any());
3624
3517
  var UnsignedVCValidator = mod.object({
3625
3518
  "@context": ContextValidator,
@@ -3649,7 +3542,7 @@ var VCValidator = UnsignedVCValidator.extend({
3649
3542
  var UnsignedVPValidator = mod.object({
3650
3543
  "@context": ContextValidator,
3651
3544
  id: mod.string().optional(),
3652
- type: mod.string().array().nonempty(),
3545
+ type: mod.string().or(mod.string().array().nonempty()),
3653
3546
  verifiableCredential: VCValidator.or(VCValidator.array()).optional(),
3654
3547
  holder: mod.string().optional()
3655
3548
  }).catchall(mod.any());