@hastehaul/common 1.0.14 → 1.0.17

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 (46) hide show
  1. package/build/errors/bad-request-error.d.ts +24 -2
  2. package/build/errors/bad-request-error.js +22 -0
  3. package/build/errors/custom-error.d.ts +24 -0
  4. package/build/errors/custom-error.js +11 -0
  5. package/build/errors/database-error.d.ts +24 -2
  6. package/build/errors/database-error.js +23 -1
  7. package/build/errors/index.d.ts +25 -0
  8. package/build/errors/index.js +26 -0
  9. package/build/errors/not-found-error.d.ts +24 -2
  10. package/build/errors/not-found-error.js +22 -0
  11. package/build/errors/system-error.d.ts +25 -2
  12. package/build/errors/system-error.js +24 -1
  13. package/build/events/base/base-consumer.d.ts +3 -1
  14. package/build/events/base/base-publisher.d.ts +1 -1
  15. package/build/events/base/base-stream.d.ts +1 -1
  16. package/build/events/base/index.d.ts +21 -0
  17. package/build/events/base/index.js +38 -0
  18. package/build/events/common/index.d.ts +14 -0
  19. package/build/events/common/index.js +31 -0
  20. package/build/events/common/interfaces/index.d.ts +13 -0
  21. package/build/events/common/interfaces/index.js +33 -0
  22. package/build/events/common/interfaces/order-events-interfaces/index.d.ts +18 -0
  23. package/build/events/common/interfaces/order-events-interfaces/index.js +35 -0
  24. package/build/events/common/interfaces/order-events-interfaces/order-cancelled-event.d.ts +36 -0
  25. package/build/events/common/interfaces/order-events-interfaces/order-completed-event.d.ts +36 -0
  26. package/build/events/common/interfaces/order-events-interfaces/order-requested-event.d.ts +36 -0
  27. package/build/events/common/interfaces/payment-event-interfaces/index.d.ts +0 -0
  28. package/build/events/common/interfaces/payment-event-interfaces/index.js +3 -0
  29. package/build/events/common/interfaces/stream-interfaces/index.d.ts +1 -0
  30. package/build/events/common/interfaces/stream-interfaces/index.js +18 -0
  31. package/build/events/common/interfaces/stream-interfaces/order-stream-interface.d.ts +17 -0
  32. package/build/events/index.d.ts +14 -0
  33. package/build/events/index.js +31 -0
  34. package/build/index.d.ts +166 -4
  35. package/build/index.js +175 -4
  36. package/build/utils/base_classes/index.d.ts +18 -0
  37. package/build/utils/base_classes/index.js +19 -0
  38. package/build/utils/base_classes/jobs/base-producers.js +2 -2
  39. package/build/utils/base_classes/jobs/base-worker.js +2 -2
  40. package/build/utils/base_classes/listeners/base-namespace.d.ts +15 -0
  41. package/build/utils/base_classes/listeners/base-namespace.js +7 -0
  42. package/build/utils/enums.d.ts +1 -1
  43. package/build/utils/enums.js +1 -1
  44. package/build/utils/index.d.ts +18 -0
  45. package/build/utils/index.js +19 -0
  46. package/package.json +1 -1
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ // Import and re-export multiple modules related to jobs and listeners.
2
3
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
4
  if (k2 === undefined) k2 = k;
4
5
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -14,6 +15,24 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
15
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
16
  };
16
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ /**
19
+ * Re-exports all the contents from the "base-producers" module.
20
+ *
21
+ * The "base-producers" module contains base classes and utilities for implementing job producers in the application.
22
+ * Job producers are responsible for generating and queuing jobs to be processed by job workers.
23
+ */
17
24
  __exportStar(require("./jobs/base-producers"), exports);
25
+ /**
26
+ * Re-exports all the contents from the "base-worker" module.
27
+ *
28
+ * The "base-worker" module contains base classes and utilities for implementing job workers in the application.
29
+ * Job workers are responsible for processing jobs generated by job producers and executing the required tasks.
30
+ */
18
31
  __exportStar(require("./jobs/base-worker"), exports);
