validup 1.0.0 → 2.0.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
@@ -166,7 +166,13 @@ When validation fails, the container throws a `ValidupError` containing a list o
166
166
  type Issue = IssueItem | IssueGroup;
167
167
  ```
168
168
 
169
- This recursive structure preserves the path of failure, so consumers can render rich field-level error messages.
169
+ This recursive structure preserves the path of failure, so consumers can render rich field-level error messages. Every node carries an **absolute** path — a leaf three groups deep still reads `['user', 'contact', 'email']` — so `flattenIssueItems` produces a directly indexable list with no tree walk needed.
170
+
171
+ > **Where the model lives.** `Issue`, `IssueItem`, `IssueGroup`, `IssueCode`, `IssueDataByCode`, the `defineIssue*` factories, the `isIssue*` guards, `flattenIssue*`, `prefixIssuePath`, `formatIssue` and `interpolate` come from [**`@ebec/core`**](https://github.com/tada5hi/ebec) — an extensible error-class library that also owns the issue model.
172
+ >
173
+ > They live outside validup so other libraries can share the shape without taking on validup's runtime. Issue trees then compose across libraries, because both sides reference the same types rather than agreeing by structural coincidence.
174
+ >
175
+ > **Import them from `@ebec/core`** — `npm install @ebec/core --save`. As of v2.0.0, `validup` no longer re-exports the model; the examples below import from `@ebec/core` directly. Every `@validup/*` integration package already depends on it directly.
170
176
 
171
177
  ## Builder API (compile-time typing)
172
178
 
@@ -656,7 +662,7 @@ const out = container.runSync(input); // returns T directly, not Promise<T>
656
662
  `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:
657
663
 
658
664
  ```typescript
659
- import { formatIssue, type IssueMessageTemplates } from 'validup';
665
+ import { formatIssue, type IssueMessageTemplates } from '@ebec/core';
660
666
 
661
667
  const de: IssueMessageTemplates = {
662
668
  value_invalid: 'Feld {name} ist ungültig',
@@ -670,11 +676,13 @@ for (const issue of error.issues) {
670
676
 
671
677
  `formatIssue(issue, templates?, fallback?)`:
672
678
 
673
- 1. If `templates[issue.code]` exists, returns `interpolate(template, issue.data)` (placeholders use the `{name}` syntax from `@ebec/core`).
679
+ 1. If `templates[issue.code]` exists, returns `interpolate(template, issue.data)` (placeholders use the `{name}` syntax — single braces).
674
680
  2. Otherwise returns `issue.message`.
675
681
  3. Otherwise returns `fallback`.
676
682
 
677
- 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.
683
+ A catalog may be partial: a code it does not cover falls back to that issue's own `message`, per issue rather than all-or-nothing.
684
+
685
+ Custom validators that want to participate in this flow should pass `data` through `defineIssueItem`/`defineIssueGroup` so consumer-side templates can reference field-specific values. `interpolate` is also re-exported for ad-hoc rendering.
678
686
 
679
687
  ## Error Handling
680
688
 
@@ -695,7 +703,7 @@ class ValidupError extends BaseError {
695
703
 
696
704
  Subclass `ValidupError` (or `BaseError` directly) when you need a domain-specific code — ebec derives it from the class name automatically.
697
705
 
698
- Use `isValidupError(err)` to check across package boundaries. It is duck-typed (instanceof OR has a valid `issues` array), so it tolerates the case where two copies of `validup` exist in the dependency tree.
706
+ Use `isValidupError(err)` to check across package boundaries. It matches `instanceof ValidupError`, then the error's `@instanceof` marker chain — which also covers a duplicate copy of `validup` in the dependency tree and a `ValidupError` rehydrated from `toJSON()` output — and only falls back to duck-typing when neither matches: a non-empty `issues` array whose members all look like `Issue`s, or an empty one on an error whose `code` is `'VALIDUP_ERROR'` (covers a zero-issue `ValidupError` from before the marker existed, e.g. validup <= 2.0.0). A bare empty `issues` array with no `VALIDUP_ERROR` code is not sufficient: every `@ebec/core` `BaseError` (and therefore every `@ebec/http` error) carries an `issues` array by default.
699
707
 
700
708
  ```typescript
701
709
  import { isValidupError } from 'validup';
@@ -731,7 +739,7 @@ interface IssueGroup {
731
739
  Use the factories — they set `type` correctly and apply default codes:
732
740
 
733
741
  ```typescript
734
- import { defineIssueItem, defineIssueGroup, IssueCode } from 'validup';
742
+ import { defineIssueItem, defineIssueGroup, IssueCode } from '@ebec/core';
735
743
 
736
744
  const item = defineIssueItem({
737
745
  path: ['email'],
@@ -790,7 +798,7 @@ defineIssueItem({ code: 'email_taken', path: ['email'], message: '…' });
790
798
  If you want a typed const for your own codes (so `AppCode.EMAIL_TAKEN` autocompletes alongside `AppCode.REQUIRED`), define one alongside the shipped vocabulary:
791
799
 
792
800
  ```typescript
793
- import { IssueCode } from 'validup';
801
+ import { IssueCode } from '@ebec/core';
794
802
 
795
803
  export const AppCode = {
796
804
  ...IssueCode,
@@ -862,6 +870,7 @@ See [Builder API](#builder-api-compile-time-typing). Each `.mount(...)` call ret
862
870
  |-----------------------|------------------------------------------------------|
863
871
  | `defineIssueItem` | Construct an `IssueItem` (sets `type`, default code) |
864
872
  | `defineIssueGroup` | Construct an `IssueGroup` (sets `type`) |
873
+ | `prefixIssuePath` | Rebase an issue onto a parent path, recursing into groups. Call it when merging issues from a sub-structure into a larger tree — it is what keeps every node's `path` absolute |
865
874
  | `createValidupError` | Build a `ValidupError` carrying one `IssueItem` (sugar for the most common single-issue failure shape). Caller throws. |
866
875
  | `IssueCode` | Vocabulary of well-known issue codes (`VALUE_INVALID`, `REQUIRED`, `MIN_LENGTH`, …; full table above) |
867
876
  | `GroupKey` | `WILDCARD = '*'` |
@@ -944,7 +953,7 @@ Use one of the official integration packages to bridge an existing validator lib
944
953
 
945
954
  What's covered by semver:
946
955
 
947
- - **Public exports** — everything re-exported from `validup`'s entry barrel (`Container`, `defineSchema`, `ValidupError`, `Issue` / factories / guards, `IssueCode`, `GroupKey`, `OptionalValue`, helpers in `formatIssue` / `flattenIssue*`).
956
+ - **Public exports** — everything re-exported from `validup`'s entry barrel (`Container`, `defineSchema`, `ValidupError`, `isValidupError`, `createValidupError`, `GroupKey`, `OptionalValue`, and the rest of `src/index.ts`). As of v2.0.0, the issue model itself (`Issue` / factories / guards, `IssueCode`, `formatIssue`, `flattenIssue*`, `prefixIssuePath`) is **not** part of this list — it is owned and versioned by [`@ebec/core`](https://github.com/tada5hi/ebec), not re-exported from `validup`.
948
957
  - **`Container` runtime contract** — `run` / `runSync` / `runParallel` (via `parallel: true`) / `safeRun` / `safeRunSync`, including their throw-contracts as documented on `IContainer` (`safeRun` throws only on abort).
949
958
  - **`Issue` and `ValidupError` shape** — the discriminated union (`type: 'item' | 'group'`), `data`, `meta`, `code` widening to `IssueCode | (string & {})`.
950
959
  - **Mount API** — variadic `mount(...)` argument forms listed in [Mounting](#mounting).
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { BaseError, interpolate } from "@ebec/core";
1
+ import { BareIssueCode, BaseError, Issue, IssueCode, IssueDataByCode, IssueGroup, ParameterizedIssueCode, ResolveIssueCode } from "@ebec/core";
2
2
  import { Path } from "pathtrace";
3
3
  //#region src/cache/types.d.ts
4
4
  /**
@@ -141,422 +141,8 @@ declare enum OptionalValue {
141
141
  FALSY = "falsy"
142
142
  }
143
143
  //#endregion
144
- //#region src/issue/constants.d.ts
145
- /**
146
- * Vocabulary of well-known issue codes. Adapter packages map foreign
147
- * validator codes onto these so consumer-side translation catalogs
148
- * (e.g. `@ilingo/validup`) can ship one localized message per code
149
- * instead of falling back to a generic "invalid value" fallback.
150
- *
151
- * Tracks the common ground between vuelidate, zod, joi, and yup. The
152
- * core lifts from vuelidate's catalog (snake_cased to match validup's
153
- * convention); modern format codes (`PATTERN`, `UUID`, `DATE`,
154
- * `JSON`, `BASE64`, `STRONG_PASSWORD`, …) cover ground vuelidate
155
- * predates. Every format code names the format positively (`UUID`,
156
- * `EMAIL`, `URL`, …) rather than the failure mode (`NOT_UUID`,
157
- * `INVALID_EMAIL`) so the registry reads consistently.
158
- *
159
- * Ad-hoc / project-specific codes still work — `IssueItem.code` is
160
- * widened to `IssueCode | (string & {})`, so `defineIssueItem({ code:
161
- * 'email_taken', ... })` is valid. If you want a typed const for your
162
- * own codes, define one alongside this one:
163
- *
164
- * ```ts
165
- * import { IssueCode } from 'validup';
166
- *
167
- * export const AppCode = {
168
- * ...IssueCode,
169
- * EMAIL_TAKEN: 'email_taken',
170
- * } as const;
171
- * ```
172
- *
173
- * Each entry's JSDoc documents the structured `data` adapters should
174
- * attach when constructing the issue — templates can rely on those
175
- * placeholders being present (`{{min}}`, `{{max}}`, `{{other}}`, etc.).
176
- */
177
- declare const IssueCode: {
178
- /** Generic fallback when no more-specific code applies. `data`: — */
179
- readonly VALUE_INVALID: "value_invalid";
180
- /** Every branch of a `oneOf` container failed. `data`: — */
181
- readonly ONE_OF_FAILED: "one_of_failed";
182
- /** Value is missing, `undefined`, `null`, or empty per the validator's semantics. `data`: — */
183
- readonly REQUIRED: "required";
184
- /** Value contains characters outside the alphabetical set. `data`: — */
185
- readonly ALPHA: "alpha";
186
- /** Value contains characters outside the alphanumeric set. `data`: — */
187
- readonly ALPHA_NUM: "alpha_num";
188
- /** Value is not a number. `data`: — */
189
- readonly NUMERIC: "numeric";
190
- /** Value is not an integer. `data`: — */
191
- readonly INTEGER: "integer";
192
- /** Value is not a decimal number. `data`: — */
193
- readonly DECIMAL: "decimal";
194
- /** Value is shorter than the configured minimum. `data`: `{ min: number }` */
195
- readonly MIN_LENGTH: "min_length";
196
- /** Value is longer than the configured maximum. `data`: `{ max: number }` */
197
- readonly MAX_LENGTH: "max_length";
198
- /** Numeric value is below the configured minimum. `data`: `{ min: number }` */
199
- readonly MIN_VALUE: "min_value";
200
- /** Numeric value is above the configured maximum. `data`: `{ max: number }` */
201
- readonly MAX_VALUE: "max_value";
202
- /** Numeric value falls outside the configured `[min, max]` range. `data`: `{ min: number, max: number }` */
203
- readonly BETWEEN: "between";
204
- /** Value is not a valid email address. `data`: — */
205
- readonly EMAIL: "email";
206
- /** Value is not a valid URL. `data`: — */
207
- readonly URL: "url";
208
- /** Value is not a valid IP address. `data`: — */
209
- readonly IP_ADDRESS: "ip_address";
210
- /** Value is not a valid MAC address. `data`: — */
211
- readonly MAC_ADDRESS: "mac_address";
212
- /** Value is not a valid UUID. `data`: — */
213
- readonly UUID: "uuid";
214
- /** Value is not a valid date / cannot be parsed as a date. `data`: — */
215
- readonly DATE: "date";
216
- /**
217
- * Value does not match the expected regex pattern. `data`:
218
- * `{ pattern: string }` — source of the regex without flags so
219
- * catalogs can quote it in human-readable form.
220
- */
221
- readonly PATTERN: "pattern";
222
- /** Value is not valid JSON. `data`: — */
223
- readonly JSON: "json";
224
- /** Value is not valid base64. `data`: — */
225
- readonly BASE64: "base64";
226
- /**
227
- * Value does not meet the configured strong-password rules. `data`:
228
- * `{ minLength?: number, minLowercase?: number, minUppercase?: number,
229
- * minNumbers?: number, minSymbols?: number }` — only the keys the
230
- * adapter chose to surface; missing keys mean "the default for that
231
- * setting wasn't configured."
232
- */
233
- readonly STRONG_PASSWORD: "strong_password";
234
- /**
235
- * Value must equal another named field's value (sibling-field assertion,
236
- * e.g. password-confirm). `data`: `{ other: string }` — the name of
237
- * the field being compared against.
238
- */
239
- readonly SAME_AS: "same_as";
240
- };
241
- type IssueCode = typeof IssueCode[keyof typeof IssueCode];
242
- /**
243
- * Per-code `data` contract for the well-known vocabulary. Producers
244
- * (`defineIssueItem`, `createValidupError`, adapter `error.ts` modules)
245
- * thread this through their type signatures so TS rejects mismatched
246
- * payloads at compile time — e.g. `STRONG_PASSWORD` with `data:
247
- * { pointsPerUnique: 5 }` (a validator.js scoring weight, not a strength
248
- * requirement) fails to type-check. Codes absent from this map carry no
249
- * `data`; ad-hoc string codes fall back to the open
250
- * `Record<string, unknown>` shape on the raw `IssueItem` branch.
251
- *
252
- * Extensible via TypeScript declaration merging — third-party adapters
253
- * and apps that want typed data for their own codes can augment this
254
- * interface, and the producer-side gatekeep (`defineIssueItem`,
255
- * `createValidupError`) will type-check their payloads too:
256
- *
257
- * ```ts
258
- * // In a third-party package or app:
259
- * declare module 'validup' {
260
- * interface IssueDataByCode {
261
- * email_taken: { existingUserId: string };
262
- * }
263
- * }
264
- *
265
- * defineIssueItem({
266
- * code: 'email_taken',
267
- * path: ['email'],
268
- * message: 'Already in use',
269
- * data: { existingUserId: 'u_42' }, // typed and required
270
- * });
271
- * ```
272
- *
273
- * Keep entries here in lockstep with the JSDoc on the corresponding
274
- * `IssueCode` entry — the type-level enforcement and the documentation
275
- * are two views of the same contract.
276
- */
277
- interface IssueDataByCode {
278
- min_length: {
279
- min: number;
280
- };
281
- max_length: {
282
- max: number;
283
- };
284
- min_value: {
285
- min: number;
286
- };
287
- max_value: {
288
- max: number;
289
- };
290
- between: {
291
- min: number;
292
- max: number;
293
- };
294
- pattern: {
295
- pattern: string;
296
- };
297
- strong_password: {
298
- minLength?: number;
299
- minLowercase?: number;
300
- minUppercase?: number;
301
- minNumbers?: number;
302
- minSymbols?: number;
303
- };
304
- same_as: {
305
- other: string;
306
- };
307
- }
308
- /**
309
- * `IssueCode` values that carry a documented `data` payload — keys of
310
- * {@link IssueDataByCode}. Producers using one of these codes must
311
- * supply the matching `data` shape.
312
- */
313
- type ParameterizedIssueCode = keyof IssueDataByCode;
314
- /**
315
- * `IssueCode` values that carry no `data` (`VALUE_INVALID`, `EMAIL`,
316
- * `REQUIRED`, …). Producers using one of these codes must omit `data`
317
- * (or pass `undefined`).
318
- */
319
- type BareIssueCode = Exclude<IssueCode, ParameterizedIssueCode>;
320
- //#endregion
321
- //#region src/issue/types.d.ts
322
- /**
323
- * Resolve a possibly-`undefined` `code` to its effective vocabulary entry.
324
- * When a producer (`defineIssueItem`, `createValidupError`) is called
325
- * without a `code`, the runtime defaults to `IssueCode.VALUE_INVALID`;
326
- * this helper reflects that at the type level so the conditional-type
327
- * signatures pick the bare-data branch instead of the raw catch-all.
328
- *
329
- * `[C] extends [undefined]` is the standard idiom for testing the whole
330
- * `C` against `undefined` *without* distributing over union members.
331
- */
332
- type ResolveIssueCode<C> = [C] extends [undefined] ? typeof IssueCode.VALUE_INVALID : C & string;
333
- interface IssueBase {
334
- /**
335
- * Out-of-band provenance about how this issue came to exist — context the
336
- * consumer cannot reconstruct from `path` + the container's mount config.
337
- *
338
- * Library-owned keys (stable, semver-protected):
339
- *
340
- * - `optional?: true` — set by the runtime when the originating mount's
341
- * `optional` declaration resolves truthy for the current value:
342
- *
343
- * - `optional: true` → tagged
344
- * - `optional: false` → not tagged (matches the runtime's truthy filter)
345
- * - `optional: (v) => boolean` → predicate is invoked with the current
346
- * value; tagged iff it returns truthy. In practice the run loop only
347
- * enters the error path when the predicate has already returned
348
- * false (otherwise the validator would have been skipped), so
349
- * predicate-optional issues effectively never carry the flag today.
350
- * - `optional: undefined` → not tagged
351
- *
352
- * Reflects only the most-local mount, never inherited from a parent:
353
- * a leaf inside an optional child container does NOT carry the flag
354
- * unless its own mount also evaluated truthy. Set on direct leaf
355
- * emissions and on the wrapping `IssueGroup` produced for the mount
356
- * itself; never set on issues that bubbled up unchanged through
357
- * `prefixIssuePath`.
358
- * - `external?: true` — set by frameworks that inject server-side issues
359
- * (e.g. `@validup/vue`'s `setExternalIssues`). Distinguishes
360
- * server-supplied from validator-supplied so consumers can render the
361
- * distinction.
362
- *
363
- * Apps and third-party validators may add their own keys (e.g.
364
- * `app.componentId`) — the open-shape `Record<string, unknown>` is
365
- * intentional. New library-owned keys must pass the bar above:
366
- * provenance, not derivable from path + container config. Presentation
367
- * tokens (e.g. `severity`) do not qualify and live in consumer code.
368
- */
369
- meta?: Record<string, unknown>;
370
- /**
371
- * Issue path.
372
- */
373
- path: PropertyKey[];
374
- /**
375
- * Default-rendered message (eager, English). Use `formatIssue` with a
376
- * `code → template` map for localized re-rendering at the consumer side.
377
- */
378
- message: string;
379
- /**
380
- * Structured parameters used by the default `message` rendering and
381
- * available to consumer-side formatters (i18n, custom locales). The
382
- * concrete shape depends on the discriminating `code` — see the
383
- * `IssueItem` union below for the per-code contract.
384
- */
385
- data?: Record<string, unknown>;
386
- }
387
- /**
388
- * Shared shape for every `IssueItem` branch — the discriminant (`type:
389
- * 'item'`) plus the vendor-passthrough fields. The `code` and `data`
390
- * fields are intentionally absent here; each branch in the discriminated
391
- * union below pins them to the right pair.
392
- */
393
- interface IssueItemCommon extends IssueBase {
394
- /**
395
- * Issue Type
396
- */
397
- type: 'item';
398
- /**
399
- * Received input value.
400
- */
401
- received?: unknown;
402
- /**
403
- * Expected input value.
404
- */
405
- expected?: unknown;
406
- }
407
- /**
408
- * Typed-data branch — one variant per `ParameterizedIssueCode`. The
409
- * `data` shape is locked to the documented contract via
410
- * {@link IssueDataByCode}.
411
- *
412
- * Distributed (rather than written as a single `code: ParameterizedIssueCode`
413
- * member) so that `Extract<IssueItem, { code: 'min_length' }>` and structural
414
- * narrowing on `issue.code === IssueCode.MIN_LENGTH` resolve to the right
415
- * concrete variant with `data: { min: number }`, not the joined union.
416
- */
417
- type IssueItemTyped = { [K in ParameterizedIssueCode]: IssueItemCommon & {
418
- code: K;
419
- data: IssueDataByCode[K];
420
- }; }[ParameterizedIssueCode];
421
- /**
422
- * Bare-data branch — one variant per `BareIssueCode`. `data` must be
423
- * absent (or explicitly `undefined`).
424
- *
425
- * Distributed for the same reason as {@link IssueItemTyped} — so
426
- * `Extract<IssueItem, { code: 'email' }>` resolves to the single
427
- * `code: 'email'` variant.
428
- */
429
- type IssueItemBare = { [K in BareIssueCode]: IssueItemCommon & {
430
- code: K;
431
- data?: undefined;
432
- }; }[BareIssueCode];
433
- /**
434
- * Escape-hatch branch — ad-hoc / project-specific codes outside the
435
- * shipped vocabulary. `code: string & {}` keeps autocomplete on the
436
- * `IssueCode` literals while permitting strings the typed branches don't
437
- * cover; `data` is fully open.
438
- *
439
- * Note: because `string & {}` accepts any string at the type level,
440
- * narrowing on `issue.code === IssueCode.MIN_LENGTH` still pulls this
441
- * branch in alongside the matching `IssueItemTyped` variant. The
442
- * producer-side `defineIssueItem` / `createValidupError` signatures
443
- * gatekeep this so emission is always correct; consumers needing a
444
- * clean narrow should cast `issue.data` after the code check.
445
- */
446
- interface IssueItemRaw extends IssueItemCommon {
447
- code: string & {};
448
- data?: Record<string, unknown>;
449
- }
450
- /**
451
- * Discriminated union over `IssueItem`'s three branches:
452
- *
453
- * - {@link IssueItemTyped} — known parameterized codes (`MIN_LENGTH`,
454
- * `PATTERN`, `STRONG_PASSWORD`, …); `data` is required and typed.
455
- * - {@link IssueItemBare} — known param-less codes (`EMAIL`, `REQUIRED`,
456
- * …); `data` must be absent.
457
- * - {@link IssueItemRaw} — ad-hoc string codes; `data` is open.
458
- *
459
- * The discriminant is `code`. Build issues with `defineIssueItem` (typed
460
- * overloads enforce the per-branch contract) rather than constructing
461
- * literals by hand.
462
- */
463
- type IssueItem = IssueItemTyped | IssueItemBare | IssueItemRaw;
464
- interface IssueGroup extends IssueBase {
465
- /**
466
- * Code identifying the issue. See `IssueItem.code` for the
467
- * vocabulary + ad-hoc widening conventions.
468
- */
469
- code?: IssueCode | (string & {});
470
- /**
471
- * Issue Type
472
- */
473
- type: 'group';
474
- /**
475
- * Child issues
476
- */
477
- issues: Issue[];
478
- }
479
- type Issue = IssueGroup | IssueItem;
480
- //#endregion
481
- //#region src/issue/check.d.ts
482
- declare function isIssueItem(input: unknown): input is IssueItem;
483
- declare function isIssueGroup(input: unknown): input is IssueGroup;
484
- declare function isIssue(input: unknown): input is Issue;
485
- //#endregion
486
- //#region src/issue/define.d.ts
487
- interface DefineIssueItemCommon extends Omit<IssueBase, 'data'> {
488
- received?: unknown;
489
- expected?: unknown;
490
- }
491
- /**
492
- * Per-call `data` shape for {@link defineIssueItem}. The `data`
493
- * requirement is selected from the resolved `code`:
494
- *
495
- * - Parameterized code → `data` required, typed per {@link IssueDataByCode}.
496
- * - Bare code (incl. omitted, which resolves to `VALUE_INVALID`)
497
- * → `data` must be absent / `undefined`.
498
- * - Ad-hoc string code → `data` optional `Record`.
499
- */
500
- type DefineIssueItemData<C> = DefineIssueItemCommon & {
501
- code?: C;
502
- } & (ResolveIssueCode<C> extends ParameterizedIssueCode ? {
503
- data: IssueDataByCode[ResolveIssueCode<C> & ParameterizedIssueCode];
504
- } : ResolveIssueCode<C> extends BareIssueCode ? {
505
- data?: undefined;
506
- } : {
507
- data?: Record<string, unknown>;
508
- });
509
- /**
510
- * Return type for {@link defineIssueItem} — picks the concrete `IssueItem`
511
- * variant matching the resolved `code`.
512
- */
513
- type DefineIssueItemReturn<C> = ResolveIssueCode<C> extends ParameterizedIssueCode ? Extract<IssueItemTyped, {
514
- code: ResolveIssueCode<C>;
515
- }> : ResolveIssueCode<C> extends BareIssueCode ? Extract<IssueItemBare, {
516
- code: ResolveIssueCode<C>;
517
- }> : IssueItemRaw;
518
- /**
519
- * Build an `IssueItem`. TS uses the supplied `code` to pick the right
520
- * `data` requirement at the call site — passing `MIN_LENGTH` without
521
- * `data: { min }` is a compile error; passing `STRONG_PASSWORD` with
522
- * `data: { pointsPerUnique: 5 }` is a compile error.
523
- *
524
- * `code` may be omitted (defaults to `IssueCode.VALUE_INVALID` — bare,
525
- * no data).
526
- */
527
- declare function defineIssueItem<C extends string | undefined = undefined>(data: DefineIssueItemData<C>): DefineIssueItemReturn<C>;
528
- declare function defineIssueGroup(data: Omit<IssueGroup, 'type'>): IssueGroup;
529
- //#endregion
530
- //#region src/issue/flatten.d.ts
531
- declare function flattenIssueItems(issues: Issue[]): IssueItem[];
532
- declare function flattenIssueGroups(issues: Issue[]): IssueGroup[];
533
- //#endregion
534
- //#region src/issue/format.d.ts
535
- /**
536
- * Map of issue `code` → message template. Templates use `{name}` placeholders
537
- * — the same syntax `@ebec/core`'s `interpolate` understands — and are
538
- * resolved against `Issue.data` at format time.
539
- *
540
- * ```ts
541
- * const de: IssueMessageTemplates = {
542
- * value_invalid: 'Wert ist ungültig',
543
- * one_of_failed: 'Keine der Varianten war erfolgreich',
544
- * };
545
- * ```
546
- */
547
- type IssueMessageTemplates = Partial<Record<IssueCode, string>> & Record<string, string>;
548
- /**
549
- * Render an issue's user-facing message.
550
- *
551
- * Resolution order:
552
- * 1. If `templates[code]` exists, return `interpolate(template, issue.data)`.
553
- * 2. Else return `issue.message` (the default English rendering set at
554
- * construction time).
555
- * 3. Else return `fallback`.
556
- */
557
- declare function formatIssue(issue: Issue, templates?: IssueMessageTemplates, fallback?: string): string;
558
- //#endregion
559
144
  //#region src/error/base.d.ts
