@maestro-js/cache 1.0.0-alpha.24 → 1.0.0-alpha.26
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.d.ts +10 -1
- package/dist/index.js +7 -8
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Log } from '@maestro-js/log';
|
|
2
2
|
import Redis$1, { Redis } from 'ioredis';
|
|
3
|
+
import { ConnectionOptions } from 'node:tls';
|
|
3
4
|
|
|
4
5
|
/** Contract that every cache backend (Redis, MockRedis, etc.) must implement */
|
|
5
6
|
interface CacheDriver {
|
|
@@ -54,9 +55,17 @@ interface RedisDriverConfig {
|
|
|
54
55
|
operationTimeout?: number;
|
|
55
56
|
connectTimeout?: number;
|
|
56
57
|
keyPrefix?: string;
|
|
58
|
+
/** ACL username for `AUTH`. Omit for the default user. */
|
|
59
|
+
username?: string;
|
|
60
|
+
/** Password for `AUTH`. */
|
|
61
|
+
password?: string;
|
|
62
|
+
/** Logical database index to `SELECT` after connecting. Defaults to 0. */
|
|
63
|
+
db?: number;
|
|
64
|
+
/** TLS connection options. Pass `{}` to enable TLS with defaults. Omit for a plaintext connection. */
|
|
65
|
+
tls?: ConnectionOptions;
|
|
57
66
|
logger?: Log.LogFunctions;
|
|
58
67
|
}
|
|
59
|
-
declare function redisCacheDriver({ url, port, operationTimeout, connectTimeout, keyPrefix, logger: loggerInput }: RedisDriverConfig): CacheDriver & {
|
|
68
|
+
declare function redisCacheDriver({ url, port, operationTimeout, connectTimeout, keyPrefix, username, password, db, tls, logger: loggerInput }: RedisDriverConfig): CacheDriver & {
|
|
60
69
|
connection: Redis$1;
|
|
61
70
|
};
|
|
62
71
|
|
package/dist/index.js
CHANGED
|
@@ -182,17 +182,16 @@ function redisCacheDriver({
|
|
|
182
182
|
operationTimeout = 5e3,
|
|
183
183
|
connectTimeout = 1e4,
|
|
184
184
|
keyPrefix = "",
|
|
185
|
+
username,
|
|
186
|
+
password,
|
|
187
|
+
db,
|
|
188
|
+
tls,
|
|
185
189
|
logger: loggerInput
|
|
186
190
|
}) {
|
|
187
191
|
const logger = loggerInput;
|
|
188
|
-
const
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
});
|
|
192
|
-
const subscriber = new Redis2(port, url, {
|
|
193
|
-
connectTimeout,
|
|
194
|
-
keyPrefix
|
|
195
|
-
});
|
|
192
|
+
const connectionOptions = { connectTimeout, keyPrefix, username, password, db, tls };
|
|
193
|
+
const redis = new Redis2(port, url, connectionOptions);
|
|
194
|
+
const subscriber = new Redis2(port, url, connectionOptions);
|
|
196
195
|
const lockEmitter = new EventEmitter();
|
|
197
196
|
const channelPrefix = [keyPrefix, "maestro.events."].join("");
|
|
198
197
|
const cacheLockChannelName = `${channelPrefix}cache-locks`;
|
package/package.json
CHANGED
|
@@ -13,16 +13,16 @@
|
|
|
13
13
|
"ioredis-timeout": "^1.5.0",
|
|
14
14
|
"ioredis-mock": "^8.2.0",
|
|
15
15
|
"@types/ioredis-mock": "^8.2.6",
|
|
16
|
-
"@maestro-js/service-registry": "1.0.0-alpha.
|
|
16
|
+
"@maestro-js/service-registry": "1.0.0-alpha.26"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"@maestro-js/log": "1.0.0-alpha.
|
|
19
|
+
"@maestro-js/log": "1.0.0-alpha.26"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/node": "^22.19.11",
|
|
23
|
-
"@maestro-js/log": "1.0.0-alpha.
|
|
23
|
+
"@maestro-js/log": "1.0.0-alpha.26"
|
|
24
24
|
},
|
|
25
|
-
"version": "1.0.0-alpha.
|
|
25
|
+
"version": "1.0.0-alpha.26",
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"access": "public"
|
|
28
28
|
},
|