@keyv/mongo 2.1.6 → 2.1.8
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/README.md +3 -2
- package/package.json +23 -7
- package/src/index.d.ts +12 -9
- package/src/index.js +2 -2
package/README.md
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
> MongoDB storage adapter for Keyv
|
|
4
4
|
|
|
5
5
|
[](https://github.com/jaredwray/keyv/actions/workflows/tests.yaml)
|
|
6
|
-
[](https://codecov.io/gh/jaredwray/keyv)
|
|
7
7
|
[](https://www.npmjs.com/package/@keyv/mongo)
|
|
8
|
+
[](https://npmjs.com/package/@keyv/mongo)
|
|
8
9
|
|
|
9
10
|
MongoDB storage adapter for [Keyv](https://github.com/jaredwray/keyv).
|
|
10
11
|
|
|
@@ -35,4 +36,4 @@ const keyv = new Keyv('mongodb://user:pass@localhost:27017/dbname', { collection
|
|
|
35
36
|
|
|
36
37
|
## License
|
|
37
38
|
|
|
38
|
-
MIT © Jared Wray
|
|
39
|
+
MIT © Jared Wray
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keyv/mongo",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.8",
|
|
4
4
|
"description": "MongoDB storage adapter for Keyv",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"test": "xo && nyc ava",
|
|
7
|
+
"test": "xo && nyc ava --serial",
|
|
8
8
|
"coverage": "nyc report --reporter=text-lcov > coverage.lcov",
|
|
9
9
|
"clean": "rm -rf node_modules && rm -rf .nyc_output && rm -rf coverage.lcov"
|
|
10
10
|
},
|
|
@@ -13,12 +13,26 @@
|
|
|
13
13
|
"unicorn/prefer-module": 0,
|
|
14
14
|
"unicorn/no-array-reduce": 0,
|
|
15
15
|
"unicorn/prefer-object-from-entries": 0,
|
|
16
|
-
"unicorn/prefer-node-protocol": 0
|
|
16
|
+
"unicorn/prefer-node-protocol": 0,
|
|
17
|
+
"ava/no-ignored-test-files": [
|
|
18
|
+
"error",
|
|
19
|
+
{
|
|
20
|
+
"extensions": [
|
|
21
|
+
"js",
|
|
22
|
+
"ts"
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
]
|
|
17
26
|
}
|
|
18
27
|
},
|
|
19
28
|
"ava": {
|
|
20
29
|
"require": [
|
|
21
|
-
"requirable"
|
|
30
|
+
"requirable",
|
|
31
|
+
"ts-node/register"
|
|
32
|
+
],
|
|
33
|
+
"extensions": [
|
|
34
|
+
"js",
|
|
35
|
+
"ts"
|
|
22
36
|
]
|
|
23
37
|
},
|
|
24
38
|
"repository": {
|
|
@@ -44,18 +58,20 @@
|
|
|
44
58
|
},
|
|
45
59
|
"homepage": "https://github.com/jaredwray/keyv",
|
|
46
60
|
"dependencies": {
|
|
47
|
-
"mongodb": "^4.
|
|
61
|
+
"mongodb": "^4.5.0",
|
|
48
62
|
"pify": "^5.0.0"
|
|
49
63
|
},
|
|
50
64
|
"devDependencies": {
|
|
51
65
|
"@keyv/test-suite": "*",
|
|
52
|
-
"ava": "^4.
|
|
66
|
+
"ava": "^4.2.0",
|
|
53
67
|
"keyv": "*",
|
|
54
68
|
"nyc": "^15.1.0",
|
|
55
69
|
"requirable": "^1.0.5",
|
|
56
70
|
"this": "^1.1.0",
|
|
71
|
+
"ts-node": "^10.8.2",
|
|
72
|
+
"@types/keyv": "^3.1.4",
|
|
57
73
|
"tsd": "^0.20.0",
|
|
58
|
-
"typescript": "^4.6.
|
|
74
|
+
"typescript": "^4.6.4",
|
|
59
75
|
"xo": "^0.48.0"
|
|
60
76
|
},
|
|
61
77
|
"tsd" : {
|
package/src/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {EventEmitter} from 'events';
|
|
2
2
|
import GridFSBucket from 'mongodb';
|
|
3
|
+
import {Store, StoredData} from 'keyv';
|
|
3
4
|
|
|
4
|
-
declare class KeyvMongo extends EventEmitter {
|
|
5
|
+
declare class KeyvMongo<Value=any> extends EventEmitter implements Store<Value> {
|
|
5
6
|
readonly ttlSupport: false;
|
|
6
7
|
opts: Record<string, any>;
|
|
7
8
|
connect: Promise<any>;
|
|
@@ -9,16 +10,18 @@ declare class KeyvMongo extends EventEmitter {
|
|
|
9
10
|
bucket: GridFSBucket;
|
|
10
11
|
store: import('mongodb').Collection<import('bson').Document>;
|
|
11
12
|
constructor(options?: string | KeyvMongo.Options);
|
|
12
|
-
get(key: string): Promise<
|
|
13
|
-
getMany(
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
get(key: string): Promise<Value>;
|
|
14
|
+
getMany?(
|
|
15
|
+
keys: string[]
|
|
16
|
+
): Array<StoredData<Value>> | Promise<Array<StoredData<Value>>> | undefined;
|
|
17
|
+
set(key: string, value: Value, ttl?: number): any;
|
|
18
|
+
delete(key: string): boolean | Promise<boolean>;
|
|
16
19
|
deleteMany(keys: string[]): boolean;
|
|
17
|
-
|
|
18
|
-
clearUnusedFor(seconds: any): false | Promise<boolean>;
|
|
19
|
-
clear(): Promise<void>;
|
|
20
|
+
clear(): void | Promise<void>;
|
|
20
21
|
iterator(namespace: string | undefined): AsyncGenerator<any, void, any>;
|
|
21
|
-
has(key: string): boolean
|
|
22
|
+
has?(key: string): boolean | Promise<boolean>;
|
|
23
|
+
clearExpired(): boolean | Promise<boolean>;
|
|
24
|
+
clearUnusedFor(seconds: any): boolean | Promise<boolean>;
|
|
22
25
|
}
|
|
23
26
|
|
|
24
27
|
export = KeyvMongo;
|
package/src/index.js
CHANGED
|
@@ -167,7 +167,7 @@ class KeyvMongo extends EventEmitter {
|
|
|
167
167
|
data.push(value.value);
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
return data
|
|
170
|
+
return data;
|
|
171
171
|
});
|
|
172
172
|
}
|
|
173
173
|
|
|
@@ -190,7 +190,7 @@ class KeyvMongo extends EventEmitter {
|
|
|
190
190
|
i++;
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
return results
|
|
193
|
+
return results;
|
|
194
194
|
}),
|
|
195
195
|
);
|
|
196
196
|
}
|