UNPKG

2.15 kBTypeScriptView Raw
1import { Source, Loader } from '@graphql-tools/utils';
2import { UnnormalizedTypeDefPointer, LoadTypedefsOptions as ToolsLoadTypedefsOptions, LoadSchemaOptions as ToolsLoadSchemaOptions } from '@graphql-tools/load';
3import { GraphQLSchema, DocumentNode } from 'graphql';
4import { MiddlewareFn } from './helpers/utils';
5declare type Pointer = UnnormalizedTypeDefPointer | UnnormalizedTypeDefPointer[];
6declare type LoadTypedefsOptions = Partial<ToolsLoadTypedefsOptions>;
7declare type LoadSchemaOptions = Partial<ToolsLoadSchemaOptions>;
8export declare type SchemaOutput = 'GraphQLSchema' | 'DocumentNode' | 'string';
9export declare class LoadersRegistry {
10 private _loaders;
11 private _middlewares;
12 private readonly cwd;
13 constructor({ cwd }: {
14 cwd: string;
15 });
16 register(loader: Loader): void;
17 override(loaders: Loader[]): void;
18 use(middleware: MiddlewareFn<DocumentNode>): void;
19 loadTypeDefs(pointer: Pointer, options?: LoadTypedefsOptions): Promise<Source[]>;
20 loadTypeDefsSync(pointer: Pointer, options?: LoadTypedefsOptions): Source[];
21 loadDocuments(pointer: Pointer, options?: LoadTypedefsOptions): Promise<Source[]>;
22 loadDocumentsSync(pointer: Pointer, options?: LoadTypedefsOptions): Source[];
23 loadSchema(pointer: Pointer): Promise<GraphQLSchema>;
24 loadSchema(pointer: Pointer, out: 'string', options?: LoadSchemaOptions): Promise<GraphQLSchema>;
25 loadSchema(pointer: Pointer, out: 'DocumentNode', options?: LoadSchemaOptions): Promise<DocumentNode>;
26 loadSchema(pointer: Pointer, out: 'GraphQLSchema', options?: LoadSchemaOptions): Promise<GraphQLSchema>;
27 loadSchemaSync(pointer: Pointer): GraphQLSchema;
28 loadSchemaSync(pointer: Pointer, out: 'string', options?: LoadSchemaOptions): GraphQLSchema;
29 loadSchemaSync(pointer: Pointer, out: 'DocumentNode', options?: LoadSchemaOptions): DocumentNode;
30 loadSchemaSync(pointer: Pointer, out: 'GraphQLSchema', options?: LoadSchemaOptions): GraphQLSchema;
31 private createOptions;
32 private transformSchemaSources;
33 private castSchema;
34}
35export {};
36//# sourceMappingURL=loaders.d.ts.map
\No newline at end of file