32
+ /**
33
+ * Re-exports all the contents from the "base-namespace" module.
34
+ *
35
+ * The "base-namespace" module contains base classes and utilities for implementing custom namespaces in the application.
36
+ * Custom namespaces provide separate channels for communication between connected clients and the server, allowing for organized event handling within separate contexts.
37
+ */
19
38
  __exportStar(require("./listeners/base-namespace"), exports);
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AbstractJobQueue = void 0;
4
4
  const bullmq_1 = require("bullmq");
5
- const connections_wrappers_1 = require("../../../connections-wrappers");
5
+ const redis_connection_wrapper_1 = require("../../../connections-wrappers/redis-connection-wrapper");
6
6
  /**
7
7
  * Abstract class representing a Job Queue.
8
8
  */
@@ -14,7 +14,7 @@ class AbstractJobQueue {
14
14
  */
15
15
  constructor(queueName) {
16
16
  // Initialize the job queue with the provided name and a Redis connection from the redisWrapper.
17
- this.que = new bullmq_1.Queue(queueName, { connection: connections_wrappers_1.redisWrapper.client });
17
+ this.que = new bullmq_1.Queue(queueName, { connection: redis_connection_wrapper_1.redisWrapper.client });
18
18
  }
19
19
  }
20
20
  exports.AbstractJobQueue = AbstractJobQueue;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AbstractWorker = void 0;
4
4
  const bullmq_1 = require("bullmq");
5
- const connections_wrappers_1 = require("../../../connections-wrappers");
5
+ const redis_connection_wrapper_1 = require("../../../connections-wrappers/redis-connection-wrapper");
6
6
  /**
7
7
  * Abstract class representing a worker for processing jobs from a Job Queue.
8
8
  */
