@nhtio/validation 0.1.0-master-649f9ed8 → 0.1.0-master-99c163e7

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
@@ -1,4 +1,4 @@
1
- import vitePluginRequire_1761725025331_5846896 from "knex";
1
+ import vitePluginRequire_1761727994034_16514014 from "knex";
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -13726,9 +13726,10 @@ var RootFactory = class RootFactory {
13726
13726
  }
13727
13727
  static generate(root, schema, args$1) {
13728
13728
  (0, import_assert.default)(root, "Must be invoked on a Joi instance.");
13729
- schema.$_root = root;
13730
- if (!schema._definition.args || !args$1.length) return schema;
13731
- return schema._definition.args(schema, ...args$1);
13729
+ const cloned = schema.clone();
13730
+ cloned.$_root = root;
13731
+ if (!cloned._definition.args || !args$1.length) return cloned;
13732
+ return cloned._definition.args(cloned, ...args$1);
13732
13733
  }
13733
13734
  static expandExtension(extension, joi) {
13734
13735
  if (typeof extension.type === "string") return [extension];
@@ -13827,7 +13828,10 @@ var RootFactory = class RootFactory {
13827
13828
  "object"
13828
13829
  ].includes(type), "The", type, "type does not allow arguments");
13829
13830
  let schema = RootFactory.types[type];
13830
- if (options.schemaTypeModifiers?.length) for (const modifier of options.schemaTypeModifiers) schema = modifier(schema, this, args$1);
13831
+ if (options.schemaTypeModifiers?.length) {
13832
+ for (const modifier of options.schemaTypeModifiers) schema = modifier(schema, this, args$1);
13833
+ if (type === "link" && args$1.length && schema.$_root) return schema;
13834
+ }
13831
13835
  return RootFactory.generate(this, schema, args$1);
13832
13836
  };
13833
13837
  let shortcuts = [
@@ -13874,7 +13878,7 @@ const isReference$1 = (obj, root) => {
13874
13878
  return root.isRef(obj);
13875
13879
  };
13876
13880
  const resolveKnex = (connection) => {
13877
- const db = vitePluginRequire_1761725025331_5846896;
13881
+ const db = vitePluginRequire_1761727994034_16514014;
13878
13882
  if ("function" !== typeof connection && !("object" === typeof connection && connection !== null && !Array.isArray(connection))) throw new Error("Invalid Knex connection or QueryClientContract instance");
13879
13883
  if ("function" === typeof connection.getReadClient) return connection.getReadClient();
13880
13884
  if ("function" === typeof connection.ref) return connection;
@@ -111069,7 +111073,7 @@ const dehydrateKnexConnection = (connection) => {
111069
111073
  throw new TypeError("Cannot dehydrate unexpected type of Knex connection");
111070
111074
  };
111071
111075
  const rehydrateKnexConnection = (dehydrated) => {
111072
- const db = vitePluginRequire_1761725025331_5846896;
111076
+ const db = vitePluginRequire_1761727994034_16514014;
111073
111077
  return db(dehydrated._encodedValue);
111074
111078
  };
111075
111079
  const rehydrateFunction = (functionString, namedBindings) => {
@@ -111129,7 +111133,7 @@ const encode = (schema, options = {}) => {
111129
111133
  });
111130
111134
  }
111131
111135
  const json$1 = JSON.stringify({
111132
- version: "0.1.0-master-649f9ed8",
111136
+ version: "0.1.0-master-99c163e7",
111133
111137
  schema: description$1
111134
111138
  }, (key, value) => {
111135
111139
  if (typeof value === "bigint") return value.toString();
@@ -111177,9 +111181,9 @@ const decode = (base64, options = {}) => {
111177
111181
  });
111178
111182
  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");
111179
111183
  const { version: schemaVersion, schema } = description$1;
111180
- if (import_semver.valid("0.1.0-master-649f9ed8")) {
111184
+ if (import_semver.valid("0.1.0-master-99c163e7")) {
111181
111185
  if (!import_semver.valid(import_semver.coerce(schemaVersion))) throw new TypeError(`Invalid schema version: ${schemaVersion}`);
111182
- if (import_semver.gt(import_semver.coerce(schemaVersion), "0.1.0-master-649f9ed8")) throw new TypeError(`Schema version ${schemaVersion} is not compatible with current version 0.1.0-master-649f9ed8`);
111186
+ if (import_semver.gt(import_semver.coerce(schemaVersion), "0.1.0-master-99c163e7")) throw new TypeError(`Schema version ${schemaVersion} is not compatible with current version 0.1.0-master-99c163e7`);
111183
111187
  }
111184
111188
  return validator.build(schema);
111185
111189
  };
@@ -112633,7 +112637,7 @@ init_esm();
112633
112637
  var import_lib = __toESM(require_lib$3());
112634
112638
  var import_lib$1 = __toESM(require_lib$2());
112635
112639
  var import_lib$2 = __toESM(require_lib());
112636
- const version = "0.1.0-master-649f9ed8";
112640
+ const version = "0.1.0-master-99c163e7";
112637
112641
  var ValidationError = import_lib$2.ValidationError;
112638
112642
  var location = import_lib$1.location;
112639
112643
  export { ValidationError, esm_exports as address, decode, encode, import_lib as formula, location, tlds, validator, version };