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