keyv 5.1.0 → 5.1.1
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 +8 -0
- package/dist/index.cjs +17 -0
- package/dist/index.d.cts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +17 -0
- package/package.json +98 -94
package/README.md
CHANGED
|
@@ -221,6 +221,7 @@ The official storage adapters are covered by [over 150 integration tests](https:
|
|
|
221
221
|
Database | Adapter | Native TTL
|
|
222
222
|
---|---|---
|
|
223
223
|
Redis | [@keyv/redis](https://github.com/jaredwray/keyv/tree/master/packages/redis) | Yes
|
|
224
|
+
Valkey | [@keyv/valkey](https://github.com/jaredwray/keyv/tree/master/packages/valkey) | Yes
|
|
224
225
|
MongoDB | [@keyv/mongo](https://github.com/jaredwray/keyv/tree/master/packages/mongo) | Yes
|
|
225
226
|
SQLite | [@keyv/sqlite](https://github.com/jaredwray/keyv/tree/master/packages/sqlite) | No
|
|
226
227
|
PostgreSQL | [@keyv/postgres](https://github.com/jaredwray/keyv/tree/master/packages/postgres) | No
|
|
@@ -356,6 +357,13 @@ The connection string URI.
|
|
|
356
357
|
|
|
357
358
|
Merged into the options object as options.uri.
|
|
358
359
|
|
|
360
|
+
### .namespace
|
|
361
|
+
|
|
362
|
+
Type: `String`
|
|
363
|
+
Default: `'keyv'`
|
|
364
|
+
|
|
365
|
+
This is the namespace for the current instance. When you set it it will set it also on the storage adapter. This is the preferred way to set the namespace over `.opts.namespace`.
|
|
366
|
+
|
|
359
367
|
### options
|
|
360
368
|
|
|
361
369
|
Type: `Object`
|
package/dist/index.cjs
CHANGED
|
@@ -275,6 +275,23 @@ var Keyv = class extends event_manager_default {
|
|
|
275
275
|
this.stats.enabled = this.opts.stats;
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
|
+
/**
|
|
279
|
+
* Get the current namespace.
|
|
280
|
+
* @returns {string | undefined} The current namespace.
|
|
281
|
+
*/
|
|
282
|
+
get namespace() {
|
|
283
|
+
return this.opts.namespace;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Set the current namespace.
|
|
287
|
+
* @param {string | undefined} namespace The namespace to set.
|
|
288
|
+
*/
|
|
289
|
+
set namespace(namespace) {
|
|
290
|
+
this.opts.namespace = namespace;
|
|
291
|
+
if (this.opts.store) {
|
|
292
|
+
this.opts.store.namespace = namespace;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
278
295
|
generateIterator(iterator) {
|
|
279
296
|
const function_ = async function* () {
|
|
280
297
|
for await (const [key, raw] of typeof iterator === "function" ? iterator(this.opts.store.namespace) : iterator) {
|
package/dist/index.d.cts
CHANGED
|
@@ -107,6 +107,16 @@ declare class Keyv<GenericValue = any> extends EventManager {
|
|
|
107
107
|
stats: StatsManager;
|
|
108
108
|
constructor(store?: KeyvStoreAdapter | KeyvOptions | Map<any, any>, options?: Omit<KeyvOptions, 'store'>);
|
|
109
109
|
constructor(options?: KeyvOptions);
|
|
110
|
+
/**
|
|
111
|
+
* Get the current namespace.
|
|
112
|
+
* @returns {string | undefined} The current namespace.
|
|
113
|
+
*/
|
|
114
|
+
get namespace(): string | undefined;
|
|
115
|
+
/**
|
|
116
|
+
* Set the current namespace.
|
|
117
|
+
* @param {string | undefined} namespace The namespace to set.
|
|
118
|
+
*/
|
|
119
|
+
set namespace(namespace: string | undefined);
|
|
110
120
|
generateIterator(iterator: IteratorFunction): IteratorFunction;
|
|
111
121
|
_checkIterableAdapter(): boolean;
|
|
112
122
|
_getKeyPrefix(key: string): string;
|
package/dist/index.d.ts
CHANGED
|
@@ -107,6 +107,16 @@ declare class Keyv<GenericValue = any> extends EventManager {
|
|
|
107
107
|
stats: StatsManager;
|
|
108
108
|
constructor(store?: KeyvStoreAdapter | KeyvOptions | Map<any, any>, options?: Omit<KeyvOptions, 'store'>);
|
|
109
109
|
constructor(options?: KeyvOptions);
|
|
110
|
+
/**
|
|
111
|
+
* Get the current namespace.
|
|
112
|
+
* @returns {string | undefined} The current namespace.
|
|
113
|
+
*/
|
|
114
|
+
get namespace(): string | undefined;
|
|
115
|
+
/**
|
|
116
|
+
* Set the current namespace.
|
|
117
|
+
* @param {string | undefined} namespace The namespace to set.
|
|
118
|
+
*/
|
|
119
|
+
set namespace(namespace: string | undefined);
|
|
110
120
|
generateIterator(iterator: IteratorFunction): IteratorFunction;
|
|
111
121
|
_checkIterableAdapter(): boolean;
|
|
112
122
|
_getKeyPrefix(key: string): string;
|
package/dist/index.js
CHANGED
|
@@ -249,6 +249,23 @@ var Keyv = class extends event_manager_default {
|
|
|
249
249
|
this.stats.enabled = this.opts.stats;
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
|
+
/**
|
|
253
|
+
* Get the current namespace.
|
|
254
|
+
* @returns {string | undefined} The current namespace.
|
|
255
|
+
*/
|
|
256
|
+
get namespace() {
|
|
257
|
+
return this.opts.namespace;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Set the current namespace.
|
|
261
|
+
* @param {string | undefined} namespace The namespace to set.
|
|
262
|
+
*/
|
|
263
|
+
set namespace(namespace) {
|
|
264
|
+
this.opts.namespace = namespace;
|
|
265
|
+
if (this.opts.store) {
|
|
266
|
+
this.opts.store.namespace = namespace;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
252
269
|
generateIterator(iterator) {
|
|
253
270
|
const function_ = async function* () {
|
|
254
271
|
for await (const [key, raw] of typeof iterator === "function" ? iterator(this.opts.store.namespace) : iterator) {
|
package/package.json
CHANGED
|
@@ -1,95 +1,99 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
2
|
+
"name": "keyv",
|
|
3
|
+
"version": "5.1.1",
|
|
4
|
+
"description": "Simple key-value storage with support for multiple backends",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.cjs",
|
|
7
|
+
"module": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"require": "./dist/index.cjs",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"xo": {
|
|
16
|
+
"rules": {
|
|
17
|
+
"import/no-named-as-default": "off",
|
|
18
|
+
"unicorn/prefer-module": "off",
|
|
19
|
+
"unicorn/prefer-node-protocol": "off",
|
|
20
|
+
"@typescript-eslint/consistent-type-definitions": "off",
|
|
21
|
+
"unicorn/no-typeof-undefined": "off",
|
|
22
|
+
"unicorn/prefer-event-target": "off",
|
|
23
|
+
"import/no-extraneous-dependencies": "off",
|
|
24
|
+
"import/extensions": "off",
|
|
25
|
+
"@typescript-eslint/ban-ts-comment": "off",
|
|
26
|
+
"@typescript-eslint/no-unsafe-call": "off",
|
|
27
|
+
"@typescript-eslint/no-for-in-array": "off",
|
|
28
|
+
"guard-for-in": "off",
|
|
29
|
+
"no-await-in-loop": "off",
|
|
30
|
+
"@typescript-eslint/no-unsafe-return": "off",
|
|
31
|
+
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
32
|
+
"@typescript-eslint/no-unsafe-argument": "off",
|
|
33
|
+
"@typescript-eslint/naming-convention": "off",
|
|
34
|
+
"@typescript-eslint/consistent-type-assertions": "off",
|
|
35
|
+
"@typescript-eslint/no-confusing-void-expression": "off",
|
|
36
|
+
"@typescript-eslint/no-var-requires": "off",
|
|
37
|
+
"@typescript-eslint/prefer-ts-expect-error": "off"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"repository": {
|
|
41
|
+
"type": "git",
|
|
42
|
+
"url": "git+https://github.com/jaredwray/keyv.git"
|
|
43
|
+
},
|
|
44
|
+
"keywords": [
|
|
45
|
+
"key",
|
|
46
|
+
"value",
|
|
47
|
+
"store",
|
|
48
|
+
"cache",
|
|
49
|
+
"ttl",
|
|
50
|
+
"key-value",
|
|
51
|
+
"storage",
|
|
52
|
+
"backend",
|
|
53
|
+
"adapter",
|
|
54
|
+
"redis",
|
|
55
|
+
"mongodb",
|
|
56
|
+
"sqlite",
|
|
57
|
+
"mysql",
|
|
58
|
+
"postgresql",
|
|
59
|
+
"memory",
|
|
60
|
+
"node-cache",
|
|
61
|
+
"lru-cache",
|
|
62
|
+
"lru",
|
|
63
|
+
"cache-manager"
|
|
64
|
+
],
|
|
65
|
+
"author": "Jared Wray <me@jaredwray.com> (http://jaredwray.com)",
|
|
66
|
+
"license": "MIT",
|
|
67
|
+
"bugs": {
|
|
68
|
+
"url": "https://github.com/jaredwray/keyv/issues"
|
|
69
|
+
},
|
|
70
|
+
"homepage": "https://github.com/jaredwray/keyv",
|
|
71
|
+
"dependencies": {
|
|
72
|
+
"@keyv/serialize": "*"
|
|
73
|
+
},
|
|
74
|
+
"devDependencies": {
|
|
75
|
+
"@keyv/compress-brotli": "*",
|
|
76
|
+
"@keyv/compress-gzip": "*",
|
|
77
|
+
"@keyv/memcache": "*",
|
|
78
|
+
"@keyv/mongo": "*",
|
|
79
|
+
"@keyv/sqlite": "*",
|
|
80
|
+
"@keyv/test-suite": "*",
|
|
81
|
+
"rimraf": "^6.0.1",
|
|
82
|
+
"timekeeper": "^2.3.1",
|
|
83
|
+
"tsd": "^0.31.2",
|
|
84
|
+
"xo": "^0.59.3"
|
|
85
|
+
},
|
|
86
|
+
"tsd": {
|
|
87
|
+
"directory": "test"
|
|
88
|
+
},
|
|
89
|
+
"files": [
|
|
90
|
+
"dist",
|
|
91
|
+
"LISCENCE"
|
|
92
|
+
],
|
|
93
|
+
"scripts": {
|
|
94
|
+
"build": "rimraf ./dist && tsup src/index.ts --format cjs,esm --dts --clean",
|
|
95
|
+
"test": "xo --fix && vitest run --coverage",
|
|
96
|
+
"test:ci": "xo && vitest --run --sequence.setupFiles=list",
|
|
97
|
+
"clean": "rimraf ./node_modules ./coverage ./test/testdb.sqlite ./dist"
|
|
98
|
+
}
|
|
99
|
+
}
|