@graphql-mesh/plugin-response-cache 0.103.22 → 0.103.23-alpha-20250225152619-a15c16437d4a502dc13188c665dc5d0170872753

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
@@ -8,6 +8,7 @@ const cross_helpers_1 = require("@graphql-mesh/cross-helpers");
8
8
  const string_interpolation_1 = require("@graphql-mesh/string-interpolation");
9
9
  const utils_1 = require("@graphql-tools/utils");
10
10
  const plugin_response_cache_1 = require("@graphql-yoga/plugin-response-cache");
11
+ const promise_helpers_1 = require("@whatwg-node/promise-helpers");
11
12
  function generateSessionIdFactory(sessionIdDef) {
12
13
  if (sessionIdDef == null) {
13
14
  return function voidSession() {
@@ -81,7 +82,7 @@ function getCacheForResponseCache(meshCache) {
81
82
  const entitiesToRemoveJobs = [];
82
83
  for (const { typename, id } of entitiesToRemove) {
83
84
  const entryId = `${typename}.${id}`;
84
- const job = (0, utils_1.mapMaybePromise)(meshCache.getKeysByPrefix(`response-cache:${entryId}:`), cacheEntriesToDelete => {
85
+ const job = (0, promise_helpers_1.handleMaybePromise)(() => meshCache.getKeysByPrefix(`response-cache:${entryId}:`), cacheEntriesToDelete => {
85
86
  const jobs = [];
86
87
  for (const cacheEntryName of cacheEntriesToDelete) {
87
88
  const [, , responseId] = cacheEntryName.split(':');
@@ -110,10 +111,10 @@ function getCacheForResponseCache(meshCache) {
110
111
  else if (entitiesToRemoveJobs.length > 0) {
111
112
  promiseAllJob = Promise.all(entitiesToRemoveJobs);
112
113
  }
113
- return (0, utils_1.mapMaybePromise)(promiseAllJob, () => {
114
+ return (0, promise_helpers_1.handleMaybePromise)(() => promiseAllJob, () => {
114
115
  const responseIdsToCheckJobs = [];
115
116
  for (const responseId of responseIdsToCheck) {
116
- const job = (0, utils_1.mapMaybePromise)(meshCache.getKeysByPrefix(`response-cache:${responseId}:`), cacheEntries => {
117
+ const job = (0, promise_helpers_1.handleMaybePromise)(() => meshCache.getKeysByPrefix(`response-cache:${responseId}:`), cacheEntries => {
117
118
  if (cacheEntries.length !== 0) {
118
119
  return meshCache.delete(`response-cache:${responseId}`);
119
120
  }
package/esm/index.js CHANGED
@@ -2,8 +2,9 @@ import CacheControlParser from 'cache-control-parser';
2
2
  import { defaultBuildResponseCacheKey } from '@envelop/response-cache';
3
3
  import { process } from '@graphql-mesh/cross-helpers';
4
4
  import { stringInterpolator } from '@graphql-mesh/string-interpolation';
5
- import { isPromise, mapMaybePromise } from '@graphql-tools/utils';
5
+ import { isPromise } from '@graphql-tools/utils';
6
6
  import { useResponseCache } from '@graphql-yoga/plugin-response-cache';
7
+ import { handleMaybePromise } from '@whatwg-node/promise-helpers';
7
8
  function generateSessionIdFactory(sessionIdDef) {
8
9
  if (sessionIdDef == null) {
9
10
  return function voidSession() {
@@ -77,7 +78,7 @@ function getCacheForResponseCache(meshCache) {
77
78
  const entitiesToRemoveJobs = [];
78
79
  for (const { typename, id } of entitiesToRemove) {
79
80
  const entryId = `${typename}.${id}`;
80
- const job = mapMaybePromise(meshCache.getKeysByPrefix(`response-cache:${entryId}:`), cacheEntriesToDelete => {
81
+ const job = handleMaybePromise(() => meshCache.getKeysByPrefix(`response-cache:${entryId}:`), cacheEntriesToDelete => {
81
82
  const jobs = [];
82
83
  for (const cacheEntryName of cacheEntriesToDelete) {
83
84
  const [, , responseId] = cacheEntryName.split(':');
@@ -106,10 +107,10 @@ function getCacheForResponseCache(meshCache) {
106
107
  else if (entitiesToRemoveJobs.length > 0) {
107
108
  promiseAllJob = Promise.all(entitiesToRemoveJobs);
108
109
  }
109
- return mapMaybePromise(promiseAllJob, () => {
110
+ return handleMaybePromise(() => promiseAllJob, () => {
110
111
  const responseIdsToCheckJobs = [];
111
112
  for (const responseId of responseIdsToCheck) {
112
- const job = mapMaybePromise(meshCache.getKeysByPrefix(`response-cache:${responseId}:`), cacheEntries => {
113
+ const job = handleMaybePromise(() => meshCache.getKeysByPrefix(`response-cache:${responseId}:`), cacheEntries => {
113
114
  if (cacheEntries.length !== 0) {
114
115
  return meshCache.delete(`response-cache:${responseId}`);
115
116
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-mesh/plugin-response-cache",
3
- "version": "0.103.22",
3
+ "version": "0.103.23-alpha-20250225152619-a15c16437d4a502dc13188c665dc5d0170872753",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
6
  "graphql": "*"
@@ -10,10 +10,11 @@
10
10
  "@envelop/response-cache": "^7.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.103.19",
14
- "@graphql-mesh/utils": "^0.103.19",
13
+ "@graphql-mesh/types": "0.103.20-alpha-20250225152619-a15c16437d4a502dc13188c665dc5d0170872753",
14
+ "@graphql-mesh/utils": "0.103.20-alpha-20250225152619-a15c16437d4a502dc13188c665dc5d0170872753",
15
15
  "@graphql-tools/utils": "^10.6.2",
16
16
  "@graphql-yoga/plugin-response-cache": "^3.13.1",
17
+ "@whatwg-node/promise-helpers": "^1.0.0",
17
18
  "cache-control-parser": "^2.0.6",
18
19
  "graphql-yoga": "^5.12.0",
19
20
  "tslib": "^2.4.0"