@graphql-mesh/plugin-response-cache 0.104.13-alpha-20250905104910-e13cfe1d679b36b3ee7fad2da98d5771c4d6d223 → 0.104.13-alpha-20250906124441-ea4b23b33bc99a347cf1c47a6ec55ccbf53b40c7

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
@@ -193,16 +193,15 @@ function useMeshResponseCache(options) {
193
193
  const cacheControlHeader = response.headers.get('cache-control');
194
194
  if (cacheControlHeader != null) {
195
195
  const parsedCacheControl = cache_control_parser_1.default.parse(cacheControlHeader);
196
- const headerNames = ['max-age', 's-maxage'];
197
- function checkHeaderTtl(headerName) {
198
- if (parsedCacheControl[headerName] != null) {
199
- const maxAgeInSeconds = parsedCacheControl[headerName];
200
- const maxAgeInMs = maxAgeInSeconds * 1000;
201
- checkTtl(context, maxAgeInMs);
202
- }
196
+ if (parsedCacheControl['max-age'] != null) {
197
+ const maxAgeInSeconds = parsedCacheControl['max-age'];
198
+ const maxAgeInMs = maxAgeInSeconds * 1000;
199
+ checkTtl(context, maxAgeInMs);
203
200
  }
204
- for (const headerName of headerNames) {
205
- checkHeaderTtl(headerName);
201
+ if (parsedCacheControl['s-maxage'] != null) {
202
+ const sMaxAgeInSeconds = parsedCacheControl['s-maxage'];
203
+ const sMaxAgeInMs = sMaxAgeInSeconds * 1000;
204
+ checkTtl(context, sMaxAgeInMs);
206
205
  }
207
206
  }
208
207
  };
package/esm/index.js CHANGED
@@ -189,16 +189,15 @@ export default function useMeshResponseCache(options) {
189
189
  const cacheControlHeader = response.headers.get('cache-control');
190
190
  if (cacheControlHeader != null) {
191
191
  const parsedCacheControl = CacheControlParser.parse(cacheControlHeader);
192
- const headerNames = ['max-age', 's-maxage'];
193
- function checkHeaderTtl(headerName) {
194
- if (parsedCacheControl[headerName] != null) {
195
- const maxAgeInSeconds = parsedCacheControl[headerName];
196
- const maxAgeInMs = maxAgeInSeconds * 1000;
197
- checkTtl(context, maxAgeInMs);
198
- }
192
+ if (parsedCacheControl['max-age'] != null) {
193
+ const maxAgeInSeconds = parsedCacheControl['max-age'];
194
+ const maxAgeInMs = maxAgeInSeconds * 1000;
195
+ checkTtl(context, maxAgeInMs);
199
196
  }
200
- for (const headerName of headerNames) {
201
- checkHeaderTtl(headerName);
197
+ if (parsedCacheControl['s-maxage'] != null) {
198
+ const sMaxAgeInSeconds = parsedCacheControl['s-maxage'];
199
+ const sMaxAgeInMs = sMaxAgeInSeconds * 1000;
200
+ checkTtl(context, sMaxAgeInMs);
202
201
  }
203
202
  }
204
203
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-mesh/plugin-response-cache",
3
- "version": "0.104.13-alpha-20250905104910-e13cfe1d679b36b3ee7fad2da98d5771c4d6d223",
3
+ "version": "0.104.13-alpha-20250906124441-ea4b23b33bc99a347cf1c47a6ec55ccbf53b40c7",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
6
  "graphql": "*"
@@ -10,8 +10,8 @@
10
10
  "@envelop/response-cache": "^8.0.0",
11
11
  "@graphql-mesh/cross-helpers": "^0.4.10",
12
12
  "@graphql-mesh/string-interpolation": "0.5.8",
13
- "@graphql-mesh/types": "0.104.12-alpha-20250905104910-e13cfe1d679b36b3ee7fad2da98d5771c4d6d223",
14
- "@graphql-mesh/utils": "0.104.12-alpha-20250905104910-e13cfe1d679b36b3ee7fad2da98d5771c4d6d223",
13
+ "@graphql-mesh/types": "0.104.12-alpha-20250906124441-ea4b23b33bc99a347cf1c47a6ec55ccbf53b40c7",
14
+ "@graphql-mesh/utils": "0.104.12-alpha-20250906124441-ea4b23b33bc99a347cf1c47a6ec55ccbf53b40c7",
15
15
  "@graphql-tools/utils": "^10.6.2",
16
16
  "@graphql-yoga/plugin-response-cache": "^3.13.1",
17
17
  "@whatwg-node/promise-helpers": "^1.0.0",