1 | import { DocumentNode, GraphQLSchema, BuildSchemaOptions } from 'graphql';
|
2 | import { GraphQLSchemaValidationOptions } from 'graphql/type/schema';
|
3 | import { ExtendedParseOptions } from './parse-graphql-sdl';
|
4 | export interface Source {
|
5 | document?: DocumentNode;
|
6 | schema?: GraphQLSchema;
|
7 | rawSDL?: string;
|
8 | location?: string;
|
9 | }
|
10 | export declare type SingleFileOptions = ExtendedParseOptions & GraphQLSchemaValidationOptions & BuildSchemaOptions & {
|
11 | cwd?: string;
|
12 | };
|
13 | export declare type WithList<T> = T | T[];
|
14 | export declare type ElementOf<TList> = TList extends Array<infer TElement> ? TElement : never;
|
15 | export declare type SchemaPointer = WithList<string>;
|
16 | export declare type SchemaPointerSingle = ElementOf<SchemaPointer>;
|
17 | export declare type DocumentGlobPathPointer = string;
|
18 | export declare type DocumentPointer = WithList<DocumentGlobPathPointer>;
|
19 | export declare type DocumentPointerSingle = ElementOf<DocumentPointer>;
|
20 | export interface Loader<TPointer = string, TOptions extends SingleFileOptions = SingleFileOptions> {
|
21 | loaderId(): string;
|
22 | canLoad(pointer: TPointer, options?: TOptions): Promise<boolean>;
|
23 | canLoadSync?(pointer: TPointer, options?: TOptions): boolean;
|
24 | load(pointer: TPointer, options?: TOptions): Promise<Source | never>;
|
25 | loadSync?(pointer: TPointer, options?: TOptions): Source | never;
|
26 | }
|
27 | export declare type SchemaLoader<TOptions extends SingleFileOptions = SingleFileOptions> = Loader<SchemaPointerSingle, TOptions>;
|
28 | export declare type DocumentLoader<TOptions extends SingleFileOptions = SingleFileOptions> = Loader<DocumentPointerSingle, TOptions>;
|
29 | export declare type UniversalLoader<TOptions extends SingleFileOptions = SingleFileOptions> = Loader<SchemaPointerSingle | DocumentPointerSingle, TOptions>;
|