From 102b78655f73cbb2c1f4d16f1b26f8ec380ba381 Mon Sep 17 00:00:00 2001 From: Benjie Gillam Date: Thu, 29 Nov 2018 16:43:01 +0000 Subject: [PATCH] fix(types): add missing hook types (#932) --- src/postgraphile/pluginHook.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/postgraphile/pluginHook.ts b/src/postgraphile/pluginHook.ts index 185180569..9c44d6722 100644 --- a/src/postgraphile/pluginHook.ts +++ b/src/postgraphile/pluginHook.ts @@ -1,5 +1,5 @@ import { AddFlagFn } from './cli'; -import { Server } from 'http'; +import { Server, IncomingMessage } from 'http'; import { HttpRequestHandler, PostGraphileOptions } from '../interfaces'; import { WithPostGraphileContextFn } from './withPostGraphileContext'; import { version } from '../../package.json'; @@ -8,7 +8,10 @@ import * as graphql from 'graphql'; export type HookFn = (arg: T, context: {}) => T; export type PluginHookFn = (hookName: string, argument: T, context?: {}) => T; export interface PostGraphilePlugin { + init?: HookFn; + pluginHook?: HookFn; + 'cli:flags:add:standard'?: HookFn; 'cli:flags:add:schema'?: HookFn; 'cli:flags:add:errorHandling'?: HookFn; @@ -19,11 +22,18 @@ export interface PostGraphilePlugin { 'cli:flags:add'?: HookFn; 'cli:flags:add:deprecated'?: HookFn; 'cli:flags:add:workarounds'?: HookFn; - + 'cli:library:options'?: HookFn<{}>; 'cli:server:middleware'?: HookFn; 'cli:server:created'?: HookFn; + 'cli:greeting'?: HookFn>; 'postgraphile:options'?: HookFn; + 'postgraphile:validationRules:static'?: HookFn>; + 'postgraphile:http:handler'?: HookFn; + 'postgraphile:httpParamsList'?: HookFn>; + 'postgraphile:validationRules'?: HookFn>; // AVOID THIS where possible; use 'postgraphile:validationRules:static' instead. + 'postgraphile:middleware'?: HookFn; + withPostGraphileContext?: HookFn; } type HookName = keyof PostGraphilePlugin;