Sanity Library Reference Docs
    Preparing search index...

    Type Alias EffectHandlerContext<Client>

    type EffectHandlerContext<Client extends WorkflowClient> = {
        client: Client;
        clientFor: (ref: GdrUri | GlobalDocumentReference) => WorkflowClient;
        commitOps: (req: CommitOpsRequest) => Promise<void>;
        effectKey: string;
        instanceId: string;
        log: (message: string, extra?: Record<string, unknown>) => void;
        setProgress: (target: ProgressTarget, value: number) => Promise<void>;
    }

    Type Parameters

    Index

    Properties

    client: Client

    A concrete sibling of the createEngine client, bound to the workflow resource with the same credentials; untagged handler requests carry the workflow.effect tag by default.

    Resolve the client for a subject doc's own resource: a handler patching a foreign subject routes its write here — client addresses the instance's. Throws on a bare id.

    commitOps: (req: CommitOpsRequest) => Promise<void>

    Mid-dispatch field.* commit gated on THIS dispatch's exact claim — a superseded claim writes nothing. Runs in call order, never coalesced; idempotencyKey is required.

    effectKey: string
    instanceId: string
    log: (message: string, extra?: Record<string, unknown>) => void
    setProgress: (target: ProgressTarget, value: number) => Promise<void>

    Absolute progress, sugar over commitOps: field.sets a number (0–100, enforced at commit). Unlike commitOps, pending sets to one field coalesce — latest value wins.