1 | import { FieldNode, GraphQLSchema } from 'graphql';
|
2 | import DataLoader from 'dataloader';
|
3 | import { IDelegateToSchemaOptions, SubschemaConfig } from '@graphql-tools/delegate';
|
4 | export declare type DataLoaderCache<K = any, V = any, C = K> = WeakMap<ReadonlyArray<FieldNode>, WeakMap<GraphQLSchema | SubschemaConfig, DataLoader<K, V, C>>>;
|
5 | export declare type BatchDelegateFn<TContext = Record<string, any>, K = any> = (batchDelegateOptions: BatchDelegateOptions<TContext, K>) => any;
|
6 | export declare type BatchDelegateOptionsFn<TContext = Record<string, any>, K = any> = (batchDelegateOptions: BatchDelegateOptions<TContext, K>) => IDelegateToSchemaOptions<TContext>;
|
7 | export interface BatchDelegateOptions<TContext = Record<string, any>, K = any, V = any, C = K> extends Omit<IDelegateToSchemaOptions<TContext>, 'args'> {
|
8 | dataLoaderOptions?: DataLoader.Options<K, V, C>;
|
9 | key: K;
|
10 | argsFromKeys?: (keys: ReadonlyArray<K>) => Record<string, any>;
|
11 | valuesFromResults?: (results: any, keys: ReadonlyArray<K>) => Array<V>;
|
12 | lazyOptionsFn?: BatchDelegateOptionsFn;
|
13 | }
|
14 | export interface CreateBatchDelegateFnOptions<TContext = Record<string, any>, K = any, V = any, C = K> extends Partial<Omit<IDelegateToSchemaOptions<TContext>, 'args' | 'info'>> {
|
15 | dataLoaderOptions?: DataLoader.Options<K, V, C>;
|
16 | argsFromKeys?: (keys: ReadonlyArray<K>) => Record<string, any>;
|
17 | valuesFromResults?: (results: any, keys: ReadonlyArray<K>) => Array<V>;
|
18 | lazyOptionsFn?: (batchDelegateOptions: BatchDelegateOptions<TContext, K>) => IDelegateToSchemaOptions<TContext>;
|
19 | }
|