Sanity Library Reference Docs
    Preparing search index...
    interface EvaluateFromSnapshotArgs {
        actor: Actor;
        attributes?: UserAttributes;
        definition: {
            description?: string;
            fields?: FieldEntry[];
            groups?: Group[];
            initialStage: string;
            lifecycle?: WorkflowLifecycle;
            name: string;
            predicates?: Record<string, string>;
            roleAliases?: RoleAliases;
            semantics?: Semantic[];
            stages: Stage[];
            start?: StartBlock;
            title: string;
        };
        grants?: Grant[];
        guardDereference?: GuardDereference;
        guards?: readonly MutationGuardDoc[];
        instance: WorkflowInstance;
        localPrincipalId?: string;
        now?: string;
        resourceGrants?: ReadonlyMap<string, SubjectResourceAccess>;
        snapshot: HydratedSnapshot;
    }
    Index

    Properties

    actor: Actor
    attributes?: UserAttributes

    Resolved org-level user attributes for the actor. Omit to leave the rendered $attributes undefined (conditions referencing it fail closed).

    definition: {
        description?: string;
        fields?: FieldEntry[];
        groups?: Group[];
        initialStage: string;
        lifecycle?: WorkflowLifecycle;
        name: string;
        predicates?: Record<string, string>;
        roleAliases?: RoleAliases;
        semantics?: Semantic[];
        stages: Stage[];
        start?: StartBlock;
        title: string;
    }
    grants?: Grant[]

    Resolved grants for the actor. Omit to leave the rendered $can undefined (conditions referencing it fail closed — the real lake write boundary still enforces).

    guardDereference?: GuardDereference

    Stored-resource lookup for guard predicates using ->. Omit when no guard can dereference; missing lookups resolve null and deny fail-closed.

    guards?: readonly MutationGuardDoc[]

    Live mutation guards held for this instance (a reactive adapter's guard stream). Every action commit is an update write to the instance doc, so a guard that matches the instance and denies that write disables every action with mutation-guard-denied. Omit to skip the gate in this projection — the engine's verb paths load live guards and re-check at commit time (the runtime evaluation path fetches them itself).

    localPrincipalId?: string

    The actor's principal id in the workflow resource's own identity namespace — the comparand for everything the resource's lake evaluates (identity() in guard predicates, the anchor ACL's grant filters). Omitted when it equals Actor.id (org-level resources, robots).

    now?: string

    The $now reading every condition in this projection shares. Omit to use wallClock; a reactive consumer (or the bench) passes its own clock reading for a stable/deterministic timeline.

    resourceGrants?: ReadonlyMap<string, SubjectResourceAccess>

    Per-FOREIGN-subject-resource access — the actor's ACL grants PLUS the actor's principal id in that resource's own namespace — keyed by resource-shaped GDR (<type>:<id>); feeds the subject-write forecast on effects-bearing actions (SubjectPermissionDenial). A resource appears only when both halves resolved; omit it (or the whole map) to skip that resource's forecast (degrade open — the subject's lake still enforces). The runtime evaluation path resolves this through each resource's own client.

    The in-memory snapshot to evaluate against. The caller assembles it from whatever source — a fetch-backed evaluation or a live store. The _id of every doc must be in GDR-URI form, as buildSnapshot produces.