@validup/validator-js 0.2.3 → 2.0.0

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/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2024-2026 Peter Placzek
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -14,7 +14,7 @@ npm install @validup/validator-js validator validup --save
14
14
 
15
15
  | Peer dependency | Supported versions |
16
16
  |-----------------|--------------------|
17
- | `validup` | `^1.0.0` |
17
+ | `validup` | `^2.0.0` |
18
18
  | `validator` | `^13.0.0` |
19
19
 
20
20
  ## Quick Start
@@ -130,7 +130,7 @@ container.mount('phone', createValidator(
130
130
  - `fn` — any function with the signature `(value: string, ...args: any[]) => boolean`. validator.js's predicates all fit.
131
131
  - `code` — the validup `IssueCode` (or any project-specific string) attached to the resulting `IssueItem`. `IssueItem.code` widens to `IssueCode | (string & {})`, so ad-hoc strings are accepted.
132
132
  - `message` — fallback English message on `IssueItem.message`. Always set this — i18n catalogs key off `code`, but consumers without an i18n setup see the message directly.
133
- - `data` — structured payload surfaced on `IssueItem.data`. Optional; templates that reference placeholders (`{{locale}}`, `{{min}}`, …) resolve against this.
133
+ - `data` — structured payload surfaced on `IssueItem.data`. Optional; templates that reference placeholders (`{locale}`, `{min}`, …) resolve against this.
134
134
  - `sideEffect` — optional flag for the rare case where the wrapped predicate captures external state. Default is cache-eligible.
135
135
 
136
136
  The wrap stringifies `ctx.value` via `toValidatorString` before calling `fn` — same as the factories — so consumers can mount on `number`-shaped fields without manual coercion.
@@ -164,4 +164,6 @@ express-validator wraps validator.js in a chain API meant for Express middleware
164
164
 
165
165
  ## License
166
166
 
167
- Apache-2.0 © Peter Placzek
167
+ Made with 💚
168
+
169
+ Published under [Apache 2.0 License](./LICENSE).
package/dist/index.d.mts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { ValidatorDescriptor } from "validup";
2
-
3
2
  //#region src/module.d.ts
4
3
  /**
5
4
  * Shape of a validator.js boolean predicate. The first argument is always
@@ -234,8 +233,9 @@ declare function isInt<C = unknown>(options?: BaseFactoryOptions & validator.IsI
234
233
  /**
235
234
  * Factory: validator.js `isFloat`. Like {@link isInt} but for decimal
236
235
  * numbers — type failure emits `IssueCode.DECIMAL`; range bounds emit
237
- * `MIN_VALUE` / `MAX_VALUE`. `lt` / `gt` map to `MIN_VALUE` / `MAX_VALUE`
238
- * the same way `isInt` does.
236
+ * `MIN_VALUE` / `MAX_VALUE`. `gt` / `lt` map to `MIN_VALUE` / `MAX_VALUE`
237
+ * the same way `isInt` does — `gt` emits `MIN_VALUE` with `data.min` set to
238
+ * `options.gt`, `lt` emits `MAX_VALUE` with `data.max` set to `options.lt`.
239
239
  *
240
240
  * **Locale caveat.** validator.js's locale-aware float parsing (e.g.
241
241
  * `'123,45'` under `locale: 'de-DE'`) is opaque to the factory — we use
package/dist/index.mjs CHANGED
@@ -1,53 +1,7 @@
1
+ import { getPathValue } from "pathtrace";
1
2
  import validator from "validator";
2
- import { IssueCode, createValidupError, defineValidator } from "validup";
3
- //#region ../../node_modules/pathtrace/dist/index.mjs
4
- const UNSAFE_KEYS = new Set([
5
- "__proto__",
6
- "constructor",
7
- "prototype"
8
- ]);
9
- function isUnsafeKey(key) {
10
- return UNSAFE_KEYS.has(key);
11
- }
12
- const BRACKET_NUMBER_REGEX = /(?<!\\)\[(\d+)]$/;
13
- /**
14
- * Convert string to property path array.
15
- *
16
- * @see https://github.com/lodash/lodash/blob/main/src/.internal/stringToPath.ts
17
- * @see https://github.com/chaijs/pathval
18
- *
19
- * @param segment
20
- */
21
- function pathToArray(segment) {
22
- if (typeof segment === "number") return [segment];
23
- if (typeof segment === "symbol") return [];
24
- const parts = segment.replace(/([^\\])\[/g, "$1.[").match(/(\\\.|[^.]+?)+/g);
25
- if (!parts) return [];
26
- const result = [];
27
- for (const part of parts) {
28
- if (isUnsafeKey(part)) continue;
29
- const regex = BRACKET_NUMBER_REGEX.exec(part);
30
- if (regex) result.push(Number(regex[1]));
31
- else result.push(part.replace(/\\([.[\]])/g, "$1"));
32
- }
33
- return result;
34
- }
35
- function getPathValue(data, path) {
36
- const parts = Array.isArray(path) ? path : pathToArray(path);
37
- let res;
38
- let temp = data;
39
- let index = 0;
40
- while (index < parts.length) {
41
- if (temp === null || typeof temp === "undefined") break;
42
- if (isUnsafeKey(parts[index])) break;
43
- if (parts[index] in Object(temp)) temp = temp[parts[index]];
44
- else break;
45
- if (index === parts.length - 1) res = temp;
46
- index++;
47
- }
48
- return res;
49
- }
50
- //#endregion
3
+ import { IssueCode } from "@ebec/core";
4
+ import { createValidupError, defineValidator } from "validup";
51
5
  //#region src/module.ts
52
6
  /**
53
7
  * Build a string representation suitable for validator.js. validator.js
@@ -378,6 +332,35 @@ function isDecimal(options = {}) {
378
332
  } });
379
333
  }
380
334
  /**
335
+ * Shared range ladder for {@link isInt} / {@link isFloat}. Throws the first
336
+ * violated bound and returns `void` when every bound holds.
337
+ *
338
+ * The bounds are checked first-match-wins in `min`, `gt`, `max`, `lt` order,
339
+ * and the emitted codes are deliberately coarser than the option names:
340
+ *
341
+ * - `min` (inclusive) and `gt` (exclusive) both emit `IssueCode.MIN_VALUE`.
342
+ * For `gt`, `data.min` carries `options.gt` — i18n templates can quote the
343
+ * boundary, and the precise inclusive/exclusive wording comes from
344
+ * `message`. Same treatment for `lt` → `IssueCode.MAX_VALUE` with
345
+ * `data.max` carrying `options.lt`. This mapping is an i18n-facing
346
+ * contract; don't split it without a matching catalog change.
347
+ *
348
+ * Type-failure codes (`INTEGER` for `isInt`, `DECIMAL` for `isFloat`) sit
349
+ * OUTSIDE this ladder and stay with their respective factories — which is
350
+ * why the helper needs no code-selecting parameter.
351
+ *
352
+ * `NaN` handling also stays with the caller: `isFloat` skips the ladder for
353
+ * localized input that `Number()` can't parse, while `isInt` reaches it only
354
+ * after `validator.isInt` returned true.
355
+ */
356
+ function assertNumericRange(received, numeric, options) {
357
+ const { min, max, lt, gt } = options;
358
+ if (typeof min === "number" && numeric < min) throw createValidupError(received, IssueCode.MIN_VALUE, options.message ?? `The value must be greater than or equal to ${min}`, { min });
359
+ if (typeof gt === "number" && numeric <= gt) throw createValidupError(received, IssueCode.MIN_VALUE, options.message ?? `The value must be greater than ${gt}`, { min: gt });
360
+ if (typeof max === "number" && numeric > max) throw createValidupError(received, IssueCode.MAX_VALUE, options.message ?? `The value must be less than or equal to ${max}`, { max });
361
+ if (typeof lt === "number" && numeric >= lt) throw createValidupError(received, IssueCode.MAX_VALUE, options.message ?? `The value must be less than ${lt}`, { max: lt });
362
+ }
363
+ /**
381
364
  * Factory: validator.js `isInt`. Resolves the right vocabulary code
382
365
  * based on what failed:
383
366
  *
@@ -393,12 +376,7 @@ function isInt(options = {}) {
393
376
  return defineValidator({ run: (ctx) => {
394
377
  const s = toValidatorString(ctx.value);
395
378
  if (!validator.isInt(s, { allow_leading_zeroes: options.allow_leading_zeroes })) throw createValidupError(ctx.value, IssueCode.INTEGER, options.message ?? "The value must be an integer");
396
- const numeric = Number(s);
397
- const { min, max, lt, gt } = options;
398
- if (typeof min === "number" && numeric < min) throw createValidupError(ctx.value, IssueCode.MIN_VALUE, options.message ?? `The value must be greater than or equal to ${min}`, { min });
399
- if (typeof gt === "number" && numeric <= gt) throw createValidupError(ctx.value, IssueCode.MIN_VALUE, options.message ?? `The value must be greater than ${gt}`, { min: gt });
400
- if (typeof max === "number" && numeric > max) throw createValidupError(ctx.value, IssueCode.MAX_VALUE, options.message ?? `The value must be less than or equal to ${max}`, { max });
401
- if (typeof lt === "number" && numeric >= lt) throw createValidupError(ctx.value, IssueCode.MAX_VALUE, options.message ?? `The value must be less than ${lt}`, { max: lt });
379
+ assertNumericRange(ctx.value, Number(s), options);
402
380
  if (!validator.isInt(s, options)) throw createValidupError(ctx.value, IssueCode.INTEGER, options.message ?? "The value must be an integer");
403
381
  return ctx.value;
404
382
  } });
@@ -406,8 +384,9 @@ function isInt(options = {}) {
406
384
  /**
407
385
  * Factory: validator.js `isFloat`. Like {@link isInt} but for decimal
408
386
  * numbers — type failure emits `IssueCode.DECIMAL`; range bounds emit
409
- * `MIN_VALUE` / `MAX_VALUE`. `lt` / `gt` map to `MIN_VALUE` / `MAX_VALUE`
410
- * the same way `isInt` does.
387
+ * `MIN_VALUE` / `MAX_VALUE`. `gt` / `lt` map to `MIN_VALUE` / `MAX_VALUE`
388
+ * the same way `isInt` does — `gt` emits `MIN_VALUE` with `data.min` set to
389
+ * `options.gt`, `lt` emits `MAX_VALUE` with `data.max` set to `options.lt`.
411
390
  *
412
391
  * **Locale caveat.** validator.js's locale-aware float parsing (e.g.
413
392
  * `'123,45'` under `locale: 'de-DE'`) is opaque to the factory — we use
@@ -424,13 +403,7 @@ function isFloat(options = {}) {
424
403
  const s = toValidatorString(ctx.value);
425
404
  if (!validator.isFloat(s, { locale: options.locale })) throw createValidupError(ctx.value, IssueCode.DECIMAL, options.message ?? "The value must be a decimal number");
426
405
  const numeric = Number(s);
427
- const { min, max, lt, gt } = options;
428
- if (!Number.isNaN(numeric)) {
429
- if (typeof min === "number" && numeric < min) throw createValidupError(ctx.value, IssueCode.MIN_VALUE, options.message ?? `The value must be greater than or equal to ${min}`, { min });
430
- if (typeof gt === "number" && numeric <= gt) throw createValidupError(ctx.value, IssueCode.MIN_VALUE, options.message ?? `The value must be greater than ${gt}`, { min: gt });
431
- if (typeof max === "number" && numeric > max) throw createValidupError(ctx.value, IssueCode.MAX_VALUE, options.message ?? `The value must be less than or equal to ${max}`, { max });
432
- if (typeof lt === "number" && numeric >= lt) throw createValidupError(ctx.value, IssueCode.MAX_VALUE, options.message ?? `The value must be less than ${lt}`, { max: lt });
433
- }
406
+ if (!Number.isNaN(numeric)) assertNumericRange(ctx.value, numeric, options);
434
407
  if (!validator.isFloat(s, options)) throw createValidupError(ctx.value, IssueCode.DECIMAL, options.message ?? "The value must be a decimal number");
435
408
  return ctx.value;
436
409
  } });
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../node_modules/pathtrace/dist/index.mjs","../src/module.ts","../src/factories/comparison.ts","../src/factories/length.ts","../src/factories/string-format.ts","../src/factories/type-assertions.ts"],"sourcesContent":["//#region src/helpers/array-to-path.ts\n/**\n* @see https://github.com/express-validator/express-validator/blob/bec1dcbaa29002dcd21093ec84818c4671063b5d/src/field-selection.ts#L214\n* @param parts\n*/\nfunction arrayToPath(parts) {\n\tlet output = \"\";\n\tfor (let part of parts) {\n\t\tlet current = \"\";\n\t\tif (typeof part === \"string\") {\n\t\t\tpart = part.replace(/^\\[(\\d+)]$/g, \"\\\\[$1]\");\n\t\t\tpart = part.replace(/\\./g, \"\\\\.\");\n\t\t\tif (/^\\d+$/.test(part)) current = `[${part}]`;\n\t\t\telse if (output) current = `.${part}`;\n\t\t\telse current = part;\n\t\t} else if (typeof part === \"number\") current = `[${part}]`;\n\t\toutput += current;\n\t}\n\treturn output;\n}\n//#endregion\n//#region src/utils/is-object.ts\nfunction isObject(input) {\n\treturn !!input && typeof input === \"object\" && !Array.isArray(input);\n}\n//#endregion\n//#region src/utils/is-unsafe-key.ts\nconst UNSAFE_KEYS = new Set([\n\t\"__proto__\",\n\t\"constructor\",\n\t\"prototype\"\n]);\nfunction isUnsafeKey(key) {\n\treturn UNSAFE_KEYS.has(key);\n}\n//#endregion\n//#region src/helpers/path-to-array.ts\nconst BRACKET_NUMBER_REGEX = /(?<!\\\\)\\[(\\d+)]$/;\n/**\n* Convert string to property path array.\n*\n* @see https://github.com/lodash/lodash/blob/main/src/.internal/stringToPath.ts\n* @see https://github.com/chaijs/pathval\n*\n* @param segment\n*/\nfunction pathToArray(segment) {\n\tif (typeof segment === \"number\") return [segment];\n\tif (typeof segment === \"symbol\") return [];\n\tconst parts = segment.replace(/([^\\\\])\\[/g, \"$1.[\").match(/(\\\\\\.|[^.]+?)+/g);\n\tif (!parts) return [];\n\tconst result = [];\n\tfor (const part of parts) {\n\t\tif (isUnsafeKey(part)) continue;\n\t\tconst regex = BRACKET_NUMBER_REGEX.exec(part);\n\t\tif (regex) result.push(Number(regex[1]));\n\t\telse result.push(part.replace(/\\\\([.[\\]])/g, \"$1\"));\n\t}\n\treturn result;\n}\n//#endregion\n//#region src/path-expand/constants.ts\nlet Character = /* @__PURE__ */ function(Character) {\n\tCharacter[\"WILDCARD\"] = \"*\";\n\tCharacter[\"GLOBSTAR\"] = \"**\";\n\treturn Character;\n}({});\n//#endregion\n//#region src/path-expand/module.ts\nfunction expandPathVerboseInternal(data, path, currPath = [], currMatches = []) {\n\tconst segments = Array.isArray(path) ? path : pathToArray(path);\n\tif (!segments.length) return [{\n\t\tvalue: arrayToPath(currPath),\n\t\tmatches: currMatches\n\t}];\n\tconst key = segments[0];\n\tif (typeof key === \"symbol\") return [];\n\tconst rest = segments.slice(1);\n\tif (typeof data !== \"undefined\" && data !== null && !isObject(data) && !Array.isArray(data)) {\n\t\tif (key === Character.GLOBSTAR) {\n\t\t\tif (!rest.length) return [{\n\t\t\t\tvalue: arrayToPath(currPath),\n\t\t\t\tmatches: currMatches\n\t\t\t}];\n\t\t\treturn [];\n\t\t}\n\t\tif (key === Character.WILDCARD) return [];\n\t\treturn [{\n\t\t\tvalue: arrayToPath([...currPath, ...segments]),\n\t\t\tmatches: currMatches\n\t\t}];\n\t}\n\tdata = data || {};\n\tif (key === Character.WILDCARD) return Object.keys(data).flatMap((key) => expandPathVerboseInternal(data[key], arrayToPath(rest), currPath.concat(key), currMatches.concat(key)));\n\tif (key === Character.GLOBSTAR) return Object.keys(data).flatMap((key) => {\n\t\tconst nextPath = currPath.concat(key);\n\t\tconst value = data[key];\n\t\tconst children = expandPathVerboseInternal(value, arrayToPath(segments), nextPath, [key]).concat(rest[0] === key ? expandPathVerboseInternal(value, arrayToPath(rest.slice(1)), nextPath, []) : []);\n\t\tconst pathMatches = [];\n\t\tconst output = [];\n\t\tfor (const child of children) {\n\t\t\t/* istanbul ignore next */\n\t\t\tif (pathMatches.includes(child.value)) continue;\n\t\t\tpathMatches.push(child.value);\n\t\t\toutput.push({\n\t\t\t\tvalue: child.value,\n\t\t\t\tmatches: child.matches.length > 0 ? [...currMatches, child.matches.flat()] : currMatches\n\t\t\t});\n\t\t}\n\t\treturn output;\n\t});\n\treturn expandPathVerboseInternal(data[key], rest, currPath.concat(key), currMatches);\n}\n/**\n* Verbose expand wildcard and glob patterns.\n* Track wildcard/glob pattern matches.\n*\n* @param data\n* @param path\n*/\nfunction expandPathVerbose(data, path) {\n\treturn expandPathVerboseInternal(data, path);\n}\n/**\n* Expand wildcard and glob patterns to paths.\n*\n* @param data\n* @param path\n*/\nfunction expandPath(data, path) {\n\treturn expandPathVerbose(data, path).map((el) => el.value);\n}\n//#endregion\n//#region src/path-value/get.ts\nfunction getPathValue(data, path) {\n\tconst parts = Array.isArray(path) ? path : pathToArray(path);\n\tlet res;\n\tlet temp = data;\n\tlet index = 0;\n\twhile (index < parts.length) {\n\t\tif (temp === null || typeof temp === \"undefined\") break;\n\t\tif (isUnsafeKey(parts[index])) break;\n\t\tif (parts[index] in Object(temp)) temp = temp[parts[index]];\n\t\telse break;\n\t\tif (index === parts.length - 1) res = temp;\n\t\tindex++;\n\t}\n\treturn res;\n}\n//#endregion\n//#region src/path-value/set.ts\nconst NUMBER_REGEX = /^\\d+$/;\nfunction setPathValue(data, path, value) {\n\tconst parts = Array.isArray(path) ? path : pathToArray(path);\n\tlet temp = data;\n\tlet index = 0;\n\twhile (index < parts.length) {\n\t\t/* istanbul ignore next */\n\t\tif (!Array.isArray(temp) && !isObject(temp)) break;\n\t\tconst key = parts[index];\n\t\tif (isUnsafeKey(key)) break;\n\t\tif (typeof temp[key] === \"undefined\") if (NUMBER_REGEX.test(key)) temp[key] = [];\n\t\telse temp[key] = {};\n\t\tif (index === parts.length - 1) {\n\t\t\ttemp[key] = value;\n\t\t\tbreak;\n\t\t}\n\t\tindex++;\n\t\ttemp = temp[key];\n\t}\n\treturn data;\n}\n//#endregion\n//#region src/path-info/module.ts\nvar PathInfo = class PathInfo {\n\tdata;\n\tpathParts;\n\t_value;\n\t_parent;\n\t_exists;\n\tconstructor(data, path) {\n\t\tthis.data = data;\n\t\tif (Array.isArray(path)) this.pathParts = path.filter((p) => !isUnsafeKey(p));\n\t\telse this.pathParts = pathToArray(path);\n\t}\n\tget value() {\n\t\tif (typeof this._value !== \"undefined\") return this._value;\n\t\tif (this.pathParts.length > 0) this._value = getPathValue(this.data, this.pathParts);\n\t\telse this._value = this.data;\n\t\treturn this._value;\n\t}\n\tget name() {\n\t\tif (this.pathParts.length > 0) return this.pathParts[this.pathParts.length - 1];\n\t\treturn null;\n\t}\n\tget parent() {\n\t\tif (typeof this._parent !== \"undefined\") return this._parent;\n\t\tif (this.pathParts.length === 0) {\n\t\t\tthis._parent = null;\n\t\t\treturn this._parent;\n\t\t}\n\t\tif (this.pathParts.length > 1) this._parent = new PathInfo(this.data, this.pathParts.slice(0, this.pathParts.length - 1));\n\t\telse this._parent = new PathInfo(this.data, []);\n\t\treturn this._parent;\n\t}\n\tget exists() {\n\t\tif (typeof this._exists !== \"undefined\") return this._exists;\n\t\tif (!this.name || !this.parent) {\n\t\t\tthis._exists = true;\n\t\t\treturn this._exists;\n\t\t}\n\t\tif (this.parent.value !== null && typeof this.parent.value !== \"undefined\") this._exists = this.name in Object(this.parent.value);\n\t\telse this._exists = false;\n\t\treturn this._exists;\n\t}\n};\n//#endregion\n//#region src/path-info/helper.ts\nfunction getPathInfo(data, path) {\n\treturn new PathInfo(data, path);\n}\n//#endregion\n//#region src/remove.ts\nfunction removePath(data, path) {\n\tconst parts = Array.isArray(path) ? path : pathToArray(path);\n\tlet temp = data;\n\tlet index = 0;\n\twhile (index < parts.length) {\n\t\t/* istanbul ignore next */\n\t\tif (!Array.isArray(temp) && !isObject(temp)) break;\n\t\tconst key = parts[index];\n\t\tif (isUnsafeKey(key)) break;\n\t\tif (!Object.prototype.hasOwnProperty.call(temp, key)) break;\n\t\tif (index === parts.length - 1) {\n\t\t\tif (Array.isArray(temp)) {\n\t\t\t\tconst tempKey = Number(key);\n\t\t\t\tif (!Number.isNaN(tempKey)) {\n\t\t\t\t\ttemp.splice(tempKey, 1);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tdelete temp[key];\n\t\t\tbreak;\n\t\t}\n\t\tindex++;\n\t\ttemp = temp[key];\n\t}\n}\n//#endregion\nexport { BRACKET_NUMBER_REGEX, PathInfo, arrayToPath, expandPath, expandPathVerbose, getPathInfo, getPathValue, pathToArray, removePath, setPathValue };\n\n//# sourceMappingURL=index.mjs.map","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport {\n IssueCode,\n createValidupError,\n defineValidator,\n} from 'validup';\nimport type { ValidatorDescriptor } from 'validup';\n\n/**\n * Shape of a validator.js boolean predicate. The first argument is always\n * the string to test; subsequent arguments are validator-specific options.\n */\nexport type ValidatorJsFn = (value: string, ...args: any[]) => boolean;\n\n/**\n * Options accepted by every factory (and {@link createValidator}). The\n * factory layers vocabulary-specific fields on top of this shape.\n */\nexport interface BaseFactoryOptions {\n /**\n * Override the default English message produced by the factory. The\n * default tracks `@ilingo/validup`'s `en` catalog so the same wording\n * surfaces with and without i18n.\n */\n message?: string;\n}\n\n/**\n * Options accepted by {@link createValidator}. The vocabulary code is\n * required — that's the entire point of the generic wrap; if you just\n * want `VALUE_INVALID`, hand-roll a `Validator` instead.\n */\nexport interface CreateValidatorOptions extends BaseFactoryOptions {\n /**\n * `IssueCode` value (or any project-specific string) attached to the\n * `IssueItem` on failure.\n */\n code: string;\n /**\n * Optional structured payload surfaced on `IssueItem.data` — what\n * the i18n template's `{{placeholders}}` resolve against.\n */\n data?: Record<string, unknown>;\n}\n\n/**\n * Build a string representation suitable for validator.js. validator.js\n * functions expect strings; for numbers and booleans we use `String(...)`\n * so consumers can mount `isInt()` on a `number`-shaped field without\n * pre-stringifying.\n */\nexport function toValidatorString(value: unknown): string {\n if (typeof value === 'string') return value;\n if (typeof value === 'number' || typeof value === 'boolean') return String(value);\n if (value === null || value === undefined) return '';\n return String(value);\n}\n\n/**\n * Generic wrap for any validator.js function we don't ship a pre-baked\n * factory for. The wrapped validator stringifies `ctx.value`, calls the\n * validator.js predicate, and throws a `ValidupError` carrying the\n * supplied `code` (+ optional `data`) on failure.\n *\n * @example\n * import validator from 'validator';\n * import { createValidator } from '@validup/validator-js';\n *\n * container.mount('card', createValidator(validator.isCreditCard, {\n * code: 'credit_card',\n * message: 'Invalid credit card number',\n * }));\n *\n * For the common cases — `email()`, `isLength()`, `isInt()` etc. — reach\n * for the pre-baked factories instead; they bake the right vocabulary\n * code and `data` in for you.\n *\n * The returned descriptor participates in the validup result cache by\n * default — validator.js's `ValidatorJsFn` signature is synchronous\n * and only inspects the stringified value, so the outcome is a pure\n * function of `(ctx.value, ctx.context, ctx.group)`. If the wrapped\n * predicate captures external state and the caller knowingly opts\n * into that, pass `sideEffect: true` to bypass the cache.\n */\nexport function createValidator<C = unknown>(\n fn: ValidatorJsFn,\n options: CreateValidatorOptions & { sideEffect?: boolean },\n): ValidatorDescriptor<C> {\n const fallbackCode = options.code || IssueCode.VALUE_INVALID;\n const fallbackMessage = options.message ?? 'The value is invalid';\n\n return defineValidator<C>({\n sideEffect: options.sideEffect,\n run: (ctx) => {\n const stringified = toValidatorString(ctx.value);\n if (fn(stringified)) {\n return ctx.value;\n }\n throw createValidupError(ctx.value, fallbackCode, fallbackMessage, options.data);\n },\n });\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { getPathValue } from 'pathtrace';\nimport validator from 'validator';\nimport { IssueCode, createValidupError, defineValidator } from 'validup';\nimport type { ValidatorDescriptor } from 'validup';\nimport type { BaseFactoryOptions } from '../module';\nimport { toValidatorString } from '../module';\n\n/**\n * Factory: validator.js `matches`. Emits `IssueCode.PATTERN` on failure\n * with `data: { pattern: string }` (the regex source, no flags) so\n * i18n templates can quote it.\n */\nexport function matches<C = unknown>(pattern: RegExp | string, options: BaseFactoryOptions & {\n modifiers?: string,\n} = {}): ValidatorDescriptor<C> {\n const patternSource = typeof pattern === 'string' ? pattern : pattern.source;\n return defineValidator<C>({\n run: (ctx) => {\n const s = toValidatorString(ctx.value);\n const ok = typeof pattern === 'string' ?\n validator.matches(s, pattern, options.modifiers) :\n validator.matches(s, pattern);\n if (ok) return ctx.value;\n throw createValidupError(\n ctx.value,\n IssueCode.PATTERN,\n options.message ?? 'The value does not match the expected pattern',\n { pattern: patternSource },\n );\n },\n });\n}\n\n/**\n * Factory: validator.js `equals`. Emits `IssueCode.SAME_AS` on failure\n * with `data: { other: string }` so a translated message can quote the\n * key subject (e.g. \"must equal {{other}}\").\n *\n * `key` is the field-name / label the i18n template should\n * surface. When `expectedValue` is omitted, `key` is also used as a\n * pathtrace path into `ctx.data` to look up the runtime comparison\n * target — so `equals('password')` mounted on `passwordConfirm`\n * compares against `ctx.data.password`. Pass `expectedValue`\n * explicitly to compare against a fixed string instead.\n *\n * **Side-effect contract.** When `expectedValue` is provided the\n * validator is a pure function of `ctx.value` and participates in the\n * result cache like every other factory. When `expectedValue` is\n * omitted the validator reads `ctx.data[key]` — a sibling field —\n * which the cache's `(value, context, group)` snapshot does NOT\n * capture. The factory therefore stamps `sideEffect: true` in that\n * branch so the framework re-runs it on every invocation; otherwise a\n * `passwordConfirm` check would stay stale after `password` changes.\n */\nexport function equals<C = unknown>(key: string, options: BaseFactoryOptions & {\n expectedValue?: string,\n} = {}): ValidatorDescriptor<C> {\n return defineValidator<C>({\n sideEffect: typeof options.expectedValue === 'undefined',\n run: (ctx) => {\n const s = toValidatorString(ctx.value);\n const target = options.expectedValue ?? toValidatorString(getPathValue(ctx.data, key));\n if (validator.equals(s, target)) return ctx.value;\n throw createValidupError(\n ctx.value,\n IssueCode.SAME_AS,\n options.message ?? `The value must equal ${key}`,\n { other: key },\n );\n },\n });\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport validator from 'validator';\nimport { IssueCode, createValidupError, defineValidator } from 'validup';\nimport type { ValidatorDescriptor } from 'validup';\nimport type { BaseFactoryOptions } from '../module';\nimport { toValidatorString } from '../module';\n\n/**\n * Factory: validator.js `isLength`. Detects which bound failed at\n * validation time so the resulting issue carries a useful vocabulary\n * code:\n *\n * - Too short → `IssueCode.MIN_LENGTH` (data: `{ min }`).\n * - Too long → `IssueCode.MAX_LENGTH` (data: `{ max }`).\n *\n * Calling without `min` / `max` is allowed but degenerate — every value\n * passes. `message` overrides the default English string for both bound\n * failures.\n */\nexport function isLength<C = unknown>(\n options: BaseFactoryOptions & validator.IsLengthOptions = {},\n): ValidatorDescriptor<C> {\n const { min, max } = options;\n return defineValidator<C>({\n run: (ctx) => {\n const s = toValidatorString(ctx.value);\n if (validator.isLength(s, options)) return ctx.value;\n if (typeof min === 'number' && s.length < min) {\n throw createValidupError(\n ctx.value,\n IssueCode.MIN_LENGTH,\n options.message ?? `The minimum length allowed is ${min}`,\n { min },\n );\n }\n if (typeof max === 'number' && s.length > max) {\n throw createValidupError(\n ctx.value,\n IssueCode.MAX_LENGTH,\n options.message ?? `The maximum length allowed is ${max}`,\n { max },\n );\n }\n // Fallback (shouldn't normally hit — `isLength` returned false but\n // neither bound was crossed). The MIN_LENGTH / MAX_LENGTH codes\n // both require their bound in `data`; without a bound we can't\n // honour the vocabulary contract, so emit the generic code.\n if (typeof min === 'number') {\n throw createValidupError(\n ctx.value,\n IssueCode.MIN_LENGTH,\n options.message ?? 'The value has an invalid length',\n { min },\n );\n }\n throw createValidupError(\n ctx.value,\n IssueCode.VALUE_INVALID,\n options.message ?? 'The value has an invalid length',\n );\n },\n });\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport validator from 'validator';\nimport { IssueCode, createValidupError, defineValidator } from 'validup';\nimport type { ValidatorDescriptor } from 'validup';\nimport type { BaseFactoryOptions } from '../module';\nimport { toValidatorString } from '../module';\n\n/**\n * Factory: validator.js `isEmail`. Emits `IssueCode.EMAIL` on failure.\n *\n * Options are flattened — pass validator.js's `IsEmailOptions` keys\n * (`require_display_name`, `allow_utf8_local_part`, …) directly alongside\n * the validup-side `message` override.\n */\nexport function isEmail<C = unknown>(\n options: BaseFactoryOptions & validator.IsEmailOptions = {},\n): ValidatorDescriptor<C> {\n const message = options.message ?? 'The value is not a valid email address';\n return defineValidator<C>({\n run: (ctx) => {\n const s = toValidatorString(ctx.value);\n if (validator.isEmail(s, options)) return ctx.value;\n throw createValidupError(ctx.value, IssueCode.EMAIL, message);\n },\n });\n}\n\n/**\n * Factory: validator.js `isURL`. Emits `IssueCode.URL` on failure.\n */\nexport function isURL<C = unknown>(\n options: BaseFactoryOptions & validator.IsURLOptions = {},\n): ValidatorDescriptor<C> {\n const message = options.message ?? 'The value is not a valid URL';\n return defineValidator<C>({\n run: (ctx) => {\n const s = toValidatorString(ctx.value);\n if (validator.isURL(s, options)) return ctx.value;\n throw createValidupError(ctx.value, IssueCode.URL, message);\n },\n });\n}\n\n/**\n * Factory: validator.js `isUUID`. Emits `IssueCode.UUID` on failure.\n *\n * `version` mirrors validator.js's positional second argument\n * (`'1' | '2' | '3' | '4' | '5' | 'all' | 1 | …`). Promoted into the\n * options object so the call site is consistent with the other factories.\n */\nexport function isUUID<C = unknown>(\n options: BaseFactoryOptions & { version?: validator.UUIDVersion } = {},\n): ValidatorDescriptor<C> {\n const message = options.message ?? 'The value is not a valid UUID';\n return defineValidator<C>({\n run: (ctx) => {\n const s = toValidatorString(ctx.value);\n if (validator.isUUID(s, options.version)) return ctx.value;\n throw createValidupError(ctx.value, IssueCode.UUID, message);\n },\n });\n}\n\n/**\n * Factory: validator.js `isIP`. Emits `IssueCode.IP_ADDRESS` on failure.\n *\n * `version` mirrors validator.js's positional second argument.\n */\nexport function isIP<C = unknown>(\n options: BaseFactoryOptions & { version?: '4' | '6' | 4 | 6 } = {},\n): ValidatorDescriptor<C> {\n const message = options.message ?? 'The value is not a valid IP address';\n return defineValidator<C>({\n run: (ctx) => {\n const s = toValidatorString(ctx.value);\n if (validator.isIP(s, options.version)) return ctx.value;\n throw createValidupError(ctx.value, IssueCode.IP_ADDRESS, message);\n },\n });\n}\n\n/**\n * Factory: validator.js `isMACAddress`. Emits `IssueCode.MAC_ADDRESS` on failure.\n */\nexport function isMACAddress<C = unknown>(\n options: BaseFactoryOptions & validator.IsMACAddressOptions = {},\n): ValidatorDescriptor<C> {\n const message = options.message ?? 'The value is not a valid MAC address';\n return defineValidator<C>({\n run: (ctx) => {\n const s = toValidatorString(ctx.value);\n if (validator.isMACAddress(s, options)) return ctx.value;\n throw createValidupError(ctx.value, IssueCode.MAC_ADDRESS, message);\n },\n });\n}\n\n/**\n * Factory: validator.js `isDate`. Emits `IssueCode.DATE` on failure.\n */\nexport function isDate<C = unknown>(\n options: BaseFactoryOptions & validator.IsDateOptions = {},\n): ValidatorDescriptor<C> {\n const message = options.message ?? 'The value is not a valid date';\n return defineValidator<C>({\n run: (ctx) => {\n const s = toValidatorString(ctx.value);\n if (validator.isDate(s, options)) return ctx.value;\n throw createValidupError(ctx.value, IssueCode.DATE, message);\n },\n });\n}\n\n/**\n * Factory: validator.js `isISO8601`. Emits `IssueCode.DATE` on failure\n * (same code as `isDate` — both produce the \"is this a parseable date\"\n * outcome from the consumer's perspective).\n */\nexport function isISO8601<C = unknown>(\n options: BaseFactoryOptions & validator.IsISO8601Options = {},\n): ValidatorDescriptor<C> {\n const message = options.message ?? 'The value is not a valid date';\n return defineValidator<C>({\n run: (ctx) => {\n const s = toValidatorString(ctx.value);\n if (validator.isISO8601(s, options)) return ctx.value;\n throw createValidupError(ctx.value, IssueCode.DATE, message);\n },\n });\n}\n\n/**\n * Factory: validator.js `isJSON`. Emits `IssueCode.JSON` on failure.\n */\nexport function isJSON<C = unknown>(\n options: BaseFactoryOptions & validator.IsJSONOptions = {},\n): ValidatorDescriptor<C> {\n const message = options.message ?? 'The value is not valid JSON';\n return defineValidator<C>({\n run: (ctx) => {\n const s = toValidatorString(ctx.value);\n if (validator.isJSON(s, options)) return ctx.value;\n throw createValidupError(ctx.value, IssueCode.JSON, message);\n },\n });\n}\n\n/**\n * Factory: validator.js `isBase64`. Emits `IssueCode.BASE64` on failure.\n */\nexport function isBase64<C = unknown>(\n options: BaseFactoryOptions & validator.IsBase64Options = {},\n): ValidatorDescriptor<C> {\n const message = options.message ?? 'The value is not valid base64';\n return defineValidator<C>({\n run: (ctx) => {\n const s = toValidatorString(ctx.value);\n if (validator.isBase64(s, options)) return ctx.value;\n throw createValidupError(ctx.value, IssueCode.BASE64, message);\n },\n });\n}\n\n/**\n * The subset of `validator.StrongPasswordOptions` keys that describe\n * *strength requirements* — what the consumer wants the password to look\n * like, as opposed to scoring weights (`pointsPerUnique`,\n * `pointsForContainingLower`, …) which only affect validator.js's\n * `returnScore` mode. Only these keys surface on `IssueCode.STRONG_PASSWORD`'s\n * `data` payload, matching the documented vocabulary contract.\n */\nconst STRONG_PASSWORD_REQUIREMENT_KEYS = [\n 'minLength',\n 'minLowercase',\n 'minUppercase',\n 'minNumbers',\n 'minSymbols',\n] as const;\n\ntype StrongPasswordRequirementParams = {\n minLength?: number,\n minLowercase?: number,\n minUppercase?: number,\n minNumbers?: number,\n minSymbols?: number,\n};\n\n/**\n * Factory: validator.js `isStrongPassword`. Emits\n * `IssueCode.STRONG_PASSWORD` on failure. `data` carries only the\n * documented strength-requirement keys (`minLength`, `minLowercase`,\n * `minUppercase`, `minNumbers`, `minSymbols`) so i18n templates can quote\n * them:\n *\n * ```ts\n * isStrongPassword({ minLength: 12, minNumbers: 2 });\n * // → IssueCode.STRONG_PASSWORD, data: { minLength: 12, minNumbers: 2 }\n * ```\n *\n * Scoring weights (`pointsPerUnique`, `pointsForContainingLower`, …) are\n * still forwarded to validator.js so they continue to influence the\n * pass/fail decision (and any `returnScore`-shaped diagnostics), but they\n * do NOT appear in `data` — i18n templates would never want to render\n * \"must score at least N points per unique character\" to the user.\n */\nexport function isStrongPassword<C = unknown>(\n options: BaseFactoryOptions & validator.StrongPasswordOptions = {},\n): ValidatorDescriptor<C> {\n const message = options.message ?? 'The value does not meet the password strength requirements';\n // Strip validup-only `message` AND `returnScore` before forwarding to\n // validator.js. With `returnScore: true`, validator.js returns a numeric\n // score instead of a boolean — the truthy check below would accept any\n // non-zero score as a pass, so a weak password could squeak through.\n // Drop the flag and force boolean semantics.\n const {\n message: _ignored,\n returnScore: _alsoIgnored,\n ...rest\n } = options;\n // Project `rest` down to the documented strength-requirement subset for\n // the `data` payload. The full `rest` (including scoring weights) is\n // what validator.js sees — but consumer-facing `IssueItem.data`\n // matches the documented vocabulary contract.\n //\n // Build the template once at factory time; clone it per failure so a\n // consumer mutating `issue.data` on one IssueItem can't bleed into a\n // future failure from the same factory.\n const paramsTemplate: StrongPasswordRequirementParams = {};\n for (const key of STRONG_PASSWORD_REQUIREMENT_KEYS) {\n if (typeof rest[key] === 'number') {\n paramsTemplate[key] = rest[key];\n }\n }\n return defineValidator<C>({\n run: (ctx) => {\n const s = toValidatorString(ctx.value);\n // validator.js mutates the options argument it receives (merging\n // defaults in-place). Pass a shallow clone so consumer-side\n // `options` and our captured template stay clean.\n const probeOptions = { ...rest } as validator.StrongPasswordOptions;\n if (validator.isStrongPassword(s, probeOptions) === true) return ctx.value;\n throw createValidupError(\n ctx.value,\n IssueCode.STRONG_PASSWORD,\n message,\n { ...paramsTemplate },\n );\n },\n });\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport validator from 'validator';\nimport { IssueCode, createValidupError, defineValidator } from 'validup';\nimport type { ValidatorDescriptor } from 'validup';\nimport type { BaseFactoryOptions } from '../module';\nimport { toValidatorString } from '../module';\n\n/**\n * Factory: validator.js `isAlpha`. Emits `IssueCode.ALPHA` on failure.\n *\n * `locale` (validator.js's positional second arg) is promoted into the\n * flat options object; everything else passes through as `IsAlphaOptions`.\n */\nexport function isAlpha<C = unknown>(\n options: BaseFactoryOptions & validator.IsAlphaOptions & {\n locale?: validator.AlphaLocale,\n } = {},\n): ValidatorDescriptor<C> {\n const message = options.message ?? 'The value is not alphabetical';\n return defineValidator<C>({\n run: (ctx) => {\n const s = toValidatorString(ctx.value);\n if (validator.isAlpha(s, options.locale, options)) return ctx.value;\n throw createValidupError(ctx.value, IssueCode.ALPHA, message);\n },\n });\n}\n\n/**\n * Factory: validator.js `isAlphanumeric`. Emits `IssueCode.ALPHA_NUM` on failure.\n */\nexport function isAlphanumeric<C = unknown>(\n options: BaseFactoryOptions & validator.IsAlphanumericOptions & {\n locale?: validator.AlphanumericLocale,\n } = {},\n): ValidatorDescriptor<C> {\n const message = options.message ?? 'The value must be alphanumeric';\n return defineValidator<C>({\n run: (ctx) => {\n const s = toValidatorString(ctx.value);\n if (validator.isAlphanumeric(s, options.locale, options)) return ctx.value;\n throw createValidupError(ctx.value, IssueCode.ALPHA_NUM, message);\n },\n });\n}\n\n/**\n * Factory: validator.js `isNumeric`. Emits `IssueCode.NUMERIC` on failure.\n */\nexport function isNumeric<C = unknown>(\n options: BaseFactoryOptions & validator.IsNumericOptions = {},\n): ValidatorDescriptor<C> {\n const message = options.message ?? 'The value must be numeric';\n return defineValidator<C>({\n run: (ctx) => {\n const s = toValidatorString(ctx.value);\n if (validator.isNumeric(s, options)) return ctx.value;\n throw createValidupError(ctx.value, IssueCode.NUMERIC, message);\n },\n });\n}\n\n/**\n * Factory: validator.js `isDecimal`. Emits `IssueCode.DECIMAL` on failure.\n */\nexport function isDecimal<C = unknown>(\n options: BaseFactoryOptions & validator.IsDecimalOptions = {},\n): ValidatorDescriptor<C> {\n const message = options.message ?? 'The value must be a decimal number';\n return defineValidator<C>({\n run: (ctx) => {\n const s = toValidatorString(ctx.value);\n if (validator.isDecimal(s, options)) return ctx.value;\n throw createValidupError(ctx.value, IssueCode.DECIMAL, message);\n },\n });\n}\n\n/**\n * Factory: validator.js `isInt`. Resolves the right vocabulary code\n * based on what failed:\n *\n * - Value isn't an integer at all → `IssueCode.INTEGER`.\n * - Value below `min` (inclusive) or `gt` (exclusive) → `IssueCode.MIN_VALUE`\n * (data: `{ min }`). For `gt`, `data.min` is `options.gt` — i18n\n * templates can quote the boundary; the precise inclusive/exclusive\n * wording comes from `message`.\n * - Value above `max` (inclusive) or `lt` (exclusive) → `IssueCode.MAX_VALUE`\n * (data: `{ max }`). Same treatment as `gt` → `data.max` is `options.lt`.\n */\nexport function isInt<C = unknown>(\n options: BaseFactoryOptions & validator.IsIntOptions = {},\n): ValidatorDescriptor<C> {\n return defineValidator<C>({\n run: (ctx) => {\n const s = toValidatorString(ctx.value);\n // Type check first — strip range bounds so a non-integer always\n // surfaces as INTEGER instead of being swallowed by a range failure.\n const isInteger = validator.isInt(s, { allow_leading_zeroes: options.allow_leading_zeroes });\n if (!isInteger) {\n throw createValidupError(\n ctx.value,\n IssueCode.INTEGER,\n options.message ?? 'The value must be an integer',\n );\n }\n const numeric = Number(s);\n const {\n min,\n max,\n lt,\n gt,\n } = options;\n if (typeof min === 'number' && numeric < min) {\n throw createValidupError(\n ctx.value,\n IssueCode.MIN_VALUE,\n options.message ?? `The value must be greater than or equal to ${min}`,\n { min },\n );\n }\n if (typeof gt === 'number' && numeric <= gt) {\n throw createValidupError(\n ctx.value,\n IssueCode.MIN_VALUE,\n options.message ?? `The value must be greater than ${gt}`,\n { min: gt },\n );\n }\n if (typeof max === 'number' && numeric > max) {\n throw createValidupError(\n ctx.value,\n IssueCode.MAX_VALUE,\n options.message ?? `The value must be less than or equal to ${max}`,\n { max },\n );\n }\n if (typeof lt === 'number' && numeric >= lt) {\n throw createValidupError(\n ctx.value,\n IssueCode.MAX_VALUE,\n options.message ?? `The value must be less than ${lt}`,\n { max: lt },\n );\n }\n // Defensive final pass — catches any remaining option we didn't\n // model explicitly (currently none beyond min/max/lt/gt and\n // allow_leading_zeroes). If this fires the failure is a true type\n // mismatch.\n if (!validator.isInt(s, options)) {\n throw createValidupError(\n ctx.value,\n IssueCode.INTEGER,\n options.message ?? 'The value must be an integer',\n );\n }\n return ctx.value;\n },\n });\n}\n\n/**\n * Factory: validator.js `isFloat`. Like {@link isInt} but for decimal\n * numbers — type failure emits `IssueCode.DECIMAL`; range bounds emit\n * `MIN_VALUE` / `MAX_VALUE`. `lt` / `gt` map to `MIN_VALUE` / `MAX_VALUE`\n * the same way `isInt` does.\n *\n * **Locale caveat.** validator.js's locale-aware float parsing (e.g.\n * `'123,45'` under `locale: 'de-DE'`) is opaque to the factory — we use\n * `Number(s)` for the explicit range checks, which returns `NaN` for\n * localized strings. When `locale` is set and the input parses to `NaN`,\n * we skip the explicit range checks and fall through to\n * `validator.isFloat(s, options)`, which DOES handle the locale correctly\n * — but a range failure caught there surfaces as `IssueCode.DECIMAL`\n * instead of `MIN_VALUE` / `MAX_VALUE`. Use the default locale (or\n * normalize the input upstream) when precise range codes matter for i18n.\n */\nexport function isFloat<C = unknown>(\n options: BaseFactoryOptions & validator.IsFloatOptions = {},\n): ValidatorDescriptor<C> {\n return defineValidator<C>({\n run: (ctx) => {\n const s = toValidatorString(ctx.value);\n // Pre-check honours `locale` so localized floats (e.g. '123,45' for\n // 'de-DE') aren't rejected by the type gate before the range checks\n // get a chance to run.\n if (!validator.isFloat(s, { locale: options.locale })) {\n throw createValidupError(\n ctx.value,\n IssueCode.DECIMAL,\n options.message ?? 'The value must be a decimal number',\n );\n }\n const numeric = Number(s);\n const {\n min,\n max,\n lt,\n gt,\n } = options;\n // NaN from a localized input skips the explicit range checks — see\n // the JSDoc above for the resulting code-vs-message trade-off.\n if (!Number.isNaN(numeric)) {\n if (typeof min === 'number' && numeric < min) {\n throw createValidupError(\n ctx.value,\n IssueCode.MIN_VALUE,\n options.message ?? `The value must be greater than or equal to ${min}`,\n { min },\n );\n }\n if (typeof gt === 'number' && numeric <= gt) {\n throw createValidupError(\n ctx.value,\n IssueCode.MIN_VALUE,\n options.message ?? `The value must be greater than ${gt}`,\n { min: gt },\n );\n }\n if (typeof max === 'number' && numeric > max) {\n throw createValidupError(\n ctx.value,\n IssueCode.MAX_VALUE,\n options.message ?? `The value must be less than or equal to ${max}`,\n { max },\n );\n }\n if (typeof lt === 'number' && numeric >= lt) {\n throw createValidupError(\n ctx.value,\n IssueCode.MAX_VALUE,\n options.message ?? `The value must be less than ${lt}`,\n { max: lt },\n );\n }\n }\n if (!validator.isFloat(s, options)) {\n throw createValidupError(\n ctx.value,\n IssueCode.DECIMAL,\n options.message ?? 'The value must be a decimal number',\n );\n }\n return ctx.value;\n },\n });\n}\n"],"x_google_ignoreList":[0],"mappings":";;;AA2BA,MAAM,cAAc,IAAI,IAAI;CAC3B;CACA;CACA;AACD,CAAC;AACD,SAAS,YAAY,KAAK;CACzB,OAAO,YAAY,IAAI,GAAG;AAC3B;AAGA,MAAM,uBAAuB;;;;;;;;;AAS7B,SAAS,YAAY,SAAS;CAC7B,IAAI,OAAO,YAAY,UAAU,OAAO,CAAC,OAAO;CAChD,IAAI,OAAO,YAAY,UAAU,OAAO,CAAC;CACzC,MAAM,QAAQ,QAAQ,QAAQ,cAAc,MAAM,EAAE,MAAM,iBAAiB;CAC3E,IAAI,CAAC,OAAO,OAAO,CAAC;CACpB,MAAM,SAAS,CAAC;CAChB,KAAK,MAAM,QAAQ,OAAO;EACzB,IAAI,YAAY,IAAI,GAAG;EACvB,MAAM,QAAQ,qBAAqB,KAAK,IAAI;EAC5C,IAAI,OAAO,OAAO,KAAK,OAAO,MAAM,EAAE,CAAC;OAClC,OAAO,KAAK,KAAK,QAAQ,eAAe,IAAI,CAAC;CACnD;CACA,OAAO;AACR;AA2EA,SAAS,aAAa,MAAM,MAAM;CACjC,MAAM,QAAQ,MAAM,QAAQ,IAAI,IAAI,OAAO,YAAY,IAAI;CAC3D,IAAI;CACJ,IAAI,OAAO;CACX,I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ACJ,CAAC;AACL"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/module.ts","../src/factories/comparison.ts","../src/factories/length.ts","../src/factories/string-format.ts","../src/factories/type-assertions.ts"],"sourcesContent":["/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { IssueCode } from '@ebec/core';\nimport { createValidupError, defineValidator } from 'validup';\nimport type { ValidatorDescriptor } from 'validup';\n\n/**\n * Shape of a validator.js boolean predicate. The first argument is always\n * the string to test; subsequent arguments are validator-specific options.\n */\nexport type ValidatorJsFn = (value: string, ...args: any[]) => boolean;\n\n/**\n * Options accepted by every factory (and {@link createValidator}). The\n * factory layers vocabulary-specific fields on top of this shape.\n */\nexport interface BaseFactoryOptions {\n /**\n * Override the default English message produced by the factory. The\n * default tracks `@ilingo/validup`'s `en` catalog so the same wording\n * surfaces with and without i18n.\n */\n message?: string;\n}\n\n/**\n * Options accepted by {@link createValidator}. The vocabulary code is\n * required — that's the entire point of the generic wrap; if you just\n * want `VALUE_INVALID`, hand-roll a `Validator` instead.\n */\nexport interface CreateValidatorOptions extends BaseFactoryOptions {\n /**\n * `IssueCode` value (or any project-specific string) attached to the\n * `IssueItem` on failure.\n */\n code: string;\n /**\n * Optional structured payload surfaced on `IssueItem.data` — what\n * the i18n template's `{{placeholders}}` resolve against.\n */\n data?: Record<string, unknown>;\n}\n\n/**\n * Build a string representation suitable for validator.js. validator.js\n * functions expect strings; for numbers and booleans we use `String(...)`\n * so consumers can mount `isInt()` on a `number`-shaped field without\n * pre-stringifying.\n */\nexport function toValidatorString(value: unknown): string {\n if (typeof value === 'string') return value;\n if (typeof value === 'number' || typeof value === 'boolean') return String(value);\n if (value === null || value === undefined) return '';\n return String(value);\n}\n\n/**\n * Generic wrap for any validator.js function we don't ship a pre-baked\n * factory for. The wrapped validator stringifies `ctx.value`, calls the\n * validator.js predicate, and throws a `ValidupError` carrying the\n * supplied `code` (+ optional `data`) on failure.\n *\n * @example\n * import validator from 'validator';\n * import { createValidator } from '@validup/validator-js';\n *\n * container.mount('card', createValidator(validator.isCreditCard, {\n * code: 'credit_card',\n * message: 'Invalid credit card number',\n * }));\n *\n * For the common cases — `email()`, `isLength()`, `isInt()` etc. — reach\n * for the pre-baked factories instead; they bake the right vocabulary\n * code and `data` in for you.\n *\n * The returned descriptor participates in the validup result cache by\n * default — validator.js's `ValidatorJsFn` signature is synchronous\n * and only inspects the stringified value, so the outcome is a pure\n * function of `(ctx.value, ctx.context, ctx.group)`. If the wrapped\n * predicate captures external state and the caller knowingly opts\n * into that, pass `sideEffect: true` to bypass the cache.\n */\nexport function createValidator<C = unknown>(\n fn: ValidatorJsFn,\n options: CreateValidatorOptions & { sideEffect?: boolean },\n): ValidatorDescriptor<C> {\n const fallbackCode = options.code || IssueCode.VALUE_INVALID;\n const fallbackMessage = options.message ?? 'The value is invalid';\n\n return defineValidator<C>({\n sideEffect: options.sideEffect,\n run: (ctx) => {\n const stringified = toValidatorString(ctx.value);\n if (fn(stringified)) {\n return ctx.value;\n }\n throw createValidupError(ctx.value, fallbackCode, fallbackMessage, options.data);\n },\n });\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { getPathValue } from 'pathtrace';\nimport validator from 'validator';\nimport { IssueCode } from '@ebec/core';\nimport { createValidupError, defineValidator } from 'validup';\nimport type { ValidatorDescriptor } from 'validup';\nimport type { BaseFactoryOptions } from '../module';\nimport { toValidatorString } from '../module';\n\n/**\n * Factory: validator.js `matches`. Emits `IssueCode.PATTERN` on failure\n * with `data: { pattern: string }` (the regex source, no flags) so\n * i18n templates can quote it.\n */\nexport function matches<C = unknown>(pattern: RegExp | string, options: BaseFactoryOptions & {\n modifiers?: string,\n} = {}): ValidatorDescriptor<C> {\n const patternSource = typeof pattern === 'string' ? pattern : pattern.source;\n return defineValidator<C>({\n run: (ctx) => {\n const s = toValidatorString(ctx.value);\n const ok = typeof pattern === 'string' ?\n validator.matches(s, pattern, options.modifiers) :\n validator.matches(s, pattern);\n if (ok) return ctx.value;\n throw createValidupError(\n ctx.value,\n IssueCode.PATTERN,\n options.message ?? 'The value does not match the expected pattern',\n { pattern: patternSource },\n );\n },\n });\n}\n\n/**\n * Factory: validator.js `equals`. Emits `IssueCode.SAME_AS` on failure\n * with `data: { other: string }` so a translated message can quote the\n * key subject (e.g. \"must equal {{other}}\").\n *\n * `key` is the field-name / label the i18n template should\n * surface. When `expectedValue` is omitted, `key` is also used as a\n * pathtrace path into `ctx.data` to look up the runtime comparison\n * target — so `equals('password')` mounted on `passwordConfirm`\n * compares against `ctx.data.password`. Pass `expectedValue`\n * explicitly to compare against a fixed string instead.\n *\n * **Side-effect contract.** When `expectedValue` is provided the\n * validator is a pure function of `ctx.value` and participates in the\n * result cache like every other factory. When `expectedValue` is\n * omitted the validator reads `ctx.data[key]` — a sibling field —\n * which the cache's `(value, context, group)` snapshot does NOT\n * capture. The factory therefore stamps `sideEffect: true` in that\n * branch so the framework re-runs it on every invocation; otherwise a\n * `passwordConfirm` check would stay stale after `password` changes.\n */\nexport function equals<C = unknown>(key: string, options: BaseFactoryOptions & {\n expectedValue?: string,\n} = {}): ValidatorDescriptor<C> {\n return defineValidator<C>({\n sideEffect: typeof options.expectedValue === 'undefined',\n run: (ctx) => {\n const s = toValidatorString(ctx.value);\n const target = options.expectedValue ?? toValidatorString(getPathValue(ctx.data, key));\n if (validator.equals(s, target)) return ctx.value;\n throw createValidupError(\n ctx.value,\n IssueCode.SAME_AS,\n options.message ?? `The value must equal ${key}`,\n { other: key },\n );\n },\n });\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport validator from 'validator';\nimport { IssueCode } from '@ebec/core';\nimport { createValidupError, defineValidator } from 'validup';\nimport type { ValidatorDescriptor } from 'validup';\nimport type { BaseFactoryOptions } from '../module';\nimport { toValidatorString } from '../module';\n\n/**\n * Factory: validator.js `isLength`. Detects which bound failed at\n * validation time so the resulting issue carries a useful vocabulary\n * code:\n *\n * - Too short → `IssueCode.MIN_LENGTH` (data: `{ min }`).\n * - Too long → `IssueCode.MAX_LENGTH` (data: `{ max }`).\n *\n * Calling without `min` / `max` is allowed but degenerate — every value\n * passes. `message` overrides the default English string for both bound\n * failures.\n */\nexport function isLength<C = unknown>(\n options: BaseFactoryOptions & validator.IsLengthOptions = {},\n): ValidatorDescriptor<C> {\n const { min, max } = options;\n return defineValidator<C>({\n run: (ctx) => {\n const s = toValidatorString(ctx.value);\n if (validator.isLength(s, options)) return ctx.value;\n if (typeof min === 'number' && s.length < min) {\n throw createValidupError(\n ctx.value,\n IssueCode.MIN_LENGTH,\n options.message ?? `The minimum length allowed is ${min}`,\n { min },\n );\n }\n if (typeof max === 'number' && s.length > max) {\n throw createValidupError(\n ctx.value,\n IssueCode.MAX_LENGTH,\n options.message ?? `The maximum length allowed is ${max}`,\n { max },\n );\n }\n // Fallback (shouldn't normally hit — `isLength` returned false but\n // neither bound was crossed). The MIN_LENGTH / MAX_LENGTH codes\n // both require their bound in `data`; without a bound we can't\n // honour the vocabulary contract, so emit the generic code.\n if (typeof min === 'number') {\n throw createValidupError(\n ctx.value,\n IssueCode.MIN_LENGTH,\n options.message ?? 'The value has an invalid length',\n { min },\n );\n }\n throw createValidupError(\n ctx.value,\n IssueCode.VALUE_INVALID,\n options.message ?? 'The value has an invalid length',\n );\n },\n });\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport validator from 'validator';\nimport { IssueCode } from '@ebec/core';\nimport { createValidupError, defineValidator } from 'validup';\nimport type { ValidatorDescriptor } from 'validup';\nimport type { BaseFactoryOptions } from '../module';\nimport { toValidatorString } from '../module';\n\n/**\n * Factory: validator.js `isEmail`. Emits `IssueCode.EMAIL` on failure.\n *\n * Options are flattened — pass validator.js's `IsEmailOptions` keys\n * (`require_display_name`, `allow_utf8_local_part`, …) directly alongside\n * the validup-side `message` override.\n */\nexport function isEmail<C = unknown>(\n options: BaseFactoryOptions & validator.IsEmailOptions = {},\n): ValidatorDescriptor<C> {\n const message = options.message ?? 'The value is not a valid email address';\n return defineValidator<C>({\n run: (ctx) => {\n const s = toValidatorString(ctx.value);\n if (validator.isEmail(s, options)) return ctx.value;\n throw createValidupError(ctx.value, IssueCode.EMAIL, message);\n },\n });\n}\n\n/**\n * Factory: validator.js `isURL`. Emits `IssueCode.URL` on failure.\n */\nexport function isURL<C = unknown>(\n options: BaseFactoryOptions & validator.IsURLOptions = {},\n): ValidatorDescriptor<C> {\n const message = options.message ?? 'The value is not a valid URL';\n return defineValidator<C>({\n run: (ctx) => {\n const s = toValidatorString(ctx.value);\n if (validator.isURL(s, options)) return ctx.value;\n throw createValidupError(ctx.value, IssueCode.URL, message);\n },\n });\n}\n\n/**\n * Factory: validator.js `isUUID`. Emits `IssueCode.UUID` on failure.\n *\n * `version` mirrors validator.js's positional second argument\n * (`'1' | '2' | '3' | '4' | '5' | 'all' | 1 | …`). Promoted into the\n * options object so the call site is consistent with the other factories.\n */\nexport function isUUID<C = unknown>(\n options: BaseFactoryOptions & { version?: validator.UUIDVersion } = {},\n): ValidatorDescriptor<C> {\n const message = options.message ?? 'The value is not a valid UUID';\n return defineValidator<C>({\n run: (ctx) => {\n const s = toValidatorString(ctx.value);\n if (validator.isUUID(s, options.version)) return ctx.value;\n throw createValidupError(ctx.value, IssueCode.UUID, message);\n },\n });\n}\n\n/**\n * Factory: validator.js `isIP`. Emits `IssueCode.IP_ADDRESS` on failure.\n *\n * `version` mirrors validator.js's positional second argument.\n */\nexport function isIP<C = unknown>(\n options: BaseFactoryOptions & { version?: '4' | '6' | 4 | 6 } = {},\n): ValidatorDescriptor<C> {\n const message = options.message ?? 'The value is not a valid IP address';\n return defineValidator<C>({\n run: (ctx) => {\n const s = toValidatorString(ctx.value);\n if (validator.isIP(s, options.version)) return ctx.value;\n throw createValidupError(ctx.value, IssueCode.IP_ADDRESS, message);\n },\n });\n}\n\n/**\n * Factory: validator.js `isMACAddress`. Emits `IssueCode.MAC_ADDRESS` on failure.\n */\nexport function isMACAddress<C = unknown>(\n options: BaseFactoryOptions & validator.IsMACAddressOptions = {},\n): ValidatorDescriptor<C> {\n const message = options.message ?? 'The value is not a valid MAC address';\n return defineValidator<C>({\n run: (ctx) => {\n const s = toValidatorString(ctx.value);\n if (validator.isMACAddress(s, options)) return ctx.value;\n throw createValidupError(ctx.value, IssueCode.MAC_ADDRESS, message);\n },\n });\n}\n\n/**\n * Factory: validator.js `isDate`. Emits `IssueCode.DATE` on failure.\n */\nexport function isDate<C = unknown>(\n options: BaseFactoryOptions & validator.IsDateOptions = {},\n): ValidatorDescriptor<C> {\n const message = options.message ?? 'The value is not a valid date';\n return defineValidator<C>({\n run: (ctx) => {\n const s = toValidatorString(ctx.value);\n if (validator.isDate(s, options)) return ctx.value;\n throw createValidupError(ctx.value, IssueCode.DATE, message);\n },\n });\n}\n\n/**\n * Factory: validator.js `isISO8601`. Emits `IssueCode.DATE` on failure\n * (same code as `isDate` — both produce the \"is this a parseable date\"\n * outcome from the consumer's perspective).\n */\nexport function isISO8601<C = unknown>(\n options: BaseFactoryOptions & validator.IsISO8601Options = {},\n): ValidatorDescriptor<C> {\n const message = options.message ?? 'The value is not a valid date';\n return defineValidator<C>({\n run: (ctx) => {\n const s = toValidatorString(ctx.value);\n if (validator.isISO8601(s, options)) return ctx.value;\n throw createValidupError(ctx.value, IssueCode.DATE, message);\n },\n });\n}\n\n/**\n * Factory: validator.js `isJSON`. Emits `IssueCode.JSON` on failure.\n */\nexport function isJSON<C = unknown>(\n options: BaseFactoryOptions & validator.IsJSONOptions = {},\n): ValidatorDescriptor<C> {\n const message = options.message ?? 'The value is not valid JSON';\n return defineValidator<C>({\n run: (ctx) => {\n const s = toValidatorString(ctx.value);\n if (validator.isJSON(s, options)) return ctx.value;\n throw createValidupError(ctx.value, IssueCode.JSON, message);\n },\n });\n}\n\n/**\n * Factory: validator.js `isBase64`. Emits `IssueCode.BASE64` on failure.\n */\nexport function isBase64<C = unknown>(\n options: BaseFactoryOptions & validator.IsBase64Options = {},\n): ValidatorDescriptor<C> {\n const message = options.message ?? 'The value is not valid base64';\n return defineValidator<C>({\n run: (ctx) => {\n const s = toValidatorString(ctx.value);\n if (validator.isBase64(s, options)) return ctx.value;\n throw createValidupError(ctx.value, IssueCode.BASE64, message);\n },\n });\n}\n\n/**\n * The subset of `validator.StrongPasswordOptions` keys that describe\n * *strength requirements* — what the consumer wants the password to look\n * like, as opposed to scoring weights (`pointsPerUnique`,\n * `pointsForContainingLower`, …) which only affect validator.js's\n * `returnScore` mode. Only these keys surface on `IssueCode.STRONG_PASSWORD`'s\n * `data` payload, matching the documented vocabulary contract.\n */\nconst STRONG_PASSWORD_REQUIREMENT_KEYS = [\n 'minLength',\n 'minLowercase',\n 'minUppercase',\n 'minNumbers',\n 'minSymbols',\n] as const;\n\ntype StrongPasswordRequirementParams = {\n minLength?: number,\n minLowercase?: number,\n minUppercase?: number,\n minNumbers?: number,\n minSymbols?: number,\n};\n\n/**\n * Factory: validator.js `isStrongPassword`. Emits\n * `IssueCode.STRONG_PASSWORD` on failure. `data` carries only the\n * documented strength-requirement keys (`minLength`, `minLowercase`,\n * `minUppercase`, `minNumbers`, `minSymbols`) so i18n templates can quote\n * them:\n *\n * ```ts\n * isStrongPassword({ minLength: 12, minNumbers: 2 });\n * // → IssueCode.STRONG_PASSWORD, data: { minLength: 12, minNumbers: 2 }\n * ```\n *\n * Scoring weights (`pointsPerUnique`, `pointsForContainingLower`, …) are\n * still forwarded to validator.js so they continue to influence the\n * pass/fail decision (and any `returnScore`-shaped diagnostics), but they\n * do NOT appear in `data` — i18n templates would never want to render\n * \"must score at least N points per unique character\" to the user.\n */\nexport function isStrongPassword<C = unknown>(\n options: BaseFactoryOptions & validator.StrongPasswordOptions = {},\n): ValidatorDescriptor<C> {\n const message = options.message ?? 'The value does not meet the password strength requirements';\n // Strip validup-only `message` AND `returnScore` before forwarding to\n // validator.js. With `returnScore: true`, validator.js returns a numeric\n // score instead of a boolean — the truthy check below would accept any\n // non-zero score as a pass, so a weak password could squeak through.\n // Drop the flag and force boolean semantics.\n const {\n message: _ignored,\n returnScore: _alsoIgnored,\n ...rest\n } = options;\n // Project `rest` down to the documented strength-requirement subset for\n // the `data` payload. The full `rest` (including scoring weights) is\n // what validator.js sees — but consumer-facing `IssueItem.data`\n // matches the documented vocabulary contract.\n //\n // Build the template once at factory time; clone it per failure so a\n // consumer mutating `issue.data` on one IssueItem can't bleed into a\n // future failure from the same factory.\n const paramsTemplate: StrongPasswordRequirementParams = {};\n for (const key of STRONG_PASSWORD_REQUIREMENT_KEYS) {\n if (typeof rest[key] === 'number') {\n paramsTemplate[key] = rest[key];\n }\n }\n return defineValidator<C>({\n run: (ctx) => {\n const s = toValidatorString(ctx.value);\n // validator.js mutates the options argument it receives (merging\n // defaults in-place). Pass a shallow clone so consumer-side\n // `options` and our captured template stay clean.\n const probeOptions = { ...rest } as validator.StrongPasswordOptions;\n if (validator.isStrongPassword(s, probeOptions) === true) return ctx.value;\n throw createValidupError(\n ctx.value,\n IssueCode.STRONG_PASSWORD,\n message,\n { ...paramsTemplate },\n );\n },\n });\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport validator from 'validator';\nimport { IssueCode } from '@ebec/core';\nimport { createValidupError, defineValidator } from 'validup';\nimport type { ValidatorDescriptor } from 'validup';\nimport type { BaseFactoryOptions } from '../module';\nimport { toValidatorString } from '../module';\n\n/**\n * Factory: validator.js `isAlpha`. Emits `IssueCode.ALPHA` on failure.\n *\n * `locale` (validator.js's positional second arg) is promoted into the\n * flat options object; everything else passes through as `IsAlphaOptions`.\n */\nexport function isAlpha<C = unknown>(\n options: BaseFactoryOptions & validator.IsAlphaOptions & {\n locale?: validator.AlphaLocale,\n } = {},\n): ValidatorDescriptor<C> {\n const message = options.message ?? 'The value is not alphabetical';\n return defineValidator<C>({\n run: (ctx) => {\n const s = toValidatorString(ctx.value);\n if (validator.isAlpha(s, options.locale, options)) return ctx.value;\n throw createValidupError(ctx.value, IssueCode.ALPHA, message);\n },\n });\n}\n\n/**\n * Factory: validator.js `isAlphanumeric`. Emits `IssueCode.ALPHA_NUM` on failure.\n */\nexport function isAlphanumeric<C = unknown>(\n options: BaseFactoryOptions & validator.IsAlphanumericOptions & {\n locale?: validator.AlphanumericLocale,\n } = {},\n): ValidatorDescriptor<C> {\n const message = options.message ?? 'The value must be alphanumeric';\n return defineValidator<C>({\n run: (ctx) => {\n const s = toValidatorString(ctx.value);\n if (validator.isAlphanumeric(s, options.locale, options)) return ctx.value;\n throw createValidupError(ctx.value, IssueCode.ALPHA_NUM, message);\n },\n });\n}\n\n/**\n * Factory: validator.js `isNumeric`. Emits `IssueCode.NUMERIC` on failure.\n */\nexport function isNumeric<C = unknown>(\n options: BaseFactoryOptions & validator.IsNumericOptions = {},\n): ValidatorDescriptor<C> {\n const message = options.message ?? 'The value must be numeric';\n return defineValidator<C>({\n run: (ctx) => {\n const s = toValidatorString(ctx.value);\n if (validator.isNumeric(s, options)) return ctx.value;\n throw createValidupError(ctx.value, IssueCode.NUMERIC, message);\n },\n });\n}\n\n/**\n * Factory: validator.js `isDecimal`. Emits `IssueCode.DECIMAL` on failure.\n */\nexport function isDecimal<C = unknown>(\n options: BaseFactoryOptions & validator.IsDecimalOptions = {},\n): ValidatorDescriptor<C> {\n const message = options.message ?? 'The value must be a decimal number';\n return defineValidator<C>({\n run: (ctx) => {\n const s = toValidatorString(ctx.value);\n if (validator.isDecimal(s, options)) return ctx.value;\n throw createValidupError(ctx.value, IssueCode.DECIMAL, message);\n },\n });\n}\n\n/**\n * The min/gt/max/lt bounds shared by {@link isInt} and {@link isFloat}.\n * A subset of both `validator.IsIntOptions` and `validator.IsFloatOptions`\n * plus the `message` override from `BaseFactoryOptions`.\n */\ntype NumericRangeOptions = {\n min?: number,\n max?: number,\n lt?: number,\n gt?: number,\n message?: string,\n};\n\n/**\n * Shared range ladder for {@link isInt} / {@link isFloat}. Throws the first\n * violated bound and returns `void` when every bound holds.\n *\n * The bounds are checked first-match-wins in `min`, `gt`, `max`, `lt` order,\n * and the emitted codes are deliberately coarser than the option names:\n *\n * - `min` (inclusive) and `gt` (exclusive) both emit `IssueCode.MIN_VALUE`.\n * For `gt`, `data.min` carries `options.gt` — i18n templates can quote the\n * boundary, and the precise inclusive/exclusive wording comes from\n * `message`. Same treatment for `lt` → `IssueCode.MAX_VALUE` with\n * `data.max` carrying `options.lt`. This mapping is an i18n-facing\n * contract; don't split it without a matching catalog change.\n *\n * Type-failure codes (`INTEGER` for `isInt`, `DECIMAL` for `isFloat`) sit\n * OUTSIDE this ladder and stay with their respective factories — which is\n * why the helper needs no code-selecting parameter.\n *\n * `NaN` handling also stays with the caller: `isFloat` skips the ladder for\n * localized input that `Number()` can't parse, while `isInt` reaches it only\n * after `validator.isInt` returned true.\n */\nfunction assertNumericRange(\n received: unknown,\n numeric: number,\n options: NumericRangeOptions,\n): void {\n const {\n min,\n max,\n lt,\n gt,\n } = options;\n if (typeof min === 'number' && numeric < min) {\n throw createValidupError(\n received,\n IssueCode.MIN_VALUE,\n options.message ?? `The value must be greater than or equal to ${min}`,\n { min },\n );\n }\n if (typeof gt === 'number' && numeric <= gt) {\n throw createValidupError(\n received,\n IssueCode.MIN_VALUE,\n options.message ?? `The value must be greater than ${gt}`,\n { min: gt },\n );\n }\n if (typeof max === 'number' && numeric > max) {\n throw createValidupError(\n received,\n IssueCode.MAX_VALUE,\n options.message ?? `The value must be less than or equal to ${max}`,\n { max },\n );\n }\n if (typeof lt === 'number' && numeric >= lt) {\n throw createValidupError(\n received,\n IssueCode.MAX_VALUE,\n options.message ?? `The value must be less than ${lt}`,\n { max: lt },\n );\n }\n}\n\n/**\n * Factory: validator.js `isInt`. Resolves the right vocabulary code\n * based on what failed:\n *\n * - Value isn't an integer at all → `IssueCode.INTEGER`.\n * - Value below `min` (inclusive) or `gt` (exclusive) → `IssueCode.MIN_VALUE`\n * (data: `{ min }`). For `gt`, `data.min` is `options.gt` — i18n\n * templates can quote the boundary; the precise inclusive/exclusive\n * wording comes from `message`.\n * - Value above `max` (inclusive) or `lt` (exclusive) → `IssueCode.MAX_VALUE`\n * (data: `{ max }`). Same treatment as `gt` → `data.max` is `options.lt`.\n */\nexport function isInt<C = unknown>(\n options: BaseFactoryOptions & validator.IsIntOptions = {},\n): ValidatorDescriptor<C> {\n return defineValidator<C>({\n run: (ctx) => {\n const s = toValidatorString(ctx.value);\n // Type check first — strip range bounds so a non-integer always\n // surfaces as INTEGER instead of being swallowed by a range failure.\n const isInteger = validator.isInt(s, { allow_leading_zeroes: options.allow_leading_zeroes });\n if (!isInteger) {\n throw createValidupError(\n ctx.value,\n IssueCode.INTEGER,\n options.message ?? 'The value must be an integer',\n );\n }\n assertNumericRange(ctx.value, Number(s), options);\n // Defensive final pass — catches any remaining option we didn't\n // model explicitly (currently none beyond min/max/lt/gt and\n // allow_leading_zeroes). If this fires the failure is a true type\n // mismatch.\n if (!validator.isInt(s, options)) {\n throw createValidupError(\n ctx.value,\n IssueCode.INTEGER,\n options.message ?? 'The value must be an integer',\n );\n }\n return ctx.value;\n },\n });\n}\n\n/**\n * Factory: validator.js `isFloat`. Like {@link isInt} but for decimal\n * numbers — type failure emits `IssueCode.DECIMAL`; range bounds emit\n * `MIN_VALUE` / `MAX_VALUE`. `gt` / `lt` map to `MIN_VALUE` / `MAX_VALUE`\n * the same way `isInt` does — `gt` emits `MIN_VALUE` with `data.min` set to\n * `options.gt`, `lt` emits `MAX_VALUE` with `data.max` set to `options.lt`.\n *\n * **Locale caveat.** validator.js's locale-aware float parsing (e.g.\n * `'123,45'` under `locale: 'de-DE'`) is opaque to the factory — we use\n * `Number(s)` for the explicit range checks, which returns `NaN` for\n * localized strings. When `locale` is set and the input parses to `NaN`,\n * we skip the explicit range checks and fall through to\n * `validator.isFloat(s, options)`, which DOES handle the locale correctly\n * — but a range failure caught there surfaces as `IssueCode.DECIMAL`\n * instead of `MIN_VALUE` / `MAX_VALUE`. Use the default locale (or\n * normalize the input upstream) when precise range codes matter for i18n.\n */\nexport function isFloat<C = unknown>(\n options: BaseFactoryOptions & validator.IsFloatOptions = {},\n): ValidatorDescriptor<C> {\n return defineValidator<C>({\n run: (ctx) => {\n const s = toValidatorString(ctx.value);\n // Pre-check honours `locale` so localized floats (e.g. '123,45' for\n // 'de-DE') aren't rejected by the type gate before the range checks\n // get a chance to run.\n if (!validator.isFloat(s, { locale: options.locale })) {\n throw createValidupError(\n ctx.value,\n IssueCode.DECIMAL,\n options.message ?? 'The value must be a decimal number',\n );\n }\n const numeric = Number(s);\n // NaN from a localized input skips the explicit range checks — see\n // the JSDoc above for the resulting code-vs-message trade-off. The\n // guard stays at THIS call site rather than moving into\n // `assertNumericRange`: `isInt` reaches the ladder only after\n // `validator.isInt` returned true, so hoisting it would bake in an\n // invariant that a future locale-aware `isInt` could silently break\n // into a wrong-pass.\n if (!Number.isNaN(numeric)) {\n assertNumericRange(ctx.value, numeric, options);\n }\n if (!validator.isFloat(s, options)) {\n throw createValidupError(\n ctx.value,\n IssueCode.DECIMAL,\n options.message ?? 'The value must be a decimal number',\n );\n }\n return ctx.value;\n },\n });\n}\n"],"mappings":";;;;;;;;;;;AAsDA,SAAgB,kBAAkB,OAAwB;CACtD,IAAI,OAAO,UAAU,UAAU,OAAO;CACtC,IAAI,OAAO,UAAU,YAAY,OAAO,UAAU,WAAW,OAAO,OAAO,KAAK;CAChF,IAAI,UAAU,QAAQ,UAAU,KAAA,GAAW,OAAO;CAClD,OAAO,OAAO,KAAK;AACvB;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,SAAgB,gBACZ,IACA,SACsB;CACtB,MAAM,eAAe,QAAQ,QAAQ,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AAI,CAAC,OAAO,MAAM,OAAO,GACrB,mBAAmB,IAAI,OAAO,SAAS,OAAO;EAElD,IAAI,CAAC,UAAU,QAAQ,GAAG,OAAO,GAC7B,MAAM,mBACF,IAAI,OACJ,UAAU,SACV,QAAQ,WAAW,oCACvB;EAEJ,OAAO,IAAI;CACf,EACJ,CAAC;AACL"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@validup/validator-js",
3
- "version": "0.2.3",
3
+ "version": "2.0.0",
4
4
  "type": "module",
5
5
  "description": "validator.js integration for validup — pre-baked factories per common rule plus a generic createValidator for the long tail.",
6
6
  "author": {
@@ -32,6 +32,7 @@
32
32
  "build:types": "tsc --noEmit -p tsconfig.build.json",
33
33
  "build:js": "tsdown",
34
34
  "build": "npm run build:types && npm run build:js",
35
+ "test:types": "tsc --noEmit",
35
36
  "test": "vitest --config test/vitest.config.ts --run",
36
37
  "test:coverage": "vitest --config test/vitest.config.ts --run --coverage"
37
38
  },
@@ -42,13 +43,17 @@
42
43
  "validatorjs"
43
44
  ],
44
45
  "license": "Apache-2.0",
46
+ "dependencies": {
47
+ "@ebec/core": "^1.3.1",
48
+ "pathtrace": "^2.2.3"
49
+ },
45
50
  "devDependencies": {
46
51
  "@types/validator": "^13.12.2",
47
52
  "validator": "^13.12.0"
48
53
  },
49
54
  "peerDependencies": {
50
- "validup": "^0.5.1",
51
- "validator": "^13.0.0"
55
+ "validator": "^13.0.0",
56
+ "validup": "^2.0.0"
52
57
  },
53
58
  "publishConfig": {
54
59
  "access": "public"