-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into update-copyright
- Loading branch information
Showing
26 changed files
with
148 additions
and
331 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@keystone-next/admin-ui': major | ||
'@keystone-next/keystone': major | ||
--- | ||
|
||
Updated `createApolloServerMicro` to take system arguments rather than a `KeystoneConfig` object. |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export { createSystem } from './lib/createSystem'; | ||
export { createExpressServer } from './lib/createExpressServer'; | ||
export { initConfig } from './lib/initConfig'; | ||
export { createApolloServerMicro } from './lib/createApolloServerMicro'; | ||
export { createApolloServerMicro } from './lib/createApolloServer'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import type { IncomingMessage, ServerResponse } from 'http'; | ||
import { GraphQLSchema } from 'graphql'; | ||
import { ApolloServer as ApolloServerMicro } from 'apollo-server-micro'; | ||
import { ApolloServer as ApolloServerExpress } from 'apollo-server-express'; | ||
|
||
// @ts-ignore | ||
import { formatError } from '@keystone-next/keystone-legacy/lib/Keystone/format-error'; | ||
import type { CreateContext, SessionStrategy } from '@keystone-next/types'; | ||
import { createSessionContext } from '../session'; | ||
|
||
export const createApolloServerMicro = ({ | ||
graphQLSchema, | ||
createContext, | ||
sessionStrategy, | ||
connectionPromise, | ||
}: { | ||
graphQLSchema: GraphQLSchema; | ||
createContext: CreateContext; | ||
sessionStrategy?: SessionStrategy<any>; | ||
connectionPromise: Promise<any>; | ||
}) => { | ||
return new ApolloServerMicro({ | ||
uploads: false, | ||
schema: graphQLSchema, | ||
playground: { settings: { 'request.credentials': 'same-origin' } }, | ||
formatError, | ||
context: async ({ req, res }: { req: IncomingMessage; res: ServerResponse }) => { | ||
await connectionPromise; | ||
return createContext({ | ||
sessionContext: sessionStrategy | ||
? await createSessionContext(sessionStrategy, req, res, createContext) | ||
: undefined, | ||
req, | ||
}); | ||
}, | ||
}); | ||
}; | ||
|
||
export const createApolloServerExpress = ({ | ||
graphQLSchema, | ||
createContext, | ||
sessionStrategy, | ||
}: { | ||
graphQLSchema: GraphQLSchema; | ||
createContext: CreateContext; | ||
sessionStrategy?: SessionStrategy<any>; | ||
}) => { | ||
return new ApolloServerExpress({ | ||
uploads: false, | ||
schema: graphQLSchema, | ||
// FIXME: allow the dev to control where/when they get a playground | ||
playground: { settings: { 'request.credentials': 'same-origin' } }, | ||
formatError, // TODO: this needs to be discussed | ||
context: async ({ req, res }: { req: IncomingMessage; res: ServerResponse }) => | ||
createContext({ | ||
sessionContext: sessionStrategy | ||
? await createSessionContext(sessionStrategy, req, res, createContext) | ||
: undefined, | ||
req, | ||
}), | ||
// FIXME: support for apollo studio tracing | ||
// ...(process.env.ENGINE_API_KEY || process.env.APOLLO_KEY | ||
// ? { tracing: true } | ||
// : { | ||
// engine: false, | ||
// // Only enable tracing in dev mode so we can get local debug info, but | ||
// // don't bother returning that info on prod when the `engine` is | ||
// // disabled. | ||
// tracing: dev, | ||
// }), | ||
// FIXME: Support for generic custom apollo configuration | ||
// ...apolloConfig, | ||
}); | ||
// FIXME: Support custom API path via config.graphql.path. | ||
// Note: Core keystone uses '/admin/api' as the default. | ||
// FIXME: Support for file handling configuration | ||
// maxFileSize: 200 * 1024 * 1024, | ||
// maxFiles: 5, | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.