diff --git a/.changeset/big-kiwis-explain.md b/.changeset/big-kiwis-explain.md deleted file mode 100644 index ba4122e27d6..00000000000 --- a/.changeset/big-kiwis-explain.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@apollo/server': patch ---- - -Update executeOperation second parameter to be an optional options object which includes an optional `contextValue`. diff --git a/.changeset/blue-bottles-jump.md b/.changeset/blue-bottles-jump.md deleted file mode 100644 index a845151cc84..00000000000 --- a/.changeset/blue-bottles-jump.md +++ /dev/null @@ -1,2 +0,0 @@ ---- ---- diff --git a/.changeset/chatty-baboons-search.md b/.changeset/chatty-baboons-search.md deleted file mode 100644 index e6cb61d2362..00000000000 --- a/.changeset/chatty-baboons-search.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@apollo/server": patch ---- - -Upgrade @apollo/server-gateway-interface to have laxer definition of overallCachePolicy. diff --git a/.changeset/chilled-cows-drum.md b/.changeset/chilled-cows-drum.md deleted file mode 100644 index fda61def9bd..00000000000 --- a/.changeset/chilled-cows-drum.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@apollo/server-integration-testsuite': patch -'@apollo/server-plugin-response-cache': patch -'@apollo/server': patch ---- - -Experimental support for incremental delivery (`@defer`/`@stream`) when combined with a prerelease of `graphql-js`. diff --git a/.changeset/eleven-drinks-mix.md b/.changeset/eleven-drinks-mix.md deleted file mode 100644 index a845151cc84..00000000000 --- a/.changeset/eleven-drinks-mix.md +++ /dev/null @@ -1,2 +0,0 @@ ---- ---- diff --git a/.changeset/eleven-needles-collect.md b/.changeset/eleven-needles-collect.md deleted file mode 100644 index f368c64bed2..00000000000 --- a/.changeset/eleven-needles-collect.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -"@apollo/server-integration-testsuite": patch -"@apollo/server": patch ---- - -Support Gateway. Remove executor constructor option. diff --git a/.changeset/empty-peaches-heal.md b/.changeset/empty-peaches-heal.md deleted file mode 100644 index a845151cc84..00000000000 --- a/.changeset/empty-peaches-heal.md +++ /dev/null @@ -1,2 +0,0 @@ ---- ---- diff --git a/.changeset/famous-parents-argue.md b/.changeset/famous-parents-argue.md deleted file mode 100644 index 0fb34c93a9a..00000000000 --- a/.changeset/famous-parents-argue.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"@apollo/server-integration-testsuite": patch -"@apollo/server-plugin-response-cache": patch -"@apollo/server": patch ---- - -Rename response.http.statusCode back to status like it was in AS3. diff --git a/.changeset/fifty-peaches-bathe.md b/.changeset/fifty-peaches-bathe.md deleted file mode 100644 index a845151cc84..00000000000 --- a/.changeset/fifty-peaches-bathe.md +++ /dev/null @@ -1,2 +0,0 @@ ---- ---- diff --git a/.changeset/forty-beds-cough.md b/.changeset/forty-beds-cough.md deleted file mode 100644 index eb6502e6c1f..00000000000 --- a/.changeset/forty-beds-cough.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@apollo/server-integration-testsuite': patch -'@apollo/server': patch ---- - -The cache control plugin sets `cache-control: no-store` for uncacheable responses. Pass `calculateHttpHeaders: 'if-cacheable'` to the cache control plugin to restore AS3 behavior. diff --git a/.changeset/gorgeous-penguins-jog.md b/.changeset/gorgeous-penguins-jog.md deleted file mode 100644 index a845151cc84..00000000000 --- a/.changeset/gorgeous-penguins-jog.md +++ /dev/null @@ -1,2 +0,0 @@ ---- ---- diff --git a/.changeset/healthy-deers-search.md b/.changeset/healthy-deers-search.md deleted file mode 100644 index f95f1484229..00000000000 --- a/.changeset/healthy-deers-search.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@apollo/server': patch ---- - -`HTTPGraphQLRequest` now uses a specific `HeaderMap` class which we export instead of allowing a standard `Map`. The `HeaderMap` downcases all incoming keys, as header names are not case-sensitive. diff --git a/.changeset/healthy-glasses-reflect.md b/.changeset/healthy-glasses-reflect.md deleted file mode 100644 index 42e2b19c50b..00000000000 --- a/.changeset/healthy-glasses-reflect.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@apollo/server": patch ---- - -New usage reporting option `sendTraces: false` to only send usage reports as aggregated statistics, not per-request traces. diff --git a/.changeset/hip-cheetahs-fail.md b/.changeset/hip-cheetahs-fail.md deleted file mode 100644 index ea013f8fd08..00000000000 --- a/.changeset/hip-cheetahs-fail.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@apollo/server": patch ---- - -Port #6709 from AS3 (improve an error message) diff --git a/.changeset/late-numbers-pull.md b/.changeset/late-numbers-pull.md deleted file mode 100644 index bac4a1b7bdc..00000000000 --- a/.changeset/late-numbers-pull.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@apollo/server': patch ---- - -Update `validationRules` typing for correctness. This is sort of a breaking change for TS users in that the types were more permissive than they should have been. All `validationRules` list items should conform to the `graphql-js` `ValidationRule` type. diff --git a/.changeset/lazy-emus-hunt.md b/.changeset/lazy-emus-hunt.md deleted file mode 100644 index 1a1395f5149..00000000000 --- a/.changeset/lazy-emus-hunt.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@apollo/server-integration-testsuite": patch ---- - -Relax error-handling expectations to work better with Fastify diff --git a/.changeset/light-kings-glow.md b/.changeset/light-kings-glow.md deleted file mode 100644 index a845151cc84..00000000000 --- a/.changeset/light-kings-glow.md +++ /dev/null @@ -1,2 +0,0 @@ ---- ---- diff --git a/.changeset/many-plums-smile.md b/.changeset/many-plums-smile.md deleted file mode 100644 index 1e4e794f669..00000000000 --- a/.changeset/many-plums-smile.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@apollo/server": patch ---- - -Remove Apollo-internal `internal_includeTracesContributingToStats`. This should not have been used other than inside Apollo's own servers. diff --git a/.changeset/neat-buckets-marry.md b/.changeset/neat-buckets-marry.md deleted file mode 100644 index a845151cc84..00000000000 --- a/.changeset/neat-buckets-marry.md +++ /dev/null @@ -1,2 +0,0 @@ ---- ---- diff --git a/.changeset/ninety-panthers-accept.md b/.changeset/ninety-panthers-accept.md deleted file mode 100644 index 580625636c5..00000000000 --- a/.changeset/ninety-panthers-accept.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"@apollo/server-plugin-landing-page-graphql-playground": major -"@apollo/server-integration-testsuite": patch -"@apollo/server": patch ---- - -Move ApolloServerPluginGraphQLPlayground into its own package. diff --git a/.changeset/ninety-tips-unite.md b/.changeset/ninety-tips-unite.md deleted file mode 100644 index 244bf44d7d1..00000000000 --- a/.changeset/ninety-tips-unite.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@apollo/server-integration-testsuite": patch ---- - -Added unit tests to cover `unmodified` and `masked` error reporting options diff --git a/.changeset/old-insects-smash.md b/.changeset/old-insects-smash.md deleted file mode 100644 index a12af3c9172..00000000000 --- a/.changeset/old-insects-smash.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@apollo/server": patch ---- - -`parseOptions` is now only used for parsing operations, not for schemas too. Its TS type now only includes options recognized by `graphql-js` itself. diff --git a/.changeset/old-papayas-switch.md b/.changeset/old-papayas-switch.md deleted file mode 100644 index ce0ab68af3c..00000000000 --- a/.changeset/old-papayas-switch.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@apollo/server": patch ---- - -Use extensions for all imports to accommodate TS users using moduleResolution: "nodenext" diff --git a/.changeset/pink-eggs-draw.md b/.changeset/pink-eggs-draw.md deleted file mode 100644 index 706e0dd125f..00000000000 --- a/.changeset/pink-eggs-draw.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"@apollo/server-integration-testsuite": patch -"@apollo/server-plugin-response-cache": patch -"@apollo/server": patch ---- - -Get cache-control types from @apollo/cache-control-types; no more `declare module` for info.cacheControl diff --git a/.changeset/pre.json b/.changeset/pre.json deleted file mode 100644 index 200fbc910b2..00000000000 --- a/.changeset/pre.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "mode": "exit", - "tag": "rc", - "initialVersions": { - "@apollo/server-integration-testsuite": "3.6.7", - "@apollo/server-plugin-response-cache": "3.6.7", - "@apollo/server": "3.6.7", - "@apollo/usage-reporting-protobuf": "3.3.1", - "@apollo/server-plugin-landing-page-graphql-playground": "3.0.0" - }, - "changesets": [ - "big-kiwis-explain", - "blue-bottles-jump", - "chatty-baboons-search", - "chilled-cows-drum", - "eleven-drinks-mix", - "eleven-needles-collect", - "empty-peaches-heal", - "famous-parents-argue", - "fifty-peaches-bathe", - "forty-beds-cough", - "gorgeous-penguins-jog", - "healthy-deers-search", - "healthy-glasses-reflect", - "hip-cheetahs-fail", - "late-numbers-pull", - "lazy-emus-hunt", - "light-kings-glow", - "many-plums-smile", - "neat-buckets-marry", - "ninety-panthers-accept", - "ninety-tips-unite", - "old-insects-smash", - "old-papayas-switch", - "pink-eggs-draw", - "quick-beans-applaud", - "real-games-dance", - "seven-avocados-compare", - "shaggy-badgers-act", - "shaggy-schools-sparkle", - "shiny-files-serve", - "short-lies-kneel", - "silly-icons-taste", - "six-pianos-refuse", - "sixty-flowers-press", - "small-cycles-hammer", - "small-suits-compare", - "spicy-lions-deliver", - "spicy-pugs-deliver", - "spotty-days-eat", - "stale-goats-serve", - "stale-sheep-search", - "tasty-elephants-give", - "tender-frogs-judge", - "thirty-donkeys-sing", - "tricky-pillows-wash", - "twenty-cooks-repair", - "violet-mayflies-help", - "wet-kiwis-play", - "wet-rats-shake", - "witty-moles-fail", - "witty-squids-vanish", - "witty-toes-grin", - "yellow-actors-do" - ] -} diff --git a/.changeset/quick-beans-applaud.md b/.changeset/quick-beans-applaud.md deleted file mode 100644 index 8a47fecbcdf..00000000000 --- a/.changeset/quick-beans-applaud.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@apollo/server-integration-testsuite': patch ---- - -Relax message requirement for malformed JSON POST to allow default 'Bad Request' -response. diff --git a/.changeset/real-games-dance.md b/.changeset/real-games-dance.md deleted file mode 100644 index 073d877d0e7..00000000000 --- a/.changeset/real-games-dance.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@apollo/server-integration-testsuite': patch -'@apollo/server-plugin-response-cache': patch -'@apollo/server': patch ---- - -Require graphql@16.6 as a peer dependency. diff --git a/.changeset/seven-avocados-compare.md b/.changeset/seven-avocados-compare.md deleted file mode 100644 index 9064a2dc415..00000000000 --- a/.changeset/seven-avocados-compare.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@apollo/server-integration-testsuite': patch ---- - -Test the behavior of didResolveOperation hooks throwing. diff --git a/.changeset/shaggy-badgers-act.md b/.changeset/shaggy-badgers-act.md deleted file mode 100644 index a845151cc84..00000000000 --- a/.changeset/shaggy-badgers-act.md +++ /dev/null @@ -1,2 +0,0 @@ ---- ---- diff --git a/.changeset/shaggy-schools-sparkle.md b/.changeset/shaggy-schools-sparkle.md deleted file mode 100644 index f52aeca1606..00000000000 --- a/.changeset/shaggy-schools-sparkle.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@apollo/server': patch ---- - -Fixed usage reporting plugin log message diff --git a/.changeset/shiny-files-serve.md b/.changeset/shiny-files-serve.md deleted file mode 100644 index a845151cc84..00000000000 --- a/.changeset/shiny-files-serve.md +++ /dev/null @@ -1,2 +0,0 @@ ---- ---- diff --git a/.changeset/short-lies-kneel.md b/.changeset/short-lies-kneel.md deleted file mode 100644 index fee1d668904..00000000000 --- a/.changeset/short-lies-kneel.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@apollo/server": patch ---- - -The usage reporting option `debugPrintReports` now displays reports via `logger.info` rather than `logger.warn`. diff --git a/.changeset/silly-icons-taste.md b/.changeset/silly-icons-taste.md deleted file mode 100644 index 98ce9aeb810..00000000000 --- a/.changeset/silly-icons-taste.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -"@apollo/server-integration-testsuite": patch -"@apollo/server": patch ---- - -Rename usage reporting option `sendErrorsInTraces` (added in 4.0.0-alpha.4) to `sendErrors`, as it also affects error statistics outside of traces. diff --git a/.changeset/six-pianos-refuse.md b/.changeset/six-pianos-refuse.md deleted file mode 100644 index 65dd8a36a87..00000000000 --- a/.changeset/six-pianos-refuse.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@apollo/server-integration-testsuite': patch ---- - -Expand jest peer deps to include v29 diff --git a/.changeset/sixty-flowers-press.md b/.changeset/sixty-flowers-press.md deleted file mode 100644 index a845151cc84..00000000000 --- a/.changeset/sixty-flowers-press.md +++ /dev/null @@ -1,2 +0,0 @@ ---- ---- diff --git a/.changeset/small-cycles-hammer.md b/.changeset/small-cycles-hammer.md deleted file mode 100644 index 802374306d2..00000000000 --- a/.changeset/small-cycles-hammer.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -"@apollo/server-integration-testsuite": major -"@apollo/server-plugin-response-cache": major -"@apollo/server": major -"@apollo/usage-reporting-protobuf": major ---- - -Initial Apollo Server 4 release diff --git a/.changeset/small-suits-compare.md b/.changeset/small-suits-compare.md deleted file mode 100644 index 2974b1e6ef4..00000000000 --- a/.changeset/small-suits-compare.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -"@apollo/server-integration-testsuite": patch -"@apollo/server": patch ---- - -Refactor error formatting. - -Remove `error.extensions.exception`; you can add it back yourself with `formatError`. `error.extensions.exception.stacktrace` is now available on `error.extensions.stacktrace`. - -Provide `unwrapResolverError` function in `@apollo/server/errors`; useful for your `formatError` hook. - -No more TS `declare module` describing the `exception` extension (partially incorrectly). - -Rename the (new in v4) constructor option `includeStackTracesInErrorResponses` to `includeStacktraceInErrorResponses`. diff --git a/.changeset/spicy-lions-deliver.md b/.changeset/spicy-lions-deliver.md deleted file mode 100644 index 29558b5fcd2..00000000000 --- a/.changeset/spicy-lions-deliver.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@apollo/server": patch ---- - -Port #6763 from AS3 (fix fieldLevelInstrumentation type declaration) diff --git a/.changeset/spicy-pugs-deliver.md b/.changeset/spicy-pugs-deliver.md deleted file mode 100644 index 3248d780965..00000000000 --- a/.changeset/spicy-pugs-deliver.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@apollo/server": patch ---- - -Update internal use of `@graphql-tools/schema` from v8 to v9. This should be a no-op; we have already removed the feature that would have been affected by the API change in this upgrade (passing `parseOptions` to `makeExecutableSchema`). diff --git a/.changeset/spotty-days-eat.md b/.changeset/spotty-days-eat.md deleted file mode 100644 index b033a37649f..00000000000 --- a/.changeset/spotty-days-eat.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@apollo/server": patch ---- - -Ensure executionDidEnd hooks are only called once (when they throw) diff --git a/.changeset/stale-goats-serve.md b/.changeset/stale-goats-serve.md deleted file mode 100644 index 6c5b8165869..00000000000 --- a/.changeset/stale-goats-serve.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@apollo/server-integration-testsuite': patch ---- - -Update snapshot format to future jest v29 default diff --git a/.changeset/stale-sheep-search.md b/.changeset/stale-sheep-search.md deleted file mode 100644 index ab2c95f9d51..00000000000 --- a/.changeset/stale-sheep-search.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@apollo/server": patch ---- - -Port GHSA-2fvv-qxrq-7jq6 fix from v3 (remove XSS from default landing page HTML) diff --git a/.changeset/tasty-elephants-give.md b/.changeset/tasty-elephants-give.md deleted file mode 100644 index 9550c0c0b68..00000000000 --- a/.changeset/tasty-elephants-give.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@apollo/server': patch ---- - -Fix a slow memory leak in the usage reporting plugin (#6983). diff --git a/.changeset/tender-frogs-judge.md b/.changeset/tender-frogs-judge.md deleted file mode 100644 index e1fd1ac0b80..00000000000 --- a/.changeset/tender-frogs-judge.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@apollo/usage-reporting-protobuf': patch ---- - -Update `@apollo/protobufjs` dependency to avoid false positives in vulnerability scans (https://github.com/apollographql/apollo-server/issues/6835) diff --git a/.changeset/thirty-donkeys-sing.md b/.changeset/thirty-donkeys-sing.md deleted file mode 100644 index 367612ae66d..00000000000 --- a/.changeset/thirty-donkeys-sing.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@apollo/server-integration-testsuite': patch -'@apollo/server': patch ---- - -Support application/graphql-response+json content-type if requested via Accept header, as per graphql-over-http spec. -Include `charset=utf-8` in content-type headers. diff --git a/.changeset/tricky-pillows-wash.md b/.changeset/tricky-pillows-wash.md deleted file mode 100644 index a845151cc84..00000000000 --- a/.changeset/tricky-pillows-wash.md +++ /dev/null @@ -1,2 +0,0 @@ ---- ---- diff --git a/.changeset/twenty-cooks-repair.md b/.changeset/twenty-cooks-repair.md deleted file mode 100644 index 7623719b998..00000000000 --- a/.changeset/twenty-cooks-repair.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -"@apollo/server-integration-testsuite": patch -"@apollo/server": patch ---- - -Usage reporting and inline trace plugins: replace `rewriteError` with `sendErrorsInTraces`/`includeErrors`, and mask all errors by default. diff --git a/.changeset/violet-mayflies-help.md b/.changeset/violet-mayflies-help.md deleted file mode 100644 index 60f1c7dded9..00000000000 --- a/.changeset/violet-mayflies-help.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -"@apollo/server-integration-testsuite": patch -"@apollo/server-plugin-response-cache": patch -"@apollo/server": patch -"@apollo/usage-reporting-protobuf": patch ---- - -Export ApolloServerErrorCode enum instead of error classes. HTTPGraphQLRequest takes search params as raw string. diff --git a/.changeset/wet-kiwis-play.md b/.changeset/wet-kiwis-play.md deleted file mode 100644 index 3bbfb293b76..00000000000 --- a/.changeset/wet-kiwis-play.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -"@apollo/server-integration-testsuite": patch -"@apollo/server-plugin-response-cache": patch -"@apollo/server": patch ---- - -Several changes relating to plugins: - -- Remove the `server` field on `GraphQLRequestContext` and `GraphQLServerContext` (ie, the arguments to most plugin hook methods). This was added during AS4 development and did not exist in AS3. - -- Add `logger` and `cache` fields to `GraphQLRequestContext` and `GraphQLServerContext`. The `logger` fields and `GraphQLRequestContext.cache` existed in AS3 and had been previously removed for redundancy with the `server` field. (Unlike in AS3, `logger` is readonly.) - -- `ApolloServerPlugin` is now declared as `` rather than ``. This means that you can declare a plugin that doesn't care about `contextValue` to simply implement `ApolloServerPlugin` and it will work with any `ApolloServer`. This should make it easy to write plugins that don't care about context. - -- Remove the ability to specify a factory function as an element of the `plugins` list in the `ApolloServer` constructor. (Reducing the number of ways to specify constructor options helps keep type errors simpler.) As far as we know the main use case for this (referring to the `ApolloServer` itself when creating the plugin) can be handled with the new-in-AS4 `ApolloServer.addPlugin` method. diff --git a/.changeset/wet-rats-shake.md b/.changeset/wet-rats-shake.md deleted file mode 100644 index a845151cc84..00000000000 --- a/.changeset/wet-rats-shake.md +++ /dev/null @@ -1,2 +0,0 @@ ---- ---- diff --git a/.changeset/witty-moles-fail.md b/.changeset/witty-moles-fail.md deleted file mode 100644 index 0ba1658d2d9..00000000000 --- a/.changeset/witty-moles-fail.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@apollo/server-integration-testsuite': patch ---- - -Add test for batch requests with no elements diff --git a/.changeset/witty-squids-vanish.md b/.changeset/witty-squids-vanish.md deleted file mode 100644 index e63c3e45958..00000000000 --- a/.changeset/witty-squids-vanish.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -"@apollo/server-integration-testsuite": patch -"@apollo/server": patch ---- - -Errors thrown in resolvers and context functions can use `extensions.http` to affect the response status code and headers. The default behavior when a context function throws is now to always use status code 500 rather than comparing `extensions.code` to `INTERNAL_SERVER_ERROR`. diff --git a/.changeset/witty-toes-grin.md b/.changeset/witty-toes-grin.md deleted file mode 100644 index b2361fdc400..00000000000 --- a/.changeset/witty-toes-grin.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@apollo/server': patch ---- - -Add generics for response data and variables to server.executeOperation; allow inference from TypedQueryDocumentNode. diff --git a/.changeset/yellow-actors-do.md b/.changeset/yellow-actors-do.md deleted file mode 100644 index e0215fa975f..00000000000 --- a/.changeset/yellow-actors-do.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@apollo/server': patch ---- - -Usage reporting: always send traces over 10MB as stats. diff --git a/CHANGELOG_v4_draft.md b/CHANGELOG_v4_draft.md deleted file mode 100644 index f0e0a886c10..00000000000 --- a/CHANGELOG_v4_draft.md +++ /dev/null @@ -1,117 +0,0 @@ -(note: this will be moved to packages/server/CHANGELOG.md as part of the actual release process) - -## v4.0.0 - -### BREAKING CHANGES - -Apollo Server contains quite a few breaking changes: most notably, a brand new package name! Read our [migration guide](https://www.apollographql.com/docs/apollo-server/migration/) for more details on how to update your app. - - -#### Bumped dependencies - -The minimum versions of these dependencies have been bumped to provide an improved foundation for the development of future features. - -- Dropped support for Node.js v12, which is no longer under [long-term support](https://nodejs.org/en/about/releases/#releases) from the Node.js Foundation. -- Dropped support for versions of the `graphql` library prior to `v16.6.0`. - - Upgrading `graphql` may require you to upgrade other libraries that are installed in your project. For example, if you use Apollo Server with Apollo Gateway, you should upgrade Apollo Gateway to at least v0.50.1 or any v2.x version for full `graphql` 16 support before upgrading to Apollo Server 4. -- If you use Apollo Server with TypeScript, you must use TypeScript v4.7.0 or newer. - - -#### New package structure - -Apollo Server 4 is distributed in the `@apollo/server` package. This package replaces `apollo-server`, `apollo-server-core`, `apollo-server-express`, `apollo-server-errors`, `apollo-server-types`, and `apollo-server-plugin-base`. - -The `@apollo/server` package exports the `ApolloServer` class. In Apollo Server 3, individual web framework integrations had their own subclasses of `ApolloServer`. In Apollo Server 4, there is a single `ApolloServer` class; web framework integrations define their own functions which use a new stable integration API on `ApolloServer` to execute operations. - -Other functionality is exported from "deep imports" on `@apollo/server`. `startStandaloneServer` (the replacement for the batteries-included `apollo-server` package) is exported from `@apollo/server/standalone`. `expressMiddleware` (the replacement for `apollo-server-express`) is exported from `@apollo/server/express4`. Plugins such as `ApolloServerPluginUsageReporting` are exported from paths such as `@apollo/server/plugin/usageReporting`. - -The `@apollo/server` package is built natively as both an ECMAScript Module (ESM) and as a CommonJS module (CJS); Apollo Server 3 was only built as CJS. This allows ESM-native bundlers to create more efficient bundles. - -Other packages have been renamed: -- `apollo-datasource-rest` is now [`@apollo/datasource-rest`](https://www.npmjs.com/package/@apollo/datasource-rest). -- `apollo-server-plugin-response-cache` is now [`@apollo/server-plugin-response-cache`](https://www.npmjs.com/package/@apollo/server-plugin-response-cache). -- `apollo-server-plugin-operation-registry` is now [`@apollo/server-plugin-operation-registry`](https://www.npmjs.com/package/@apollo/server-plugin-operation-registry). -- `apollo-reporting-protobuf` (an internal implementation detail for the usage reporting plugin) is now [`@apollo/usage-reporting-protobuf`](https://www.npmjs.com/package/@apollo/usage-reporting-protobuf). - - -#### Removed web framework integrations - -Prior to Apollo Server 4, the only way to integrate a web framework with Apollo Server was for the Apollo Server project to add an official `apollo-server-x` subclass maintained as part of the core project. Apollo Server 4 makes it easy for users to integrate with their favorite web framework, and so we have removed most of the framework integrations from the core project so that framework integrations can be maintained by users who are passionate about that framework. Because of this, the core project no longer directly maintains integrations for Fastify, Hapi, Koa, Micro, AWS Lambda,Google Cloud Functions, Azure Functions, or Cloudflare. We expect that [community integrations](https://www.apollographql.com/docs/apollo-server/v4/integrations/integration-index/) will eventually be created for most of these frameworks and serverless environments. - -Apollo Server's support for the Express web framework no longer also supports its older predecessor [Connect](https://github.com/senchalabs/connect). - - -#### Removed constructor options - -- The `dataSources` constructor option essentially added a post-processing step to your app's context function, creating `DataSource` subclasses and adding them to a `dataSources` field on your context value. This meant the TypeScript type the `context` function returns was _different_ from the context type your resolvers and plugins receive. Additionally, this design obfuscated that `DataSource` objects are created once per request (i.e., like the rest of the context object). Apollo Server 4 removes the `dataSources` constructor option. You can now treat `DataSources` like any other part of your `context` object. See the [migration guide](https://www.apollographql.com/docs/apollo-server/migration/) for details on how to move your `dataSources` function into your `context` function. -- The `modules` constructor option was just a slightly different way of writing `typeDefs` and `resolvers` (although it surprisingly used entirely different logic under the hood). This option has been removed. -- The `mocks` and `mockEntireSchema` constructor options wrapped an outdated version of the [`@graphql-tools/mocks`](https://www.npmjs.com/package/@graphql-tools/mock) library to provide mocking functionality. These constructor options have been removed; you can instead directly incorporate the `@graphql-tools/mock` package into your app, enabling you to get the most up-to-date mocking features. -- The `debug` constructor option (which defaulted to `true` unless the `NODE_ENV` environment variable is either `production` or `test`) mostly controlled whether GraphQL errors responses included stack traces, but it also affected the default log level on the default logger. The `debug` constructor option has been removed and is replaced with `includeStacktraceInErrorResponses`, which does exactly what it says it does. -- The `formatResponse` constructor option has been removed; its functionality can be replaced by the `willSendResponse` plugin hook. -- The `executor` constructor option has been removed; the ability to replace `graphql-js`'s execution functionality is still available via the `gateway` option. - -#### Removed features - -- Apollo Server 4 no longer responds to health checks on the path `/.well-known/apollo/server-health`. You can run a trivial GraphQL operation as a health check, or you can add a custom health check via your web framework. -- Apollo Server 4 no longer cares what URL path is used to access its functionality. Instead of specifying the `path` option to various Apollo Server methods, just use your web framework's routing feature to mount the Apollo Server integration at the appropriate path. -- Apollo Server 4's Express middleware no longer wraps the `body-parser` and `cors` middleware; it is your responsibility to install and set up these middleware yourself when using a framework integration. (The standalone HTTP server sets up body parsing and CORS for you, but without the ability to configure their details.) -- Apollo Server no longer re-exports the `gql` tag function from `graphql-tag`. If you want to use `gql`, install the `graphql-tag` package. -- Apollo Server no longer defines its own `ApolloError` class and `toApolloError` function. Instead, use `GraphQLError` from the `graphql` package. -- Apollo Server no longer exports error subclasses representing the errors that it creates, such as `SyntaxError`. Instead, it exports an enum `ApolloServerErrorCode` that you can use to recognize errors created by Apollo Server. -- Apollo Server no longer exports the `ForbiddenError` and `AuthenticationError` classes. Instead, you can define your own error codes for these errors or other errors. -- The undocumented `__resolveObject` pseudo-resolver is no longer supported. -- The `requestAgent` option to `ApolloServerPluginUsageReporting` has been removed. -- In the JSON body of a `POST` request, the `variables` and `extensions` fields must be objects, not JSON-encoded strings. -- The core Apollo Server packages no longer provide a landing page plugin for the unmaintained GraphQL Playground UI. We have published an Apollo Server 4-compatible landing page plugin in the package `@apollo/server-plugin-landing-page-graphql-playground`, but do not intend to maintain it further after this one-time publish. - -#### Modified functionality - -- The `context` function is now provided to your integration function (such as `startStandaloneServer` or `expressMiddleware`) rather than to the `new ApolloServer` constructor. -- The `executeOperation` method now directly accepts a context value, rather than accepting the arguments to your `context` function. -- The `formatError` hook now receives the original thrown error in addition to the formatted error. -- Formatted errors no longer contain the `extensions.exception` field containing all enumerable properties of the originally thrown error. If you want to include more information in an error, specify them as `extensions` when creating a `GraphQLError`. The `stacktrace` field is provided directly on `extensions` rather than nested under `exception`. -- All errors responses are consistently rendered as `application/json` JSON responses, and the `formatError` hook is used consistently. -- Other [changes to error handling outside of resolvers](https://www.apollographql.com/docs/apollo-server/migration/#improvements-to-error-handling-outside-of-resolvers) are described in the migration guide. -- The `parseOptions` constructor option only affects the parsing of incoming operations, not the parsing of `typeDefs`. - - -#### Plugin API changes - -- The field `GraphQLRequestContext.context` has been renamed to `contextValue`. -- The field `GraphQLRequestContext.logger` is now readonly. -- The fields `GraphQLRequestContext.schemaHash` and `GraphQLRequestContext.debug` have been removed. -- The type `GraphQLServiceContext` has been renamed to `GraphQLServerContext`, and the fields `schemaHash`, `persistedQueries`, and `serverlessFramework` have been removed; the latter has been semi-replaced by `startedInBackground`. -- The `http` field on the `GraphQLRequest` object (available to plugins as `requestContext.request` and as an argument to `server.executeOperation`) is no longer based on the Fetch API's `Request` object. It no longer contains an URL path, and its `headers` field is a `Map` rather than a `Headers` object. -- The structure of the `GraphQLResponse` object (available to plugins as `requestContext.response` and as the return value from `server.executeOperation`) has [changed in several ways](https://www.apollographql.com/docs/apollo-server/migration/#graphqlresponse). -- The `plugins` constructor argument does not take factory functions. -- `requestDidStart` hooks are called in parallel rather than in series. -- A few changes have been made which may affect [custom `gateway` and `GraphQLDataSource` implementations](https://www.apollographql.com/docs/apollo-server/migration/#custom-gateway-and-graphqldatasource-implementations). - - -#### Changes to defaults - -- CSRF prevention is on by default. -- HTTP batching is disabled by default. -- The default in-memory cache is bounded. -- The local landing page defaults to the *embedded* Apollo Sandbox; this provides a user interface for executing GraphQL operations which doesn't require any additional CORS configuration. -- The usage reporting and inline trace plugins mask errors in their reports by default: error messages are replaced with `` and error extensions are replaced with a single extension `maskedBy`. This can be configured with the `sendErrors` option to `ApolloServerPluginUsageReporting` and the `includeErrors` option to `ApolloServerPluginInlineTrace`. The `rewriteError` option to these plugins has been removed; its functionality is subsumed by the new options. - -#### TypeScript-specific changes - -- The TypeScript types for the `validationRules` constructor option are more accurate. -- We now use the `@apollo/utils.fetcher` package to define the shape of the Fetch API, instead of `apollo-server-env`. This package only supports argument structures that are likely to be compatible across implementations of the Fetch API. -- The `CacheScope`, `CacheHint`, `CacheAnnotation`, `CachePolicy`, and `ResolveInfoCacheControl` types are now exported from the `@apollo/cache-control-types` package. `CacheScope` is now a pure TypeScript type rather than an enum. -- The type for `ApolloServer`'s constructor options argument is now `ApolloServerOptions`, not `Config` or `ApolloServerExpressConfig`. -- Some other types have been renamed or removed; see the migration guide for details. - -### New features - -- In TypeScript, you can now declare your server's context value type using generic type syntax, like `new ApolloServer`. This ensures that the type returned by your context function matches the context type provided to your resolvers and plugins. -- `ApolloServer` now has a well-documented API for integrating with web frameworks, featuring the new `executeHTTPGraphQLRequest` method. -- `ApolloServer` now has explicit support for the "serverless" style of startup error handling. Serverless frameworks generally do not allow handlers to do "async" work during startup, so any failure to load the schema or run `serverWillStart` handlers can't prevent requests from being served. Apollo Server 4 provides a `server.startInBackgroundHandlingStartupErrorsByLoggingAndFailingAllRequests()` method as an alternative to `await server.start()` for use in contexts like serverless environments. -- You can add a plugin to a server with `server.addPlugin()`. Plugins can only be added before the server is `start`ed. This allows you to pass the server itself as an argument to the plugin. -- `ApolloServer` has new public readonly `cache` and `logger` fields. -- When combined with `graphql` v17 (only available as pre-releases as of September 2022), Apollo Server now has experimental support for [incremental delivery](https://www.apollographql.com/docs/apollo-server/workflow/requests/#incremental-delivery-experimental) directives such as `@defer` and `@stream`. -- Apollo Server 4 adds new plugin hooks `startupDidFail`, `contextCreationDidFail`, `invalidRequestWasReceived`, `unexpectedErrorProcessingRequest`, `didEncounterSubsequentErrors`, and `willSendSubsequentPayload`. -- If Apollo Server receives an operation while the server is shutting down, it now logs a warning telling you to properly configure HTTP server draining. -- Apollo Server now supports responses with `content-type: application/graphql-response+json` when requested by clients via the `accept` header, as described in the [GraphQL over HTTP specification proposal](https://github.com/graphql/graphql-over-http). diff --git a/ROADMAP.md b/ROADMAP.md deleted file mode 100644 index fd7ef9c3621..00000000000 --- a/ROADMAP.md +++ /dev/null @@ -1,151 +0,0 @@ -# Apollo Server Roadmap - -*Last updated: January 2022* - -> **Please note:** This is an approximation of **larger effort** work planned for the next 3 - 6 months. It does not cover all new functionality that will be added, and nothing here is set in stone. Also note that each of these releases, and several patch/minor releases in-between, will include bug fixes (based on issue triaging) and community submitted PRs. - -## 4.0 - -**Estimated release:** Q2 2022 - -We are now actively working on Apollo Server 4. This project consists of a number of refactors focused on making Apollo Server simpler to use, maintain, document, and extend. Much of this builds on proposals that were originally part of the Apollo Server 3 plan which we removed from that release due to scope. Much of the below is based on a [proposal from 2019](https://github.com/apollographql/apollo-server/issues/3184) which is one of the most up-voted issues in our repository. - -### Replace 9 core-maintained bindings with a stable HTTP abstraction - -Currently, Apollo Server has core-maintained bindings to a large number of web frameworks and serverless environments. There is no stable, easy API to allow you to write your own binding to a new framework. These bindings are all maintained by the Apollo Server core team, but we do not have practical experience running servers that use most of these frameworks. Adding new features to Apollo Server often requires making very similar changes in every binding package, which is a big barrier to making real improvements. The different bindings are implemented as separate npm packages which subclass the core `ApolloServer` package, which means that the API for `ApolloServer` is [different for different packages](https://www.apollographql.com/docs/apollo-server/api/apollo-server/#framework-specific-middleware-function), which is challenging to document and understand. - -In Apollo Server 4, we will follow the 2019 proposal to add a well-defined API for processing an HTTP request to `ApolloServer`. `ApolloServer` will have a single documentable API rather than being extended via subclasses. Framework integration packages can export functions or classes that take in `ApolloServer` and call its methods appropriately instead of adding their own methods to the object. - -As part of the main Apollo Server package, we will maintain integrations that work on Node's built-in `http` request and response types. You will be able to use these directly with `http.createServer` or with Express (whose request and response types extend Node's). - -Currently, the `apollo-server` package exports a "batteries-included" version of `ApolloServer` with a very different API: it has a `listen` method instead of a framework integration method, and various aspects of it cannot be configured. The fact that the package whose name is closest to the name of the project exports a class with the same name as every other `ApolloServer` but has different behavior may in some ways be "convenient" but it makes it challenging to document; we have recently started taking the verbose approach of always referring to `apollo-server` as "the batteries-included `apollo-server` package". In Apollo Server 4, we plan to introduce an `ApolloServerStandalone` class in the main Apollo Server package which is similar in concept to remove ambiguity and make the name more easily reference-able. - -The Apollo Server core team will no longer try to maintain integrations for which we have no hands-on operational experience. **This is where the larger community can help!** During the development process of Apollo Server 4, we'd like to find community members who are excited to maintain the integrations for most of the web frameworks (Fastify, Hapi, Koa, Micro, Lambda, Google Cloud Functions, Azure Functions, and Cloudflare). Writing these integrations should be much easier in the new model, because the only responsibility of these packages will be translating requests and responses between the framework's native format and the types used by `ApolloServer`'s API. We will add more direct support to the `ApolloServer` API for the patterns that are repeated across the serverless integration packages today. - -Separating these packages from the Apollo Server release cycle will have many advantages: - -- Users of these integration packages will depend directly on the main Apollo Server package as well as on the integration package, instead of only depending transitively on the main Apollo Server package. This makes it easier to understand exactly what version of Apollo Server you are using. -- Separating the versioning of the integration packages from the main Apollo Server package makes it easier for integration packages to make backwards-incompatible changes to their integration-specific APIs without requiring a full Apollo Server major version bump. -- If the underlying web framework makes backwards-incompatible changes, it will be easier to split the integration package in two or find another way of handling those changes. - -We are looking for volunteers to maintain these integrations! See [the issues with the 'integration-collaborators' label](https://github.com/apollographql/apollo-server/labels/integration-collaborators) to find the discussion about your favorite web framework today. - -### Combine many packages into `@apollo/server` - -You may have noticed the recurring phrase "the main Apollo Server package" above. Another challenge of maintaining and using Apollo Server is how many separate npm packages are in the project! Most of the core logic is in `apollo-server-core`, but this isn't the package that users interact most directly with. There isn't much value provided by the separation into many classes, but it does add a lot of complexity to maintaining and using the package. - -We believe we can combine the following packages into a single `@apollo/server` package: -- `apollo-server-core` -- `apollo-server` (the "batteries-included" package --- we are looking forward to never having to type this phrase again) -- `apollo-server-plugin-base` -- `apollo-server-types` -- `apollo-server-express` -- `apollo-server-errors` -- `apollo-reporting-protobuf` - -The `@apollo/server` naming matches how Apollo's other actively maintained npm packages such as `@apollo/client` and `@apollo/gateway` are named. After Apollo Server 4 is released, all actively maintained Apollo packages will start with `@apollo/`; this leaves the `apollo-` "namespace" for community packages such as integration packages like `apollo-server-fastify`. - -In order to implement the standalone server with minimal `npm install`s required, this package will have a dependency on `body-parser` (and perhaps `cors` if we want to allow CORS handling to be configurable); we believe this dependency is small enough that it will be acceptable to include it even for folks who use a different web framework that has its own body parsing solution. - -This package will be the only package in the `apollo-server` repository. We can stop using Lerna; we are considering using [Changesets](https://github.com/changesets/changesets/) to make releases and changelog management more straightforward. (Right now our CHANGELOG.md is written manually and assumes inaccurately that all Apollo Server packages use the same version numbers; after this we will have a precise CHANGELOG.md for any package we publish.) - -(Some aspects of `apollo-server-errors` will ideally be folded into `graphql-js` instead.) - -### Remove features that wrap framework-specific libraries - -Some parts of Apollo Server take parameters that are passed directly to framework-specific libraries. These libraries are ones that most users of the framework already know how to use, and they vary across frameworks making our APIs challenging to document. This specifically includes body-parsing and CORS-handling packages. - -In Apollo Server 4, framework integration functions won't try to wrap these basic framework-specific libraries. If you want to use our Express middleware, you'll be required to use the standard `body-parser` middleware yourself. (We'll have good error handling to help you figure out if you forgot to do this.) This means we won't have to have a special option just for passing options through to `body-parser`. - -`ApolloServerStandalone` (our replacement for the batteries-included `apollo-server` package) will still link in `body-parser` and parse bodies for you. Any integration maintainer who thinks their package would work better if it had a more standalone/batteries-included API should feel free to add that as well, but the main building block exported by an integration should probably just handle GraphQL requests without linking in other middleware. - -### Remove health checks and path parsing - -The “health check” feature is just "an HTTP path which always returns 200 and which allows you to pass in a handler to run arbitrary code instead". It’s notably not actually connected to the state of the ApolloServer object itself (eg, if something is broken that prevents operations from executing then health checks can still pass). Our docs (https://www.apollographql.com/docs/apollo-server/monitoring/health-checks/) no longer actively encourage the use of this feature and instead recommend running a trivial GraphQL query over GET. If for some reason running this query is not an acceptable health check, folks integrating Apollo Server into a web framework can define their own health check via their web framework directly. - -This feature is the main remaining reason that ApolloServer needs to know about and parse URI paths. This leads to a bunch of confusing complexity: there’s a concept of `server.graphqlPath` which middleware uses to decide whether or not to process a request as GraphQL, but you can also use your web framework itself to specify directly what path middleware is mounted at. (This flexibility is not provided to the batteries-included server, which always has a `graphqlPath` of `/`.) Path parsing has been a challenge for many integrations; for example, when running in AWS Lambda, the full path at which your function is invoked generally contains some extra components which need to be ignored to figure out if the request is a health check. - -So if we’re removing health checks from Apollo Server, we can also remove path parsing; if you want to mount your GraphQL server at `/api/graphql`, you should do that via `app.use('/api/graphql', apolloServer.getMiddleware())` rather than via `app.use(apolloServer.getMiddleware({ graphqlPath: '/api/graphql' }))` (both of which currently work with slightly and confusingly different semantics). - -We may consider leaving health check support in `ApolloServerStandalone` (where you can't easily add your own HTTP path handlers), if compelling arguments for why it's superior to using `?query=%7B__typename%7D` as health check are provided. - -### Replace `apollo-server-caching` with an existing key/value cache abstraction - -The Apollo Server project includes the `apollo-server-caching` package, which defines an abstraction over key/value data stores like Redis and Memcached. This abstraction is used as a building block for several features such as the full-response cache implemented in `apollo-server-plugin-response-cache` and the caching HTTP client implemented in `apollo-datasource-rest`. The Apollo Server project maintains implementations of this interface for Redis and Memcached; the broader community has implemented the interface for several additional backends. - -However, there's really nothing GraphQL-specific about this interface. We've discovered that the [`keyv`](https://www.npmjs.com/package/keyv) project defines a nearly-identical interface. This project has support for many backends including Redis and Memcached. If there are any backends that have an `apollo-server-caching` implementation and no `keyv` implementation, it's very easy to write your own `keyv` implementation, or one could easily write a tiny class to wrap any existing `apollo-server-caching` implementation as a `keyv` implementation. - -In Apollo Server 4 we will stop maintaining `apollo-server-caching` and change Apollo Server to use `keyv` instead. This will allow us to focus on what we're best at (building tools for working with GraphQL) rather than the relatively unrelated project of building an abstract key-value cache API, and will immediately enable Apollo Server's caching features to work with any backend supported by `keyv`. - -### Replace `apollo-server-env` with some `fetch` API typing package - -While the `apollo-server-env` package used to provide a bunch of different polyfills, it now just provides TypeScript typings and polyfills for `fetch` and `URL` APIs. It seems very likely that we can use some maintained third-party package to provide these typings in a way that continues to be flexible enough to allow for multiple `fetch` implementations. - -In the off-chance that such a package does not exist, we could maintain one ourselves, but with a more specific name like `@apollo/fetch-typings` and published from its own repository on a lifecycle not strictly tied to Apollo Server releases. - -(One very possible answer would be to be all-in on `node-fetch`, in the sense that packages that want to run `fetch` directly depend on `node-fetch` and allow you to override the fetcher with fetcher options whose TypeScript types depend on those defined in `@types/node-fetch`. `apollo-server-env` depends on `node-fetch` today so it seems likely that this will work. We should verify that this continues to support swapping in certain popular fetch replacements such as `make-fetch-happen`. (One odd bit is that `node-fetch` v3 only supports being used from ESM so we are sticking to v2 for now and probably should for AS4 as well.) - -### Replace top-level `dataSources` option with a data sources plugin - -The Data Sources and Plugins APIs were added to Apollo Server around the same time. With the benefit of hindsight, it does not appear that `dataSources` needs to be its own top-level option, as the plugin API provides a strict superset of the functionality available via the `dataSources` option. - -The `apollo-datasource` package will move to its own repository and will continue to export its DataSource API, but also export a `dataSourcePlugin` function. Code that currently looks like: - -``` -const server = new ApolloServer({ - typeDefs, - resolvers, - dataSources: () => { - return { - moviesAPI: new MoviesAPI(), - personalizationAPI: new PersonalizationAPI(), - }; - }, -}); -``` - -could be replaced by - -``` -import { dataSourcePlugin } from 'apollo-datasource'; - -const server = new ApolloServer({ - typeDefs, - resolvers, - plugins: [dataSourcePlugin(() => { - return { - moviesAPI: new MoviesAPI(), - personalizationAPI: new PersonalizationAPI(), - }; - })], -}); -``` - -This could provide exactly the same functionality to data source implementations without `@apollo/server` needing to know anything about the `DataSource` interface. - -### Move `apollo-datasource-rest` to its own repository - -`apollo-datasource-rest` is a caching HTTP client for Node which uses our `apollo-server-caching` interface to talk to a cache. Other than the fact that it implements the `DataSource` interface, its code is pretty unrelated to the rest of Apollo Server, and the current Apollo Server team has not been actively maintaining it, despite the fact that it's a nice piece of software that many find valuable. - -Its version numbering is not particularly related to Apollo Server’s version number (as it is essentially unrelated code and backwards-incompatible changes to one package generally won’t cause backwards-incompatible changes to the other) but it is currently coupled to the Apollo Server release process: we can’t easily release it without releasing AS and vice versa, and its CHANGELOG is confusingly intermingled with Apollo Server changes. (These are certainly fixable problems if we wanted.) - -Because it is semantically pretty independent from Apollo Server, we will move it to its own repository with its own CHANGELOG and issue tracker. We will also start actively maintaining it again, in collaboration with community members who use it more than we do internally at Apollo. - -(Like the rest of Apollo Server, we will change it to use `keyv` instead of `apollo-server-caching`.) - -### Move plugins which have their own package to their own repositories - -Some plugins, like the usage reporting plugin, are built in to Apollo Server; they currently live in `apollo-server-core` and will live in `@apollo/server` in AS4. Other plugins live in their own packages. These plugins will move to their own repositories. Specifically, this includes ~`apollo-server-plugin-operation-registry`~ (migrated to `@apollo/server-plugin-operation-registry`) and `apollo-server-plugin-response-cache`. - -(Because `apollo-server-plugin-response-cache` will have no dependencies other than `@apollo/server` and `graphql`, it might be reasonable to merge it into `@apollo/server` as well. That said, keeping it as a separate package means we can make interface improvements to it on a versioning lifecycle that doesn't have to be strictly synchronized with the main Apollo Server API, so a separate package and repository is probably best.) - - -### Change usage reporting defaults backwards-incompatibly to send less data - -In order to make usage reporting have better performance and less potential PII leakage by default, we should change the default usage reporting to send even less information by default. We previously changed usage reporting to make variable and HTTP header reporting opt-in. We should continue down this path to make sending error bodies in traces opt-in (though we should still probably track the number of errors by default). Furthermore, now that the [Unified Reporting](https://github.com/apollographql/apollo-server/pull/4142) and [referenced field usage](https://github.com/apollographql/apollo-server/issues/5708) projects are done, we can change the defaults to make *traces* be an opt-in feature (which gives you access to traces on the Operations page, field execution counts on the Fields page, and field latencies in Explorer and VSCode timing hints) that isn’t on by default. This would mean that by default we would only send summarized statistics of operations, not any data about individual requests, and the only user-provided strings would be operation signatures (with literals removed as always). - -### Set the stage for GraphQL modes other than "one response per request" - -The current `ApolloServer` API makes it very challenging to change the fundamental model where web framework integrations ask `apollo-server-core` to process a request and receive a single response back. This means that it is challenging to implement features such as `@defer` and `@stream` directives or subscriptions. - -When designing the new HTTP abstraction, we will ensure that it can support these features of the GraphQL spec. This does not necessarily mean we will ship support for `@defer` in `@apollo/server@4.0.0`; this roadmap is pretty long already, and so implementing these features are not currently in scope for the initial release. But a major goal of this release is to make implementing these features (in a way that works with all web framework integrations) easier. diff --git a/package-lock.json b/package-lock.json index 8c6a528faf1..d4d9d7a8630 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15999,13 +15999,13 @@ }, "packages/integration-testsuite": { "name": "@apollo/server-integration-testsuite", - "version": "4.0.0-rc.18", + "version": "4.0.0", "license": "MIT", "dependencies": { "@apollo/cache-control-types": "^1.0.2", "@apollo/client": "^3.6.9", - "@apollo/server-plugin-landing-page-graphql-playground": "^4.0.0-alpha.0", - "@apollo/usage-reporting-protobuf": "^4.0.0-rc.2", + "@apollo/server-plugin-landing-page-graphql-playground": "^4.0.0", + "@apollo/usage-reporting-protobuf": "^4.0.0", "@apollo/utils.createhash": "^1.1.0", "@apollo/utils.keyvaluecache": "^1.0.1", "@josephg/resolvable": "^1.0.1", @@ -16020,7 +16020,7 @@ "node": ">=14.0" }, "peerDependencies": { - "@apollo/server": "^4.0.0-rc.18", + "@apollo/server": "^4.0.0", "@jest/globals": "28.x || 29.x", "graphql": "^16.6.0", "jest": "28.x || 29.x" @@ -16028,7 +16028,7 @@ }, "packages/plugin-landing-page-graphql-playground": { "name": "@apollo/server-plugin-landing-page-graphql-playground", - "version": "4.0.0-alpha.0", + "version": "4.0.0", "license": "MIT", "dependencies": { "@apollographql/graphql-playground-html": "1.6.29" @@ -16037,12 +16037,12 @@ "node": ">=14.0" }, "peerDependencies": { - "@apollo/server": "^4.0.0-alpha.7" + "@apollo/server": "^4.0.0" } }, "packages/plugin-response-cache": { "name": "@apollo/server-plugin-response-cache", - "version": "4.0.0-rc.6", + "version": "4.0.0", "license": "MIT", "dependencies": { "@apollo/utils.createhash": "^1.1.0", @@ -16052,18 +16052,18 @@ "node": ">=14.0" }, "peerDependencies": { - "@apollo/server": "^4.0.0-rc.14", + "@apollo/server": "^4.0.0", "graphql": "^16.6.0" } }, "packages/server": { "name": "@apollo/server", - "version": "4.0.0-rc.18", + "version": "4.0.0", "license": "MIT", "dependencies": { "@apollo/cache-control-types": "^1.0.2", "@apollo/server-gateway-interface": "^1.0.3", - "@apollo/usage-reporting-protobuf": "^4.0.0-rc.2", + "@apollo/usage-reporting-protobuf": "^4.0.0", "@apollo/utils.createhash": "^1.1.0", "@apollo/utils.fetcher": "^1.0.0", "@apollo/utils.isnodelike": "^1.1.0", @@ -16111,7 +16111,7 @@ }, "packages/usage-reporting-protobuf": { "name": "@apollo/usage-reporting-protobuf", - "version": "4.0.0-rc.2", + "version": "4.0.0", "license": "MIT", "dependencies": { "@apollo/protobufjs": "1.2.6" @@ -16295,7 +16295,7 @@ "requires": { "@apollo/cache-control-types": "^1.0.2", "@apollo/server-gateway-interface": "^1.0.3", - "@apollo/usage-reporting-protobuf": "^4.0.0-rc.2", + "@apollo/usage-reporting-protobuf": "^4.0.0", "@apollo/utils.createhash": "^1.1.0", "@apollo/utils.fetcher": "^1.0.0", "@apollo/utils.isnodelike": "^1.1.0", @@ -16346,8 +16346,8 @@ "requires": { "@apollo/cache-control-types": "^1.0.2", "@apollo/client": "^3.6.9", - "@apollo/server-plugin-landing-page-graphql-playground": "^4.0.0-alpha.0", - "@apollo/usage-reporting-protobuf": "^4.0.0-rc.2", + "@apollo/server-plugin-landing-page-graphql-playground": "^4.0.0", + "@apollo/usage-reporting-protobuf": "^4.0.0", "@apollo/utils.createhash": "^1.1.0", "@apollo/utils.keyvaluecache": "^1.0.1", "@josephg/resolvable": "^1.0.1", diff --git a/packages/integration-testsuite/CHANGELOG.md b/packages/integration-testsuite/CHANGELOG.md index 02c3dbef0f4..55f2a1a750e 100644 --- a/packages/integration-testsuite/CHANGELOG.md +++ b/packages/integration-testsuite/CHANGELOG.md @@ -1,200 +1,5 @@ # @apollo/server-integration-testsuite -## 4.0.0-rc.18 +## 4.0.0 -### Patch Changes - -- [#7001](https://github.com/apollographql/apollo-server/pull/7001) [`63d568d13`](https://github.com/apollographql/apollo-server/commit/63d568d13b82e241a4ab9b6033c7aaa983b71700) Thanks [@glasser](https://github.com/glasser)! - Test the behavior of didResolveOperation hooks throwing. - -- Updated dependencies []: - - @apollo/server@4.0.0-rc.18 - -## 4.0.0-rc.17 - -### Patch Changes - -- Updated dependencies [[`233b44eea`](https://github.com/apollographql/apollo-server/commit/233b44eea5031364d88df38afede0b8771c27661)]: - - @apollo/server@4.0.0-rc.17 - -## 4.0.0-rc.16 - -### Patch Changes - -- [#6986](https://github.com/apollographql/apollo-server/pull/6986) [`db5d715a3`](https://github.com/apollographql/apollo-server/commit/db5d715a38fc4b24e45a045440b593018a5d170e) Thanks [@glasser](https://github.com/glasser)! - The cache control plugin sets `cache-control: no-store` for uncacheable responses. Pass `calculateHttpHeaders: 'if-cacheable'` to the cache control plugin to restore AS3 behavior. - -- Updated dependencies [[`db5d715a3`](https://github.com/apollographql/apollo-server/commit/db5d715a38fc4b24e45a045440b593018a5d170e)]: - - @apollo/server@4.0.0-rc.16 - -## 4.0.0-rc.15 - -### Patch Changes - -- Updated dependencies [[`d20842824`](https://github.com/apollographql/apollo-server/commit/d208428248532d55249cad5ea3912dd097232831), [`e1455d583`](https://github.com/apollographql/apollo-server/commit/e1455d58366517b633cc4412e3c2f9e80d7a4f22)]: - - @apollo/usage-reporting-protobuf@4.0.0-rc.2 - - @apollo/server@4.0.0-rc.15 - -## 4.0.0-rc.14 - -### Patch Changes - -- [#6961](https://github.com/apollographql/apollo-server/pull/6961) [`a782c791f`](https://github.com/apollographql/apollo-server/commit/a782c791f4f616e36a0036dcabb4d928a7c3f871) Thanks [@glasser](https://github.com/glasser)! - Require graphql@16.6 as a peer dependency. - -- Updated dependencies [[`a782c791f`](https://github.com/apollographql/apollo-server/commit/a782c791f4f616e36a0036dcabb4d928a7c3f871), [`d3ea2d4ef`](https://github.com/apollographql/apollo-server/commit/d3ea2d4ef137519d073185dea778e39e89a301c2)]: - - @apollo/server@4.0.0-rc.14 - -## 4.0.0-alpha.13 - -### Patch Changes - -- [#6936](https://github.com/apollographql/apollo-server/pull/6936) [`a404bf17e`](https://github.com/apollographql/apollo-server/commit/a404bf17e86d6f53588b2796c9190ad98779a6f9) Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Add test for batch requests with no elements - -- Updated dependencies [[`a404bf17e`](https://github.com/apollographql/apollo-server/commit/a404bf17e86d6f53588b2796c9190ad98779a6f9), [`a404bf17e`](https://github.com/apollographql/apollo-server/commit/a404bf17e86d6f53588b2796c9190ad98779a6f9), [`a404bf17e`](https://github.com/apollographql/apollo-server/commit/a404bf17e86d6f53588b2796c9190ad98779a6f9)]: - - @apollo/server@4.0.0-alpha.13 - -## 4.0.0-alpha.12 - -### Patch Changes - -- [#6827](https://github.com/apollographql/apollo-server/pull/6827) [`0c2909aa1`](https://github.com/apollographql/apollo-server/commit/0c2909aa1593a9b0abf299b071629a4ab23dc71b) Thanks [@glasser](https://github.com/glasser)! - Experimental support for incremental delivery (`@defer`/`@stream`) when combined with a prerelease of `graphql-js`. - -- [#6850](https://github.com/apollographql/apollo-server/pull/6850) [`256f2424b`](https://github.com/apollographql/apollo-server/commit/256f2424bf6e8420e2582bb2d7a685c810c40bfe) Thanks [@renovate](https://github.com/apps/renovate)! - Expand jest peer deps to include v29 - -- [#6910](https://github.com/apollographql/apollo-server/pull/6910) [`6541f92c9`](https://github.com/apollographql/apollo-server/commit/6541f92c9a0a97b818d637fbac9fb6a2fe14c37c) Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Update snapshot format to future jest v29 default - -- [#6827](https://github.com/apollographql/apollo-server/pull/6827) [`0c2909aa1`](https://github.com/apollographql/apollo-server/commit/0c2909aa1593a9b0abf299b071629a4ab23dc71b) Thanks [@glasser](https://github.com/glasser)! - Support application/graphql-response+json content-type if requested via Accept header, as per graphql-over-http spec. - Include `charset=utf-8` in content-type headers. -- Updated dependencies [[`0c2909aa1`](https://github.com/apollographql/apollo-server/commit/0c2909aa1593a9b0abf299b071629a4ab23dc71b), [`0c2909aa1`](https://github.com/apollographql/apollo-server/commit/0c2909aa1593a9b0abf299b071629a4ab23dc71b)]: - - @apollo/server@4.0.0-alpha.12 - -## 4.0.0-alpha.11 - -### Patch Changes - -- [#6906](https://github.com/apollographql/apollo-server/pull/6906) [`115ab2fa8`](https://github.com/apollographql/apollo-server/commit/115ab2fa8879d532d2de2fe6b0373540bda518e3) Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Relax message requirement for malformed JSON POST to allow default 'Bad Request' - response. -- Updated dependencies [[`6b37d169b`](https://github.com/apollographql/apollo-server/commit/6b37d169bc7163d49efdff37f5a3a5c3404806ff)]: - - @apollo/server@4.0.0-alpha.11 - -## 4.0.0-alpha.10 - -### Patch Changes - -- [#6857](https://github.com/apollographql/apollo-server/pull/6857) [`15b1cb2e9`](https://github.com/apollographql/apollo-server/commit/15b1cb2e96d9ede9007d22f33b2f5a745f071dba) Thanks [@glasser](https://github.com/glasser)! - Errors thrown in resolvers and context functions can use `extensions.http` to affect the response status code and headers. The default behavior when a context function throws is now to always use status code 500 rather than comparing `extensions.code` to `INTERNAL_SERVER_ERROR`. - -- Updated dependencies [[`15b1cb2e9`](https://github.com/apollographql/apollo-server/commit/15b1cb2e96d9ede9007d22f33b2f5a745f071dba)]: - - @apollo/server@4.0.0-alpha.10 - -## 4.0.0-alpha.9 - -### Patch Changes - -- [#6855](https://github.com/apollographql/apollo-server/pull/6855) [`3e4ab3fca`](https://github.com/apollographql/apollo-server/commit/3e4ab3fcafb72027bf3c6359884808ba11381315) Thanks [@glasser](https://github.com/glasser)! - Rename usage reporting option `sendErrorsInTraces` (added in 4.0.0-alpha.4) to `sendErrors`, as it also affects error statistics outside of traces. - -- Updated dependencies [[`3e4ab3fca`](https://github.com/apollographql/apollo-server/commit/3e4ab3fcafb72027bf3c6359884808ba11381315), [`3e4ab3fca`](https://github.com/apollographql/apollo-server/commit/3e4ab3fcafb72027bf3c6359884808ba11381315), [`3e4ab3fca`](https://github.com/apollographql/apollo-server/commit/3e4ab3fcafb72027bf3c6359884808ba11381315), [`3e4ab3fca`](https://github.com/apollographql/apollo-server/commit/3e4ab3fcafb72027bf3c6359884808ba11381315)]: - - @apollo/server@4.0.0-alpha.9 - -## 4.0.0-alpha.8 - -### Patch Changes - -- Updated dependencies [[`3320fee92`](https://github.com/apollographql/apollo-server/commit/3320fee922ffa50080aa63597c84844516583860), [`9fc23f799`](https://github.com/apollographql/apollo-server/commit/9fc23f7995205e8239890197dbeaabc5db6fb073), [`2cab8f785`](https://github.com/apollographql/apollo-server/commit/2cab8f78580f6dacc64a497d06397b5b3cce89f6)]: - - @apollo/server@4.0.0-alpha.8 - -## 4.0.0-alpha.7 - -### Patch Changes - -- [#6817](https://github.com/apollographql/apollo-server/pull/6817) [`eca003fdc`](https://github.com/apollographql/apollo-server/commit/eca003fdc75bdb63153e68119b9891d2bffc6545) Thanks [@glasser](https://github.com/glasser)! - Move ApolloServerPluginGraphQLPlayground into its own package. - -- Updated dependencies [[`eca003fdc`](https://github.com/apollographql/apollo-server/commit/eca003fdc75bdb63153e68119b9891d2bffc6545)]: - - @apollo/server-plugin-landing-page-graphql-playground@4.0.0-alpha.0 - - @apollo/server@4.0.0-alpha.7 - -## 4.0.0-alpha.6 - -### Patch Changes - -- [#6814](https://github.com/apollographql/apollo-server/pull/6814) [`cf0fcf49a`](https://github.com/apollographql/apollo-server/commit/cf0fcf49afa9b8ee12840f5ac4bf1be6320cb7e1) Thanks [@glasser](https://github.com/glasser)! - Several changes relating to plugins: - - - Remove the `server` field on `GraphQLRequestContext` and `GraphQLServerContext` (ie, the arguments to most plugin hook methods). This was added during AS4 development and did not exist in AS3. - - - Add `logger` and `cache` fields to `GraphQLRequestContext` and `GraphQLServerContext`. The `logger` fields and `GraphQLRequestContext.cache` existed in AS3 and had been previously removed for redundancy with the `server` field. (Unlike in AS3, `logger` is readonly.) - - - `ApolloServerPlugin` is now declared as `` rather than ``. This means that you can declare a plugin that doesn't care about `contextValue` to simply implement `ApolloServerPlugin` and it will work with any `ApolloServer`. This should make it easy to write plugins that don't care about context. - - - Remove the ability to specify a factory function as an element of the `plugins` list in the `ApolloServer` constructor. (Reducing the number of ways to specify constructor options helps keep type errors simpler.) As far as we know the main use case for this (referring to the `ApolloServer` itself when creating the plugin) can be handled with the new-in-AS4 `ApolloServer.addPlugin` method. - -- Updated dependencies [[`cf0fcf49a`](https://github.com/apollographql/apollo-server/commit/cf0fcf49afa9b8ee12840f5ac4bf1be6320cb7e1)]: - - @apollo/server@4.0.0-alpha.6 - -## 4.0.0-alpha.5 - -### Patch Changes - -- [#6806](https://github.com/apollographql/apollo-server/pull/6806) [`bccc230f0`](https://github.com/apollographql/apollo-server/commit/bccc230f05761c15098df9a5e9f57f0c65cf4fa6) Thanks [@glasser](https://github.com/glasser)! - Rename response.http.statusCode back to status like it was in AS3. - -- Updated dependencies [[`bccc230f0`](https://github.com/apollographql/apollo-server/commit/bccc230f05761c15098df9a5e9f57f0c65cf4fa6)]: - - @apollo/server@4.0.0-alpha.5 - -## 4.0.0-alpha.4 - -### Patch Changes - -- [#6795](https://github.com/apollographql/apollo-server/pull/6795) [`363fd308d`](https://github.com/apollographql/apollo-server/commit/363fd308d09c8df0428b059cbe6743a723ac65b2) Thanks [@bonnici](https://github.com/bonnici)! - Added unit tests to cover `unmodified` and `masked` error reporting options - -* [#6794](https://github.com/apollographql/apollo-server/pull/6794) [`7445d3377`](https://github.com/apollographql/apollo-server/commit/7445d3377d16cdc65506131572c0a616d3a6324c) Thanks [@glasser](https://github.com/glasser)! - Usage reporting and inline trace plugins: replace `rewriteError` with `sendErrorsInTraces`/`includeErrors`, and mask all errors by default. - -* Updated dependencies [[`13f809ca6`](https://github.com/apollographql/apollo-server/commit/13f809ca6c5e1f0be9d05823f1194a8743321a79), [`96178c570`](https://github.com/apollographql/apollo-server/commit/96178c57070af574fbcff7f51b73924c576725db), [`400f7867b`](https://github.com/apollographql/apollo-server/commit/400f7867b521359fd7213547c88fcf3fc8fbe94c), [`7445d3377`](https://github.com/apollographql/apollo-server/commit/7445d3377d16cdc65506131572c0a616d3a6324c)]: - - @apollo/server@4.0.0-alpha.4 - -## 4.0.0-alpha.3 - -### Patch Changes - -- [#6771](https://github.com/apollographql/apollo-server/pull/6771) [`bce9150f3`](https://github.com/apollographql/apollo-server/commit/bce9150f31d6fd58b7a6622611ec7b35b3564aa6) Thanks [@glasser](https://github.com/glasser)! - Support Gateway. Remove executor constructor option. - -* [#6764](https://github.com/apollographql/apollo-server/pull/6764) [`c4115e96a`](https://github.com/apollographql/apollo-server/commit/c4115e96ac75e04cffe1c3353fc03ea65dcab909) Thanks [@glasser](https://github.com/glasser)! - Get cache-control types from @apollo/cache-control-types; no more `declare module` for info.cacheControl - -- [#6759](https://github.com/apollographql/apollo-server/pull/6759) [`6ef6a090c`](https://github.com/apollographql/apollo-server/commit/6ef6a090cff26f5d98e9965cd839307931e12516) Thanks [@glasser](https://github.com/glasser)! - Refactor error formatting. - - Remove `error.extensions.exception`; you can add it back yourself with `formatError`. `error.extensions.exception.stacktrace` is now available on `error.extensions.stacktrace`. - - Provide `unwrapResolverError` function in `@apollo/server/errors`; useful for your `formatError` hook. - - No more TS `declare module` describing the `exception` extension (partially incorrectly). - - Rename the (new in v4) constructor option `includeStackTracesInErrorResponses` to `includeStacktraceInErrorResponses`. - -- Updated dependencies [[`bce9150f3`](https://github.com/apollographql/apollo-server/commit/bce9150f31d6fd58b7a6622611ec7b35b3564aa6), [`c4115e96a`](https://github.com/apollographql/apollo-server/commit/c4115e96ac75e04cffe1c3353fc03ea65dcab909), [`6ef6a090c`](https://github.com/apollographql/apollo-server/commit/6ef6a090cff26f5d98e9965cd839307931e12516), [`536e038a7`](https://github.com/apollographql/apollo-server/commit/536e038a744738f740072781f32e83a360ec0744)]: - - @apollo/server@4.0.0-alpha.3 - -## 4.0.0-alpha.2 - -### Patch Changes - -- [#6760](https://github.com/apollographql/apollo-server/pull/6760) [`052f1b548`](https://github.com/apollographql/apollo-server/commit/052f1b548c7f882d4cee1c6730cd15463086af6b) Thanks [@glasser](https://github.com/glasser)! - Relax error-handling expectations to work better with Fastify - -- Updated dependencies [[`f736b4980`](https://github.com/apollographql/apollo-server/commit/f736b4980b39f3b563939b100eff85e073189cb1)]: - - @apollo/server@4.0.0-alpha.2 - -## 4.0.0-alpha.1 - -### Patch Changes - -- [#6357](https://github.com/apollographql/apollo-server/pull/6357) [`7c3c825d8`](https://github.com/apollographql/apollo-server/commit/7c3c825d834ddad778de8b6d4254e56613fe8534) Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Export ApolloServerErrorCode enum instead of error classes. HTTPGraphQLRequest takes search params as raw string. - -- Updated dependencies [[`7c3c825d8`](https://github.com/apollographql/apollo-server/commit/7c3c825d834ddad778de8b6d4254e56613fe8534)]: - - @apollo/server@4.0.0-alpha.1 - - @apollo/usage-reporting-protobuf@4.0.0-alpha.1 - -## 4.0.0-alpha.0 - -### Major Changes - -- [`f39d9eec7`](https://github.com/apollographql/apollo-server/commit/f39d9eec7ab72d0f471a0bb0646dd42ad81c56cf) Thanks [@glasser](https://github.com/glasser)! - Initial Apollo Server 4 release - -### Patch Changes - -- Updated dependencies [[`f39d9eec7`](https://github.com/apollographql/apollo-server/commit/f39d9eec7ab72d0f471a0bb0646dd42ad81c56cf)]: - - @apollo/server@4.0.0-alpha.0 - - @apollo/usage-reporting-protobuf@4.0.0-alpha.0 +Initial release of `@apollo/server-integration-testsuite`. diff --git a/packages/integration-testsuite/package.json b/packages/integration-testsuite/package.json index e8f87e690cf..fc041d4677b 100644 --- a/packages/integration-testsuite/package.json +++ b/packages/integration-testsuite/package.json @@ -1,6 +1,6 @@ { "name": "@apollo/server-integration-testsuite", - "version": "4.0.0-rc.18", + "version": "4.0.0", "description": "Test suite for Apollo Server integrations", "type": "module", "main": "dist/index.js", @@ -29,10 +29,10 @@ "dependencies": { "@apollo/cache-control-types": "^1.0.2", "@apollo/client": "^3.6.9", - "@apollo/server-plugin-landing-page-graphql-playground": "^4.0.0-alpha.0", + "@apollo/server-plugin-landing-page-graphql-playground": "^4.0.0", "@apollo/utils.keyvaluecache": "^1.0.1", "@apollo/utils.createhash": "^1.1.0", - "@apollo/usage-reporting-protobuf": "^4.0.0-rc.2", + "@apollo/usage-reporting-protobuf": "^4.0.0", "@josephg/resolvable": "^1.0.1", "body-parser": "^1.20.0", "express": "^4.18.1", @@ -42,7 +42,7 @@ "supertest": "^6.2.3" }, "peerDependencies": { - "@apollo/server": "^4.0.0-rc.18", + "@apollo/server": "^4.0.0", "@jest/globals": "28.x || 29.x", "graphql": "^16.6.0", "jest": "28.x || 29.x" diff --git a/packages/plugin-landing-page-graphql-playground/CHANGELOG.md b/packages/plugin-landing-page-graphql-playground/CHANGELOG.md index 029fddf184b..3958ad3e67a 100644 --- a/packages/plugin-landing-page-graphql-playground/CHANGELOG.md +++ b/packages/plugin-landing-page-graphql-playground/CHANGELOG.md @@ -1,12 +1,7 @@ # @apollo/server-plugin-landing-page-graphql-playground -## 4.0.0-alpha.0 +## 4.0.0 -### Major Changes +One-time release of `@apollo/server-plugin-landing-page-graphql-playground` with support for Apollo Server 4. The version of this plugin designed for Apollo Server 2 and 3 was part of `apollo-server-core`. -- [#6817](https://github.com/apollographql/apollo-server/pull/6817) [`eca003fdc`](https://github.com/apollographql/apollo-server/commit/eca003fdc75bdb63153e68119b9891d2bffc6545) Thanks [@glasser](https://github.com/glasser)! - Move ApolloServerPluginGraphQLPlayground into its own package. - -### Patch Changes - -- Updated dependencies [[`eca003fdc`](https://github.com/apollographql/apollo-server/commit/eca003fdc75bdb63153e68119b9891d2bffc6545)]: - - @apollo/server@4.0.0-alpha.7 +Note: this package is not officially supported by Apollo. This package exists for migration purposes only. We do not intend to resolve security issues or other bugs with this package if they arise, so please migrate away from this to Apollo Server's default Explorer as soon as possible. diff --git a/packages/plugin-landing-page-graphql-playground/package.json b/packages/plugin-landing-page-graphql-playground/package.json index 9689efbab05..083f0d65269 100644 --- a/packages/plugin-landing-page-graphql-playground/package.json +++ b/packages/plugin-landing-page-graphql-playground/package.json @@ -1,6 +1,6 @@ { "name": "@apollo/server-plugin-landing-page-graphql-playground", - "version": "4.0.0-alpha.0", + "version": "4.0.0", "description": "Apollo Server landing page plugin for GraphQL Playground", "type": "module", "main": "dist/cjs/index.js", @@ -33,6 +33,6 @@ "@apollographql/graphql-playground-html": "1.6.29" }, "peerDependencies": { - "@apollo/server": "^4.0.0-alpha.7" + "@apollo/server": "^4.0.0" } } diff --git a/packages/plugin-response-cache/CHANGELOG.md b/packages/plugin-response-cache/CHANGELOG.md index e857c83bffc..4664353ee64 100644 --- a/packages/plugin-response-cache/CHANGELOG.md +++ b/packages/plugin-response-cache/CHANGELOG.md @@ -1,74 +1,5 @@ # @apollo/server-plugin-response-cache -## 4.0.0-rc.6 +## 4.0.0 -### Patch Changes - -- [#6961](https://github.com/apollographql/apollo-server/pull/6961) [`a782c791f`](https://github.com/apollographql/apollo-server/commit/a782c791f4f616e36a0036dcabb4d928a7c3f871) Thanks [@glasser](https://github.com/glasser)! - Require graphql@16.6 as a peer dependency. - -- Updated dependencies [[`a782c791f`](https://github.com/apollographql/apollo-server/commit/a782c791f4f616e36a0036dcabb4d928a7c3f871), [`d3ea2d4ef`](https://github.com/apollographql/apollo-server/commit/d3ea2d4ef137519d073185dea778e39e89a301c2)]: - - @apollo/server@4.0.0-rc.14 - -## 4.0.0-alpha.5 - -### Patch Changes - -- [#6827](https://github.com/apollographql/apollo-server/pull/6827) [`0c2909aa1`](https://github.com/apollographql/apollo-server/commit/0c2909aa1593a9b0abf299b071629a4ab23dc71b) Thanks [@glasser](https://github.com/glasser)! - Experimental support for incremental delivery (`@defer`/`@stream`) when combined with a prerelease of `graphql-js`. - -- Updated dependencies [[`0c2909aa1`](https://github.com/apollographql/apollo-server/commit/0c2909aa1593a9b0abf299b071629a4ab23dc71b), [`0c2909aa1`](https://github.com/apollographql/apollo-server/commit/0c2909aa1593a9b0abf299b071629a4ab23dc71b)]: - - @apollo/server@4.0.0-alpha.12 - -## 4.0.0-alpha.4 - -### Patch Changes - -- [#6814](https://github.com/apollographql/apollo-server/pull/6814) [`cf0fcf49a`](https://github.com/apollographql/apollo-server/commit/cf0fcf49afa9b8ee12840f5ac4bf1be6320cb7e1) Thanks [@glasser](https://github.com/glasser)! - Several changes relating to plugins: - - - Remove the `server` field on `GraphQLRequestContext` and `GraphQLServerContext` (ie, the arguments to most plugin hook methods). This was added during AS4 development and did not exist in AS3. - - - Add `logger` and `cache` fields to `GraphQLRequestContext` and `GraphQLServerContext`. The `logger` fields and `GraphQLRequestContext.cache` existed in AS3 and had been previously removed for redundancy with the `server` field. (Unlike in AS3, `logger` is readonly.) - - - `ApolloServerPlugin` is now declared as `` rather than ``. This means that you can declare a plugin that doesn't care about `contextValue` to simply implement `ApolloServerPlugin` and it will work with any `ApolloServer`. This should make it easy to write plugins that don't care about context. - - - Remove the ability to specify a factory function as an element of the `plugins` list in the `ApolloServer` constructor. (Reducing the number of ways to specify constructor options helps keep type errors simpler.) As far as we know the main use case for this (referring to the `ApolloServer` itself when creating the plugin) can be handled with the new-in-AS4 `ApolloServer.addPlugin` method. - -- Updated dependencies [[`cf0fcf49a`](https://github.com/apollographql/apollo-server/commit/cf0fcf49afa9b8ee12840f5ac4bf1be6320cb7e1)]: - - @apollo/server@4.0.0-alpha.6 - -## 4.0.0-alpha.3 - -### Patch Changes - -- [#6806](https://github.com/apollographql/apollo-server/pull/6806) [`bccc230f0`](https://github.com/apollographql/apollo-server/commit/bccc230f05761c15098df9a5e9f57f0c65cf4fa6) Thanks [@glasser](https://github.com/glasser)! - Rename response.http.statusCode back to status like it was in AS3. - -- Updated dependencies [[`bccc230f0`](https://github.com/apollographql/apollo-server/commit/bccc230f05761c15098df9a5e9f57f0c65cf4fa6)]: - - @apollo/server@4.0.0-alpha.5 - -## 4.0.0-alpha.2 - -### Patch Changes - -- [#6764](https://github.com/apollographql/apollo-server/pull/6764) [`c4115e96a`](https://github.com/apollographql/apollo-server/commit/c4115e96ac75e04cffe1c3353fc03ea65dcab909) Thanks [@glasser](https://github.com/glasser)! - Get cache-control types from @apollo/cache-control-types; no more `declare module` for info.cacheControl - -- Updated dependencies [[`bce9150f3`](https://github.com/apollographql/apollo-server/commit/bce9150f31d6fd58b7a6622611ec7b35b3564aa6), [`c4115e96a`](https://github.com/apollographql/apollo-server/commit/c4115e96ac75e04cffe1c3353fc03ea65dcab909), [`6ef6a090c`](https://github.com/apollographql/apollo-server/commit/6ef6a090cff26f5d98e9965cd839307931e12516), [`536e038a7`](https://github.com/apollographql/apollo-server/commit/536e038a744738f740072781f32e83a360ec0744)]: - - @apollo/server@4.0.0-alpha.3 - -## 4.0.0-alpha.1 - -### Patch Changes - -- [#6357](https://github.com/apollographql/apollo-server/pull/6357) [`7c3c825d8`](https://github.com/apollographql/apollo-server/commit/7c3c825d834ddad778de8b6d4254e56613fe8534) Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Export ApolloServerErrorCode enum instead of error classes. HTTPGraphQLRequest takes search params as raw string. - -- Updated dependencies [[`7c3c825d8`](https://github.com/apollographql/apollo-server/commit/7c3c825d834ddad778de8b6d4254e56613fe8534)]: - - @apollo/server@4.0.0-alpha.1 - -## 4.0.0-alpha.0 - -### Major Changes - -- [`f39d9eec7`](https://github.com/apollographql/apollo-server/commit/f39d9eec7ab72d0f471a0bb0646dd42ad81c56cf) Thanks [@glasser](https://github.com/glasser)! - Initial Apollo Server 4 release - -### Patch Changes - -- Updated dependencies [[`f39d9eec7`](https://github.com/apollographql/apollo-server/commit/f39d9eec7ab72d0f471a0bb0646dd42ad81c56cf)]: - - @apollo/server@4.0.0-alpha.0 +Initial release of `@apollo/server-plugin-response-cache` with support for Apollo Server 4. The version of this plugin designed for Apollo Server 2 and 3 was named `apollo-server-plugin-response-cache`. diff --git a/packages/plugin-response-cache/package.json b/packages/plugin-response-cache/package.json index 6df41a87764..6c9b2ffc1c0 100644 --- a/packages/plugin-response-cache/package.json +++ b/packages/plugin-response-cache/package.json @@ -1,6 +1,6 @@ { "name": "@apollo/server-plugin-response-cache", - "version": "4.0.0-rc.6", + "version": "4.0.0", "description": "Apollo Server full query response cache", "type": "module", "main": "dist/cjs/index.js", @@ -33,7 +33,7 @@ "@apollo/utils.keyvaluecache": "^1.0.1" }, "peerDependencies": { - "@apollo/server": "^4.0.0-rc.14", + "@apollo/server": "^4.0.0", "graphql": "^16.6.0" } } diff --git a/packages/server/CHANGELOG.md b/packages/server/CHANGELOG.md index 040ed0ec2da..70cb3fb1e11 100644 --- a/packages/server/CHANGELOG.md +++ b/packages/server/CHANGELOG.md @@ -1,169 +1,121 @@ # @apollo/server -## 4.0.0-rc.18 +## 4.0.0 -## 4.0.0-rc.17 +### BREAKING CHANGES -### Patch Changes +Apollo Server contains quite a few breaking changes: most notably, a brand new package name! Read our [migration guide](https://www.apollographql.com/docs/apollo-server/migration/) for more details on how to update your app. -- [#6998](https://github.com/apollographql/apollo-server/pull/6998) [`233b44eea`](https://github.com/apollographql/apollo-server/commit/233b44eea5031364d88df38afede0b8771c27661) Thanks [@glasser](https://github.com/glasser)! - Fix a slow memory leak in the usage reporting plugin (#6983). -## 4.0.0-rc.16 +#### Bumped dependencies -### Patch Changes +The minimum versions of these dependencies have been bumped to provide an improved foundation for the development of future features. -- [#6986](https://github.com/apollographql/apollo-server/pull/6986) [`db5d715a3`](https://github.com/apollographql/apollo-server/commit/db5d715a38fc4b24e45a045440b593018a5d170e) Thanks [@glasser](https://github.com/glasser)! - The cache control plugin sets `cache-control: no-store` for uncacheable responses. Pass `calculateHttpHeaders: 'if-cacheable'` to the cache control plugin to restore AS3 behavior. +- Dropped support for Node.js v12, which is no longer under [long-term support](https://nodejs.org/en/about/releases/#releases) from the Node.js Foundation. +- Dropped support for versions of the `graphql` library prior to `v16.6.0`. + - Upgrading `graphql` may require you to upgrade other libraries that are installed in your project. For example, if you use Apollo Server with Apollo Gateway, you should upgrade Apollo Gateway to at least v0.50.1 or any v2.x version for full `graphql` 16 support before upgrading to Apollo Server 4. +- If you use Apollo Server with TypeScript, you must use TypeScript v4.7.0 or newer. -## 4.0.0-rc.15 -### Patch Changes +#### New package structure -- [#6897](https://github.com/apollographql/apollo-server/pull/6897) [`e1455d583`](https://github.com/apollographql/apollo-server/commit/e1455d58366517b633cc4412e3c2f9e80d7a4f22) Thanks [@bonnici](https://github.com/bonnici)! - Usage reporting: always send traces over 10MB as stats. +Apollo Server 4 is distributed in the `@apollo/server` package. This package replaces `apollo-server`, `apollo-server-core`, `apollo-server-express`, `apollo-server-errors`, `apollo-server-types`, and `apollo-server-plugin-base`. -- Updated dependencies [[`d20842824`](https://github.com/apollographql/apollo-server/commit/d208428248532d55249cad5ea3912dd097232831)]: - - @apollo/usage-reporting-protobuf@4.0.0-rc.2 +The `@apollo/server` package exports the `ApolloServer` class. In Apollo Server 3, individual web framework integrations had their own subclasses of `ApolloServer`. In Apollo Server 4, there is a single `ApolloServer` class; web framework integrations define their own functions which use a new stable integration API on `ApolloServer` to execute operations. -## 4.0.0-rc.14 +Other functionality is exported from "deep imports" on `@apollo/server`. `startStandaloneServer` (the replacement for the batteries-included `apollo-server` package) is exported from `@apollo/server/standalone`. `expressMiddleware` (the replacement for `apollo-server-express`) is exported from `@apollo/server/express4`. Plugins such as `ApolloServerPluginUsageReporting` are exported from paths such as `@apollo/server/plugin/usageReporting`. -### Patch Changes +The `@apollo/server` package is built natively as both an ECMAScript Module (ESM) and as a CommonJS module (CJS); Apollo Server 3 was only built as CJS. This allows ESM-native bundlers to create more efficient bundles. -- [#6961](https://github.com/apollographql/apollo-server/pull/6961) [`a782c791f`](https://github.com/apollographql/apollo-server/commit/a782c791f4f616e36a0036dcabb4d928a7c3f871) Thanks [@glasser](https://github.com/glasser)! - Require graphql@16.6 as a peer dependency. +Other packages have been renamed: +- `apollo-datasource-rest` is now [`@apollo/datasource-rest`](https://www.npmjs.com/package/@apollo/datasource-rest). +- `apollo-server-plugin-response-cache` is now [`@apollo/server-plugin-response-cache`](https://www.npmjs.com/package/@apollo/server-plugin-response-cache). +- `apollo-server-plugin-operation-registry` is now [`@apollo/server-plugin-operation-registry`](https://www.npmjs.com/package/@apollo/server-plugin-operation-registry). +- `apollo-reporting-protobuf` (an internal implementation detail for the usage reporting plugin) is now [`@apollo/usage-reporting-protobuf`](https://www.npmjs.com/package/@apollo/usage-reporting-protobuf). -- [#6960](https://github.com/apollographql/apollo-server/pull/6960) [`d3ea2d4ef`](https://github.com/apollographql/apollo-server/commit/d3ea2d4ef137519d073185dea778e39e89a301c2) Thanks [@glasser](https://github.com/glasser)! - Add generics for response data and variables to server.executeOperation; allow inference from TypedQueryDocumentNode. -## 4.0.0-alpha.13 +#### Removed web framework integrations -### Patch Changes +Prior to Apollo Server 4, the only way to integrate a web framework with Apollo Server was for the Apollo Server project to add an official `apollo-server-x` subclass maintained as part of the core project. Apollo Server 4 makes it easy for users to integrate with their favorite web framework, and so we have removed most of the framework integrations from the core project so that framework integrations can be maintained by users who are passionate about that framework. Because of this, the core project no longer directly maintains integrations for Fastify, Hapi, Koa, Micro, AWS Lambda,Google Cloud Functions, Azure Functions, or Cloudflare. We expect that [community integrations](https://www.apollographql.com/docs/apollo-server/v4/integrations/integration-index/) will eventually be created for most of these frameworks and serverless environments. -- [#6936](https://github.com/apollographql/apollo-server/pull/6936) [`a404bf17e`](https://github.com/apollographql/apollo-server/commit/a404bf17e86d6f53588b2796c9190ad98779a6f9) Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Update executeOperation second parameter to be an optional options object which includes an optional `contextValue`. +Apollo Server's support for the Express web framework no longer also supports its older predecessor [Connect](https://github.com/senchalabs/connect). -- [#6936](https://github.com/apollographql/apollo-server/pull/6936) [`a404bf17e`](https://github.com/apollographql/apollo-server/commit/a404bf17e86d6f53588b2796c9190ad98779a6f9) Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - `HTTPGraphQLRequest` now uses a specific `HeaderMap` class which we export instead of allowing a standard `Map`. The `HeaderMap` downcases all incoming keys, as header names are not case-sensitive. -- [#6936](https://github.com/apollographql/apollo-server/pull/6936) [`a404bf17e`](https://github.com/apollographql/apollo-server/commit/a404bf17e86d6f53588b2796c9190ad98779a6f9) Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Update `validationRules` typing for correctness. This is sort of a breaking change for TS users in that the types were more permissive than they should have been. All `validationRules` list items should conform to the `graphql-js` `ValidationRule` type. +#### Removed constructor options -## 4.0.0-alpha.12 +- The `dataSources` constructor option essentially added a post-processing step to your app's context function, creating `DataSource` subclasses and adding them to a `dataSources` field on your context value. This meant the TypeScript type the `context` function returns was _different_ from the context type your resolvers and plugins receive. Additionally, this design obfuscated that `DataSource` objects are created once per request (i.e., like the rest of the context object). Apollo Server 4 removes the `dataSources` constructor option. You can now treat `DataSources` like any other part of your `context` object. See the [migration guide](https://www.apollographql.com/docs/apollo-server/migration/) for details on how to move your `dataSources` function into your `context` function. +- The `modules` constructor option was just a slightly different way of writing `typeDefs` and `resolvers` (although it surprisingly used entirely different logic under the hood). This option has been removed. +- The `mocks` and `mockEntireSchema` constructor options wrapped an outdated version of the [`@graphql-tools/mocks`](https://www.npmjs.com/package/@graphql-tools/mock) library to provide mocking functionality. These constructor options have been removed; you can instead directly incorporate the `@graphql-tools/mock` package into your app, enabling you to get the most up-to-date mocking features. +- The `debug` constructor option (which defaulted to `true` unless the `NODE_ENV` environment variable is either `production` or `test`) mostly controlled whether GraphQL errors responses included stack traces, but it also affected the default log level on the default logger. The `debug` constructor option has been removed and is replaced with `includeStacktraceInErrorResponses`, which does exactly what it says it does. +- The `formatResponse` constructor option has been removed; its functionality can be replaced by the `willSendResponse` plugin hook. +- The `executor` constructor option has been removed; the ability to replace `graphql-js`'s execution functionality is still available via the `gateway` option. -### Patch Changes +#### Removed features -- [#6827](https://github.com/apollographql/apollo-server/pull/6827) [`0c2909aa1`](https://github.com/apollographql/apollo-server/commit/0c2909aa1593a9b0abf299b071629a4ab23dc71b) Thanks [@glasser](https://github.com/glasser)! - Experimental support for incremental delivery (`@defer`/`@stream`) when combined with a prerelease of `graphql-js`. +- Apollo Server 4 no longer responds to health checks on the path `/.well-known/apollo/server-health`. You can run a trivial GraphQL operation as a health check, or you can add a custom health check via your web framework. +- Apollo Server 4 no longer cares what URL path is used to access its functionality. Instead of specifying the `path` option to various Apollo Server methods, just use your web framework's routing feature to mount the Apollo Server integration at the appropriate path. +- Apollo Server 4's Express middleware no longer wraps the `body-parser` and `cors` middleware; it is your responsibility to install and set up these middleware yourself when using a framework integration. (The standalone HTTP server sets up body parsing and CORS for you, but without the ability to configure their details.) +- Apollo Server no longer re-exports the `gql` tag function from `graphql-tag`. If you want to use `gql`, install the `graphql-tag` package. +- Apollo Server no longer defines its own `ApolloError` class and `toApolloError` function. Instead, use `GraphQLError` from the `graphql` package. +- Apollo Server no longer exports error subclasses representing the errors that it creates, such as `SyntaxError`. Instead, it exports an enum `ApolloServerErrorCode` that you can use to recognize errors created by Apollo Server. +- Apollo Server no longer exports the `ForbiddenError` and `AuthenticationError` classes. Instead, you can define your own error codes for these errors or other errors. +- The undocumented `__resolveObject` pseudo-resolver is no longer supported. +- The `requestAgent` option to `ApolloServerPluginUsageReporting` has been removed. +- In the JSON body of a `POST` request, the `variables` and `extensions` fields must be objects, not JSON-encoded strings. +- The core Apollo Server packages no longer provide a landing page plugin for the unmaintained GraphQL Playground UI. We have published an Apollo Server 4-compatible landing page plugin in the package `@apollo/server-plugin-landing-page-graphql-playground`, but do not intend to maintain it further after this one-time publish. -- [#6827](https://github.com/apollographql/apollo-server/pull/6827) [`0c2909aa1`](https://github.com/apollographql/apollo-server/commit/0c2909aa1593a9b0abf299b071629a4ab23dc71b) Thanks [@glasser](https://github.com/glasser)! - Support application/graphql-response+json content-type if requested via Accept header, as per graphql-over-http spec. - Include `charset=utf-8` in content-type headers. +#### Modified functionality -## 4.0.0-alpha.11 +- The `context` function is now provided to your integration function (such as `startStandaloneServer` or `expressMiddleware`) rather than to the `new ApolloServer` constructor. +- The `executeOperation` method now directly accepts a context value, rather than accepting the arguments to your `context` function. +- The `formatError` hook now receives the original thrown error in addition to the formatted error. +- Formatted errors no longer contain the `extensions.exception` field containing all enumerable properties of the originally thrown error. If you want to include more information in an error, specify them as `extensions` when creating a `GraphQLError`. The `stacktrace` field is provided directly on `extensions` rather than nested under `exception`. +- All errors responses are consistently rendered as `application/json` JSON responses, and the `formatError` hook is used consistently. +- Other [changes to error handling outside of resolvers](https://www.apollographql.com/docs/apollo-server/migration/#improvements-to-error-handling-outside-of-resolvers) are described in the migration guide. +- The `parseOptions` constructor option only affects the parsing of incoming operations, not the parsing of `typeDefs`. -### Patch Changes -- [#6879](https://github.com/apollographql/apollo-server/pull/6879) [`6b37d169b`](https://github.com/apollographql/apollo-server/commit/6b37d169bc7163d49efdff37f5a3a5c3404806ff) Thanks [@bonnici](https://github.com/bonnici)! - Fixed usage reporting plugin log message +#### Plugin API changes -## 4.0.0-alpha.10 +- The field `GraphQLRequestContext.context` has been renamed to `contextValue`. +- The field `GraphQLRequestContext.logger` is now readonly. +- The fields `GraphQLRequestContext.schemaHash` and `GraphQLRequestContext.debug` have been removed. +- The type `GraphQLServiceContext` has been renamed to `GraphQLServerContext`, and the fields `schemaHash`, `persistedQueries`, and `serverlessFramework` have been removed; the latter has been semi-replaced by `startedInBackground`. +- The `http` field on the `GraphQLRequest` object (available to plugins as `requestContext.request` and as an argument to `server.executeOperation`) is no longer based on the Fetch API's `Request` object. It no longer contains an URL path, and its `headers` field is a `Map` rather than a `Headers` object. +- The structure of the `GraphQLResponse` object (available to plugins as `requestContext.response` and as the return value from `server.executeOperation`) has [changed in several ways](https://www.apollographql.com/docs/apollo-server/migration/#graphqlresponse). +- The `plugins` constructor argument does not take factory functions. +- `requestDidStart` hooks are called in parallel rather than in series. +- A few changes have been made which may affect [custom `gateway` and `GraphQLDataSource` implementations](https://www.apollographql.com/docs/apollo-server/migration/#custom-gateway-and-graphqldatasource-implementations). -### Patch Changes -- [#6857](https://github.com/apollographql/apollo-server/pull/6857) [`15b1cb2e9`](https://github.com/apollographql/apollo-server/commit/15b1cb2e96d9ede9007d22f33b2f5a745f071dba) Thanks [@glasser](https://github.com/glasser)! - Errors thrown in resolvers and context functions can use `extensions.http` to affect the response status code and headers. The default behavior when a context function throws is now to always use status code 500 rather than comparing `extensions.code` to `INTERNAL_SERVER_ERROR`. +#### Changes to defaults -## 4.0.0-alpha.9 +- CSRF prevention is on by default. +- HTTP batching is disabled by default. +- The default in-memory cache is bounded. +- The local landing page defaults to the *embedded* Apollo Sandbox; this provides a user interface for executing GraphQL operations which doesn't require any additional CORS configuration. +- The usage reporting and inline trace plugins mask errors in their reports by default: error messages are replaced with `` and error extensions are replaced with a single extension `maskedBy`. This can be configured with the `sendErrors` option to `ApolloServerPluginUsageReporting` and the `includeErrors` option to `ApolloServerPluginInlineTrace`. The `rewriteError` option to these plugins has been removed; its functionality is subsumed by the new options. -### Patch Changes +#### TypeScript-specific changes -- [#6855](https://github.com/apollographql/apollo-server/pull/6855) [`3e4ab3fca`](https://github.com/apollographql/apollo-server/commit/3e4ab3fcafb72027bf3c6359884808ba11381315) Thanks [@glasser](https://github.com/glasser)! - New usage reporting option `sendTraces: false` to only send usage reports as aggregated statistics, not per-request traces. +- The TypeScript types for the `validationRules` constructor option are more accurate. +- We now use the `@apollo/utils.fetcher` package to define the shape of the Fetch API, instead of `apollo-server-env`. This package only supports argument structures that are likely to be compatible across implementations of the Fetch API. +- The `CacheScope`, `CacheHint`, `CacheAnnotation`, `CachePolicy`, and `ResolveInfoCacheControl` types are now exported from the `@apollo/cache-control-types` package. `CacheScope` is now a pure TypeScript type rather than an enum. +- The type for `ApolloServer`'s constructor options argument is now `ApolloServerOptions`, not `Config` or `ApolloServerExpressConfig`. +- Some other types have been renamed or removed; see the migration guide for details. -* [#6855](https://github.com/apollographql/apollo-server/pull/6855) [`3e4ab3fca`](https://github.com/apollographql/apollo-server/commit/3e4ab3fcafb72027bf3c6359884808ba11381315) Thanks [@glasser](https://github.com/glasser)! - Remove Apollo-internal `internal_includeTracesContributingToStats`. This should not have been used other than inside Apollo's own servers. +### New features -- [#6855](https://github.com/apollographql/apollo-server/pull/6855) [`3e4ab3fca`](https://github.com/apollographql/apollo-server/commit/3e4ab3fcafb72027bf3c6359884808ba11381315) Thanks [@glasser](https://github.com/glasser)! - The usage reporting option `debugPrintReports` now displays reports via `logger.info` rather than `logger.warn`. +- In TypeScript, you can now declare your server's context value type using generic type syntax, like `new ApolloServer`. This ensures that the type returned by your context function matches the context type provided to your resolvers and plugins. +- `ApolloServer` now has a well-documented API for integrating with web frameworks, featuring the new `executeHTTPGraphQLRequest` method. +- `ApolloServer` now has explicit support for the "serverless" style of startup error handling. Serverless frameworks generally do not allow handlers to do "async" work during startup, so any failure to load the schema or run `serverWillStart` handlers can't prevent requests from being served. Apollo Server 4 provides a `server.startInBackgroundHandlingStartupErrorsByLoggingAndFailingAllRequests()` method as an alternative to `await server.start()` for use in contexts like serverless environments. +- You can add a plugin to a server with `server.addPlugin()`. Plugins can only be added before the server is `start`ed. This allows you to pass the server itself as an argument to the plugin. +- `ApolloServer` has new public readonly `cache` and `logger` fields. +- When combined with `graphql` v17 (only available as pre-releases as of September 2022), Apollo Server now has experimental support for [incremental delivery](https://www.apollographql.com/docs/apollo-server/workflow/requests/#incremental-delivery-experimental) directives such as `@defer` and `@stream`. +- Apollo Server 4 adds new plugin hooks `startupDidFail`, `contextCreationDidFail`, `invalidRequestWasReceived`, `unexpectedErrorProcessingRequest`, `didEncounterSubsequentErrors`, and `willSendSubsequentPayload`. +- If Apollo Server receives an operation while the server is shutting down, it now logs a warning telling you to properly configure HTTP server draining. +- Apollo Server now supports responses with `content-type: application/graphql-response+json` when requested by clients via the `accept` header, as described in the [GraphQL over HTTP specification proposal](https://github.com/graphql/graphql-over-http). -* [#6855](https://github.com/apollographql/apollo-server/pull/6855) [`3e4ab3fca`](https://github.com/apollographql/apollo-server/commit/3e4ab3fcafb72027bf3c6359884808ba11381315) Thanks [@glasser](https://github.com/glasser)! - Rename usage reporting option `sendErrorsInTraces` (added in 4.0.0-alpha.4) to `sendErrors`, as it also affects error statistics outside of traces. +## Versions prior to 4.0.0 -## 4.0.0-alpha.8 - -### Patch Changes - -- [#6841](https://github.com/apollographql/apollo-server/pull/6841) [`3320fee92`](https://github.com/apollographql/apollo-server/commit/3320fee922ffa50080aa63597c84844516583860) Thanks [@glasser](https://github.com/glasser)! - Upgrade @apollo/server-gateway-interface to have laxer definition of overallCachePolicy. - -* [#6731](https://github.com/apollographql/apollo-server/pull/6731) [`9fc23f799`](https://github.com/apollographql/apollo-server/commit/9fc23f7995205e8239890197dbeaabc5db6fb073) Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Use extensions for all imports to accommodate TS users using moduleResolution: "nodenext" - -- [#6846](https://github.com/apollographql/apollo-server/pull/6846) [`2cab8f785`](https://github.com/apollographql/apollo-server/commit/2cab8f78580f6dacc64a497d06397b5b3cce89f6) Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Ensure executionDidEnd hooks are only called once (when they throw) - -## 4.0.0-alpha.7 - -### Patch Changes - -- [#6817](https://github.com/apollographql/apollo-server/pull/6817) [`eca003fdc`](https://github.com/apollographql/apollo-server/commit/eca003fdc75bdb63153e68119b9891d2bffc6545) Thanks [@glasser](https://github.com/glasser)! - Move ApolloServerPluginGraphQLPlayground into its own package. - -## 4.0.0-alpha.6 - -### Patch Changes - -- [#6814](https://github.com/apollographql/apollo-server/pull/6814) [`cf0fcf49a`](https://github.com/apollographql/apollo-server/commit/cf0fcf49afa9b8ee12840f5ac4bf1be6320cb7e1) Thanks [@glasser](https://github.com/glasser)! - Several changes relating to plugins: - - - Remove the `server` field on `GraphQLRequestContext` and `GraphQLServerContext` (ie, the arguments to most plugin hook methods). This was added during AS4 development and did not exist in AS3. - - - Add `logger` and `cache` fields to `GraphQLRequestContext` and `GraphQLServerContext`. The `logger` fields and `GraphQLRequestContext.cache` existed in AS3 and had been previously removed for redundancy with the `server` field. (Unlike in AS3, `logger` is readonly.) - - - `ApolloServerPlugin` is now declared as `` rather than ``. This means that you can declare a plugin that doesn't care about `contextValue` to simply implement `ApolloServerPlugin` and it will work with any `ApolloServer`. This should make it easy to write plugins that don't care about context. - - - Remove the ability to specify a factory function as an element of the `plugins` list in the `ApolloServer` constructor. (Reducing the number of ways to specify constructor options helps keep type errors simpler.) As far as we know the main use case for this (referring to the `ApolloServer` itself when creating the plugin) can be handled with the new-in-AS4 `ApolloServer.addPlugin` method. - -## 4.0.0-alpha.5 - -### Patch Changes - -- [#6806](https://github.com/apollographql/apollo-server/pull/6806) [`bccc230f0`](https://github.com/apollographql/apollo-server/commit/bccc230f05761c15098df9a5e9f57f0c65cf4fa6) Thanks [@glasser](https://github.com/glasser)! - Rename response.http.statusCode back to status like it was in AS3. - -## 4.0.0-alpha.4 - -### Patch Changes - -- [#6788](https://github.com/apollographql/apollo-server/pull/6788) [`13f809ca6`](https://github.com/apollographql/apollo-server/commit/13f809ca6c5e1f0be9d05823f1194a8743321a79) Thanks [@glasser](https://github.com/glasser)! - `parseOptions` is now only used for parsing operations, not for schemas too. Its TS type now only includes options recognized by `graphql-js` itself. - -* [#6785](https://github.com/apollographql/apollo-server/pull/6785) [`96178c570`](https://github.com/apollographql/apollo-server/commit/96178c57070af574fbcff7f51b73924c576725db) Thanks [@renovate](https://github.com/apps/renovate)! - Update internal use of `@graphql-tools/schema` from v8 to v9. This should be a no-op; we have already removed the feature that would have been affected by the API change in this upgrade (passing `parseOptions` to `makeExecutableSchema`). - -- [#6792](https://github.com/apollographql/apollo-server/pull/6792) [`400f7867b`](https://github.com/apollographql/apollo-server/commit/400f7867b521359fd7213547c88fcf3fc8fbe94c) Thanks [@glasser](https://github.com/glasser)! - Port GHSA-2fvv-qxrq-7jq6 fix from v3 (remove XSS from default landing page HTML) - -* [#6794](https://github.com/apollographql/apollo-server/pull/6794) [`7445d3377`](https://github.com/apollographql/apollo-server/commit/7445d3377d16cdc65506131572c0a616d3a6324c) Thanks [@glasser](https://github.com/glasser)! - Usage reporting and inline trace plugins: replace `rewriteError` with `sendErrorsInTraces`/`includeErrors`, and mask all errors by default. - -## 4.0.0-alpha.3 - -### Patch Changes - -- [#6771](https://github.com/apollographql/apollo-server/pull/6771) [`bce9150f3`](https://github.com/apollographql/apollo-server/commit/bce9150f31d6fd58b7a6622611ec7b35b3564aa6) Thanks [@glasser](https://github.com/glasser)! - Support Gateway. Remove executor constructor option. - -* [#6764](https://github.com/apollographql/apollo-server/pull/6764) [`c4115e96a`](https://github.com/apollographql/apollo-server/commit/c4115e96ac75e04cffe1c3353fc03ea65dcab909) Thanks [@glasser](https://github.com/glasser)! - Get cache-control types from @apollo/cache-control-types; no more `declare module` for info.cacheControl - -- [#6759](https://github.com/apollographql/apollo-server/pull/6759) [`6ef6a090c`](https://github.com/apollographql/apollo-server/commit/6ef6a090cff26f5d98e9965cd839307931e12516) Thanks [@glasser](https://github.com/glasser)! - Refactor error formatting. - - Remove `error.extensions.exception`; you can add it back yourself with `formatError`. `error.extensions.exception.stacktrace` is now available on `error.extensions.stacktrace`. - - Provide `unwrapResolverError` function in `@apollo/server/errors`; useful for your `formatError` hook. - - No more TS `declare module` describing the `exception` extension (partially incorrectly). - - Rename the (new in v4) constructor option `includeStackTracesInErrorResponses` to `includeStacktraceInErrorResponses`. - -* [#6765](https://github.com/apollographql/apollo-server/pull/6765) [`536e038a7`](https://github.com/apollographql/apollo-server/commit/536e038a744738f740072781f32e83a360ec0744) Thanks [@glasser](https://github.com/glasser)! - Port #6763 from AS3 (fix fieldLevelInstrumentation type declaration) - -## 4.0.0-alpha.2 - -### Patch Changes - -- [#6357](https://github.com/apollographql/apollo-server/pull/6357) [`f736b4980`](https://github.com/apollographql/apollo-server/commit/f736b4980b39f3b563939b100eff85e073189cb1) Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Port #6709 from AS3 (improve an error message) - -## 4.0.0-alpha.1 - -### Patch Changes - -- [#6357](https://github.com/apollographql/apollo-server/pull/6357) [`7c3c825d8`](https://github.com/apollographql/apollo-server/commit/7c3c825d834ddad778de8b6d4254e56613fe8534) Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Export ApolloServerErrorCode enum instead of error classes. HTTPGraphQLRequest takes search params as raw string. - -- Updated dependencies [[`7c3c825d8`](https://github.com/apollographql/apollo-server/commit/7c3c825d834ddad778de8b6d4254e56613fe8534)]: - - @apollo/usage-reporting-protobuf@4.0.0-alpha.1 - -## 4.0.0-alpha.0 - -### Major Changes - -- [`f39d9eec7`](https://github.com/apollographql/apollo-server/commit/f39d9eec7ab72d0f471a0bb0646dd42ad81c56cf) Thanks [@glasser](https://github.com/glasser)! - Initial Apollo Server 4 release - -### Patch Changes - -- Updated dependencies [[`f39d9eec7`](https://github.com/apollographql/apollo-server/commit/f39d9eec7ab72d0f471a0bb0646dd42ad81c56cf)]: - - @apollo/usage-reporting-protobuf@4.0.0-alpha.0 +The first version of Apollo Server published in the `@apollo/server` package is v4.0.0. Before this release, all Apollo Server packages tracked their changes in a single file, which can be found at [`CHANGELOG_historical.md`](http://github.com/apollographql/apollo-server/blob/main/CHANGELOG_historical.md). diff --git a/packages/server/package.json b/packages/server/package.json index c9921302308..e2a46d4a50b 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,6 +1,6 @@ { "name": "@apollo/server", - "version": "4.0.0-rc.18", + "version": "4.0.0", "description": "Core engine for Apollo GraphQL server", "type": "module", "main": "dist/cjs/index.js", @@ -86,7 +86,7 @@ "dependencies": { "@apollo/cache-control-types": "^1.0.2", "@apollo/server-gateway-interface": "^1.0.3", - "@apollo/usage-reporting-protobuf": "^4.0.0-rc.2", + "@apollo/usage-reporting-protobuf": "^4.0.0", "@apollo/utils.createhash": "^1.1.0", "@apollo/utils.fetcher": "^1.0.0", "@apollo/utils.isnodelike": "^1.1.0", diff --git a/packages/usage-reporting-protobuf/CHANGELOG.md b/packages/usage-reporting-protobuf/CHANGELOG.md index f03ad896bf1..aef4a432027 100644 --- a/packages/usage-reporting-protobuf/CHANGELOG.md +++ b/packages/usage-reporting-protobuf/CHANGELOG.md @@ -1,19 +1,5 @@ # @apollo/usage-reporting-protobuf -## 4.0.0-rc.2 +## 4.0.0 -### Patch Changes - -- [#6967](https://github.com/apollographql/apollo-server/pull/6967) [`d20842824`](https://github.com/apollographql/apollo-server/commit/d208428248532d55249cad5ea3912dd097232831) Thanks [@renovate](https://github.com/apps/renovate)! - Update `@apollo/protobufjs` dependency to avoid false positives in vulnerability scans (https://github.com/apollographql/apollo-server/issues/6835) - -## 4.0.0-alpha.1 - -### Patch Changes - -- [#6357](https://github.com/apollographql/apollo-server/pull/6357) [`7c3c825d8`](https://github.com/apollographql/apollo-server/commit/7c3c825d834ddad778de8b6d4254e56613fe8534) Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Export ApolloServerErrorCode enum instead of error classes. HTTPGraphQLRequest takes search params as raw string. - -## 4.0.0-alpha.0 - -### Major Changes - -- [`f39d9eec7`](https://github.com/apollographql/apollo-server/commit/f39d9eec7ab72d0f471a0bb0646dd42ad81c56cf) Thanks [@glasser](https://github.com/glasser)! - Initial Apollo Server 4 release +Initial release of `@apollo/usage-reporting-protobuf` with support for Apollo Server 4. The version of this plugin designed for Apollo Server 2 and 3 was named `apollo-reporting-protobuf`. This is an internal implementation detail of Apollo Server and is not intended for general direct use. diff --git a/packages/usage-reporting-protobuf/package.json b/packages/usage-reporting-protobuf/package.json index 3d626f3fb5c..726100a3b8e 100644 --- a/packages/usage-reporting-protobuf/package.json +++ b/packages/usage-reporting-protobuf/package.json @@ -1,6 +1,6 @@ { "name": "@apollo/usage-reporting-protobuf", - "version": "4.0.0-rc.2", + "version": "4.0.0", "description": "Protobuf format for Apollo usage reporting", "type": "module", "exports": {