Sanity Library Reference Docs
    Preparing search index...

    Interface Source

    Represents a source.

    interface Source {
        advancedVersionControl: { enabled: boolean };
        authenticated: boolean;
        currentUser: CurrentUser;
        dataset: string;
        document: {
            actions: (
                props: PartialContext<DocumentActionsContext>,
            ) => DocumentActionComponent[];
            askToEdit: {
                enabled: (props: DocumentAskToEditEnabledContext) => boolean;
            };
            badges: (
                props: PartialContext<DocumentBadgesContext>,
            ) => DocumentBadgeComponent[];
            drafts: { enabled: boolean };
            inspectors: (
                props: PartialContext<DocumentInspectorContext>,
            ) => DocumentInspector[];
            resolveNewDocumentOptions: (
                context: NewDocumentCreationContext,
            ) => InitialValueTemplateItem[];
            resolveProductionUrl: (
                context: PartialContext<ResolveProductionUrlContext>,
            ) => Promise<string>;
            singletons: SingletonDefinition[];
            unstable_comments: {
                enabled: (props: DocumentCommentsEnabledContext) => boolean;
            };
            unstable_languageFilter: (
                props: PartialContext<DocumentLanguageFilterContext>,
            ) => DocumentLanguageFilterComponent[];
        };
        form: {
            arrays: {
                collapseItems: { enabled: boolean; gridLimit: number; limit: number };
            };
            components?: FormComponents;
            file: { assetSources: AssetSource[]; directUploads: boolean };
            image: { assetSources: AssetSource[]; directUploads: boolean };
            unstable?: {
                CustomMarkers?: FormBuilderCustomMarkersComponent;
                Markers?: FormBuilderMarkersComponent;
            };
        };
        getClient: (clientOptions: SourceClientOptions) => SanityClient$1;
        mediaLibrary?: MediaLibraryConfig;
        name: string;
        onUncaughtError?: (error: Error, errorInfo: ErrorInfo) => void;
        projectId: string;
        releases?: {
            actions?: (
                props: PartialContext<ReleaseActionsContext>,
            ) => ReleaseActionComponent[];
            enabled?: boolean;
            limit?: number;
            metadata?: { fields?: FieldDefinition[] };
        };
        scheduledDrafts?: { enabled: boolean };
        schema: Schema;
        search: {
            filters: SearchFilterDefinition[];
            operators: SearchOperatorDefinition<any>[];
            strategy?: "groq2024" | "groqLegacy";
            unstable_partialIndexing?: { enabled: boolean };
        };
        studio?: { components?: StudioComponents };
        tasks?: { enabled: boolean };
        templates: ResolvedTemplate<any, any>[];
        title: string;
        tools: Tool<any>[];
        type: "source";
    }

    Hierarchy (View Summary)

    Index

    Properties

    advancedVersionControl: { enabled: boolean }

    Advanced version control provides features such as inline content diffs in Studio to make resolving conflicts across document versions easier.

    Type declaration

    • Betaenabled: boolean

      Control whether advanced version control functionality is enabled.

      Advanced version control helps editors identify and resolve divergences between document versions.

    authenticated: boolean

    Whether the user is authenticated.

    currentUser: CurrentUser

    The current user of the source.

    dataset: string

    The name of the dataset.

    document: {
        actions: (
            props: PartialContext<DocumentActionsContext>,
        ) => DocumentActionComponent[];
        askToEdit: { enabled: (props: DocumentAskToEditEnabledContext) => boolean };
        badges: (
            props: PartialContext<DocumentBadgesContext>,
        ) => DocumentBadgeComponent[];
        drafts: { enabled: boolean };
        inspectors: (
            props: PartialContext<DocumentInspectorContext>,
        ) => DocumentInspector[];
        resolveNewDocumentOptions: (
            context: NewDocumentCreationContext,
        ) => InitialValueTemplateItem[];
        resolveProductionUrl: (
            context: PartialContext<ResolveProductionUrlContext>,
        ) => Promise<string>;
        singletons: SingletonDefinition[];
        unstable_comments: {
            enabled: (props: DocumentCommentsEnabledContext) => boolean;
        };
        unstable_languageFilter: (
            props: PartialContext<DocumentLanguageFilterContext>,
        ) => DocumentLanguageFilterComponent[];
    }

    Document-related functionality.

    Type declaration

    form: {
        arrays: {
            collapseItems: { enabled: boolean; gridLimit: number; limit: number };
        };
        components?: FormComponents;
        file: { assetSources: AssetSource[]; directUploads: boolean };
        image: { assetSources: AssetSource[]; directUploads: boolean };
        unstable?: {
            CustomMarkers?: FormBuilderCustomMarkersComponent;
            Markers?: FormBuilderMarkersComponent;
        };
    }

    Form-related functionality.

    Type declaration

    • Betaarrays: { collapseItems: { enabled: boolean; gridLimit: number; limit: number } }

      Array-related functionality.

      • collapseItems: { enabled: boolean; gridLimit: number; limit: number }

        Collapsing of long arrays in the form.

        • enabled: boolean

          Whether long arrays are collapsed.

        • gridLimit: number

          The same, for arrays using the grid layout. Follows limit when one is configured.

        • limit: number

          The number of items rendered before the remaining items are collapsed.

    • Optional Betacomponents?: FormComponents

      Components for the form.

    • Betafile: { assetSources: AssetSource[]; directUploads: boolean }

      File-related functionality.

      • assetSources: AssetSource[]

        The asset sources.

      • directUploads: boolean

        Whether direct uploads are enabled.

    • Betaimage: { assetSources: AssetSource[]; directUploads: boolean }

      Image-related functionality.

      • assetSources: AssetSource[]

        The asset sources.

      • directUploads: boolean

        Whether direct uploads are enabled.

    • Optional Betaunstable?: {
          CustomMarkers?: FormBuilderCustomMarkersComponent;
          Markers?: FormBuilderMarkersComponent;
      }

      these have not been migrated over and are not merged by the form builder

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

    Returns a client instance.

    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.

    projectId: string

    The ID of the project.

    releases?: {
        actions?: (
            props: PartialContext<ReleaseActionsContext>,
        ) => ReleaseActionComponent[];
        enabled?: boolean;
        limit?: number;
        metadata?: { fields?: FieldDefinition[] };
    }

    Type declaration

    • Optionalactions?: (props: PartialContext<ReleaseActionsContext>) => ReleaseActionComponent[]

      Returns an array of actions for the release.

    • Optionalenabled?: boolean
    • Optionallimit?: number

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

    • Optionalmetadata?: { fields?: FieldDefinition[] }

      Extra metadata fields, compiled as a private object schema and edited with the studio form. Rendered on create and in the edit dialog only while beta.variants is enabled. Empty when no workspace or plugin configured any.

    scheduledDrafts?: { enabled: boolean }
    schema: Schema

    The schema of the source.

    search: {
        filters: SearchFilterDefinition[];
        operators: SearchOperatorDefinition<any>[];
        strategy?: "groq2024" | "groqLegacy";
        unstable_partialIndexing?: { enabled: boolean };
    }
    studio?: { components?: StudioComponents }

    Type declaration

    tasks?: { enabled: boolean }
    templates: ResolvedTemplate<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.