Sanity Library Reference Docs
    Preparing search index...

    The bench-owned engine call context injected into every wrapped verb.

    interface BenchState {
        access: WorkflowAccess;
        advance: (ms: number) => void;
        client: TestClient;
        clientFor: (access: WorkflowAccess) => TestClient;
        currentUser: Actor;
        executionContext: DeclaredExecutionContext;
        grants: Grant[];
        now: () => string;
        resourceClients?: ResourceClientResolver;
        seedDocuments: (documents: StoreDocument[]) => void;
        setNow: (iso: string) => void;
        tag: string;
        workflowResource: WorkflowResource;
    }

    Hierarchy (View Summary)

    Index

    Properties

    advance: (ms: number) => void

    Moves the bench clock forward by ms; call Bench.tick after to re-evaluate — advance itself never writes.

    client: TestClient
    clientFor: (access: WorkflowAccess) => TestClient

    A token-bound sibling client acting as access — the bench's ONE identity seam, cached per identity with omitted grants defaulting to wildcard; bind it to createBenchEngine instead of hand-rolling addIdentity + withConfig.

    currentUser: Actor
    executionContext: DeclaredExecutionContext
    grants: Grant[]
    now: () => string

    Current bench clock reading (ISO); wall-clock until BenchState.setNow or BenchState.advance freezes it.

    resourceClients?: ResourceClientResolver
    seedDocuments: (documents: StoreDocument[]) => void
    setNow: (iso: string) => void

    Freezes the bench clock at an explicit ISO instant; every subsequent engine call sees this as $now and stamps it on history.

    tag: string
    workflowResource: WorkflowResource