@graphql-mesh/cache-cfw-kv 1.0.0-alpha-20230523160518-5443a1139 → 1.0.0-alpha-20230523160829-449dc3c14

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
@@ -10,28 +10,24 @@ class CFWorkerKVCache {
10
10
  }
11
11
  }
12
12
  async get(key) {
13
- var _a;
14
- return (_a = this.kvNamespace) === null || _a === void 0 ? void 0 : _a.get(key, 'json');
13
+ return this.kvNamespace?.get(key, 'json');
15
14
  }
16
15
  async getKeysByPrefix(prefix) {
17
- var _a;
18
- const result = await ((_a = this.kvNamespace) === null || _a === void 0 ? void 0 : _a.list({
16
+ const result = await this.kvNamespace?.list({
19
17
  prefix,
20
- }));
18
+ });
21
19
  if (!result) {
22
20
  return [];
23
21
  }
24
22
  return result.keys.map(keyEntry => keyEntry.name);
25
23
  }
26
24
  async set(key, value, options) {
27
- var _a;
28
- return (_a = this.kvNamespace) === null || _a === void 0 ? void 0 : _a.put(key, JSON.stringify(value), {
29
- expirationTtl: options === null || options === void 0 ? void 0 : options.ttl,
25
+ return this.kvNamespace?.put(key, JSON.stringify(value), {
26
+ expirationTtl: options?.ttl,
30
27
  });
31
28
  }
32
29
  async delete(key) {
33
- var _a;
34
- return (_a = this.kvNamespace) === null || _a === void 0 ? void 0 : _a.delete(key);
30
+ return this.kvNamespace?.delete(key);
35
31
  }
36
32
  }
37
33
  exports.default = CFWorkerKVCache;
package/esm/index.js CHANGED
@@ -8,27 +8,23 @@ export default class CFWorkerKVCache {
8
8
  }
9
9
  }
10
10
  async get(key) {
11
- var _a;
12
- return (_a = this.kvNamespace) === null || _a === void 0 ? void 0 : _a.get(key, 'json');
11
+ return this.kvNamespace?.get(key, 'json');
13
12
  }
14
13
  async getKeysByPrefix(prefix) {
15
- var _a;
16
- const result = await ((_a = this.kvNamespace) === null || _a === void 0 ? void 0 : _a.list({
14
+ const result = await this.kvNamespace?.list({
17
15
  prefix,
18
- }));
16
+ });
19
17
  if (!result) {
20
18
  return [];
21
19
  }
22
20
  return result.keys.map(keyEntry => keyEntry.name);
23
21
  }
24
22
  async set(key, value, options) {
25
- var _a;
26
- return (_a = this.kvNamespace) === null || _a === void 0 ? void 0 : _a.put(key, JSON.stringify(value), {
27
- expirationTtl: options === null || options === void 0 ? void 0 : options.ttl,
23
+ return this.kvNamespace?.put(key, JSON.stringify(value), {
24
+ expirationTtl: options?.ttl,
28
25
  });
29
26
  }
30
27
  async delete(key) {
31
- var _a;
32
- return (_a = this.kvNamespace) === null || _a === void 0 ? void 0 : _a.delete(key);
28
+ return this.kvNamespace?.delete(key);
33
29
  }
34
30
  }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@graphql-mesh/cache-cfw-kv",
3
- "version": "1.0.0-alpha-20230523160518-5443a1139",
3
+ "version": "1.0.0-alpha-20230523160829-449dc3c14",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
- "@graphql-mesh/types": "1.0.0-alpha-20230523160518-5443a1139",
7
- "@graphql-mesh/utils": "1.0.0-alpha-20230523160518-5443a1139",
6
+ "@graphql-mesh/types": "1.0.0-alpha-20230523160829-449dc3c14",
7
+ "@graphql-mesh/utils": "1.0.0-alpha-20230523160829-449dc3c14",
8
8
  "graphql": "*",
9
9
  "tslib": "^2.4.0"
10
10
  },
@@ -15,6 +15,9 @@
15
15
  "directory": "packages/cache/cfw-kv"
16
16
  },
17
17
  "license": "MIT",
18
+ "engines": {
19
+ "node": ">=16.0.0"
20
+ },
18
21
  "main": "cjs/index.js",
19
22
  "module": "esm/index.js",
20
23
  "typings": "typings/index.d.ts",