@graphql-yoga/plugin-apq
Version:
APQ plugin for GraphQL Yoga.
21 lines (20 loc) • 734 B
TypeScript
import { Plugin, PromiseOrValue } from 'graphql-yoga';
export declare function hashSHA256(str: string): Promise<string>;
export interface APQStoreOptions {
max?: number;
ttl?: number;
}
export declare function createInMemoryAPQStore(options?: APQStoreOptions): APQStore;
export interface APQOptions {
store?: APQStore;
hash?: (str: string) => PromiseOrValue<string>;
}
export interface APQStore {
get(key: string): PromiseOrValue<string | null | undefined>;
set(key: string, query: string): PromiseOrValue<any>;
}
export interface APQExtension {
version: 1;
sha256Hash: string;
}
export declare function useAPQ<TPluginContext extends Record<string, any>>(options?: APQOptions): Plugin<TPluginContext>;