Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix and Export Extension and Playground Types #1360

Merged
merged 2 commits into from Jul 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 22 additions & 1 deletion packages/apollo-server-cloudflare/src/index.ts
@@ -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';
7 changes: 6 additions & 1 deletion packages/apollo-server-core/src/index.ts
Expand Up @@ -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';
Expand Down
11 changes: 10 additions & 1 deletion packages/apollo-server-core/src/playground.ts
Expand Up @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions packages/apollo-server-express/src/index.ts
@@ -1,6 +1,8 @@
export {
GraphQLUpload,
GraphQLOptions,
GraphQLExtension,
Config,
gql,
// Errors
ApolloError,
Expand All @@ -10,6 +12,10 @@ export {
AuthenticationError,
ForbiddenError,
UserInputError,
// playground
defaultPlaygroundOptions,
PlaygroundConfig,
PlaygroundRenderPageOptions,
} from 'apollo-server-core';

export * from 'graphql-tools';
Expand Down
6 changes: 6 additions & 0 deletions packages/apollo-server-hapi/src/index.ts
@@ -1,6 +1,8 @@
export {
GraphQLUpload,
GraphQLOptions,
GraphQLExtension,
Config,
gql,
// Errors
ApolloError,
Expand All @@ -10,6 +12,10 @@ export {
AuthenticationError,
ForbiddenError,
UserInputError,
// playground
defaultPlaygroundOptions,
PlaygroundConfig,
PlaygroundRenderPageOptions,
} from 'apollo-server-core';

export * from 'graphql-tools';
Expand Down
6 changes: 6 additions & 0 deletions packages/apollo-server-koa/src/index.ts
@@ -1,6 +1,8 @@
export {
GraphQLUpload,
GraphQLOptions,
GraphQLExtension,
Config,
gql,
// Errors
ApolloError,
Expand All @@ -10,6 +12,10 @@ export {
AuthenticationError,
ForbiddenError,
UserInputError,
// playground
defaultPlaygroundOptions,
PlaygroundConfig,
PlaygroundRenderPageOptions,
} from 'apollo-server-core';

export * from 'graphql-tools';
Expand Down
1 change: 0 additions & 1 deletion packages/apollo-server-lambda/src/ApolloServer.ts
@@ -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,
Expand Down
6 changes: 6 additions & 0 deletions packages/apollo-server-lambda/src/index.ts
@@ -1,6 +1,8 @@
export {
GraphQLUpload,
GraphQLOptions,
GraphQLExtension,
Config,
gql,
// Errors
ApolloError,
Expand All @@ -10,6 +12,10 @@ export {
AuthenticationError,
ForbiddenError,
UserInputError,
// playground
defaultPlaygroundOptions,
PlaygroundConfig,
PlaygroundRenderPageOptions,
} from 'apollo-server-core';

export * from 'graphql-tools';
Expand Down
6 changes: 6 additions & 0 deletions packages/apollo-server-micro/src/index.ts
@@ -1,6 +1,8 @@
export {
GraphQLUpload,
GraphQLOptions,
GraphQLExtension,
Config,
gql,
// Errors
ApolloError,
Expand All @@ -10,6 +12,10 @@ export {
AuthenticationError,
ForbiddenError,
UserInputError,
// playground
defaultPlaygroundOptions,
PlaygroundConfig,
PlaygroundRenderPageOptions,
} from 'apollo-server-core';

export * from 'graphql-tools';
Expand Down
13 changes: 12 additions & 1 deletion packages/apollo-server/src/exports.ts
Expand Up @@ -2,12 +2,23 @@ export * from 'graphql-tools';
export * from 'graphql-subscriptions';

export {
gql,
GraphQLUpload,
GraphQLOptions,
GraphQLExtension,
Config,
// Errors
ApolloError,
toApolloError,
SyntaxError,
ValidationError,
AuthenticationError,
ForbiddenError,
UserInputError,
gql,
// playground
defaultPlaygroundOptions,
PlaygroundConfig,
PlaygroundRenderPageOptions,
} from 'apollo-server-core';

export { CorsOptions } from 'apollo-server-express';
10 changes: 0 additions & 10 deletions packages/apollo-server/src/index.ts
Expand Up @@ -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 {
Expand Down