145
+ declare const VALIDUP_ERROR_INSTANCE: unique symbol;
560
146
  declare class ValidupError extends BaseError {
561
147
  readonly issues: Issue[];
562
148
  constructor(issues?: Issue[]);
@@ -1631,16 +1217,6 @@ declare class Container<T extends Record<string, any> = Record<string, any>, C =
1631
1217
  * expand to for the given `data`.
1632
1218
  */
1633
1219
  private assertPathsStrict;
1634
- /**
1635
- * Prepend `keyParts` to a child issue's `path` and — when the child is
1636
- * an `IssueGroup` — recurse into its nested issues so every leaf carries
1637
- * the parent prefix. Without recursion, a child container that already
1638
- * wrapped its own multi-issue mount in a group (or a `oneOf` child) would
1639
- * surface inner items with paths missing the parent segment, breaking
1640
- * downstream consumers that rely on `flattenIssueItems` for per-field
1641
- * lookup (e.g. `@validup/vue`).
1642
- */
1643
- private prefixIssuePath;
1644
1220
  /**
1645
1221
  * Translate a throw raised by one execution step (one validator or
1646
1222
  * nested-container invocation, from the surrounding `run` loop) into
@@ -1850,5 +1426,5 @@ declare function hasOwnProperty<X extends {}, Y extends PropertyKey>(obj: X, pro
1850
1426
  //#region src/utils/object.d.ts
1851
1427
  declare function isObject(input: unknown): input is Record<string, any>;
1852
1428
  //#endregion
1853
- export { BareIssueCode, BaseMount, BuildOneOfFailedGroupOptions, Builder, ComposeElement, ComposeOptions, Container, ContainerInput, ContainerMount, ContainerOptions, ContainerRunOptions, ErrorToIssuesOptions, GroupKey, IBuilder, IContainer, IResultCache, IsOptional, Issue, IssueBase, IssueCode, IssueDataByCode, IssueGroup, IssueItem, IssueItemBare, IssueItemRaw, IssueItemTyped, IssueMessageTemplates, Mount, MountOptions, MountTarget, Mounted, ObjectLiteral, OptionalValue, OptionalValueInput, ParameterizedIssueCode, PathFilterResolution, PathsStrictViolationError, PathsStrictViolationInput, ResolveIssueCode, Result, ResultCache, ResultCacheEntry, ResultCacheOutcome, ResultCacheSnapshot, ResultFailure, ResultSuccess, Spread, Validator, ValidatorContext, ValidatorDescriptor, ValidatorMount, ValidupError, buildErrorMessageForAttribute, buildErrorMessageForAttributes, buildOneOfFailedGroup, compose, composeOneOf, createValidupError, defineIssueGroup, defineIssueItem, defineSchema, defineValidator, errorToIssues, flattenIssueGroups, flattenIssueItems, formatIssue, hasOwnProperty, interpolate, isContainer, isError, isIssue, isIssueGroup, isIssueItem, isObject, isOptionalValue, isPathsStrictViolation, isResultCache, isValidatorDescriptor, isValidupError, resolveDefaults, resolvePathFilter, stringifyPath };
1429
+ export { BaseMount, BuildOneOfFailedGroupOptions, Builder, ComposeElement, ComposeOptions, Container, ContainerInput, ContainerMount, ContainerOptions, ContainerRunOptions, ErrorToIssuesOptions, GroupKey, IBuilder, IContainer, IResultCache, IsOptional, Mount, MountOptions, MountTarget, Mounted, ObjectLiteral, OptionalValue, OptionalValueInput, PathFilterResolution, PathsStrictViolationError, PathsStrictViolationInput, Result, ResultCache, ResultCacheEntry, ResultCacheOutcome, ResultCacheSnapshot, ResultFailure, ResultSuccess, Spread, VALIDUP_ERROR_INSTANCE, Validator, ValidatorContext, ValidatorDescriptor, ValidatorMount, ValidupError, buildErrorMessageForAttribute, buildErrorMessageForAttributes, buildOneOfFailedGroup, compose, composeOneOf, createValidupError, defineSchema, defineValidator, errorToIssues, hasOwnProperty, isContainer, isError, isObject, isOptionalValue, isPathsStrictViolation, isResultCache, isValidatorDescriptor, isValidupError, resolveDefaults, resolvePathFilter, stringifyPath };
1854
1430
  //# sourceMappingURL=index.d.mts.map