Skip to content

@jayoncode/form-intelligence API


@jayoncode/form-intelligence API

Classes

FormModuleHost

Type Parameters

Type Parameter
TValues extends Record<string, unknown>

Constructors

Constructor
ts
new FormModuleHost<TValues>(
   form: FormInstance<TValues>, 
   config: ResolvedFormConfig<TValues>, 
   events: FormEventBus, 
pluginRegistry: PluginRegistry<TValues>): FormModuleHost<TValues>;
Parameters
ParameterType
formFormInstance<TValues>
configResolvedFormConfig<TValues>
eventsFormEventBus
pluginRegistryPluginRegistry<TValues>
Returns

FormModuleHost<TValues>

Methods

register()
ts
register(module: FormModule<TValues>): void;
Parameters
ParameterType
moduleFormModule<TValues>
Returns

void

registerPlugin()
ts
registerPlugin(plugin: FormPlugin<TValues>, order?: number): void;
Parameters
ParameterType
pluginFormPlugin<TValues>
ordernumber
Returns

void

has()
ts
has(id: string): boolean;
Parameters
ParameterType
idstring
Returns

boolean

start()
ts
start(): void;
Returns

void

destroy()
ts
destroy(): void;
Returns

void


FormModuleRegistry

Type Parameters

Type Parameter
TValues extends Record<string, unknown>

Constructors

Constructor
ts
new FormModuleRegistry<TValues>(): FormModuleRegistry<TValues>;
Returns

FormModuleRegistry<TValues>

Methods

register()
ts
register(module: FormModule<TValues>): void;
Parameters
ParameterType
moduleFormModule<TValues>
Returns

void

unregister()
ts
unregister(id: string): boolean;
Parameters
ParameterType
idstring
Returns

boolean

has()
ts
has(id: string): boolean;
Parameters
ParameterType
idstring
Returns

boolean

size()
ts
size(): number;
Returns

number

list()
ts
list(): readonly FormModule<TValues>[];
Returns

readonly FormModule<TValues>[]

initializeAll()
ts
initializeAll(context: FormModuleContext<TValues>): void;
Parameters
ParameterType
contextFormModuleContext<TValues>
Returns

void

startAll()
ts
startAll(context: FormModuleContext<TValues>): void;
Parameters
ParameterType
contextFormModuleContext<TValues>
Returns

void

stopAll()
ts
stopAll(context: FormModuleContext<TValues>): void;
Parameters
ParameterType
contextFormModuleContext<TValues>
Returns

void

destroyAll()
ts
destroyAll(context: FormModuleContext<TValues>): void;
Parameters
ParameterType
contextFormModuleContext<TValues>
Returns

void


DependencyEngine

Structural dependency graph façade (Phase 6 / ADR-007).

Constructors

Constructor
ts
new DependencyEngine(options?: DependencyEngineOptions): DependencyEngine;
Parameters
ParameterType
optionsDependencyEngineOptions
Returns

DependencyEngine

Methods

registerMap()
ts
registerMap(map: DependencyMap, options?: {
  actions?: readonly DependencyAction[];
  actionsByChild?: Partial<Record<string, readonly DependencyAction[]>>;
  inferred?: boolean;
}): void;
Parameters
ParameterType
mapDependencyMap
options?{ actions?: readonly DependencyAction[]; actionsByChild?: Partial<Record<string, readonly DependencyAction[]>>; inferred?: boolean; }
options.actions?readonly DependencyAction[]
options.actionsByChild?Partial<Record<string, readonly DependencyAction[]>>
options.inferred?boolean
Returns

void

addEdge()
ts
addEdge(
   child: string, 
   parents: readonly string[], 
   actions?: readonly DependencyAction[], 
   options?: {
  clearValue?: unknown;
  inferred?: boolean;
}): void;
Parameters
ParameterTypeDefault value
childstringundefined
parentsreadonly string[]undefined
actionsreadonly DependencyAction[]DEFAULT_DEPENDENCY_ACTIONS
options?{ clearValue?: unknown; inferred?: boolean; }undefined
options.clearValue?unknownundefined
options.inferred?booleanundefined
Returns

void

addEdgeConfig()
ts
addEdgeConfig(config: DependencyEdgeConfig & {
  to: string;
}): void;
Parameters
ParameterType
configDependencyEdgeConfig & { to: string; }
Returns

void

syncInferredFromFields()
ts
syncInferredFromFields<TValues>(fields: ReadonlyMap<string, FieldOptions<TValues>>): void;

Sync inferred edges from FieldOptions.dependsOn (revalidate-only).

Type Parameters
Type Parameter
TValues extends Record<string, unknown>
Parameters
ParameterType
fieldsReadonlyMap<string, FieldOptions<TValues>>
Returns

void

getDependents()
ts
getDependents(path: string): readonly string[];
Parameters
ParameterType
pathstring
Returns

readonly string[]

getParents()
ts
getParents(path: string): readonly string[];
Parameters
ParameterType
pathstring
Returns

readonly string[]

detectCycles()
ts
detectCycles(): readonly readonly string[][];
Returns

readonly readonly string[][]

topologicalOrder()
ts
topologicalOrder(seeds?: readonly string[]): readonly string[];
Parameters
ParameterType
seeds?readonly string[]
Returns

readonly string[]

inspect()
ts
inspect(): DependencyGraph;
Returns

DependencyGraph

onParentChange()
ts
onParentChange(path: string): CascadeResult;

Propagate a parent change: clear / revalidate / recompute / reloadOptions for dependents in topological order.

Parameters
ParameterType
pathstring
Returns

CascadeResult


FormIntelligentError

Extends

  • Error

Extended by

Constructors

Constructor
ts
new FormIntelligentError(
   message: string, 
   code: FormErrorCode, 
   options?: FormErrorOptions): FormIntelligentError;
Parameters
ParameterType
messagestring
codeFormErrorCode
optionsFormErrorOptions
Returns

FormIntelligentError

Overrides
ts
Error.constructor

Properties

PropertyModifierType
codereadonlyFormErrorCode
detailsreadonlyReadonly<PlainObject> | undefined

ValidationError

Extends

Constructors

Constructor
ts
new ValidationError(message: string, options?: FormErrorOptions): ValidationError;
Parameters
ParameterType
messagestring
optionsFormErrorOptions
Returns

ValidationError

Overrides

FormIntelligentError.constructor

Properties

PropertyModifierTypeInherited from
codereadonlyFormErrorCodeFormIntelligentError.code
detailsreadonlyReadonly<PlainObject> | undefinedFormIntelligentError.details

SubmitError

Extends

Constructors

Constructor
ts
new SubmitError(message: string, options?: FormErrorOptions): SubmitError;
Parameters
ParameterType
messagestring
optionsFormErrorOptions
Returns

SubmitError

Overrides

FormIntelligentError.constructor

Properties

PropertyModifierTypeInherited from
codereadonlyFormErrorCodeFormIntelligentError.code
detailsreadonlyReadonly<PlainObject> | undefinedFormIntelligentError.details

WorkflowError

Extends

Constructors

Constructor
ts
new WorkflowError(message: string, options?: FormErrorOptions): WorkflowError;
Parameters
ParameterType
messagestring
optionsFormErrorOptions
Returns

WorkflowError

Overrides

FormIntelligentError.constructor

Properties

PropertyModifierTypeInherited from
codereadonlyFormErrorCodeFormIntelligentError.code
detailsreadonlyReadonly<PlainObject> | undefinedFormIntelligentError.details

ConfigurationError

Extends

Constructors

Constructor
ts
new ConfigurationError(message: string, options?: FormErrorOptions): ConfigurationError;
Parameters
ParameterType
messagestring
optionsFormErrorOptions
Returns

ConfigurationError

Overrides

FormIntelligentError.constructor

Properties

PropertyModifierTypeInherited from
codereadonlyFormErrorCodeFormIntelligentError.code
detailsreadonlyReadonly<PlainObject> | undefinedFormIntelligentError.details

DraftStorageError

Recoverable draft persistence failures (quota, corrupt payload).

Extends

Constructors

Constructor
ts
new DraftStorageError(message: string, options?: FormErrorOptions): DraftStorageError;
Parameters
ParameterType
messagestring
optionsFormErrorOptions
Returns

DraftStorageError

Overrides

FormIntelligentError.constructor

Properties

PropertyModifierTypeInherited from
codereadonlyFormErrorCodeFormIntelligentError.code
detailsreadonlyReadonly<PlainObject> | undefinedFormIntelligentError.details

OfflineQueueError

Offline queue failures (quota, overflow reject).

Extends

Constructors

Constructor
ts
new OfflineQueueError(message: string, options?: FormErrorOptions): OfflineQueueError;
Parameters
ParameterType
messagestring
optionsFormErrorOptions
Returns

OfflineQueueError

Overrides

FormIntelligentError.constructor

Properties

PropertyModifierTypeInherited from
codereadonlyFormErrorCodeFormIntelligentError.code
detailsreadonlyReadonly<PlainObject> | undefinedFormIntelligentError.details

PluginError

Isolated plugin/middleware failures (setup or hook throw).

Extends

Constructors

Constructor
ts
new PluginError(message: string, options?: FormErrorOptions): PluginError;
Parameters
ParameterType
messagestring
optionsFormErrorOptions
Returns

PluginError

Overrides

FormIntelligentError.constructor

Properties

PropertyModifierTypeInherited from
codereadonlyFormErrorCodeFormIntelligentError.code
detailsreadonlyReadonly<PlainObject> | undefinedFormIntelligentError.details

MiddlewarePipeline

Onion middleware registry. Lower order runs earlier (outer). Same order → registration order.

Type Parameters

Type Parameter
TValues extends Record<string, unknown>

Constructors

Constructor
ts
new MiddlewarePipeline<TValues>(): MiddlewarePipeline<TValues>;
Returns

MiddlewarePipeline<TValues>

Methods

use()
ts
use(middleware: MiddlewareInput<TValues>): () => void;
Parameters
ParameterType
middlewareMiddlewareInput<TValues>
Returns

() => void

