@zerotal/validator 1.8.1 → 1.10.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/CHANGELOG.md CHANGED
@@ -8,6 +8,16 @@ follows the Zerotal monorepo's unified versioning.
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [1.9.0] — 2026-08-29
12
+
13
+ ### Documented
14
+
15
+ - **Every promised export is documented.** The `docs-coverage` gate reads `maturity: stable` as a
16
+ promise about a package's exports, and measures how much of that promise is written down. It
17
+ was 798 gaps across the suite; it is now zero. This package's share is covered on its own
18
+ pages — types named, options shapes described, and the decisions behind them recorded where
19
+ somebody looking for them will find them.
20
+
11
21
  ## [1.7.3] — 2026-08-20
12
22
 
13
23
  ### Fixed
package/api-surface.md CHANGED
@@ -315,14 +315,6 @@ const Validator = { check<S extends Record<string, FieldRule>>(data: Record<s
315
315
 
316
316
  function registerDbRuleRunner = (runner: DbRuleRunner) => void
317
317
 
318
- function runStringRules = (data: Record<string, unknown>, rules: StringRules) => Record<string, string[]>
319
-
320
- function runStringRulesAsync = (data: Record<string, unknown>, rules: StringRules) => Promise<Record<string, string[]>>
321
-
322
- function runValidation = <S extends Schema>(schema: S, input: Record<string, unknown>) => ValidationOutcome<unknown>
323
-
324
- function runValidationAsync = <S extends Schema>(schema: S, input: Record<string, unknown>) => Promise<ValidationOutcome<unknown>>
325
-
326
318
  function validate = <S extends Record<string, FieldRule>>(ctx: HttpContext, factory: (rules: RuleBuilder) => S) => Promise<Infer<ExtractDefs<S>>>
327
319
 
328
320
  function ValidatorConfig = (options?: Partial<ValidatorConfigShape>) => ValidatorConfigShape
@@ -349,7 +341,7 @@ interface FieldRuleDefinition = {
349
341
  }
350
342
 
351
343
  interface UniqueOptions = {
352
- ignoreId?: string | number
344
+ ignoreId?: string | number | undefined
353
345
  }
354
346
 
355
347
  interface ValidatorConfigShape = {
@@ -363,8 +355,6 @@ type InferFieldType = F['type'] extends 'string' ? string : F['type'] extends 'n
363
355
 
364
356
  type Schema = { [x: string]: FieldRuleDefinition;}
365
357
 
366
- type StringRules = { [x: string]: string | string[];}
367
-
368
358
  type ValidationErrors = { [x: string]: string;}
369
359
 
370
360
  type ValidationOutcome = ValidationResult<T> | ValidationFailure
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zerotal/validator",
3
- "version": "1.8.1",
3
+ "version": "1.10.0",
4
4
  "license": "MIT",
5
5
  "maturity": "stable",
6
6
  "private": false,
@@ -30,7 +30,7 @@
30
30
  "typecheck": "tsc --noEmit"
31
31
  },
32
32
  "dependencies": {
33
- "@zerotal/core": "1.8.1"
33
+ "@zerotal/core": "1.10.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "typescript": "^5.8.0"
package/src/Validator.ts CHANGED
@@ -30,6 +30,7 @@ function resolveRequired(def: FieldRuleDefinition, input: Record<string, unknown
30
30
  return def.required;
31
31
  }
32
32
 
33
+ /** @internal */
33
34
  export function runValidation<S extends Schema>(
34
35
  schema: S,
35
36
  input: Record<string, unknown>,
@@ -330,6 +331,8 @@ type RuleEntry = { name: string; args: unknown[]; message?: string; fn?: CustomF
330
331
  * Like runValidation() but also executes async rules (unique, exists, custom fn).
331
332
  * Use this in validate() and FormRequest.validate() instead of runValidation()
332
333
  * whenever the schema may contain DB-aware or custom async rules.
334
+ *
335
+ * @internal
333
336
  */
334
337
  export async function runValidationAsync<S extends Schema>(
335
338
  schema: S,
package/src/dbRules.ts CHANGED
@@ -18,7 +18,7 @@ type DbRuleRunner = (
18
18
 
19
19
  export interface UniqueOptions {
20
20
  /** Ignore the row with this id — use on update to exclude the current record. */
21
- ignoreId?: number | string;
21
+ ignoreId?: number | string | undefined;
22
22
  }
23
23
 
24
24
  let _runner: DbRuleRunner | undefined;
@@ -8,6 +8,7 @@
8
8
  * every rule it covers.
9
9
  */
10
10
 
11
+ /** @internal */
11
12
  export type StringRules = Record<string, string | string[]>;
12
13
 
13
14
  export type RuleFn = (
@@ -242,6 +243,8 @@ function _label(field: string): string {
242
243
  /**
243
244
  * Validate `data` against pipe-delimited string `rules`. Returns a map of field → error messages
244
245
  * for every field that failed (an empty object means everything passed).
246
+ *
247
+ * @internal
245
248
  */
246
249
  export function runStringRules(
247
250
  data: Record<string, unknown>,
@@ -289,6 +292,8 @@ export function runStringRules(
289
292
  * Async variant of {@link runStringRules}. Currently wraps the synchronous engine; exists so
290
293
  * callers (e.g. Flow's `await this.validate()`) have a stable async entry point as
291
294
  * database-backed string rules (`unique`/`exists`) are layered in.
295
+ *
296
+ * @internal
292
297
  */
293
298
  export async function runStringRulesAsync(
294
299
  data: Record<string, unknown>,