@graphql-mesh/plugin-response-cache 0.104.12 → 0.104.13-alpha-20250905104910-e13cfe1d679b36b3ee7fad2da98d5771c4d6d223
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 +9 -8
- package/esm/index.js +9 -8
- package/package.json +3 -3
package/cjs/index.js
CHANGED
|
@@ -193,15 +193,16 @@ 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
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
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
|
+
}
|
|
200
203
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
const sMaxAgeInMs = sMaxAgeInSeconds * 1000;
|
|
204
|
-
checkTtl(context, sMaxAgeInMs);
|
|
204
|
+
for (const headerName of headerNames) {
|
|
205
|
+
checkHeaderTtl(headerName);
|
|
205
206
|
}
|
|
206
207
|
}
|
|
207
208
|
};
|
package/esm/index.js
CHANGED
|
@@ -189,15 +189,16 @@ 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
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
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
|
+
}
|
|
196
199
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
const sMaxAgeInMs = sMaxAgeInSeconds * 1000;
|
|
200
|
-
checkTtl(context, sMaxAgeInMs);
|
|
200
|
+
for (const headerName of headerNames) {
|
|
201
|
+
checkHeaderTtl(headerName);
|
|
201
202
|
}
|
|
202
203
|
}
|
|
203
204
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-mesh/plugin-response-cache",
|
|
3
|
-
"version": "0.104.
|
|
3
|
+
"version": "0.104.13-alpha-20250905104910-e13cfe1d679b36b3ee7fad2da98d5771c4d6d223",
|
|
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": "
|
|
14
|
-
"@graphql-mesh/utils": "
|
|
13
|
+
"@graphql-mesh/types": "0.104.12-alpha-20250905104910-e13cfe1d679b36b3ee7fad2da98d5771c4d6d223",
|
|
14
|
+
"@graphql-mesh/utils": "0.104.12-alpha-20250905104910-e13cfe1d679b36b3ee7fad2da98d5771c4d6d223",
|
|
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",
|