run()
ts
run(input: {
  form: FormInstance<TValues>;
  phase: MiddlewarePhase;
  signal: AbortSignal;
  meta?: Readonly<Record<string, unknown>>;
}): Promise<MiddlewareRunResult>;
Parameters
ParameterType
input{ form: FormInstance<TValues>; phase: MiddlewarePhase; signal: AbortSignal; meta?: Readonly<Record<string, unknown>>; }
input.formFormInstance<TValues>
input.phaseMiddlewarePhase
input.signalAbortSignal
input.meta?Readonly<Record<string, unknown>>
Returns

Promise<MiddlewareRunResult>

clear()
ts
clear(): void;
Returns

void

Interfaces

FormController

Thin façade over FormInstance for adapters and design systems.

Type Parameters

Type ParameterDefault type
TValues extends Record<string, unknown>Record<string, unknown>

Properties

PropertyModifierType
statereadonlyFormState<TValues>

Methods

subscribe()
ts
subscribe(listener: () => void): () => void;
Parameters
ParameterType
listener() => void
Returns

() => void

getSnapshot()
ts
getSnapshot(): FormState<TValues>;
Returns

FormState<TValues>

submit()
ts
submit(options?: SubmitOptions): Promise<boolean>;
Parameters
ParameterType
options?SubmitOptions
Returns

Promise<boolean>

reset()
ts
reset(options?: ResetOptions<TValues>): void;
Parameters
ParameterType
options?ResetOptions<TValues>
Returns

void

field()
ts
field(path: string): FieldController<TValues>;
Parameters
ParameterType
pathstring
Returns

FieldController<TValues>

firstInvalidPath()
ts
firstInvalidPath(): string | undefined;

First path with a non-empty error message.

Returns

string | undefined

focusFirstInvalid()
ts
focusFirstInvalid(): string | undefined;

Focuses the first invalid control when a DOM document is available. Returns the path (or undefined if none). Safe no-op under SSR.

Returns

string | undefined

destroy()
ts
destroy(): void;
Returns

void


FrameworkAdapter

Contract for framework UI adapters (React, Vue, Angular, Svelte, …). Implementations ship in separate packages — never required by core.

Type Parameters

Type ParameterDefault type
TValues extends Record<string, unknown>Record<string, unknown>

Properties

PropertyModifierType
namereadonlystring

Methods

connect()
ts
connect(form: FormInstance<TValues>): void | (() => void);

Bind framework lifecycle / reactivity to a form instance. Return a cleanup that disconnects subscriptions and effects.

Parameters
ParameterType
formFormInstance<TValues>
Returns

void | (() => void)


PersistenceAdapter

Persist form values for drafts and autosave. Implementations may be sync (localStorage) or async (IndexedDB, remote).

Type Parameters

Type ParameterDefault type
TValues extends Record<string, unknown>Record<string, unknown>

Properties

PropertyModifierType
name?readonlystring

Methods

load()
ts
load(key: string): TValues | Promise<TValues | null> | null;
Parameters
ParameterType
keystring
Returns

TValues | Promise<TValues | null> | null

save()
ts
save(key: string, values: TValues): void | Promise<void>;
Parameters
ParameterType
keystring
valuesTValues
Returns

void | Promise<void>

clear()
ts
clear(key: string): void | Promise<void>;
Parameters
ParameterType
keystring
Returns

void | Promise<void>


SyncPersistenceAdapter

Sync persistence surface used by draft workflow today. Compatible with PersistenceAdapter when methods are synchronous.

Type Parameters

Type ParameterDefault type
TValues extends Record<string, unknown>Record<string, unknown>

Properties

PropertyModifierType
name?readonlystring

Methods

load()
ts
load(key: string): TValues | null;
Parameters
ParameterType
keystring
Returns

TValues | null

save()
ts
save(key: string, values: TValues): void;
Parameters
ParameterType
keystring
valuesTValues
Returns

void

clear()
ts
clear(key: string): void;
Parameters
ParameterType
keystring
Returns

void


SchemaAdapter

Bridge any validation library into Form Intelligence. Schema adapters are optional — core never depends on Zod/Yup/etc. Error keys are field paths (dot notation).

Type Parameters

Type ParameterDefault type
TValues extends Record<string, unknown>Record<string, unknown>

Properties

PropertyModifierType
name?readonlystring

Methods

validate()
ts
validate(values: TValues): 
  | Readonly<Record<string, string>>
| Promise<Readonly<Record<string, string>>>;
Parameters
ParameterType
valuesTValues
Returns

| Readonly<Record<string, string>> | Promise<Readonly<Record<string, string>>>


SubmitTransportAdapter

Transport layer for form submission (fetch, GraphQL, custom API clients). Keep UI frameworks out of this interface — values + meta only.

Type Parameters

Type ParameterDefault type
TValues extends Record<string, unknown>Record<string, unknown>
TResultunknown

Properties

PropertyModifierType
name?readonlystring

Methods

submit()
ts
submit(values: TValues, meta?: SubmitMeta): TResult | Promise<TResult>;
Parameters
ParameterType
valuesTValues
meta?SubmitMeta
Returns

TResult | Promise<TResult>


FormModuleContext

Type Parameters

Type Parameter
TValues extends Record<string, unknown>

Properties

PropertyModifierType
formreadonlyFormInstance<TValues>
configreadonlyResolvedFormConfig<TValues>
eventsreadonlyFormEventBus

Methods

registerCleanup()
ts
registerCleanup(cleanup: () => void): void;
Parameters
ParameterType
cleanup() => void
Returns

void


FormModule

Type Parameters

Type ParameterDefault type
TValues extends Record<string, unknown>Record<string, unknown>

Properties

PropertyModifierType
idreadonlystring
order?readonlynumber

Methods

initialize()?
ts
optional initialize(context: FormModuleContext<TValues>): void;
Parameters
ParameterType
contextFormModuleContext<TValues>
Returns

void

start()?
ts
optional start(context: FormModuleContext<TValues>): void;
Parameters
ParameterType
contextFormModuleContext<TValues>
Returns

void

stop()?
ts
optional stop(context: FormModuleContext<TValues>): void;
Parameters
ParameterType
contextFormModuleContext<TValues>
Returns

void

destroy()?
ts
optional destroy(context: FormModuleContext<TValues>): void;
Parameters
ParameterType
contextFormModuleContext<TValues>
Returns

void


FieldAriaIds

Properties

PropertyModifierType
errorId?readonlystring
descriptionId?readonlystring

FieldAria

CamelCase ARIA snapshot for adapters and FieldController.

Properties

PropertyModifierType
ariaInvalidreadonlyboolean
ariaRequiredreadonlyboolean
ariaDescribedByreadonlystring | undefined

FieldAriaAttributes

Spread-friendly DOM attributes ({...field.aria.attributes}).

Properties

PropertyModifierType
aria-invalidreadonlyboolean
aria-requiredreadonlyboolean | undefined
aria-describedbyreadonlystring | undefined

ComputeFieldAriaInput

Properties

PropertyModifierTypeDescription
error?readonlystring-
required?readonlybooleanTrue when presentation/UI marks the field required.
ids?readonlyFieldAriaIds-

FieldAriaResult

Properties

PropertyModifierType
ariareadonlyFieldAria
attributesreadonlyFieldAriaAttributes

CalculationBuilder

Type Parameters

Type ParameterDefault type
TValues extends Record<string, unknown>Record<string, unknown>

Methods

from()
ts
from(...deps: string[]): CalculationBuilder<TValues>;
Parameters
ParameterType
...depsstring[]
Returns

CalculationBuilder<TValues>

lazy()
ts
lazy(enabled?: boolean): CalculationBuilder<TValues>;
Parameters
ParameterType
enabled?boolean
Returns

CalculationBuilder<TValues>

memoized()
ts
memoized(enabled?: boolean): CalculationBuilder<TValues>;
Parameters
ParameterType
enabled?boolean
Returns

CalculationBuilder<TValues>

markDirty()
ts
markDirty(enabled?: boolean): CalculationBuilder<TValues>;
Parameters
ParameterType
enabled?boolean
Returns

CalculationBuilder<TValues>

compute()
ts
compute(fn: (ctx: CalculationComputeContext<TValues>) => unknown): void;
Parameters
ParameterType
fn(ctx: CalculationComputeContext<TValues>) => unknown
Returns

void


CalculationDefinition

Type Parameters

Type Parameter
TValues extends Record<string, unknown>

Properties

PropertyModifierTypeDescription
pathreadonlystring-
computereadonly(context: CalculationComputeContext<TValues>) => unknown-
deps?readonlyreadonly string[]-
markDirty?readonlybooleanWhen true, writing the derived value marks the field dirty. Default false.
lazy?readonlybooleanSkip initial compute on register; still runs when deps change.
memoized?readonlybooleanSkip compute when dependency fingerprint is unchanged.

CalculateOptions

Type Parameters

Type Parameter
TValues extends Record<string, unknown>

Properties

PropertyModifierType
deps?readonlyreadonly string[]
markDirty?readonlyboolean
lazy?readonlyboolean
memoized?readonlyboolean
computereadonly(context: { values: TValues; }) => unknown

DependencyRegistrar()

Type Parameters

Type ParameterDefault type
_TValues extends Record<string, unknown>Record<string, unknown>
ts
DependencyRegistrar(map: DependencyMap): DependencyRegistrar<_TValues>;

Parameters

ParameterType
mapDependencyMap

Returns

DependencyRegistrar<_TValues>

Methods

ts
link(parent: string): {
  to: {
     effect: DependencyRegistrar<_TValues>;
  };
};
Parameters
ParameterType
parentstring
Returns
ts
{
  to: {
     effect: DependencyRegistrar<_TValues>;
  };
}
NameType
to()(child: string) => { effect: DependencyRegistrar<_TValues>; }
edge()
ts
edge(config: DependencyEdgeConfig & {
  to: string;
}): DependencyRegistrar<_TValues>;
Parameters
ParameterType
configDependencyEdgeConfig & { to: string; }
Returns

DependencyRegistrar<_TValues>

inspect()
ts
inspect(): DependencyGraph;
Returns

DependencyGraph


DependencyEdgeConfig

Properties

PropertyModifierType
fromreadonlystring | readonly string[]
actions?readonlyreadonly DependencyAction[]
clearValue?readonlyunknown

