Sanity Library Reference Docs
    Preparing search index...

    A stored action. semantics is engine-owned advisory meaning, independent of execution and presentation — an array so the vocabulary can grow without reshaping this field. when's presence makes the action CASCADE-FIRED: the engine fires it the moment the condition turns true, at most once per stage visit, and it is never invocable via fireAction; absent, the action must be invoked via fireAction by any caller holding a token (fire-on-entry is when: 'true'). filter is existence with GROQ semantics — a non-matching action might as well not exist (invisible to UI and LLMs, never merely disabled); on a when action it composes: filter scopes whether the automation exists, when is its firing trigger. roles is kept VERBATIM only when cascade-fired (the pin on which identities may execute the trigger); a fireAction-fired action's roles folds into filter at desugar instead.

    interface Action {
        description?: string;
        effects?: {
            bindings?: { [key: string]: string };
            description?: string;
            input?: { [key: string]: unknown };
            name: string;
            outputs?: FieldShape[];
            title?: string;
        }[];
        filter?: string;
        group?: string[];
        name: string;
        ops?: Op[];
        params?: {
            description?: string;
            name: string;
            options?: ChoiceOptions;
            required?: boolean;
            title?: string;
            type: | "string"
            | "number"
            | "boolean"
            | "actor"
            | "url"
            | "doc.ref"
            | "doc.refs"
            | "dateTime"
            | "json";
            validation?: ScalarValidation;
        }[];
        roles?: string[];
        semantics?: ActionSemantic[];
        spawn?: {
            context?: { [key: string]: string };
            definition: { name: string; version?: number | "latest" };
            forEach: string;
            onExit?: "detach" | "abort";
            with?: { [key: string]: string };
        };
        title?: string;
        when?: string;
    }
    Index

    Properties

    description?: string
    effects?: {
        bindings?: { [key: string]: string };
        description?: string;
        input?: { [key: string]: unknown };
        name: string;
        outputs?: FieldShape[];
        title?: string;
    }[]
    filter?: string
    group?: string[]
    name: string
    ops?: Op[]
    params?: {
        description?: string;
        name: string;
        options?: ChoiceOptions;
        required?: boolean;
        title?: string;
        type:
            | "string"
            | "number"
            | "boolean"
            | "actor"
            | "url"
            | "doc.ref"
            | "doc.refs"
            | "dateTime"
            | "json";
        validation?: ScalarValidation;
    }[]
    roles?: string[]
    semantics?: ActionSemantic[]
    spawn?: {
        context?: { [key: string]: string };
        definition: { name: string; version?: number | "latest" };
        forEach: string;
        onExit?: "detach" | "abort";
        with?: { [key: string]: string };
    }
    title?: string
    when?: string