@forklaunch/core 0.6.5 → 0.7.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.
Files changed (35) hide show
  1. package/lib/{openTelemetryCollector-CWrfzmmW.d.mts → openTelemetryCollector-CmZ3T_2T.d.mts} +9 -1
  2. package/lib/{openTelemetryCollector-CWrfzmmW.d.ts → openTelemetryCollector-CmZ3T_2T.d.ts} +9 -1
  3. package/lib/src/cache/index.d.mts +210 -24
  4. package/lib/src/cache/index.d.ts +210 -24
  5. package/lib/src/cache/index.js +364 -31
  6. package/lib/src/cache/index.js.map +1 -1
  7. package/lib/src/cache/index.mjs +374 -31
  8. package/lib/src/cache/index.mjs.map +1 -1
  9. package/lib/src/controllers/index.d.mts +10 -0
  10. package/lib/src/controllers/index.d.ts +10 -0
  11. package/lib/src/http/index.d.mts +51 -4
  12. package/lib/src/http/index.d.ts +51 -4
  13. package/lib/src/http/index.js +24 -1
  14. package/lib/src/http/index.js.map +1 -1
  15. package/lib/src/http/index.mjs +23 -1
  16. package/lib/src/http/index.mjs.map +1 -1
  17. package/lib/src/{dtoMapper → mappers}/index.d.mts +3 -3
  18. package/lib/src/{dtoMapper → mappers}/index.d.ts +3 -3
  19. package/lib/src/{dtoMapper → mappers}/index.js +12 -12
  20. package/lib/src/mappers/index.js.map +1 -0
  21. package/lib/src/{dtoMapper → mappers}/index.mjs +8 -8
  22. package/lib/src/mappers/index.mjs.map +1 -0
  23. package/lib/src/persistence/index.d.mts +120 -0
  24. package/lib/src/persistence/index.d.ts +120 -0
  25. package/lib/src/persistence/index.js +152 -0
  26. package/lib/src/persistence/index.js.map +1 -0
  27. package/lib/src/persistence/index.mjs +127 -0
  28. package/lib/src/persistence/index.mjs.map +1 -0
  29. package/lib/src/services/index.d.mts +3 -2
  30. package/lib/src/services/index.d.ts +3 -2
  31. package/lib/src/services/index.js.map +1 -1
  32. package/lib/src/services/index.mjs.map +1 -1
  33. package/package.json +15 -9
  34. package/lib/src/dtoMapper/index.js.map +0 -1
  35. package/lib/src/dtoMapper/index.mjs.map +0 -1
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
 
20
30
  // src/cache/index.ts
@@ -25,107 +35,430 @@ __export(cache_exports, {
25
35
  });
26
36
  module.exports = __toCommonJS(cache_exports);
27
37
 
38
+ // src/cache/cacheKey.ts
39
+ var createCacheKey = (cacheKeyPrefix) => (id) => {
40
+ return `${cacheKeyPrefix}:${id}`;
41
+ };
42
+
28
43
  // src/cache/redisTtlCache.ts
29
44
  var import_redis = require("redis");
