Sanity Library Reference Docs
    Preparing search index...

    Interface StructureResolverContext

    Structure tool context. Extends from ConfigContext.

    interface StructureResolverContext {
        currentUser: CurrentUser;
        dataset: string;
        documentStore: DocumentStore;
        getClient: (options: SourceClientOptions) => SanityClient$1;
        i18n: LocaleSource;
        perspectiveStack: StackablePerspective[];
        projectId: string;
        schema: Schema;
        selectedVariantName?: string;
    }

    Hierarchy (View Summary)

    Index

    Properties

    currentUser: CurrentUser

    The current user or null if not authenticated.

    dataset: string

    The name of the dataset.

    documentStore: DocumentStore

    This can be replaced by a different API in the future. It is provided as-is to support common structure patterns found in V2 in V3.

    getClient: (options: SourceClientOptions) => SanityClient$1

    A function that returns a Sanity client with the specified options.

    perspectiveStack: StackablePerspective[]

    The stacked array of perspective ids ordered chronologically to represent the state of documents at the given point in time. It can be used as the perspective param in the client to get the correct view of the documents. ["published"] | ["drafts"] | ["releaseId2", "releaseId1", "drafts"] See PerspectiveStack

    projectId: string

    The ID of the project.

    schema: Schema

    The schema for this source.

    selectedVariantName?: string

    The selected editing variant as a bare variant id, or undefined when no variant is selected. It can be used as the variant param in the client, alongside perspectiveStack, to get the view of the documents as seen through that variant.

    Always provided by the Studio. Declared optional so that structure resolvers written before variants existed keep type checking when they construct this context themselves.