DependencyEdge

Properties

PropertyModifierTypeDescription
fromreadonlystring-
toreadonlystring-
actionsreadonlyreadonly DependencyAction[]-
clearValue?readonlyunknown-
inferred?readonlybooleanInferred from FieldOptions.dependsOn — cycles warn; explicit edges throw.

DependencyNode

Properties

PropertyModifierType
pathreadonlystring
parentsreadonlyreadonly string[]
childrenreadonlyreadonly string[]

DependencyGraph

Properties

PropertyModifierType
nodesreadonlyReadonlyMap<string, DependencyNode>
edgesreadonlyreadonly DependencyEdge[]

Methods

dependentsOf()
ts
dependentsOf(path: string): readonly string[];
Parameters
ParameterType
pathstring
Returns

readonly string[]

parentsOf()
ts
parentsOf(path: string): readonly string[];
Parameters
ParameterType
pathstring
Returns

readonly string[]

topoOrder()
ts
topoOrder(seeds?: readonly string[]): readonly string[];
Parameters
ParameterType
seeds?readonly string[]
Returns

readonly string[]


CascadeResult

Properties

PropertyModifierType
clearsreadonlyreadonly { path: string; clearValue: unknown; }[]
revalidatereadonlyreadonly string[]
recomputereadonlyreadonly string[]
reloadOptionsreadonlyreadonly string[]

PresentationState

Properties

PropertyModifierType
fieldreadonlyFieldUiState
optionsreadonlyreadonly FieldOption[] | undefined
formreadonlyFormUiState

PresentationSnapshot

Properties

PropertyModifierType
fieldUireadonlyFieldUiMap
formUireadonlyFormUiState
fieldOptionsreadonlyReadonly<Record<FieldPath, readonly FieldOption[]>>

TransformContext

Type Parameters

Type ParameterDefault type
TValues extends Record<string, unknown>Record<string, unknown>

Properties

PropertyModifierType
pathreadonlystring
valuesreadonlyTValues
signal?readonlyAbortSignal

SanitizeOptions

Properties

PropertyModifierTypeDescription
stripHtml?readonlybooleanStrip simple HTML tags. Default true when sanitize: true.
stripControlChars?readonlybooleanStrip C0 control chars except tab/newline. Default true when sanitize: true.

TransformPipelineOptions

Properties

PropertyModifierType
trim?readonlyboolean | "start" | "end" | "both"
normalize?readonlyboolean | "nfc" | "nfd"
sanitize?readonlyboolean | SanitizeOptions
parse?readonlyParser
stages?readonlyreadonly TransformFn<Record<string, unknown>>[]

TransformPipelineHandle

Methods

pipe()
ts
pipe(...stages: TransformFn<Record<string, unknown>>[]): TransformPipelineHandle;
Parameters
ParameterType
...stagesTransformFn<Record<string, unknown>>[]
Returns

TransformPipelineHandle

clear()
ts
clear(): void;
Returns

void


FieldUiState

Properties

PropertyTypeDescription
visibleboolean-
disabledboolean-
requiredboolean | undefined-
readOnly?booleanAdditive — when true, controls should be non-editable but still focusable.
busy?booleanAdditive — e.g. async option load / validating.
hasError?booleanDerived UI projection (validation state): raw error present. Distinct from showError (whether to display).
errorMessage?stringDerived UI projection: error string when present.
showError?booleanDerived UI projection (UI state): whether the error should be displayed under the active errorDisplay policy.
status?"validating" | "error" | "success" | "idle"Derived UI projection: exactly one of validating

FormUiState

Properties

PropertyModifierType
submitDisabledreadonlyboolean

FieldOption

Properties

PropertyModifierType
labelreadonlystring
valuereadonlystring

RuleContext

Type Parameters

Type Parameter
TValues extends Record<string, unknown>

Properties

PropertyModifierType
valuesreadonlyTValues

Methods

show()
ts
show(...paths: readonly string[]): void;
Parameters
ParameterType
...pathsreadonly string[]
Returns

void

hide()
ts
hide(...paths: readonly string[]): void;
Parameters
ParameterType
...pathsreadonly string[]
Returns

void

require()
ts
require(...paths: readonly string[]): void;
Parameters
ParameterType
...pathsreadonly string[]
Returns

void

optional()
ts
optional(...paths: readonly string[]): void;
Parameters
ParameterType
...pathsreadonly string[]
Returns

void

enable()
ts
enable(...paths: readonly string[]): void;
Parameters
ParameterType
...pathsreadonly string[]
Returns

void

disable()
ts
disable(...paths: readonly string[]): void;
Parameters
ParameterType
...pathsreadonly string[]
Returns

void

disableSubmit()
ts
disableSubmit(): void;
Returns

void

enableSubmit()
ts
enableSubmit(): void;
Returns

void

setValue()
ts
setValue(path: string, value: unknown): void;
Parameters
ParameterType
pathstring
valueunknown
Returns

void


FormRuleDefinition

Type Parameters

Type ParameterDefault type
TValues extends Record<string, unknown>Record<string, unknown>

Properties

PropertyModifierType
watchreadonlystring
equals?readonlyunknown
notEquals?readonlyunknown
greaterThan?readonlynumber
lessThan?readonlynumber
show?readonlyreadonly string[]
hide?readonlyreadonly string[]
require?readonlyreadonly string[]
optional?readonlyreadonly string[]
enable?readonlyreadonly string[]
disable?readonlyreadonly string[]
disableSubmit?readonlyboolean
changes?readonly(value: unknown, values: TValues) => | readonly FieldOption[] | Promise<readonly FieldOption[]>
populate?readonlystring
then?readonly(context: RuleContext<TValues>) => void

WizardStep

Properties

PropertyModifierTypeDescription
id?readonlystring-
fields?readonlyreadonly string[]-
validate?readonlyboolean-
when?readonly(values: Record<string, unknown>) => booleanSkip this step when predicate returns false (conditional steps MVP).
next?readonly| string | ((values: Record<string, unknown>) => string | undefined)Explicit next step id, or resolver from values.
canLeave?readonly(ctx: WizardGuardContext) => boolean | Promise<boolean>-
canEnter?readonly(ctx: WizardGuardContext) => boolean | Promise<boolean>-

WizardGuardContext

Type Parameters

Type ParameterDefault type
TValues extends Record<string, unknown>Record<string, unknown>

Properties

PropertyModifierType
valuesreadonlyTValues
fromStepIdreadonlystring | undefined
toStepIdreadonlystring
signalreadonlyAbortSignal

WizardConfig

Properties

PropertyModifierTypeDescription
stepsreadonlyreadonly WizardStep[]-
initialStep?readonlynumber-
goToValidation?readonlyWizardNavigateValidationDefault validation for goTo. - all — validate entire form (SHIPPED default) - step — validate current step fields only - none — skip validation
persistStepInDraft?readonlybooleanWhen true, draft save/restore includes currentStep.

WizardStepGraphNode

Properties

PropertyModifierType
idreadonlystring
indexreadonlynumber
nextIdsreadonlyreadonly string[]

WizardStepGraph

Properties

PropertyModifierType
nodesreadonlyreadonly WizardStepGraphNode[]

JsonFormPayload

Type Parameters

Type Parameter
TValues extends Record<string, unknown>

Properties

PropertyModifierType
kindreadonly"json"
valuesreadonlyTValues

MultipartFormPayload

Properties

PropertyModifierType
kindreadonly"multipart"
formDatareadonlyFormData

ToFormDataOptions

Properties

PropertyModifierTypeDescription
omitEmpty?readonlybooleanSkip empty strings, empty file arrays, null, and undefined. Default true.

PluginErrorReport

Properties

PropertyModifierType
plugin?readonlystring
hook?readonlystring
phase?readonlystring
errorreadonlyunknown

MiddlewareContext

Type Parameters

Type ParameterDefault type
TValues extends Record<string, unknown>Record<string, unknown>

Properties

PropertyModifierType
formreadonlyFormInstance<TValues>
phasereadonlyMiddlewarePhase
signalreadonlyAbortSignal
metareadonlyReadonly<Record<string, unknown>>

Methods

halt()
ts
halt(reason?: string): void;
Parameters
ParameterType
reason?string
Returns

void


MiddlewareRegistration

Properties

PropertyModifierType
namereadonlystring
order?readonlynumber
phases?readonlyreadonly MiddlewarePhase[]

MiddlewareRunResult

Properties

PropertyModifierType
haltedreadonlyboolean
reason?readonlystring

AsyncRetryPolicy

Properties

PropertyModifierTypeDescription
maxAttemptsreadonlynumberTotal attempts including the first; minimum 1.
delayMs?readonlynumber | ((attempt: number) => number)Attempt is 1-based after a failure.
shouldRetry?readonly(error: unknown, attempt: number) => boolean-

AsyncCachePolicy

Properties

PropertyModifierTypeDescription
ttlreadonlyTtlInput-
storage?readonly"memory" | "session"Default "memory". "session" is accepted for API compatibility but is memory-only — async validation outcomes are never written to sessionStorage (cleartext sensitive-data policy).
maxEntries?readonlynumberDefault 256.

AsyncValidatorOptions

Type Parameters

Type ParameterDefault type
TValues extends Record<string, unknown>Record<string, unknown>

Properties

PropertyModifierType
validatereadonly(value: unknown, context: ValidationContext<TValues> & { signal: AbortSignal; }) => | ValidatorResult | Promise<ValidatorResult>
debounce?readonlynumber
retry?readonlynumber | AsyncRetryPolicy
timeout?readonlynumber
cache?readonlyfalse | TtlInput | AsyncCachePolicy
abortPrevious?readonlyboolean
preventDuplicates?readonlyboolean
cacheKey?readonly(value: unknown, context: ValidationContext<TValues>) => string
sharedCache?readonlystring | boolean
offline?readonly"skip" | "fail" | "queue"

AsyncJob

Properties

PropertyModifierType
idreadonlystring
pathreadonlystring
generationreadonlynumber
cacheKeyreadonlystring
signalreadonlyAbortSignal
startedAtreadonlynumber
statusreadonly"scheduled" | "running" | "settled" | "aborted" | "timeout" | "queued"