45
+
46
+ // src/http/middleware/request/cors.middleware.ts
47
+ var import_cors = __toESM(require("cors"));
48
+
49
+ // src/http/middleware/request/createContext.middleware.ts
50
+ var import_api = require("@opentelemetry/api");
51
+ var import_uuid = require("uuid");
52
+
53
+ // src/http/telemetry/constants.ts
54
+ var import_semantic_conventions = require("@opentelemetry/semantic-conventions");
55
+
56
+ // src/http/guards/isExpressLikeSchemaHandler.ts
57
+ var import_common = require("@forklaunch/common");
58
+
59
+ // src/http/middleware/request/auth.middleware.ts
60
+ var import_jose = require("jose");
61
+
62
+ // src/services/getEnvVar.ts
63
+ function getEnvVar(name) {
64
+ const value = process.env[name];
65
+ return value;
66
+ }
67
+
68
+ // src/http/telemetry/openTelemetryCollector.ts
69
+ var import_opentelemetry_instrumentation_hyper_express = require("@forklaunch/opentelemetry-instrumentation-hyper-express");
70
+ var import_api3 = require("@opentelemetry/api");
71
+ var import_exporter_logs_otlp_http = require("@opentelemetry/exporter-logs-otlp-http");
72
+ var import_exporter_metrics_otlp_http = require("@opentelemetry/exporter-metrics-otlp-http");
73
+ var import_exporter_trace_otlp_http = require("@opentelemetry/exporter-trace-otlp-http");
74
+ var import_instrumentation_express = require("@opentelemetry/instrumentation-express");
75
+ var import_instrumentation_http = require("@opentelemetry/instrumentation-http");
76
+ var import_resources = require("@opentelemetry/resources");
77
+ var import_sdk_logs = require("@opentelemetry/sdk-logs");
78
+ var import_sdk_metrics = require("@opentelemetry/sdk-metrics");
79
+ var import_sdk_node = require("@opentelemetry/sdk-node");
80
+ var import_semantic_conventions2 = require("@opentelemetry/semantic-conventions");
81
+ var import_dotenv = __toESM(require("dotenv"));
82
+
83
+ // src/http/guards/isForklaunchRequest.ts
84
+ function isForklaunchRequest(request) {
85
+ return request != null && typeof request === "object" && "contractDetails" in request;
86
+ }
87
+
88
+ // src/http/telemetry/pinoLogger.ts
89
+ var import_common2 = require("@forklaunch/common");
90
+ var import_api2 = require("@opentelemetry/api");
91
+ var import_api_logs = require("@opentelemetry/api-logs");
92
+ var import_pino = __toESM(require("pino"));
93
+ var import_pino_pretty = __toESM(require("pino-pretty"));
94
+
95
+ // src/http/telemetry/openTelemetryCollector.ts
96
+ import_dotenv.default.config({ path: getEnvVar("ENV_FILE_PATH") });
97
+ new import_sdk_node.NodeSDK({
98
+ resource: (0, import_resources.resourceFromAttributes)({
99
+ [import_semantic_conventions2.ATTR_SERVICE_NAME]: getEnvVar("OTEL_SERVICE_NAME")
100
+ }),
101
+ traceExporter: new import_exporter_trace_otlp_http.OTLPTraceExporter({
102
+ url: `${getEnvVar("OTEL_EXPORTER_OTLP_ENDPOINT") ?? "http://localhost:4318"}/v1/traces`
103
+ }),
104
+ metricReader: new import_sdk_metrics.PeriodicExportingMetricReader({
105
+ exporter: new import_exporter_metrics_otlp_http.OTLPMetricExporter({
106
+ url: `${getEnvVar("OTEL_EXPORTER_OTLP_ENDPOINT") ?? "http://localhost:4318"}/v1/metrics`
107
+ }),
108
+ exportIntervalMillis: 5e3
109
+ }),
110
+ logRecordProcessors: [
111
+ new import_sdk_logs.BatchLogRecordProcessor(
112
+ new import_exporter_logs_otlp_http.OTLPLogExporter({
113
+ url: `${getEnvVar("OTEL_EXPORTER_OTLP_ENDPOINT") ?? "http://localhost:4318"}/v1/logs`
114
+ })
115
+ )
116
+ ],
117
+ instrumentations: [
118
+ new import_instrumentation_http.HttpInstrumentation({
119
+ applyCustomAttributesOnSpan: (span, request) => {
120
+ span.setAttribute(
121
+ "service.name",
122
+ getEnvVar("OTEL_SERVICE_NAME") ?? "unknown"
123
+ );
124
+ if (isForklaunchRequest(request)) {
125
+ span.setAttribute("api.name", request.contractDetails?.name);
126
+ }
127
+ }
128
+ }),
129
+ new import_instrumentation_express.ExpressInstrumentation(),
130
+ new import_opentelemetry_instrumentation_hyper_express.HyperExpressInstrumentation()
131
+ ]
132
+ }).start();
133
+ var httpRequestsTotalCounter = import_api3.metrics.getMeter(getEnvVar("OTEL_SERVICE_NAME") || "unknown").createCounter("http_requests_total", {
134
+ description: "Number of HTTP requests"
135
+ });
136
+ var httpServerDurationHistogram = import_api3.metrics.getMeter(getEnvVar("OTEL_SERVICE_NAME") || "unknown").createHistogram("http_server_duration", {
137
+ description: "Duration of HTTP server requests",
138
+ unit: "s"
139
+ });
140
+
141
+ // src/http/middleware/request/parse.middleware.ts
142
+ var import_validator = require("@forklaunch/validator");
143
+
144
+ // src/http/middleware/response/parse.middleware.ts
145
+ var import_validator2 = require("@forklaunch/validator");
146
+
147
+ // src/http/telemetry/recordMetric.ts
148
+ var import_semantic_conventions3 = require("@opentelemetry/semantic-conventions");
149
+
150
+ // src/services/configInjector.ts
151
+ var import_common3 = require("@forklaunch/common");
152
+ var import_validator3 = require("@forklaunch/validator");
153
+
154
+ // src/http/telemetry/evaluateTelemetryOptions.ts
155
+ function evaluateTelemetryOptions(telemetryOptions) {
156
+ return {
157
+ enabled: typeof telemetryOptions.enabled === "boolean" ? {
158
+ metrics: telemetryOptions.enabled,
159
+ tracing: telemetryOptions.enabled,
160
+ logging: telemetryOptions.enabled
161
+ } : {
162
+ metrics: telemetryOptions.enabled.metrics,
163
+ tracing: telemetryOptions.enabled.tracing,
164
+ logging: telemetryOptions.enabled.logging
165
+ },
166
+ level: telemetryOptions.level
167
+ };
168
+ }
169
+
170
+ // src/cache/redisTtlCache.ts
30
171
  var RedisTtlCache = class {
31
172
  /**
32
173
  * Creates an instance of RedisTtlCache.
33
174
  *
34
- * @param {number} ttlMilliseconds - The default TTL in milliseconds.
35
- * @param {RedisClientOptions} [hostingOptions] - The Redis client options.
175
+ * @param {number} ttlMilliseconds - The default Time-To-Live in milliseconds for cache entries
176
+ * @param {OpenTelemetryCollector<MetricsDefinition>} openTelemetryCollector - Collector for OpenTelemetry metrics
177
+ * @param {RedisClientOptions} hostingOptions - Configuration options for the Redis client
178
+ * @param {TelemetryOptions} telemetryOptions - Configuration options for telemetry
36
179
  */
37
- constructor(ttlMilliseconds, openTelemetryCollector, hostingOptions) {
180
+ constructor(ttlMilliseconds, openTelemetryCollector, hostingOptions, telemetryOptions) {
38
181
  this.ttlMilliseconds = ttlMilliseconds;
39
182
  this.openTelemetryCollector = openTelemetryCollector;
183
+ this.telemetryOptions = evaluateTelemetryOptions(telemetryOptions);
40
184
  this.client = (0, import_redis.createClient)(hostingOptions);
41
- this.client.on("error", (err) => openTelemetryCollector.error(err));
42
- this.client.connect().catch(openTelemetryCollector.error);
185
+ if (this.telemetryOptions.enabled.logging) {
186
+ this.client.on("error", (err) => this.openTelemetryCollector.error(err));
187
+ this.client.connect().catch(this.openTelemetryCollector.error);
188
+ }
43
189
  }
44
190
  client;
191
+ telemetryOptions;
192
+ /**
193
+ * Parses a raw Redis reply into the expected type.
194
+ * Handles null values, arrays, buffers, and JSON strings.
195
+ *
196
+ * @template T - The expected type of the parsed value
197
+ * @param {RedisCommandRawReply} value - The raw value from Redis to parse
198
+ * @returns {T} The parsed value cast to type T
199
+ */
200
+ parseValue(value) {
201
+ if (value == null) {
202
+ return null;
203
+ }
204
+ if (Array.isArray(value)) {
205
+ return value.map((v) => this.parseValue(v));
206
+ }
207
+ if (Buffer.isBuffer(value)) {
208
+ return value.toJSON();
209
+ }
210
+ switch (typeof value) {
211
+ case "object":
212
+ case "string":
213
+ return JSON.parse(value);
214
+ case "number":
215
+ return value;
216
+ }
217
+ }
45
218
  /**
46
219
  * Puts a record into the Redis cache.
47
220
  *
48
- * @param {TtlCacheRecord} param0 - The cache record to put into the cache.
49
- * @returns {Promise<void>} - A promise that resolves when the record is put into the cache.
221
+ * @template T - The type of value being cached
222
+ * @param {TtlCacheRecord<T>} param0 - The cache record containing key, value and optional TTL
223
+ * @param {string} param0.key - The key to store the value under
224
+ * @param {T} param0.value - The value to cache
225
+ * @param {number} [param0.ttlMilliseconds] - Optional TTL in milliseconds, defaults to constructor value
226
+ * @returns {Promise<void>} A promise that resolves when the value is cached
50
227
  */
51
228
  async putRecord({
52
229
  key,
53
230
  value,
54
231
  ttlMilliseconds = this.ttlMilliseconds
55
232
  }) {
233
+ if (this.telemetryOptions.enabled.logging) {
234
+ this.openTelemetryCollector.info(`Putting record into cache: ${key}`);
235
+ }
56
236
  await this.client.set(key, JSON.stringify(value), {
57
237
  PX: ttlMilliseconds
58
238
  });
59
239
  }
240
+ /**
241
+ * Puts multiple records into the Redis cache in a single transaction.
242
+ *
243
+ * @template T - The type of values being cached
244
+ * @param {TtlCacheRecord<T>[]} cacheRecords - Array of cache records to store
245
+ * @returns {Promise<void>} A promise that resolves when all values are cached
246
+ */
247
+ async putBatchRecords(cacheRecords) {
248
+ let multiCommand = this.client.multi();
249
+ for (const { key, value, ttlMilliseconds } of cacheRecords) {
250
+ multiCommand = multiCommand.set(key, JSON.stringify(value), {
251
+ PX: ttlMilliseconds || this.ttlMilliseconds
252
+ });
253
+ }
254
+ await multiCommand.exec();
255
+ }
256
+ /**
257
+ * Adds a value to the left end of a Redis list.
258
+ *
259
+ * @template T - The type of value being enqueued
260
+ * @param {string} queueName - The name of the Redis list
261
+ * @param {T} value - The value to add to the list
262
+ * @returns {Promise<void>} A promise that resolves when the value is enqueued
263
+ */
264
+ async enqueueRecord(queueName, value) {
265
+ await this.client.lPush(queueName, JSON.stringify(value));
266
+ }
267
+ /**
268
+ * Adds multiple values to the left end of a Redis list in a single transaction.
269
+ *
270
+ * @template T - The type of values being enqueued
271
+ * @param {string} queueName - The name of the Redis list
272
+ * @param {T[]} values - Array of values to add to the list
273
+ * @returns {Promise<void>} A promise that resolves when all values are enqueued
274
+ */
275
+ async enqueueBatchRecords(queueName, values) {
276
+ let multiCommand = this.client.multi();
277
+ for (const value of values) {
278
+ multiCommand = multiCommand.lPush(queueName, JSON.stringify(value));
279
+ }
280
+ await multiCommand.exec();
281
+ }
60
282
  /**
61
283
  * Deletes a record from the Redis cache.
62
284
  *
63
- * @param {string} cacheRecordKey - The key of the cache record to delete.
64
- * @returns {Promise<void>} - A promise that resolves when the record is deleted from the cache.
285
+ * @param {string} cacheRecordKey - The key of the record to delete
286
+ * @returns {Promise<void>} A promise that resolves when the record is deleted
65
287
  */
66
288
  async deleteRecord(cacheRecordKey) {
67
289
  await this.client.del(cacheRecordKey);
68
290
  }
291
+ /**
292
+ * Deletes multiple records from the Redis cache in a single transaction.
293
+ *
294
+ * @param {string[]} cacheRecordKeys - Array of keys to delete
295
+ * @returns {Promise<void>} A promise that resolves when all records are deleted
296
+ */
297
+ async deleteBatchRecords(cacheRecordKeys) {
298
+ let multiCommand = this.client.multi();
299
+ for (const key of cacheRecordKeys) {
300
+ multiCommand = multiCommand.del(key);
301
+ }
302
+ await multiCommand.exec();
303
+ }
304
+ /**
305
+ * Removes and returns the rightmost element from a Redis list.
306
+ *
307
+ * @template T - The type of value being dequeued
308
+ * @param {string} queueName - The name of the Redis list
309
+ * @returns {Promise<T>} A promise that resolves with the dequeued value
310
+ * @throws {Error} If the queue is empty
311
+ */
312
+ async dequeueRecord(queueName) {
313
+ const value = await this.client.rPop(queueName);
314
+ if (value === null) {
315
+ throw new Error(`Queue is empty: ${queueName}`);
316
+ }
317
+ return JSON.parse(value);
318
+ }
319
+ /**
320
+ * Removes and returns multiple elements from the right end of a Redis list.
321
+ *
322
+ * @template T - The type of values being dequeued
323
+ * @param {string} queueName - The name of the Redis list
324
+ * @param {number} pageSize - Maximum number of elements to dequeue
325
+ * @returns {Promise<T[]>} A promise that resolves with an array of dequeued values
326
+ */
327
+ async dequeueBatchRecords(queueName, pageSize) {
328
+ let multiCommand = this.client.multi();
329
+ for (let i = 0; i < pageSize; i++) {
330
+ multiCommand = multiCommand.rPop(queueName);
331
+ }
332
+ const values = await multiCommand.exec();
333
+ return values.map((value) => this.parseValue(value));
334
+ }
69
335
  /**
70
336
  * Reads a record from the Redis cache.
71
337
  *
72
- * @param {string} cacheRecordKey - The key of the cache record to read.
73
- * @returns {Promise<TtlCacheRecord>} - A promise that resolves with the cache record.
74
- * @throws {Error} - Throws an error if the record is not found.
338
+ * @template T - The type of value being read
339
+ * @param {string} cacheRecordKey - The key of the record to read
340
+ * @returns {Promise<TtlCacheRecord<T>>} A promise that resolves with the cache record
341
+ * @throws {Error} If the record is not found
75
342
  */
76
343
  async readRecord(cacheRecordKey) {
77
- const value = await this.client.get(cacheRecordKey);
344
+ const [value, ttl] = await this.client.multi().get(cacheRecordKey).ttl(cacheRecordKey).exec();
78
345
  if (value === null) {
79
346
  throw new Error(`Record not found for key: ${cacheRecordKey}`);
80
347
  }
81
- const ttl = await this.client.ttl(cacheRecordKey);
82
348
  return {
83
349
  key: cacheRecordKey,
84
- value: JSON.parse(value),
85
- ttlMilliseconds: ttl * 1e3
350
+ value: this.parseValue(value),
351
+ ttlMilliseconds: this.parseValue(ttl) * 1e3
86
352
  };
87
353
  }
88
354
  /**
89
- * Lists the keys in the Redis cache that match a pattern prefix.
355
+ * Reads multiple records from the Redis cache.
356
+ *
357
+ * @template T - The type of values being read
358
+ * @param {string[] | string} cacheRecordKeysOrPrefix - Array of keys to read, or a prefix pattern
359
+ * @returns {Promise<TtlCacheRecord<T>[]>} A promise that resolves with an array of cache records
360
+ */
361
+ async readBatchRecords(cacheRecordKeysOrPrefix) {
362
+ const keys = Array.isArray(cacheRecordKeysOrPrefix) ? cacheRecordKeysOrPrefix : await this.client.keys(cacheRecordKeysOrPrefix + "*");
363
+ let multiCommand = this.client.multi();
364
+ for (const key of keys) {
365
+ multiCommand = multiCommand.get(key);
366
+ multiCommand = multiCommand.ttl(key);
367
+ }
368
+ const values = await multiCommand.exec();
369
+ return values.reduce((acc, value, index) => {
370
+ if (index % 2 === 0) {
371
+ acc.push({
372
+ key: keys[index / 2],
373
+ value: this.parseValue(value),
374
+ ttlMilliseconds: this.parseValue(values[index + 1]) * 1e3
375
+ });
376
+ }
377
+ return acc;
378
+ }, []);
379
+ }
380
+ /**
381
+ * Lists all keys in the Redis cache that match a pattern prefix.
90
382
  *
91
- * @param {string} pattern_prefix - The pattern prefix to match.
92
- * @returns {Promise<string[]>} - A promise that resolves with an array of keys matching the pattern prefix.
383
+ * @param {string} pattern_prefix - The prefix pattern to match keys against
384
+ * @returns {Promise<string[]>} A promise that resolves with an array of matching keys
93
385
  */
94
386
  async listKeys(pattern_prefix) {
95
387
  const keys = await this.client.keys(pattern_prefix + "*");
96
388
  return keys;
97
389
  }
98
390
  /**
99
- * Peeks at a record in the Redis cache to check if it exists.
391
+ * Checks if a record exists in the Redis cache.
100
392
  *
101
- * @param {string} cacheRecordKey - The key of the cache record to peek at.
102
- * @returns {Promise<boolean>} - A promise that resolves with a boolean indicating if the record exists.
393
+ * @param {string} cacheRecordKey - The key to check
394
+ * @returns {Promise<boolean>} A promise that resolves with true if the record exists, false otherwise
103
395
  */
104
396
  async peekRecord(cacheRecordKey) {
105
397
  const result = await this.client.exists(cacheRecordKey);
106
398
  return result === 1;
107
399
  }
108
400
  /**
109
- * Disconnects the Redis client.
401
+ * Checks if multiple records exist in the Redis cache.
402
+ *
403
+ * @param {string[] | string} cacheRecordKeysOrPrefix - Array of keys to check, or a prefix pattern
404
+ * @returns {Promise<boolean[]>} A promise that resolves with an array of existence booleans
405
+ */
406
+ async peekBatchRecords(cacheRecordKeysOrPrefix) {
407
+ const keys = Array.isArray(cacheRecordKeysOrPrefix) ? cacheRecordKeysOrPrefix : await this.client.keys(cacheRecordKeysOrPrefix + "*");
408
+ let multiCommand = this.client.multi();
409
+ for (const key of keys) {
410
+ multiCommand = multiCommand.exists(key);
411
+ }
412
+ const results = await multiCommand.exec();
413
+ return results.map((result) => result === 1);
414
+ }
415
+ /**
416
+ * Peeks at a record in the Redis cache.
417
+ *
418
+ * @template T - The type of value being peeked at
419
+ * @param {string} queueName - The name of the Redis queue
420
+ * @returns {Promise<T>} A promise that resolves with the peeked value
421
+ */
422
+ async peekQueueRecord(queueName) {
423
+ const value = await this.client.lRange(queueName, 0, 0);
424
+ return this.parseValue(value[0]);
425
+ }
426
+ /**
427
+ * Peeks at multiple records in the Redis cache.
428
+ *
429
+ * @template T - The type of values being peeked at
430
+ * @param {string} queueName - The name of the Redis queue
431
+ * @param {number} pageSize - The number of records to peek at
432
+ * @returns {Promise<T[]>} A promise that resolves with an array of peeked values
433
+ */
434
+ async peekQueueRecords(queueName, pageSize) {
435
+ const values = await this.client.lRange(queueName, 0, pageSize - 1);
436
+ return values.map((value) => this.parseValue(value));
437
+ }
438
+ /**
439
+ * Gracefully disconnects from the Redis server.
110
440
  *
111
- * @returns {Promise<void>} - A promise that resolves when the client is disconnected.
441
+ * @returns {Promise<void>} A promise that resolves when the connection is closed
112
442
  */
113
443
  async disconnect() {
114
444
  await this.client.quit();
115
445
  }
116
446
  /**
117
- * Gets the default TTL (Time-To-Live) in milliseconds.
447
+ * Gets the default Time-To-Live value in milliseconds.
118
448
  *
119
- * @returns {number} - The TTL in milliseconds.
449
+ * @returns {number} The default TTL in milliseconds
120
450
  */
121
451
  getTtlMilliseconds() {
122
452
  return this.ttlMilliseconds;
123
453
  }
124
- };
125
-
126
- // src/cache/utils/cacheKey.ts
127
- var createCacheKey = (cacheKeyPrefix) => (id) => {
128
- return `${cacheKeyPrefix}:${id}`;
454
+ /**
455
+ * Gets the underlying Redis client instance.
456
+ *
457
+ * @returns {typeof this.client} The Redis client instance
458
+ */
459
+ getClient() {
460
+ return this.client;
461
+ }
129
462
  };
130
463
  // Annotate the CommonJS export names for ESM import in node:
131
464
  0 && (module.exports = {