@@ -15,7 +15,7 @@ class AbstractWorker {
15
15
  constructor(queueName) {
16
16
  // Create a worker instance with the provided queueName and bind the 'process' method to this worker.
17
17
  this.worker = new bullmq_1.Worker(queueName, this.process.bind(this), {
18
- connection: connections_wrappers_1.redisWrapper.client,
18
+ connection: redis_connection_wrapper_1.redisWrapper.client,
19
19
  autorun: false,
20
20
  });
21
21
  // Handle errors that may occur during job processing.
@@ -1,4 +1,19 @@
1
1
  import { Server } from 'socket.io';
2
+ /**
3
+ * Abstract class representing a Socket.IO namespace.
4
+ *
5
+ * The "IoNamespace" class serves as a base class for implementing custom Socket.IO namespaces in the application.
6
+ * A Socket.IO namespace provides a separate channel for communication between connected clients and the server.
7
+ * Custom namespaces allow developers to organize events and logic within separate contexts.
8
+ */
2
9
  export declare abstract class IoNamespace {
10
+ /**
11
+ * Abstract method to be implemented by subclasses.
12
+ *
13
+ * The "connect" method is used to establish a connection between the Socket.IO namespace and the server.
14
+ * Subclasses should override this method to define the specific logic and event handling for the namespace.
15
+ *
16
+ * @param io The Socket.IO server instance to which the namespace is connected.
17
+ */
3
18
  abstract connect(io: Server): void;
4
19
  }
@@ -1,6 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.IoNamespace = void 0;
4
+ /**
5
+ * Abstract class representing a Socket.IO namespace.
6
+ *
7
+ * The "IoNamespace" class serves as a base class for implementing custom Socket.IO namespaces in the application.
8
+ * A Socket.IO namespace provides a separate channel for communication between connected clients and the server.
9
+ * Custom namespaces allow developers to organize events and logic within separate contexts.
10
+ */
4
11
  class IoNamespace {
5
12
  }
6
13
  exports.IoNamespace = IoNamespace;
@@ -61,7 +61,7 @@ export declare enum StatusCodes {
61
61
  TOO_MANY_REQUEST = 429,
62
62
  REQUEST_HEADER_FIELDS_TOO_LARGE = 431,
63
63
  UNAVAILABLE_FOR_LEGAL_REASONS = 451,
64
- INTERNALE_SERVER_ERROR = 500,
64
+ INTERNAL_SERVER_ERROR = 500,
65
65
  NOT_IMPLEMENTED = 501,
66
66
  BAD_GATEWAY = 502,
67
67
  SERVICE_UNAVAILABLE = 503,
@@ -67,7 +67,7 @@ var StatusCodes;
67
67
  StatusCodes[StatusCodes["TOO_MANY_REQUEST"] = 429] = "TOO_MANY_REQUEST";
68
68
  StatusCodes[StatusCodes["REQUEST_HEADER_FIELDS_TOO_LARGE"] = 431] = "REQUEST_HEADER_FIELDS_TOO_LARGE";
69
69
  StatusCodes[StatusCodes["UNAVAILABLE_FOR_LEGAL_REASONS"] = 451] = "UNAVAILABLE_FOR_LEGAL_REASONS";
70
- StatusCodes[StatusCodes["INTERNALE_SERVER_ERROR"] = 500] = "INTERNALE_SERVER_ERROR";
70
+ StatusCodes[StatusCodes["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
71
71
  StatusCodes[StatusCodes["NOT_IMPLEMENTED"] = 501] = "NOT_IMPLEMENTED";
72
72
  StatusCodes[StatusCodes["BAD_GATEWAY"] = 502] = "BAD_GATEWAY";
73
73
  StatusCodes[StatusCodes["SERVICE_UNAVAILABLE"] = 503] = "SERVICE_UNAVAILABLE";
@@ -1,3 +1,21 @@
1
+ /**
2
+ * Re-exports all the enums from the "enums" module.
3
+ *
4
+ * The "enums" module contains various enumerations used in the application.
5
+ * Enumerations are used to define named constant values, such as status codes, subject names, or stream names.
6
+ */
1
7
  export * from "./enums";
8
+ /**
9
+ * Re-exports all the base classes from the "base_classes" module.
10
+ *
11
+ * The "base_classes" module contains base classes and utilities that provide foundational functionality for different parts of the application.
12
+ * This includes base classes for consumers, publishers, streams, etc., which can be extended to implement specific functionality.
13
+ */
2
14
  export * from "./base_classes";
15
+ /**
16
+ * Re-exports all the functions related to reading directories from the "read-dir" module.
17
+ *
18
+ * The "read-dir" module contains utility functions to read and access files and directories in the application.
19
+ * These functions are used for dynamic loading, configuration, and other file-related operations.
20
+ */
3
21
  export * from "./read-dir";
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ // Import and re-export multiple modules for enums, base classes, and read-dir functionality.
2
3
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
4
  if (k2 === undefined) k2 = k;
4
5
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -14,6 +15,24 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
15
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
16
  };
16
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ /**
19
+ * Re-exports all the enums from the "enums" module.
20
+ *
21
+ * The "enums" module contains various enumerations used in the application.
22
+ * Enumerations are used to define named constant values, such as status codes, subject names, or stream names.
23
+ */
17
24
  __exportStar(require("./enums"), exports);
25
+ /**
26
+ * Re-exports all the base classes from the "base_classes" module.
27
+ *
28
+ * The "base_classes" module contains base classes and utilities that provide foundational functionality for different parts of the application.
29
+ * This includes base classes for consumers, publishers, streams, etc., which can be extended to implement specific functionality.
30
+ */
18
31
  __exportStar(require("./base_classes"), exports);
32
+ /**
33
+ * Re-exports all the functions related to reading directories from the "read-dir" module.
34
+ *
35
+ * The "read-dir" module contains utility functions to read and access files and directories in the application.
36
+ * These functions are used for dynamic loading, configuration, and other file-related operations.
37
+ */
19
38
  __exportStar(require("./read-dir"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hastehaul/common",
3
- "version": "1.0.14",
3
+ "version": "1.0.17",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",