FieldMetaState

Properties

PropertyModifierType
isValidatingreadonlyboolean
label?readonlystring
description?readonlystring
hidden?readonlyboolean

ValidationFormAccessor

Type Parameters

Type Parameter
TValues extends Record<string, unknown>

Methods

get()
ts
get(path: string): unknown;
Parameters
ParameterType
pathstring
Returns

unknown

values()
ts
values(): TValues;
Returns

TValues


ValidationContext

Type Parameters

Type Parameter
TValues extends Record<string, unknown>

Properties

PropertyModifierTypeDescription
valuesreadonlyTValues-
pathreadonlystring-
formreadonlyValidationFormAccessor<TValues>-
signal?readonlyAbortSignalPresent when validation is tied to an in-flight async job (Phase 4A).

CustomFieldValidatorContext

Type Parameters

Type Parameter
TValues extends Record<string, unknown>

Properties

PropertyModifierType
valuereadonlyunknown
pathreadonlystring
formreadonlyValidationFormAccessor<TValues>

FieldSchemaConfig

Properties

PropertyModifierType
type?readonlyBuiltInFieldType
required?readonlyboolean
email?readonlyboolean
password?readonlyboolean
url?readonlyboolean
minLength?readonlynumber
validate?readonlyFieldValidateRules
validators?readonlyreadonly CustomFieldValidator<Record<string, unknown>>[]
format?readonly| Formatter | "phone" | "currency" | "slug" | "philippine-phone" | "credit-card"

FieldOptions

Type Parameters

Type Parameter
TValues extends Record<string, unknown>

Properties

PropertyModifierTypeDescription
defaultValue?readonlyunknown-
validators?readonlyreadonly Validator<TValues>[]-
validateOn?readonlyValidationMode-
dependsOn?readonlyreadonly string[]-
format?readonlyFormatter-
parse?readonlyParser-
formatOnDisplay?readonlyboolean-
parseOnInput?readonlyboolean-
transform?readonly| TransformPipelineOptions | readonly TransformFn<TValues>[]Canonical inbound transforms (trim/normalize/sanitize/parse/stages). Distinct from display format/parse — see /transform and TRANSFORM_INBOUND_ORDER.
label?readonlystring-
description?readonlystring-
hidden?readonlyboolean-
metadata?readonlyReadonly<Record<string, unknown>>-

FieldHandle

Type Parameters

Type Parameter
_TValues extends Record<string, unknown>

Properties

PropertyModifierTypeDescription
pathreadonlystring-
valuereadonlyunknown-
errorreadonlystring | undefined-
touchedreadonlyboolean-
dirtyreadonlyboolean-
visitedreadonlyboolean-
uireadonlyFieldUiViewFull presentation maps (same sources as state.fieldUi / formUi / fieldOptions).
metareadonlyFieldState & FieldMetaStateField state + meta (controller surface).
ariareadonlyFieldAriaResultAccessibility snapshot + spread attributes. Register element ids via setAriaIds so aria-describedby can link errors/help.

Methods

setValue()
ts
setValue(value: unknown): void;
Parameters
ParameterType
valueunknown
Returns

void

setTouched()
ts
setTouched(touched?: boolean): void;
Parameters
ParameterType
touched?boolean
Returns

void

setVisited()
ts
setVisited(visited?: boolean): void;
Parameters
ParameterType
visited?boolean
Returns

void

setAriaIds()
ts
setAriaIds(ids: FieldAriaIds): void;

Register error/description element ids for aria-describedby.

Parameters
ParameterType
idsFieldAriaIds
Returns

void

onBlur()
ts
onBlur(): void;
Returns

void

onFocus()
ts
onFocus(): void;
Returns

void

validate()
ts
validate(): Promise<boolean>;
Returns

Promise<boolean>

bind()
ts
bind(): FieldBinding;
Returns

FieldBinding


ValueFieldBinding

Properties

PropertyModifierType
kind?readonly"value"
namereadonlystring
valuereadonlyunknown
onChangereadonly(value: unknown) => void
onBlurreadonly() => void
onFocusreadonly() => void

FileFieldBinding

Properties

PropertyModifierTypeDescription
kindreadonly"file"-
namereadonlystring-
filesreadonlyFile[]Canonical file selection (File[]).
onChangereadonly(files: File[] | FileList | null | undefined) => void-
onBlurreadonly() => void-
onFocusreadonly() => void-

AutosaveConfig

Properties

PropertyModifierType
enabled?readonlyboolean
debounceMs?readonlynumber
onSavereadonly(values: Record<string, unknown>) => void | Promise<void>

DraftConfig

Properties

PropertyModifierTypeDescription
enabled?readonlyboolean-
storageKey?readonlystring-
storage?readonlyDraftStorageKind-
adapter?readonlyDraftStorageAdapter-
onRestore?readonly(values: Record<string, unknown>) => void-
promptOnRestore?readonlyboolean-
onRestorePrompt?readonly(values: Record<string, unknown>) => RestorePromptResult-
onRestoreDecline?readonlyDraftRestoreDeclinePolicyWhat to do when onRestorePrompt returns false. Default "keep"
versioning?readonlybooleanPersist versioned envelopes (DraftEnvelopeV1) instead of raw values.
schemaVersion?readonlystringApp schema id compared / migrated when envelopes are enabled.
migrateDraft?readonly(envelope: DraftEnvelopeV1) => DraftEnvelopeV1Migrate an envelope before restore; throw to reject restore.

RestoreDraftOptions

Properties

PropertyModifierTypeDescription
force?readonlybooleanDefault false — if the form is dirty, no-op unless force (D-RESTORE-RACE).
prompt?readonlybooleanDefault false — if true, call DraftConfig.onRestorePrompt when set.
merge?readonly"overlay" | "replace"Default overlay{ ...defaults, ...draft }. replace uses draft keys only.

AnalyticsConfig

Properties

PropertyModifierTypeDescription
enabled?readonlyboolean-
includePaths?readonlyreadonly string[]When set, only these paths appear in path-keyed metrics (deny-by-default for others). Values are never captured — paths only.
excludePaths?readonlyreadonly string[]Paths omitted from path-keyed metrics.
onSnapshot?readonly(snapshot: FormAnalyticsSnapshot) => voidInvoked whenever a snapshot is produced via getAnalytics().

FormAnalyticsSnapshot

Properties

PropertyModifierType
startedAtreadonlynumber
completedAtreadonlynumber | null
errorCountreadonlynumber
errorsByFieldreadonlyReadonly<Record<FieldPath, number>>
abandonedAtreadonlynumber | null
currentStepreadonlynumber
fieldViewsreadonlyReadonly<Record<FieldPath, number>>
dropOffFieldreadonlystring | null
timeToCompleteMsreadonlynumber | null
timeToFirstErrorMsreadonlynumber | null

OfflineQueueConfig

Properties

PropertyModifierTypeDescription
enabled?readonlyboolean-
storageKey?readonlystring-
maxItems?readonlynumberSoft cap on queued items.
overflow?readonlyOfflineOverflowPolicyBehavior when maxItems is exceeded. Default: drop-oldest.
idempotencyKey?readonly(values: Record<string, unknown>) => stringDeduplicate pending items with the same key (skip enqueue).
onConflict?readonly(local: QueuedSubmission<Record<string, unknown>>, error: unknown) => | void | OfflineConflictAction | Promise<void | OfflineConflictAction>Called when a queued item fails during flush. - keep (default) — leave at head, stop flush - drop — discard and continue - retry — keep at head and continue attempting
onOverflow?readonly(dropped: QueuedSubmission<Record<string, unknown>>, policy: OfflineOverflowPolicy) => void-

KeyboardShortcutConfig

Properties

PropertyModifierType
comboreadonlystring
actionreadonly"submit" | "saveDraft" | "undo" | "redo"

WorkflowConfig

Properties

PropertyModifierType
autosave?readonlyAutosaveConfig
draft?readonlyDraftConfig
wizard?readonlyWizardConfig
analytics?readonlyAnalyticsConfig
offlineQueue?readonlyOfflineQueueConfig
keyboard?readonlyreadonly KeyboardShortcutConfig[]

SubmissionQueueState

Properties

PropertyModifierType
pendingreadonlynumber
flushingreadonlyboolean

SetValueOptions

Properties

PropertyModifierType
recordHistory?readonlyboolean
markDirty?readonlyboolean

SubmitOptions

Properties

PropertyModifierType
preventDoubleSubmit?readonlyboolean
includeDiff?readonlyboolean
retry?readonlynumber | RetryPolicy

FormChangeRecord

Properties

PropertyModifierTypeDescription
pathreadonlystring-
typereadonlyFormChangeType-
previous?readonlyunknown-
current?readonlyunknown-
from?readonlystringPresent when type is moved (source path).

FormDiffMetadata

Properties

PropertyModifierType
durationMsreadonlynumber
changeCountreadonlynumber
addedCountreadonlynumber
removedCountreadonlynumber
changedCountreadonlynumber
unchangedCountreadonlynumber
movedCountreadonlynumber

FormDiffResult

Properties

PropertyModifierType
changesreadonlyreadonly FormChangeRecord[]
hasChangesreadonlyboolean
metadatareadonlyFormDiffMetadata

FormDiffOptions

Properties

PropertyModifierType
maxDepth?readonlynumber
includeUnchanged?readonlyboolean
treatUndefinedAsMissing?readonlyboolean

SubmitSecurityCaptcha

CAPTCHA token under the submission security namespace (ADR-CAP-001).

Properties

PropertyModifierType
providerreadonlystring
tokenreadonlystring
expiresAt?readonlynumber

SubmitSecurityMeta

Security namespace on submit meta. Stable path: meta.security.captcha (future: CSRF, OTP, …).

Properties

PropertyModifierType
captcha?readonlySubmitSecurityCaptcha

SubmitMeta

Properties

PropertyModifierTypeDescription
changedFields?readonlyreadonly string[]-
diff?readonlyFormDiffResult-
signal?readonlyAbortSignal-
security?readonlySubmitSecurityMetaPopulated by the Security Stage (e.g. CAPTCHA plugin).
upload?readonlySubmitUploadMetaPopulated after a successful upload-transport submit.

