Sanity Library Reference Docs
    Preparing search index...

    Interface StructureContext

    Interface for the structure builder context.

    interface StructureContext {
        authenticated: boolean;
        currentUser: CurrentUser;
        dataset: string;
        getClient: (clientOptions: SourceClientOptions) => SanityClient;
        getStructureBuilder: () => StructureBuilder;
        mediaLibrary?: MediaLibraryConfig;
        name: string;
        onUncaughtError?: (error: Error, errorInfo: ErrorInfo) => void;
        perspectiveStack: StackablePerspective[];
        projectId: string;
        releases?: { enabled?: boolean; limit?: number };
        resolveDocumentNode: (
            options: { documentId?: string; schemaType: string },
        ) => DocumentBuilder;
        schema: Schema;
        search: {
            enableLegacySearch?: boolean;
            filters: SearchFilterDefinition[];
            operators: SearchOperatorDefinition<any>[];
            strategy?: "groqLegacy" | "groq2024";
            unstable_partialIndexing?: { enabled: boolean };
        };
        tasks?: { enabled: boolean };
        templates: Template<any, any>[];
        title: string;
        tools: Tool<any>[];
        type: "source";
    }

    Hierarchy (View Summary)

    Index

    Properties

    authenticated: boolean

    Whether the user is authenticated.

    currentUser: CurrentUser

    The current user of the source.

    dataset: string

    The name of the dataset.

    getClient: (clientOptions: SourceClientOptions) => SanityClient

    Returns a client instance.

    Type declaration

    getStructureBuilder: () => StructureBuilder

    Get structure builder

    Type declaration

    mediaLibrary?: MediaLibraryConfig

    Config for the Sanity Media Library asset source integration.

    name: string

    The name of the source.

    onUncaughtError?: (error: Error, errorInfo: ErrorInfo) => void

    Configuration for error handling.

    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.

    releases?: { enabled?: boolean; limit?: number }

    Type declaration

    • Optionalenabled?: boolean
    • Optionallimit?: number

      Limit the number of releases that can be created by this workspace.

    resolveDocumentNode: (
        options: { documentId?: string; schemaType: string },
    ) => DocumentBuilder

    Resolve document method

    Type declaration

      • (options: { documentId?: string; schemaType: string }): DocumentBuilder
      • Parameters

        • options: { documentId?: string; schemaType: string }

          an object holding the documentId and schemaType for the document node being resolved.

        Returns DocumentBuilder

        a document node builder, or null/undefined if no document node should be returned. See DocumentBuilder

    schema: Schema

    The schema of the source.

    search: {
        enableLegacySearch?: boolean;
        filters: SearchFilterDefinition[];
        operators: SearchOperatorDefinition<any>[];
        strategy?: "groqLegacy" | "groq2024";
        unstable_partialIndexing?: { enabled: boolean };
    }
    tasks?: { enabled: boolean }
    templates: Template<any, any>[]

    The templates of the source.

    title: string

    The title of the source.

    tools: Tool<any>[]

    The tools of the source.

    type: "source"

    The type of the source.