gatsby-source-sanity
Version:
Gatsby source plugin for building websites using Sanity.io as a backend.
38 lines (37 loc) • 1.15 kB
TypeScript
import { ListTypeNode, NamedTypeNode, NonNullTypeNode } from 'gatsby/graphql';
import SanityClient = require('@sanity/client');
import { ExampleValues } from './getExampleValues';
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;
kind: 'Union';
types: string[];
};
export declare type TypeMap = {
scalars: string[];
unions: {
[key: string]: UnionTypeDef;
};
objects: {
[key: string]: ObjectTypeDef;
};
exampleValues: ExampleValues;
};
export declare const defaultTypeMap: TypeMap;
export declare function getRemoteGraphQLSchema(client: SanityClient, config: PluginConfig): Promise<string>;
export declare function getTypeMapFromGraphQLSchema(sdl: string, config: PluginConfig): TypeMap;