Sanity Library Reference Docs
    Preparing search index...

    Interface MutationGuardDoc

    The persisted body of a mutation guard — every field except the lake system fields. Shared by MutationGuardDoc (the stored doc) and the engine's compile inputs, so the field set lives in one place.

    interface MutationGuardDoc {
        _createdAt?: string;
        _id: string;
        _rev?: string;
        _type: "temp.system.guard";
        _updatedAt?: string;
        description?: string;
        match: MutationGuardMatch;
        metadata: Record<string, unknown>;
        name?: string;
        owner: string;
        predicate: string;
        resourceId: string;
        resourceType: string;
        sourceDefinition: string;
        sourceInstanceId: string;
        sourceStage: string;
    }

    Hierarchy (View Summary)

    Index

    Properties

    _createdAt?: string
    _id: string
    _rev?: string

    Deliberately NO engine data-model stamp (modelVersion/minReaderModel) — this doc format is the lake's forthcoming contract, and the engine must not grow fields on a shape it doesn't own. Assigned by the lake on write — never sent on create (an empty-string value fails datetime validation).

    _type: "temp.system.guard"
    _updatedAt?: string
    description?: string

    Bare document ids (resource-local; both published and drafts. forms).

    metadata: Record<string, unknown>

    Caller-owned projected state the predicate reads as guard.metadata.*.

    name?: string
    owner: string

    Provenance stamp — who registered the guard (the engine writes its own marker here). Unenforced: nothing reads owner, and there is no owner/admin modification rule — guard deploy/refresh/retract ride the caller's token like every other engine write. A lake-enforced guard can therefore lock the engine's own housekeeping out (self-lockout) until a dedicated engine execution identity exists.

    predicate: string

    Lake delta-mode GROQ. The root exposes document.before, document.after, mutation, and guard; identity() and resource-local reference dereferencing are available. Empty string is unconditional deny.

    resourceId: string
    resourceType: string

    The single datasource this guard belongs to — the engine spans datasources and must record which one, since the lake is per-datasource and infers the resource from storage.

    sourceDefinition: string
    sourceInstanceId: string

    Provenance — the workflow that registered this guard. The lake's own guard model carries none of these; they exist so the engine can find its guards for coherency refresh and housekeeping without parsing them out of _id.

    sourceStage: string