@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.mjs CHANGED
@@ -17823,16 +17823,19 @@ const coerce$2 = (value, helpers) => {
17823
17823
  const { schema, prefs } = helpers;
17824
17824
  if (prefs.convert) {
17825
17825
  let returnable = converted;
17826
- if (schema._flags.setZone) switch (schema._flags.setZone) {
17827
- case "utc":
17828
- returnable = returnable.toUTC();
17829
- break;
17830
- case "local":
17831
- returnable = returnable.toLocal();
17832
- break;
17833
- default:
17834
- returnable = returnable.setZone(schema._flags.setZone);
17835
- break;
17826
+ if (schema._flags.setZone && Array.isArray(schema._flags.setZone)) {
17827
+ const [zone, opts] = Array.from(schema._flags.setZone);
17828
+ switch (zone) {
17829
+ case "utc":
17830
+ returnable = returnable.toUTC();
17831
+ break;
17832
+ case "local":
17833
+ returnable = returnable.toLocal();
17834
+ break;
17835
+ default:
17836
+ returnable = returnable.setZone(zone, opts);
17837
+ break;
17838
+ }
17836
17839
  }
17837
17840
  if (schema._flags.setLocale) returnable = returnable.setLocale(schema._flags.setLocale);
17838
17841
  if (schema._flags.toFormat) {
@@ -17987,13 +17990,13 @@ const datetime = function(joi) {
17987
17990
  }
17988
17991
  },
17989
17992
  toUTC: { method() {
17990
- return this.$_setFlag("setZone", "utc");
17993
+ return this.$_setFlag("setZone", ["utc"]);
17991
17994
  } },
17992
17995
  toLocal: { method() {
17993
- return this.$_setFlag("setZone", "local");
17996
+ return this.$_setFlag("setZone", ["local"]);
17994
17997
  } },
17995
- setZone: { method(zone) {
17996
- return this.$_setFlag("setZone", zone);
17998
+ setZone: { method(zone, opts) {
17999
+ return this.$_setFlag("setZone", [zone, opts]);
17997
18000
  } },
17998
18001
  toFormat: { method(format$1) {
17999
18002
  return this.$_setFlag("toFormat", format$1, { clone: true });
@@ -18001,17 +18004,17 @@ const datetime = function(joi) {
18001
18004
  toLocalizedString: { method(formatOpts) {
18002
18005
  return this.$_setFlag("toFormat", ["toLocaleString", formatOpts], { clone: true });
18003
18006
  } },
18004
- toISO: { method() {
18005
- return this.$_setFlag("toFormat", ["toISO"], { clone: true });
18007
+ toISO: { method(opts) {
18008
+ return this.$_setFlag("toFormat", opts ? ["toISO", opts] : ["toISO"], { clone: true });
18006
18009
  } },
18007
- toISODate: { method() {
18008
- return this.$_setFlag("toFormat", ["toISODate"], { clone: true });
18010
+ toISODate: { method(opts) {
18011
+ return this.$_setFlag("toFormat", opts ? ["toISODate", opts] : ["toISODate"], { clone: true });
18009
18012
  } },
18010
18013
  toISOWeekDate: { method() {
18011
18014
  return this.$_setFlag("toFormat", ["toISOWeekDate"], { clone: true });
18012
18015
  } },
18013
- toISOTime: { method() {
18014
- return this.$_setFlag("toFormat", ["toISOTime"], { clone: true });
18016
+ toISOTime: { method(opts) {
18017
+ return this.$_setFlag("toFormat", opts ? ["toISOTime", opts] : ["toISOTime"], { clone: true });
18015
18018
  } },
18016
18019
  toRFC2822: { method() {
18017
18020
  return this.$_setFlag("toFormat", ["toRFC2822"], { clone: true });
@@ -18022,11 +18025,11 @@ const datetime = function(joi) {
18022
18025
  toSQLDate: { method() {
18023
18026
  return this.$_setFlag("toFormat", ["toSQLDate"], { clone: true });
18024
18027
  } },
18025
- toSQLTime: { method() {
18026
- return this.$_setFlag("toFormat", ["toSQLTime"], { clone: true });
18028
+ toSQLTime: { method(opts) {
18029
+ return this.$_setFlag("toFormat", opts ? ["toSQLTime", opts] : ["toSQLTime"], { clone: true });
18027
18030
  } },
18028
- toSQL: { method() {
18029
- return this.$_setFlag("toFormat", ["toSQL"], { clone: true });
18031
+ toSQL: { method(opts) {
18032
+ return this.$_setFlag("toFormat", opts ? ["toSQL", opts] : ["toSQL"], { clone: true });
18030
18033
  } },
18031
18034
  toMillis: { method() {
18032
18035
  return this.$_setFlag("toFormat", ["toMillis"], { clone: true });
@@ -18043,14 +18046,15 @@ const datetime = function(joi) {
18043
18046
  toBSON: { method() {
18044
18047
  return this.$_setFlag("toFormat", ["toBSON"], { clone: true });
18045
18048
  } },
18046
- toObject: { method() {
18047
- return this.$_setFlag("toFormat", ["toObject", { includeConfig: false }], { clone: true });
18049
+ toObject: { method(opts) {
18050
+ const config = opts?.includeConfig !== void 0 ? { includeConfig: opts.includeConfig } : { includeConfig: false };
18051
+ return this.$_setFlag("toFormat", ["toObject", config], { clone: true });
18048
18052
  } },
18049
18053
  toJSDate: { method() {
18050
18054
  return this.$_setFlag("toFormat", ["toJSDate"], { clone: true });
18051
18055
  } },
18052
- toRelative: { method() {
18053
- return this.$_setFlag("toFormat", ["toRelative"], { clone: true });
18056
+ toRelative: { method(opts) {
18057
+ return this.$_setFlag("toFormat", opts ? ["toRelative", opts] : ["toRelative"], { clone: true });
18054
18058
  } },
18055
18059
  setLocale: { method(locale$1) {
18056
18060
  return this.$_setFlag("setLocale", locale$1);
@@ -23275,7 +23279,7 @@ const encode = (schema) => {
23275
23279
  });
23276
23280
  }
23277
23281
  const json = JSON.stringify({
23278
- version: "0.1.0-master-713ab08c",
23282
+ version: "0.1.0-master-14c60765",
23279
23283
  schema: description$1
23280
23284
  });
23281
23285
  return utoa(json);
@@ -23285,9 +23289,9 @@ const decode = (base64) => {
23285
23289
  const description$1 = JSON.parse(json);
23286
23290
  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");
23287
23291
  const { version: schemaVersion, schema } = description$1;
23288
- if (import_semver.valid("0.1.0-master-713ab08c")) {
23292
+ if (import_semver.valid("0.1.0-master-14c60765")) {
23289
23293
  if (!import_semver.valid(import_semver.coerce(schemaVersion))) throw new TypeError(`Invalid schema version: ${schemaVersion}`);
23290
- 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`);
23294
+ 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`);
23291
23295
  }
23292
23296
  return validator.build(schema);
23293
23297
  };
@@ -26554,7 +26558,7 @@ const tlds = new Set(TLDS.map((tld) => tld.toLowerCase()));
26554
26558
  var import_lib = __toESM(require_lib$1());
26555
26559
  var import_lib$1 = __toESM(require_lib());
26556
26560
  var import_lib$2 = __toESM(require_lib$3());
26557
- const version = "0.1.0-master-713ab08c";
26561
+ const version = "0.1.0-master-14c60765";
26558
26562
  var ValidationError = import_lib$2.ValidationError;
26559
26563
  var location = import_lib$1.location;
26560
26564
  export { ValidationError, esm_exports as address, decode, encode, import_lib as formula, location, tlds, validator, version };