dt-common-device 8.0.7 → 8.0.9

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.
@@ -29,6 +29,7 @@ export declare function getDTApiKey(): string;
29
29
  export declare function getRedisDbHostAndPort(): {
30
30
  host: string;
31
31
  port: number;
32
+ nodeEnv: string;
32
33
  };
33
34
  /**
34
35
  * Graceful shutdown function
@@ -270,11 +270,12 @@ function getDTApiKey() {
270
270
  function getRedisDbHostAndPort() {
271
271
  const host = process.env.REDIS_HOST;
272
272
  const port = process.env.REDIS_PORT;
273
- if (!host || !port) {
273
+ const nodeEnv = process.env.NODE_ENV;
274
+ if (!host || !port || !nodeEnv) {
274
275
  getConfig().LOGGER.error("REDIS_HOST and REDIS_PORT must be set in environment variables");
275
276
  throw new Error("dt-common-device: REDIS_HOST and REDIS_PORT must be set in environment variables");
276
277
  }
277
- return { host, port: Number(port) };
278
+ return { host, port: Number(port), nodeEnv };
278
279
  }
279
280
  /**
280
281
  * Graceful shutdown function
@@ -257,6 +257,7 @@ export declare const DT_EVENT_TYPES: {
257
257
  SCHEDULE_CODES: string;
258
258
  MARKED_TO_DELETE_CODES: string;
259
259
  UNSET_CODES: string;
260
+ ORPHANED_GUEST_CODES: string;
260
261
  };
261
262
  STOPPED: string;
262
263
  COMPLETED: string;
@@ -260,6 +260,7 @@ exports.DT_EVENT_TYPES = {
260
260
  SCHEDULE_CODES: "heartbeat.lock.schedule_codes",
261
261
  MARKED_TO_DELETE_CODES: "heartbeat.lock.marked_to_delete_codes",
262
262
  UNSET_CODES: "heartbeat.lock.unset_codes",
263
+ ORPHANED_GUEST_CODES: "heartbeat.lock.orphaned_guest_codes",
263
264
  },
264
265
  STOPPED: "heartbeat.stopped",
265
266
  COMPLETED: "heartbeat.completed",
package/dist/db/redis.js CHANGED
@@ -4,21 +4,36 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getRedisClient = getRedisClient;
7
+ //Singleton pattern to ensure only one Redis client instance is create only once and shared across the application
7
8
  const config_1 = require("../config/config");
8
9
  const ioredis_1 = __importDefault(require("ioredis"));
9
10
  let redisClient = null;
10
- //Singleton pattern to ensure only one Redis client instance is create only once and shared across the application
11
11
  function getRedisClient() {
12
12
  if (!redisClient) {
13
- const { host, port } = (0, config_1.getRedisDbHostAndPort)();
13
+ const { host, port, nodeEnv } = (0, config_1.getRedisDbHostAndPort)();
14
+ const isGreenEcs = nodeEnv === "green-ecs";
14
15
  redisClient = new ioredis_1.default({
15
16
  host,
16
17
  port,
18
+ tls: isGreenEcs
19
+ ? {
20
+ rejectUnauthorized: false, // required for AWS ElastiCache TLS
21
+ }
22
+ : undefined, // no TLS for dev/QA/UAT
23
+ lazyConnect: true,
24
+ enableReadyCheck: false,
25
+ connectTimeout: 10000,
17
26
  maxRetriesPerRequest: null,
18
27
  });
19
28
  redisClient.on("error", (error) => {
20
29
  console.error("Redis error:", error);
21
30
  });
31
+ redisClient.on("connect", () => {
32
+ console.log("✅ Redis connected successfully");
33
+ });
34
+ redisClient.on("ready", () => {
35
+ console.log("✅ Redis ready for operations");
36
+ });
22
37
  }
23
38
  return redisClient;
24
39
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dt-common-device",
3
- "version": "8.0.7",
3
+ "version": "8.0.9",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [