@nhtio/validation 0.1.0-master-713ab08c → 0.1.0-master-14c60765

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs CHANGED
@@ -17819,16 +17819,19 @@ const coerce$2 = (value, helpers) => {
17819
17819
  const { schema, prefs } = helpers;
17820
17820
  if (prefs.convert) {
17821
17821
  let returnable = converted;
17822
- if (schema._flags.setZone) switch (schema._flags.setZone) {
17823
- case "utc":
17824
- returnable = returnable.toUTC();
17825
- break;
17826
- case "local":
17827
- returnable = returnable.toLocal();
17828
- break;
17829
- default:
17830
- returnable = returnable.setZone(schema._flags.setZone);
17831
- break;
17822
+ if (schema._flags.setZone && Array.isArray(schema._flags.setZone)) {
17823
+ const [zone, opts] = Array.from(schema._flags.setZone);
17824
+ switch (zone) {
17825
+ case "utc":
17826
+ returnable = returnable.toUTC();
17827
+ break;
17828
+ case "local":
17829
+ returnable = returnable.toLocal();
17830
+ break;
17831
+ default:
17832
+ returnable = returnable.setZone(zone, opts);
17833
+ break;
17834
+ }
17832
17835
  }
17833
17836
  if (schema._flags.setLocale) returnable = returnable.setLocale(schema._flags.setLocale);
17834
17837
  if (schema._flags.toFormat) {
@@ -17983,13 +17986,13 @@ const datetime = function(joi) {
17983
17986
  }
17984
17987
  },
17985
17988
  toUTC: { method() {
17986
- return this.$_setFlag("setZone", "utc");
17989
+ return this.$_setFlag("setZone", ["utc"]);
17987
17990
  } },
17988
17991
  toLocal: { method() {
17989
- return this.$_setFlag("setZone", "local");
17992
+ return this.$_setFlag("setZone", ["local"]);
17990
17993
  } },
17991
- setZone: { method(zone) {
17992
- return this.$_setFlag("setZone", zone);
17994
+ setZone: { method(zone, opts) {
17995
+ return this.$_setFlag("setZone", [zone, opts]);
17993
17996
  } },
17994
17997
  toFormat: { method(format$1) {
17995
17998
  return this.$_setFlag("toFormat", format$1, { clone: true });
@@ -17997,17 +18000,17 @@ const datetime = function(joi) {
17997
18000
  toLocalizedString: { method(formatOpts) {
17998
18001
  return this.$_setFlag("toFormat", ["toLocaleString", formatOpts], { clone: true });
17999
18002
  } },
18000
- toISO: { method() {
18001
- return this.$_setFlag("toFormat", ["toISO"], { clone: true });
18003
+ toISO: { method(opts) {
18004
+ return this.$_setFlag("toFormat", opts ? ["toISO", opts] : ["toISO"], { clone: true });
18002
18005
  } },
18003
- toISODate: { method() {
18004
- return this.$_setFlag("toFormat", ["toISODate"], { clone: true });
18006
+ toISODate: { method(opts) {
18007
+ return this.$_setFlag("toFormat", opts ? ["toISODate", opts] : ["toISODate"], { clone: true });
18005
18008
  } },
18006
18009
  toISOWeekDate: { method() {
18007
18010
  return this.$_setFlag("toFormat", ["toISOWeekDate"], { clone: true });
18008
18011
  } },
18009
- toISOTime: { method() {
18010
- return this.$_setFlag("toFormat", ["toISOTime"], { clone: true });
18012
+ toISOTime: { method(opts) {
18013
+ return this.$_setFlag("toFormat", opts ? ["toISOTime", opts] : ["toISOTime"], { clone: true });
18011
18014
  } },
18012
18015
  toRFC2822: { method() {
18013
18016
  return this.$_setFlag("toFormat", ["toRFC2822"], { clone: true });
@@ -18018,11 +18021,11 @@ const datetime = function(joi) {
18018
18021
  toSQLDate: { method() {
18019
18022
  return this.$_setFlag("toFormat", ["toSQLDate"], { clone: true });
18020
18023
  } },
18021
- toSQLTime: { method() {
18022
- return this.$_setFlag("toFormat", ["toSQLTime"], { clone: true });
18024
+ toSQLTime: { method(opts) {
18025
+ return this.$_setFlag("toFormat", opts ? ["toSQLTime", opts] : ["toSQLTime"], { clone: true });
18023
18026
  } },
18024
- toSQL: { method() {
18025
- return this.$_setFlag("toFormat", ["toSQL"], { clone: true });
18027
+ toSQL: { method(opts) {
18028
+ return this.$_setFlag("toFormat", opts ? ["toSQL", opts] : ["toSQL"], { clone: true });
18026
18029
  } },
18027
18030
  toMillis: { method() {
18028
18031
  return this.$_setFlag("toFormat", ["toMillis"], { clone: true });
@@ -18039,14 +18042,15 @@ const datetime = function(joi) {
18039
18042
  toBSON: { method() {
18040
18043
  return this.$_setFlag("toFormat", ["toBSON"], { clone: true });
18041
18044
  } },
18042
- toObject: { method() {
18043
- return this.$_setFlag("toFormat", ["toObject", { includeConfig: false }], { clone: true });
18045
+ toObject: { method(opts) {
18046
+ const config = opts?.includeConfig !== void 0 ? { includeConfig: opts.includeConfig } : { includeConfig: false };
18047
+ return this.$_setFlag("toFormat", ["toObject", config], { clone: true });
18044
18048
  } },
18045
18049
  toJSDate: { method() {
18046
18050
  return this.$_setFlag("toFormat", ["toJSDate"], { clone: true });
18047
18051
  } },
18048
- toRelative: { method() {
18049
- return this.$_setFlag("toFormat", ["toRelative"], { clone: true });
18052
+ toRelative: { method(opts) {
18053
+ return this.$_setFlag("toFormat", opts ? ["toRelative", opts] : ["toRelative"], { clone: true });
18050
18054
  } },
18051
18055
  setLocale: { method(locale$1) {
18052
18056
  return this.$_setFlag("setLocale", locale$1);
@@ -23271,7 +23275,7 @@ const encode = (schema) => {
23271
23275
  });
23272
23276
  }
23273
23277
  const json = JSON.stringify({
23274
- version: "0.1.0-master-713ab08c",
23278
+ version: "0.1.0-master-14c60765",
23275
23279
  schema: description$1
23276
23280
  });
23277
23281
  return utoa(json);
@@ -23281,9 +23285,9 @@ const decode = (base64) => {
23281
23285
  const description$1 = JSON.parse(json);
23282
23286
  if (!isPlainObject(description$1) || !("version" in description$1) || !("schema" in description$1) || typeof description$1.version !== "string" || !isPlainObject(description$1.schema)) throw new TypeError("Not a valid encoded schema");
23283
23287
  const { version: schemaVersion, schema } = description$1;
23284
- if (import_semver.valid("0.1.0-master-713ab08c")) {
23288
+ if (import_semver.valid("0.1.0-master-14c60765")) {
23285
23289
  if (!import_semver.valid(import_semver.coerce(schemaVersion))) throw new TypeError(`Invalid schema version: ${schemaVersion}`);
23286
- if (import_semver.gt(import_semver.coerce(schemaVersion), "0.1.0-master-713ab08c")) throw new TypeError(`Schema version ${schemaVersion} is not compatible with current version 0.1.0-master-713ab08c`);
23290
+ if (import_semver.gt(import_semver.coerce(schemaVersion), "0.1.0-master-14c60765")) throw new TypeError(`Schema version ${schemaVersion} is not compatible with current version 0.1.0-master-14c60765`);
23287
23291
  }
23288
23292
  return validator.build(schema);
23289
23293
  };
@@ -26550,7 +26554,7 @@ const tlds = new Set(TLDS.map((tld) => tld.toLowerCase()));
26550
26554
  var import_lib = __toESM(require_lib$1());
26551
26555
  var import_lib$1 = __toESM(require_lib());
26552
26556
  var import_lib$2 = __toESM(require_lib$3());
26553
- const version = "0.1.0-master-713ab08c";
26557
+ const version = "0.1.0-master-14c60765";
26554
26558
  Object.defineProperty(exports, "ValidationError", {
26555
26559
  enumerable: true,
26556
26560
  get: function() {