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
expose ApolloServerOptions interfaces #7311
expose ApolloServerOptions interfaces #7311
Conversation
@axe-me: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/ |
❌ Deploy Preview for apollo-server-docs failed.Built without sensitive environment variables
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 1cb8989:
|
Thanks for the PR @axe-me! Is it safe to assume the exported @glasser explicitly removed their exports before we landed v4 in this PR: #6551, motivation unclear (possibly just to limit the API surface area by default, then expose if needed later like now). I'd be interested to hear if he had any motivation to keep the types private. |
I think it was just "felt internal". If it's genuinely useful, it's probably fine to add back (with a quick double-check-that-we-like-the-names-enough-to-commit pass). |
@trevor-scheer @glasser Thanks for reviewing this PR. My use case is like this: export type CreateSubgraphServerOptions = Partial<ApolloServerOptions<AxeAppContext>> & {
serverType: 'subgraph'
// ...extra fields
};
export type CreateStnadaloneServerOptions = Partial<ApolloServerOptions<AxeAppContext>> & {
serverType: 'standalone'
// ....extra fields
};
export type CreateGatewayServerOptions = Partial<ApolloServerOptions<AxeAppContext>> & {
serverType: 'gateway'
// ...extra fields
};
export type CreateServerOptions = CreateSubgraphServerOptions | CreateStnadaloneServerOptions | CreateGatewayServerOptions; in my create server function I have code to narrowing types and create different types of apollo servers: switch (args.options.serverType) {
case 'subgraph':
server = await createSubgraphServer(args.options);
break;
case 'gateway':
server = await createGatewayServer(args.options);
break;
case 'standalone':
server = await createStandaloneServer(args.options);
break;
default:
throw new Error('Unknown server type');
} Note that right now I have to wrap around interface CreateGatewayServerOptions extends ApolloServerOptionsWithGateway<Context> {
serverType: 'gateway'
// ... extra fields
} |
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @apollo/server-integration-testsuite@4.3.1 ### Patch Changes - [#7285](#7285) [`35fa72bdd`](35fa72b) Thanks [@glasser](https://github.com/glasser)! - Adds an integration test verifying that Rover's introspection query works. This should not break any integration that passes other tests. - [#7276](#7276) [`15c912f4c`](15c912f) Thanks [@renovate](https://github.com/apps/renovate)! - Update graphql-http dependency - Updated dependencies \[[`ec28b4b33`](ec28b4b), [`322b5ebbc`](322b5eb), [`3b0ec8529`](3b0ec85)]: - @apollo/server@4.3.1 ## @apollo/server@4.3.1 ### Patch Changes - [#7313](#7313) [`ec28b4b33`](ec28b4b) Thanks [@vtipparam](https://github.com/vtipparam)! - Allow case insensitive lookup on headers. Use HeaderMap instead of plain Map for headers in expressMiddleware. - [#7311](#7311) [`322b5ebbc`](322b5eb) Thanks [@axe-me](https://github.com/axe-me)! - Export intermediate ApolloServerOptions\* types - [#7274](#7274) [`3b0ec8529`](3b0ec85) Thanks [@patrick91](https://github.com/patrick91)! - The subgraph spec has evolved in Federation v2 such that the type of `_Service.sdl` (formerly nullable) is now non-nullable. Apollo Server now detects both cases correctly in order to determine whether to: 1. install / enable the `ApolloServerPluginInlineTrace` plugin 2. throw on startup if `ApolloServerPluginSchemaReporting` should not be installed 3. warn when `ApolloServerPluginUsageReporting` is installed and configured with the `__onlyIfSchemaIsNotSubgraph` option Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Hi there,
I'm developing an in-house graphql framework wrapping around the apollo server. In the framework, I'm trying to create different types (gateway, subgraph or standalone) of apollo server based on some config. Thus the framework need access to all these interfaces.
Thanks for reviewing this PR.
Cheers.