validup 0.3.0 → 0.4.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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["interpolate"],"sources":["../src/helpers/defaults.ts","../src/helpers/error.ts","../src/constants.ts","../src/helpers/optional-value.ts","../src/helpers/path-filter.ts","../src/helpers/path-stringify.ts","../src/error/base.ts","../src/utils/has-own-property.ts","../src/utils/object.ts","../src/issue/check.ts","../src/issue/constants.ts","../src/issue/define.ts","../src/issue/flatten.ts","../src/issue/format.ts","../src/error/check.ts","../src/container/check.ts","../src/container/run-sync-violation.ts","../src/container/module.ts","../src/builder/module.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\n/**\n * Slice a parent `defaults` map down to entries that target paths inside a\n * single nested container mount, with the mount-key prefix stripped so the\n * child sees them as local keys. Exact-key matches (the default targets the\n * mount root itself) are skipped — the parent's post-loop fill handles those\n * once the child has returned, since the child is run with `flat: true` and\n * cannot address its own root.\n */\nexport function resolveDefaults(\n defaults: Record<string, any> | undefined,\n key: string,\n): Record<string, any> | undefined {\n if (typeof defaults === 'undefined') {\n return undefined;\n }\n if (key.length === 0) {\n return defaults;\n }\n\n const output: Record<string, any> = {};\n let matched = false;\n const keys = Object.keys(defaults);\n for (const k of keys) {\n if (k.startsWith(`${key}.`)) {\n output[k.slice(key.length + 1)] = defaults[k];\n matched = true;\n }\n }\n return matched ? output : undefined;\n}\n","/*\n * Copyright (c) 2024.\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 { distinctArray } from 'smob';\n\nexport function buildErrorMessageForAttribute(key: PropertyKey) {\n return `Property ${String(key)} is invalid`;\n}\n\nexport function buildErrorMessageForAttributes(input: PropertyKey[] | Record<string, any>) {\n let names: PropertyKey[];\n if (Array.isArray(input)) {\n names = distinctArray(input);\n } else {\n names = Object.keys(input);\n }\n\n if (names.length === 0) {\n return 'Properties are invalid';\n }\n\n if (names.length > 1) {\n return `Properties ${names.join(', ')} are invalid.`;\n }\n\n return buildErrorMessageForAttribute(names[0]);\n}\n","/*\n * Copyright (c) 2024.\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\nexport enum GroupKey {\n WILDCARD = '*',\n}\n\nexport enum OptionalValue {\n /**\n * value: undefined\n */\n UNDEFINED = 'undefined',\n /**\n * value: null & undefined\n */\n NULL = 'null',\n /**\n * value: empty string, false, 0\n */\n FALSY = 'falsy',\n}\n","/*\n * Copyright (c) 2024.\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 { OptionalValue } from '../constants';\n\n/**\n * Check if input value (type of) satisfies optional value type constraint.\n *\n * @param value\n * @param optionalValue\n */\nexport function isOptionalValue(\n value: unknown,\n optionalValue?: `${OptionalValue}`,\n) {\n const optionValueNormalized = optionalValue || OptionalValue.UNDEFINED;\n\n if (optionValueNormalized === OptionalValue.NULL) {\n return value === null || typeof value === 'undefined';\n }\n\n if (optionValueNormalized === OptionalValue.UNDEFINED) {\n return typeof value === 'undefined';\n }\n\n return !value;\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\nexport type PathFilterResolution = {\n skip: boolean,\n pathsToInclude: string[] | undefined,\n pathsToExclude: string[] | undefined,\n};\n\n/**\n * Resolve `pathsToInclude` / `pathsToExclude` against a single mounted item's\n * (already-expanded) local `key`. Returns whether to skip the item, plus the\n * filter sub-lists to forward into a child container — with the parent prefix\n * stripped so the child can match purely against its own local keys.\n *\n * Semantics:\n * - Un-keyed container mount (`key === ''`) shares the parent's namespace, so\n * filters are forwarded verbatim.\n * - Exact match in `pathsToInclude` / `pathsToExclude` matches the whole mount.\n * - Prefix match (`<key>.…`) only descends into container mounts; leaf\n * validators with deeper-target filters fall through (skipped for include,\n * kept for exclude).\n */\nexport function resolvePathFilter(\n pathsToInclude: string[] | undefined,\n pathsToExclude: string[] | undefined,\n key: string,\n isContainer: boolean,\n): PathFilterResolution {\n if (key.length === 0) {\n return {\n skip: false,\n pathsToInclude,\n pathsToExclude,\n };\n }\n\n let includeForward: string[] | undefined;\n if (typeof pathsToInclude !== 'undefined') {\n let exact = false;\n const stripped: string[] = [];\n for (const path of pathsToInclude) {\n if (path === key) {\n exact = true;\n } else if (isContainer && path.startsWith(`${key}.`)) {\n stripped.push(path.slice(key.length + 1));\n }\n }\n if (exact) {\n includeForward = undefined;\n } else if (stripped.length > 0) {\n includeForward = stripped;\n } else {\n return {\n skip: true,\n pathsToInclude: undefined,\n pathsToExclude: undefined,\n };\n }\n }\n\n let excludeForward: string[] | undefined;\n if (typeof pathsToExclude !== 'undefined') {\n const stripped: string[] = [];\n for (const path of pathsToExclude) {\n if (path === key) {\n return {\n skip: true,\n pathsToInclude: undefined,\n pathsToExclude: undefined,\n };\n }\n if (isContainer && path.startsWith(`${key}.`)) {\n stripped.push(path.slice(key.length + 1));\n }\n }\n if (stripped.length > 0) {\n excludeForward = stripped;\n }\n }\n\n return {\n skip: false,\n pathsToInclude: includeForward,\n pathsToExclude: excludeForward,\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 { arrayToPath } from 'pathtrace';\n\n/**\n * Stringify path array to string.\n *\n * @param input\n */\nexport function stringifyPath(input: PropertyKey[]) : string {\n return arrayToPath(input);\n}\n","/*\n * Copyright (c) 2024-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 { BaseError } from '@ebec/core';\nimport { buildErrorMessageForAttributes, stringifyPath } from '../helpers';\nimport type { Issue } from '../issue';\n\nexport class ValidupError extends BaseError {\n readonly issues: Issue[];\n\n constructor(issues: Issue[] = []) {\n const paths = issues.map((issue) => stringifyPath(issue.path));\n super({ message: buildErrorMessageForAttributes(paths) });\n\n this.issues = issues;\n }\n\n override toJSON(): ReturnType<BaseError['toJSON']> & { issues: Issue[] } {\n return {\n ...super.toJSON(),\n issues: this.issues,\n };\n }\n}\n","/*\n * Copyright (c) 2024.\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\nexport function hasOwnProperty<X extends {}, Y extends PropertyKey>(obj: X, prop: Y): obj is X & Record<Y, unknown> {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n","/*\n * Copyright (c) 2024.\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\nexport function isObject(input: unknown) : input is Record<string, any> {\n return !!input &&\n typeof input === 'object' &&\n !Array.isArray(input);\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 { isObject } from '../utils';\nimport type {\n Issue, \n IssueBase, \n IssueGroup, \n IssueItem,\n} from './types';\n\nfunction isIssuePath(input: unknown) : input is PropertyKey[] {\n if (!Array.isArray(input)) {\n return false;\n }\n\n return input.every((el) => typeof el === 'string' ||\n typeof el === 'number' ||\n typeof el === 'symbol');\n}\n\nfunction isBaseIssue(input: unknown) : input is IssueBase & { [ke: string]: any } {\n if (!isObject(input)) {\n return false;\n }\n\n if (typeof input.message !== 'string') {\n return false;\n }\n\n if (!isIssuePath(input.path)) {\n return false;\n }\n\n return typeof input.meta === 'undefined' ||\n isObject(input.meta);\n}\n\nexport function isIssueItem(input: unknown) : input is IssueItem {\n if (!isBaseIssue(input)) {\n return false;\n }\n\n if (input.type !== 'item') {\n return false;\n }\n\n return typeof input.code === 'string';\n}\n\nexport function isIssueGroup(input: unknown) : input is IssueGroup {\n if (!isBaseIssue(input)) {\n return false;\n }\n\n if (input.type !== 'group') {\n return false;\n }\n\n return Array.isArray(input.issues) &&\n input.issues.every((issue) => isIssueItem(issue) || isIssueGroup(issue));\n}\n\nexport function isIssue(input: unknown) : input is Issue {\n return isIssueGroup(input) || isIssueItem(input);\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\n/**\n * Registry of well-known issue codes. Third-party packages can extend the\n * union via TypeScript declaration merging:\n *\n * ```ts\n * declare module 'validup' {\n * interface IssueCodeRegistry {\n * email_taken: 'email_taken';\n * }\n * }\n * ```\n *\n * After augmentation, `IssueCode` widens to include the new literal so\n * `defineIssueItem({ code: 'email_taken', ... })` is type-checked.\n */\nexport interface IssueCodeRegistry {\n VALUE_INVALID: 'value_invalid',\n ONE_OF_FAILED: 'one_of_failed',\n}\n\nexport type IssueCode = IssueCodeRegistry[keyof IssueCodeRegistry];\n\nexport const IssueCode = {\n VALUE_INVALID: 'value_invalid',\n ONE_OF_FAILED: 'one_of_failed',\n} as const satisfies { [K in keyof IssueCodeRegistry]: IssueCodeRegistry[K] };\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 { IssueCode } from './constants';\nimport type { IssueGroup, IssueItem } from './types';\n\ntype PartialProps<T extends Record<PropertyKey, any>, K extends keyof T> = Pick<T, Exclude<keyof T, K>> & Partial<Pick<T, K>>;\n\nexport function defineIssueItem(data: Omit<PartialProps<IssueItem, 'code'>, 'type'>): IssueItem {\n return {\n type: 'item',\n ...data,\n code: data.code || IssueCode.VALUE_INVALID,\n };\n}\n\nexport function defineIssueGroup(data: Omit<IssueGroup, 'type'>): IssueGroup {\n return {\n type: 'group',\n ...data,\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 { isIssueGroup, isIssueItem } from './check';\nimport type { Issue, IssueGroup, IssueItem } from './types';\n\nexport function flattenIssueItems(issues: Issue[]): IssueItem[] {\n const output: IssueItem[] = [];\n for (const issue of issues) {\n if (isIssueItem(issue)) {\n output.push(issue);\n } else {\n output.push(...flattenIssueItems(issue.issues));\n }\n }\n return output;\n}\n\nexport function flattenIssueGroups(issues: Issue[]): IssueGroup[] {\n const output: IssueGroup[] = [];\n for (const issue of issues) {\n if (isIssueGroup(issue)) {\n output.push(issue);\n output.push(...flattenIssueGroups(issue.issues));\n }\n }\n return output;\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 { interpolate } from '@ebec/core';\nimport type { IssueCode } from './constants';\nimport type { Issue } from './types';\n\n/**\n * Map of issue `code` → message template. Templates use `{name}` placeholders\n * — the same syntax `@ebec/core`'s `interpolate` understands — and are\n * resolved against `Issue.params` at format time.\n *\n * ```ts\n * const de: IssueMessageTemplates = {\n * value_invalid: 'Wert ist ungültig',\n * one_of_failed: 'Keine der Varianten war erfolgreich',\n * };\n * ```\n */\nexport type IssueMessageTemplates = Partial<Record<IssueCode, string>> & Record<string, string>;\n\n/**\n * Render an issue's user-facing message.\n *\n * Resolution order:\n * 1. If `templates[code]` exists, return `interpolate(template, issue.params)`.\n * 2. Else return `issue.message` (the default English rendering set at\n * construction time).\n * 3. Else return `fallback`.\n */\nexport function formatIssue(\n issue: Issue,\n templates?: IssueMessageTemplates,\n fallback: string = '',\n): string {\n if (templates && issue.code) {\n const template = templates[issue.code];\n if (typeof template === 'string') {\n return interpolate(template, issue.params || {});\n }\n }\n if (typeof issue.message === 'string' && issue.message.length > 0) {\n return issue.message;\n }\n return fallback;\n}\n\n// Re-export ebec's `interpolate` so consumers writing custom formatters don't\n// need a direct dependency on `@ebec/core`. Same `{name}` placeholder syntax.\nexport { interpolate } from '@ebec/core';\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 { isIssue } from '../issue';\nimport { hasOwnProperty, isObject } from '../utils';\nimport { ValidupError } from './base';\n\nexport function isError(input: unknown) : input is Error & { [key: string]: any } {\n // Primary check: anything that walks like an Error in this realm.\n // Keeps cross-realm fallbacks (e.g. errors from another iframe / vm\n // context where `instanceof Error` is false) duck-typed via the\n // `message` shape — which also matches `ValidupError`-shaped throws\n // from a duplicate copy of the package.\n if (input instanceof Error) {\n return true;\n }\n\n if (!isObject(input)) {\n return false;\n }\n\n return typeof input.message === 'string' && typeof input.name === 'string';\n}\n\nexport function isValidupError(error: unknown) : error is ValidupError {\n if (!isError(error)) {\n return false;\n }\n\n if (error instanceof ValidupError) {\n return true;\n }\n\n if (!hasOwnProperty(error, 'issues')) {\n return false;\n }\n\n return Array.isArray(error.issues) &&\n error.issues.every((issue) => isIssue(issue));\n}\n","/*\n * Copyright (c) 2025.\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 { isObject } from '../utils';\nimport type { IContainer } from './types';\n\nexport function isContainer(input: unknown) : input is IContainer {\n return isObject(input) &&\n typeof input.run === 'function' &&\n typeof input.safeRun === 'function';\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\n/**\n * Thrown by `Container.runSync` when a validator returns a Promise or a\n * nested container does not implement `runSync`. Marked separately from\n * generic `Error` so the per-mount catch can re-throw it instead of folding\n * it into the issue list (otherwise users would get \"Property X is invalid\"\n * instead of the structural diagnostic).\n *\n * Internal — not exported from the package barrel.\n */\nexport class RunSyncViolationError extends Error {\n override readonly name = 'RunSyncViolationError';\n}\n\n/**\n * Duck-typed check — robust against `instanceof` mismatches when a duplicate\n * copy of the package exists in the dependency tree, or when the throw\n * crosses a realm boundary. Mirrors the `isValidupError` pattern.\n */\nexport function isRunSyncViolation(e: unknown): e is RunSyncViolationError {\n if (e instanceof RunSyncViolationError) {\n return true;\n }\n return (\n typeof e === 'object' &&\n e !== null &&\n (e as { name?: unknown }).name === 'RunSyncViolationError'\n );\n}\n","/*\n * Copyright (c) 2024-2025.\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 type { Path } from 'pathtrace';\nimport {\n expandPath, \n getPathValue, \n pathToArray, \n setPathValue,\n} from 'pathtrace';\nimport { GroupKey } from '../constants';\nimport { ValidupError, isError, isValidupError } from '../error';\nimport {\n buildErrorMessageForAttribute,\n isOptionalValue,\n resolveDefaults,\n resolvePathFilter,\n} from '../helpers';\nimport type { Validator } from '../types';\nimport { hasOwnProperty, isObject } from '../utils';\nimport { isContainer } from './check';\nimport type {\n ContainerOptions,\n ContainerRunOptions,\n IContainer,\n Mount,\n MountOptions,\n Result,\n} from './types';\nimport type { Issue } from '../issue';\nimport { IssueCode, defineIssueGroup, defineIssueItem } from '../issue';\nimport { RunSyncViolationError, isRunSyncViolation } from './run-sync-violation';\n\nexport class Container<\n T extends Record<string, any> = Record<string, any>,\n C = unknown,\n> implements IContainer<T, C> {\n protected options : ContainerOptions<T>;\n\n protected items : Mount<C>[];\n\n // ----------------------------------------------\n\n constructor(options: ContainerOptions<T> = {}) {\n this.options = options;\n this.items = [];\n\n this.initialize();\n }\n\n // ----------------------------------------------\n\n mount(container: IContainer<any, any>) : void;\n\n mount(\n options: MountOptions,\n container: IContainer<any, any>\n ): void;\n\n mount(\n key: Path<T> | (string & {}),\n data: IContainer<any, any> | Validator<C>\n ) : void;\n\n mount(\n key: Path<T> | (string & {}),\n options: MountOptions,\n data: IContainer<any, any> | Validator<C>\n ) : void;\n\n mount(...args: any[]) : void {\n if (args.length < 1) {\n throw new SyntaxError('The mount method requires at least one argument');\n }\n\n let path : string | undefined;\n\n let data: IContainer<any, any> | Validator<C> | undefined;\n let dataIsContainer : boolean = false;\n\n let options: MountOptions = {};\n\n for (const arg of args) {\n if (typeof arg === 'string') {\n path = arg;\n continue;\n }\n\n if (typeof arg === 'function') {\n data = arg;\n continue;\n }\n\n if (isContainer(arg)) {\n data = arg;\n dataIsContainer = true;\n continue;\n }\n\n if (isObject(arg)) {\n options = arg;\n }\n }\n\n if (\n !dataIsContainer &&\n (typeof path === 'undefined' || path.length === 0)\n ) {\n throw new SyntaxError('Only a container can be mounted without a key.');\n }\n\n if (typeof data === 'undefined') {\n throw new SyntaxError('No container/validator could be extracted from the fn arguments.');\n }\n\n if (isContainer(data)) {\n this.items.push({\n options,\n data,\n path,\n type: 'container',\n });\n\n return;\n }\n\n this.items.push({\n options,\n data: data as Validator<C>,\n path,\n type: 'validator',\n });\n }\n\n // ----------------------------------------------\n\n /**\n * @throws ValidupError\n *\n * @param data\n * @param options\n */\n async run(\n data: Record<string, any> = {},\n options: ContainerRunOptions<T, C> = {},\n ): Promise<T> {\n if (options.parallel) {\n return this.runParallel(data, options);\n }\n\n const { pathsToInclude, pathsToExclude } = this.resolveContainerFilters(options);\n\n const output: Record<string, any> = {};\n const issues: Issue[] = [];\n\n let itemCount = 0;\n let errorCount = 0;\n\n for (let i = 0; i < this.items.length; i++) {\n // Pre-mount abort check — cheap and short-circuits cleanly without\n // entering the per-mount try/catch (so aborts don't get rewritten\n // into validation issues).\n options.signal?.throwIfAborted();\n\n const item = this.items[i];\n\n if (!this.isItemGroupIncluded(item, options.group)) {\n continue;\n }\n\n let pathCount = 0;\n let pathFailed = false;\n\n const keys: string[] = item.path ? expandPath(data, item.path) : [''];\n\n for (const key of keys) {\n const keyParts = key ? pathToArray(key) : [];\n\n const pathRelative = keyParts.at(-1);\n const pathAbsolute = [\n ...(options.path ? options.path : []),\n ...keyParts,\n ];\n\n let value: unknown;\n if (key.length > 0) {\n value = hasOwnProperty(output, key) ?\n output[key] :\n getPathValue(data, key);\n } else {\n value = data;\n }\n\n const filter = resolvePathFilter(\n pathsToInclude,\n pathsToExclude,\n key,\n item.type === 'container',\n );\n if (filter.skip) {\n continue;\n }\n\n try {\n const isOptional = typeof item.options.optional === 'function' ?\n item.options.optional(value) :\n item.options.optional &&\n isOptionalValue(value, item.options.optionalValue);\n\n if (isOptional) {\n if (item.options.optionalInclude) {\n output[key] = value;\n }\n } else if (item.type === 'container') {\n const tmp = await item.data.run(\n isObject(value) ? value : {},\n {\n group: options.group,\n flat: true,\n path: pathAbsolute,\n pathsToInclude: filter.pathsToInclude,\n pathsToExclude: filter.pathsToExclude,\n defaults: resolveDefaults(options.defaults, key),\n context: options.context,\n signal: options.signal,\n },\n );\n\n const tmpKeys = Object.keys(tmp);\n for (const tmpKey of tmpKeys) {\n output[this.mergePaths(key, tmpKey)] = tmp[tmpKey];\n }\n } else if (item.type === 'validator') {\n output[key] = await item.data({\n key,\n path: pathAbsolute,\n\n value,\n data,\n group: options.group,\n context: options.context as C,\n signal: options.signal,\n });\n }\n } catch (e) {\n this.recordMountError(e, item, keyParts, pathRelative, issues, options.signal);\n pathFailed = true;\n }\n\n pathCount++;\n }\n\n if (pathCount > 0) {\n itemCount++;\n\n if (pathFailed) {\n errorCount++;\n }\n }\n }\n\n return this.finalizeOutput(output, options, issues, errorCount, itemCount);\n }\n\n /**\n * Parallel-execution variant of `run()`. All mounts kick off their\n * promises eagerly and the results are merged after `Promise.allSettled`.\n * See `ContainerRunOptions.parallel` for the trade-off note.\n */\n private async runParallel(\n data: Record<string, any>,\n options: ContainerRunOptions<T, C>,\n ): Promise<T> {\n const { pathsToInclude, pathsToExclude } = this.resolveContainerFilters(options);\n\n const output: Record<string, any> = {};\n const issues: Issue[] = [];\n\n type KeyTask = {\n key: string,\n keyParts: PropertyKey[],\n pathRelative: PropertyKey | undefined,\n promise: Promise<unknown>,\n kind: 'container' | 'validator',\n };\n\n type ItemGroup = {\n item: Mount<C>,\n tasks: KeyTask[],\n // optional/skip paths that completed inline still count toward\n // the per-item pathCount used for oneOf / errorCount tracking.\n syncPathCount: number,\n };\n\n const itemGroups: ItemGroup[] = [];\n\n for (let i = 0; i < this.items.length; i++) {\n options.signal?.throwIfAborted();\n\n const item = this.items[i];\n if (!this.isItemGroupIncluded(item, options.group)) {\n continue;\n }\n\n const tasks: KeyTask[] = [];\n let syncPathCount = 0;\n\n const keys: string[] = item.path ? expandPath(data, item.path) : [''];\n for (const key of keys) {\n const keyParts = key ? pathToArray(key) : [];\n const pathRelative = keyParts.at(-1);\n const pathAbsolute = [\n ...(options.path ? options.path : []),\n ...keyParts,\n ];\n\n let value: unknown;\n if (key.length > 0) {\n // Parallel mode reads `data` only — `output[key]` from a\n // sibling mount is intentionally NOT consulted (the\n // sibling may not have completed yet).\n value = getPathValue(data, key);\n } else {\n value = data;\n }\n\n const filter = resolvePathFilter(\n pathsToInclude,\n pathsToExclude,\n key,\n item.type === 'container',\n );\n if (filter.skip) {\n continue;\n }\n\n const isOptional = typeof item.options.optional === 'function' ?\n item.options.optional(value) :\n item.options.optional &&\n isOptionalValue(value, item.options.optionalValue);\n\n if (isOptional) {\n if (item.options.optionalInclude) {\n output[key] = value;\n }\n syncPathCount++;\n continue;\n }\n\n let promise: Promise<unknown>;\n if (item.type === 'container') {\n promise = item.data.run(\n isObject(value) ? value : {},\n {\n group: options.group,\n flat: true,\n path: pathAbsolute,\n pathsToInclude: filter.pathsToInclude,\n pathsToExclude: filter.pathsToExclude,\n defaults: resolveDefaults(options.defaults, key),\n context: options.context,\n signal: options.signal,\n parallel: true,\n },\n );\n } else {\n // Wrap sync validators in a microtask so the surrounding\n // `Promise.allSettled` always sees a thenable.\n const itemData = item.data;\n promise = (async () => itemData({\n key,\n path: pathAbsolute,\n value,\n data,\n group: options.group,\n context: options.context as C,\n signal: options.signal,\n }))();\n }\n\n tasks.push({\n key,\n keyParts,\n pathRelative,\n promise,\n kind: item.type,\n });\n }\n\n if (tasks.length > 0 || syncPathCount > 0) {\n itemGroups.push({\n item, \n tasks, \n syncPathCount, \n });\n }\n }\n\n // Wait for all groups concurrently. Promises were already kicked off\n // eagerly above; this just collects their settled state.\n const settledByGroup = await Promise.all(itemGroups.map(\n (group) => Promise.allSettled(group.tasks.map((t) => t.promise)),\n ));\n\n // Re-check the abort signal after settling. Sequential `run`/`runSync`\n // probe between every mount; the parallel variant can only check here\n // and before `finalizeOutput`. Without this, validators that ignore\n // `ctx.signal` would let an aborted run resolve to a successful result.\n options.signal?.throwIfAborted();\n\n let itemCount = 0;\n let errorCount = 0;\n\n for (const [i, {\n item, \n tasks, \n syncPathCount, \n }] of itemGroups.entries()) {\n const settled = settledByGroup[i];\n\n let pathFailed = false;\n for (const [j, task] of tasks.entries()) {\n const result = settled[j];\n\n if (result.status === 'fulfilled') {\n if (task.kind === 'container') {\n const tmp = result.value as Record<string, any>;\n const tmpKeys = Object.keys(tmp);\n for (const tmpKey of tmpKeys) {\n output[this.mergePaths(task.key, tmpKey)] = tmp[tmpKey];\n }\n } else {\n output[task.key] = result.value;\n }\n } else {\n this.recordMountError(\n result.reason,\n item,\n task.keyParts,\n task.pathRelative,\n issues,\n options.signal,\n );\n pathFailed = true;\n }\n }\n\n if (tasks.length + syncPathCount > 0) {\n itemCount++;\n if (pathFailed) {\n errorCount++;\n }\n }\n }\n\n // Final guard before returning a (potentially successful) value — if\n // the run was aborted after the post-settle check but before the merge\n // loop finished, propagate the abort instead of returning stale data.\n options.signal?.throwIfAborted();\n\n return this.finalizeOutput(output, options, issues, errorCount, itemCount);\n }\n\n async safeRun(input: Record<string, any> = {}, options: ContainerRunOptions<T, C> = {}): Promise<Result<T>> {\n try {\n const data = await this.run(input, options);\n return { success: true, data };\n } catch (e) {\n return this.wrapSafeRunError(e, options);\n }\n }\n\n /**\n * @throws ValidupError\n *\n * Synchronous variant of `run()`. Throws synchronously if any validator\n * returns a thenable, or if a nested container does not implement\n * `runSync`. Use it for purely synchronous validator graphs where the\n * microtask overhead of `await` per mount matters (e.g. driving a\n * reactive UI without a `pending` flicker).\n */\n runSync(\n data: Record<string, any> = {},\n options: ContainerRunOptions<T, C> = {},\n ): T {\n const { pathsToInclude, pathsToExclude } = this.resolveContainerFilters(options);\n\n const output: Record<string, any> = {};\n const issues: Issue[] = [];\n\n let itemCount = 0;\n let errorCount = 0;\n\n for (let i = 0; i < this.items.length; i++) {\n options.signal?.throwIfAborted();\n\n const item = this.items[i];\n\n if (!this.isItemGroupIncluded(item, options.group)) {\n continue;\n }\n\n let pathCount = 0;\n let pathFailed = false;\n\n const keys: string[] = item.path ? expandPath(data, item.path) : [''];\n\n for (const key of keys) {\n const keyParts = key ? pathToArray(key) : [];\n\n const pathRelative = keyParts.at(-1);\n const pathAbsolute = [\n ...(options.path ? options.path : []),\n ...keyParts,\n ];\n\n let value: unknown;\n if (key.length > 0) {\n value = hasOwnProperty(output, key) ?\n output[key] :\n getPathValue(data, key);\n } else {\n value = data;\n }\n\n const filter = resolvePathFilter(\n pathsToInclude,\n pathsToExclude,\n key,\n item.type === 'container',\n );\n if (filter.skip) {\n continue;\n }\n\n try {\n const isOptional = typeof item.options.optional === 'function' ?\n item.options.optional(value) :\n item.options.optional &&\n isOptionalValue(value, item.options.optionalValue);\n\n if (isOptional) {\n if (item.options.optionalInclude) {\n output[key] = value;\n }\n } else if (item.type === 'container') {\n const childRunSync = (\n item.data as IContainer<any, any> & {\n runSync?: (...args: any[]) => any\n }\n ).runSync;\n if (typeof childRunSync !== 'function') {\n throw new RunSyncViolationError(`runSync: nested container at \"${key || '<root>'}\" does not implement runSync`);\n }\n\n const tmp = childRunSync.call(item.data, isObject(value) ? value : {}, {\n group: options.group,\n flat: true,\n path: pathAbsolute,\n pathsToInclude: filter.pathsToInclude,\n pathsToExclude: filter.pathsToExclude,\n defaults: resolveDefaults(options.defaults, key),\n context: options.context,\n signal: options.signal,\n });\n\n const tmpKeys = Object.keys(tmp);\n for (const tmpKey of tmpKeys) {\n output[this.mergePaths(key, tmpKey)] = tmp[tmpKey];\n }\n } else if (item.type === 'validator') {\n const result = item.data({\n key,\n path: pathAbsolute,\n\n value,\n data,\n group: options.group,\n context: options.context as C,\n signal: options.signal,\n });\n if (\n result !== null &&\n typeof result === 'object' &&\n typeof (result as { then?: unknown }).then === 'function'\n ) {\n throw new RunSyncViolationError(`runSync: validator at \"${key || '<root>'}\" returned a Promise`);\n }\n output[key] = result;\n }\n } catch (e) {\n this.recordMountError(e, item, keyParts, pathRelative, issues, options.signal);\n pathFailed = true;\n }\n\n pathCount++;\n }\n\n if (pathCount > 0) {\n itemCount++;\n\n if (pathFailed) {\n errorCount++;\n }\n }\n }\n\n return this.finalizeOutput(output, options, issues, errorCount, itemCount);\n }\n\n safeRunSync(input: Record<string, any> = {}, options: ContainerRunOptions<T, C> = {}): Result<T> {\n try {\n const data = this.runSync(input, options);\n return { success: true, data };\n } catch (e) {\n return this.wrapSafeRunError(e, options);\n }\n }\n\n private resolveContainerFilters(options: ContainerRunOptions<T, C>): {\n pathsToInclude: string[] | undefined,\n pathsToExclude: string[] | undefined,\n } {\n let pathsToInclude: string[] | undefined;\n if (options.pathsToInclude) {\n pathsToInclude = options.pathsToInclude as string[];\n } else if (this.options.pathsToInclude) {\n pathsToInclude = this.options.pathsToInclude as string[];\n }\n\n let pathsToExclude: string[] | undefined;\n if (options.pathsToExclude) {\n pathsToExclude = options.pathsToExclude as string[];\n } else if (this.options.pathsToExclude) {\n pathsToExclude = this.options.pathsToExclude as string[];\n }\n\n return { pathsToInclude, pathsToExclude };\n }\n\n /**\n * Prepend `keyParts` to a child issue's `path` and — when the child is\n * an `IssueGroup` — recurse into its nested issues so every leaf carries\n * the parent prefix. Without recursion, a child container that already\n * wrapped its own multi-issue mount in a group (or a `oneOf` child) would\n * surface inner items with paths missing the parent segment, breaking\n * downstream consumers that rely on `flattenIssueItems` for per-field\n * lookup (e.g. `@validup/vue`).\n */\n private prefixIssuePath(issue: Issue, keyParts: PropertyKey[]): Issue {\n const prefixed: Issue = {\n ...issue,\n path: [...keyParts, ...(issue.path || [])],\n };\n if (prefixed.type === 'group') {\n prefixed.issues = prefixed.issues.map(\n (nested) => this.prefixIssuePath(nested, keyParts),\n );\n }\n return prefixed;\n }\n\n /**\n * Translate a per-mount throw into accumulated `issues`. Re-throws when\n * the run was aborted (signal-aware validators) so abort errors are not\n * mangled into validation issues. `keyParts` is the current mount's\n * expanded path (used to prepend to nested `ValidupError` issues).\n */\n private recordMountError(\n e: unknown,\n item: Mount<C>,\n keyParts: PropertyKey[],\n pathRelative: PropertyKey | undefined,\n issues: Issue[],\n signal: AbortSignal | undefined,\n ): void {\n if (signal?.aborted) {\n throw e;\n }\n // Structural runSync violations are not validation outcomes — they\n // mean the caller can't use runSync against this graph. Surface the\n // diagnostic verbatim instead of wrapping it as \"Property X is invalid\".\n if (isRunSyncViolation(e)) {\n throw e;\n }\n\n const childIssues: Issue[] = [];\n\n if (isValidupError(e)) {\n for (let i = 0; i < e.issues.length; i++) {\n childIssues.push(this.prefixIssuePath(e.issues[i], keyParts));\n }\n } else if (isError(e)) {\n childIssues.push(defineIssueItem({\n path: keyParts,\n message: e.message,\n }));\n }\n\n if (pathRelative) {\n if (item.type === 'container' || childIssues.length > 1) {\n issues.push(defineIssueGroup({\n message: buildErrorMessageForAttribute(String(pathRelative)),\n params: { name: String(pathRelative) },\n path: keyParts,\n issues: childIssues,\n }));\n } else {\n issues.push(...childIssues);\n }\n } else {\n issues.push(...childIssues);\n }\n }\n\n /**\n * Apply post-loop semantics: oneOf aggregation, error throw, defaults\n * fill, and flat-vs-nested output expansion.\n */\n private finalizeOutput(\n output: Record<string, any>,\n options: ContainerRunOptions<T, C>,\n issues: Issue[],\n errorCount: number,\n itemCount: number,\n ): T {\n if (this.options.oneOf) {\n // Guard against the \"all branches filtered out\" case (group /\n // pathsToInclude / pathsToExclude can leave itemCount === 0).\n // Without it, a oneOf container with nothing to run would throw\n // ONE_OF_FAILED with an empty issues list.\n if (itemCount > 0 && errorCount === itemCount) {\n const group = defineIssueGroup({\n code: IssueCode.ONE_OF_FAILED,\n message: 'None of the branches succeeded',\n issues,\n path: options.path ? options.path : [],\n });\n throw new ValidupError([group]);\n }\n } else if (errorCount > 0) {\n throw new ValidupError(issues);\n }\n\n if (options.defaults) {\n const defaultKeys = Object.keys(options.defaults);\n for (const defaultKey of defaultKeys) {\n if (\n !hasOwnProperty(output, defaultKey) ||\n typeof output[defaultKey] === 'undefined'\n ) {\n output[defaultKey] = (options.defaults as Record<string, any>)[defaultKey];\n }\n }\n }\n\n if (options.flat) {\n return output as T;\n }\n\n const temp: Record<string, any> = {};\n const keys = Object.keys(output);\n for (const key of keys) {\n setPathValue(temp, key, output[key]);\n }\n return temp as T;\n }\n\n private wrapSafeRunError(e: unknown, options: ContainerRunOptions<T, C>): Result<T> {\n // Abort is not a validation outcome — propagate it. Wrapping it\n // as a synthetic `Result.failure` would produce a misleading\n // \"AbortError\" issue at path `[]`.\n if (options.signal?.aborted) {\n throw e;\n }\n // Same reasoning for `runSync` structural violations.\n if (isRunSyncViolation(e)) {\n throw e;\n }\n\n if (isValidupError(e)) {\n return { success: false, error: e };\n }\n\n if (isError(e)) {\n return {\n success: false,\n error: new ValidupError([\n defineIssueItem({\n path: [],\n message: e.message,\n }),\n ]),\n };\n }\n\n return { success: false, error: new ValidupError() };\n }\n\n private isItemGroupIncluded(\n item: Mount<C>,\n group?: string,\n ) : boolean {\n if (group === GroupKey.WILDCARD) {\n return true;\n }\n\n if (item.options.group) {\n if (Array.isArray(item.options.group)) {\n if (item.options.group.includes(GroupKey.WILDCARD)) {\n return true;\n }\n\n if (group && item.options.group.includes(group)) {\n return true;\n }\n } else {\n if (item.options.group === GroupKey.WILDCARD) {\n return true;\n }\n\n if (item.options.group === group) {\n return true;\n }\n }\n\n return false;\n }\n\n return true;\n }\n\n /**\n * Join flat-output keys with `.` separators, preserving any pre-existing\n * leading dot on the right-hand side. Note: keys containing a *literal*\n * dot collide with the dotted-path syntax used for nested-output\n * expansion (see `setPathValue` in `pathtrace`) and will produce\n * ambiguous output when re-expanded — avoid mounting/returning such keys.\n */\n private mergePaths(...args: (string | undefined)[]) {\n let output : string = '';\n\n for (const arg of args) {\n if (!arg || arg.length === 0) {\n continue;\n }\n\n if (arg.at(0) === '.') {\n output += arg;\n } else {\n output += output.length > 0 ? `.${arg}` : arg;\n }\n }\n\n return output;\n }\n\n protected initialize() : void {\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 { Container, isContainer } from '../container';\nimport type {\n ContainerOptions,\n IContainer,\n MountOptions,\n} from '../container/types';\nimport type { Validator } from '../types';\nimport type { IBuilder, MountTarget } from './types';\n\ntype ValidatorStep<C> = {\n kind: 'validator',\n key: string,\n validator: Validator<C>,\n options: MountOptions,\n};\n\ntype NestStep<C> = {\n kind: 'nest',\n key: string,\n child: IContainer<any, C>,\n options: MountOptions,\n};\n\ntype Step<C> = ValidatorStep<C> | NestStep<C>;\n\nfunction isBuilder(value: unknown): value is IBuilder<Record<string, any>, unknown> {\n return typeof value === 'object' &&\n value !== null &&\n typeof (value as { build?: unknown }).build === 'function' &&\n typeof (value as { mount?: unknown }).mount === 'function';\n}\n\nexport class Builder<T extends Record<string, any>, C> implements IBuilder<T, C> {\n private readonly options: ContainerOptions<any>;\n\n private readonly steps: ReadonlyArray<Step<C>>;\n\n constructor(options: ContainerOptions<any>, steps: ReadonlyArray<Step<C>>) {\n this.options = options;\n this.steps = steps;\n }\n\n mount(key: string, ...rest: unknown[]): IBuilder<any, C> {\n let options: MountOptions = {};\n let target: MountTarget<C>;\n\n if (rest.length === 1) {\n target = rest[0] as MountTarget<C>;\n } else {\n options = rest[0] as MountOptions;\n target = rest[1] as MountTarget<C>;\n }\n\n let step: Step<C>;\n if (isBuilder(target)) {\n step = {\n kind: 'nest',\n key,\n child: (target as IBuilder<any, C>).build(),\n options,\n };\n } else if (isContainer(target)) {\n step = {\n kind: 'nest',\n key,\n child: target as IContainer<any, C>,\n options,\n };\n } else {\n step = {\n kind: 'validator',\n key,\n validator: target as Validator<C>,\n options,\n };\n }\n\n return new Builder<any, C>(this.options, [...this.steps, step]);\n }\n\n oneOf(): IBuilder<T, C> {\n return new Builder<T, C>(\n { ...this.options, oneOf: true },\n this.steps,\n );\n }\n\n pathsToInclude(...paths: (keyof T & string)[]): IBuilder<T, C> {\n return new Builder<T, C>(\n {\n ...this.options,\n pathsToInclude: [\n ...((this.options.pathsToInclude as string[]) ?? []),\n ...paths,\n ] as ContainerOptions<any>['pathsToInclude'],\n },\n this.steps,\n );\n }\n\n pathsToExclude(...paths: (keyof T & string)[]): IBuilder<T, C> {\n return new Builder<T, C>(\n {\n ...this.options,\n pathsToExclude: [\n ...((this.options.pathsToExclude as string[]) ?? []),\n ...paths,\n ] as ContainerOptions<any>['pathsToExclude'],\n },\n this.steps,\n );\n }\n\n build(): Container<T, C> {\n const container = new Container<T, C>(this.options as ContainerOptions<T>);\n for (const step of this.steps) {\n if (step.kind === 'nest') {\n container.mount(step.key, step.options, step.child);\n } else {\n container.mount(step.key, step.options, step.validator);\n }\n }\n return container;\n }\n}\n\n/**\n * Entry point for the compile-time-typed schema builder. The accumulator\n * starts at `{}` and grows as `.mount(...)` calls are chained;\n * `.build()` returns a `Container<T, C>` whose `run()` reflects the\n * accumulated shape.\n *\n * Pass the context type as the generic parameter to flow it through nested\n * builders and validator factories: `defineSchema<MyContext>()`.\n */\nexport function defineSchema<C = unknown>(): IBuilder<{}, C> {\n return new Builder<{}, C>({}, []);\n}\n"],"mappings":";;;;;;;;;;;;AAeA,SAAgB,gBACZ,UACA,KAC+B;CAC/B,IAAI,OAAO,aAAa,aACpB;CAEJ,IAAI,IAAI,WAAW,GACf,OAAO;CAGX,MAAM,SAA8B,CAAC;CACrC,IAAI,UAAU;CACd,MAAM,OAAO,OAAO,KAAK,QAAQ;CACjC,KAAK,MAAM,KAAK,MACZ,IAAI,EAAE,WAAW,GAAG,IAAI,EAAE,GAAG;EACzB,OAAO,EAAE,MAAM,IAAI,SAAS,CAAC,KAAK,SAAS;EAC3C,UA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;GACH,MAAM;GACN;GACA,WAAW;GACX;EACJ;EAGJ,OAAO,IAAI,QAAgB,KAAK,SAAS,CAAC,GAAG,KAAK,OAAO,IAAI,CAAC;CAClE;CAEA,QAAwB;EACpB,OAAO,IAAI,QACP;GAAE,GAAG,KAAK;GAAS,OAAO;EAAK,GAC/B,KAAK,KACT;CACJ;CAEA,eAAe,GAAG,OAA6C;EAC3D,OAAO,IAAI,QACP;GACI,GAAG,KAAK;GACR,gBAAgB,CACZ,GAAK,KAAK,QAAQ,kBAA+B,CAAC,GAClD,GAAG,KACP;EACJ,GACA,KAAK,KACT;CACJ;CAEA,eAAe,GAAG,OAA6C;EAC3D,OAAO,IAAI,QACP;GACI,GAAG,KAAK;GACR,gBAAgB,CACZ,GAAK,KAAK,QAAQ,kBAA+B,CAAC,GAClD,GAAG,KACP;EACJ,GACA,KAAK,KACT;CACJ;CAEA,QAAyB;EACrB,MAAM,YAAY,IAAI,UAAgB,KAAK,OAA8B;EACzE,KAAK,MAAM,QAAQ,KAAK,OACpB,IAAI,KAAK,SAAS,QACd,UAAU,MAAM,KAAK,KAAK,KAAK,SAAS,KAAK,KAAK;OAElD,UAAU,MAAM,KAAK,KAAK,KAAK,SAAS,KAAK,SAAS;EAG9D,OAAO;CACX;AACJ;;;;;;;;;;AAWA,SAAgB,eAA6C;CACzD,OAAO,IAAI,QAAe,CAAC,GAAG,CAAC,CAAC;AACpC"}
1
+ {"version":3,"file":"index.mjs","names":["interpolate"],"sources":["../src/utils/has-own-property.ts","../src/utils/object.ts","../src/container/check.ts","../src/error/base.ts","../src/issue/check.ts","../src/issue/constants.ts","../src/issue/define.ts","../src/issue/flatten.ts","../src/issue/format.ts","../src/error/check.ts","../src/helpers/error-to-issues.ts","../src/helpers/one-of-failed.ts","../src/helpers/compose.ts","../src/helpers/create-error.ts","../src/helpers/defaults.ts","../src/helpers/error.ts","../src/constants.ts","../src/helpers/optional-value.ts","../src/helpers/path-filter.ts","../src/helpers/path-stringify.ts","../src/validator/check.ts","../src/validator/define.ts","../src/container/run-sync-violation.ts","../src/container/module.ts","../src/builder/module.ts","../src/cache/check.ts","../src/cache/module.ts"],"sourcesContent":["/*\n * Copyright (c) 2024.\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\nexport function hasOwnProperty<X extends {}, Y extends PropertyKey>(obj: X, prop: Y): obj is X & Record<Y, unknown> {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n","/*\n * Copyright (c) 2024.\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\nexport function isObject(input: unknown) : input is Record<string, any> {\n return !!input &&\n typeof input === 'object' &&\n !Array.isArray(input);\n}\n","/*\n * Copyright (c) 2025.\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 { isObject } from '../utils';\nimport type { IContainer } from './types';\n\nexport function isContainer(input: unknown) : input is IContainer {\n return isObject(input) &&\n typeof input.run === 'function' &&\n typeof input.safeRun === 'function';\n}\n","/*\n * Copyright (c) 2024-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 { BaseError } from '@ebec/core';\nimport { buildErrorMessageForAttributes, stringifyPath } from '../helpers';\nimport type { Issue } from '../issue';\n\nexport class ValidupError extends BaseError {\n readonly issues: Issue[];\n\n constructor(issues: Issue[] = []) {\n const paths = issues.map((issue) => stringifyPath(issue.path));\n super({ message: buildErrorMessageForAttributes(paths) });\n\n this.issues = issues;\n }\n\n override toJSON(): ReturnType<BaseError['toJSON']> & { issues: Issue[] } {\n return {\n ...super.toJSON(),\n issues: this.issues,\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 { isObject } from '../utils';\nimport type {\n Issue, \n IssueBase, \n IssueGroup, \n IssueItem,\n} from './types';\n\nfunction isIssuePath(input: unknown) : input is PropertyKey[] {\n if (!Array.isArray(input)) {\n return false;\n }\n\n return input.every((el) => typeof el === 'string' ||\n typeof el === 'number' ||\n typeof el === 'symbol');\n}\n\nfunction isBaseIssue(input: unknown) : input is IssueBase & { [ke: string]: any } {\n if (!isObject(input)) {\n return false;\n }\n\n if (typeof input.message !== 'string') {\n return false;\n }\n\n if (!isIssuePath(input.path)) {\n return false;\n }\n\n return typeof input.meta === 'undefined' ||\n isObject(input.meta);\n}\n\nexport function isIssueItem(input: unknown) : input is IssueItem {\n if (!isBaseIssue(input)) {\n return false;\n }\n\n if (input.type !== 'item') {\n return false;\n }\n\n return typeof input.code === 'string';\n}\n\nexport function isIssueGroup(input: unknown) : input is IssueGroup {\n if (!isBaseIssue(input)) {\n return false;\n }\n\n if (input.type !== 'group') {\n return false;\n }\n\n return Array.isArray(input.issues) &&\n input.issues.every((issue) => isIssueItem(issue) || isIssueGroup(issue));\n}\n\nexport function isIssue(input: unknown) : input is Issue {\n return isIssueGroup(input) || isIssueItem(input);\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\n/**\n * Vocabulary of well-known issue codes. Adapter packages map foreign\n * validator codes onto these so consumer-side translation catalogs\n * (e.g. `@ilingo/validup`) can ship one localized message per code\n * instead of falling back to a generic \"invalid value\" fallback.\n *\n * Tracks the common ground between vuelidate, zod, joi, and yup. The\n * core lifts from vuelidate's catalog (snake_cased to match validup's\n * convention); modern format codes (`PATTERN`, `UUID`, `DATE`,\n * `JSON`, `BASE64`, `STRONG_PASSWORD`, …) cover ground vuelidate\n * predates. Every format code names the format positively (`UUID`,\n * `EMAIL`, `URL`, …) rather than the failure mode (`NOT_UUID`,\n * `INVALID_EMAIL`) so the registry reads consistently.\n *\n * Ad-hoc / project-specific codes still work — `IssueItem.code` is\n * widened to `IssueCode | (string & {})`, so `defineIssueItem({ code:\n * 'email_taken', ... })` is valid. If you want a typed const for your\n * own codes, define one alongside this one:\n *\n * ```ts\n * import { IssueCode } from 'validup';\n *\n * export const AppCode = {\n * ...IssueCode,\n * EMAIL_TAKEN: 'email_taken',\n * } as const;\n * ```\n *\n * Each entry's JSDoc documents the structured `data` adapters should\n * attach when constructing the issue — templates can rely on those\n * placeholders being present (`{{min}}`, `{{max}}`, `{{other}}`, etc.).\n */\nexport const IssueCode = {\n // ──────────────────────────── Generic / structural ────────────────────────────\n /** Generic fallback when no more-specific code applies. `data`: — */\n VALUE_INVALID: 'value_invalid',\n /** Every branch of a `oneOf` container failed. `data`: — */\n ONE_OF_FAILED: 'one_of_failed',\n\n // ──────────────────────────── Presence ────────────────────────────\n /** Value is missing, `undefined`, `null`, or empty per the validator's semantics. `data`: — */\n REQUIRED: 'required',\n\n // ──────────────────────────── Type assertions ────────────────────────────\n /** Value contains characters outside the alphabetical set. `data`: — */\n ALPHA: 'alpha',\n /** Value contains characters outside the alphanumeric set. `data`: — */\n ALPHA_NUM: 'alpha_num',\n /** Value is not a number. `data`: — */\n NUMERIC: 'numeric',\n /** Value is not an integer. `data`: — */\n INTEGER: 'integer',\n /** Value is not a decimal number. `data`: — */\n DECIMAL: 'decimal',\n\n // ──────────────────────────── Length (strings, arrays) ────────────────────────────\n /** Value is shorter than the configured minimum. `data`: `{ min: number }` */\n MIN_LENGTH: 'min_length',\n /** Value is longer than the configured maximum. `data`: `{ max: number }` */\n MAX_LENGTH: 'max_length',\n\n // ──────────────────────────── Numeric range ────────────────────────────\n /** Numeric value is below the configured minimum. `data`: `{ min: number }` */\n MIN_VALUE: 'min_value',\n /** Numeric value is above the configured maximum. `data`: `{ max: number }` */\n MAX_VALUE: 'max_value',\n /** Numeric value falls outside the configured `[min, max]` range. `data`: `{ min: number, max: number }` */\n BETWEEN: 'between',\n\n // ──────────────────────────── String format ────────────────────────────\n /** Value is not a valid email address. `data`: — */\n EMAIL: 'email',\n /** Value is not a valid URL. `data`: — */\n URL: 'url',\n /** Value is not a valid IP address. `data`: — */\n IP_ADDRESS: 'ip_address',\n /** Value is not a valid MAC address. `data`: — */\n MAC_ADDRESS: 'mac_address',\n /** Value is not a valid UUID. `data`: — */\n UUID: 'uuid',\n /** Value is not a valid date / cannot be parsed as a date. `data`: — */\n DATE: 'date',\n /**\n * Value does not match the expected regex pattern. `data`:\n * `{ pattern: string }` — source of the regex without flags so\n * catalogs can quote it in human-readable form.\n */\n PATTERN: 'pattern',\n /** Value is not valid JSON. `data`: — */\n JSON: 'json',\n /** Value is not valid base64. `data`: — */\n BASE64: 'base64',\n /**\n * Value does not meet the configured strong-password rules. `data`:\n * `{ minLength?: number, minLowercase?: number, minUppercase?: number,\n * minNumbers?: number, minSymbols?: number }` — only the keys the\n * adapter chose to surface; missing keys mean \"the default for that\n * setting wasn't configured.\"\n */\n STRONG_PASSWORD: 'strong_password',\n\n // ──────────────────────────── Comparison ────────────────────────────\n /**\n * Value must equal another named field's value (sibling-field assertion,\n * e.g. password-confirm). `data`: `{ other: string }` — the name of\n * the field being compared against.\n */\n SAME_AS: 'same_as',\n} as const;\n\nexport type IssueCode = typeof IssueCode[keyof typeof IssueCode];\n\n/**\n * Per-code `data` contract for the well-known vocabulary. Producers\n * (`defineIssueItem`, `createValidupError`, adapter `error.ts` modules)\n * thread this through their type signatures so TS rejects mismatched\n * payloads at compile time — e.g. `STRONG_PASSWORD` with `data:\n * { pointsPerUnique: 5 }` (a validator.js scoring weight, not a strength\n * requirement) fails to type-check. Codes absent from this map carry no\n * `data`; ad-hoc string codes fall back to the open\n * `Record<string, unknown>` shape on the raw `IssueItem` branch.\n *\n * Extensible via TypeScript declaration merging — third-party adapters\n * and apps that want typed data for their own codes can augment this\n * interface, and the producer-side gatekeep (`defineIssueItem`,\n * `createValidupError`) will type-check their payloads too:\n *\n * ```ts\n * // In a third-party package or app:\n * declare module 'validup' {\n * interface IssueDataByCode {\n * email_taken: { existingUserId: string };\n * }\n * }\n *\n * defineIssueItem({\n * code: 'email_taken',\n * path: ['email'],\n * message: 'Already in use',\n * data: { existingUserId: 'u_42' }, // typed and required\n * });\n * ```\n *\n * Keep entries here in lockstep with the JSDoc on the corresponding\n * `IssueCode` entry — the type-level enforcement and the documentation\n * are two views of the same contract.\n */\nexport interface IssueDataByCode {\n min_length: { min: number };\n max_length: { max: number };\n min_value: { min: number };\n max_value: { max: number };\n between: { min: number, max: number };\n pattern: { pattern: string };\n strong_password: {\n minLength?: number,\n minLowercase?: number,\n minUppercase?: number,\n minNumbers?: number,\n minSymbols?: number,\n };\n same_as: { other: string };\n}\n\n/**\n * `IssueCode` values that carry a documented `data` payload — keys of\n * {@link IssueDataByCode}. Producers using one of these codes must\n * supply the matching `data` shape.\n */\nexport type ParameterizedIssueCode = keyof IssueDataByCode;\n\n/**\n * `IssueCode` values that carry no `data` (`VALUE_INVALID`, `EMAIL`,\n * `REQUIRED`, …). Producers using one of these codes must omit `data`\n * (or pass `undefined`).\n */\nexport type BareIssueCode = Exclude<IssueCode, ParameterizedIssueCode>;\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 { IssueCode } from './constants';\nimport type {\n BareIssueCode,\n IssueDataByCode,\n ParameterizedIssueCode,\n} from './constants';\nimport type {\n IssueBase,\n IssueGroup,\n IssueItem,\n IssueItemBare,\n IssueItemRaw,\n IssueItemTyped,\n ResolveIssueCode,\n} from './types';\n\ninterface DefineIssueItemCommon extends Omit<IssueBase, 'data'> {\n received?: unknown,\n expected?: unknown,\n}\n\n/**\n * Per-call `data` shape for {@link defineIssueItem}. The `data`\n * requirement is selected from the resolved `code`:\n *\n * - Parameterized code → `data` required, typed per {@link IssueDataByCode}.\n * - Bare code (incl. omitted, which resolves to `VALUE_INVALID`)\n * → `data` must be absent / `undefined`.\n * - Ad-hoc string code → `data` optional `Record`.\n */\ntype DefineIssueItemData<C> = DefineIssueItemCommon & {\n code?: C,\n} & (\n ResolveIssueCode<C> extends ParameterizedIssueCode ?\n { data: IssueDataByCode[ResolveIssueCode<C> & ParameterizedIssueCode] } :\n ResolveIssueCode<C> extends BareIssueCode ?\n { data?: undefined } :\n { data?: Record<string, unknown> }\n);\n\n/**\n * Return type for {@link defineIssueItem} — picks the concrete `IssueItem`\n * variant matching the resolved `code`.\n */\ntype DefineIssueItemReturn<C> = ResolveIssueCode<C> extends ParameterizedIssueCode ?\n Extract<IssueItemTyped, { code: ResolveIssueCode<C> }> :\n ResolveIssueCode<C> extends BareIssueCode ?\n Extract<IssueItemBare, { code: ResolveIssueCode<C> }> :\n IssueItemRaw;\n\n/**\n * Build an `IssueItem`. TS uses the supplied `code` to pick the right\n * `data` requirement at the call site — passing `MIN_LENGTH` without\n * `data: { min }` is a compile error; passing `STRONG_PASSWORD` with\n * `data: { pointsPerUnique: 5 }` is a compile error.\n *\n * `code` may be omitted (defaults to `IssueCode.VALUE_INVALID` — bare,\n * no data).\n */\nexport function defineIssueItem<C extends string | undefined = undefined>(\n data: DefineIssueItemData<C>,\n): DefineIssueItemReturn<C> {\n return {\n type: 'item',\n ...data,\n code: (data as { code?: string }).code || IssueCode.VALUE_INVALID,\n } as unknown as DefineIssueItemReturn<C>;\n}\n\nexport function defineIssueGroup(data: Omit<IssueGroup, 'type'>): IssueGroup {\n return {\n type: 'group',\n ...data,\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 { isIssueGroup, isIssueItem } from './check';\nimport type { Issue, IssueGroup, IssueItem } from './types';\n\nexport function flattenIssueItems(issues: Issue[]): IssueItem[] {\n const output: IssueItem[] = [];\n for (const issue of issues) {\n if (isIssueItem(issue)) {\n output.push(issue);\n } else {\n output.push(...flattenIssueItems(issue.issues));\n }\n }\n return output;\n}\n\nexport function flattenIssueGroups(issues: Issue[]): IssueGroup[] {\n const output: IssueGroup[] = [];\n for (const issue of issues) {\n if (isIssueGroup(issue)) {\n output.push(issue);\n output.push(...flattenIssueGroups(issue.issues));\n }\n }\n return output;\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 { interpolate } from '@ebec/core';\nimport type { IssueCode } from './constants';\nimport type { Issue } from './types';\n\n/**\n * Map of issue `code` → message template. Templates use `{name}` placeholders\n * — the same syntax `@ebec/core`'s `interpolate` understands — and are\n * resolved against `Issue.data` at format time.\n *\n * ```ts\n * const de: IssueMessageTemplates = {\n * value_invalid: 'Wert ist ungültig',\n * one_of_failed: 'Keine der Varianten war erfolgreich',\n * };\n * ```\n */\nexport type IssueMessageTemplates = Partial<Record<IssueCode, string>> & Record<string, string>;\n\n/**\n * Render an issue's user-facing message.\n *\n * Resolution order:\n * 1. If `templates[code]` exists, return `interpolate(template, issue.data)`.\n * 2. Else return `issue.message` (the default English rendering set at\n * construction time).\n * 3. Else return `fallback`.\n */\nexport function formatIssue(\n issue: Issue,\n templates?: IssueMessageTemplates,\n fallback: string = '',\n): string {\n if (templates && issue.code) {\n const template = templates[issue.code];\n if (typeof template === 'string') {\n return interpolate(template, issue.data || {});\n }\n }\n if (typeof issue.message === 'string' && issue.message.length > 0) {\n return issue.message;\n }\n return fallback;\n}\n\n// Re-export ebec's `interpolate` so consumers writing custom formatters don't\n// need a direct dependency on `@ebec/core`. Same `{name}` placeholder syntax.\nexport { interpolate } from '@ebec/core';\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 { isIssue } from '../issue';\nimport { hasOwnProperty, isObject } from '../utils';\nimport { ValidupError } from './base';\n\nexport function isError(input: unknown) : input is Error & { [key: string]: any } {\n // Primary check: anything that walks like an Error in this realm.\n // Keeps cross-realm fallbacks (e.g. errors from another iframe / vm\n // context where `instanceof Error` is false) duck-typed via the\n // `message` shape — which also matches `ValidupError`-shaped throws\n // from a duplicate copy of the package.\n if (input instanceof Error) {\n return true;\n }\n\n if (!isObject(input)) {\n return false;\n }\n\n return typeof input.message === 'string' && typeof input.name === 'string';\n}\n\nexport function isValidupError(error: unknown) : error is ValidupError {\n if (!isError(error)) {\n return false;\n }\n\n if (error instanceof ValidupError) {\n return true;\n }\n\n if (!hasOwnProperty(error, 'issues')) {\n return false;\n }\n\n return Array.isArray(error.issues) &&\n error.issues.every((issue) => isIssue(issue));\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 { isError, isValidupError } from '../error';\nimport { IssueCode, defineIssueItem } from '../issue';\nimport type { Issue } from '../issue';\n\n/**\n * Options for {@link errorToIssues}. Defaults match what the\n * orchestrating helpers (compose's collect-all catch, composeAnyOf's\n * branch-failure path) want out of the box.\n */\nexport type ErrorToIssuesOptions = {\n /**\n * Code stamped on the synthetic `IssueItem` when the thrown value\n * is an `Error` or a non-`Error` throw. Defaults to\n * `IssueCode.VALUE_INVALID`. `ValidupError` issues are spread\n * verbatim and DO NOT get this code applied; their own codes are\n * preserved.\n */\n code?: IssueCode | (string & {}),\n /**\n * Path on the synthetic `IssueItem`. Defaults to `[]`.\n * `ValidupError` issues are spread verbatim with their original\n * paths intact — callers that want to prefix or transform spread\n * paths should do so after this fold (the surrounding Container\n * run loop does this in `prefixIssuePath`, for example).\n */\n path?: PropertyKey[],\n};\n\n/**\n * The \"given an unknown throw, produce `Issue[]`\" cascade shared by\n * the validator-orchestrating helpers. The branching is identical\n * at each site — `ValidupError` fans out, `Error` becomes one item,\n * anything else gets a defensive stringify — so it lives here.\n *\n * - `ValidupError` → returns a fresh array containing each of its\n * `issues` verbatim (callers can map/prefix after).\n * - `Error` → returns one `IssueItem` carrying the message + supplied\n * code/path.\n * - Anything else (string, plain object, `null`, …) → returns one\n * defensively-stringified `IssueItem` so the aggregate is never\n * silently missing a contributing failure.\n *\n * Callers layer their own per-site concerns on top of the returned\n * issues: path prefixing, optional stamping, per-branch index\n * stamping, etc.\n */\nexport function errorToIssues(\n error: unknown,\n options: ErrorToIssuesOptions = {},\n): Issue[] {\n const code = options.code ?? IssueCode.VALUE_INVALID;\n const path = options.path ?? [];\n\n if (isValidupError(error)) {\n return [...error.issues];\n }\n\n if (isError(error)) {\n return [defineIssueItem({\n path,\n code,\n message: error.message,\n })];\n }\n\n return [defineIssueItem({\n path,\n code,\n message: typeof error === 'string' && error.length > 0 ?\n error :\n `Non-Error throw: ${String(error)}`,\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 { IssueCode, defineIssueGroup } from '../issue';\nimport type { Issue, IssueGroup } from '../issue';\n\n/**\n * Options for {@link buildOneOfFailedGroup}.\n */\nexport type BuildOneOfFailedGroupOptions = {\n /**\n * Path on the wrapping group. Defaults to `[]` — most callers\n * (compose's `composeAnyOf`, the run-loop entry to a oneOf\n * container) emit the group at the boundary they own and let the\n * surrounding context attach a path.\n */\n path?: PropertyKey[],\n /**\n * Override the default English message. The wrapping group\n * carries `code: IssueCode.ONE_OF_FAILED`, so i18n catalogs key\n * off the code rather than the message; the message is only the\n * fallback rendering.\n */\n message?: string,\n};\n\n/**\n * Build the `IssueGroup` that wraps an every-branch-failed aggregate\n * — used by `composeAnyOf` (validator-level oneOf) AND\n * `Container.finalizeOutput` (container-level `oneOf` option). Sharing\n * the shape keeps the `IssueCode.ONE_OF_FAILED` contract symmetric so\n * consumers / i18n catalogs only need one format for both modes.\n */\nexport function buildOneOfFailedGroup(\n branchIssues: Issue[],\n options: BuildOneOfFailedGroupOptions = {},\n): IssueGroup {\n return defineIssueGroup({\n code: IssueCode.ONE_OF_FAILED,\n message: options.message ?? 'None of the branches succeeded',\n path: options.path ?? [],\n issues: branchIssues,\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 { isContainer } from '../container/check';\nimport type { IContainer } from '../container/types';\nimport { ValidupError } from '../error';\nimport type { Issue } from '../issue';\nimport { isObject } from '../utils';\nimport { errorToIssues } from './error-to-issues';\nimport { buildOneOfFailedGroup } from './one-of-failed';\nimport type { Validator, ValidatorContext } from '../validator';\n\n/**\n * A composable element — either a bare `Validator<C>` function or a\n * fully-built `IContainer<T, C>` instance. Containers participate\n * with the same contract as validators (transform-or-throw); the\n * dispatcher (`invokeComposeElement`) hides the call-shape difference.\n *\n * `IContainer<any, any>` (rather than something tighter) keeps the\n * compose array heterogeneous — a chain can mix schemas / containers\n * with different output shapes without forcing the caller to widen\n * generics at every call site. The cost is that the composed\n * `Validator`'s `Out` defaults to `unknown` (same as before).\n */\nexport type ComposeElement<C = unknown> = Validator<C> | IContainer<any, any>;\n\n/**\n * Options for {@link compose}. Discriminated on `oneOf` so the type\n * surface enforces the (`bail` × `oneOf`) combinations that actually\n * make sense:\n *\n * - `{}` / `{ bail?: boolean }` / `{ oneOf: false }` — the **all**\n * strategy: every validator must pass, stages thread their return\n * value into the next, `bail` controls fail-fast vs. collect-all.\n * - `{ oneOf: true }` — the **any-of** strategy: the first branch to\n * succeed wins and the composed validator returns its value;\n * `bail` is rejected at compile time because there's no chain to\n * bail out of.\n */\nexport type ComposeOptions = {\n /**\n * Run every validator and require all to pass (default). Stages\n * thread their return into the next; `bail` controls whether the\n * first failure stops the chain (`true`, default) or every failure\n * is collected into one aggregate `ValidupError` (`false`).\n *\n * **Threading rule.** A stage's return replaces the threaded\n * `ctx.value` only when defined — `undefined` is treated as a\n * pass-through so pure checks that don't re-emit `ctx.value`\n * compose cleanly with transformers. Stages that DO want to\n * explicitly clear the field must throw or return a sentinel.\n */\n oneOf?: false,\n bail?: boolean,\n} | {\n /**\n * Run branches as alternatives in registration order — the first\n * one to succeed wins, subsequent branches are not invoked, and\n * the composed validator returns the winning branch's value\n * (falling back to `ctx.value` if the winning branch returned\n * `undefined`). When *every* branch fails, the composed validator\n * throws a `ValidupError` whose first issue is an `IssueGroup`\n * with `code: IssueCode.ONE_OF_FAILED` carrying every branch's\n * collected failures (per-branch index surfaced via\n * `data: { branch }`). Symmetric with\n * `Container.options.oneOf`, just at the validator level.\n *\n * Each branch sees the original `ctx.value` — no threading\n * across alternatives, since branches aren't a pipeline.\n * `bail` is intentionally rejected at the type level under this\n * mode: there's no chain to fail-fast over.\n */\n oneOf: true,\n};\n\n/**\n * Compose multiple validators into a single `Validator`.\n *\n * Default (`oneOf: false`) — validators run in order; each stage's\n * return value feeds the next as `ctx.value`. A stage that returns\n * `undefined` is treated as a pass-through (upstream value continues\n * down the chain), so pure checks that don't re-emit `ctx.value`\n * compose cleanly with transformers. `bail: true` (default) stops at\n * the first failure; `bail: false` collects every failure into a\n * single `ValidupError`.\n *\n * `oneOf: true` — branches run as alternatives in registration order;\n * the first branch to succeed wins and subsequent branches are not\n * invoked. When every branch fails, the composed validator throws a\n * `ValidupError` whose first issue is an `IssueGroup` with\n * `code: IssueCode.ONE_OF_FAILED` carrying every branch's failures.\n *\n * Elements can be bare `Validator<C>` functions OR fully-built\n * `IContainer<T, C>` instances — the dispatcher detects which and\n * either calls the function with the threaded `ctx` or invokes the\n * container's `run(value, { group, context, signal, path })` with\n * the threaded value as input. Containers participate with the same\n * transform-or-throw contract; their output replaces the threaded\n * value in the all-strategy chain, and a successful container wins\n * the branch in `oneOf` mode.\n *\n * @example\n * // Fail-fast (default) — sanitize then validate\n * container.mount('email', compose([\n * trim(),\n * isEmail(),\n * isLength({ max: 254 }),\n * ]));\n *\n * // Collect-all — surface every broken rule for a richer error UI\n * container.mount('password', compose([\n * isLength({ min: 8 }),\n * isAlphanumeric(),\n * matches(/[0-9]/),\n * ], { bail: false }));\n *\n * // Any-of — accept either an email or a phone number on the same field\n * container.mount('contact', compose([\n * isEmail(),\n * isMobilePhone(),\n * ], { oneOf: true }));\n *\n * // Any-of with a container branch — accept a contact string OR a\n * // nested address object validated by its own container.\n * container.mount('contact', composeOneOf([\n * isEmail(),\n * isMobilePhone(),\n * addressContainer,\n * ]));\n *\n * Throws that aren't `ValidupError` / `Error` (raw strings, plain\n * objects, null) are synthesized into a single `IssueItem` so the\n * aggregate is never silently missing a contributing failure — mirrors\n * `Container.recordMountError`'s defensive behavior.\n */\nexport function compose<C = unknown>(\n elements: ComposeElement<C>[],\n options: ComposeOptions = {},\n): Validator<C> {\n if (options.oneOf === true) {\n return composeAnyOf(elements);\n }\n\n const bail = options.bail ?? true;\n\n return async (ctx) => {\n const issues: Issue[] = [];\n let { value } = ctx;\n\n for (const element of elements) {\n try {\n // Spread a fresh ctx per stage so the threaded value\n // doesn't leak back to the caller via the input\n // reference — callers that compose inside their own\n // validator can keep reading `ctx.value` after the\n // composed call returns without seeing the post-thread\n // mutation.\n const result = await invokeComposeElement(element, { ...ctx, value });\n if (typeof result !== 'undefined') {\n value = result;\n }\n } catch (e) {\n if (bail) {\n throw e;\n }\n\n // Failing stage doesn't get to mutate the threaded\n // value — `value` keeps whatever the last successful\n // stage produced, so the next validator runs against a\n // well-defined input. Use the shared `errorToIssues`\n // cascade so the ValidupError / Error / non-Error fold\n // stays in lockstep with composeAnyOf and other\n // call sites.\n for (const issue of errorToIssues(e)) {\n issues.push(issue);\n }\n }\n }\n\n if (issues.length > 0) {\n throw new ValidupError(issues);\n }\n\n return value;\n };\n}\n\n/**\n * Sugar for `compose(elements, { oneOf: true })`. Reads more\n * naturally at the call site when the alternative semantic is the\n * intent, mirrors `Container`'s own `oneOf` option.\n */\nexport function composeOneOf<C = unknown>(\n elements: ComposeElement<C>[],\n): Validator<C> {\n return compose(elements, { oneOf: true });\n}\n\n/**\n * The `oneOf` execution path. Carved out so `compose`'s body stays\n * focused on the all-strategy chain and so the abort / per-branch\n * issue plumbing has somewhere to live without nesting.\n *\n * Each branch sees the original `ctx.value` (no threading across\n * alternatives). The first defined return wins; an `undefined` return\n * from a successful branch falls back to `ctx.value` so the\n * pass-through rule stays symmetric with the all-strategy path.\n *\n * Aborts are re-raised verbatim from inside the try (matches Container\n * behavior): a cancelled run isn't a validation outcome to wrap.\n */\nfunction composeAnyOf<C>(elements: ComposeElement<C>[]): Validator<C> {\n return async (ctx) => {\n const branchIssues: Issue[] = [];\n\n for (const [index, element] of elements.entries()) {\n // Pre-branch abort check — short-circuits cleanly before we\n // enter the per-branch try/catch, so aborts never get\n // rewritten into branch-failure issues.\n ctx.signal?.throwIfAborted();\n\n try {\n const result = await invokeComposeElement(element, { ...ctx });\n // First branch to succeed wins — pass-through rule:\n // if the winning branch didn't bother re-emitting\n // `ctx.value`, surface the input as the output.\n return typeof result === 'undefined' ? ctx.value : result;\n } catch (e) {\n // Cancellations from a branch validator surface\n // verbatim instead of being folded into a branch\n // failure — caller can distinguish \"no branch matched\"\n // from \"operation cancelled\".\n if (ctx.signal?.aborted) {\n throw e;\n }\n\n const wrapped = wrapBranchIssues(e, index);\n for (const issue of wrapped) {\n branchIssues.push(issue);\n }\n }\n }\n\n // Every branch (including the empty-branch-list case) failed.\n // Use the shared `buildOneOfFailedGroup` so consumers /\n // i18n catalogs handle compose's any-of the same way they\n // handle `Container.options.oneOf`.\n throw new ValidupError([buildOneOfFailedGroup(branchIssues)]);\n };\n}\n\n/**\n * Dispatch one compose element against the current `ctx`. Containers\n * receive `ctx.value` as their input (normalised to `{}` for non-object\n * values, mirroring how the `Container.run` loop handles a nested\n * container mounted against a non-object value); validators receive\n * `ctx` itself.\n *\n * Forwarded to the child container's `run`:\n *\n * - `group`, `context`, `signal` — the threaded run-level options\n * surfaced on `ctx`. Letting the child see `ctx.signal` matters for\n * aborting in-flight child validation when the outer run is\n * cancelled.\n * - `path: ctx.path` — used by the child's mounts to compute their\n * own `ctx.path`, so a validator inside the child sees the\n * absolute path it sits at (`['foo', 'street']`, not just\n * `['street']`). Issue *paths* in the final thrown error don't\n * depend on this forwarding — the outer Container's\n * `prefixIssuePath` step rebuilds them from each level's own\n * `keyParts` — but validators that inspect `ctx.path` (for\n * logging, custom error formatting, etc.) would see a misleading\n * relative path without it.\n * - `cache: ctx.cache` — the outer Container surfaces its run-level\n * `IResultCache` on `ctx`, so threading it here keeps a\n * container-as-branch participating in the same per-mount cache\n * the outer container is using. Without this forward, mounts\n * inside a compose-branch container would silently bypass the\n * cache, breaking the cache contract for the\n * `composeOneOf([…, childContainer])` shape.\n *\n * Other run-level options (`pathsToInclude`, `pathsToExclude`,\n * `defaults`, `parallel`) are intentionally NOT forwarded — they're\n * normally narrowed per-mount by the parent's run loop\n * (`resolvePathFilter`, `resolveDefaults`), and compose doesn't have\n * the parent mount key it would need to compute the equivalent\n * narrowing. A `composeOneOf` branch that's a container therefore\n * runs all of its mounts regardless of the outer's include/exclude\n * filter; if you need that level of inheritance, mount the container\n * directly with `container.mount(...)` instead of routing it through\n * compose.\n */\nasync function invokeComposeElement<C>(\n element: ComposeElement<C>,\n ctx: ValidatorContext<C>,\n): Promise<unknown> {\n if (isContainer(element)) {\n return element.run(\n isObject(ctx.value) ? ctx.value : {},\n {\n path: ctx.path,\n group: ctx.group,\n context: ctx.context,\n signal: ctx.signal,\n cache: ctx.cache,\n },\n );\n }\n // `isContainer` narrows `element` to `IContainer`, but the\n // negative branch leaves it as the original union — TypeScript\n // doesn't subtract `IContainer` from a union containing\n // `Validator<C>` because their structural shapes overlap\n // (functions are objects). Cast to recover the call signature.\n return (element as Validator<C>)(ctx);\n}\n\n/**\n * Normalize one branch's failure into `Issue[]` ready to merge into\n * the outer `ONE_OF_FAILED` group. Each issue is tagged with\n * `data: { branch: index }` so a tree-walking consumer can report\n * \"branch N failed because ...\" without needing to reconstruct\n * registration order.\n *\n * Delegates the unknown-throw → `Issue[]` fold to the shared\n * `errorToIssues` cascade; only the per-branch stamping is local\n * concern. Spread issues are shallow-cloned before stamping so the\n * `ValidupError` instance's `issues` array on the caller side isn't\n * mutated when a consumer reads `.data.branch` later.\n */\nfunction wrapBranchIssues(error: unknown, index: number): Issue[] {\n const stamp = <I extends Issue>(issue: I): I => {\n issue.data = { ...(issue.data ?? {}), branch: index };\n return issue;\n };\n return errorToIssues(error).map((issue) => stamp({ ...issue }));\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 { ValidupError } from '../error';\nimport { defineIssueItem } from '../issue';\nimport type { \n BareIssueCode, \n IssueCode, \n IssueDataByCode, \n ParameterizedIssueCode, \n ResolveIssueCode, \n} from '../issue';\n\n/**\n * Trailing-args shape selected by the resolved `code`:\n *\n * - Parameterized code → `data` is required and typed.\n * - Bare code → no trailing arg accepted.\n * - Ad-hoc string code → `data?: Record<string, unknown>` optional.\n */\ntype CreateValidupErrorTail<C> = ResolveIssueCode<C> extends ParameterizedIssueCode ?\n [data: IssueDataByCode[ResolveIssueCode<C> & ParameterizedIssueCode]] :\n ResolveIssueCode<C> extends BareIssueCode ?\n [] :\n [data?: Record<string, unknown>];\n\n/**\n * Build a `ValidupError` carrying a single `IssueItem` with the supplied\n * code / message / data. Sugar for the common one-issue failure\n * construction used by adapters and hand-rolled validators.\n *\n * The caller throws — keeping the `throw` keyword at the call site\n * makes the failure path obvious in the validator function body:\n *\n * ```ts\n * if (!validator.isEmail(s)) {\n * throw createValidupError(ctx.value, IssueCode.EMAIL, 'Invalid email');\n * }\n *\n * if (!isInRange(s)) {\n * throw createValidupError(ctx.value, IssueCode.MIN_VALUE, msg, { min: 18 });\n * }\n * ```\n *\n * The `code` you pass selects the `data` requirement at compile time:\n * parameterized codes (`MIN_LENGTH`, `STRONG_PASSWORD`, …) require their\n * typed payload; bare codes (`EMAIL`, `REQUIRED`, …) take no data; any\n * other string falls through to an open `Record<string, unknown>` data\n * argument.\n *\n * For multi-issue failures (e.g. inside {@link compose} with `{ bail: false }`),\n * build a `ValidupError` directly with\n * `new ValidupError([defineIssueItem(...), …])`.\n */\nexport function createValidupError<C extends string = typeof IssueCode.VALUE_INVALID>(\n received: unknown,\n code: C,\n message: string,\n ...rest: CreateValidupErrorTail<C>\n): ValidupError {\n const data = rest[0] as Record<string, unknown> | undefined;\n return new ValidupError([\n defineIssueItem({\n path: [],\n message,\n code,\n data,\n received,\n } as Parameters<typeof defineIssueItem>[0]),\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\n/**\n * Slice a parent `defaults` map down to entries that target paths inside a\n * single nested container mount, with the mount-key prefix stripped so the\n * child sees them as local keys. Exact-key matches (the default targets the\n * mount root itself) are skipped — the parent's post-loop fill handles those\n * once the child has returned, since the child is run with `flat: true` and\n * cannot address its own root.\n */\nexport function resolveDefaults(\n defaults: Record<string, any> | undefined,\n key: string,\n): Record<string, any> | undefined {\n if (typeof defaults === 'undefined') {\n return undefined;\n }\n if (key.length === 0) {\n return defaults;\n }\n\n const output: Record<string, any> = {};\n let matched = false;\n const keys = Object.keys(defaults);\n for (const k of keys) {\n if (k.startsWith(`${key}.`)) {\n output[k.slice(key.length + 1)] = defaults[k];\n matched = true;\n }\n }\n return matched ? output : undefined;\n}\n","/*\n * Copyright (c) 2024.\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 { distinctArray } from 'smob';\n\nexport function buildErrorMessageForAttribute(key: PropertyKey) {\n return `Property ${String(key)} is invalid`;\n}\n\nexport function buildErrorMessageForAttributes(input: PropertyKey[] | Record<string, any>) {\n let names: PropertyKey[];\n if (Array.isArray(input)) {\n names = distinctArray(input);\n } else {\n names = Object.keys(input);\n }\n\n if (names.length === 0) {\n return 'Properties are invalid';\n }\n\n if (names.length > 1) {\n return `Properties ${names.join(', ')} are invalid.`;\n }\n\n return buildErrorMessageForAttribute(names[0]);\n}\n","/*\n * Copyright (c) 2024.\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\nexport enum GroupKey {\n WILDCARD = '*',\n}\n\nexport enum OptionalValue {\n /**\n * Treats only `undefined` as optional. Default.\n */\n UNDEFINED = 'undefined',\n /**\n * Treats `null` and `undefined` as optional.\n */\n NULL = 'null',\n /**\n * Treats any JS falsy value as optional — `undefined`, `null`, `false`,\n * `0`, `''`, `NaN`.\n *\n * **Warning**: this includes `0` and `''`. For quantity / numeric fields\n * where `0` is a meaningful value, prefer the predicate form\n * `optional: (value) => boolean` so you keep control over what counts as\n * missing (e.g. `optional: (v) => v === '' || v === undefined` drops the\n * empty string but keeps `0`).\n */\n FALSY = 'falsy',\n}\n","/*\n * Copyright (c) 2024.\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 { OptionalValue } from '../constants';\n\n/**\n * Check if input value (type of) satisfies optional value type constraint.\n *\n * @param value\n * @param optionalValue\n */\nexport function isOptionalValue(\n value: unknown,\n optionalValue?: `${OptionalValue}`,\n) {\n const optionValueNormalized = optionalValue || OptionalValue.UNDEFINED;\n\n if (optionValueNormalized === OptionalValue.NULL) {\n return value === null || typeof value === 'undefined';\n }\n\n if (optionValueNormalized === OptionalValue.UNDEFINED) {\n return typeof value === 'undefined';\n }\n\n return !value;\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\nexport type PathFilterResolution = {\n skip: boolean,\n pathsToInclude: string[] | undefined,\n pathsToExclude: string[] | undefined,\n};\n\n/**\n * Resolve `pathsToInclude` / `pathsToExclude` against a single mounted item's\n * (already-expanded) local `key`. Returns whether to skip the item, plus the\n * filter sub-lists to forward into a child container — with the parent prefix\n * stripped so the child can match purely against its own local keys.\n *\n * Semantics:\n * - Un-keyed container mount (`key === ''`) shares the parent's namespace, so\n * filters are forwarded verbatim.\n * - Exact match in `pathsToInclude` / `pathsToExclude` matches the whole mount.\n * - Prefix match (`<key>.…`) only descends into container mounts; leaf\n * validators with deeper-target filters fall through (skipped for include,\n * kept for exclude).\n */\nexport function resolvePathFilter(\n pathsToInclude: string[] | undefined,\n pathsToExclude: string[] | undefined,\n key: string,\n isContainer: boolean,\n): PathFilterResolution {\n if (key.length === 0) {\n return {\n skip: false,\n pathsToInclude,\n pathsToExclude,\n };\n }\n\n let includeForward: string[] | undefined;\n if (typeof pathsToInclude !== 'undefined') {\n let exact = false;\n const stripped: string[] = [];\n for (const path of pathsToInclude) {\n if (path === key) {\n exact = true;\n } else if (isContainer && path.startsWith(`${key}.`)) {\n stripped.push(path.slice(key.length + 1));\n }\n }\n if (exact) {\n includeForward = undefined;\n } else if (stripped.length > 0) {\n includeForward = stripped;\n } else {\n return {\n skip: true,\n pathsToInclude: undefined,\n pathsToExclude: undefined,\n };\n }\n }\n\n let excludeForward: string[] | undefined;\n if (typeof pathsToExclude !== 'undefined') {\n const stripped: string[] = [];\n for (const path of pathsToExclude) {\n if (path === key) {\n return {\n skip: true,\n pathsToInclude: undefined,\n pathsToExclude: undefined,\n };\n }\n if (isContainer && path.startsWith(`${key}.`)) {\n stripped.push(path.slice(key.length + 1));\n }\n }\n if (stripped.length > 0) {\n excludeForward = stripped;\n }\n }\n\n return {\n skip: false,\n pathsToInclude: includeForward,\n pathsToExclude: excludeForward,\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 { arrayToPath } from 'pathtrace';\n\n/**\n * Stringify path array to string.\n *\n * @param input\n */\nexport function stringifyPath(input: PropertyKey[]) : string {\n return arrayToPath(input);\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 type { ValidatorDescriptor } from './types';\nimport { isObject } from '../utils';\n\n/**\n * Duck-typed guard for {@link ValidatorDescriptor}. Used by `mount()` to\n * distinguish a descriptor from a bare `Validator` function and from a\n * nested `IContainer` (which is also an object but carries `run` /\n * `safeRun` methods — the descriptor has a `run` function but no\n * `safeRun`).\n *\n * Duck-typed (not `instanceof`) so descriptors built from a different\n * copy of the package — adapters bundling their own `validup` dependency,\n * pnpm workspaces with multiple installs — still round-trip cleanly.\n */\nexport function isValidatorDescriptor<C = unknown, Out = unknown>(\n input: unknown,\n): input is ValidatorDescriptor<C, Out> {\n if (!isObject(input)) {\n return false;\n }\n\n return (\n typeof input.run === 'function' &&\n typeof input.safeRun !== 'function'\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 type { ValidatorDescriptor } from './types';\n\n/**\n * Factory for a {@link ValidatorDescriptor}. Mirrors the\n * `defineIssueItem` / `defineIssueGroup` shape used elsewhere in the\n * library so authored validators get a stable, typed construction site.\n *\n * @example\n * const validateEmailUnique = defineValidator({\n * sideEffect: true,\n * run: async (ctx) => {\n * const taken = await api.isEmailTaken(ctx.value as string);\n * if (taken) throw new Error('Email is already taken');\n * return ctx.value;\n * },\n * });\n */\nexport function defineValidator<C = unknown, Out = unknown>(\n descriptor: ValidatorDescriptor<C, Out>,\n): ValidatorDescriptor<C, Out> {\n return descriptor;\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\n/**\n * Thrown by `Container.runSync` when a validator returns a Promise or a\n * nested container does not implement `runSync`. Marked separately from\n * generic `Error` so the per-mount catch can re-throw it instead of folding\n * it into the issue list (otherwise users would get \"Property X is invalid\"\n * instead of the structural diagnostic).\n *\n * Internal — not exported from the package barrel.\n */\nexport class RunSyncViolationError extends Error {\n override readonly name = 'RunSyncViolationError';\n}\n\n/**\n * Duck-typed check — robust against `instanceof` mismatches when a duplicate\n * copy of the package exists in the dependency tree, or when the throw\n * crosses a realm boundary. Mirrors the `isValidupError` pattern.\n */\nexport function isRunSyncViolation(e: unknown): e is RunSyncViolationError {\n if (e instanceof RunSyncViolationError) {\n return true;\n }\n return (\n typeof e === 'object' &&\n e !== null &&\n (e as { name?: unknown }).name === 'RunSyncViolationError'\n );\n}\n","/*\n * Copyright (c) 2024-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 type { Path } from 'pathtrace';\nimport {\n expandPath,\n getPathValue,\n pathToArray,\n setPathValue,\n} from 'pathtrace';\nimport type {\n IResultCache,\n ResultCacheOutcome,\n ResultCacheSnapshot,\n} from '../cache';\nimport { GroupKey } from '../constants';\nimport { ValidupError, isError, isValidupError } from '../error';\nimport {\n buildErrorMessageForAttribute,\n buildOneOfFailedGroup,\n isOptionalValue,\n resolveDefaults,\n resolvePathFilter,\n} from '../helpers';\nimport { hasOwnProperty, isObject } from '../utils';\nimport type { Validator, ValidatorDescriptor } from '../validator';\nimport { isValidatorDescriptor } from '../validator';\nimport { isContainer } from './check';\nimport type {\n ContainerOptions,\n ContainerRunOptions,\n IContainer,\n Mount,\n MountOptions,\n Result,\n} from './types';\nimport type { Issue } from '../issue';\nimport { IssueCode, defineIssueGroup, defineIssueItem } from '../issue';\nimport { RunSyncViolationError, isRunSyncViolation } from './run-sync-violation';\n\n/**\n * Bundle of state the error path needs from the surrounding run loop.\n * Grouped to keep `collectExecutionFailure`'s signature readable and to make\n * additions (e.g. extra provenance fields for meta stamping) a one-line\n * change at every call site instead of a positional-arg shuffle.\n */\ntype ExecutionFailureContext<C> = {\n error: unknown,\n item: Mount<C>,\n /**\n * The input value handed to the failing mount — retained so we can\n * re-evaluate predicate-optional declarations at error time without\n * relying on a \"predicate already returned false in the run loop\"\n * invariant.\n */\n value: unknown,\n /** Expanded mount path. Prepended to nested `ValidupError` issues. */\n keyParts: PropertyKey[],\n /** Trailing path segment. Drives the wrapping `IssueGroup` shape. */\n pathRelative: PropertyKey | undefined,\n /** Accumulator the error path writes into. */\n issues: Issue[],\n /** Per-run abort signal. If aborted, the throw is re-raised verbatim. */\n signal: AbortSignal | undefined,\n};\n\nexport class Container<\n T extends Record<string, any> = Record<string, any>,\n C = unknown,\n> implements IContainer<T, C> {\n protected options : ContainerOptions<T>;\n\n protected items : Mount<C>[];\n\n // ----------------------------------------------\n\n constructor(options: ContainerOptions<T> = {}) {\n this.options = options;\n this.items = [];\n\n this.initialize();\n }\n\n // ----------------------------------------------\n\n mount(container: IContainer<any, any>) : void;\n\n mount(\n options: MountOptions,\n container: IContainer<any, any>\n ): void;\n\n mount(\n key: Path<T> | (string & {}),\n data: IContainer<any, any> | Validator<C> | ValidatorDescriptor<C>\n ) : void;\n\n mount(\n key: Path<T> | (string & {}),\n options: MountOptions,\n data: IContainer<any, any> | Validator<C> | ValidatorDescriptor<C>\n ) : void;\n\n mount(...args: any[]) : void {\n if (args.length < 1) {\n throw new SyntaxError('The mount method requires at least one argument');\n }\n if (args.length > 3) {\n throw new SyntaxError(`mount() accepts at most 3 arguments, got ${args.length}`);\n }\n\n let path : string | undefined;\n let pathSeen = false;\n\n let data: IContainer<any, any> | Validator<C> | ValidatorDescriptor<C> | undefined;\n let dataSeen = false;\n // Tracked separately so we don't re-detect on store — `isContainer` /\n // `isValidatorDescriptor` walk the value once each here, then the\n // result is consulted directly when we push onto `this.items`.\n let dataKind: 'container' | 'validator' | 'descriptor' | undefined;\n\n let options: MountOptions = {};\n let optionsSeen = false;\n\n for (const arg of args) {\n if (typeof arg === 'string') {\n if (pathSeen) {\n throw new SyntaxError('mount() received multiple string arguments — only one path is supported.');\n }\n pathSeen = true;\n path = arg;\n continue;\n }\n\n if (typeof arg === 'function') {\n if (dataSeen) {\n throw new SyntaxError('mount() received multiple validator/container arguments.');\n }\n dataSeen = true;\n data = arg;\n dataKind = 'validator';\n continue;\n }\n\n if (isContainer(arg)) {\n if (dataSeen) {\n throw new SyntaxError('mount() received multiple validator/container arguments.');\n }\n dataSeen = true;\n data = arg;\n dataKind = 'container';\n continue;\n }\n\n // Descriptor check goes BEFORE the generic `isObject` branch:\n // a `ValidatorDescriptor` is an object that happens to carry\n // a `run` function but lacks `safeRun`, distinguishing it from\n // both `MountOptions` (no `run`) and `IContainer` (has both\n // `run` and `safeRun`).\n if (isValidatorDescriptor(arg)) {\n if (dataSeen) {\n throw new SyntaxError('mount() received multiple validator/container arguments.');\n }\n dataSeen = true;\n data = arg;\n dataKind = 'descriptor';\n continue;\n }\n\n if (isObject(arg)) {\n if (optionsSeen) {\n throw new SyntaxError('mount() received multiple options objects.');\n }\n optionsSeen = true;\n options = arg;\n }\n }\n\n if (\n dataKind !== 'container' &&\n (typeof path === 'undefined' || path.length === 0)\n ) {\n throw new SyntaxError('Only a container can be mounted without a key.');\n }\n\n if (typeof data === 'undefined' || typeof dataKind === 'undefined') {\n throw new SyntaxError('No container/validator could be extracted from the fn arguments.');\n }\n\n if (dataKind === 'container') {\n this.items.push({\n options,\n data: data as IContainer<any, any>,\n path,\n type: 'container',\n });\n\n return;\n }\n\n if (dataKind === 'descriptor') {\n const descriptor = data as ValidatorDescriptor<C>;\n this.items.push({\n options,\n data: descriptor.run,\n path,\n type: 'validator',\n sideEffect: descriptor.sideEffect,\n });\n return;\n }\n\n this.items.push({\n options,\n data: data as Validator<C>,\n path,\n type: 'validator',\n });\n }\n\n // ----------------------------------------------\n\n /**\n * Run the container against `data`. Default execution mode — async,\n * sequential, throws `ValidupError` on validation failure.\n *\n * Variants for the other execution modes:\n * - `run(data, { parallel: true })` — async, sequential→concurrent. Each\n * mount captures `value` from `data` before any sibling runs, so chained\n * sanitize-then-validate patterns are not supported.\n * - {@link Container.safeRun} — same as `run` but returns a discriminated\n * `Result<T>` instead of throwing on validation failure (still rethrows\n * on abort).\n * - {@link Container.runSync} / {@link Container.safeRunSync} — synchronous\n * variants for graphs where every validator (and every nested container's\n * `runSync`) is synchronous.\n *\n * Aborts surface verbatim — the abort is detected via `signal.throwIfAborted()`\n * between mounts (which throws `signal.reason`), and any error raised by a\n * mid-flight validator during an aborted run is re-thrown as-is rather than\n * folded into the issue tree. Callers can therefore distinguish \"validation\n * failed\" from \"operation cancelled,\" but should not assume the thrown value\n * is always `signal.reason` — a validator that throws its own error before\n * the next abort check produces that error instead.\n *\n * @throws ValidupError on validation failure.\n * @throws signal.reason when the abort check fires between mounts.\n * @throws (mid-flight validator error) when a validator throws during an\n * already-aborted run — re-raised as-is rather than wrapped.\n */\n async run(\n data: Record<string, any> = {},\n options: ContainerRunOptions<T, C> = {},\n ): Promise<T> {\n if (options.parallel) {\n return this.runParallel(data, options);\n }\n\n const { pathsToInclude, pathsToExclude } = this.resolveContainerFilters(options);\n\n const output: Record<string, any> = {};\n const issues: Issue[] = [];\n\n let itemCount = 0;\n let errorCount = 0;\n\n for (let i = 0; i < this.items.length; i++) {\n // Pre-mount abort check — cheap and short-circuits cleanly without\n // entering the per-mount try/catch (so aborts don't get rewritten\n // into validation issues).\n options.signal?.throwIfAborted();\n\n const item = this.items[i];\n\n if (!this.isItemGroupIncluded(item, options.group)) {\n continue;\n }\n\n let pathCount = 0;\n let pathFailed = false;\n const branchStart = issues.length;\n\n const keys: string[] = item.path ? expandPath(data, item.path) : [''];\n\n for (const key of keys) {\n const keyParts = key ? pathToArray(key) : [];\n\n const pathRelative = keyParts.at(-1);\n const pathAbsolute = [\n ...(options.path ? options.path : []),\n ...keyParts,\n ];\n\n let value: unknown;\n if (key.length > 0) {\n value = hasOwnProperty(output, key) ?\n output[key] :\n getPathValue(data, key);\n } else {\n value = data;\n }\n\n const filter = resolvePathFilter(\n pathsToInclude,\n pathsToExclude,\n key,\n item.type === 'container',\n );\n if (filter.skip) {\n continue;\n }\n\n try {\n const isOptional = typeof item.options.optional === 'function' ?\n item.options.optional(value) :\n item.options.optional &&\n isOptionalValue(value, item.options.optionalValue);\n\n if (isOptional) {\n if (item.options.optionalInclude) {\n output[key] = value;\n }\n } else if (item.type === 'container') {\n const tmp = await item.data.run(\n isObject(value) ? value : {},\n {\n group: options.group,\n flat: true,\n path: pathAbsolute,\n pathsToInclude: filter.pathsToInclude,\n pathsToExclude: filter.pathsToExclude,\n defaults: resolveDefaults(options.defaults, key),\n context: options.context,\n signal: options.signal,\n cache: options.cache,\n },\n );\n\n const tmpKeys = Object.keys(tmp);\n for (const tmpKey of tmpKeys) {\n output[this.mergePaths(key, tmpKey)] = tmp[tmpKey];\n }\n } else if (item.type === 'validator') {\n const snapshot: ResultCacheSnapshot = {\n value,\n context: options.context,\n group: options.group,\n };\n const cached = this.resolveCachedOutcome(item, key, snapshot, options.cache);\n if (cached) {\n if (cached.ok) {\n output[key] = cached.value;\n } else {\n // Replay the prior error through the same outer-catch\n // path so issue construction (path prefixing, optional\n // stamping) runs with the *current* `keyParts` — vital\n // when the same container is mounted under different\n // parents across runs.\n throw cached.error;\n }\n } else {\n try {\n const result = await item.data({\n key,\n path: pathAbsolute,\n\n value,\n data,\n group: options.group,\n context: options.context as C,\n signal: options.signal,\n cache: options.cache,\n });\n output[key] = result;\n this.writeCachedOutcome(\n item,\n key,\n snapshot,\n { ok: true, value: result },\n options.cache,\n options.signal,\n );\n } catch (e) {\n this.writeCachedOutcome(\n item,\n key,\n snapshot,\n { ok: false, error: e },\n options.cache,\n options.signal,\n );\n throw e;\n }\n }\n }\n } catch (e) {\n this.collectExecutionFailure({\n error: e,\n item,\n value,\n keyParts,\n pathRelative,\n issues,\n signal: options.signal,\n });\n pathFailed = true;\n }\n\n pathCount++;\n }\n\n if (pathCount > 0) {\n itemCount++;\n\n if (pathFailed) {\n errorCount++;\n this.wrapBranchForOneOf(issues, branchStart, item, i);\n }\n }\n }\n\n return this.finalizeOutput(output, options, issues, errorCount, itemCount);\n }\n\n /**\n * Parallel-execution variant of `run()`. All mounts kick off their\n * promises eagerly and the results are merged after `Promise.allSettled`.\n * See `ContainerRunOptions.parallel` for the trade-off note.\n */\n private async runParallel(\n data: Record<string, any>,\n options: ContainerRunOptions<T, C>,\n ): Promise<T> {\n const { pathsToInclude, pathsToExclude } = this.resolveContainerFilters(options);\n\n const output: Record<string, any> = {};\n const issues: Issue[] = [];\n\n type KeyTask = {\n key: string,\n keyParts: PropertyKey[],\n pathRelative: PropertyKey | undefined,\n // Retained for `collectExecutionFailure` so it can re-evaluate\n // predicate-optional mounts at error time.\n value: unknown,\n promise: Promise<unknown>,\n kind: 'container' | 'validator',\n };\n\n type ItemGroup = {\n item: Mount<C>,\n // Original registration index in `this.items`. Tracked separately\n // from the position in `itemGroups` because group-filtered mounts\n // are dropped from `itemGroups` — without this, `data.branch`\n // emitted by `wrapBranchForOneOf` would not match the\n // registration order seen by the consumer.\n mountIndex: number,\n tasks: KeyTask[],\n // optional/skip paths that completed inline still count toward\n // the per-item pathCount used for oneOf / errorCount tracking.\n syncPathCount: number,\n };\n\n const itemGroups: ItemGroup[] = [];\n\n for (let i = 0; i < this.items.length; i++) {\n options.signal?.throwIfAborted();\n\n const item = this.items[i];\n if (!this.isItemGroupIncluded(item, options.group)) {\n continue;\n }\n\n const tasks: KeyTask[] = [];\n let syncPathCount = 0;\n\n const keys: string[] = item.path ? expandPath(data, item.path) : [''];\n for (const key of keys) {\n const keyParts = key ? pathToArray(key) : [];\n const pathRelative = keyParts.at(-1);\n const pathAbsolute = [\n ...(options.path ? options.path : []),\n ...keyParts,\n ];\n\n let value: unknown;\n if (key.length > 0) {\n // Parallel mode reads `data` only — `output[key]` from a\n // sibling mount is intentionally NOT consulted (the\n // sibling may not have completed yet).\n value = getPathValue(data, key);\n } else {\n value = data;\n }\n\n const filter = resolvePathFilter(\n pathsToInclude,\n pathsToExclude,\n key,\n item.type === 'container',\n );\n if (filter.skip) {\n continue;\n }\n\n const isOptional = typeof item.options.optional === 'function' ?\n item.options.optional(value) :\n item.options.optional &&\n isOptionalValue(value, item.options.optionalValue);\n\n if (isOptional) {\n if (item.options.optionalInclude) {\n output[key] = value;\n }\n syncPathCount++;\n continue;\n }\n\n let promise: Promise<unknown>;\n if (item.type === 'container') {\n promise = item.data.run(\n isObject(value) ? value : {},\n {\n group: options.group,\n flat: true,\n path: pathAbsolute,\n pathsToInclude: filter.pathsToInclude,\n pathsToExclude: filter.pathsToExclude,\n defaults: resolveDefaults(options.defaults, key),\n context: options.context,\n signal: options.signal,\n parallel: true,\n cache: options.cache,\n },\n );\n } else {\n const snapshot: ResultCacheSnapshot = {\n value,\n context: options.context,\n group: options.group,\n };\n const cached = this.resolveCachedOutcome(item, key, snapshot, options.cache);\n if (cached) {\n // Materialize cached outcomes as already-settled promises\n // so the existing `Promise.allSettled` merge loop handles\n // them identically to fresh runs — no parallel-specific\n // replay code path.\n promise = cached.ok ?\n Promise.resolve(cached.value) :\n Promise.reject(cached.error);\n } else {\n // Wrap sync validators in a microtask so the surrounding\n // `Promise.allSettled` always sees a thenable. Cache\n // writes happen inside the wrapper so the entry is\n // persisted before the promise settles.\n const itemData = item.data;\n const captureItem = item;\n const captureKey = key;\n const captureSnapshot = snapshot;\n promise = (async () => {\n try {\n const result = await itemData({\n key,\n path: pathAbsolute,\n value,\n data,\n group: options.group,\n context: options.context as C,\n signal: options.signal,\n cache: options.cache,\n });\n this.writeCachedOutcome(\n captureItem,\n captureKey,\n captureSnapshot,\n { ok: true, value: result },\n options.cache,\n options.signal,\n );\n return result;\n } catch (e) {\n this.writeCachedOutcome(\n captureItem,\n captureKey,\n captureSnapshot,\n { ok: false, error: e },\n options.cache,\n options.signal,\n );\n throw e;\n }\n })();\n }\n }\n\n tasks.push({\n key,\n keyParts,\n pathRelative,\n value,\n promise,\n kind: item.type,\n });\n }\n\n if (tasks.length > 0 || syncPathCount > 0) {\n itemGroups.push({\n item,\n mountIndex: i,\n tasks,\n syncPathCount,\n });\n }\n }\n\n // Wait for all groups concurrently. Promises were already kicked off\n // eagerly above; this just collects their settled state.\n const settledByGroup = await Promise.all(itemGroups.map(\n (group) => Promise.allSettled(group.tasks.map((t) => t.promise)),\n ));\n\n // Re-check the abort signal after settling. Sequential `run`/`runSync`\n // probe between every mount; the parallel variant can only check here\n // and before `finalizeOutput`. Without this, validators that ignore\n // `ctx.signal` would let an aborted run resolve to a successful result.\n options.signal?.throwIfAborted();\n\n let itemCount = 0;\n let errorCount = 0;\n\n for (const [i, {\n item,\n mountIndex,\n tasks,\n syncPathCount,\n }] of itemGroups.entries()) {\n const settled = settledByGroup[i];\n\n let pathFailed = false;\n const branchStart = issues.length;\n for (const [j, task] of tasks.entries()) {\n const result = settled[j];\n\n if (result.status === 'fulfilled') {\n if (task.kind === 'container') {\n const tmp = result.value as Record<string, any>;\n const tmpKeys = Object.keys(tmp);\n for (const tmpKey of tmpKeys) {\n output[this.mergePaths(task.key, tmpKey)] = tmp[tmpKey];\n }\n } else {\n output[task.key] = result.value;\n }\n } else {\n this.collectExecutionFailure({\n error: result.reason,\n item,\n value: task.value,\n keyParts: task.keyParts,\n pathRelative: task.pathRelative,\n issues,\n signal: options.signal,\n });\n pathFailed = true;\n }\n }\n\n if (tasks.length + syncPathCount > 0) {\n itemCount++;\n if (pathFailed) {\n errorCount++;\n // Use the original registration index so `data.branch`\n // matches the registration order regardless of group\n // filtering — sequential `run()` / `runSync()` already\n // pass the registration index directly.\n this.wrapBranchForOneOf(issues, branchStart, item, mountIndex);\n }\n }\n }\n\n // Final guard before returning a (potentially successful) value — if\n // the run was aborted after the post-settle check but before the merge\n // loop finished, propagate the abort instead of returning stale data.\n options.signal?.throwIfAborted();\n\n return this.finalizeOutput(output, options, issues, errorCount, itemCount);\n }\n\n async safeRun(input: Record<string, any> = {}, options: ContainerRunOptions<T, C> = {}): Promise<Result<T>> {\n try {\n const data = await this.run(input, options);\n return { success: true, data };\n } catch (e) {\n return this.wrapSafeRunError(e, options);\n }\n }\n\n /**\n * Synchronous variant of {@link Container.run}. Use it for purely\n * synchronous validator graphs where the microtask overhead of `await`\n * per mount matters (e.g. driving a reactive UI without a `pending`\n * flicker on every keystroke).\n *\n * Each mounted validator's return value MUST NOT be a thenable, and every\n * nested container MUST implement `runSync`. Either violation throws\n * `RunSyncViolationError` (structural — distinct from validation\n * failures), so the diagnostic is surfaced verbatim rather than wrapped\n * into a `ValidupError`. The companion {@link Container.safeRunSync}\n * still rethrows these for the same reason.\n *\n * No `parallel` variant — synchronous graphs don't benefit from\n * concurrency, and `Promise.allSettled` is async by definition.\n *\n * Aborts surface the same way as {@link Container.run}: the\n * `signal.throwIfAborted()` check between mounts throws `signal.reason`,\n * and a mid-flight validator throw during an already-aborted run is\n * re-raised verbatim. Don't assume the thrown value is always\n * `signal.reason`.\n *\n * @throws ValidupError on validation failure.\n * @throws RunSyncViolationError when a validator returns a Promise or a\n * nested container does not implement `runSync`.\n * @throws signal.reason when the abort check fires between mounts.\n * @throws (mid-flight validator error) when a validator throws during an\n * already-aborted run.\n */\n runSync(\n data: Record<string, any> = {},\n options: ContainerRunOptions<T, C> = {},\n ): T {\n const { pathsToInclude, pathsToExclude } = this.resolveContainerFilters(options);\n\n const output: Record<string, any> = {};\n const issues: Issue[] = [];\n\n let itemCount = 0;\n let errorCount = 0;\n\n for (let i = 0; i < this.items.length; i++) {\n options.signal?.throwIfAborted();\n\n const item = this.items[i];\n\n if (!this.isItemGroupIncluded(item, options.group)) {\n continue;\n }\n\n let pathCount = 0;\n let pathFailed = false;\n const branchStart = issues.length;\n\n const keys: string[] = item.path ? expandPath(data, item.path) : [''];\n\n for (const key of keys) {\n const keyParts = key ? pathToArray(key) : [];\n\n const pathRelative = keyParts.at(-1);\n const pathAbsolute = [\n ...(options.path ? options.path : []),\n ...keyParts,\n ];\n\n let value: unknown;\n if (key.length > 0) {\n value = hasOwnProperty(output, key) ?\n output[key] :\n getPathValue(data, key);\n } else {\n value = data;\n }\n\n const filter = resolvePathFilter(\n pathsToInclude,\n pathsToExclude,\n key,\n item.type === 'container',\n );\n if (filter.skip) {\n continue;\n }\n\n try {\n const isOptional = typeof item.options.optional === 'function' ?\n item.options.optional(value) :\n item.options.optional &&\n isOptionalValue(value, item.options.optionalValue);\n\n if (isOptional) {\n if (item.options.optionalInclude) {\n output[key] = value;\n }\n } else if (item.type === 'container') {\n const childRunSync = (\n item.data as IContainer<any, any> & {\n runSync?: (...args: any[]) => any\n }\n ).runSync;\n if (typeof childRunSync !== 'function') {\n throw new RunSyncViolationError(`runSync: nested container at \"${key || '<root>'}\" does not implement runSync`);\n }\n\n const tmp = childRunSync.call(item.data, isObject(value) ? value : {}, {\n group: options.group,\n flat: true,\n path: pathAbsolute,\n pathsToInclude: filter.pathsToInclude,\n pathsToExclude: filter.pathsToExclude,\n defaults: resolveDefaults(options.defaults, key),\n context: options.context,\n signal: options.signal,\n cache: options.cache,\n });\n\n const tmpKeys = Object.keys(tmp);\n for (const tmpKey of tmpKeys) {\n output[this.mergePaths(key, tmpKey)] = tmp[tmpKey];\n }\n } else if (item.type === 'validator') {\n const snapshot: ResultCacheSnapshot = {\n value,\n context: options.context,\n group: options.group,\n };\n const cached = this.resolveCachedOutcome(item, key, snapshot, options.cache);\n if (cached) {\n if (cached.ok) {\n output[key] = cached.value;\n } else {\n throw cached.error;\n }\n } else {\n try {\n const result = item.data({\n key,\n path: pathAbsolute,\n\n value,\n data,\n group: options.group,\n context: options.context as C,\n signal: options.signal,\n cache: options.cache,\n });\n if (\n result !== null &&\n typeof result === 'object' &&\n typeof (result as { then?: unknown }).then === 'function'\n ) {\n // Don't cache: structural violation, not a\n // validation outcome.\n throw new RunSyncViolationError(`runSync: validator at \"${key || '<root>'}\" returned a Promise`);\n }\n output[key] = result;\n this.writeCachedOutcome(\n item,\n key,\n snapshot,\n { ok: true, value: result },\n options.cache,\n options.signal,\n );\n } catch (e) {\n // RunSyncViolation is structural — don't pollute\n // the cache with a graph-level error that the\n // next run might reach through different mounts.\n if (!isRunSyncViolation(e)) {\n this.writeCachedOutcome(\n item,\n key,\n snapshot,\n { ok: false, error: e },\n options.cache,\n options.signal,\n );\n }\n throw e;\n }\n }\n }\n } catch (e) {\n this.collectExecutionFailure({\n error: e,\n item,\n value,\n keyParts,\n pathRelative,\n issues,\n signal: options.signal,\n });\n pathFailed = true;\n }\n\n pathCount++;\n }\n\n if (pathCount > 0) {\n itemCount++;\n\n if (pathFailed) {\n errorCount++;\n this.wrapBranchForOneOf(issues, branchStart, item, i);\n }\n }\n }\n\n return this.finalizeOutput(output, options, issues, errorCount, itemCount);\n }\n\n safeRunSync(input: Record<string, any> = {}, options: ContainerRunOptions<T, C> = {}): Result<T> {\n try {\n const data = this.runSync(input, options);\n return { success: true, data };\n } catch (e) {\n return this.wrapSafeRunError(e, options);\n }\n }\n\n /**\n * Lookup helper for the per-mount result cache.\n *\n * Returns `undefined` (forcing a real run) for any of:\n * - No `cache` supplied — caller didn't opt in.\n * - Mount isn't a validator — container mounts run their own\n * inner loop, which consults the cache for their own mounts.\n * - Validator declared `sideEffect: true` — its result depends on\n * inputs the snapshot doesn't capture (sibling fields, network,\n * global state), so caching would be unsound.\n * - No prior entry stored for this `(mount, key)` pair.\n * - Stored snapshot's `value` / `context` / `group` don't all match\n * the current invocation by `Object.is`.\n */\n private resolveCachedOutcome(\n item: Mount<C>,\n key: string,\n snapshot: ResultCacheSnapshot,\n cache: IResultCache | undefined,\n ): ResultCacheOutcome | undefined {\n if (\n !cache ||\n item.type !== 'validator' ||\n item.sideEffect === true\n ) {\n return undefined;\n }\n const entry = cache.get(item, key);\n if (!entry) {\n return undefined;\n }\n if (\n Object.is(entry.snapshot.value, snapshot.value) &&\n Object.is(entry.snapshot.context, snapshot.context) &&\n Object.is(entry.snapshot.group, snapshot.group)\n ) {\n return entry.outcome;\n }\n return undefined;\n }\n\n /**\n * Store the outcome of a fresh validator invocation. No-ops in the\n * same cases `resolveCachedOutcome` returns `undefined` for, plus:\n *\n * - `signal.aborted` — the throw was caused by cancellation, not by\n * a validation outcome we want to remember. Caching the abort\n * would mean future replays surface \"AbortError\" as a fake\n * validation issue every time the same snapshot is seen, even\n * in fully-completed runs.\n *\n * `RunSyncViolationError`s are filtered out at the call site\n * (`runSync` only) because they're structural — the validator\n * graph is wrong, not the input.\n */\n private writeCachedOutcome(\n item: Mount<C>,\n key: string,\n snapshot: ResultCacheSnapshot,\n outcome: ResultCacheOutcome,\n cache: IResultCache | undefined,\n signal: AbortSignal | undefined,\n ): void {\n if (\n !cache ||\n item.type !== 'validator' ||\n item.sideEffect === true ||\n signal?.aborted\n ) {\n return;\n }\n cache.set(item, key, { snapshot, outcome });\n }\n\n private resolveContainerFilters(options: ContainerRunOptions<T, C>): {\n pathsToInclude: string[] | undefined,\n pathsToExclude: string[] | undefined,\n } {\n let pathsToInclude: string[] | undefined;\n if (options.pathsToInclude) {\n pathsToInclude = options.pathsToInclude as string[];\n } else if (this.options.pathsToInclude) {\n pathsToInclude = this.options.pathsToInclude as string[];\n }\n\n let pathsToExclude: string[] | undefined;\n if (options.pathsToExclude) {\n pathsToExclude = options.pathsToExclude as string[];\n } else if (this.options.pathsToExclude) {\n pathsToExclude = this.options.pathsToExclude as string[];\n }\n\n return { pathsToInclude, pathsToExclude };\n }\n\n /**\n * Prepend `keyParts` to a child issue's `path` and — when the child is\n * an `IssueGroup` — recurse into its nested issues so every leaf carries\n * the parent prefix. Without recursion, a child container that already\n * wrapped its own multi-issue mount in a group (or a `oneOf` child) would\n * surface inner items with paths missing the parent segment, breaking\n * downstream consumers that rely on `flattenIssueItems` for per-field\n * lookup (e.g. `@validup/vue`).\n */\n private prefixIssuePath(issue: Issue, keyParts: PropertyKey[]): Issue {\n const prefixed: Issue = {\n ...issue,\n path: [...keyParts, ...(issue.path || [])],\n };\n if (prefixed.type === 'group') {\n prefixed.issues = prefixed.issues.map(\n (nested) => this.prefixIssuePath(nested, keyParts),\n );\n }\n return prefixed;\n }\n\n /**\n * Translate a throw raised by one execution step (one validator or\n * nested-container invocation, from the surrounding `run` loop) into\n * accumulated issues and push them onto `context.issues`. Re-throws when\n * the run was aborted (signal-aware validators) so abort errors are not\n * mangled into validation issues.\n *\n * \"Mount\" is the *setup-time* verb (`container.mount(...)`); what failed\n * here is the *execution* of an already-mounted unit — hence the name.\n *\n * The context object captures everything the error path needs to know\n * about the failing step: the thrown value (`error`), the mount\n * descriptor (`item`), the current input (`value` — kept around so we\n * can re-evaluate predicate-optional declarations at error time), the\n * expanded path (`keyParts` — used to prepend to nested `ValidupError`\n * issues) and the trailing segment (`pathRelative` — used when wrapping\n * multi-issue or container emissions into an `IssueGroup`). The\n * destination accumulator (`issues`) and the abort `signal` round out\n * what's needed to handle the failure.\n *\n * @modifies context.issues — appends one or more entries per call.\n */\n private collectExecutionFailure(context: ExecutionFailureContext<C>): void {\n const {\n error,\n item,\n value,\n keyParts,\n pathRelative,\n issues,\n signal,\n } = context;\n\n if (signal?.aborted) {\n throw error;\n }\n // Structural runSync violations are not validation outcomes — they\n // mean the caller can't use runSync against this graph. Surface the\n // diagnostic verbatim instead of wrapping it as \"Property X is invalid\".\n if (isRunSyncViolation(error)) {\n throw error;\n }\n\n // Mounts whose `optional` declaration resolves truthy for the current\n // `value` stamp their own emissions with `meta.optional: true`, so\n // consumers (e.g. `@validup/vue`'s severity helper) can downgrade UX\n // gating for fields the schema permits to be blank.\n //\n // Resolution mirrors the run-loop check (e.g. lines 254-256):\n //\n // - `optional: true` → tag\n // - `optional: false` → don't tag (matches runtime's truthy filter)\n // - `optional: (v) => boolean` → invoke the predicate with the\n // current value and tag iff it returns truthy. Today the run\n // loop only enters this error path when the predicate returned\n // false (otherwise the validator would have been skipped), so\n // this branch is effectively \"don't tag\" — but the explicit\n // re-evaluation keeps the code's intent self-evident and\n // decouples it from that invariant.\n // - `optional: undefined` → don't tag\n //\n // Per the \"no inheritance\" decision: issues bubbled up unchanged from\n // a child Container's own `ValidupError` are NOT stamped here — the\n // child's own per-mount tagging is authoritative, and a leaf inside a\n // required-on-its-own-mount field stays unmarked even if its parent\n // mount was optional. This matches the \"if you DO provide a role, the\n // role's required fields are still required\" semantics.\n const isOptionalMount = typeof item.options.optional === 'function' ?\n Boolean(item.options.optional(value)) :\n item.options.optional === true\n ;\n // Shallow stamp — only the top-level `issue.meta`. Used for the\n // wrapping `IssueGroup` we emit for container mounts (Option B: do\n // not propagate the parent's optional flag onto the bubbled-up child\n // leaves, which retain their own per-mount tagging) and for leaves\n // we construct directly via `defineIssueItem`.\n //\n // We reassign `issue.meta` to a FRESH object rather than mutating\n // the existing one. The top-level `issue` is always safe to mutate\n // here (it's a fresh object from `prefixIssuePath`'s shallow spread\n // or one of the `defineIssue*` factories), but the inner `meta`\n // object can be shared with the validator's original\n // `ValidupError.issues[i].meta` — mutating in place would leak\n // `optional: true` back into the validator's own (possibly cached\n // or replayed) error.\n const markOptional = <I extends Issue>(issue: I): I => {\n if (!isOptionalMount) {\n return issue;\n }\n issue.meta = { ...(issue.meta ?? {}), optional: true };\n return issue;\n };\n\n // Deep stamp — recurse into `IssueGroup.issues`. Used ONLY when the\n // whole tree was produced by *this* validator (e.g. an integration\n // adapter that threw `ValidupError([defineIssueGroup({ issues: [...] })])`).\n // Without this, `flattenIssueItems` would pull out the inner leaves\n // and miss `meta.optional` on them. Not used for container mounts —\n // see Option B above.\n const markOptionalDeep = <I extends Issue>(issue: I): I => {\n if (!isOptionalMount) {\n return issue;\n }\n markOptional(issue);\n if (issue.type === 'group') {\n issue.issues = issue.issues.map((nested) => markOptionalDeep(nested));\n }\n return issue;\n };\n\n const childIssues: Issue[] = [];\n\n if (isValidupError(error)) {\n for (let i = 0; i < error.issues.length; i++) {\n const prefixed = this.prefixIssuePath(error.issues[i], keyParts);\n // Stamp only when a *validator* threw `ValidupError` directly\n // (e.g. an integration adapter like `@validup/zod` reshaping\n // a foreign error into validup issues). Deep so that a\n // validator returning a nested `IssueGroup` tags leaves too.\n // For child Container runs, leave the bubbled tree alone —\n // see comment above.\n childIssues.push(item.type === 'validator' ? markOptionalDeep(prefixed) : prefixed);\n }\n } else if (isError(error)) {\n childIssues.push(markOptional(defineIssueItem({\n path: keyParts,\n message: error.message,\n })));\n } else {\n // Non-`Error` throw (string, plain object, null, …). Without a\n // synthetic issue here, the run would still flag the mount as\n // failed but the resulting `ValidupError.issues` would not\n // mention the throw at all — caller sees \"validation failed\"\n // with no diagnostic. Surface the stringified value so the\n // failure is at least traceable.\n childIssues.push(markOptional(defineIssueItem({\n path: keyParts,\n message: typeof error === 'string' && error.length > 0 ? error : `Non-Error throw: ${String(error)}`,\n })));\n }\n\n if (pathRelative) {\n if (item.type === 'container' || childIssues.length > 1) {\n // The wrapping group is itself an emission of *this* mount —\n // stamp it (shallow) so a tree-walking consumer can read the\n // optional signal at the group level. The leaves inside\n // follow the \"no inheritance\" rule and stay untouched for\n // container mounts; for multi-leaf validator mounts, the\n // leaves were already stamped above.\n issues.push(markOptional(defineIssueGroup({\n message: buildErrorMessageForAttribute(String(pathRelative)),\n data: { name: String(pathRelative) },\n path: keyParts,\n issues: childIssues,\n })));\n } else {\n issues.push(...childIssues);\n }\n } else {\n issues.push(...childIssues);\n }\n }\n\n /**\n * For `oneOf` containers, wrap the issues produced by a single branch\n * (slice from `branchStart` to the end of `issues`) into one sub-group\n * so per-branch identity is preserved in the final aggregate. Non-oneOf\n * containers leave the issue list untouched — they don't need branch\n * partitioning.\n *\n * The wrapping group's `path` is `[]` (the branch wraps everything\n * inside it; per-leaf paths are unchanged); `data.branch` is the\n * mount index; and `data.name` (when set) is the mount path so\n * consumers can label \"branch X failed\" without recomputing the\n * registration order.\n */\n private wrapBranchForOneOf(\n issues: Issue[],\n branchStart: number,\n item: Mount<C>,\n branchIndex: number,\n ): void {\n if (!this.options.oneOf) {\n return;\n }\n const branchIssues = issues.splice(branchStart);\n const data: Record<string, unknown> = { branch: branchIndex };\n if (item.path) {\n data.name = item.path;\n }\n issues.push(defineIssueGroup({\n message: item.path ?\n `Branch \"${item.path}\" failed` :\n `Branch ${branchIndex} failed`,\n data,\n path: [],\n issues: branchIssues,\n }));\n }\n\n /**\n * Apply post-loop semantics: oneOf aggregation, error throw, defaults\n * fill, and flat-vs-nested output expansion.\n */\n private finalizeOutput(\n output: Record<string, any>,\n options: ContainerRunOptions<T, C>,\n issues: Issue[],\n errorCount: number,\n itemCount: number,\n ): T {\n if (this.options.oneOf) {\n // Guard against the \"all branches filtered out\" case (group /\n // pathsToInclude / pathsToExclude can leave itemCount === 0).\n // Without it, a oneOf container with nothing to run would throw\n // ONE_OF_FAILED with an empty issues list. Shared\n // `buildOneOfFailedGroup` keeps the ONE_OF_FAILED shape in\n // lockstep with compose's any-of path so consumers / i18n\n // catalogs only format one variant.\n if (itemCount > 0 && errorCount === itemCount) {\n throw new ValidupError([buildOneOfFailedGroup(issues, { path: options.path ? options.path : [] })]);\n }\n } else if (errorCount > 0) {\n throw new ValidupError(issues);\n }\n\n if (options.defaults) {\n const defaultKeys = Object.keys(options.defaults);\n for (const defaultKey of defaultKeys) {\n if (\n !hasOwnProperty(output, defaultKey) ||\n typeof output[defaultKey] === 'undefined'\n ) {\n output[defaultKey] = (options.defaults as Record<string, any>)[defaultKey];\n }\n }\n }\n\n if (options.flat) {\n return output as T;\n }\n\n const temp: Record<string, any> = {};\n const keys = Object.keys(output);\n for (const key of keys) {\n setPathValue(temp, key, output[key]);\n }\n return temp as T;\n }\n\n private wrapSafeRunError(e: unknown, options: ContainerRunOptions<T, C>): Result<T> {\n // Abort is not a validation outcome — propagate it. Wrapping it\n // as a synthetic `Result.failure` would produce a misleading\n // \"AbortError\" issue at path `[]`.\n if (options.signal?.aborted) {\n throw e;\n }\n // Same reasoning for `runSync` structural violations.\n if (isRunSyncViolation(e)) {\n throw e;\n }\n\n if (isValidupError(e)) {\n return { success: false, error: e };\n }\n\n if (isError(e)) {\n return {\n success: false,\n error: new ValidupError([\n defineIssueItem({\n path: [],\n message: e.message,\n }),\n ]),\n };\n }\n\n // Non-`Error` throw (string, plain object, null, …). Surface a\n // stringified diagnostic so `Result.error.issues` is never empty —\n // an empty issue list with `success: false` is a confusing API\n // signal (\"validation failed\" with no diagnostic) and is what\n // landed in 0.x for non-Error throws.\n return {\n success: false,\n error: new ValidupError([\n defineIssueItem({\n path: [],\n message: typeof e === 'string' && e.length > 0 ? e : `Non-Error throw: ${String(e)}`,\n }),\n ]),\n };\n }\n\n private isItemGroupIncluded(\n item: Mount<C>,\n group?: string,\n ) : boolean {\n if (group === GroupKey.WILDCARD) {\n return true;\n }\n\n if (item.options.group) {\n if (Array.isArray(item.options.group)) {\n if (item.options.group.includes(GroupKey.WILDCARD)) {\n return true;\n }\n\n if (group && item.options.group.includes(group)) {\n return true;\n }\n } else {\n if (item.options.group === GroupKey.WILDCARD) {\n return true;\n }\n\n if (item.options.group === group) {\n return true;\n }\n }\n\n return false;\n }\n\n return true;\n }\n\n /**\n * Join flat-output keys with `.` separators, preserving any pre-existing\n * leading dot on the right-hand side. Note: keys containing a *literal*\n * dot collide with the dotted-path syntax used for nested-output\n * expansion (see `setPathValue` in `pathtrace`) and will produce\n * ambiguous output when re-expanded — avoid mounting/returning such keys.\n */\n private mergePaths(...args: (string | undefined)[]) {\n let output : string = '';\n\n for (const arg of args) {\n if (!arg || arg.length === 0) {\n continue;\n }\n\n if (arg.at(0) === '.') {\n output += arg;\n } else {\n output += output.length > 0 ? `.${arg}` : arg;\n }\n }\n\n return output;\n }\n\n protected initialize() : void {\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 { Container, isContainer } from '../container';\nimport type {\n ContainerOptions,\n IContainer,\n MountOptions,\n} from '../container/types';\nimport type { IBuilder, MountTarget } from './types';\nimport type { Validator } from '../validator';\n\ntype ValidatorStep<C> = {\n kind: 'validator',\n key: string,\n validator: Validator<C>,\n options: MountOptions,\n};\n\ntype NestStep<C> = {\n kind: 'nest',\n key: string,\n child: IContainer<any, C>,\n options: MountOptions,\n};\n\ntype Step<C> = ValidatorStep<C> | NestStep<C>;\n\nfunction isBuilder(value: unknown): value is IBuilder<Record<string, any>, unknown> {\n return typeof value === 'object' &&\n value !== null &&\n typeof (value as { build?: unknown }).build === 'function' &&\n typeof (value as { mount?: unknown }).mount === 'function';\n}\n\nexport class Builder<T extends Record<string, any>, C> implements IBuilder<T, C> {\n private readonly options: ContainerOptions<any>;\n\n private readonly steps: ReadonlyArray<Step<C>>;\n\n constructor(options: ContainerOptions<any>, steps: ReadonlyArray<Step<C>>) {\n this.options = options;\n this.steps = steps;\n }\n\n mount(key: string, ...rest: unknown[]): IBuilder<any, C> {\n let options: MountOptions = {};\n let target: MountTarget<C>;\n\n if (rest.length === 1) {\n target = rest[0] as MountTarget<C>;\n } else {\n options = rest[0] as MountOptions;\n target = rest[1] as MountTarget<C>;\n }\n\n let step: Step<C>;\n if (isBuilder(target)) {\n step = {\n kind: 'nest',\n key,\n child: (target as IBuilder<any, C>).build(),\n options,\n };\n } else if (isContainer(target)) {\n step = {\n kind: 'nest',\n key,\n child: target as IContainer<any, C>,\n options,\n };\n } else {\n step = {\n kind: 'validator',\n key,\n validator: target as Validator<C>,\n options,\n };\n }\n\n return new Builder<any, C>(this.options, [...this.steps, step]);\n }\n\n oneOf(): IBuilder<T, C> {\n return new Builder<T, C>(\n { ...this.options, oneOf: true },\n this.steps,\n );\n }\n\n pathsToInclude(...paths: (keyof T & string)[]): IBuilder<T, C> {\n return new Builder<T, C>(\n {\n ...this.options,\n pathsToInclude: [\n ...((this.options.pathsToInclude as string[]) ?? []),\n ...paths,\n ] as ContainerOptions<any>['pathsToInclude'],\n },\n this.steps,\n );\n }\n\n pathsToExclude(...paths: (keyof T & string)[]): IBuilder<T, C> {\n return new Builder<T, C>(\n {\n ...this.options,\n pathsToExclude: [\n ...((this.options.pathsToExclude as string[]) ?? []),\n ...paths,\n ] as ContainerOptions<any>['pathsToExclude'],\n },\n this.steps,\n );\n }\n\n build(): Container<T, C> {\n const container = new Container<T, C>(this.options as ContainerOptions<T>);\n for (const step of this.steps) {\n if (step.kind === 'nest') {\n container.mount(step.key, step.options, step.child);\n } else {\n container.mount(step.key, step.options, step.validator);\n }\n }\n return container;\n }\n}\n\n/**\n * Entry point for the compile-time-typed schema builder. The accumulator\n * starts at `{}` and grows as `.mount(...)` calls are chained;\n * `.build()` returns a `Container<T, C>` whose `run()` reflects the\n * accumulated shape.\n *\n * Pass the context type as the generic parameter to flow it through nested\n * builders and validator factories: `defineSchema<MyContext>()`.\n */\nexport function defineSchema<C = unknown>(): IBuilder<{}, C> {\n return new Builder<{}, C>({}, []);\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 type { IResultCache } from './types';\nimport { isObject } from '../utils';\n\n/**\n * Duck-typed guard for {@link IResultCache}. Avoids `instanceof`\n * checks so caches constructed from a different copy of the package\n * (workspaces with duplicated `validup` installs, adapter bundles)\n * still round-trip cleanly.\n */\nexport function isResultCache(input: unknown): input is IResultCache {\n if (!isObject(input)) {\n return false;\n }\n\n return (\n typeof input.get === 'function' &&\n typeof input.set === 'function' &&\n typeof input.delete === 'function' &&\n typeof input.clear === 'function'\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 type { IResultCache, ResultCacheEntry } from './types';\n\n/**\n * Default in-memory {@link IResultCache} implementation.\n *\n * Backed by a two-level `Map`:\n * - outer key — Mount reference (opaque object)\n * - inner key — expanded path (string)\n *\n * `Map` is used for both levels (rather than a `WeakMap` on the outer)\n * so `clear()` is supported. Cache entries become unreachable when the\n * owning composable / caller drops its reference to the\n * `ResultCache` instance; in the typical `@validup/vue` flow that\n * happens on `onScopeDispose`, which lines up with component unmount.\n *\n * Snapshot equality (the \"is this still valid?\" check) is the run\n * loop's job — see `container/module.ts`. This class is dumb storage.\n */\nexport class ResultCache implements IResultCache {\n private store: Map<object, Map<string, ResultCacheEntry>>;\n\n constructor() {\n this.store = new Map();\n }\n\n get(mount: object, key: string): ResultCacheEntry | undefined {\n return this.store.get(mount)?.get(key);\n }\n\n set(mount: object, key: string, entry: ResultCacheEntry): void {\n let inner = this.store.get(mount);\n if (!inner) {\n inner = new Map();\n this.store.set(mount, inner);\n }\n inner.set(key, entry);\n }\n\n delete(mount: object, key?: string): void {\n if (typeof key === 'undefined') {\n this.store.delete(mount);\n return;\n }\n const inner = this.store.get(mount);\n if (!inner) {\n return;\n }\n inner.delete(key);\n if (inner.size === 0) {\n this.store.delete(mount);\n }\n }\n\n clear(): void {\n this.store.clear();\n }\n}\n"],"mappings":";;;;AAOA,SAAgB,eAAoD,KAAQ,MAAwC;CAChH,OAAO,OAAO,UAAU,eAAe,KAAK,KAAK,IAAI;AACzD;;;ACFA,SAAgB,SAAS,OAA+C;CACpE,OAAO,CAAC,CAAC,SACL,OAAO,UAAU,YACjB,CAAC,MAAM,QAAQ,KAAK;AAC5B;;;ACDA,SAAgB,YAAY,OAAsC;CAC9D,OAAO,SAAS,KAAK,KACjB,OAAO,MAAM,QAAQ,cACrB,OAAO,MAAM,YAAY;AACjC;;;ACHA,IAAa,eAAb,cAAkC,UAAU;CACxC;CAEA,YAAY,SAAkB,CAAC,GAAG;EAC9B,MAAM,QAAQ,OAAO,KAAK,UAAU,cAAc,MAAM,IAAI,CAAC;EAC7D,MAAM,EAAE,SAAS,+BAA+B,KAAK,EAAE,CAAC;EAExD,KAAK,SAAS;CAClB;CAEA,SAAyE;EACrE,OAAO;GACH,GAAG,MAAM,OAAO;GAChB,QAAQ,KAAK;EACjB;CACJ;AACJ;;;ACZA,SAAS,YAAY,OAAyC;CAC1D,IAAI,CAAC,MAAM,QAAQ,KAAK,GACpB,OAAO;CAGX,OAAO,MAAM,OAAO,OAAO,OAAO,OAAO,YACzC,OAAO,OAAO,YACd,OAAO,OAAO,QAAQ;AAC1B;AAEA,SAAS,YAAY,OAA6D;CAC9E,IAAI,CAAC,SAAS,KAAK,GACf,OAAO;CAGX,IAAI,OAAO,MAAM,YAAY,UACzB,OAAO;CAGX,IAAI,CAAC,YAAY,MAAM,IAAI,GACvB,OAAO;CAGX,OAAO,OAAO,MAAM,SAAS,eACzB,SAAS,MAAM,IAAI;AAC3B;AAEA,SAAgB,YAAY,OAAqC;CAC7D,IAAI,CAAC,YAAY,KAAK,GAClB,OAAO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@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "validup",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
5
  "description": "A validation library.",
6
6
  "author": {
@@ -25,10 +25,10 @@
25
25
  "dist"
26
26
  ],
27
27
  "engines": {
28
- "node": ">=22.0.0"
28
+ "node": ">=24.0.0"
29
29
  },
30
30
  "scripts": {
31
- "build:types": "tsc --noEmit",
31
+ "build:types": "tsc --noEmit -p tsconfig.build.json",
32
32
  "build:js": "tsdown",
33
33
  "build": "npm run build:types && npm run build:js",
34
34
  "test": "vitest --config test/vitest.config.ts --run",