Fix and Export Extension and Playground Types (#1360)

* export playground types

* make playground configuration recursively partial
This commit is contained in:
Evans Hauser 2018-07-16 15:49:20 -07:00 committed by GitHub
parent 8a588929d4
commit fa6c973f36
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 80 additions and 15 deletions

View file

@ -1,2 +1,23 @@
export * from 'graphql-tools';
export { ApolloServer } from './ApolloServer';
export { gql } from 'apollo-server-core';
export {
GraphQLUpload,
GraphQLOptions,
GraphQLExtension,
Config,
gql,
// Errors
ApolloError,
toApolloError,
SyntaxError,
ValidationError,
AuthenticationError,
ForbiddenError,
UserInputError,
// playground
defaultPlaygroundOptions,
PlaygroundConfig,
PlaygroundRenderPageOptions,
} from 'apollo-server-core';

View file

@ -22,7 +22,12 @@ export {
export { convertNodeHttpToRequest } from './nodeHttpToRequest';
export { createPlaygroundOptions } from './playground';
export {
createPlaygroundOptions,
PlaygroundConfig,
defaultPlaygroundOptions,
PlaygroundRenderPageOptions,
} from './playground';
// ApolloServer Base class
export { ApolloServerBase } from './ApolloServer';

View file

@ -11,7 +11,16 @@ export {
// by the integration subclasses
const playgroundVersion = '1.7.2';
export type PlaygroundConfig = Partial<PlaygroundRenderPageOptions> | boolean;
// https://stackoverflow.com/a/51365037
type RecursivePartial<T> = {
[P in keyof T]?: T[P] extends (infer U)[]
? RecursivePartial<U>[]
: T[P] extends object ? RecursivePartial<T[P]> : T[P]
};
export type PlaygroundConfig =
| RecursivePartial<PlaygroundRenderPageOptions>
| boolean;
export const defaultPlaygroundOptions = {
version: playgroundVersion,

View file

@ -1,6 +1,8 @@
export {
GraphQLUpload,
GraphQLOptions,
GraphQLExtension,
Config,
gql,
// Errors
ApolloError,
@ -10,6 +12,10 @@ export {
AuthenticationError,
ForbiddenError,
UserInputError,
// playground
defaultPlaygroundOptions,
PlaygroundConfig,
PlaygroundRenderPageOptions,
} from 'apollo-server-core';
export * from 'graphql-tools';

View file

@ -1,6 +1,8 @@
export {
GraphQLUpload,
GraphQLOptions,
GraphQLExtension,
Config,
gql,
// Errors
ApolloError,
@ -10,6 +12,10 @@ export {
AuthenticationError,
ForbiddenError,
UserInputError,
// playground
defaultPlaygroundOptions,
PlaygroundConfig,
PlaygroundRenderPageOptions,
} from 'apollo-server-core';
export * from 'graphql-tools';

View file

@ -1,6 +1,8 @@
export {
GraphQLUpload,
GraphQLOptions,
GraphQLExtension,
Config,
gql,
// Errors
ApolloError,
@ -10,6 +12,10 @@ export {
AuthenticationError,
ForbiddenError,
UserInputError,
// playground
defaultPlaygroundOptions,
PlaygroundConfig,
PlaygroundRenderPageOptions,
} from 'apollo-server-core';
export * from 'graphql-tools';

View file

@ -1,6 +1,5 @@
import * as lambda from 'aws-lambda';
import { ApolloServerBase } from 'apollo-server-core';
export { GraphQLOptions, GraphQLExtension } from 'apollo-server-core';
import { GraphQLOptions, Config } from 'apollo-server-core';
import {
renderPlaygroundPage,

View file

@ -1,6 +1,8 @@
export {
GraphQLUpload,
GraphQLOptions,
GraphQLExtension,
Config,
gql,
// Errors
ApolloError,
@ -10,6 +12,10 @@ export {
AuthenticationError,
ForbiddenError,
UserInputError,
// playground
defaultPlaygroundOptions,
PlaygroundConfig,
PlaygroundRenderPageOptions,
} from 'apollo-server-core';
export * from 'graphql-tools';

View file

@ -1,6 +1,8 @@
export {
GraphQLUpload,
GraphQLOptions,
GraphQLExtension,
Config,
gql,
// Errors
ApolloError,
@ -10,6 +12,10 @@ export {
AuthenticationError,
ForbiddenError,
UserInputError,
// playground
defaultPlaygroundOptions,
PlaygroundConfig,
PlaygroundRenderPageOptions,
} from 'apollo-server-core';
export * from 'graphql-tools';

View file

@ -2,6 +2,12 @@ export * from 'graphql-tools';
export * from 'graphql-subscriptions';
export {
gql,
GraphQLUpload,
GraphQLOptions,
GraphQLExtension,
Config,
// Errors
ApolloError,
toApolloError,
SyntaxError,
@ -9,5 +15,10 @@ export {
AuthenticationError,
ForbiddenError,
UserInputError,
gql,
// playground
defaultPlaygroundOptions,
PlaygroundConfig,
PlaygroundRenderPageOptions,
} from 'apollo-server-core';
export { CorsOptions } from 'apollo-server-express';

View file

@ -11,16 +11,6 @@ import {
} from 'apollo-server-express';
import { Config } from 'apollo-server-core';
export {
GraphQLUpload,
GraphQLOptions,
GraphQLExtension,
gql,
Config,
} from 'apollo-server-core';
export { CorsOptions } from 'apollo-server-express';
export * from './exports';
export interface ServerInfo {