UNPKG

sanity

Version:

Sanity is a real-time content infrastructure with a scalable, hosted backend featuring a Graph Oriented Query Language (GROQ), asset pipelines and fast edge caches

20 lines (16 loc) 518 B
import {type CliApiClient} from '@sanity/cli' export function createSchemaApiClient(apiClient: CliApiClient) { const client = apiClient({ requireUser: true, requireProject: true, }).withConfig({apiVersion: 'v2025-03-01', useCdn: false}) const projectId = client.config().projectId const dataset = client.config().dataset if (!projectId) throw new Error('Project ID is not defined') if (!dataset) throw new Error('Dataset is not defined') return { client, projectId, dataset, } }