Skip to content

Commit fa6c973

Browse files
authored
Fix and Export Extension and Playground Types (#1360)
* export playground types * make playground configuration recursively partial
1 parent 8a58892 commit fa6c973

File tree

11 files changed

+80
-15
lines changed

11 files changed

+80
-15
lines changed
Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,23 @@
1+
export * from 'graphql-tools';
2+
13
export { ApolloServer } from './ApolloServer';
2-
export { gql } from 'apollo-server-core';
4+
5+
export {
6+
GraphQLUpload,
7+
GraphQLOptions,
8+
GraphQLExtension,
9+
Config,
10+
gql,
11+
// Errors
12+
ApolloError,
13+
toApolloError,
14+
SyntaxError,
15+
ValidationError,
16+
AuthenticationError,
17+
ForbiddenError,
18+
UserInputError,
19+
// playground
20+
defaultPlaygroundOptions,
21+
PlaygroundConfig,
22+
PlaygroundRenderPageOptions,
23+
} from 'apollo-server-core';

packages/apollo-server-core/src/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ export {
2222

2323
export { convertNodeHttpToRequest } from './nodeHttpToRequest';
2424

25-
export { createPlaygroundOptions } from './playground';
25+
export {
26+
createPlaygroundOptions,
27+
PlaygroundConfig,
28+
defaultPlaygroundOptions,
29+
PlaygroundRenderPageOptions,
30+
} from './playground';
2631

2732
// ApolloServer Base class
2833
export { ApolloServerBase } from './ApolloServer';

packages/apollo-server-core/src/playground.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,16 @@ export {
1111
// by the integration subclasses
1212
const playgroundVersion = '1.7.2';
1313

14-
export type PlaygroundConfig = Partial<PlaygroundRenderPageOptions> | boolean;
14+
// https://stackoverflow.com/a/51365037
15+
type RecursivePartial<T> = {
16+
[P in keyof T]?: T[P] extends (infer U)[]
17+
? RecursivePartial<U>[]
18+
: T[P] extends object ? RecursivePartial<T[P]> : T[P]
19+
};
20+
21+
export type PlaygroundConfig =
22+
| RecursivePartial<PlaygroundRenderPageOptions>
23+
| boolean;
1524

1625
export const defaultPlaygroundOptions = {
1726
version: playgroundVersion,

packages/apollo-server-express/src/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
export {
22
GraphQLUpload,
33
GraphQLOptions,
4+
GraphQLExtension,
5+
Config,
46
gql,
57
// Errors
68
ApolloError,
@@ -10,6 +12,10 @@ export {
1012
AuthenticationError,
1113
ForbiddenError,
1214
UserInputError,
15+
// playground
16+
defaultPlaygroundOptions,
17+
PlaygroundConfig,
18+
PlaygroundRenderPageOptions,
1319
} from 'apollo-server-core';
1420

1521
export * from 'graphql-tools';

packages/apollo-server-hapi/src/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
export {
22
GraphQLUpload,
33
GraphQLOptions,
4+
GraphQLExtension,
5+
Config,
46
gql,
57
// Errors
68
ApolloError,
@@ -10,6 +12,10 @@ export {
1012
AuthenticationError,
1113
ForbiddenError,
1214
UserInputError,
15+
// playground
16+
defaultPlaygroundOptions,
17+
PlaygroundConfig,
18+
PlaygroundRenderPageOptions,
1319
} from 'apollo-server-core';
1420

1521
export * from 'graphql-tools';

packages/apollo-server-koa/src/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
export {
22
GraphQLUpload,
33
GraphQLOptions,
4+
GraphQLExtension,
5+
Config,
46
gql,
57
// Errors
68
ApolloError,
@@ -10,6 +12,10 @@ export {
1012
AuthenticationError,
1113
ForbiddenError,
1214
UserInputError,
15+
// playground
16+
defaultPlaygroundOptions,
17+
PlaygroundConfig,
18+
PlaygroundRenderPageOptions,
1319
} from 'apollo-server-core';
1420

1521
export * from 'graphql-tools';

packages/apollo-server-lambda/src/ApolloServer.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as lambda from 'aws-lambda';
22
import { ApolloServerBase } from 'apollo-server-core';
3-
export { GraphQLOptions, GraphQLExtension } from 'apollo-server-core';
43
import { GraphQLOptions, Config } from 'apollo-server-core';
54
import {
65
renderPlaygroundPage,

packages/apollo-server-lambda/src/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
export {
22
GraphQLUpload,
33
GraphQLOptions,
4+
GraphQLExtension,
5+
Config,
46
gql,
57
// Errors
68
ApolloError,
@@ -10,6 +12,10 @@ export {
1012
AuthenticationError,
1113
ForbiddenError,
1214
UserInputError,
15+
// playground
16+
defaultPlaygroundOptions,
17+
PlaygroundConfig,
18+
PlaygroundRenderPageOptions,
1319
} from 'apollo-server-core';
1420

1521
export * from 'graphql-tools';

packages/apollo-server-micro/src/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
export {
22
GraphQLUpload,
33
GraphQLOptions,
4+
GraphQLExtension,
5+
Config,
46
gql,
57
// Errors
68
ApolloError,
@@ -10,6 +12,10 @@ export {
1012
AuthenticationError,
1113
ForbiddenError,
1214
UserInputError,
15+
// playground
16+
defaultPlaygroundOptions,
17+
PlaygroundConfig,
18+
PlaygroundRenderPageOptions,
1319
} from 'apollo-server-core';
1420

1521
export * from 'graphql-tools';

packages/apollo-server/src/exports.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,23 @@ export * from 'graphql-tools';
22
export * from 'graphql-subscriptions';
33

44
export {
5+
gql,
6+
GraphQLUpload,
7+
GraphQLOptions,
8+
GraphQLExtension,
9+
Config,
10+
// Errors
511
ApolloError,
612
toApolloError,
713
SyntaxError,
814
ValidationError,
915
AuthenticationError,
1016
ForbiddenError,
1117
UserInputError,
12-
gql,
18+
// playground
19+
defaultPlaygroundOptions,
20+
PlaygroundConfig,
21+
PlaygroundRenderPageOptions,
1322
} from 'apollo-server-core';
23+
24+
export { CorsOptions } from 'apollo-server-express';

packages/apollo-server/src/index.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,6 @@ import {
1111
} from 'apollo-server-express';
1212
import { Config } from 'apollo-server-core';
1313

14-
export {
15-
GraphQLUpload,
16-
GraphQLOptions,
17-
GraphQLExtension,
18-
gql,
19-
Config,
20-
} from 'apollo-server-core';
21-
22-
export { CorsOptions } from 'apollo-server-express';
23-
2414
export * from './exports';
2515

2616
export interface ServerInfo {

0 commit comments

Comments
 (0)