@hastehaul/common 2.0.26 → 2.0.28
Sign up to get free protection for your applications and to get access to all the features.
- package/build/connections-wrappers/redis-connection-wrapper.d.ts +1 -1
- package/build/connections-wrappers/redis-connection-wrapper.js +17 -6
- package/build/connections-wrappers/socket-connection-wrapper.d.ts +1 -1
- package/build/connections-wrappers/socket-connection-wrapper.js +20 -9
- package/build/events/common/enums/subjects/customer-system-subjects.d.ts +1 -1
- package/build/events/common/enums/subjects/customer-system-subjects.js +1 -1
- package/package.json +1 -1
@@ -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
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
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
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
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.
|
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.
|
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 = {}));
|