UNPKG

gatsby-source-sanity

Version:

Gatsby source plugin for building websites using Sanity.io as a backend.

35 lines (34 loc) 1.02 kB
import { ListTypeNode, NamedTypeNode, NonNullTypeNode } from 'gatsby/graphql'; import SanityClient = require('@sanity/client'); import { PluginConfig } from '../gatsby-node'; export declare type FieldDef = { type: NamedTypeNode | ListTypeNode | NonNullTypeNode; namedType: NamedTypeNode; isList: boolean; aliasFor: string | null; isReference: boolean; }; export declare type ObjectTypeDef = { name: string; kind: 'Object'; isDocument: boolean; fields: { [key: string]: FieldDef; }; }; export declare type UnionTypeDef = { name: string; types: string[]; }; export declare type TypeMap = { scalars: string[]; objects: { [key: string]: ObjectTypeDef; }; unions: { [key: string]: UnionTypeDef; }; }; export declare const defaultTypeMap: TypeMap; export declare function getRemoteGraphQLSchema(client: SanityClient, config: PluginConfig): Promise<string>; export declare function getTypeMapFromGraphQLSchema(sdl: string): TypeMap;