UNPKG

1.65 kBTypeScriptView Raw
1/// <reference types="node" />
2import { Pool, PoolConfig } from 'pg';
3import { IncomingMessage, ServerResponse } from 'http';
4import { GraphQLSchema } from 'graphql';
5import { EventEmitter } from 'events';
6import { PostGraphileOptions, HttpRequestHandler } from '../interfaces';
7import { ShutdownActions } from './shutdownActions';
8export interface PostgraphileSchemaBuilder<Request extends IncomingMessage = IncomingMessage, Response extends ServerResponse = ServerResponse> {
9 _emitter: EventEmitter;
10 getGraphQLSchema: () => Promise<GraphQLSchema>;
11 options: PostGraphileOptions<Request, Response>;
12}
13/**
14 * Creates a PostGraphile Http request handler by first introspecting the
15 * database to get a GraphQL schema, and then using that to create the Http
16 * request handler.
17 */
18export declare function getPostgraphileSchemaBuilder<Request extends IncomingMessage = IncomingMessage, Response extends ServerResponse = ServerResponse>(pgPool: Pool, schema: string | Array<string>, incomingOptions: PostGraphileOptions<Request, Response>, shutdownActions?: ShutdownActions): PostgraphileSchemaBuilder;
19export default function postgraphile<Request extends IncomingMessage = IncomingMessage, Response extends ServerResponse = ServerResponse>(poolOrConfig?: Pool | PoolConfig | string, schema?: string | Array<string>, options?: PostGraphileOptions<Request, Response>): HttpRequestHandler;
20export default function postgraphile<Request extends IncomingMessage = IncomingMessage, Response extends ServerResponse = ServerResponse>(poolOrConfig?: Pool | PoolConfig | string, options?: PostGraphileOptions<Request, Response>): HttpRequestHandler;