ValidateOptions

Properties

PropertyModifierType
paths?readonlyreadonly string[]
mode?readonlyValidationMode

ResetOptions

Type Parameters

Type Parameter
TValues extends Record<string, unknown>

Properties

PropertyModifierType
values?readonlyPartial<TValues>
keepDirty?readonlyboolean

FormConfig

Type Parameters

Type Parameter
TValues extends Record<string, unknown>

Properties

PropertyModifierTypeDescription
initialValues?readonlyTValues-
target?readonlystring | HTMLElement-
form?readonlystring | HTMLElement-
schema?readonly| SchemaAdapter<Record<string, unknown>> | Partial<Record<string, FieldSchemaDefinition>>-
onSubmit?readonly(values: TValues, meta?: SubmitMeta) => void | Promise<void>-
onSubmitError?readonly(error: unknown) => void-
onPluginError?readonlyPluginErrorHandlerReceives isolated plugin/hook failures (setup, hooks, destroy). Does not rethrow — form continues per Phase 15 isolation policy.
validateOn?readonlyValidationMode-
validators?readonlyPartial<Record<string, | Validator<TValues> | readonly Validator<TValues>[]>>-
crossFieldValidators?readonlyreadonly CrossFieldRule<TValues>[]-
formValidators?readonlyreadonly CrossFieldValidator<TValues>[]-
workflow?readonlyWorkflowConfig-
autoSave?readonlyAutosaveConfig & { every?: string; }-
wizard?readonlyboolean | WizardConfig-
rules?readonlyreadonly FormRuleInput<TValues>[]-
plugins?readonlyreadonly FormPlugin<TValues>[]Plugins registered at create time (same as calling form.use(plugin) for each entry, in order). Prefer this for declarative setup; use form.use() later for conditional or late registration.
subscribe?readonly| FormSubscribeListener<TValues> | readonly FormSubscribeListener<TValues>[]State listeners registered at create time (same store as form.subscribe()). Pass one listener or an array. Each receives the form instance, is invoked once after create (so UI can sync immediately), then on every state notify. Lives until form.destroy(). Prefer framework adapters for React/Vue; use this for vanilla / host UI.
dependencies?readonlyReadonly<Record<string, string | readonly string[]>>Explicit dependency map: child → parent(s). Cycles throw ConfigurationError at registration (ADR-007).
dependencyActions?readonlyPartial<Record<string, readonly DependencyAction[]>>Per-child action overrides for dependencies (default ["clear","revalidate"]).

FieldState

Properties

PropertyModifierType
touchedreadonlyboolean
dirtyreadonlyboolean
visitedreadonlyboolean
changedreadonlyboolean

FormState

Type Parameters

Type Parameter
TValues extends Record<string, unknown>

Properties

PropertyModifierTypeDescription
valuesreadonlyTValues-
errorsreadonlyReadonly<Record<FieldPath, string>>-
touchedreadonlyReadonly<Record<FieldPath, boolean>>-
dirtyreadonlyReadonly<Record<FieldPath, boolean>>-
visitedreadonlyReadonly<Record<FieldPath, boolean>>-
changedreadonlyReadonly<Record<FieldPath, boolean>>-
isSubmittingreadonlyboolean-
isValidatingreadonlyboolean-
isValidreadonlyboolean-
isDirtyreadonlyboolean-
isChangedreadonlyboolean-
submitCountreadonlynumber-
submitPhasereadonlySubmitPhaseLast / current submit lifecycle phase.
workflowreadonlyWorkflowState-
fieldUireadonlyFieldUiMap-
formUireadonlyFormUiState-
fieldMetareadonlyReadonly<Record<FieldPath, FieldMetaState>>-
fieldOptionsreadonlyReadonly<Record<FieldPath, readonly FieldOption[]>>-
submissionQueuereadonlySubmissionQueueState-

WorkflowState

Properties

PropertyModifierType
currentStepreadonlynumber
totalStepsreadonlynumber
canGoNextreadonlyboolean
canGoPrevreadonlyboolean
progressreadonlynumber
isAutosavingreadonlyboolean
lastAutosaveAtreadonlynumber | null

FormCheckpoint

Durable form checkpoint — distinct from getSnapshot() (external-store identity).

Type Parameters

Type ParameterDefault type
TValues extends Record<string, unknown>Record<string, unknown>

Properties

PropertyModifierType
versionreadonly1
kindreadonly"checkpoint"
capturedAtreadonlynumber
valuesreadonlyTValues
errors?readonlyReadonly<Record<string, string>>
touched?readonlyReadonly<Record<string, boolean>>
dirty?readonlyReadonly<Record<string, boolean>>
visited?readonlyReadonly<Record<string, boolean>>
fieldUi?readonlyReadonly<Record<string, FieldUiState>>
workflow?readonly{ currentStep: number; }
workflow.currentStepreadonlynumber

CreateCheckpointOptions

Properties

PropertyModifierType
include?readonlyreadonly ( | "values" | "workflow" | "touched" | "errors" | "dirty" | "visited" | "fieldUi")[]

RestoreCheckpointOptions

Properties

PropertyModifierType
recordHistory?readonlyboolean
restoreMeta?readonlyboolean

FormInstance

Type Parameters

Type Parameter
TValues extends Record<string, unknown>

Properties

PropertyModifierTypeDescription
idreadonlystring-
refreadonlyFormRef-
uireadonlyFormUiProjection<TValues>Derived UI projection (@jayoncode/form-intelligence/ui). Uses registered policies from ui() plugin, or package defaults.
statereadonlyFormState<TValues>Current form snapshot — same as getFormState().
workflowpublic{ next: Promise<boolean>; prev: void; goTo: Promise<boolean>; getStepGraph: WizardStepGraph; visibleSteps: readonly string[]; }-
workflow.nextpublicPromise<boolean>-
workflow.prevpublicvoid-
workflow.goTopublicPromise<boolean>-
workflow.getStepGraphpublicWizardStepGraph-
workflow.visibleStepspublicreadonly string[]-

Methods

field()
ts
field(path: string, options?: FieldOptions<TValues>): FieldHandle<TValues>;
Parameters
ParameterType
pathstring
options?FieldOptions<TValues>
Returns

FieldHandle<TValues>

firstInvalidPath()
ts
firstInvalidPath(): string | undefined;

First path with a non-empty error (stable key order).

Returns

string | undefined

focusFirstInvalid()
ts
focusFirstInvalid(): string | undefined;

Focus first invalid control when document exists; SSR-safe no-op. Returns the focused path or undefined.

Returns

string | undefined

registeredFieldPaths()
ts
registeredFieldPaths(): readonly string[];

Paths registered via field() in registration order.

Returns

readonly string[]

pushField()
ts
pushField(arrayPath: string, item?: unknown): string;
Parameters
ParameterType
arrayPathstring
item?unknown
Returns

string

removeField()
ts
removeField(arrayPath: string, index: number): void;
Parameters
ParameterType
arrayPathstring
indexnumber
Returns

void

insertField()
ts
insertField(
   arrayPath: string, 
   index: number, 
   item?: unknown): string;
Parameters
ParameterType
arrayPathstring
indexnumber
item?unknown
Returns

string

submit()
ts
submit(options?: SubmitOptions): Promise<boolean>;
Parameters
ParameterType
options?SubmitOptions
Returns

Promise<boolean>

cancelSubmit()
ts
cancelSubmit(): void;
Returns

void

useMiddleware()
ts
useMiddleware(middleware: MiddlewareInput<TValues>): () => void;

Register onion middleware for submit/validate phases. Same stack as plugin hooks — see MIDDLEWARE_HOOK_MAP.

Parameters
ParameterType
middlewareMiddlewareInput<TValues>
Returns

() => void

reset()
ts
reset(options?: ResetOptions<TValues>): void;
Parameters
ParameterType
options?ResetOptions<TValues>
Returns

void

validate()
ts
validate(options?: ValidateOptions): Promise<boolean>;
Parameters
ParameterType
options?ValidateOptions
Returns

Promise<boolean>

values()
Call Signature
ts
values(): TValues;
Returns

TValues

Call Signature
ts
values(path: string): unknown;
Parameters
ParameterType
pathstring
Returns

unknown

get()
ts
get(path: string): unknown;
Parameters
ParameterType
pathstring
Returns

unknown

errors()
ts
errors(path?: string): string | Readonly<Record<string, string>> | undefined;
Parameters
ParameterType
path?string
Returns

string | Readonly<Record<string, string>> | undefined

setValue()
ts
setValue(
   path: string, 
   value: unknown, 
   options?: SetValueOptions): void;
Parameters
ParameterType
pathstring
valueunknown
options?SetValueOptions
Returns

void

markNonPersistent()
ts
markNonPersistent(path: string): void;

Mark a path as browser-owned ephemeral (non-persistent). File fields are registered automatically from DOM type="file" or file-shaped values. Drafts, autosave, offline queue, and history omit these paths (ADR-FILE-001).

Parameters
ParameterType
pathstring
Returns

void

toFormData()
ts
toFormData(options?: ToFormDataOptions): FormData;

Build FormData from current values (files as binary parts). Applications remain responsible for the network transport (ADR-FILE-001).

Parameters
ParameterType
options?ToFormDataOptions
Returns

FormData

payload()
ts
payload(options?: ToFormDataOptions): FormPayload<TValues>;

JSON when no files are present; multipart FormData when any file selection is non-empty.

Parameters
ParameterType
options?ToFormDataOptions
Returns

FormPayload<TValues>

setError()
ts
setError(path: string, message: string): void;
Parameters
ParameterType
pathstring
messagestring
Returns

void

clearErrors()
ts
clearErrors(path?: string): void;
Parameters
ParameterType
path?string
Returns

void

getFieldState()
ts
getFieldState(path: string): FieldState;
Parameters
ParameterType
pathstring
Returns

FieldState

getFieldMeta()
ts
getFieldMeta(path: string): FieldMetaState;
Parameters
ParameterType
pathstring
Returns

FieldMetaState

getFormState()
ts
getFormState(): FormState<TValues>;
Returns

FormState<TValues>

getSnapshot()
ts
getSnapshot(): FormState<TValues>;

