form-graph
    Preparing search index...

    Interface FormStore<State, Ext, Codecs, Data>

    interface FormStore<State, Ext, Codecs = unknown, Data = State> {
        clearError(key: FieldKeys<Codecs, State>): void;
        dirtyFields(): string[];
        getCodecChurn(): string[];
        getComputedKeys(): string[];
        getField(key: string): FieldSnapshot<unknown, unknown> | null;
        getIntent(): Record<string, unknown>;
        getNotes(): readonly ResolutionNote[];
        getSnapshot(): Snapshot<State>;
        getState(): State;
        isDirty(): boolean;
        list(key: FieldKeys<Codecs, State>): ListHandle;
        output(): Data;
        prune(predicate: (address: string) => boolean): void;
        reset(options?: { exclude?: readonly string[] }): void;
        set(patch: Record<string, unknown>): void;
        setError(
            key: FieldKeys<Codecs, State>,
            error: { code?: string; message: string },
        ): void;
        setExt(ext: Ext): void;
        subscribe(callback: Listener): () => void;
        subscribe(key: string, callback: Listener): () => void;
        validate(): ValidationResult<Data, State>;
        validate(
            keys: FieldKeys<Codecs, State> | readonly FieldKeys<Codecs, State>[],
        ): ScopedValidationResult;
    }

    Type Parameters

    • State
    • Ext
    • Codecs = unknown

      Phantom registry carried from the FormDefinition so registry-driven binding helpers can infer per-key types from a store value alone. Never read at runtime.

    • Data = State
    Index
    • Field keys the user has WRITTEN this session — non-ephemeral TRUSTED intent, scope-collapsed (a field edited under two branch buckets reports once, by addressKey; list element paths report as paths). Storage-loaded and seeded values are boundary entries and don't count: dirty means "the user did this here", which is what an unsaved-changes warning wants. Deliberate divergence from react-hook-form: writing the default value back STAYS dirty — the entry exists; we don't deep-compare defaults.

      Returns string[]

    • Keys whose codec is being rebuilt on every pass — hoist these.

      Returns string[]

    • Derived (computed) keys in the active branch.

      Returns string[]

    • Durable intent only — adopted defaults are session memory, never saved.

      Returns Record<string, unknown>

    • The strict submission projection — typed as Data on the same claim parse makes: same keys, per-key output-validated (possibly stripped) values. Never written back into state.

      Returns Data

    • Deletes intent entries whose ADDRESS matches — storageAdapter.removeKey sweeps (clearStorageForOutput). The predicate sees full addresses (steps@groupA/2); match on addressKey(address) to clear every bucket of one field.

      Parameters

      • predicate: (address: string) => boolean

      Returns void

    • Clears intent. Excluded FIELD KEYS keep everything they've accumulated — every scoped bucket included, so an excluded steps survives with its per-scope memory intact.

      Parameters

      • options: { exclude?: readonly string[] } = {}

      Returns void

    • Parameters

      • patch: Record<string, unknown>

      Returns void

    • Attach an EXTERNAL validity judgment to a field — the door for async results (a server-side audit, a failed cost check) into the sync engine. Participates in the snapshot's error and in validate()/output(); never persisted. Cleared by a user write to the field, by the field leaving the active branch, or explicitly via clearError().

      Parameters

      • key: FieldKeys<Codecs, State>
      • error: { code?: string; message: string }

      Returns void

    • Parameters

      • callback: Listener

      Returns () => void

    • Parameters

      • key: string
      • callback: Listener

      Returns () => void

    • Runs output schemas, records errors on fields, and notifies. Mirrors set's shape: no argument judges the whole active graph; a key or key list judges ONLY those fields (a wizard step's "Next"), surfacing and clearing errors for them alone — other fields' surfaced errors are left untouched. The scoped form returns no data: its success vouches only for the named fields, and the full projection would over-promise.

      Returns ValidationResult<Data, State>

    • Runs output schemas, records errors on fields, and notifies. Mirrors set's shape: no argument judges the whole active graph; a key or key list judges ONLY those fields (a wizard step's "Next"), surfacing and clearing errors for them alone — other fields' surfaced errors are left untouched. The scoped form returns no data: its success vouches only for the named fields, and the full projection would over-promise.

      Parameters

      Returns ScopedValidationResult