@hastehaul/common 2.0.26 → 2.0.28

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.
@@ -22,7 +22,7 @@ export declare class RedisWrapper {
22
22
  * @param {string} host - The Redis server host address (default is "customer-redis-srv").
23
23
  * @param {number} port - The Redis server port number (default is 6379).
24
24
  */
25
- connect(host?: string, port?: number): void;
25
+ connect(host?: string, port?: number): Promise<void>;
26
26
  }
27
27
  /**
28
28
  * Singleton instance of the RedisWrapper class to provide a centralized Redis client connection.
@@ -1,4 +1,13 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
13
  };
@@ -34,12 +43,14 @@ class RedisWrapper {
34
43
  * @param {number} port - The Redis server port number (default is 6379).
35
44
  */
36
45
  connect(host, port) {
37
- this._redisClient = new ioredis_1.default({ host: host || this.host, port: port || this.port, maxRetriesPerRequest: null });
38
- this._redisClient.on("connect", function () {
39
- console.info("Redis Server Connected!");
40
- });
41
- this._redisClient.on("error", function (error) {
42
- console.error("Error in Redis", error);
46
+ return __awaiter(this, void 0, void 0, function* () {
47
+ this._redisClient = new ioredis_1.default({ host: host || this.host, port: port || this.port, maxRetriesPerRequest: null });
48
+ this._redisClient.on("connect", function () {
49
+ console.info("Redis Server Connected!");
50
+ });
51
+ this._redisClient.on("error", function (error) {
52
+ console.error("Error in Redis", error);
53
+ });
43
54
  });
44
55
  }
45
56
  }
@@ -20,7 +20,7 @@ export declare class SocketWrapper {
20
20
  *
21
21
  * @param {http.Server} httpServer - The HTTP server instance to attach Socket.IO to.
22
22
  */
23
- connect(httpServer: http.Server, path?: string): void;
23
+ connect(httpServer: http.Server, path?: string): Promise<void>;
24
24
  }
25
25
  /**
26
26
  * Singleton instance of the SocketWrapper class to provide a centralized Socket.IO server connection.
@@ -1,4 +1,13 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  exports.socketWrapper = exports.SocketWrapper = void 0;
4
13
  const socket_io_1 = require("socket.io");
@@ -25,15 +34,17 @@ class SocketWrapper {
25
34
  * @param {http.Server} httpServer - The HTTP server instance to attach Socket.IO to.
26
35
  */
27
36
  connect(httpServer, path) {
28
- this._io = new socket_io_1.Server(httpServer, {
29
- path: `/${path ? path + '/' : ''}socket/`,
30
- pingTimeout: 30000,
31
- pingInterval: 25000,
32
- cors: {
33
- origin: "*",
34
- methods: ["GET", "POST"],
35
- // credentials: true,
36
- },
37
+ return __awaiter(this, void 0, void 0, function* () {
38
+ this._io = new socket_io_1.Server(httpServer, {
39
+ path: `/${path ? path + '/' : ''}socket/`,
40
+ pingTimeout: 30000,
41
+ pingInterval: 25000,
42
+ cors: {
43
+ origin: "*",
44
+ methods: ["GET", "POST"],
45
+ // credentials: true,
46
+ },
47
+ });
37
48
  });
38
49
  }
39
50
  }
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export declare enum CustomerSystemSubjects {
5
5
  CustomerSystemCustomerService = "customer-system.customer-service",
6
- CustomerSystemPaymentService = "customer-system.notification-service",
6
+ CustomerSystemPaymentService = "customer-system.payment-service",
7
7
  CustomerSystemDriverService = "customer-system.driver-service",
8
8
  CustomerSystemDiscountService = "customer-system.discount-service"
9
9
  }
@@ -7,7 +7,7 @@ exports.CustomerSystemSubjects = void 0;
7
7
  var CustomerSystemSubjects;
8
8
  (function (CustomerSystemSubjects) {
9
9
  CustomerSystemSubjects["CustomerSystemCustomerService"] = "customer-system.customer-service";
10
- CustomerSystemSubjects["CustomerSystemPaymentService"] = "customer-system.notification-service";
10
+ CustomerSystemSubjects["CustomerSystemPaymentService"] = "customer-system.payment-service";
11
11
  CustomerSystemSubjects["CustomerSystemDriverService"] = "customer-system.driver-service";
12
12
  CustomerSystemSubjects["CustomerSystemDiscountService"] = "customer-system.discount-service";
13
13
  })(CustomerSystemSubjects || (exports.CustomerSystemSubjects = CustomerSystemSubjects = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hastehaul/common",
3
- "version": "2.0.26",
3
+ "version": "2.0.28",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",