Skip to content

Commit

Permalink
fix(types): export interfaces (#841)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjie authored Aug 23, 2018
1 parent 40a151b commit d64ec06
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {
} from './postgraphile';
import { makePluginHook, PostGraphilePlugin } from './postgraphile/pluginHook';

export * from './interfaces';

export default postgraphile;

export {
Expand Down
10 changes: 0 additions & 10 deletions src/interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* tslint:disable:no-any */
import { EventEmitter } from 'events';
import { GraphQLError, GraphQLSchema, SourceLocation } from 'graphql';
import { IncomingMessage, ServerResponse } from 'http';
import { PluginHookFn } from './postgraphile/pluginHook';
Expand Down Expand Up @@ -227,15 +226,6 @@ export type GraphQLErrorExtended = GraphQLError & {
code: string;
};

// Used by `createPostGraphileHttpRequestHandler`
export interface CreateRequestHandlerOptions extends PostGraphileOptions {
// The actual GraphQL schema we will use.
getGqlSchema: () => Promise<GraphQLSchema>;
// A Postgres client pool we use to connect Postgres clients.
pgPool: Pool;
_emitter: EventEmitter;
}

/**
* A request handler for one of many different `http` frameworks.
*/
Expand Down
13 changes: 12 additions & 1 deletion src/postgraphile/http/createPostGraphileHttpRequestHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { extendedFormatError } from '../extendedFormatError';
import { IncomingMessage, ServerResponse } from 'http';
import { isKoaApp, middleware as koaMiddleware } from './koaMiddleware';
import { pluginHookFromOptions } from '../pluginHook';
import { HttpRequestHandler, CreateRequestHandlerOptions, mixed } from '../../interfaces';
import { HttpRequestHandler, PostGraphileOptions, mixed } from '../../interfaces';
import setupServerSentEvents from './setupServerSentEvents';
import withPostGraphileContext from '../withPostGraphileContext';
import { Context as KoaContext } from 'koa';
Expand All @@ -31,6 +31,17 @@ import bodyParser = require('body-parser');
import sendFile = require('send');
import LRU = require('lru-cache');
import crypto = require('crypto');
import { Pool } from 'pg';
import { EventEmitter } from 'events';

// Used by `createPostGraphileHttpRequestHandler`
export interface CreateRequestHandlerOptions extends PostGraphileOptions {
// The actual GraphQL schema we will use.
getGqlSchema: () => Promise<GraphQLSchema>;
// A Postgres client pool we use to connect Postgres clients.
pgPool: Pool;
_emitter: EventEmitter;
}

const calculateQueryHash = (queryString: string): string =>
crypto
Expand Down
2 changes: 1 addition & 1 deletion src/postgraphile/http/setupServerSentEvents.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* tslint:disable:no-any */
import { PassThrough } from 'stream';
import { IncomingMessage, ServerResponse } from 'http';
import { CreateRequestHandlerOptions } from '../../interfaces';
import { CreateRequestHandlerOptions } from './createPostGraphileHttpRequestHandler';

export default function setupServerSentEvents(
req: IncomingMessage,
Expand Down

0 comments on commit d64ec06

Please sign in to comment.