node-server-engine 1.10.15 → 1.11.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/README.md +200 -1
- package/dist/entities/PubSub/handleMessage/handleMessage.js +1 -1
- package/dist/entities/PubSub/handleMessage/handleMessage.js.map +1 -1
- package/dist/entities/Redis/Redis.d.ts +66 -24
- package/dist/entities/Redis/Redis.js +272 -144
- package/dist/entities/Redis/Redis.js.map +1 -1
- package/dist/entities/Redis/index.d.ts +1 -1
- package/dist/entities/Redis/index.js +10 -38
- package/dist/entities/Redis/index.js.map +1 -1
- package/dist/entities/SecretManager/SecretManager.d.ts +87 -0
- package/dist/entities/SecretManager/SecretManager.js +385 -0
- package/dist/entities/SecretManager/SecretManager.js.map +1 -0
- package/dist/entities/SecretManager/SecretManager.types.d.ts +71 -0
- package/dist/entities/SecretManager/SecretManager.types.js +2 -0
- package/dist/entities/SecretManager/SecretManager.types.js.map +1 -0
- package/dist/entities/SecretManager/index.d.ts +2 -0
- package/dist/entities/SecretManager/index.js +28 -0
- package/dist/entities/SecretManager/index.js.map +1 -0
- package/dist/entities/Sequelize/Sequelize.js +5 -3
- package/dist/entities/Sequelize/Sequelize.js.map +1 -1
- package/dist/entities/Server/Server.d.ts +2 -0
- package/dist/entities/Server/Server.js +9 -0
- package/dist/entities/Server/Server.js.map +1 -1
- package/dist/entities/Server/Server.types.d.ts +3 -0
- package/dist/entities/Server/Server.types.js.map +1 -1
- package/dist/entities/index.d.ts +1 -0
- package/dist/entities/index.js +11 -0
- package/dist/entities/index.js.map +1 -1
- package/dist/middleware/requestMetrics/requestMetrics.js +15 -5
- package/dist/middleware/requestMetrics/requestMetrics.js.map +1 -1
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.js +0 -11
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/jwt/jwt.js +25 -2
- package/dist/utils/jwt/jwt.js.map +1 -1
- package/package.json +1 -1
- package/dist/utils/secretManager/index.d.ts +0 -2
- package/dist/utils/secretManager/index.js +0 -28
- package/dist/utils/secretManager/index.js.map +0 -1
- package/dist/utils/secretManager/secretLoader.d.ts +0 -8
- package/dist/utils/secretManager/secretLoader.js +0 -68
- package/dist/utils/secretManager/secretLoader.js.map +0 -1
- package/dist/utils/secretManager/secretResolver.d.ts +0 -5
- package/dist/utils/secretManager/secretResolver.js +0 -41
- package/dist/utils/secretManager/secretResolver.js.map +0 -1
|
@@ -3,168 +3,296 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.Redis = void 0;
|
|
7
|
-
exports.createRedisClient = createRedisClient;
|
|
8
|
-
exports.createRedisInstance = createRedisInstance;
|
|
9
|
-
exports.getClient = getClient;
|
|
10
|
-
exports.init = init;
|
|
11
|
-
exports.redisClient = void 0;
|
|
12
|
-
exports.shutdown = shutdown;
|
|
6
|
+
exports.shutdown = exports.redisClient = exports.init = exports.getClient = exports.createRedisClient = exports.Redis = void 0;
|
|
13
7
|
var _ioredis = require("ioredis");
|
|
14
8
|
var _Redis = require("./Redis.validate");
|
|
15
9
|
var _EngineError = require("../EngineError");
|
|
16
10
|
var _LifecycleController = require("../LifecycleController");
|
|
17
11
|
var _report = require("../../utils/report");
|
|
18
|
-
|
|
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
|
-
|
|
27
|
-
/**
|
|
28
|
-
* We use a proxy to extend the Redis behavior and allow initialization of the client only when needed while keeping the same interface
|
|
29
|
-
*/
|
|
30
|
-
const Redis = exports.Redis = new Proxy(
|
|
31
|
-
// 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
|
|
32
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
33
|
-
// @ts-ignore
|
|
34
|
-
{}, {
|
|
35
|
-
get: function (target, property) {
|
|
36
|
-
if (property === 'init') return init;
|
|
37
|
-
if (property === 'shutdown') return shutdown;
|
|
38
|
-
if (property === 'getClient') return getClient;
|
|
39
|
-
// Create the redis client if it does not exist
|
|
40
|
-
if (!redisClient) throw new _EngineError.EngineError({
|
|
41
|
-
message: 'Redis client was not initialized'
|
|
42
|
-
});
|
|
43
|
-
// Call the function on the redis client
|
|
44
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
45
|
-
// @ts-ignore
|
|
46
|
-
return redisClient[property];
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Get the underlying Redis client (for advanced use cases)
|
|
52
|
-
*/
|
|
53
|
-
function getClient() {
|
|
54
|
-
return redisClient;
|
|
55
|
-
}
|
|
12
|
+
const namespace = 'engine:redis';
|
|
56
13
|
|
|
57
14
|
/**
|
|
58
|
-
*
|
|
15
|
+
* Generic Redis wrapper for caching and data storage
|
|
16
|
+
* Provides methods for initialization, connection management, and cleanup
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* // Initialize Redis connection
|
|
21
|
+
* Redis.init();
|
|
22
|
+
*
|
|
23
|
+
* // Use Redis client
|
|
24
|
+
* await Redis.set('key', 'value');
|
|
25
|
+
* const value = await Redis.get('key');
|
|
26
|
+
*
|
|
27
|
+
* // Get underlying client for advanced operations
|
|
28
|
+
* const client = Redis.getClient();
|
|
29
|
+
* ```
|
|
59
30
|
*/
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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
|
-
});
|
|
104
|
-
_LifecycleController.LifecycleController.register(Redis);
|
|
105
|
-
}
|
|
31
|
+
const Redis = exports.Redis = {
|
|
32
|
+
/** Redis client instance */
|
|
33
|
+
client: undefined,
|
|
34
|
+
/**
|
|
35
|
+
* Initialize Redis connection
|
|
36
|
+
* @param options - Redis configuration options
|
|
37
|
+
*/
|
|
38
|
+
init(options = {}) {
|
|
39
|
+
// Ignore if already initialized
|
|
40
|
+
if (this.client) {
|
|
41
|
+
(0, _report.reportDebug)({
|
|
42
|
+
namespace,
|
|
43
|
+
message: 'Redis client already initialized'
|
|
44
|
+
});
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
this.client = this.createRedisClient(options);
|
|
106
48
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
*/
|
|
110
|
-
async function shutdown() {
|
|
111
|
-
if (redisClient) {
|
|
112
|
-
try {
|
|
113
|
-
await redisClient.quit();
|
|
49
|
+
// Setup event listeners
|
|
50
|
+
this.client.on('connect', () => {
|
|
114
51
|
(0, _report.reportDebug)({
|
|
115
|
-
namespace
|
|
116
|
-
message: 'Redis client
|
|
52
|
+
namespace,
|
|
53
|
+
message: 'Redis client connecting'
|
|
117
54
|
});
|
|
118
|
-
}
|
|
55
|
+
});
|
|
56
|
+
this.client.on('ready', () => {
|
|
57
|
+
(0, _report.reportDebug)({
|
|
58
|
+
namespace,
|
|
59
|
+
message: 'Redis client ready'
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
this.client.on('error', err => {
|
|
119
63
|
(0, _report.reportError)(new _EngineError.EngineError({
|
|
120
|
-
message: '
|
|
64
|
+
message: 'Redis client error',
|
|
121
65
|
data: {
|
|
122
|
-
error:
|
|
66
|
+
error: err.message
|
|
123
67
|
}
|
|
124
68
|
}));
|
|
69
|
+
});
|
|
70
|
+
this.client.on('close', () => {
|
|
71
|
+
(0, _report.reportDebug)({
|
|
72
|
+
namespace,
|
|
73
|
+
message: 'Redis connection closed'
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
this.client.on('reconnecting', () => {
|
|
77
|
+
(0, _report.reportDebug)({
|
|
78
|
+
namespace,
|
|
79
|
+
message: 'Redis client reconnecting'
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
_LifecycleController.LifecycleController.register({
|
|
83
|
+
shutdown: () => this.shutdown()
|
|
84
|
+
});
|
|
85
|
+
},
|
|
86
|
+
/**
|
|
87
|
+
* Shutdown Redis connection and cleanup
|
|
88
|
+
* @returns Promise that resolves when shutdown is complete
|
|
89
|
+
*/
|
|
90
|
+
async shutdown() {
|
|
91
|
+
if (this.client) {
|
|
92
|
+
try {
|
|
93
|
+
await this.client.quit();
|
|
94
|
+
(0, _report.reportDebug)({
|
|
95
|
+
namespace,
|
|
96
|
+
message: 'Redis client disconnected'
|
|
97
|
+
});
|
|
98
|
+
} catch (error) {
|
|
99
|
+
(0, _report.reportError)(new _EngineError.EngineError({
|
|
100
|
+
message: 'Error during Redis shutdown',
|
|
101
|
+
data: {
|
|
102
|
+
error: error.message
|
|
103
|
+
}
|
|
104
|
+
}));
|
|
105
|
+
}
|
|
125
106
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
107
|
+
this.client = undefined;
|
|
108
|
+
},
|
|
109
|
+
/**
|
|
110
|
+
* Get the underlying Redis client
|
|
111
|
+
* @returns Redis client instance or undefined
|
|
112
|
+
*/
|
|
113
|
+
getClient() {
|
|
114
|
+
return this.client;
|
|
115
|
+
},
|
|
116
|
+
/**
|
|
117
|
+
* Create Redis client with configuration
|
|
118
|
+
* @param options - Redis creation options
|
|
119
|
+
* @returns Redis client instance
|
|
120
|
+
* @private
|
|
121
|
+
*/
|
|
122
|
+
createRedisClient(options = {}) {
|
|
123
|
+
// Check that environment variables are correctly set
|
|
124
|
+
(0, _Redis.validateRedisEnvironment)(options);
|
|
129
125
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
126
|
+
// Throw an error if there is no host
|
|
127
|
+
if (!process.env.REDIS_HOST) {
|
|
128
|
+
throw new _EngineError.EngineError({
|
|
129
|
+
message: 'Host required to initialize Redis connection'
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
const config = {
|
|
133
|
+
port: process.env.REDIS_PORT ? parseInt(process.env.REDIS_PORT) : 6379,
|
|
134
|
+
host: process.env.REDIS_HOST,
|
|
135
|
+
username: process.env.REDIS_USERNAME,
|
|
136
|
+
password: process.env.REDIS_PASSWORD,
|
|
137
|
+
db: options.db ?? 0,
|
|
138
|
+
retryStrategy: times => {
|
|
139
|
+
const delay = Math.min(times * 50, 2000);
|
|
140
|
+
return delay;
|
|
141
|
+
},
|
|
142
|
+
reconnectOnError: err => {
|
|
143
|
+
const targetErrors = ['READONLY', 'ECONNRESET', 'ETIMEDOUT'];
|
|
144
|
+
return targetErrors.some(targetError => err.message.includes(targetError));
|
|
145
|
+
},
|
|
146
|
+
maxRetriesPerRequest: 3,
|
|
147
|
+
enableReadyCheck: options.enableReadyCheck ?? true,
|
|
148
|
+
lazyConnect: options.lazyConnect ?? process.env.NODE_ENV === 'test',
|
|
149
|
+
...options.redis
|
|
150
|
+
};
|
|
136
151
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
152
|
+
// Add TLS configuration if TLS_CA is provided
|
|
153
|
+
if (process.env.TLS_CA) {
|
|
154
|
+
config.tls = {
|
|
155
|
+
ca: process.env.TLS_CA,
|
|
156
|
+
rejectUnauthorized: process.env.NODE_ENV === 'production'
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
return new _ioredis.Redis(config);
|
|
160
|
+
},
|
|
161
|
+
// Proxy common Redis methods to the client
|
|
162
|
+
async get(key) {
|
|
163
|
+
if (!this.client) throw new _EngineError.EngineError({
|
|
164
|
+
message: 'Redis client was not initialized'
|
|
165
|
+
});
|
|
166
|
+
return this.client.get(key);
|
|
167
|
+
},
|
|
168
|
+
async set(key, value, ...args) {
|
|
169
|
+
if (!this.client) throw new _EngineError.EngineError({
|
|
170
|
+
message: 'Redis client was not initialized'
|
|
171
|
+
});
|
|
172
|
+
return this.client.set(key, value, ...args);
|
|
173
|
+
},
|
|
174
|
+
async del(...keys) {
|
|
175
|
+
if (!this.client) throw new _EngineError.EngineError({
|
|
176
|
+
message: 'Redis client was not initialized'
|
|
177
|
+
});
|
|
178
|
+
return this.client.del(...keys);
|
|
179
|
+
},
|
|
180
|
+
async exists(...keys) {
|
|
181
|
+
if (!this.client) throw new _EngineError.EngineError({
|
|
182
|
+
message: 'Redis client was not initialized'
|
|
183
|
+
});
|
|
184
|
+
return this.client.exists(...keys);
|
|
185
|
+
},
|
|
186
|
+
async expire(key, seconds) {
|
|
187
|
+
if (!this.client) throw new _EngineError.EngineError({
|
|
188
|
+
message: 'Redis client was not initialized'
|
|
189
|
+
});
|
|
190
|
+
return this.client.expire(key, seconds);
|
|
191
|
+
},
|
|
192
|
+
async ttl(key) {
|
|
193
|
+
if (!this.client) throw new _EngineError.EngineError({
|
|
194
|
+
message: 'Redis client was not initialized'
|
|
195
|
+
});
|
|
196
|
+
return this.client.ttl(key);
|
|
197
|
+
},
|
|
198
|
+
async incr(key) {
|
|
199
|
+
if (!this.client) throw new _EngineError.EngineError({
|
|
200
|
+
message: 'Redis client was not initialized'
|
|
201
|
+
});
|
|
202
|
+
return this.client.incr(key);
|
|
203
|
+
},
|
|
204
|
+
async decr(key) {
|
|
205
|
+
if (!this.client) throw new _EngineError.EngineError({
|
|
206
|
+
message: 'Redis client was not initialized'
|
|
207
|
+
});
|
|
208
|
+
return this.client.decr(key);
|
|
209
|
+
},
|
|
210
|
+
async hget(key, field) {
|
|
211
|
+
if (!this.client) throw new _EngineError.EngineError({
|
|
212
|
+
message: 'Redis client was not initialized'
|
|
213
|
+
});
|
|
214
|
+
return this.client.hget(key, field);
|
|
215
|
+
},
|
|
216
|
+
async hset(key, field, value) {
|
|
217
|
+
if (!this.client) throw new _EngineError.EngineError({
|
|
218
|
+
message: 'Redis client was not initialized'
|
|
219
|
+
});
|
|
220
|
+
return this.client.hset(key, field, value);
|
|
221
|
+
},
|
|
222
|
+
async hgetall(key) {
|
|
223
|
+
if (!this.client) throw new _EngineError.EngineError({
|
|
224
|
+
message: 'Redis client was not initialized'
|
|
225
|
+
});
|
|
226
|
+
return this.client.hgetall(key);
|
|
227
|
+
},
|
|
228
|
+
async lpush(key, ...values) {
|
|
229
|
+
if (!this.client) throw new _EngineError.EngineError({
|
|
230
|
+
message: 'Redis client was not initialized'
|
|
231
|
+
});
|
|
232
|
+
return this.client.lpush(key, ...values);
|
|
233
|
+
},
|
|
234
|
+
async rpush(key, ...values) {
|
|
235
|
+
if (!this.client) throw new _EngineError.EngineError({
|
|
236
|
+
message: 'Redis client was not initialized'
|
|
237
|
+
});
|
|
238
|
+
return this.client.rpush(key, ...values);
|
|
239
|
+
},
|
|
240
|
+
async lpop(key, count) {
|
|
241
|
+
if (!this.client) throw new _EngineError.EngineError({
|
|
242
|
+
message: 'Redis client was not initialized'
|
|
243
|
+
});
|
|
244
|
+
if (count !== undefined) {
|
|
245
|
+
return this.client.lpop(key, count);
|
|
246
|
+
}
|
|
247
|
+
return this.client.lpop(key);
|
|
248
|
+
},
|
|
249
|
+
async rpop(key, count) {
|
|
250
|
+
if (!this.client) throw new _EngineError.EngineError({
|
|
251
|
+
message: 'Redis client was not initialized'
|
|
252
|
+
});
|
|
253
|
+
if (count !== undefined) {
|
|
254
|
+
return this.client.rpop(key, count);
|
|
255
|
+
}
|
|
256
|
+
return this.client.rpop(key);
|
|
257
|
+
},
|
|
258
|
+
async lrange(key, start, stop) {
|
|
259
|
+
if (!this.client) throw new _EngineError.EngineError({
|
|
260
|
+
message: 'Redis client was not initialized'
|
|
261
|
+
});
|
|
262
|
+
return this.client.lrange(key, start, stop);
|
|
263
|
+
},
|
|
264
|
+
async sadd(key, ...members) {
|
|
265
|
+
if (!this.client) throw new _EngineError.EngineError({
|
|
266
|
+
message: 'Redis client was not initialized'
|
|
267
|
+
});
|
|
268
|
+
return this.client.sadd(key, ...members);
|
|
269
|
+
},
|
|
270
|
+
async smembers(key) {
|
|
271
|
+
if (!this.client) throw new _EngineError.EngineError({
|
|
272
|
+
message: 'Redis client was not initialized'
|
|
273
|
+
});
|
|
274
|
+
return this.client.smembers(key);
|
|
275
|
+
},
|
|
276
|
+
async sismember(key, member) {
|
|
277
|
+
if (!this.client) throw new _EngineError.EngineError({
|
|
278
|
+
message: 'Redis client was not initialized'
|
|
279
|
+
});
|
|
280
|
+
return this.client.sismember(key, member);
|
|
281
|
+
}
|
|
282
|
+
};
|
|
160
283
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
284
|
+
// Export backward compatibility functions
|
|
285
|
+
const createRedisClient = exports.createRedisClient = Redis.createRedisClient.bind(Redis);
|
|
286
|
+
const getClient = exports.getClient = Redis.getClient.bind(Redis);
|
|
287
|
+
const init = exports.init = Redis.init.bind(Redis);
|
|
288
|
+
const shutdown = exports.shutdown = Redis.shutdown.bind(Redis);
|
|
289
|
+
|
|
290
|
+
// For tests that need direct access to the client
|
|
291
|
+
let redisClient = exports.redisClient = void 0;
|
|
292
|
+
Object.defineProperty(Redis, 'client', {
|
|
293
|
+
get: () => redisClient,
|
|
294
|
+
set: value => {
|
|
295
|
+
exports.redisClient = redisClient = value;
|
|
167
296
|
}
|
|
168
|
-
|
|
169
|
-
}
|
|
297
|
+
});
|
|
170
298
|
//# sourceMappingURL=Redis.js.map
|
|
@@ -1 +1 @@
|
|
|
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, RedisOptions } 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: RedisOptions): 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: RedisOptions = {\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,MAAoB,EAAe;EACrE,OAAO,IAAIC,cAAW,CAACD,MAAM,CAAC;AAChC;;AAEA;AACA;AACA;AACO,MAAME,KAAK,GAAAJ,OAAA,CAAAI,KAAA,GAAG,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ngineError","_LifecycleController","_report","namespace","Redis","exports","client","undefined","init","options","reportDebug","message","createRedisClient","on","err","reportError","EngineError","data","error","LifecycleController","register","shutdown","quit","getClient","validateRedisEnvironment","process","env","REDIS_HOST","config","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","RedisClient","get","key","set","value","args","del","keys","exists","expire","seconds","ttl","incr","decr","hget","field","hset","hgetall","lpush","values","rpush","lpop","count","rpop","lrange","start","stop","sadd","members","smembers","sismember","member","bind","redisClient","Object","defineProperty"],"sources":["../../../src/entities/Redis/Redis.ts"],"sourcesContent":["import { Redis as RedisClient, RedisOptions } from 'ioredis';\nimport { 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\nconst namespace = 'engine:redis';\n\n/**\n * Generic Redis wrapper for caching and data storage\n * Provides methods for initialization, connection management, and cleanup\n * \n * @example\n * ```typescript\n * // Initialize Redis connection\n * Redis.init();\n * \n * // Use Redis client\n * await Redis.set('key', 'value');\n * const value = await Redis.get('key');\n * \n * // Get underlying client for advanced operations\n * const client = Redis.getClient();\n * ```\n */\nexport const Redis = {\n /** Redis client instance */\n client: undefined as RedisClient | undefined,\n\n /**\n * Initialize Redis connection\n * @param options - Redis configuration options\n */\n init(options: RedisCreateOptions = {}): void {\n // Ignore if already initialized\n if (this.client) {\n reportDebug({\n namespace,\n message: 'Redis client already initialized'\n });\n return;\n }\n \n this.client = this.createRedisClient(options);\n \n // Setup event listeners\n this.client.on('connect', () => {\n reportDebug({\n namespace,\n message: 'Redis client connecting'\n });\n });\n \n this.client.on('ready', () => {\n reportDebug({\n namespace,\n message: 'Redis client ready'\n });\n });\n \n this.client.on('error', (err) => {\n reportError(new EngineError({\n message: 'Redis client error',\n data: { error: err.message }\n }));\n });\n \n this.client.on('close', () => {\n reportDebug({\n namespace,\n message: 'Redis connection closed'\n });\n });\n \n this.client.on('reconnecting', () => {\n reportDebug({\n namespace,\n message: 'Redis client reconnecting'\n });\n });\n \n LifecycleController.register({ shutdown: () => this.shutdown() });\n },\n\n /**\n * Shutdown Redis connection and cleanup\n * @returns Promise that resolves when shutdown is complete\n */\n async shutdown(): Promise<void> {\n if (this.client) {\n try {\n await this.client.quit();\n reportDebug({\n namespace,\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 this.client = undefined;\n },\n\n /**\n * Get the underlying Redis client\n * @returns Redis client instance or undefined\n */\n getClient(): RedisClient | undefined {\n return this.client;\n },\n\n /**\n * Create Redis client with configuration\n * @param options - Redis creation options\n * @returns Redis client instance\n * @private\n */\n createRedisClient(options: RedisCreateOptions = {}): 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\n const config: RedisOptions = {\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 new RedisClient(config);\n },\n\n // Proxy common Redis methods to the client\n async get(key: string): Promise<string | null> {\n if (!this.client) throw new EngineError({ message: 'Redis client was not initialized' });\n return this.client.get(key);\n },\n\n async set(key: string, value: string | number | Buffer, ...args: unknown[]): Promise<'OK' | null> {\n if (!this.client) throw new EngineError({ message: 'Redis client was not initialized' });\n return this.client.set(key, value, ...args as []);\n },\n\n async del(...keys: string[]): Promise<number> {\n if (!this.client) throw new EngineError({ message: 'Redis client was not initialized' });\n return this.client.del(...keys);\n },\n\n async exists(...keys: string[]): Promise<number> {\n if (!this.client) throw new EngineError({ message: 'Redis client was not initialized' });\n return this.client.exists(...keys);\n },\n\n async expire(key: string, seconds: number): Promise<number> {\n if (!this.client) throw new EngineError({ message: 'Redis client was not initialized' });\n return this.client.expire(key, seconds);\n },\n\n async ttl(key: string): Promise<number> {\n if (!this.client) throw new EngineError({ message: 'Redis client was not initialized' });\n return this.client.ttl(key);\n },\n\n async incr(key: string): Promise<number> {\n if (!this.client) throw new EngineError({ message: 'Redis client was not initialized' });\n return this.client.incr(key);\n },\n\n async decr(key: string): Promise<number> {\n if (!this.client) throw new EngineError({ message: 'Redis client was not initialized' });\n return this.client.decr(key);\n },\n\n async hget(key: string, field: string): Promise<string | null> {\n if (!this.client) throw new EngineError({ message: 'Redis client was not initialized' });\n return this.client.hget(key, field);\n },\n\n async hset(key: string, field: string, value: string | number | Buffer): Promise<number> {\n if (!this.client) throw new EngineError({ message: 'Redis client was not initialized' });\n return this.client.hset(key, field, value);\n },\n\n async hgetall(key: string): Promise<Record<string, string>> {\n if (!this.client) throw new EngineError({ message: 'Redis client was not initialized' });\n return this.client.hgetall(key);\n },\n\n async lpush(key: string, ...values: (string | Buffer | number)[]): Promise<number> {\n if (!this.client) throw new EngineError({ message: 'Redis client was not initialized' });\n return this.client.lpush(key, ...values);\n },\n\n async rpush(key: string, ...values: (string | Buffer | number)[]): Promise<number> {\n if (!this.client) throw new EngineError({ message: 'Redis client was not initialized' });\n return this.client.rpush(key, ...values);\n },\n\n async lpop(key: string, count?: number): Promise<string | string[] | null> {\n if (!this.client) throw new EngineError({ message: 'Redis client was not initialized' });\n if (count !== undefined) {\n return this.client.lpop(key, count);\n }\n return this.client.lpop(key);\n },\n\n async rpop(key: string, count?: number): Promise<string | string[] | null> {\n if (!this.client) throw new EngineError({ message: 'Redis client was not initialized' });\n if (count !== undefined) {\n return this.client.rpop(key, count);\n }\n return this.client.rpop(key);\n },\n\n async lrange(key: string, start: number, stop: number): Promise<string[]> {\n if (!this.client) throw new EngineError({ message: 'Redis client was not initialized' });\n return this.client.lrange(key, start, stop);\n },\n\n async sadd(key: string, ...members: (string | Buffer | number)[]): Promise<number> {\n if (!this.client) throw new EngineError({ message: 'Redis client was not initialized' });\n return this.client.sadd(key, ...members);\n },\n\n async smembers(key: string): Promise<string[]> {\n if (!this.client) throw new EngineError({ message: 'Redis client was not initialized' });\n return this.client.smembers(key);\n },\n\n async sismember(key: string, member: string | Buffer | number): Promise<number> {\n if (!this.client) throw new EngineError({ message: 'Redis client was not initialized' });\n return this.client.sismember(key, member);\n }\n};\n\n// Export backward compatibility functions\nexport const createRedisClient = Redis.createRedisClient.bind(Redis);\nexport const getClient = Redis.getClient.bind(Redis);\nexport const init = Redis.init.bind(Redis);\nexport const shutdown = Redis.shutdown.bind(Redis);\n\n// For tests that need direct access to the client\nexport let redisClient: RedisClient | undefined;\nObject.defineProperty(Redis, 'client', {\n get: () => redisClient,\n set: (value) => { redisClient = value; }\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;AAEA,MAAMK,SAAS,GAAG,cAAc;;AAEhC;AACA;AACA;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,CAACmB,SAAS,CAACkE,IAAI,CAACrF,KAAK,CAAC;AAC7C,MAAMI,IAAI,GAAAH,OAAA,CAAAG,IAAA,GAAGJ,KAAK,CAACI,IAAI,CAACiF,IAAI,CAACrF,KAAK,CAAC;AACnC,MAAMiB,QAAQ,GAAAhB,OAAA,CAAAgB,QAAA,GAAGjB,KAAK,CAACiB,QAAQ,CAACoE,IAAI,CAACrF,KAAK,CAAC;;AAElD;AACO,IAAIsF,WAAoC,GAAArF,OAAA,CAAAqF,WAAA;AAC/CC,MAAM,CAACC,cAAc,CAACxF,KAAK,EAAE,QAAQ,EAAE;EACrCsD,GAAG,EAAEA,CAAA,KAAMgC,WAAW;EACtB9B,GAAG,EAAGC,KAAK,IAAK;IAAExD,OAAA,CAAAqF,WAAA,GAAAA,WAAW,GAAG7B,KAAK;EAAE;AACzC,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './Redis';
|
|
2
2
|
export * from './Redis.types';
|
|
@@ -3,48 +3,20 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
var _exportNames = {
|
|
7
|
-
Redis: true,
|
|
8
|
-
createRedisClient: true,
|
|
9
|
-
getClient: true,
|
|
10
|
-
init: true,
|
|
11
|
-
shutdown: true
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "Redis", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function () {
|
|
16
|
-
return _Redis.Redis;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
Object.defineProperty(exports, "createRedisClient", {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
get: function () {
|
|
22
|
-
return _Redis.createRedisClient;
|
|
23
|
-
}
|
|
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
|
-
});
|
|
43
6
|
var _Redis = require("./Redis");
|
|
7
|
+
Object.keys(_Redis).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _Redis[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _Redis[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
44
17
|
var _Redis2 = require("./Redis.types");
|
|
45
18
|
Object.keys(_Redis2).forEach(function (key) {
|
|
46
19
|
if (key === "default" || key === "__esModule") return;
|
|
47
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
48
20
|
if (key in exports && exports[key] === _Redis2[key]) return;
|
|
49
21
|
Object.defineProperty(exports, key, {
|
|
50
22
|
enumerable: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_Redis","require","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_Redis","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_Redis2"],"sources":["../../../src/entities/Redis/index.ts"],"sourcesContent":["export * from './Redis';\nexport * from './Redis.types';\n"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,OAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,OAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,OAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,OAAA,CAAAL,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { SecretManagerServiceClient } from '@google-cloud/secret-manager';
|
|
2
|
+
import { SecretManagerOptions, SecretConfig, LoadedSecret, SecretLoadResult } from './SecretManager.types';
|
|
3
|
+
/**
|
|
4
|
+
* Generic GCP Secret Manager wrapper for managing application secrets
|
|
5
|
+
* Provides methods for loading secrets at startup, runtime fetching, and cleanup
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* // Initialize with configuration
|
|
10
|
+
* await SecretManager.init({
|
|
11
|
+
* enabled: true,
|
|
12
|
+
* projectId: 'my-project',
|
|
13
|
+
* prefix: 'my-service',
|
|
14
|
+
* secrets: ['DB_PASSWORD', { name: 'PRIVATE_KEY', type: 'file' }]
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* // Get a cached secret
|
|
18
|
+
* const password = SecretManager.getSecret('DB_PASSWORD');
|
|
19
|
+
*
|
|
20
|
+
* // Fetch a secret on-demand
|
|
21
|
+
* const apiKey = await SecretManager.fetchSecret('API_KEY');
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare const SecretManager: {
|
|
25
|
+
/** Singleton client instance */
|
|
26
|
+
client: SecretManagerServiceClient | undefined;
|
|
27
|
+
/** Configuration options */
|
|
28
|
+
options: SecretManagerOptions | undefined;
|
|
29
|
+
/** Cache of loaded secrets */
|
|
30
|
+
secretCache: Map<string, LoadedSecret>;
|
|
31
|
+
/** Temporary files created by Secret Manager */
|
|
32
|
+
tempFiles: string[];
|
|
33
|
+
/**
|
|
34
|
+
* Initialize the Secret Manager
|
|
35
|
+
* @param config - Secret Manager configuration options
|
|
36
|
+
* @returns Promise with load results
|
|
37
|
+
*/
|
|
38
|
+
init(config?: SecretManagerOptions): Promise<SecretLoadResult>;
|
|
39
|
+
/**
|
|
40
|
+
* Load secrets from Secret Manager
|
|
41
|
+
* @private
|
|
42
|
+
*/
|
|
43
|
+
loadSecrets(config: SecretManagerOptions): Promise<SecretLoadResult>;
|
|
44
|
+
/**
|
|
45
|
+
* Load a single secret from Secret Manager
|
|
46
|
+
* @private
|
|
47
|
+
*/
|
|
48
|
+
loadSecret(config: SecretConfig, globalConfig: SecretManagerOptions): Promise<LoadedSecret | null>;
|
|
49
|
+
/**
|
|
50
|
+
* Normalize secret configuration
|
|
51
|
+
* @private
|
|
52
|
+
*/
|
|
53
|
+
normalizeSecretConfig(input: SecretConfig | string): SecretConfig;
|
|
54
|
+
/**
|
|
55
|
+
* Get a secret value from cache (if caching is enabled)
|
|
56
|
+
* @param name - Secret name
|
|
57
|
+
* @returns Secret value or undefined
|
|
58
|
+
*/
|
|
59
|
+
getSecret(name: string): string | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Get secret from Secret Manager on-demand (useful for runtime secret rotation)
|
|
62
|
+
* @param name - Secret name
|
|
63
|
+
* @param version - Secret version (default: 'latest')
|
|
64
|
+
* @returns Promise with secret value
|
|
65
|
+
*/
|
|
66
|
+
fetchSecret(name: string, version?: string): Promise<string>;
|
|
67
|
+
/**
|
|
68
|
+
* Reload all secrets (useful for secret rotation)
|
|
69
|
+
* @returns Promise with reload results
|
|
70
|
+
*/
|
|
71
|
+
reload(): Promise<SecretLoadResult>;
|
|
72
|
+
/**
|
|
73
|
+
* Shutdown Secret Manager and cleanup
|
|
74
|
+
* @returns Promise that resolves when cleanup is complete
|
|
75
|
+
*/
|
|
76
|
+
shutdown(): Promise<void>;
|
|
77
|
+
/**
|
|
78
|
+
* Check if Secret Manager is initialized
|
|
79
|
+
* @returns True if initialized
|
|
80
|
+
*/
|
|
81
|
+
isInitialized(): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Get current configuration (without sensitive data)
|
|
84
|
+
* @returns Configuration object or undefined
|
|
85
|
+
*/
|
|
86
|
+
getConfig(): Partial<SecretManagerOptions> | undefined;
|
|
87
|
+
};
|