data-cap
    Preparing search index...

    Interface MutatorDefinition<TFields, TParams, TRaw, TWrites>

    A mutator operation: performs a side effect. writes is optional -- omitting it defaults to full-capability-tree ownership, bounded to the declared schema (ADR 0011) -- the common "this mutator can touch anything the schema allows" case doesn't pay a declaration tax.

    interface MutatorDefinition<
        TFields,
        TParams,
        TRaw,
        TWrites extends FieldOwnership<TFields> | undefined,
    > {
        execute: (params: TParams, signal: AbortSignal) => Promise<TRaw>;
        optimistic?: (
            authoritativeState: DataState<TFields>,
            params: TParams,
        ) =>
            | OwnedPatch<TFields, TWrites extends undefined ? true : TWrites>
            | undefined;
        params?: TParams;
        processor?: (
            raw: TRaw,
            params: TParams,
        ) => OwnedPatch<TFields, TWrites extends undefined ? true : TWrites>;
        writes?: TWrites;
    }

    Type Parameters

    Index
    execute: (params: TParams, signal: AbortSignal) => Promise<TRaw>

    Performs the actual side effect (a write, an API call, etc.), aborted via signal.

    optimistic?: (
        authoritativeState: DataState<TFields>,
        params: TParams,
    ) =>
        | OwnedPatch<TFields, TWrites extends undefined ? true : TWrites>
        | undefined

    Computes an optimistic patch from CURRENT AUTHORITATIVE state (never the visible/projected state -- a second concurrent optimistic transition must never compute against a first transition's still-pending value). Returning undefined means no optimistic transition for this call.

    params?: TParams

    Default/example params, deep-merged with a caller's partial at call time.

    processor?: (
        raw: TRaw,
        params: TParams,
    ) => OwnedPatch<TFields, TWrites extends undefined ? true : TWrites>

    Defaults to identity when omitted -- execute's raw result is then used directly as the patch.

    writes?: TWrites

    Declares which fields this mutator may write -- omitting it defaults to the full capability tree.