For useSyncExternalStore(form.subscribe, form.getSnapshot). Not a durable checkpoint.

Returns

FormState<TValues>

getPresentation()
Call Signature
ts
getPresentation(path: string): PresentationState;

Per-path presentation (field UI + options + form UI).

Parameters
ParameterType
pathstring
Returns

PresentationState

Call Signature
ts
getPresentation(): PresentationSnapshot;

Full presentation maps (same sources as state.fieldUi / formUi / fieldOptions).

Returns

PresentationSnapshot

createCheckpoint()
ts
createCheckpoint(options?: CreateCheckpointOptions): FormCheckpoint<TValues>;

Durable checkpoint for undo/restore flows — see restoreCheckpoint.

Parameters
ParameterType
options?CreateCheckpointOptions
Returns

FormCheckpoint<TValues>

restoreCheckpoint()
ts
restoreCheckpoint(checkpoint: FormCheckpoint<TValues>, options?: RestoreCheckpointOptions): void;
Parameters
ParameterType
checkpointFormCheckpoint<TValues>
options?RestoreCheckpointOptions
Returns

void

getValues()
ts
getValues(): TValues;
Returns

TValues

getErrors()
ts
getErrors(): Readonly<Record<FieldPath, string>>;
Returns

Readonly<Record<FieldPath, string>>

isValid()
ts
isValid(): boolean;
Returns

boolean

isSubmitting()
ts
isSubmitting(): boolean;
Returns

boolean

submissionGuard()
ts
submissionGuard(options?: Pick<SubmitOptions, "preventDoubleSubmit">): SubmissionGuardResult;

Hard submission eligibility (enforced by submit()). Distinct from form.ui.canSubmit (UX projection + disableSubmitWhen).

Parameters
ParameterType
options?Pick<SubmitOptions, "preventDoubleSubmit">
Returns

SubmissionGuardResult

isDirty()
ts
isDirty(): boolean;
Returns

boolean

changedFields()
ts
changedFields(): readonly string[];
Returns

readonly string[]

changedSinceSubmitFields()
ts
changedSinceSubmitFields(): readonly string[];
Returns

readonly string[]

diffFromDefaults()
ts
diffFromDefaults(options?: FormDiffOptions): Promise<FormDiffResult>;
Parameters
ParameterType
options?FormDiffOptions
Returns

Promise<FormDiffResult>

diffFrom()
ts
diffFrom(baseline: Record<string, unknown>, options?: FormDiffOptions): Promise<FormDiffResult>;
Parameters
ParameterType
baselineRecord<string, unknown>
options?FormDiffOptions
Returns

Promise<FormDiffResult>

when()
ts
when(field: string): WhenRuleBuilder<TValues>;
Parameters
ParameterType
fieldstring
Returns

WhenRuleBuilder<TValues>

dependencies()
Call Signature
ts
dependencies(map: Readonly<Record<string, string | readonly string[]>>): void;

Register explicit dependency map (fail-fast on cycles).

Parameters
ParameterType
mapReadonly<Record<string, string | readonly string[]>>
Returns

void

Call Signature
ts
dependencies(): DependencyRegistrar<TValues>;

Fluent dependency registrar + inspect().

Returns

DependencyRegistrar<TValues>

calculate()
Call Signature
ts
calculate(path: string): CalculationBuilder<TValues>;

Fluent derived field: form.calculate("total").from("price","qty").compute(...).

Parameters
ParameterType
pathstring
Returns

CalculationBuilder<TValues>

Call Signature
ts
calculate(path: string, options: 
  | CalculateOptions<TValues>
  | ((context: {
  values: TValues;
}) => unknown)): void;
Parameters
ParameterType
pathstring
options| CalculateOptions<TValues> | ((context: { values: TValues; }) => unknown)
Returns

void

transform()
Call Signature
ts
transform(path: string): TransformPipelineHandle;

Register inbound transform stages for a path.

Parameters
ParameterType
pathstring
Returns

TransformPipelineHandle

Call Signature
ts
transform(path: string, stages: readonly TransformFn<TValues>[]): void;
Parameters
ParameterType
pathstring
stagesreadonly TransformFn<TValues>[]
Returns

void

saveDraft()
ts
saveDraft(): void;
Returns

void

restoreDraft()
ts
restoreDraft(options?: RestoreDraftOptions): Promise<boolean>;

Restore persisted draft into the live form (after mount). Returns true when values were applied; false when skipped (disabled / empty / declined / dirty without force / corrupt).

Parameters
ParameterType
options?RestoreDraftOptions
Returns

Promise<boolean>

undo()
ts
undo(): boolean;
Returns

boolean

redo()
ts
redo(): boolean;
Returns

boolean

getAnalytics()
ts
getAnalytics(): FormAnalyticsSnapshot;
Returns

FormAnalyticsSnapshot

flushOfflineQueue()
ts
flushOfflineQueue(): Promise<{
  flushed: number;
  failed: number;
}>;
Returns

Promise<{ flushed: number; failed: number; }>

use()
Call Signature
ts
use(plugin: FormPlugin<TValues>): void;
Parameters
ParameterType
pluginFormPlugin<TValues>
Returns

void

Call Signature
ts
use<TSelected>(selector: FormSelector<TValues, TSelected>): TSelected;
Type Parameters
Type Parameter
TSelected
Parameters
ParameterType
selectorFormSelector<TValues, TSelected>
Returns

TSelected

listPlugins()
ts
listPlugins(): readonly {
  name: string;
  order: number;
  version?: string;
}[];

Registered plugins (name / order / version) for DevTools introspection.

Returns

readonly { name: string; order: number; version?: string; }[]

subscribe()
ts
subscribe(listener: () => void): () => void;

Advanced: reactive UI updates. Framework adapters call this internally. For declarative create-time listeners, prefer createForm({ subscribe }).

Parameters
ParameterType
listener() => void
Returns

() => void

on()
ts
on(event: FormEvent, listener: (payload?: unknown) => void): () => void;
Parameters
ParameterType
eventFormEvent
listener(payload?: unknown) => void
Returns

() => void

emit()
ts
emit(event: FormEvent, payload?: unknown): void;

Emit a form lifecycle event (plugins may use for upload:*).

Parameters
ParameterType
eventFormEvent
payload?unknown
Returns

void

destroy()
ts
destroy(): void;
Returns

void

registerPlugin()
ts
registerPlugin(plugin: FormPlugin<TValues>): void;
Parameters
ParameterType
pluginFormPlugin<TValues>
Returns

void


FormPluginSetupResult

Properties

PropertyModifierType
onDestroy?readonly() => void

FormPlugin

Type Parameters

Type ParameterDefault type
TValues extends Record<string, unknown>Record<string, unknown>

Properties

PropertyModifierTypeDescription
namereadonlystring-
version?readonlystringPlugin package/semver label (metadata only).
engines?readonlystringSemver range against @jayoncode/form-intelligence (>=3.1.0, ^3.1.0, or exact). Checked at register/use.
order?readonlynumber-

Methods

setup()
ts
setup(form: FormInstance<TValues>, api: FormPluginApi<TValues>): void | FormPluginSetupResult | (() => void);
Parameters
ParameterType
formFormInstance<TValues>
apiFormPluginApi<TValues>
Returns

void | FormPluginSetupResult | (() => void)

Type Aliases

FieldController

ts
type FieldController<TValues> = FieldHandle<TValues>;

Preferred UI binding surface over reaching into form internals (Phase 16). Alias of the enhanced FieldHandle (includes aria / setAriaIds).

Type Parameters

Type ParameterDefault type
TValues extends Record<string, unknown>Record<string, unknown>

DependencyAction

ts
type DependencyAction = "clear" | "reloadOptions" | "revalidate" | "recompute" | "preserve";

DependencyMap

ts
type DependencyMap = Readonly<Record<FieldPath, FieldPath | readonly FieldPath[]>>;

Map sugar: child path → parent path(s).


TransformFn

ts
type TransformFn<TValues> = (value: unknown, ctx: TransformContext<TValues>) => unknown;

Type Parameters

Type ParameterDefault type
TValues extends Record<string, unknown>Record<string, unknown>

Parameters

ParameterType
valueunknown
ctxTransformContext<TValues>

Returns

unknown


FieldUiMap

ts
type FieldUiMap = Readonly<Record<string, FieldUiState>>;

WizardNavigateValidation

ts
type WizardNavigateValidation = "step" | "all" | "none";

Validation scope for workflow.goTo. Default "all" preserves SHIPPED behavior.


CanonicalFileValue

ts
type CanonicalFileValue = File[];

Canonical in-memory representation for file fields (ADR-FILE-001 Phase A).


FormPayloadKind

ts
type FormPayloadKind = "json" | "multipart";

FormPayload

ts
type FormPayload<TValues> = 
  | JsonFormPayload<TValues>
  | MultipartFormPayload;

Type Parameters

Type Parameter
TValues extends Record<string, unknown>

FormatPreset

ts
type FormatPreset = "philippine-phone" | "credit-card" | "phone" | "currency" | "slug";

Formatter

ts
type Formatter = (value: unknown) => unknown;

Parameters

ParameterType
valueunknown

Returns

unknown


Parser

ts
type Parser = (value: unknown) => unknown;

Parameters

ParameterType
valueunknown

Returns

unknown


PluginPipelineStage

ts
type PluginPipelineStage = typeof PLUGIN_PIPELINE_STAGES[number];

PluginErrorHandler

ts
type PluginErrorHandler = (report: PluginErrorReport) => void;

Parameters

ParameterType
reportPluginErrorReport

Returns

void


MiddlewarePhase

ts
type MiddlewarePhase = 
  | "beforeValidate"
  | "afterValidate"
  | "beforeSubmit"
  | "afterSubmit"
  | "submitError"
  | "beforeSetValue"
  | "afterSetValue";

Phases that onion middleware and plugin hooks can observe.


MiddlewareNext

ts
type MiddlewareNext = () => Promise<void>;

Returns

Promise<void>


FormMiddleware

ts
type FormMiddleware<TValues> = (ctx: MiddlewareContext<TValues>, next: MiddlewareNext) => void | Promise<void>;

Type Parameters

Type ParameterDefault type
TValues extends Record<string, unknown>Record<string, unknown>

