node-server-engine 1.7.4 → 1.8.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/entities/Redis/Redis.d.ts +10 -2
- package/dist/entities/Redis/Redis.js +104 -9
- package/dist/entities/Redis/Redis.js.map +1 -1
- package/dist/entities/Redis/Redis.types.d.ts +6 -0
- package/dist/entities/Redis/Redis.types.js.map +1 -1
- package/dist/entities/Redis/index.d.ts +1 -1
- package/dist/entities/Redis/index.js +22 -1
- package/dist/entities/Redis/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import { Redis as RedisClient } from 'ioredis';
|
|
2
2
|
import { RedisCreateOptions } from './Redis.types';
|
|
3
3
|
export declare let redisClient: undefined | RedisClient;
|
|
4
|
+
/**
|
|
5
|
+
* Factory function to create a new Redis instance (exported for testing)
|
|
6
|
+
*/
|
|
7
|
+
export declare function createRedisInstance(config: any): RedisClient;
|
|
4
8
|
/**
|
|
5
9
|
* We use a proxy to extend the Redis behavior and allow initialization of the client only when needed while keeping the same interface
|
|
6
10
|
*/
|
|
7
11
|
export declare const Redis: never;
|
|
8
12
|
/**
|
|
9
|
-
*
|
|
13
|
+
* Get the underlying Redis client (for advanced use cases)
|
|
14
|
+
*/
|
|
15
|
+
export declare function getClient(): RedisClient | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* On init create client and connect
|
|
10
18
|
*/
|
|
11
19
|
export declare function init(): void;
|
|
12
20
|
/**
|
|
@@ -14,6 +22,6 @@ export declare function init(): void;
|
|
|
14
22
|
*/
|
|
15
23
|
export declare function shutdown(): Promise<void>;
|
|
16
24
|
/**
|
|
17
|
-
* Create Redis client
|
|
25
|
+
* Create Redis client with enhanced configuration
|
|
18
26
|
*/
|
|
19
27
|
export declare function createRedisClient(options?: RedisCreateOptions): RedisClient;
|
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.Redis = void 0;
|
|
7
7
|
exports.createRedisClient = createRedisClient;
|
|
8
|
+
exports.createRedisInstance = createRedisInstance;
|
|
9
|
+
exports.getClient = getClient;
|
|
8
10
|
exports.init = init;
|
|
9
11
|
exports.redisClient = void 0;
|
|
10
12
|
exports.shutdown = shutdown;
|
|
@@ -12,8 +14,16 @@ var _ioredis = require("ioredis");
|
|
|
12
14
|
var _Redis = require("./Redis.validate");
|
|
13
15
|
var _EngineError = require("../EngineError");
|
|
14
16
|
var _LifecycleController = require("../LifecycleController");
|
|
17
|
+
var _report = require("../../utils/report");
|
|
15
18
|
let redisClient = exports.redisClient = void 0;
|
|
16
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Factory function to create a new Redis instance (exported for testing)
|
|
22
|
+
*/
|
|
23
|
+
function createRedisInstance(config) {
|
|
24
|
+
return new _ioredis.Redis(config);
|
|
25
|
+
}
|
|
26
|
+
|
|
17
27
|
/**
|
|
18
28
|
* We use a proxy to extend the Redis behavior and allow initialization of the client only when needed while keeping the same interface
|
|
19
29
|
*/
|
|
@@ -25,6 +35,7 @@ const Redis = exports.Redis = new Proxy(
|
|
|
25
35
|
get: function (target, property) {
|
|
26
36
|
if (property === 'init') return init;
|
|
27
37
|
if (property === 'shutdown') return shutdown;
|
|
38
|
+
if (property === 'getClient') return getClient;
|
|
28
39
|
// Create the redis client if it does not exist
|
|
29
40
|
if (!redisClient) throw new _EngineError.EngineError({
|
|
30
41
|
message: 'Redis client was not initialized'
|
|
@@ -37,12 +48,59 @@ const Redis = exports.Redis = new Proxy(
|
|
|
37
48
|
});
|
|
38
49
|
|
|
39
50
|
/**
|
|
40
|
-
*
|
|
51
|
+
* Get the underlying Redis client (for advanced use cases)
|
|
52
|
+
*/
|
|
53
|
+
function getClient() {
|
|
54
|
+
return redisClient;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* On init create client and connect
|
|
41
59
|
*/
|
|
42
60
|
function init() {
|
|
43
61
|
// Ignore if already initialized
|
|
44
|
-
if (redisClient)
|
|
62
|
+
if (redisClient) {
|
|
63
|
+
(0, _report.reportDebug)({
|
|
64
|
+
namespace: 'engine:redis',
|
|
65
|
+
message: 'Redis client already initialized'
|
|
66
|
+
});
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
45
69
|
exports.redisClient = redisClient = createRedisClient();
|
|
70
|
+
|
|
71
|
+
// Setup event listeners
|
|
72
|
+
redisClient.on('connect', () => {
|
|
73
|
+
(0, _report.reportDebug)({
|
|
74
|
+
namespace: 'engine:redis',
|
|
75
|
+
message: 'Redis client connecting'
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
redisClient.on('ready', () => {
|
|
79
|
+
(0, _report.reportDebug)({
|
|
80
|
+
namespace: 'engine:redis',
|
|
81
|
+
message: 'Redis client ready'
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
redisClient.on('error', err => {
|
|
85
|
+
(0, _report.reportError)(new _EngineError.EngineError({
|
|
86
|
+
message: 'Redis client error',
|
|
87
|
+
data: {
|
|
88
|
+
error: err.message
|
|
89
|
+
}
|
|
90
|
+
}));
|
|
91
|
+
});
|
|
92
|
+
redisClient.on('close', () => {
|
|
93
|
+
(0, _report.reportDebug)({
|
|
94
|
+
namespace: 'engine:redis',
|
|
95
|
+
message: 'Redis connection closed'
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
redisClient.on('reconnecting', () => {
|
|
99
|
+
(0, _report.reportDebug)({
|
|
100
|
+
namespace: 'engine:redis',
|
|
101
|
+
message: 'Redis client reconnecting'
|
|
102
|
+
});
|
|
103
|
+
});
|
|
46
104
|
_LifecycleController.LifecycleController.register(Redis);
|
|
47
105
|
}
|
|
48
106
|
|
|
@@ -50,26 +108,63 @@ function init() {
|
|
|
50
108
|
* On shutdown close connection and clear client
|
|
51
109
|
*/
|
|
52
110
|
async function shutdown() {
|
|
53
|
-
if (redisClient)
|
|
111
|
+
if (redisClient) {
|
|
112
|
+
try {
|
|
113
|
+
await redisClient.quit();
|
|
114
|
+
(0, _report.reportDebug)({
|
|
115
|
+
namespace: 'engine:redis',
|
|
116
|
+
message: 'Redis client disconnected'
|
|
117
|
+
});
|
|
118
|
+
} catch (error) {
|
|
119
|
+
(0, _report.reportError)(new _EngineError.EngineError({
|
|
120
|
+
message: 'Error during Redis shutdown',
|
|
121
|
+
data: {
|
|
122
|
+
error: error.message
|
|
123
|
+
}
|
|
124
|
+
}));
|
|
125
|
+
}
|
|
126
|
+
}
|
|
54
127
|
exports.redisClient = redisClient = undefined;
|
|
55
128
|
}
|
|
56
129
|
|
|
57
130
|
/**
|
|
58
|
-
* Create Redis client
|
|
131
|
+
* Create Redis client with enhanced configuration
|
|
59
132
|
*/
|
|
60
133
|
function createRedisClient(options = {}) {
|
|
61
134
|
// Check that environment variables are correctly set
|
|
62
135
|
(0, _Redis.validateRedisEnvironment)(options);
|
|
63
|
-
|
|
136
|
+
|
|
137
|
+
// Throw an error if there is no host
|
|
64
138
|
if (!process.env.REDIS_HOST) throw new _EngineError.EngineError({
|
|
65
139
|
message: 'Host required to initialize Redis connection'
|
|
66
140
|
});
|
|
67
|
-
|
|
68
|
-
port: process.env.REDIS_PORT ? parseInt(process.env.REDIS_PORT) :
|
|
141
|
+
const config = {
|
|
142
|
+
port: process.env.REDIS_PORT ? parseInt(process.env.REDIS_PORT) : 6379,
|
|
69
143
|
host: process.env.REDIS_HOST,
|
|
70
144
|
username: process.env.REDIS_USERNAME,
|
|
71
145
|
password: process.env.REDIS_PASSWORD,
|
|
72
|
-
db: 0
|
|
73
|
-
|
|
146
|
+
db: options.db ?? 0,
|
|
147
|
+
retryStrategy: times => {
|
|
148
|
+
const delay = Math.min(times * 50, 2000);
|
|
149
|
+
return delay;
|
|
150
|
+
},
|
|
151
|
+
reconnectOnError: err => {
|
|
152
|
+
const targetErrors = ['READONLY', 'ECONNRESET', 'ETIMEDOUT'];
|
|
153
|
+
return targetErrors.some(targetError => err.message.includes(targetError));
|
|
154
|
+
},
|
|
155
|
+
maxRetriesPerRequest: 3,
|
|
156
|
+
enableReadyCheck: options.enableReadyCheck ?? true,
|
|
157
|
+
lazyConnect: options.lazyConnect ?? process.env.NODE_ENV === 'test',
|
|
158
|
+
...options.redis
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
// Add TLS configuration if TLS_CA is provided
|
|
162
|
+
if (process.env.TLS_CA) {
|
|
163
|
+
config.tls = {
|
|
164
|
+
ca: process.env.TLS_CA,
|
|
165
|
+
rejectUnauthorized: process.env.NODE_ENV === 'production'
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
return createRedisInstance(config);
|
|
74
169
|
}
|
|
75
170
|
//# sourceMappingURL=Redis.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Redis.js","names":["_ioredis","require","_Redis","_EngineError","_LifecycleController","redisClient","exports","Redis","Proxy","get","target","property","init","shutdown","EngineError","message","createRedisClient","LifecycleController","register","quit","undefined","options","validateRedisEnvironment","process","env","REDIS_HOST","
|
|
1
|
+
{"version":3,"file":"Redis.js","names":["_ioredis","require","_Redis","_EngineError","_LifecycleController","_report","redisClient","exports","createRedisInstance","config","RedisClient","Redis","Proxy","get","target","property","init","shutdown","getClient","EngineError","message","reportDebug","namespace","createRedisClient","on","err","reportError","data","error","LifecycleController","register","quit","undefined","options","validateRedisEnvironment","process","env","REDIS_HOST","port","REDIS_PORT","parseInt","host","username","REDIS_USERNAME","password","REDIS_PASSWORD","db","retryStrategy","times","delay","Math","min","reconnectOnError","targetErrors","some","targetError","includes","maxRetriesPerRequest","enableReadyCheck","lazyConnect","NODE_ENV","redis","TLS_CA","tls","ca","rejectUnauthorized"],"sources":["../../../src/entities/Redis/Redis.ts"],"sourcesContent":["import { Redis as RedisClient } from 'ioredis';\nimport { RedisInterface, RedisCreateOptions } from './Redis.types';\nimport { validateRedisEnvironment } from './Redis.validate';\nimport { EngineError } from 'entities/EngineError';\nimport { LifecycleController } from 'entities/LifecycleController';\nimport { reportDebug, reportError } from 'utils/report';\n\nexport let redisClient: undefined | RedisClient;\n\n/**\n * Factory function to create a new Redis instance (exported for testing)\n */\nexport function createRedisInstance(config: any): RedisClient {\n return new RedisClient(config);\n}\n\n/**\n * We use a proxy to extend the Redis behavior and allow initialization of the client only when needed while keeping the same interface\n */\nexport const Redis = new Proxy<RedisInterface>(\n // Due to how we do the proxying, we are forced to ignore ts-errors, we could never create an object that respects the interface properly\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n {},\n {\n get: function (target, property): unknown {\n if (property === 'init') return init;\n if (property === 'shutdown') return shutdown;\n if (property === 'getClient') return getClient;\n // Create the redis client if it does not exist\n if (!redisClient)\n throw new EngineError({ message: 'Redis client was not initialized' });\n // Call the function on the redis client\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return redisClient[property] as unknown;\n }\n }\n);\n\n/**\n * Get the underlying Redis client (for advanced use cases)\n */\nexport function getClient(): RedisClient | undefined {\n return redisClient;\n}\n\n/**\n * On init create client and connect\n */\nexport function init(): void {\n // Ignore if already initialized\n if (redisClient) {\n reportDebug({\n namespace: 'engine:redis',\n message: 'Redis client already initialized'\n });\n return;\n }\n \n redisClient = createRedisClient();\n \n // Setup event listeners\n redisClient.on('connect', () => {\n reportDebug({\n namespace: 'engine:redis',\n message: 'Redis client connecting'\n });\n });\n \n redisClient.on('ready', () => {\n reportDebug({\n namespace: 'engine:redis',\n message: 'Redis client ready'\n });\n });\n \n redisClient.on('error', (err) => {\n reportError(new EngineError({\n message: 'Redis client error',\n data: { error: err.message }\n }));\n });\n \n redisClient.on('close', () => {\n reportDebug({\n namespace: 'engine:redis',\n message: 'Redis connection closed'\n });\n });\n \n redisClient.on('reconnecting', () => {\n reportDebug({\n namespace: 'engine:redis',\n message: 'Redis client reconnecting'\n });\n });\n \n LifecycleController.register(Redis);\n}\n\n/**\n * On shutdown close connection and clear client\n */\nexport async function shutdown(): Promise<void> {\n if (redisClient) {\n try {\n await redisClient.quit();\n reportDebug({\n namespace: 'engine:redis',\n message: 'Redis client disconnected'\n });\n } catch (error) {\n reportError(new EngineError({\n message: 'Error during Redis shutdown',\n data: { error: (error as Error).message }\n }));\n }\n }\n redisClient = undefined;\n}\n\n/**\n * Create Redis client with enhanced configuration\n */\nexport function createRedisClient(\n options: RedisCreateOptions = {}\n): RedisClient {\n // Check that environment variables are correctly set\n validateRedisEnvironment(options);\n \n // Throw an error if there is no host\n if (!process.env.REDIS_HOST)\n throw new EngineError({\n message: 'Host required to initialize Redis connection'\n });\n\n const config: any = {\n port: process.env.REDIS_PORT ? parseInt(process.env.REDIS_PORT) : 6379,\n host: process.env.REDIS_HOST,\n username: process.env.REDIS_USERNAME,\n password: process.env.REDIS_PASSWORD,\n db: options.db ?? 0,\n retryStrategy: (times: number) => {\n const delay = Math.min(times * 50, 2000);\n return delay;\n },\n reconnectOnError: (err: Error) => {\n const targetErrors = ['READONLY', 'ECONNRESET', 'ETIMEDOUT'];\n return targetErrors.some(targetError => err.message.includes(targetError));\n },\n maxRetriesPerRequest: 3,\n enableReadyCheck: options.enableReadyCheck ?? true,\n lazyConnect: options.lazyConnect ?? (process.env.NODE_ENV === 'test'),\n ...options.redis\n };\n\n // Add TLS configuration if TLS_CA is provided\n if (process.env.TLS_CA) {\n config.tls = {\n ca: process.env.TLS_CA,\n rejectUnauthorized: process.env.NODE_ENV === 'production'\n };\n }\n\n return createRedisInstance(config);\n}\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,oBAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAEO,IAAIK,WAAoC,GAAAC,OAAA,CAAAD,WAAA;;AAE/C;AACA;AACA;AACO,SAASE,mBAAmBA,CAACC,MAAW,EAAe;EAC5D,OAAO,IAAIC,cAAW,CAACD,MAAM,C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AAC;AACpC","ignoreList":[]}
|
|
@@ -4,6 +4,8 @@ export type RedisInterface = IoRedis & Cluster & {
|
|
|
4
4
|
init: () => void;
|
|
5
5
|
/** Stop the redis service */
|
|
6
6
|
shutdown: () => Promise<void>;
|
|
7
|
+
/** Get the underlying Redis client */
|
|
8
|
+
getClient: () => IoRedis | undefined;
|
|
7
9
|
};
|
|
8
10
|
/** Options to initialize a Redis client */
|
|
9
11
|
export interface RedisCreateOptions {
|
|
@@ -13,4 +15,8 @@ export interface RedisCreateOptions {
|
|
|
13
15
|
enableReadyCheck?: boolean;
|
|
14
16
|
/** Cluster mode read operation settings, can make reads on masters, slaves, or both */
|
|
15
17
|
scaleReads?: string;
|
|
18
|
+
/** Database index to use (default: 0) */
|
|
19
|
+
db?: number;
|
|
20
|
+
/** Lazy connect - don't connect until first command (default: false) */
|
|
21
|
+
lazyConnect?: boolean;
|
|
16
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Redis.types.js","names":[],"sources":["../../../src/entities/Redis/Redis.types.ts"],"sourcesContent":["import { Redis as IoRedis, Cluster, RedisOptions } from 'ioredis';\n\nexport type RedisInterface = IoRedis &\n Cluster & {\n /** Start the redis service */\n init: () => void;\n /** Stop the redis service */\n shutdown: () => Promise<void>;\n };\n\n/** Options to initialize a Redis client */\nexport interface RedisCreateOptions {\n /** Redis client settings */\n redis?: RedisOptions;\n /** Should the client perform readiness check when establishing the connection */\n enableReadyCheck?: boolean;\n /** Cluster mode read operation settings, can make reads on masters, slaves, or both */\n scaleReads?: string;\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Redis.types.js","names":[],"sources":["../../../src/entities/Redis/Redis.types.ts"],"sourcesContent":["import { Redis as IoRedis, Cluster, RedisOptions } from 'ioredis';\n\nexport type RedisInterface = IoRedis &\n Cluster & {\n /** Start the redis service */\n init: () => void;\n /** Stop the redis service */\n shutdown: () => Promise<void>;\n /** Get the underlying Redis client */\n getClient: () => IoRedis | undefined;\n };\n\n/** Options to initialize a Redis client */\nexport interface RedisCreateOptions {\n /** Redis client settings */\n redis?: RedisOptions;\n /** Should the client perform readiness check when establishing the connection */\n enableReadyCheck?: boolean;\n /** Cluster mode read operation settings, can make reads on masters, slaves, or both */\n scaleReads?: string;\n /** Database index to use (default: 0) */\n db?: number;\n /** Lazy connect - don't connect until first command (default: false) */\n lazyConnect?: boolean;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Redis, createRedisClient } from './Redis';
|
|
1
|
+
export { Redis, createRedisClient, getClient, init, shutdown } from './Redis';
|
|
2
2
|
export * from './Redis.types';
|
|
@@ -5,7 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
var _exportNames = {
|
|
7
7
|
Redis: true,
|
|
8
|
-
createRedisClient: true
|
|
8
|
+
createRedisClient: true,
|
|
9
|
+
getClient: true,
|
|
10
|
+
init: true,
|
|
11
|
+
shutdown: true
|
|
9
12
|
};
|
|
10
13
|
Object.defineProperty(exports, "Redis", {
|
|
11
14
|
enumerable: true,
|
|
@@ -19,6 +22,24 @@ Object.defineProperty(exports, "createRedisClient", {
|
|
|
19
22
|
return _Redis.createRedisClient;
|
|
20
23
|
}
|
|
21
24
|
});
|
|
25
|
+
Object.defineProperty(exports, "getClient", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return _Redis.getClient;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(exports, "init", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () {
|
|
34
|
+
return _Redis.init;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(exports, "shutdown", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function () {
|
|
40
|
+
return _Redis.shutdown;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
22
43
|
var _Redis = require("./Redis");
|
|
23
44
|
var _Redis2 = require("./Redis.types");
|
|
24
45
|
Object.keys(_Redis2).forEach(function (key) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_Redis","require","_Redis2","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get"],"sources":["../../../src/entities/Redis/index.ts"],"sourcesContent":["export { Redis, createRedisClient } from './Redis';\nexport * from './Redis.types';\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["_Redis","require","_Redis2","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get"],"sources":["../../../src/entities/Redis/index.ts"],"sourcesContent":["export { Redis, createRedisClient, getClient, init, shutdown } from './Redis';\nexport * from './Redis.types';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAAAE,MAAA,CAAAC,IAAA,CAAAF,OAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,OAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,OAAA,CAAAI,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-server-engine",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "Framework used to develop backend services. This package ships with a lot of features to standardize the creation of services, letting you focus on the business logic.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"filesize-parser": "^1.5.1",
|
|
63
63
|
"fs-extra": "^11.3.0",
|
|
64
64
|
"glob": "^11.0.0",
|
|
65
|
-
"ioredis": "^5.
|
|
65
|
+
"ioredis": "^5.8.2",
|
|
66
66
|
"json-stringify-safe": "^5.0.1",
|
|
67
67
|
"jsonwebtoken": "^9.0.2",
|
|
68
68
|
"mime-types": "^2.1.35",
|