@apollo/server-plugin-response-cache
Advanced tools
Comparing version 4.0.0-alpha.4 to 4.0.0-alpha.5
# @apollo/server-plugin-response-cache | ||
## 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 | ||
@@ -4,0 +13,0 @@ |
@@ -46,3 +46,3 @@ "use strict"; | ||
return { | ||
result: { data: value.data }, | ||
body: { kind: 'single', singleResult: { data: value.data } }, | ||
http: { | ||
@@ -88,2 +88,5 @@ status: undefined, | ||
const logger = requestContext.logger || console; | ||
if (requestContext.response.body.kind !== 'single') { | ||
return; | ||
} | ||
if (!isGraphQLQuery(requestContext)) { | ||
@@ -104,3 +107,3 @@ return; | ||
} | ||
const { data, errors } = requestContext.response.result; | ||
const { data, errors } = requestContext.response.body.singleResult; | ||
const policyIfCacheable = requestContext.overallCachePolicy.policyIfCacheable(); | ||
@@ -107,0 +110,0 @@ if (errors || !data || !policyIfCacheable) { |
@@ -44,3 +44,3 @@ import { createHash } from '@apollo/utils.createhash'; | ||
return { | ||
result: { data: value.data }, | ||
body: { kind: 'single', singleResult: { data: value.data } }, | ||
http: { | ||
@@ -86,2 +86,5 @@ status: undefined, | ||
const logger = requestContext.logger || console; | ||
if (requestContext.response.body.kind !== 'single') { | ||
return; | ||
} | ||
if (!isGraphQLQuery(requestContext)) { | ||
@@ -102,3 +105,3 @@ return; | ||
} | ||
const { data, errors } = requestContext.response.result; | ||
const { data, errors } = requestContext.response.body.singleResult; | ||
const policyIfCacheable = requestContext.overallCachePolicy.policyIfCacheable(); | ||
@@ -105,0 +108,0 @@ if (errors || !data || !policyIfCacheable) { |
{ | ||
"name": "@apollo/server-plugin-response-cache", | ||
"version": "4.0.0-alpha.4", | ||
"version": "4.0.0-alpha.5", | ||
"description": "Apollo Server full query response cache", | ||
@@ -36,5 +36,5 @@ "type": "module", | ||
"peerDependencies": { | ||
"@apollo/server": "^4.0.0-alpha.6", | ||
"@apollo/server": "^4.0.0-alpha.12", | ||
"graphql": "^16.5.0" | ||
} | ||
} |
import plugin from '../ApolloServerPluginResponseCache'; | ||
import { describe, it, expect } from '@jest/globals'; | ||
@@ -3,0 +4,0 @@ describe('Response cache plugin', () => { |
@@ -9,2 +9,3 @@ import { | ||
import request, { type Response } from 'supertest'; | ||
import { jest, describe, it, expect, beforeAll, afterAll } from '@jest/globals'; | ||
@@ -11,0 +12,0 @@ describe('Response caching', () => { |
@@ -6,3 +6,4 @@ { | ||
{ "path": "../../" }, | ||
{ "path": "../../../server" } | ||
] | ||
} |
@@ -220,3 +220,3 @@ import type { CacheHint } from '@apollo/cache-control-types'; | ||
return { | ||
result: { data: value.data }, | ||
body: { kind: 'single', singleResult: { data: value.data } }, | ||
http: { | ||
@@ -273,2 +273,10 @@ status: undefined, | ||
// We don't support caching incremental delivery responses (ie, | ||
// responses that use @defer or @stream) now. (It might be useful to | ||
// do so: after all, deferred responses might benefit the most from | ||
// caching! But we don't right now.) | ||
if (requestContext.response.body.kind !== 'single') { | ||
return; | ||
} | ||
if (!isGraphQLQuery(requestContext)) { | ||
@@ -293,3 +301,3 @@ return; | ||
const { data, errors } = requestContext.response.result; | ||
const { data, errors } = requestContext.response.body.singleResult; | ||
const policyIfCacheable = | ||
@@ -296,0 +304,0 @@ requestContext.overallCachePolicy.policyIfCacheable(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
157953
1189