Sanity Library Reference Docs
    Preparing search index...

    Declares every topic available through the message bus.

    interface Topics {
        "access.request": EventTopicDef<
            { resourceId: string; resourceType: "organization"
            | "project" },
            { ok: true } | { ok: false; reason: "unsupported" | "already-has-access" },
        >;
        "applications.activity": EventTopicDef<DocumentActivity>;
        "applications.base-path": StateTopicDef<TopicResult<string>>;
        "applications.capabilities": StateTopicDef<
            Partial<Record<"history" | "globalUserMenu" | "favorites", boolean>>,
        >;
        "applications.config": StateTopicDef<ApplicationConfig[] | null>;
        "applications.context": StateTopicDef<
            ApplicationContext & { appId: string }
            | null,
        >;
        "applications.context.update": EventTopicDef<ApplicationContext | null>;
        "applications.foreground": StateTopicDef<string | null>;
        "applications.list": StateTopicDef<
            | TopicResult<
                (
                    | Installation<InstallationInclude>
                    | Application<ApplicationInclude>
                    | LocalApplication
                )[],
            >
            | null,
        >;
        "applications.reload": EventTopicDef<
            void,
            { ok: true }
            | { ok: false; reason: "unsupported" },
        >;
        "applications.status.update": EventTopicDef<ApplicationStatusUpdate>;
        "auth.token": StateTopicDef<string | null>;
        "auth.token.refresh": EventTopicDef<void, string>;
        "favorites.documents": StateTopicDef<FavoriteDocument[]>;
        "favorites.update": EventTopicDef<
            {
                document: DashboardDocumentReference & { resource: {} };
                favorited: boolean;
            },
            void,
        >;
        "navigation.location": StateTopicDef<NavigationLocation | null>;
        "navigation.location.update": EventTopicDef<
            { history?: "push"
            | "replace"; url: string },

                | { ok: true }
                | { ok: false; reason: "not-navigable" | "interrupted" | "failed" },
        >;
        "organizations.current": StateTopicDef<
            Pick<OrganizationBase, "name" | "id" | "slug">
            | null,
        >;
        "panels.mode": StateTopicDef<
            | TopicResult<
                | { appId: string; mode: "aside"; name: string; size?: number }
                | { appId: string; mode: "full"; name: string }
                | null,
            >
            | null,
        >;
        "panels.mode.set": EventTopicDef<
            | { mode: "aside"
            | "full"; name: string }
            | { name: string; size: number }
            | null,
        >;
        "preferences.color-scheme": StateTopicDef<"light" | "dark">;
        "preferences.dock-locked": StateTopicDef<boolean>;
        "users.current": StateTopicDef<CurrentUser | null>;
        "workers.message": EventTopicDef<unknown>;
        "workers.post": EventTopicDef<{ name: string; payload: unknown }, unknown>;
    }

    Hierarchy (View Summary)

    Index

    Properties

    "access.request": EventTopicDef<
        { resourceId: string; resourceType: "organization"
        | "project" },
        { ok: true } | { ok: false; reason: "unsupported" | "already-has-access" },
    >

    Asks the dashboard to show its access request prompt for a resource the user can't access, scoped like the Access API's /access/{resourceType}/{resourceId}/requests. Replies once the prompt is shown. The prompt handles the Access API outcome (SSO enforcement, pending or declined requests, request limits), so the reply doesn't report it.

    ok: false reasons:

    • unsupported: the dashboard doesn't show access requests for the sending application
    • already-has-access: the user already has access to the resource, so there is nothing to request
    "applications.activity": EventTopicDef<DocumentActivity>

    Reports user activity in an application, e.g. for the recents feed. Fire-and-forget.

    "applications.base-path": StateTopicDef<TopicResult<string>>

    The base path for an application.

    An unknown application returns {ok: false}.

    "applications.capabilities": StateTopicDef<
        Partial<Record<"history" | "globalUserMenu" | "favorites", boolean>>,
    >

    The capabilities the host provides. A missing key means the host does not provide it.

    "applications.config": StateTopicDef<ApplicationConfig[] | null>

    The available application configuration modules.

    "applications.context": StateTopicDef<
        ApplicationContext & { appId: string }
        | null,
    >

    The foreground application's context, or null when it has published none.

    "applications.context.update": EventTopicDef<ApplicationContext | null>

    Publishes the sending application's context. null clears it. Fire-and-forget.

    "applications.foreground": StateTopicDef<string | null>

    The foreground application ID, or null on dashboard-level routes.

    "applications.list": StateTopicDef<
        | TopicResult<
            (
                | Installation<InstallationInclude>
                | Application<ApplicationInclude>
                | LocalApplication
            )[],
        >
        | null,
    >

    The dashboard applications and installations available to the current user. Each member publishes its own raw serialised record, so the kinds are distinguished by shape: an Application has a type of 'studio' | 'coreApp', a LocalApplication adds local, and an Installation has no type and carries applicationId with a nested application object.

    "applications.reload": EventTopicDef<
        void,
        { ok: true }
        | { ok: false; reason: "unsupported" },
    >

    Asks the dashboard to reload the sending application with its latest code, without reloading the dashboard. Replies before the application is unmounted.

    ok: false reasons:

    • unsupported: the dashboard can't reload the sending application
    "applications.status.update": EventTopicDef<ApplicationStatusUpdate>
    "auth.token": StateTopicDef<string | null>

    The session token for the reading connection, or null while signed out. The host writes it to each connection separately, so one application never sees another's token.

    "auth.token.refresh": EventTopicDef<void, string>

    Requests a dashboard session token.

    "favorites.documents": StateTopicDef<FavoriteDocument[]>

    The signed-in user's favorited documents, published while the host provides favorites.

    "favorites.update": EventTopicDef<
        {
            document: DashboardDocumentReference & { resource: {} };
            favorited: boolean;
        },
        void,
    >

    Favorites or unfavorites a document. The host replies once favorites.documents reflects the change, so a read after the reply sees it. A favorite is identified by its published document ID, type, resource and schemaName (workspace).

    "navigation.location": StateTopicDef<NavigationLocation | null>

    The current dashboard location and active navigation.

    "navigation.location.update": EventTopicDef<
        { history?: "push"
        | "replace"; url: string },

            | { ok: true }
            | { ok: false; reason: "not-navigable" | "interrupted" | "failed" },
    >

    Requests navigation and replies when the location commits.

    ok: false reasons:

    • not-navigable: the URL cannot be handled by a dashboard application
    • interrupted: another navigation superseded the request
    • failed: the router rejected or did not commit the request
    "organizations.current": StateTopicDef<
        Pick<OrganizationBase, "name" | "id" | "slug">
        | null,
    >

    The current organization, or null without an active organization.

    "panels.mode": StateTopicDef<
        | TopicResult<
            | { appId: string; mode: "aside"; name: string; size?: number }
            | { appId: string; mode: "full"; name: string }
            | null,
        >
        | null,
    >

    The open panel, its application, display mode, and optional width in pixels.

    "panels.mode.set": EventTopicDef<
        | { mode: "aside"
        | "full"; name: string }
        | { name: string; size: number }
        | null,
    >

    Opens, updates, resizes, or closes an application's panel.

    "preferences.color-scheme": StateTopicDef<"light" | "dark">

    The resolved dashboard color scheme.

    "preferences.dock-locked": StateTopicDef<boolean>

    Whether the dashboard dock is pinned open.

    "users.current": StateTopicDef<CurrentUser | null>

    The signed-in user, or null while signed out.

    "workers.message": EventTopicDef<unknown>

    A worker messages its own application's views. Only that application's views receive it; they read it with useWorker.

    "workers.post": EventTopicDef<{ name: string; payload: unknown }, unknown>

    A view posts to one of its own application's workers by service name. The dashboard passes the payload to that worker and returns its reply, or refuses with NO_RESPONDER when the worker isn't running. Views send it with useWorker.