validup 0.3.0 → 0.4.1

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/README.md CHANGED
@@ -10,10 +10,6 @@ A composable, path-based validation library for TypeScript.
10
10
 
11
11
  Mount any validator function (or nested container) onto any path of your input, run them in groups, collect structured issues, and bridge to existing libraries via integration packages. No decorators, no schema DSL, no metadata reflection.
12
12
 
13
- > 🚧 **Work in Progress**
14
- >
15
- > Validup is currently under active development and is not yet ready for production.
16
-
17
13
  **Table of Contents**
18
14
 
19
15
  - [Installation](#installation)
@@ -35,9 +31,10 @@ Mount any validator function (or nested container) onto any path of your input,
35
31
  - [Defaults](#defaults)
36
32
  - [Context](#context)
37
33
  - [Cancellation](#cancellation)
38
- - [Parallel Execution](#parallel-execution)
39
- - [Safe Run](#safe-run)
40
- - [Sync Fast Path](#sync-fast-path)
34
+ - [Run Modes](#run-modes)
35
+ - [Parallel Execution](#parallel-execution)
36
+ - [Safe Run](#safe-run)
37
+ - [Sync Fast Path](#sync-fast-path)
41
38
  - [Localized Messages](#localized-messages)
42
39
  - [Error Handling](#error-handling)
43
40
  - [ValidupError](#validuperror)
@@ -49,6 +46,7 @@ Mount any validator function (or nested container) onto any path of your input,
49
46
  - [Issue Helpers](#issue-helpers)
50
47
  - [Type Guards](#type-guards)
51
48
  - [Integrations](#integrations)
49
+ - [Stability](#stability)
52
50
  - [License](#license)
53
51
 
54
52
  ## Installation
@@ -116,6 +114,39 @@ type ValidatorContext<C = unknown> = {
116
114
 
117
115
  A validator's **return value** becomes the output for that path — so validators double as transformers/sanitizers. The optional second generic `Out` lets callers (and the [Builder API](#builder-api-compile-time-typing)) infer per-field types from the validator's return type — `Out` defaults to `unknown`, so existing call sites compile unchanged.
118
116
 
117
+ #### Descriptor form
118
+
119
+ `mount()` also accepts a `ValidatorDescriptor<C, Out>` — a small wrapper that attaches per-mount metadata the framework consults. Today the metadata is just `sideEffect`, the switch that opts a validator out of the [result cache](#result-caching).
120
+
121
+ ```typescript
122
+ import { defineValidator } from 'validup';
123
+
124
+ // Cache-eligible (default): same (value, context, group) → reuse result.
125
+ const isPositive = defineValidator({
126
+ run: (ctx) => {
127
+ if (typeof ctx.value !== 'number' || ctx.value <= 0) {
128
+ throw new Error('must be positive');
129
+ }
130
+ return ctx.value;
131
+ },
132
+ });
133
+
134
+ // Cross-field / network / stateful — re-run every time:
135
+ const isEmailUnique = defineValidator({
136
+ sideEffect: true,
137
+ run: async (ctx) => {
138
+ if (await api.isEmailTaken(ctx.value as string)) {
139
+ throw new Error('Email already taken');
140
+ }
141
+ return ctx.value;
142
+ },
143
+ });
144
+
145
+ container.mount('email', isEmailUnique);
146
+ ```
147
+
148
+ Bare functions stay fully supported — `mount('foo', fn)` normalizes them to `{ run: fn }` internally with no behavior change. Use `defineValidator` when you need the metadata.
149
+
119
150
  ### Containers
120
151
 
121
152
  A `Container<T, C>` holds an ordered list of mounts and runs them against an input object. The optional generic `T` constrains mount keys and shapes the resolved output; the optional `C` types the caller-supplied [context](#context).
@@ -395,7 +426,7 @@ await container.run({ name: '', count: 0 }); // ✅ name skipped, count validat
395
426
 
396
427
  ## oneOf Branches
397
428
 
398
- A container created with `{ oneOf: true }` succeeds if **any one** of its mounts succeeds. Failures are aggregated into a single `IssueGroup` only when **all** branches fail.
429
+ A container created with `{ oneOf: true }` succeeds if **any one** of its mounts succeeds. Failures are aggregated into a single `IssueGroup` (code `one_of_failed`) only when **all** branches fail, and each branch's contribution is wrapped in its own sub-group so consumers can recover per-branch identity.
399
430
 
400
431
  ```typescript
401
432
  const credential = new Container({ oneOf: true });
@@ -407,9 +438,20 @@ await credential.run({ email: 'peter@example.com' });
407
438
  // → { email: 'peter@example.com' } — username branch failure is ignored
408
439
 
409
440
  await credential.run({ email: 'not-an-email', username: 'invalid' });
410
- // → throws ValidupError with one IssueGroup (code: 'one_of_failed')
441
+ // → throws ValidupError. error.issues is shaped:
442
+ // [
443
+ // {
444
+ // type: 'group', code: 'one_of_failed', path: [],
445
+ // issues: [
446
+ // { type: 'group', path: [], data: { branch: 0, name: 'email' }, issues: [...] },
447
+ // { type: 'group', path: [], data: { branch: 1, name: 'username' }, issues: [...] },
448
+ // ],
449
+ // },
450
+ // ]
411
451
  ```
412
452
 
453
+ The per-branch sub-group's `data.branch` is the mount index (in registration order) and `data.name` is the mount path. Use `flattenIssueItems(error.issues)` for a flat list of leaf failures regardless of branch, or walk the sub-groups when you need to report which branch failed and why.
454
+
413
455
  ## Path Filtering
414
456
 
415
457
  Limit or exclude paths at runtime:
@@ -481,7 +523,55 @@ try {
481
523
 
482
524
  `safeRun()` rethrows the abort reason (it is never wrapped into a `Result.failure`) so callers can distinguish "validation failed" from "operation cancelled".
483
525
 
484
- ## Parallel Execution
526
+ ## Result Caching
527
+
528
+ `Container.run` (and every other run variant) accepts an optional `cache: ResultCache`. When supplied, validator mounts whose `(ctx.value, ctx.context, ctx.group)` snapshot matches a prior invocation are skipped — their cached outcome is replayed instead of re-running the validator. Particularly valuable for forms with slow async validators (network round-trips, regex-heavy schemas): submit-time validation doesn't pay the cost of re-running mounts whose inputs the per-keystroke runs already proved fresh.
529
+
530
+ ```typescript
531
+ import { Container, ResultCache, defineValidator } from 'validup';
532
+
533
+ const container = new Container<{ email: string }>();
534
+ let calls = 0;
535
+ container.mount('email', defineValidator({
536
+ run: async (ctx) => {
537
+ calls += 1;
538
+ await new Promise((r) => setTimeout(r, 100));
539
+ return ctx.value;
540
+ },
541
+ }));
542
+
543
+ const cache = new ResultCache();
544
+ const data = { email: 'peter@example.com' };
545
+
546
+ await container.run(data, { cache });
547
+ await container.run(data, { cache });
548
+ // calls === 1 — the second invocation hits the cache
549
+ ```
550
+
551
+ **Opt out per validator** with `sideEffect: true` (via `defineValidator` or an adapter's `{ sideEffect: true }` option) for cross-field validators, network calls, or anything else whose result depends on inputs the snapshot doesn't capture. The cache is caller-owned — `Container` never holds a reference, so the lifecycle (per-request / per-form / persistent) is entirely up to you. Implement `IResultCache` directly for LRU eviction, TTL, etc.
552
+
553
+ See [the Caching guide](https://validup.tada5hi.net/guide/caching) for the full snapshot semantics and lifecycle patterns.
554
+
555
+ ## Run Modes
556
+
557
+ Four methods — `container.run` / `container.runSync` / `container.safeRun` / `container.safeRunSync` — plus a `parallel` flag on the async ones cover three orthogonal axes: **sync vs async**, **throw vs no-throw `Result`**, and **sequential vs parallel** (async only):
558
+
559
+ | Need | Call | Returns |
560
+ |---------------------------------------------------|-----------------------------------------------|-----------------------|
561
+ | Async, throws on validation failure (default) | `container.run(input, opts)` | `Promise<T>` |
562
+ | Async, throws, parallel mounts | `container.run(input, { parallel: true })` | `Promise<T>` |
563
+ | Async, no-throw `Result` | `container.safeRun(input, opts)` | `Promise<Result<T>>` |
564
+ | Async, no-throw, parallel mounts | `container.safeRun(input, { parallel: true })`| `Promise<Result<T>>` |
565
+ | Sync, throws on validation failure | `container.runSync(input, opts)` | `T` |
566
+ | Sync, no-throw `Result` | `container.safeRunSync(input, opts)` | `Result<T>` |
567
+
568
+ `sync + parallel` is intentionally not a combination — `Promise.allSettled` is async by definition, and sync graphs don't benefit from concurrency.
569
+
570
+ **When `safe*` still throws:** the abort reason from `options.signal`, and the structural `RunSyncViolationError` from `safeRunSync` when a validator returns a Promise or a nested container doesn't implement `runSync`. Both bypass the issue-folding path so callers can distinguish them from validation outcomes.
571
+
572
+ Details on each axis below.
573
+
574
+ ### Parallel Execution
485
575
 
486
576
  By default mounts run sequentially in registration order. For containers whose mounts hit independent slow async resources (multiple DB lookups, HTTP calls), opt into parallel mode:
487
577
 
@@ -493,7 +583,7 @@ All mounts kick off concurrently and the results merge in registration order —
493
583
 
494
584
  **Trade-off**: in parallel mode each mount captures its `value` from the input `data` *before* any sibling mount runs, so a later mount can no longer read an earlier mount's transformed `output[key]`. Stick with sequential mode (the default) for chained-key sanitize-then-validate patterns.
495
585
 
496
- ## Safe Run
586
+ ### Safe Run
497
587
 
498
588
  `safeRun()` returns a discriminated `Result<T>` instead of throwing — handy when you want to deal with errors without `try/catch`:
499
589
 
@@ -507,7 +597,7 @@ if (result.success) {
507
597
  }
508
598
  ```
509
599
 
510
- ## Sync Fast Path
600
+ ### Sync Fast Path
511
601
 
512
602
  When every mounted validator (and every nested container's `runSync`) is synchronous, use `runSync()` / `safeRunSync()` to skip the per-mount microtask overhead of `await`:
513
603
 
@@ -519,7 +609,7 @@ const out = container.runSync(input); // returns T directly, not Promise<T>
519
609
 
520
610
  ## Localized Messages
521
611
 
522
- `Issue.message` is rendered eagerly in English at construction time. For i18n / custom locales, every issue also carries a structured `params?: Record<string, unknown>` field (populated by the runtime where the message references a non-trivial value — e.g. `{ name: 'email' }` on the wrapping group at a failing mount). Pair it with `formatIssue` and a `code → template` map to render at the consumer side:
612
+ `Issue.message` is rendered eagerly in English at construction time. For i18n / custom locales, every issue also carries a structured `data?: Record<string, unknown>` field (populated by the runtime where the message references a non-trivial value — e.g. `{ name: 'email' }` on the wrapping group at a failing mount). Pair it with `formatIssue` and a `code → template` map to render at the consumer side:
523
613
 
524
614
  ```typescript
525
615
  import { formatIssue, type IssueMessageTemplates } from 'validup';
@@ -536,11 +626,11 @@ for (const issue of error.issues) {
536
626
 
537
627
  `formatIssue(issue, templates?, fallback?)`:
538
628
 
539
- 1. If `templates[issue.code]` exists, returns `interpolate(template, issue.params)` (placeholders use the `{name}` syntax from `@ebec/core`).
629
+ 1. If `templates[issue.code]` exists, returns `interpolate(template, issue.data)` (placeholders use the `{name}` syntax from `@ebec/core`).
540
630
  2. Otherwise returns `issue.message`.
541
631
  3. Otherwise returns `fallback`.
542
632
 
543
- Custom validators that want to participate in this flow should pass `params` through `defineIssueItem`/`defineIssueGroup` so consumer-side templates can reference field-specific values. The default `interpolate` is also re-exported for ad-hoc rendering.
633
+ Custom validators that want to participate in this flow should pass `data` through `defineIssueItem`/`defineIssueGroup` so consumer-side templates can reference field-specific values. The default `interpolate` is also re-exported for ad-hoc rendering.
544
634
 
545
635
  ## Error Handling
546
636
 
@@ -615,25 +705,57 @@ const group = defineIssueGroup({
615
705
 
616
706
  ### Issue Codes
617
707
 
618
- | Code | When |
619
- |-------------------------------|-------------------------------------------------------|
620
- | `IssueCode.VALUE_INVALID` | Default for any `defineIssueItem(...)` without a code |
621
- | `IssueCode.ONE_OF_FAILED` | All branches of a `oneOf` container failed |
622
-
623
- The `IssueCode` const exposes the well-known runtime values; the matching `IssueCode` *type* (declaration-merged with the `IssueCodeRegistry` interface) gives autocomplete on `IssueItem.code`. Third-party packages can register their own codes:
708
+ validup ships a vocabulary of well-known issue codes that adapter packages (`@validup/zod`, `@validup/validator-js`, …) map onto and that i18n catalogs (`@ilingo/validup`) translate from. The vocabulary tracks the common ground across vuelidate, zod, joi, and yup — enough that a translation catalog can ship one localized string per code instead of a generic "invalid value" fallback.
709
+
710
+ | Theme | Code | When | `data` |
711
+ |-------|------|------|----------|
712
+ | **Generic / structural** | `VALUE_INVALID` | Default for any `defineIssueItem(...)` without a code | — |
713
+ | | `ONE_OF_FAILED` | All branches of a `oneOf` container failed (the wrapping group; per-branch sub-groups carry `{ branch, name }`) | — |
714
+ | **Presence** | `REQUIRED` | Value is missing, `undefined`, `null`, or empty | — |
715
+ | **Type assertions** | `ALPHA` | Value contains characters outside the alphabetical set | — |
716
+ | | `ALPHA_NUM` | Value contains characters outside the alphanumeric set | — |
717
+ | | `NUMERIC` | Value is not a number | — |
718
+ | | `INTEGER` | Value is not an integer | — |
719
+ | | `DECIMAL` | Value is not a decimal number | — |
720
+ | **Length** (strings, arrays) | `MIN_LENGTH` | Value is shorter than the configured minimum | `{ min: number }` |
721
+ | | `MAX_LENGTH` | Value is longer than the configured maximum | `{ max: number }` |
722
+ | **Numeric range** | `MIN_VALUE` | Numeric value is below the configured minimum | `{ min: number }` |
723
+ | | `MAX_VALUE` | Numeric value is above the configured maximum | `{ max: number }` |
724
+ | | `BETWEEN` | Numeric value falls outside `[min, max]` | `{ min: number, max: number }` |
725
+ | **String format** | `EMAIL` | Value is not a valid email address | — |
726
+ | | `URL` | Value is not a valid URL | — |
727
+ | | `IP_ADDRESS` | Value is not a valid IP address | — |
728
+ | | `MAC_ADDRESS` | Value is not a valid MAC address | — |
729
+ | | `UUID` | Value is not a valid UUID | — |
730
+ | | `DATE` | Value is not a valid / parseable date | — |
731
+ | | `PATTERN` | Value does not match the expected regex | `{ pattern: string }` |
732
+ | | `JSON` | Value is not valid JSON | — |
733
+ | | `BASE64` | Value is not valid base64 | — |
734
+ | | `STRONG_PASSWORD` | Value doesn't meet the configured strength rules | `{ minLength?, minLowercase?, minUppercase?, minNumbers?, minSymbols? }` |
735
+ | **Comparison** | `SAME_AS` | Value must equal another named field's value (e.g. password-confirm) | `{ other: string }` |
736
+
737
+ Adapters are responsible for mapping foreign codes onto the vocabulary — e.g. `@validup/zod`'s adapter translates zod's `too_small` (string variant) onto `IssueCode.MIN_LENGTH`. When a foreign code has no direct match, the adapter falls back to `IssueCode.VALUE_INVALID` and the consumer-side template uses the eagerly-rendered English `issue.message`.
738
+
739
+ The `IssueCode` const exposes the runtime values; the matching `IssueCode` *type* (a derived `typeof IssueCode[keyof typeof IssueCode]`) gives autocomplete on `IssueItem.code`. For project-specific codes — `'email_taken'`, `'rate_limited'` — `IssueItem.code` is widened to `IssueCode | (string & {})` so the literal string is accepted without ceremony:
624
740
 
625
741
  ```typescript
626
- declare module 'validup' {
627
- interface IssueCodeRegistry {
628
- EMAIL_TAKEN: 'email_taken';
629
- }
630
- }
631
-
632
742
  defineIssueItem({ code: 'email_taken', path: ['email'], message: '…' });
633
- // → autocompletes 'email_taken' alongside the built-ins
743
+ // → accepted; downstream code paths treat it like any other code
634
744
  ```
635
745
 
636
- Codes that don't need a registry entry still work — `IssueItem.code` is widened to `IssueCode | (string & {})` so ad-hoc strings stay valid.
746
+ If you want a typed const for your own codes (so `AppCode.EMAIL_TAKEN` autocompletes alongside `AppCode.REQUIRED`), define one alongside the shipped vocabulary:
747
+
748
+ ```typescript
749
+ import { IssueCode } from 'validup';
750
+
751
+ export const AppCode = {
752
+ ...IssueCode,
753
+ EMAIL_TAKEN: 'email_taken',
754
+ RATE_LIMITED: 'rate_limited',
755
+ } as const;
756
+
757
+ export type AppCode = typeof AppCode[keyof typeof AppCode];
758
+ ```
637
759
 
638
760
  ## API Reference
639
761
 
@@ -651,12 +773,15 @@ class Container<
651
773
  mount(key: Path<T>, data: IContainer | Validator<C>): void;
652
774
  mount(key: Path<T>, options: MountOptions, data: IContainer | Validator<C>): void;
653
775
 
654
- run(input?: Record<string, any>, options?: ContainerRunOptions<T, C>): Promise<T>;
655
- safeRun(input?: Record<string, any>, options?: ContainerRunOptions<T, C>): Promise<Result<T>>;
776
+ // `input` is typed `Partial<T>` so a form narrower than the validator's
777
+ // entity type (e.g. a create-form against `Container<User>` where `id` /
778
+ // `createdAt` are server-set) type-checks without a cast.
779
+ run(input?: Partial<T>, options?: ContainerRunOptions<T, C>): Promise<T>;
780
+ safeRun(input?: Partial<T>, options?: ContainerRunOptions<T, C>): Promise<Result<T>>;
656
781
 
657
782
  // Sync variants — throw if any validator returns a Promise.
658
- runSync(input?: Record<string, any>, options?: ContainerRunOptions<T, C>): T;
659
- safeRunSync(input?: Record<string, any>, options?: ContainerRunOptions<T, C>): Result<T>;
783
+ runSync(input?: Partial<T>, options?: ContainerRunOptions<T, C>): T;
784
+ safeRunSync(input?: Partial<T>, options?: ContainerRunOptions<T, C>): Result<T>;
660
785
  }
661
786
  ```
662
787
 
@@ -691,10 +816,62 @@ See [Builder API](#builder-api-compile-time-typing). Each `.mount(...)` call ret
691
816
  |-----------------------|------------------------------------------------------|
692
817
  | `defineIssueItem` | Construct an `IssueItem` (sets `type`, default code) |
693
818
  | `defineIssueGroup` | Construct an `IssueGroup` (sets `type`) |
694
- | `IssueCode` | Built-in issue codes (`VALUE_INVALID`, `ONE_OF_FAILED`) |
819
+ | `createValidupError` | Build a `ValidupError` carrying one `IssueItem` (sugar for the most common single-issue failure shape). Caller throws. |
820
+ | `IssueCode` | Vocabulary of well-known issue codes (`VALUE_INVALID`, `REQUIRED`, `MIN_LENGTH`, …; full table above) |
695
821
  | `GroupKey` | `WILDCARD = '*'` |
696
822
  | `OptionalValue` | `UNDEFINED` / `NULL` / `FALSY` |
697
823
 
824
+ ### Validator Composition
825
+
826
+ ```typescript
827
+ import { compose, composeOneOf, type ComposeOptions, type ComposeElement } from 'validup';
828
+
829
+ type ComposeElement<C = unknown> = Validator<C> | IContainer<any, any>;
830
+
831
+ function compose<C = unknown>(
832
+ elements: ComposeElement<C>[],
833
+ options?: ComposeOptions,
834
+ ): Validator<C>;
835
+
836
+ function composeOneOf<C = unknown>(
837
+ elements: ComposeElement<C>[],
838
+ ): Validator<C>;
839
+ ```
840
+
841
+ Build a single `Validator` from many. Each element can be a bare `Validator<C>` function OR a fully-built `IContainer<T, C>` instance — the dispatcher picks the right call shape (containers receive the threaded value as their input, validators receive `ctx`). The strategy is picked via `options.oneOf`:
842
+
843
+ - **`oneOf: false`** (default) — every element must pass. Stages thread their return value into the next so sanitize-then-validate patterns work; `options.bail` controls fail-fast (`true`, default) vs. collect-all (`false`).
844
+ - **`oneOf: true`** — branches run as alternatives in registration order; the first one to succeed wins, subsequent branches are not invoked, and the composed validator returns the winning branch's value. When every branch fails, the composed validator throws a `ValidupError` whose first issue is an `IssueGroup` with `code: IssueCode.ONE_OF_FAILED` carrying every branch's failures (each tagged with `data: { branch }`). `bail` is rejected at the type level under this mode — there's no chain to fail-fast over.
845
+
846
+ `composeOneOf([...])` is sugar for `compose([...], { oneOf: true })`.
847
+
848
+ ```typescript
849
+ // sanitize-then-validate
850
+ container.mount('email', compose([trim(), isEmail(), isLength({ max: 254 })]));
851
+
852
+ // every broken rule surfaces in one pass
853
+ container.mount('password', compose([
854
+ isLength({ min: 8 }),
855
+ isAlphanumeric(),
856
+ matches(/[0-9]/),
857
+ ], { bail: false }));
858
+
859
+ // accept either an email or a phone number on the same field
860
+ container.mount('contact', composeOneOf([isEmail(), isMobilePhone()]));
861
+
862
+ // any-of with a container branch — accept a string-formatted contact
863
+ // OR a nested address object validated by its own container.
864
+ container.mount('contact', composeOneOf([
865
+ isEmail(),
866
+ isMobilePhone(),
867
+ addressContainer,
868
+ ]));
869
+ ```
870
+
871
+ Threading notes:
872
+ - A stage that returns `undefined` is treated as a pass-through — the upstream value continues down the chain. Validators that DO want to explicitly clear the field must throw or return a sentinel.
873
+ - Container elements receive `ctx.value` as their `input` (normalised to `{}` for non-object values, matching how a nested container mounted directly handles a non-object mount value). Their `path` / `group` / `context` / `signal` flow from the threaded `ctx`, so issues from a container branch carry absolute paths from the outer mount (`composeOneOf` mounted at `foo` with a child schema's `street` field surfaces issues at `['foo', 'street']`).
874
+
698
875
  ### Type Guards
699
876
 
700
877
  | Export | Returns |
@@ -714,9 +891,33 @@ Use one of the official integration packages to bridge an existing validator lib
714
891
  |--------------------------------------------------------------------------------------|--------------------------------------------------------------------------------|
715
892
  | [`@validup/standard-schema`](https://npmjs.com/package/@validup/standard-schema) | Any [Standard Schema](https://standardschema.dev) library — zod 3.24+, valibot, arktype, effect-schema, … |
716
893
  | [`@validup/zod`](https://npmjs.com/package/@validup/zod) | [zod](https://zod.dev) schemas (vendor-specific issue mapping with `expected` / `received`) |
717
- | [`@validup/express-validator`](https://npmjs.com/package/@validup/express-validator) | [express-validator](https://express-validator.github.io) chains |
894
+ | [`@validup/validator-js`](https://npmjs.com/package/@validup/validator-js) | [validator.js](https://github.com/validatorjs/validator.js) string validators — pre-baked factories per common rule, plus a generic `createValidator(fn, {...})` for the long tail |
718
895
  | [`@validup/vue`](https://npmjs.com/package/@validup/vue) | [Vue 3](https://vuejs.org) composable for reactive client-side form state |
719
896
 
897
+ ## Stability
898
+
899
+ What's covered by semver:
900
+
901
+ - **Public exports** — everything re-exported from `validup`'s entry barrel (`Container`, `defineSchema`, `ValidupError`, `Issue` / factories / guards, `IssueCode`, `GroupKey`, `OptionalValue`, helpers in `formatIssue` / `flattenIssue*`).
902
+ - **`Container` runtime contract** — `run` / `runSync` / `runParallel` (via `parallel: true`) / `safeRun` / `safeRunSync`, including their throw-contracts as documented on `IContainer` (`safeRun` throws only on abort).
903
+ - **`Issue` and `ValidupError` shape** — the discriminated union (`type: 'item' | 'group'`), `data`, `meta`, `code` widening to `IssueCode | (string & {})`.
904
+ - **Mount API** — variadic `mount(...)` argument forms listed in [Mounting](#mounting).
905
+ - **`oneOf` aggregation shape** — `IssueCode.ONE_OF_FAILED` group wrapping per-branch sub-groups (see [oneOf Branches](#oneof-branches)).
906
+
907
+ Extension points:
908
+
909
+ - **`IssueCode` widening** — `IssueItem.code` accepts any `string & {}` so consumers can use project-specific codes without ceremony. Define your own const that spreads `IssueCode` for typed autocomplete on your codes (see [Issue Codes](#issue-codes)).
910
+ - **`Validator<C, Out>`** — `C` (context) and `Out` (return type) generics participate in builder inference; defaults stay `unknown`.
911
+ - **`IContainer`** — opt-in interface; integration packages can implement it to be mountable as a nested container.
912
+ - **`isContainer` / `isValidupError`** — duck-typed guards that tolerate package duplicates and cross-realm throws. Prefer these over `instanceof` at boundaries.
913
+
914
+ Internal (no semver guarantee):
915
+
916
+ - Anything not re-exported from `src/index.ts`, including private helpers (`recordMountError`, `finalizeOutput`, etc.) and the `RunSyncViolationError` class.
917
+ - Default English `Issue.message` strings — re-render via `formatIssue` and a `code → template` map if you depend on specific wording.
918
+
919
+ Deprecation policy: a removal lands in at least one minor release as a deprecation (JSDoc `@deprecated` + console warning where feasible) before the next major drops it.
920
+
720
921
  ## License
721
922
 
722
923
  Made with 💚