@keyv/etcd 2.0.1 → 2.1.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/dist/index.cjs CHANGED
@@ -24,9 +24,9 @@ __export(src_exports, {
24
24
  default: () => src_default
25
25
  });
26
26
  module.exports = __toCommonJS(src_exports);
27
- var import_events = require("events");
27
+ var import_node_events = require("events");
28
28
  var import_etcd3 = require("etcd3");
29
- var KeyvEtcd = class extends import_events.EventEmitter {
29
+ var KeyvEtcd = class extends import_node_events.EventEmitter {
30
30
  ttlSupport;
31
31
  opts;
32
32
  client;
@@ -48,7 +48,8 @@ var KeyvEtcd = class extends import_events.EventEmitter {
48
48
  this.opts = {
49
49
  url: "127.0.0.1:2379",
50
50
  ...url,
51
- ...options
51
+ ...options,
52
+ dialect: "etcd"
52
53
  };
53
54
  this.opts.url = this.opts.url.replace(/^etcd:\/\//, "");
54
55
  this.client = new import_etcd3.Etcd3({
@@ -116,7 +117,7 @@ var KeyvEtcd = class extends import_events.EventEmitter {
116
117
  return this.client.get(key).exists();
117
118
  }
118
119
  async disconnect() {
119
- return this.client.close();
120
+ this.client.close();
120
121
  }
121
122
  };
122
123
  var src_default = KeyvEtcd;
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { EventEmitter } from 'events';
1
+ import { EventEmitter } from 'node:events';
2
2
  import { Etcd3, Lease } from 'etcd3';
3
3
  import { StoredData } from 'keyv';
4
4
 
@@ -14,6 +14,7 @@ type KeyvEtcdOptions = {
14
14
  uri?: string;
15
15
  ttl?: number;
16
16
  busyTimeout?: number;
17
+ dialect?: 'etcd';
17
18
  };
18
19
  declare class KeyvEtcd<Value = any> extends EventEmitter {
19
20
  ttlSupport: boolean;
@@ -33,4 +34,4 @@ declare class KeyvEtcd<Value = any> extends EventEmitter {
33
34
  disconnect(): Promise<void>;
34
35
  }
35
36
 
36
- export { KeyvEtcd, KeyvEtcd as default };
37
+ export { KeyvEtcd, type KeyvEtcdOptions, KeyvEtcd as default };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { EventEmitter } from 'events';
1
+ import { EventEmitter } from 'node:events';
2
2
  import { Etcd3, Lease } from 'etcd3';
3
3
  import { StoredData } from 'keyv';
4
4
 
@@ -14,6 +14,7 @@ type KeyvEtcdOptions = {
14
14
  uri?: string;
15
15
  ttl?: number;
16
16
  busyTimeout?: number;
17
+ dialect?: 'etcd';
17
18
  };
18
19
  declare class KeyvEtcd<Value = any> extends EventEmitter {
19
20
  ttlSupport: boolean;
@@ -33,4 +34,4 @@ declare class KeyvEtcd<Value = any> extends EventEmitter {
33
34
  disconnect(): Promise<void>;
34
35
  }
35
36
 
36
- export { KeyvEtcd, KeyvEtcd as default };
37
+ export { KeyvEtcd, type KeyvEtcdOptions, KeyvEtcd as default };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/index.ts
2
- import { EventEmitter } from "events";
2
+ import { EventEmitter } from "node:events";
3
3
  import { Etcd3 } from "etcd3";
4
4
  var KeyvEtcd = class extends EventEmitter {
5
5
  ttlSupport;
@@ -23,7 +23,8 @@ var KeyvEtcd = class extends EventEmitter {
23
23
  this.opts = {
24
24
  url: "127.0.0.1:2379",
25
25
  ...url,
26
- ...options
26
+ ...options,
27
+ dialect: "etcd"
27
28
  };
28
29
  this.opts.url = this.opts.url.replace(/^etcd:\/\//, "");
29
30
  this.client = new Etcd3({
@@ -91,7 +92,7 @@ var KeyvEtcd = class extends EventEmitter {
91
92
  return this.client.get(key).exists();
92
93
  }
93
94
  async disconnect() {
94
- return this.client.close();
95
+ this.client.close();
95
96
  }
96
97
  };
97
98
  var src_default = KeyvEtcd;
package/package.json CHANGED
@@ -1,91 +1,61 @@
1
1
  {
2
- "name": "@keyv/etcd",
3
- "version": "2.0.1",
4
- "description": "Etcd storage adapter for Keyv",
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
- "scripts": {
16
- "build": "rm -rf dist && tsup src/index.ts --format cjs,esm --dts --clean",
17
- "prepare": "yarn build",
18
- "test": "xo --fix && vitest run --coverage",
19
- "test:ci": "xo && vitest --run --sequence.setupFiles=list",
20
- "clean": "rm -rf node_modules && rm -rf ./coverage"
21
- },
22
- "xo": {
23
- "rules": {
24
- "import/no-named-as-default": "off",
25
- "unicorn/prefer-module": "off",
26
- "unicorn/no-array-reduce": "off",
27
- "unicorn/prefer-object-from-entries": "off",
28
- "unicorn/prefer-node-protocol": "off",
29
- "n/file-extension-in-import": "off",
30
- "@typescript-eslint/use-unknown-in-catch-callback-variable": "off",
31
- "import/extensions": "off",
32
- "@typescript-eslint/no-confusing-void-expression": "off",
33
- "@typescript-eslint/promise-function-async": "off",
34
- "eslint-comments/no-unused-disable": "off",
35
- "unicorn/prefer-event-target": "off",
36
- "import/no-extraneous-dependencies": "off"
37
- }
38
- },
39
- "ava": {
40
- "require": [
41
- "requirable",
42
- "ts-node/register"
43
- ],
44
- "extensions": [
45
- "js",
46
- "ts"
47
- ]
48
- },
49
- "repository": {
50
- "type": "git",
51
- "url": "git+https://github.com/jaredwray/keyv.git"
52
- },
53
- "keywords": [
54
- "etcd",
55
- "keyv",
56
- "storage",
57
- "adapter",
58
- "key",
59
- "value",
60
- "store",
61
- "cache",
62
- "ttl"
63
- ],
64
- "author": "Jared Wray <me@jaredwray.com> (https://jaredwray.com)",
65
- "license": "MIT",
66
- "bugs": {
67
- "url": "https://github.com/jaredwray/keyv/issues"
68
- },
69
- "homepage": "https://github.com/jaredwray/keyv",
70
- "dependencies": {
71
- "etcd3": "^1.1.2"
72
- },
73
- "devDependencies": {
74
- "@keyv/test-suite": "*",
75
- "c8": "^10.1.2",
76
- "keyv": "^5.0.0",
77
- "requirable": "^1.0.5",
78
- "ts-node": "^10.9.2",
79
- "tsd": "^0.31.1",
80
- "typescript": "^5.5.4",
81
- "webpack": "^5.93.0",
82
- "xo": "^0.59.3"
83
- },
84
- "tsd": {
85
- "directory": "test"
86
- },
87
- "files": [
88
- "dist",
89
- "LICENSE"
90
- ]
91
- }
2
+ "name": "@keyv/etcd",
3
+ "version": "2.1.0",
4
+ "description": "Etcd storage adapter for Keyv",
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
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/jaredwray/keyv.git"
18
+ },
19
+ "keywords": [
20
+ "etcd",
21
+ "keyv",
22
+ "storage",
23
+ "adapter",
24
+ "key",
25
+ "value",
26
+ "store",
27
+ "cache",
28
+ "ttl"
29
+ ],
30
+ "author": "Jared Wray <me@jaredwray.com> (https://jaredwray.com)",
31
+ "license": "MIT",
32
+ "bugs": {
33
+ "url": "https://github.com/jaredwray/keyv/issues"
34
+ },
35
+ "homepage": "https://github.com/jaredwray/keyv",
36
+ "dependencies": {
37
+ "etcd3": "^1.1.2"
38
+ },
39
+ "devDependencies": {
40
+ "@vitest/coverage-v8": "^2.1.8",
41
+ "rimraf": "^6.0.1",
42
+ "typescript": "^5.7.2",
43
+ "vitest": "^2.1.8",
44
+ "xo": "^0.60.0",
45
+ "@keyv/test-suite": "^2.0.3",
46
+ "keyv": "^5.2.1"
47
+ },
48
+ "tsd": {
49
+ "directory": "test"
50
+ },
51
+ "files": [
52
+ "dist",
53
+ "LICENSE"
54
+ ],
55
+ "scripts": {
56
+ "build": "rimraf ./dist && tsup src/index.ts --format cjs,esm --dts --clean",
57
+ "test": "xo --fix && vitest run --coverage",
58
+ "test:ci": "xo && vitest --run --sequence.setupFiles=list",
59
+ "clean": "rimraf ./node_modules ./coverage ./dist"
60
+ }
61
+ }