Parameters

ParameterType
ctxMiddlewareContext<TValues>
nextMiddlewareNext

Returns

void | Promise<void>


MiddlewareInput

ts
type MiddlewareInput<TValues> = 
  | FormMiddleware<TValues> & Partial<MiddlewareRegistration>
  | MiddlewareRegistration & {
  run: FormMiddleware<TValues>;
};

Type Parameters

Type ParameterDefault type
TValues extends Record<string, unknown>Record<string, unknown>

TtlInput

ts
type TtlInput = 
  | number
  | `${number}ms`
  | `${number}s`
  | `${number}m`
  | `${number}h`;

FieldPath

ts
type FieldPath = string;

FormRuleInput

ts
type FormRuleInput<TValues> = 
  | FormRuleDefinition<TValues>
  | WhenRuleBuilder<TValues>
  | WhenRuleBuilder;

Plain rule object or a when() builder (createForm calls .build() for builders).

Type Parameters

Type ParameterDefault type
TValues extends Record<string, unknown>Record<string, unknown>

ValidationMode

ts
type ValidationMode = "onChange" | "onBlur" | "onSubmit" | "onTouched" | "all";

FormEvent

ts
type FormEvent = 
  | "change"
  | "blur"
  | "focus"
  | "reset"
  | "submit"
  | "validate"
  | "validated"
  | "autosave"
  | "draft"
  | "upload:progress"
  | "upload:complete"
  | "upload:error";

ValidatorResult

ts
type ValidatorResult = true | false | string | undefined;

BuiltInFieldType

ts
type BuiltInFieldType = "text" | "email" | "password" | "url" | "file";

CustomFieldValidator

ts
type CustomFieldValidator<TValues> = (context: CustomFieldValidatorContext<TValues>) => 
  | ValidatorResult
| Promise<ValidatorResult>;

Type Parameters

Type ParameterDefault type
TValues extends Record<string, unknown>Record<string, unknown>

Parameters

ParameterType
contextCustomFieldValidatorContext<TValues>

Returns

| ValidatorResult | Promise<ValidatorResult>


FormRef

ts
type FormRef = (element: HTMLFormElement | null) => void;

Parameters

ParameterType
elementHTMLFormElement | null

Returns

void


FieldSchemaDefinition

ts
type FieldSchemaDefinition = 
  | BuiltInFieldType
  | FieldSchemaConfig;

Validator

ts
type Validator<TValues> = (value: unknown, context: ValidationContext<TValues>) => 
  | ValidatorResult
| Promise<ValidatorResult>;

Type Parameters

Type ParameterDefault type
TValues extends Record<string, unknown>Record<string, unknown>

Parameters

ParameterType
valueunknown
contextValidationContext<TValues>

Returns

| ValidatorResult | Promise<ValidatorResult>


FieldBinding

ts
type FieldBinding = 
  | ValueFieldBinding
  | FileFieldBinding;

Headless binding — file fields omit controlled value (ADR-FILE-001).


DraftRestoreDeclinePolicy

ts
type DraftRestoreDeclinePolicy = "keep" | "clear" | "remember";

Policy when onRestorePrompt returns false (user declined).

  • keep — leave the draft; the next prompt can ask again (default)
  • clear — delete the draft so it will not prompt again
  • remember — keep the draft; suppress prompts for the same draft content until it changes

RestorePromptResult

ts
type RestorePromptResult = boolean | "defer";

Result of onRestorePrompt.

  • true — restore
  • false — decline and apply onRestoreDecline
  • "defer" — skip this attempt without applying decline policy (e.g. wait until after mount)

SubmitPhase

ts
type SubmitPhase = "idle" | "validating" | "submitting" | "success" | "error";

Submit lifecycle phase (Phase 10). isSubmitting remains the boolean loading flag.


FormSubscribeListener

ts
type FormSubscribeListener<TValues> = (form: FormInstance<TValues>) => void;

State listener for createForm({ subscribe }). Receives the form instance. Lives until form.destroy() — use form.subscribe() when you need unsubscribe.

Type Parameters

Type ParameterDefault type
TValues extends Record<string, unknown>Record<string, unknown>

Parameters

ParameterType
formFormInstance<TValues>

Returns

void


FormSelector

ts
type FormSelector<TValues, TSelected> = (state: FormState<TValues>) => TSelected;

Type Parameters

Type Parameter
TValues extends Record<string, unknown>
TSelected

Parameters

ParameterType
stateFormState<TValues>

Returns

TSelected


AsyncValidator

ts
type AsyncValidator<TValues> = Validator<TValues> & {
  __async: true;
};

Type Declaration

NameType
__asynctrue

Type Parameters

Type ParameterDefault type
TValues extends Record<string, unknown>Record<string, unknown>

AsyncValidatorWithOptions

ts
type AsyncValidatorWithOptions<TValues> = AsyncValidator<TValues> & {
  __asyncOptions: AsyncValidatorOptions<TValues>;
};

Type Declaration

NameType
__asyncOptionsAsyncValidatorOptions<TValues>

Type Parameters

Type ParameterDefault type
TValues extends Record<string, unknown>Record<string, unknown>

FileSizeInput

ts
type FileSizeInput = number | string;

Variables

DEFAULT_FIELD_UI

ts
const DEFAULT_FIELD_UI: FieldUiState;

Defaults when a path is missing from fieldUi (API freeze §5).


PRESENTATION_OWNERSHIP

ts
const PRESENTATION_OWNERSHIP: {
  producers: readonly ["workflow.rules", "dependency.populate", "schema.requiredBaseline"];
  consumers: readonly ["dom.enhancer", "framework.adapters", "a11y"];
  nonWriters: readonly ["validation", "transform", "format"];
};

Ownership note (Phase 9 / ADR-018): Workflow rules and schema/static required baseline produce UI intents; Presentation exposes them. Validation must not write visible/hidden/required on validate ticks. DOM enhancer and adapters consume getPresentation / field.ui only.

Type Declaration

NameType
producersreadonly ["workflow.rules", "dependency.populate", "schema.requiredBaseline"]
consumersreadonly ["dom.enhancer", "framework.adapters", "a11y"]
nonWritersreadonly ["validation", "transform", "format"]

TRANSFORM_INBOUND_ORDER

ts
const TRANSFORM_INBOUND_ORDER: readonly ["trim", "normalize", "sanitize", "custom", "parse"];

Fixed inbound stage order (Alg 8 / 13_TRANSFORM_ENGINE). Format/display is outbound-only and is not part of this list.


PLUGIN_PIPELINE_STAGES

ts
const PLUGIN_PIPELINE_STAGES: readonly ["beforeValidate", "validate", "afterValidate", "beforeSubmit", "submit", "afterSubmit", "submitError"];

Documented interceptor stages (Phase 15). Onion useMiddleware + plugin hooks share this map (D-MW-VS-PLUGIN).


MIDDLEWARE_HOOK_MAP

ts
const MIDDLEWARE_HOOK_MAP: {
  beforeValidate: "beforeValidate";
  afterValidate: "afterValidate";
  beforeSubmit: "beforeSubmit";
  afterSubmit: "afterSubmit";
};

Maps plugin hook names → middleware phases (Phase 10 / D-MW-VS-PLUGIN). Plugin api.on(hook) and form.useMiddleware share one interceptor stack per phase. Documented pipeline stages: see PLUGIN_PIPELINE_STAGES.

Type Declaration

NameTypeDefault value
beforeValidate"beforeValidate""beforeValidate"
afterValidate"afterValidate""afterValidate"
beforeSubmit"beforeSubmit""beforeSubmit"
afterSubmit"afterSubmit""afterSubmit"

MIDDLEWARE_ONLY_PHASES

ts
const MIDDLEWARE_ONLY_PHASES: readonly ["submitError", "beforeSetValue", "afterSetValue"];

Phases that exist only on the middleware onion (no plugin hook synonym yet).


ASYNC_VALIDATOR_OPTION_DEFAULTS

ts
const ASYNC_VALIDATOR_OPTION_DEFAULTS: {
  debounce: 300;
  retry: 0;
  timeout: undefined;
  cache: false;
  abortPrevious: true;
  preventDuplicates: true;
  sharedCache: false;
  offline: "skip";
};

Defaults when the options-object overload is used (API_SIGNATURE_FREEZE §1).

Type Declaration

NameTypeDefault value
debounce300300
retry00
timeoutundefinedundefined
cachefalsefalse
abortPrevioustruetrue
preventDuplicatestruetrue
sharedCachefalsefalse
offline"skip""skip"

email

ts
const email: Validator;

required

ts
const required: Validator;

url

ts
const url: Validator;

FORM_INTELLIGENT_VERSION

ts
const FORM_INTELLIGENT_VERSION: "3.1.0" = "3.1.0";

Package version used for plugin engines compatibility checks.

Functions

createFormController()

ts
function createFormController<TValues>(form: FormInstance<TValues>): FormController<TValues>;

Type Parameters

Type Parameter
TValues extends Record<string, unknown>

Parameters

ParameterType
formFormInstance<TValues>

Returns

FormController<TValues>


isFrameworkAdapter()

ts
function isFrameworkAdapter(value: unknown): value is FrameworkAdapter<Record<string, unknown>>;

Parameters

ParameterType
valueunknown

Returns

value is FrameworkAdapter<Record<string, unknown>>


isPersistenceAdapter()

ts
function isPersistenceAdapter(value: unknown): value is PersistenceAdapter<Record<string, unknown>>;

Parameters

ParameterType
valueunknown

Returns

value is PersistenceAdapter<Record<string, unknown>>


isSchemaAdapter()

ts
function isSchemaAdapter(value: unknown): value is SchemaAdapter<Record<string, unknown>>;

Parameters

ParameterType
valueunknown

Returns

value is SchemaAdapter<Record<string, unknown>>


isSubmitTransportAdapter()

ts
function isSubmitTransportAdapter(value: unknown): value is SubmitTransportAdapter<Record<string, unknown>, unknown>;

Parameters

ParameterType
valueunknown

Returns

value is SubmitTransportAdapter<Record<string, unknown>, unknown>


createForm()

ts
function createForm<TValues>(config: FormConfig<TValues>): FormInstance<TValues>;

