Sanity Library Reference Docs
    Preparing search index...

    The caller-side half of the start contexts — everything the evaluating surface knows that the definition doesn't. Every member is optional because the surfaces genuinely differ (a pure consumer may hold no clock): An absent binding evaluates each read of it to GROQ null, and where that null lands decides the verdict — a predicate that can't decide without the binding fails closed, while a count-of-matches clause over values every row stores passes vacuously (in GROQ null equals only null, so the unbound read matches no stored value). The vars themselves are inventoried in START_FILTER_VARS / START_REQUIREMENT_VARS; the caller's $fields map is NOT scope — start.filter never binds it, and explainStartRequirement takes it as its own argument.

    interface StartScope {
        fetchDataset?: () => Promise<unknown[]>;
        now?: string;
        subject?:
            | `dataset:${string}`
            | `canvas:${string}`
            | `media-library:${string}`
            | `dashboard:${string}`;
        tag?: string;
    }
    Index

    Properties

    fetchDataset?: () => Promise<unknown[]>

    The engine-owned start slice, for predicates that read *[...] or for a singleSubject requirement — invoked lazily only when evaluation needs it. Each row exposes exactly {definition, subject, completedAt}; completed rows are included, so authors qualify in-flight themselves (!defined(completedAt)). Absent ⇒ a dataset-reading filter fails closed (this surface cannot see the dataset, so it cannot decide), while a dataset-reading requirement THROWS — see explainStartRequirement.

    now?: string

    ISO clock reading — binds $now.

    subject?:
        | `dataset:${string}`
        | `canvas:${string}`
        | `media-library:${string}`
        | `dashboard:${string}`

    Resource-qualified identity of the prospective subject. Unlike a loaded document's bare _id, this stays collision-free across resources.

    tag?: string

    The engine's tag partition — binds $tag.