@graphql-mesh/cache-cfw-kv 0.104.19 → 0.104.20
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 +3 -8
- package/esm/index.js +3 -8
- package/package.json +4 -3
- package/typings/index.d.cts +2 -2
- package/typings/index.d.ts +2 -2
package/cjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const promise_helpers_1 = require("@whatwg-node/promise-helpers");
|
|
4
4
|
class CFWorkerKVCache {
|
|
5
5
|
constructor(config) {
|
|
6
6
|
if (typeof config.namespace === 'string') {
|
|
@@ -18,7 +18,7 @@ class CFWorkerKVCache {
|
|
|
18
18
|
return this.kvNamespace?.get(key, 'json');
|
|
19
19
|
}
|
|
20
20
|
getKeysByPrefix(prefix) {
|
|
21
|
-
return (0,
|
|
21
|
+
return (0, promise_helpers_1.handleMaybePromise)(() => this.kvNamespace?.list({ prefix }), result => {
|
|
22
22
|
if (!result) {
|
|
23
23
|
return [];
|
|
24
24
|
}
|
|
@@ -31,12 +31,7 @@ class CFWorkerKVCache {
|
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
delete(key) {
|
|
34
|
-
|
|
35
|
-
return (0, utils_1.mapMaybePromise)(this.kvNamespace?.delete(key), () => true, () => false);
|
|
36
|
-
}
|
|
37
|
-
catch (e) {
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
34
|
+
return (0, promise_helpers_1.handleMaybePromise)(() => this.kvNamespace?.delete(key), () => true, () => false);
|
|
40
35
|
}
|
|
41
36
|
}
|
|
42
37
|
exports.default = CFWorkerKVCache;
|
package/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { handleMaybePromise } from '@whatwg-node/promise-helpers';
|
|
2
2
|
export default class CFWorkerKVCache {
|
|
3
3
|
constructor(config) {
|
|
4
4
|
if (typeof config.namespace === 'string') {
|
|
@@ -16,7 +16,7 @@ export default class CFWorkerKVCache {
|
|
|
16
16
|
return this.kvNamespace?.get(key, 'json');
|
|
17
17
|
}
|
|
18
18
|
getKeysByPrefix(prefix) {
|
|
19
|
-
return
|
|
19
|
+
return handleMaybePromise(() => this.kvNamespace?.list({ prefix }), result => {
|
|
20
20
|
if (!result) {
|
|
21
21
|
return [];
|
|
22
22
|
}
|
|
@@ -29,11 +29,6 @@ export default class CFWorkerKVCache {
|
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
delete(key) {
|
|
32
|
-
|
|
33
|
-
return mapMaybePromise(this.kvNamespace?.delete(key), () => true, () => false);
|
|
34
|
-
}
|
|
35
|
-
catch (e) {
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
32
|
+
return handleMaybePromise(() => this.kvNamespace?.delete(key), () => true, () => false);
|
|
38
33
|
}
|
|
39
34
|
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-mesh/cache-cfw-kv",
|
|
3
|
-
"version": "0.104.
|
|
3
|
+
"version": "0.104.20",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"graphql": "*"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@graphql-mesh/types": "^0.103.
|
|
10
|
-
"@graphql-mesh/utils": "^0.103.
|
|
9
|
+
"@graphql-mesh/types": "^0.103.20",
|
|
10
|
+
"@graphql-mesh/utils": "^0.103.20",
|
|
11
|
+
"@whatwg-node/promise-helpers": "^1.0.0",
|
|
11
12
|
"tslib": "^2.4.0"
|
|
12
13
|
},
|
|
13
14
|
"repository": {
|
package/typings/index.d.cts
CHANGED
|
@@ -6,9 +6,9 @@ export default class CFWorkerKVCache implements KeyValueCache {
|
|
|
6
6
|
logger?: Logger;
|
|
7
7
|
});
|
|
8
8
|
get<T>(key: string): Promise<T | undefined>;
|
|
9
|
-
getKeysByPrefix(prefix: string): import("@
|
|
9
|
+
getKeysByPrefix(prefix: string): import("@whatwg-node/promise-helpers").MaybePromise<string[]>;
|
|
10
10
|
set(key: string, value: any, options?: {
|
|
11
11
|
ttl?: number;
|
|
12
12
|
}): Promise<void>;
|
|
13
|
-
delete(key: string): import("@
|
|
13
|
+
delete(key: string): import("@whatwg-node/promise-helpers").MaybePromise<boolean>;
|
|
14
14
|
}
|
package/typings/index.d.ts
CHANGED
|
@@ -6,9 +6,9 @@ export default class CFWorkerKVCache implements KeyValueCache {
|
|
|
6
6
|
logger?: Logger;
|
|
7
7
|
});
|
|
8
8
|
get<T>(key: string): Promise<T | undefined>;
|
|
9
|
-
getKeysByPrefix(prefix: string): import("@
|
|
9
|
+
getKeysByPrefix(prefix: string): import("@whatwg-node/promise-helpers").MaybePromise<string[]>;
|
|
10
10
|
set(key: string, value: any, options?: {
|
|
11
11
|
ttl?: number;
|
|
12
12
|
}): Promise<void>;
|
|
13
|
-
delete(key: string): import("@
|
|
13
|
+
delete(key: string): import("@whatwg-node/promise-helpers").MaybePromise<boolean>;
|
|
14
14
|
}
|