import { Duplex } from 'stream'; import { DocumentNode } from "graphql"; import { IResolvers } from "@graphql-tools/utils"; import { MaybePromise } from "@httptoolkit/util"; export interface AdminPlugin { // Called when a /start request is received that references this plugin start: (options: StartParams) => MaybePromise; stop: () => MaybePromise; reset?: () => MaybePromise; enableDebug?: () => void, schema: DocumentNode | string; buildResolvers: (stream: Duplex, ruleParameters: { [key: string]: any }) => IResolvers } export type AdminPluginConstructor = { new(): Plugin }; export type PluginStartParams = Plugin extends AdminPlugin ? StartParams : never; export type PluginStartDefaults }> = { [key in keyof Plugins]?: Partial> }; export type PluginClientResponse = Plugin extends AdminPlugin ? ClientResponse : never; export type PluginConstructorMap = { [key in keyof Plugins]: AdminPluginConstructor }; export type PluginStartParamsMap = { [key in keyof Plugins]: PluginStartParams }; export type PluginClientResponsesMap = { [key in keyof Plugins]: PluginClientResponse };