@graphql-yoga/plugin-response-cache 2.1.0 → 2.1.1-alpha-20230810153432-d9f7d423

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/index.js CHANGED
@@ -14,7 +14,7 @@ const cacheKeyFactoryForEnvelop = async function cacheKeyFactoryForEnvelop({ ses
14
14
  }
15
15
  return sessionId;
16
16
  };
17
- const getDocumentStringForEnvelop = (executionArgs) => {
17
+ const getDocumentStringForEnvelop = executionArgs => {
18
18
  const context = executionArgs.contextValue;
19
19
  if (context.params?.query == null) {
20
20
  throw new Error('[useResponseCache] This plugin is not configured correctly. Make sure you use this plugin with GraphQL Yoga');
@@ -45,8 +45,7 @@ function useResponseCache(options) {
45
45
  ? options.shouldCacheResult({ cacheKey, result })
46
46
  : !result.errors?.length;
47
47
  if (shouldCached) {
48
- const extensions = (result.extensions ||=
49
- {});
48
+ const extensions = (result.extensions ||= {});
50
49
  const httpExtensions = (extensions.http ||= {});
51
50
  const headers = (httpExtensions.headers ||= {});
52
51
  headers['ETag'] = cacheKey;
package/esm/index.js CHANGED
@@ -10,7 +10,7 @@ const cacheKeyFactoryForEnvelop = async function cacheKeyFactoryForEnvelop({ ses
10
10
  }
11
11
  return sessionId;
12
12
  };
13
- const getDocumentStringForEnvelop = (executionArgs) => {
13
+ const getDocumentStringForEnvelop = executionArgs => {
14
14
  const context = executionArgs.contextValue;
15
15
  if (context.params?.query == null) {
16
16
  throw new Error('[useResponseCache] This plugin is not configured correctly. Make sure you use this plugin with GraphQL Yoga');
@@ -41,8 +41,7 @@ export function useResponseCache(options) {
41
41
  ? options.shouldCacheResult({ cacheKey, result })
42
42
  : !result.errors?.length;
43
43
  if (shouldCached) {
44
- const extensions = (result.extensions ||=
45
- {});
44
+ const extensions = (result.extensions ||= {});
46
45
  const httpExtensions = (extensions.http ||= {});
47
46
  const headers = (httpExtensions.headers ||= {});
48
47
  headers['ETag'] = cacheKey;
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@graphql-yoga/plugin-response-cache",
3
- "version": "2.1.0",
3
+ "version": "2.1.1-alpha-20230810153432-d9f7d423",
4
4
  "description": "",
5
5
  "peerDependencies": {
6
6
  "graphql": "^15.2.0 || ^16.0.0",
7
- "graphql-yoga": "^4.0.3"
7
+ "graphql-yoga": "4.0.4-alpha-20230810153432-d9f7d423"
8
8
  },
9
9
  "dependencies": {
10
10
  "@envelop/response-cache": "^5.1.0"
@@ -1,6 +1,6 @@
1
- import { createInMemoryCache, UseResponseCacheParameter as UseEnvelopResponseCacheParameter, Cache as EnvelopCache, ResponseCacheExtensions as EnvelopResponseCacheExtensions } from '@envelop/response-cache';
2
1
  import { ExecutionResult } from 'graphql';
3
2
  import { Maybe, Plugin, PromiseOrValue } from 'graphql-yoga';
3
+ import { createInMemoryCache, Cache as EnvelopCache, ResponseCacheExtensions as EnvelopResponseCacheExtensions, UseResponseCacheParameter as UseEnvelopResponseCacheParameter } from '@envelop/response-cache';
4
4
  export type UseResponseCacheParameter = Omit<UseEnvelopResponseCacheParameter, 'getDocumentString' | 'session' | 'cache' | 'enabled'> & {
5
5
  cache?: Cache;
6
6
  session: (request: Request) => PromiseOrValue<Maybe<string>>;
@@ -1,6 +1,6 @@
1
- import { createInMemoryCache, UseResponseCacheParameter as UseEnvelopResponseCacheParameter, Cache as EnvelopCache, ResponseCacheExtensions as EnvelopResponseCacheExtensions } from '@envelop/response-cache';
2
1
  import { ExecutionResult } from 'graphql';
3
2
  import { Maybe, Plugin, PromiseOrValue } from 'graphql-yoga';
3
+ import { createInMemoryCache, Cache as EnvelopCache, ResponseCacheExtensions as EnvelopResponseCacheExtensions, UseResponseCacheParameter as UseEnvelopResponseCacheParameter } from '@envelop/response-cache';
4
4
  export type UseResponseCacheParameter = Omit<UseEnvelopResponseCacheParameter, 'getDocumentString' | 'session' | 'cache' | 'enabled'> & {
5
5
  cache?: Cache;
6
6
  session: (request: Request) => PromiseOrValue<Maybe<string>>;