@hastehaul/common 2.0.11 → 2.0.14

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.
@@ -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): void;
23
+ connect(httpServer: http.Server, path?: string): void;
24
24
  }
25
25
  /**
26
26
  * Singleton instance of the SocketWrapper class to provide a centralized Socket.IO server connection.
@@ -24,9 +24,9 @@ class SocketWrapper {
24
24
  *
25
25
  * @param {http.Server} httpServer - The HTTP server instance to attach Socket.IO to.
26
26
  */
27
- connect(httpServer) {
27
+ connect(httpServer, path) {
28
28
  this._io = new socket_io_1.Server(httpServer, {
29
- path: "/socket/",
29
+ path: path || `/${path}/socket/`,
30
30
  pingTimeout: 30000,
31
31
  pingInterval: 25000,
32
32
  cors: {
@@ -1,3 +1,4 @@
1
1
  export declare function hasElapsed(expirationDate: Date): boolean;
2
2
  export declare function colorize(text: string, colorCode: number): string;
3
3
  export declare function formatDatetimeToHumanReadable(datetime: Date, format?: string): string;
4
+ export declare function generateIdentifier(messageContent: string): string;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.formatDatetimeToHumanReadable = exports.colorize = exports.hasElapsed = void 0;
6
+ exports.generateIdentifier = exports.formatDatetimeToHumanReadable = exports.colorize = exports.hasElapsed = void 0;
7
7
  const moment_1 = __importDefault(require("moment"));
8
8
  function hasElapsed(expirationDate) {
9
9
  const currentDate = (0, moment_1.default)();
@@ -20,3 +20,8 @@ function formatDatetimeToHumanReadable(datetime, format) {
20
20
  return (0, moment_1.default)(datetime).format(format || 'MMMM D, YYYY h:mm A');
21
21
  }
22
22
  exports.formatDatetimeToHumanReadable = formatDatetimeToHumanReadable;
23
+ function generateIdentifier(messageContent) {
24
+ // You can use any hash function or strategy that suits your needs
25
+ return Buffer.from(messageContent).toString('base64');
26
+ }
27
+ exports.generateIdentifier = generateIdentifier;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hastehaul/common",
3
- "version": "2.0.11",
3
+ "version": "2.0.14",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",