1 | import { IResolvers, Transform } from '@graphql-tools/utils';
|
2 | import { GraphQLSchema, GraphQLResolveInfo, DocumentNode } from 'graphql';
|
3 | import * as YamlConfig from './config';
|
4 | import { KeyValueCache, KeyValueCacheSetOptions } from 'fetchache';
|
5 | import { Executor, Subscriber } from '@graphql-tools/delegate';
|
6 | export { YamlConfig };
|
7 | export declare function getJsonSchema(): any;
|
8 | export declare type MeshSource<ContextType = any, InitialContext = any> = {
|
9 | schema: GraphQLSchema;
|
10 | executor?: Executor;
|
11 | subscriber?: Subscriber;
|
12 | contextVariables?: (keyof InitialContext)[];
|
13 | contextBuilder?: (initialContextValue: InitialContext) => Promise<ContextType>;
|
14 | batch?: boolean;
|
15 | };
|
16 | export declare type GetMeshSourceOptions<THandlerConfig> = {
|
17 | name: string;
|
18 | pubsub: MeshPubSub;
|
19 | config: THandlerConfig;
|
20 | cache: KeyValueCache;
|
21 | };
|
22 | export interface MeshHandler<TContext = any> {
|
23 | getMeshSource: () => Promise<MeshSource<TContext>>;
|
24 | }
|
25 | export interface MeshHandlerLibrary<TConfig = any, TContext = any> {
|
26 | new (options: GetMeshSourceOptions<TConfig>): MeshHandler<TContext>;
|
27 | }
|
28 | export declare type ResolverData<TParent = any, TArgs = any, TContext = any> = {
|
29 | root?: TParent;
|
30 | args?: TArgs;
|
31 | context?: TContext;
|
32 | info?: GraphQLResolveInfo;
|
33 | };
|
34 | export declare type AllHooks = {
|
35 | destroy: void;
|
36 | resolverCalled: {
|
37 | resolverData: ResolverData;
|
38 | };
|
39 | resolverDone: {
|
40 | resolverData: ResolverData;
|
41 | result: any;
|
42 | };
|
43 | resolverError: {
|
44 | resolverData: ResolverData;
|
45 | error: Error;
|
46 | };
|
47 | [key: string]: any;
|
48 | };
|
49 | export declare type HookName = keyof AllHooks & string;
|
50 | export interface MeshPubSub {
|
51 | publish<THook extends HookName>(triggerName: THook, payload: AllHooks[THook]): Promise<void>;
|
52 | subscribe<THook extends HookName>(triggerName: THook, onMessage: (data: AllHooks[THook]) => void, options?: any): Promise<number>;
|
53 | unsubscribe(subId: number): void;
|
54 | asyncIterator<THook extends HookName>(triggers: THook): AsyncIterator<AllHooks[THook]>;
|
55 | }
|
56 | export interface MeshTransformOptions<Config = any> {
|
57 | config: Config;
|
58 | cache: KeyValueCache;
|
59 | pubsub: MeshPubSub;
|
60 | apiName?: string;
|
61 | }
|
62 | export interface MeshTransformLibrary<Config = any> {
|
63 | new (options: MeshTransformOptions<Config>): MeshTransform;
|
64 | }
|
65 | export interface MeshTransform extends Transform {
|
66 | noWrap?: boolean;
|
67 | }
|
68 | export declare type Maybe<T> = null | undefined | T;
|
69 | export { KeyValueCache, KeyValueCacheSetOptions };
|
70 | export declare type MergerFn = (options: {
|
71 | rawSources: RawSourceOutput[];
|
72 | cache: KeyValueCache;
|
73 | pubsub: MeshPubSub;
|
74 | typeDefs?: DocumentNode[];
|
75 | resolvers?: IResolvers;
|
76 | transforms?: Transform[];
|
77 | executor?: Executor;
|
78 | }) => Promise<GraphQLSchema> | GraphQLSchema;
|
79 | export declare type RawSourceOutput = {
|
80 | name: string;
|
81 | contextBuilder: null | ((initialContextValue?: any) => Promise<any>);
|
82 | schema: GraphQLSchema;
|
83 | executor?: Executor;
|
84 | subscriber?: Subscriber;
|
85 | transforms: MeshTransform[];
|
86 | contextVariables: (keyof any)[];
|
87 | handler: MeshHandler;
|
88 | batch: boolean;
|
89 | };
|
90 | export declare type GraphQLOperation = DocumentNode | string;
|
91 | export declare type ImportFn = (moduleId: string) => Promise<any>;
|