@envelop/response-cache-cloudflare-kv 4.0.0-rc-20250304073852-e6afc71246cc740977d8a20d8292b891e7e27bb6 → 4.0.0

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/invalidate.js CHANGED
@@ -4,14 +4,13 @@ exports.invalidate = invalidate;
4
4
  exports.invalidateCacheEntityRecord = invalidateCacheEntityRecord;
5
5
  exports.getAllKvKeysForPrefix = getAllKvKeysForPrefix;
6
6
  const cache_key_js_1 = require("./cache-key.js");
7
- async function invalidate(entities, KV, keyPrefix) {
7
+ function invalidate(entities, KV, keyPrefix) {
8
8
  const kvPromises = []; // Collecting all the KV operations so we can await them all at once
9
9
  const entityInvalidationPromises = []; // Parallelize invalidation of each entity
10
10
  for (const entity of entities) {
11
11
  entityInvalidationPromises.push(invalidateCacheEntityRecord(entity, kvPromises, KV, keyPrefix));
12
12
  }
13
- await Promise.allSettled(entityInvalidationPromises);
14
- await Promise.allSettled(kvPromises);
13
+ return Promise.allSettled([...entityInvalidationPromises, ...kvPromises]).then(() => undefined);
15
14
  }
16
15
  async function invalidateCacheEntityRecord(entity,
17
16
  /** Collect all inner promises to batch await all async operations outside the function */
package/cjs/set.js CHANGED
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.set = set;
4
4
  const cache_key_js_1 = require("./cache-key.js");
5
- async function set(
5
+ function set(
6
6
  /** id/hash of the operation */
7
7
  id,
8
8
  /** the result that should be cached */
@@ -28,5 +28,5 @@ ttl, KV, keyPrefix) {
28
28
  metadata: { operationKey },
29
29
  }));
30
30
  }
31
- await Promise.allSettled(kvPromises);
31
+ return Promise.allSettled(kvPromises).then(() => undefined);
32
32
  }
package/esm/invalidate.js CHANGED
@@ -1,12 +1,11 @@
1
1
  import { buildEntityKey } from './cache-key.js';
2
- export async function invalidate(entities, KV, keyPrefix) {
2
+ export function invalidate(entities, KV, keyPrefix) {
3
3
  const kvPromises = []; // Collecting all the KV operations so we can await them all at once
4
4
  const entityInvalidationPromises = []; // Parallelize invalidation of each entity
5
5
  for (const entity of entities) {
6
6
  entityInvalidationPromises.push(invalidateCacheEntityRecord(entity, kvPromises, KV, keyPrefix));
7
7
  }
8
- await Promise.allSettled(entityInvalidationPromises);
9
- await Promise.allSettled(kvPromises);
8
+ return Promise.allSettled([...entityInvalidationPromises, ...kvPromises]).then(() => undefined);
10
9
  }
11
10
  export async function invalidateCacheEntityRecord(entity,
12
11
  /** Collect all inner promises to batch await all async operations outside the function */
package/esm/set.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { buildEntityKey, buildOperationKey } from './cache-key.js';
2
- export async function set(
2
+ export function set(
3
3
  /** id/hash of the operation */
4
4
  id,
5
5
  /** the result that should be cached */
@@ -25,5 +25,5 @@ ttl, KV, keyPrefix) {
25
25
  metadata: { operationKey },
26
26
  }));
27
27
  }
28
- await Promise.allSettled(kvPromises);
28
+ return Promise.allSettled(kvPromises).then(() => undefined);
29
29
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@envelop/response-cache-cloudflare-kv",
3
- "version": "4.0.0-rc-20250304073852-e6afc71246cc740977d8a20d8292b891e7e27bb6",
3
+ "version": "4.0.0",
4
4
  "sideEffects": false,
5
5
  "peerDependenciesMeta": {
6
6
  "@cloudflare/workers-types": {
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "peerDependencies": {
11
11
  "@cloudflare/workers-types": "^4.20231121.0",
12
- "@envelop/response-cache": "8.0.0-rc-20250304073852-e6afc71246cc740977d8a20d8292b891e7e27bb6",
12
+ "@envelop/response-cache": "^8.0.0",
13
13
  "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
14
14
  },
15
15
  "dependencies": {
@@ -17,7 +17,7 @@
17
17
  },
18
18
  "repository": {
19
19
  "type": "git",
20
- "url": "https://github.com/n1ru4l/envelop.git",
20
+ "url": "https://github.com/graphql-hive/envelop.git",
21
21
  "directory": "packages/plugins/response-cache-cloudflare-kv"
22
22
  },
23
23
  "author": {