Create a form workflow instance. Pass target / form.ref for DOM-backed forms (HTML constraints imported on attach), or initialValues for headless usage.

Type Parameters

Type Parameter
TValues extends Record<string, unknown>

Parameters

ParameterType
configFormConfig<TValues>

Returns

FormInstance<TValues>


pluginAsModule()

ts
function pluginAsModule<TValues>(
   plugin: FormPlugin<TValues>, 
   order?: number, 
api?: FormPluginApi<TValues>): FormModule<TValues>;

Type Parameters

Type Parameter
TValues extends Record<string, unknown>

Parameters

ParameterType
pluginFormPlugin<TValues>
ordernumber
api?FormPluginApi<TValues>

Returns

FormModule<TValues>


computeFieldAria()

ts
function computeFieldAria(input: ComputeFieldAriaInput): FieldAriaResult;

Pure ARIA computation from field state — no DOM queries (Phase 16 / Spec 27).

Parameters

ParameterType
inputComputeFieldAriaInput

Returns

FieldAriaResult


calculate()

ts
function calculate<TValues>(path: string): CalculationBuilder<TValues>;

Root helper — returns an unbound builder. Prefer form.calculate(path).

Type Parameters

Type ParameterDefault type
TValues extends Record<string, unknown>Record<string, unknown>

Parameters

ParameterType
pathstring

Returns

CalculationBuilder<TValues>


dependencies()

ts
function dependencies(map: DependencyMap): DependencyMap;

Standalone helper — returns a normalized dependency map for config merge.

Parameters

ParameterType
mapDependencyMap

Returns

DependencyMap


resolveFieldUi()

ts
function resolveFieldUi(
   path: string, 
   fieldUi: FieldUiMap, 
   extras?: {
  busy?: boolean;
}): FieldUiState;

Resolve presentation flags for a path with freeze defaults.

Parameters

ParameterType
pathstring
fieldUiFieldUiMap
extras?{ busy?: boolean; }
extras.busy?boolean

Returns

FieldUiState


createTransformPipeline()

ts
function createTransformPipeline(options?: TransformPipelineOptions, outbound?: Formatter): TransformPipeline;

Compile a reusable inbound transform pipeline. Stage order is fixed: trim → normalize → sanitize → custom → parse.

Parameters

ParameterType
optionsTransformPipelineOptions
outbound?Formatter

Returns

TransformPipeline


runTransformInbound()

ts
function runTransformInbound<TValues>(
   raw: unknown, 
   options: 
  | TransformPipelineOptions
  | readonly TransformFn<TValues>[]
  | undefined, 
   ctx: TransformContext<TValues>): unknown;

Type Parameters

Type ParameterDefault type
TValues extends Record<string, unknown>Record<string, unknown>

Parameters

ParameterType
rawunknown
options| TransformPipelineOptions | readonly TransformFn<TValues>[] | undefined
ctxTransformContext<TValues>

Returns

unknown


when()

ts
function when<TValues>(field: string): WhenRuleBuilder<TValues>;

Type Parameters

Type ParameterDefault type
TValues extends Record<string, unknown>Record<string, unknown>

Parameters

ParameterType
fieldstring

Returns

WhenRuleBuilder<TValues>


satisfiesEnginesRange()

ts
function satisfiesEnginesRange(range: string, version?: string): boolean;

Minimal semver range check for plugin engines metadata. Supports: >=x.y.z, ^x.y.z, exact x.y.z.

Parameters

ParameterTypeDefault value
rangestringundefined
versionstringFORM_INTELLIGENT_VERSION

Returns

boolean


composeMiddleware()

ts
function composeMiddleware<TContext>(middlewares: readonly PluginMiddleware<TContext>[]): (context: TContext) => Promise<void>;

Type Parameters

Type Parameter
TContext

Parameters

ParameterType
middlewaresreadonly PluginMiddleware<TContext>[]

Returns

(context: TContext) => Promise<void>


runMiddlewareChain()

ts
function runMiddlewareChain<TContext>(middlewares: readonly PluginMiddleware<TContext>[], context: TContext): Promise<void>;

Type Parameters

Type Parameter
TContext

Parameters

ParameterType
middlewaresreadonly PluginMiddleware<TContext>[]
contextTContext

Returns

Promise<void>


clearSharedValidationCaches()

ts
function clearSharedValidationCaches(): void;

Test helper — clears shared namespaces.

Returns

void


parseTtl()

ts
function parseTtl(input: TtlInput): number;

Parse TTL input to milliseconds. Plain numbers are treated as milliseconds.

Parameters

ParameterType
inputTtlInput

Returns

number


matchesField()

ts
function matchesField<TValues>(targetPath: string, message?: string): Validator<TValues>;

Type Parameters

Type Parameter
TValues extends Record<string, unknown>

Parameters

ParameterTypeDefault value
targetPathstringundefined
messagestring"Values must match."

Returns

Validator<TValues>


requiredWhen()

ts
function requiredWhen<TValues>(
   sourcePath: string, 
   predicate: (value: unknown, context: ValidationContext<TValues>) => boolean, 
message?: string): Validator<TValues>;

Type Parameters

Type Parameter
TValues extends Record<string, unknown>

Parameters

ParameterTypeDefault value
sourcePathstringundefined
predicate(value: unknown, context: ValidationContext<TValues>) => booleanundefined
messagestring"This field is required."

Returns

Validator<TValues>


runValidationPipeline()

ts
function runValidationPipeline<TValues>(input: ValidationPipelineInput<TValues>): Promise<Record<string, string>>;

Type Parameters

Type Parameter
TValues extends Record<string, unknown>

Parameters

ParameterType
inputValidationPipelineInput<TValues>

Returns

Promise<Record<string, string>>


currency()

ts
function currency(options?: CurrencyValidatorOptions): Validator;

Parameters

ParameterType
optionsCurrencyValidatorOptions

Returns

Validator


custom()

ts
function custom<TValues>(fn: CustomFieldValidator<TValues>): Validator<TValues>;

Type Parameters

Type Parameter
TValues extends Record<string, unknown>

Parameters

ParameterType
fnCustomFieldValidator<TValues>

Returns

Validator<TValues>


asyncValidator()

Call Signature

ts
function asyncValidator<TValues>(validate: Validator<TValues>): AsyncValidator<TValues>;
Type Parameters
Type ParameterDefault type
TValues extends Record<string, unknown>Record<string, unknown>
Parameters
ParameterType
validateValidator<TValues>
Returns

AsyncValidator<TValues>

Call Signature

ts
function asyncValidator<TValues>(options: AsyncValidatorOptions<TValues>): AsyncValidatorWithOptions<TValues>;
Type Parameters
Type ParameterDefault type
TValues extends Record<string, unknown>Record<string, unknown>
Parameters
ParameterType
optionsAsyncValidatorOptions<TValues>
Returns

AsyncValidatorWithOptions<TValues>


isAsyncValidator()

ts
function isAsyncValidator<TValues>(validator: Validator<TValues>): validator is AsyncValidator<TValues>;

Type Parameters

Type Parameter
TValues extends Record<string, unknown>

Parameters

ParameterType
validatorValidator<TValues>

Returns

validator is AsyncValidator<TValues>


getAsyncValidatorOptions()

ts
function getAsyncValidatorOptions<TValues>(validator: Validator<TValues>): 
  | AsyncValidatorOptions<TValues>
  | undefined;

Type Parameters

Type Parameter
TValues extends Record<string, unknown>

Parameters

ParameterType
validatorValidator<TValues>

Returns

| AsyncValidatorOptions<TValues> | undefined


date()

ts
function date(options?: DateValidatorOptions): Validator;

Parameters

ParameterType
optionsDateValidatorOptions

Returns

Validator


parseByteSize()

ts
function parseByteSize(input: string | number): number;

Parse a byte size as a number or human string ("5MB", "500kb", "1 GiB").

Parameters

ParameterType
inputstring | number

Returns

number


accept()

ts
function accept(pattern: string | readonly string[]): Validator;

Require every selected file to match HTML-like accept tokens (extensions .png, MIME image/png, or wildcards image/*).

Parameters

ParameterType
patternstring | readonly string[]

Returns

Validator


maxSize()

ts
function maxSize(limit: FileSizeInput): Validator;

Maximum size per file (bytes or "5MB").

Parameters

ParameterType
limitFileSizeInput

Returns

Validator


minSize()

ts
function minSize(limit: FileSizeInput): Validator;

Minimum size per file (bytes or "1KB"). Empty selection passes.

Parameters

ParameterType
limitFileSizeInput

Returns

Validator


maxFiles()

ts
function maxFiles(limit: number): Validator;

Maximum number of selected files.

Parameters

ParameterType
limitnumber

Returns

Validator


minFiles()

ts
function minFiles(limit: number): Validator;

Minimum number of selected files. Empty still fails when limit > 0.

Parameters

ParameterType
limitnumber

Returns

Validator


maxLength()

ts
function maxLength(max: number): Validator;

Parameters

ParameterType
maxnumber

Returns

Validator


minLength()

ts
function minLength(min: number): Validator;

Parameters

ParameterType
minnumber

Returns

Validator


number()

ts
function number(options?: NumberValidatorOptions): Validator;

Parameters

ParameterType
optionsNumberValidatorOptions

Returns

Validator


min()

ts
function min(minimum: number): Validator;

Parameters

ParameterType
minimumnumber

Returns

Validator


max()

ts
function max(maximum: number): Validator;

Parameters

ParameterType
maximumnumber

Returns

Validator


password()

ts
function password(options?: PasswordValidatorOptions): Validator;

Parameters

ParameterType
optionsPasswordValidatorOptions

Returns

Validator


phone()

ts
function phone(message?: string): Validator;

Parameters

ParameterTypeDefault value
messagestring"Enter a valid phone number."

Returns

Validator


regex()

ts
function regex(pattern: RegExp, message?: string): Validator;

Parameters

ParameterTypeDefault value
patternRegExpundefined
messagestring"Invalid format."

Returns

Validator

An ecosystem of independent, headless TypeScript libraries engineered for modern web development. Every package includes interactive playgrounds and documentation that evolves alongside the code.