@hastehaul/common 1.0.14 → 1.0.17
Sign up to get free protection for your applications and to get access to all the features.
- package/build/errors/bad-request-error.d.ts +24 -2
- package/build/errors/bad-request-error.js +22 -0
- package/build/errors/custom-error.d.ts +24 -0
- package/build/errors/custom-error.js +11 -0
- package/build/errors/database-error.d.ts +24 -2
- package/build/errors/database-error.js +23 -1
- package/build/errors/index.d.ts +25 -0
- package/build/errors/index.js +26 -0
- package/build/errors/not-found-error.d.ts +24 -2
- package/build/errors/not-found-error.js +22 -0
- package/build/errors/system-error.d.ts +25 -2
- package/build/errors/system-error.js +24 -1
- package/build/events/base/base-consumer.d.ts +3 -1
- package/build/events/base/base-publisher.d.ts +1 -1
- package/build/events/base/base-stream.d.ts +1 -1
- package/build/events/base/index.d.ts +21 -0
- package/build/events/base/index.js +38 -0
- package/build/events/common/index.d.ts +14 -0
- package/build/events/common/index.js +31 -0
- package/build/events/common/interfaces/index.d.ts +13 -0
- package/build/events/common/interfaces/index.js +33 -0
- package/build/events/common/interfaces/order-events-interfaces/index.d.ts +18 -0
- package/build/events/common/interfaces/order-events-interfaces/index.js +35 -0
- package/build/events/common/interfaces/order-events-interfaces/order-cancelled-event.d.ts +36 -0
- package/build/events/common/interfaces/order-events-interfaces/order-completed-event.d.ts +36 -0
- package/build/events/common/interfaces/order-events-interfaces/order-requested-event.d.ts +36 -0
- package/build/events/common/interfaces/payment-event-interfaces/index.d.ts +0 -0
- package/build/events/common/interfaces/payment-event-interfaces/index.js +3 -0
- package/build/events/common/interfaces/stream-interfaces/index.d.ts +1 -0
- package/build/events/common/interfaces/stream-interfaces/index.js +18 -0
- package/build/events/common/interfaces/stream-interfaces/order-stream-interface.d.ts +17 -0
- package/build/events/index.d.ts +14 -0
- package/build/events/index.js +31 -0
- package/build/index.d.ts +166 -4
- package/build/index.js +175 -4
- package/build/utils/base_classes/index.d.ts +18 -0
- package/build/utils/base_classes/index.js +19 -0
- package/build/utils/base_classes/jobs/base-producers.js +2 -2
- package/build/utils/base_classes/jobs/base-worker.js +2 -2
- package/build/utils/base_classes/listeners/base-namespace.d.ts +15 -0
- package/build/utils/base_classes/listeners/base-namespace.js +7 -0
- package/build/utils/enums.d.ts +1 -1
- package/build/utils/enums.js +1 -1
- package/build/utils/index.d.ts +18 -0
- package/build/utils/index.js +19 -0
- package/package.json +1 -1
@@ -1,15 +1,51 @@
|
|
1
1
|
import { OrderDurableName } from '../../enums/durable-names/order-dname';
|
2
2
|
import { OrderStream } from '../../enums/streams/order-stream';
|
3
3
|
import { OrderSubjects } from '../../enums/subjects/order-subjects';
|
4
|
+
/**
|
5
|
+
* Interface representing the "Order Cancelled" event.
|
6
|
+
*
|
7
|
+
* The "OrderCancelledEvent" interface defines the structure of an event related to the cancellation of an order.
|
8
|
+
* Events of this type are used to communicate order cancellation details across the application.
|
9
|
+
*/
|
4
10
|
export interface OrderCancelledEvent {
|
11
|
+
/**
|
12
|
+
* The subject of the event, specifying that it represents an "Order Cancelled" event.
|
13
|
+
*/
|
5
14
|
subject: OrderSubjects.OrderCancelled;
|
15
|
+
/**
|
16
|
+
* The durable name associated with the consumer handling the "Order Cancelled" event.
|
17
|
+
* This property is optional and may be used to identify the consumer processing the event in a durable manner.
|
18
|
+
*/
|
6
19
|
durableName?: OrderDurableName.OrderCancelledDurablename;
|
20
|
+
/**
|
21
|
+
* The stream to which the event belongs, specifying that it is an "Order" stream.
|
22
|
+
* Events of different types may be grouped into different streams based on their common characteristics.
|
23
|
+
*/
|
7
24
|
stream: OrderStream.Order;
|
25
|
+
/**
|
26
|
+
* The data payload of the "Order Cancelled" event.
|
27
|
+
* The data payload contains specific details related to the order cancellation, such as order ID, version, status, user ID, and trip ID.
|
28
|
+
*/
|
8
29
|
data: {
|
30
|
+
/**
|
31
|
+
* The unique identifier of the order associated with the cancellation event.
|
32
|
+
*/
|
9
33
|
id: string;
|
34
|
+
/**
|
35
|
+
* The version number of the order at the time of the cancellation event.
|
36
|
+
*/
|
10
37
|
version: number;
|
38
|
+
/**
|
39
|
+
* The status of the order after the cancellation event (e.g., "cancelled").
|
40
|
+
*/
|
11
41
|
status: string;
|
42
|
+
/**
|
43
|
+
* The unique identifier of the user who initiated the order cancellation.
|
44
|
+
*/
|
12
45
|
userid: string;
|
46
|
+
/**
|
47
|
+
* The unique identifier of the trip associated with the cancelled order.
|
48
|
+
*/
|
13
49
|
tripid: string;
|
14
50
|
};
|
15
51
|
}
|
@@ -1,15 +1,51 @@
|
|
1
1
|
import { OrderDurableName } from '../../enums/durable-names/order-dname';
|
2
2
|
import { OrderStream } from '../../enums/streams/order-stream';
|
3
3
|
import { OrderSubjects } from '../../enums/subjects/order-subjects';
|
4
|
+
/**
|
5
|
+
* Interface representing the "Order Completed" event.
|
6
|
+
*
|
7
|
+
* The "OrderCompletedEvent" interface defines the structure of an event related to the completion of an order.
|
8
|
+
* Events of this type are used to communicate order completion details across the application.
|
9
|
+
*/
|
4
10
|
export interface OrderCompletedEvent {
|
11
|
+
/**
|
12
|
+
* The subject of the event, specifying that it represents an "Order Completed" event.
|
13
|
+
*/
|
5
14
|
subject: OrderSubjects.OrderCompleted;
|
15
|
+
/**
|
16
|
+
* The durable name associated with the consumer handling the "Order Completed" event.
|
17
|
+
* This property is optional and may be used to identify the consumer processing the event in a durable manner.
|
18
|
+
*/
|
6
19
|
durableName?: OrderDurableName.OrderCompletedDurablename;
|
20
|
+
/**
|
21
|
+
* The stream to which the event belongs, specifying that it is an "Order" stream.
|
22
|
+
* Events of different types may be grouped into different streams based on their common characteristics.
|
23
|
+
*/
|
7
24
|
stream: OrderStream.Order;
|
25
|
+
/**
|
26
|
+
* The data payload of the "Order Completed" event.
|
27
|
+
* The data payload contains specific details related to the order completion, such as order ID, version, status, user ID, and trip ID.
|
28
|
+
*/
|
8
29
|
data: {
|
30
|
+
/**
|
31
|
+
* The unique identifier of the order associated with the completion event.
|
32
|
+
*/
|
9
33
|
id: string;
|
34
|
+
/**
|
35
|
+
* The version number of the order at the time of the completion event.
|
36
|
+
*/
|
10
37
|
version: number;
|
38
|
+
/**
|
39
|
+
* The status of the order after the completion event (e.g., "completed").
|
40
|
+
*/
|
11
41
|
status: string;
|
42
|
+
/**
|
43
|
+
* The unique identifier of the user who initiated the order completion.
|
44
|
+
*/
|
12
45
|
userid: string;
|
46
|
+
/**
|
47
|
+
* The unique identifier of the trip associated with the completed order.
|
48
|
+
*/
|
13
49
|
tripid: string;
|
14
50
|
};
|
15
51
|
}
|
@@ -1,15 +1,51 @@
|
|
1
1
|
import { OrderDurableName } from '../../enums/durable-names/order-dname';
|
2
2
|
import { OrderStream } from '../../enums/streams/order-stream';
|
3
3
|
import { OrderSubjects } from '../../enums/subjects/order-subjects';
|
4
|
+
/**
|
5
|
+
* Interface representing the "Order Requested" event.
|
6
|
+
*
|
7
|
+
* The "OrderRequestedEvent" interface defines the structure of an event related to the request for an order.
|
8
|
+
* Events of this type are used to communicate order request details across the application.
|
9
|
+
*/
|
4
10
|
export interface OrderRequestedEvent {
|
11
|
+
/**
|
12
|
+
* The subject of the event, specifying that it represents an "Order Requested" event.
|
13
|
+
*/
|
5
14
|
subject: OrderSubjects.OrderRequested;
|
15
|
+
/**
|
16
|
+
* The durable name associated with the consumer handling the "Order Requested" event.
|
17
|
+
* This property is optional and may be used to identify the consumer processing the event in a durable manner.
|
18
|
+
*/
|
6
19
|
durableName?: OrderDurableName.OrderRequestDurablename;
|
20
|
+
/**
|
21
|
+
* The stream to which the event belongs, specifying that it is an "Order" stream.
|
22
|
+
* Events of different types may be grouped into different streams based on their common characteristics.
|
23
|
+
*/
|
7
24
|
stream: OrderStream.Order;
|
25
|
+
/**
|
26
|
+
* The data payload of the "Order Requested" event.
|
27
|
+
* The data payload contains specific details related to the order request, such as order ID, version, status, user ID, and trip ID.
|
28
|
+
*/
|
8
29
|
data: {
|
30
|
+
/**
|
31
|
+
* The unique identifier of the order associated with the request event.
|
32
|
+
*/
|
9
33
|
id: string;
|
34
|
+
/**
|
35
|
+
* The version number of the order at the time of the request event.
|
36
|
+
*/
|
10
37
|
version: number;
|
38
|
+
/**
|
39
|
+
* The status of the order after the request event (e.g., "requested").
|
40
|
+
*/
|
11
41
|
status: string;
|
42
|
+
/**
|
43
|
+
* The unique identifier of the user who initiated the order request.
|
44
|
+
*/
|
12
45
|
userid: string;
|
46
|
+
/**
|
47
|
+
* The unique identifier of the trip associated with the requested order.
|
48
|
+
*/
|
13
49
|
tripid: string;
|
14
50
|
};
|
15
51
|
}
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from "./order-stream-interface";
|
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";
|
2
|
+
// Import and re-export the contents of the "order-stream-interface.ts" file.
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
4
|
+
if (k2 === undefined) k2 = k;
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
8
|
+
}
|
9
|
+
Object.defineProperty(o, k2, desc);
|
10
|
+
}) : (function(o, m, k, k2) {
|
11
|
+
if (k2 === undefined) k2 = k;
|
12
|
+
o[k2] = m[k];
|
13
|
+
}));
|
14
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
15
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
16
|
+
};
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
18
|
+
__exportStar(require("./order-stream-interface"), exports);
|
@@ -1,6 +1,23 @@
|
|
1
1
|
import { OrderStream } from '../../enums/streams/order-stream';
|
2
2
|
import { MainSubjects } from '../../enums/subjects/main-subjects';
|
3
|
+
/**
|
4
|
+
* Interface representing an event associated with the "Order" stream.
|
5
|
+
*
|
6
|
+
* The "OrderStreamEvent" interface defines the structure of an event related to the "Order" stream.
|
7
|
+
* Events of this type are used to communicate specific details related to the "Order" stream.
|
8
|
+
*/
|
3
9
|
export interface OrderStreamEvent {
|
10
|
+
/**
|
11
|
+
* The subject of the event, specifying that it is associated with the "Order" stream.
|
12
|
+
*
|
13
|
+
* In this case, the subject is derived from the "MainSubjects.ORDER" enum value, indicating that this event is related to orders.
|
14
|
+
*/
|
4
15
|
subject: MainSubjects.ORDER;
|
16
|
+
/**
|
17
|
+
* The stream to which the event belongs, specifying that it is an "Order" stream.
|
18
|
+
*
|
19
|
+
* Events of different types may be grouped into different streams based on their common characteristics.
|
20
|
+
* In this case, the stream is of type "OrderStream.Order", indicating that it is an event related to the "Order" stream.
|
21
|
+
*/
|
5
22
|
stream: OrderStream.Order;
|
6
23
|
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
/**
|
2
|
+
* Re-exports all the contents from the "base" module.
|
3
|
+
*
|
4
|
+
* The "base" module contains base classes and utilities that provide foundational functionality for various parts of the application.
|
5
|
+
* This includes base classes for consumers, publishers, streams, etc., that can be extended to implement specific functionality.
|
6
|
+
*/
|
7
|
+
export * from "./base";
|
8
|
+
/**
|
9
|
+
* Re-exports all the contents from the "common" module.
|
10
|
+
*
|
11
|
+
* The "common" module contains shared utilities, helper functions, enums, and interfaces that are commonly used across the application.
|
12
|
+
* These shared resources provide a common set of functionalities to be used by different components or modules within the application.
|
13
|
+
*/
|
14
|
+
export * from "./common";
|
@@ -0,0 +1,31 @@
|
|
1
|
+
"use strict";
|
2
|
+
// Import and re-export multiple modules related to "base" and "common" functionalities.
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
4
|
+
if (k2 === undefined) k2 = k;
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
8
|
+
}
|
9
|
+
Object.defineProperty(o, k2, desc);
|
10
|
+
}) : (function(o, m, k, k2) {
|
11
|
+
if (k2 === undefined) k2 = k;
|
12
|
+
o[k2] = m[k];
|
13
|
+
}));
|
14
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
15
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
16
|
+
};
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
18
|
+
/**
|
19
|
+
* Re-exports all the contents from the "base" module.
|
20
|
+
*
|
21
|
+
* The "base" module contains base classes and utilities that provide foundational functionality for various parts of the application.
|
22
|
+
* This includes base classes for consumers, publishers, streams, etc., that can be extended to implement specific functionality.
|
23
|
+
*/
|
24
|
+
__exportStar(require("./base"), exports);
|
25
|
+
/**
|
26
|
+
* Re-exports all the contents from the "common" module.
|
27
|
+
*
|
28
|
+
* The "common" module contains shared utilities, helper functions, enums, and interfaces that are commonly used across the application.
|
29
|
+
* These shared resources provide a common set of functionalities to be used by different components or modules within the application.
|
30
|
+
*/
|
31
|
+
__exportStar(require("./common"), exports);
|
package/build/index.d.ts
CHANGED
@@ -1,4 +1,166 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
/**
|
2
|
+
* Re-exports all the contents from the "redis-connection-wrapper" module.
|
3
|
+
*
|
4
|
+
* The "redis-connection-wrapper" module contains a class that wraps the Redis client connection and provides easy access to the Redis client instance.
|
5
|
+
* It also includes error handling and connection management features.
|
6
|
+
*/
|
7
|
+
export * from "./connections-wrappers/redis-connection-wrapper";
|
8
|
+
/**
|
9
|
+
* Re-exports all the contents from the "socket-connection-wrapper" module.
|
10
|
+
*
|
11
|
+
* The "socket-connection-wrapper" module contains a class that wraps the Socket.IO server connection and provides easy access to the Socket.IO server instance.
|
12
|
+
* It includes error handling and connection management features for Socket.IO server connections.
|
13
|
+
*/
|
14
|
+
export * from "./connections-wrappers/socket-connection-wrapper";
|
15
|
+
/**
|
16
|
+
* Re-exports all the contents from the "nats-wrapper" module.
|
17
|
+
*
|
18
|
+
* The "nats-wrapper" module contains a class that wraps the NATS (NATS Streaming Server) client connection and provides easy access to the NATS client instance.
|
19
|
+
* It includes error handling and connection management features for NATS client connections.
|
20
|
+
*/
|
21
|
+
export * from "./connections-wrappers/nats-wrapper";
|
22
|
+
/**
|
23
|
+
* Re-exports the "BadRequestError" class from the "bad-request-error" file.
|
24
|
+
*
|
25
|
+
* The "BadRequestError" class represents a specific "Bad Request" error and is used to handle client requests with invalid or malformed data.
|
26
|
+
*/
|
27
|
+
export * from "./errors/bad-request-error";
|
28
|
+
/**
|
29
|
+
* Re-exports the "CustomError" abstract class from the "custom-error" file.
|
30
|
+
*
|
31
|
+
* The "CustomError" abstract class serves as the foundation for creating specific error classes for different types of errors.
|
32
|
+
*/
|
33
|
+
export * from "./errors/custom-error";
|
34
|
+
/**
|
35
|
+
* Re-exports the "DatabaseError" class from the "database-error" file.
|
36
|
+
*
|
37
|
+
* The "DatabaseError" class represents a specific error related to database operations or connectivity issues.
|
38
|
+
*/
|
39
|
+
export * from "./errors/database-error";
|
40
|
+
/**
|
41
|
+
* Re-exports the "NotFoundError" class from the "not-found-error" file.
|
42
|
+
*
|
43
|
+
* The "NotFoundError" class represents a specific "Not Found" error and is used when a requested resource is not found.
|
44
|
+
*/
|
45
|
+
export * from "./errors/not-found-error";
|
46
|
+
/**
|
47
|
+
* Re-exports the "SystemError" class from the "system-error" file.
|
48
|
+
*
|
49
|
+
* The "SystemError" class represents a specific "System Error" that can occur due to unexpected issues in the system.
|
50
|
+
*/
|
51
|
+
export * from "./errors/system-error";
|
52
|
+
/**
|
53
|
+
* Re-exports the "currentUser" middleware from the "current-user" module.
|
54
|
+
*
|
55
|
+
* The "currentUser" middleware is used to extract and verify the current user's information from the request headers.
|
56
|
+
* It checks for a valid bearer token in the "Authorization" header, verifies the JWT token, and attaches the user payload to the request object for further processing in subsequent middleware or route handlers.
|
57
|
+
*/
|
58
|
+
export * from "./middlewares/current-user";
|
59
|
+
/**
|
60
|
+
* Re-exports the "errorHandler" middleware from the "error-handler" module.
|
61
|
+
*
|
62
|
+
* The "errorHandler" middleware is a custom error-handling middleware used to handle and respond to errors that occur during request processing.
|
63
|
+
* It intercepts any uncaught errors in the application, such as custom errors or other exceptions, and sends appropriate error responses to the client.
|
64
|
+
* If the error is a custom error (e.g., BadRequestError, NotFoundError, DatabaseError, etc.), the middleware serializes the error and sends it with the corresponding status code and error messages.
|
65
|
+
* If the error is not a custom error, a generic error response is sent with a 500 status code and a default error message.
|
66
|
+
*/
|
67
|
+
export * from "./middlewares/error-handler";
|
68
|
+
/**
|
69
|
+
*? Re-exports all the enums from the "enums" module.
|
70
|
+
*
|
71
|
+
* The "enums" module contains various enumerations used in the application.
|
72
|
+
* Enumerations are used to define named constant values, such as status codes, subject names, or stream names.
|
73
|
+
*/
|
74
|
+
export * from "./utils/enums";
|
75
|
+
/**
|
76
|
+
*? Re-exports all the functions related to reading directories from the "read-dir" module.
|
77
|
+
*
|
78
|
+
* The "read-dir" module contains utility functions to read and access files and directories in the application.
|
79
|
+
* These functions are used for dynamic loading, configuration, and other file-related operations.
|
80
|
+
*/
|
81
|
+
export * from "./utils/read-dir";
|
82
|
+
/**
|
83
|
+
*? Re-exports all the contents from the "base-producers" module.
|
84
|
+
*
|
85
|
+
* The "base-producers" module contains base classes and utilities for implementing job producers in the application.
|
86
|
+
* Job producers are responsible for generating and queuing jobs to be processed by job workers.
|
87
|
+
*/
|
88
|
+
export * from "./utils/base_classes/jobs/base-producers";
|
89
|
+
/**
|
90
|
+
*? Re-exports all the contents from the "base-worker" module.
|
91
|
+
*
|
92
|
+
* The "base-worker" module contains base classes and utilities for implementing job workers in the application.
|
93
|
+
* Job workers are responsible for processing jobs generated by job producers and executing the required tasks.
|
94
|
+
*/
|
95
|
+
export * from "./utils/base_classes/jobs/base-worker";
|
96
|
+
/**
|
97
|
+
*? Re-exports all the contents from the "base-namespace" module.
|
98
|
+
*
|
99
|
+
* The "base-namespace" module contains base classes and utilities for implementing custom namespaces in the application.
|
100
|
+
* Custom namespaces provide separate channels for communication between connected clients and the server, allowing for organized event handling within separate contexts.
|
101
|
+
*/
|
102
|
+
export * from "./utils/base_classes/listeners/base-namespace";
|
103
|
+
/**
|
104
|
+
*? Re-exports the "BaseConsumer" class from the "base-consumer" file.
|
105
|
+
*
|
106
|
+
* The "BaseConsumer" class serves as a base class for implementing event consumers.
|
107
|
+
* It provides common functionality and methods that can be extended by specific consumer implementations.
|
108
|
+
*/
|
109
|
+
export * from "./events/base/base-consumer";
|
110
|
+
/**
|
111
|
+
* Re-exports the "BasePublisher" class from the "base-publisher" file.
|
112
|
+
*
|
113
|
+
* The "BasePublisher" class serves as a base class for implementing event publishers.
|
114
|
+
* It provides common functionality and methods that can be extended by specific publisher implementations.
|
115
|
+
*/
|
116
|
+
export * from "./events/base/base-publisher";
|
117
|
+
/**
|
118
|
+
* Re-exports the "BaseStream" class from the "base-stream" file.
|
119
|
+
*
|
120
|
+
* The "BaseStream" class serves as a base class for implementing event streams.
|
121
|
+
* It provides common functionality and methods that can be extended by specific stream implementations.
|
122
|
+
*/
|
123
|
+
export * from "./events/base/base-stream";
|
124
|
+
/**
|
125
|
+
* Re-exports the "OrderCancelledEvent" class from the "order-cancelled-event" file.
|
126
|
+
*
|
127
|
+
* The "OrderCancelledEvent" class represents an event related to the cancellation of an order.
|
128
|
+
*/
|
129
|
+
export * from "./events/common/interfaces/order-events-interfaces/order-cancelled-event";
|
130
|
+
/**
|
131
|
+
* Re-exports the "OrderCompletedEvent" class from the "order-completed-event" file.
|
132
|
+
*
|
133
|
+
* The "OrderCompletedEvent" class represents an event related to the completion of an order.
|
134
|
+
*/
|
135
|
+
export * from "./events/common/interfaces/order-events-interfaces/order-completed-event";
|
136
|
+
/**
|
137
|
+
* Re-exports the "OrderRequestedEvent" class from the "order-requested-event" file.
|
138
|
+
*
|
139
|
+
* The "OrderRequestedEvent" class represents an event related to a request for an order.
|
140
|
+
*/
|
141
|
+
export * from "./events/common/interfaces/order-events-interfaces/order-requested-event";
|
142
|
+
/**
|
143
|
+
* Re-exports all the interfaces related to streams from the "stream-interfaces" file.
|
144
|
+
*
|
145
|
+
* The "stream-interfaces" file contains interfaces for various streams used in the application.
|
146
|
+
* For example, "OrderStreamEvent" represents an event associated with the "Order" stream.
|
147
|
+
*/
|
148
|
+
export * from "./events/common/interfaces/stream-interfaces/order-stream-interface";
|
149
|
+
/**
|
150
|
+
* Re-exports all the types related to durable names from the "durable-names" file.
|
151
|
+
*
|
152
|
+
* The types include enums and utility types used to define durable names for consumers of different event types.
|
153
|
+
*/
|
154
|
+
export * from "./events/common/enums/durable-names";
|
155
|
+
/**
|
156
|
+
* Re-exports the type related to streams from the "streams" file.
|
157
|
+
*
|
158
|
+
* The "Streams" type alias represents a JetStream stream that can handle different event types.
|
159
|
+
*/
|
160
|
+
export * from "./events/common/enums/streams";
|
161
|
+
/**
|
162
|
+
* Re-exports the type related to subjects from the "subjects" file.
|
163
|
+
*
|
164
|
+
* The "Subjects" type alias represents the subjects for different event types.
|
165
|
+
*/
|
166
|
+
export * from "./events/common/enums/subjects";
|
package/build/index.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
"use strict";
|
2
|
+
//* Import and re-export multiple modules related to connection wrappers.
|
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,7 +15,177 @@ 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 });
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
/**
|
19
|
+
* Re-exports all the contents from the "redis-connection-wrapper" module.
|
20
|
+
*
|
21
|
+
* The "redis-connection-wrapper" module contains a class that wraps the Redis client connection and provides easy access to the Redis client instance.
|
22
|
+
* It also includes error handling and connection management features.
|
23
|
+
*/
|
24
|
+
__exportStar(require("./connections-wrappers/redis-connection-wrapper"), exports);
|
25
|
+
/**
|
26
|
+
* Re-exports all the contents from the "socket-connection-wrapper" module.
|
27
|
+
*
|
28
|
+
* The "socket-connection-wrapper" module contains a class that wraps the Socket.IO server connection and provides easy access to the Socket.IO server instance.
|
29
|
+
* It includes error handling and connection management features for Socket.IO server connections.
|
30
|
+
*/
|
31
|
+
__exportStar(require("./connections-wrappers/socket-connection-wrapper"), exports);
|
32
|
+
/**
|
33
|
+
* Re-exports all the contents from the "nats-wrapper" module.
|
34
|
+
*
|
35
|
+
* The "nats-wrapper" module contains a class that wraps the NATS (NATS Streaming Server) client connection and provides easy access to the NATS client instance.
|
36
|
+
* It includes error handling and connection management features for NATS client connections.
|
37
|
+
*/
|
38
|
+
__exportStar(require("./connections-wrappers/nats-wrapper"), exports);
|
39
|
+
//* Import and re-export custom error classes for easier access.
|
40
|
+
/**
|
41
|
+
* Re-exports the "BadRequestError" class from the "bad-request-error" file.
|
42
|
+
*
|
43
|
+
* The "BadRequestError" class represents a specific "Bad Request" error and is used to handle client requests with invalid or malformed data.
|
44
|
+
*/
|
45
|
+
__exportStar(require("./errors/bad-request-error"), exports);
|
46
|
+
/**
|
47
|
+
* Re-exports the "CustomError" abstract class from the "custom-error" file.
|
48
|
+
*
|
49
|
+
* The "CustomError" abstract class serves as the foundation for creating specific error classes for different types of errors.
|
50
|
+
*/
|
51
|
+
__exportStar(require("./errors/custom-error"), exports);
|
52
|
+
/**
|
53
|
+
* Re-exports the "DatabaseError" class from the "database-error" file.
|
54
|
+
*
|
55
|
+
* The "DatabaseError" class represents a specific error related to database operations or connectivity issues.
|
56
|
+
*/
|
57
|
+
__exportStar(require("./errors/database-error"), exports);
|
58
|
+
/**
|
59
|
+
* Re-exports the "NotFoundError" class from the "not-found-error" file.
|
60
|
+
*
|
61
|
+
* The "NotFoundError" class represents a specific "Not Found" error and is used when a requested resource is not found.
|
62
|
+
*/
|
63
|
+
__exportStar(require("./errors/not-found-error"), exports);
|
64
|
+
/**
|
65
|
+
* Re-exports the "SystemError" class from the "system-error" file.
|
66
|
+
*
|
67
|
+
* The "SystemError" class represents a specific "System Error" that can occur due to unexpected issues in the system.
|
68
|
+
*/
|
69
|
+
__exportStar(require("./errors/system-error"), exports);
|
70
|
+
//* Import and re-export multiple middleware modules.
|
71
|
+
/**
|
72
|
+
* Re-exports the "currentUser" middleware from the "current-user" module.
|
73
|
+
*
|
74
|
+
* The "currentUser" middleware is used to extract and verify the current user's information from the request headers.
|
75
|
+
* It checks for a valid bearer token in the "Authorization" header, verifies the JWT token, and attaches the user payload to the request object for further processing in subsequent middleware or route handlers.
|
76
|
+
*/
|
77
|
+
__exportStar(require("./middlewares/current-user"), exports);
|
78
|
+
/**
|
79
|
+
* Re-exports the "errorHandler" middleware from the "error-handler" module.
|
80
|
+
*
|
81
|
+
* The "errorHandler" middleware is a custom error-handling middleware used to handle and respond to errors that occur during request processing.
|
82
|
+
* It intercepts any uncaught errors in the application, such as custom errors or other exceptions, and sends appropriate error responses to the client.
|
83
|
+
* If the error is a custom error (e.g., BadRequestError, NotFoundError, DatabaseError, etc.), the middleware serializes the error and sends it with the corresponding status code and error messages.
|
84
|
+
* If the error is not a custom error, a generic error response is sent with a 500 status code and a default error message.
|
85
|
+
*/
|
86
|
+
__exportStar(require("./middlewares/error-handler"), exports);
|
87
|
+
//* Import and re-export multiple modules for enums, base classes, and read-dir functionality.
|
88
|
+
/**
|
89
|
+
*? Re-exports all the enums from the "enums" module.
|
90
|
+
*
|
91
|
+
* The "enums" module contains various enumerations used in the application.
|
92
|
+
* Enumerations are used to define named constant values, such as status codes, subject names, or stream names.
|
93
|
+
*/
|
94
|
+
__exportStar(require("./utils/enums"), exports);
|
95
|
+
/**
|
96
|
+
*? Re-exports all the functions related to reading directories from the "read-dir" module.
|
97
|
+
*
|
98
|
+
* The "read-dir" module contains utility functions to read and access files and directories in the application.
|
99
|
+
* These functions are used for dynamic loading, configuration, and other file-related operations.
|
100
|
+
*/
|
101
|
+
__exportStar(require("./utils/read-dir"), exports);
|
102
|
+
/**
|
103
|
+
*? Re-exports all the contents from the "base-producers" module.
|
104
|
+
*
|
105
|
+
* The "base-producers" module contains base classes and utilities for implementing job producers in the application.
|
106
|
+
* Job producers are responsible for generating and queuing jobs to be processed by job workers.
|
107
|
+
*/
|
108
|
+
__exportStar(require("./utils/base_classes/jobs/base-producers"), exports);
|
109
|
+
/**
|
110
|
+
*? Re-exports all the contents from the "base-worker" module.
|
111
|
+
*
|
112
|
+
* The "base-worker" module contains base classes and utilities for implementing job workers in the application.
|
113
|
+
* Job workers are responsible for processing jobs generated by job producers and executing the required tasks.
|
114
|
+
*/
|
115
|
+
__exportStar(require("./utils/base_classes/jobs/base-worker"), exports);
|
116
|
+
/**
|
117
|
+
*? Re-exports all the contents from the "base-namespace" module.
|
118
|
+
*
|
119
|
+
* The "base-namespace" module contains base classes and utilities for implementing custom namespaces in the application.
|
120
|
+
* Custom namespaces provide separate channels for communication between connected clients and the server, allowing for organized event handling within separate contexts.
|
121
|
+
*/
|
122
|
+
__exportStar(require("./utils/base_classes/listeners/base-namespace"), exports);
|
123
|
+
//* Import and re-export base classes for consumers, publishers, and streams.
|
124
|
+
/**
|
125
|
+
*? Re-exports the "BaseConsumer" class from the "base-consumer" file.
|
126
|
+
*
|
127
|
+
* The "BaseConsumer" class serves as a base class for implementing event consumers.
|
128
|
+
* It provides common functionality and methods that can be extended by specific consumer implementations.
|
129
|
+
*/
|
130
|
+
__exportStar(require("./events/base/base-consumer"), exports);
|
131
|
+
/**
|
132
|
+
* Re-exports the "BasePublisher" class from the "base-publisher" file.
|
133
|
+
*
|
134
|
+
* The "BasePublisher" class serves as a base class for implementing event publishers.
|
135
|
+
* It provides common functionality and methods that can be extended by specific publisher implementations.
|
136
|
+
*/
|
137
|
+
__exportStar(require("./events/base/base-publisher"), exports);
|
138
|
+
/**
|
139
|
+
* Re-exports the "BaseStream" class from the "base-stream" file.
|
140
|
+
*
|
141
|
+
* The "BaseStream" class serves as a base class for implementing event streams.
|
142
|
+
* It provides common functionality and methods that can be extended by specific stream implementations.
|
143
|
+
*/
|
144
|
+
__exportStar(require("./events/base/base-stream"), exports);
|
145
|
+
//* Import and re-export multiple interfaces related to different events and streams.
|
146
|
+
/**
|
147
|
+
* Re-exports the "OrderCancelledEvent" class from the "order-cancelled-event" file.
|
148
|
+
*
|
149
|
+
* The "OrderCancelledEvent" class represents an event related to the cancellation of an order.
|
150
|
+
*/
|
151
|
+
__exportStar(require("./events/common/interfaces/order-events-interfaces/order-cancelled-event"), exports);
|
152
|
+
/**
|
153
|
+
* Re-exports the "OrderCompletedEvent" class from the "order-completed-event" file.
|
154
|
+
*
|
155
|
+
* The "OrderCompletedEvent" class represents an event related to the completion of an order.
|
156
|
+
*/
|
157
|
+
__exportStar(require("./events/common/interfaces/order-events-interfaces/order-completed-event"), exports);
|
158
|
+
/**
|
159
|
+
* Re-exports the "OrderRequestedEvent" class from the "order-requested-event" file.
|
160
|
+
*
|
161
|
+
* The "OrderRequestedEvent" class represents an event related to a request for an order.
|
162
|
+
*/
|
163
|
+
__exportStar(require("./events/common/interfaces/order-events-interfaces/order-requested-event"), exports);
|
164
|
+
//! Interfaces related to payment events are currently commented out using '//'.
|
165
|
+
// export * from "./payment-event-interfaces";
|
166
|
+
/**
|
167
|
+
* Re-exports all the interfaces related to streams from the "stream-interfaces" file.
|
168
|
+
*
|
169
|
+
* The "stream-interfaces" file contains interfaces for various streams used in the application.
|
170
|
+
* For example, "OrderStreamEvent" represents an event associated with the "Order" stream.
|
171
|
+
*/
|
172
|
+
__exportStar(require("./events/common/interfaces/stream-interfaces/order-stream-interface"), exports);
|
173
|
+
//* Import and re-export types from other files in events enums for easier access.
|
174
|
+
/**
|
175
|
+
* Re-exports all the types related to durable names from the "durable-names" file.
|
176
|
+
*
|
177
|
+
* The types include enums and utility types used to define durable names for consumers of different event types.
|
178
|
+
*/
|
179
|
+
__exportStar(require("./events/common/enums/durable-names"), exports);
|
180
|
+
/**
|
181
|
+
* Re-exports the type related to streams from the "streams" file.
|
182
|
+
*
|
183
|
+
* The "Streams" type alias represents a JetStream stream that can handle different event types.
|
184
|
+
*/
|
185
|
+
__exportStar(require("./events/common/enums/streams"), exports);
|
186
|
+
/**
|
187
|
+
* Re-exports the type related to subjects from the "subjects" file.
|
188
|
+
*
|
189
|
+
* The "Subjects" type alias represents the subjects for different event types.
|
190
|
+
*/
|
191
|
+
__exportStar(require("./events/common/enums/subjects"), exports);
|
@@ -1,3 +1,21 @@
|
|
1
|
+
/**
|
2
|
+
* Re-exports all the contents from the "base-producers" module.
|
3
|
+
*
|
4
|
+
* The "base-producers" module contains base classes and utilities for implementing job producers in the application.
|
5
|
+
* Job producers are responsible for generating and queuing jobs to be processed by job workers.
|
6
|
+
*/
|
1
7
|
export * from "./jobs/base-producers";
|
8
|
+
/**
|
9
|
+
* Re-exports all the contents from the "base-worker" module.
|
10
|
+
*
|
11
|
+
* The "base-worker" module contains base classes and utilities for implementing job workers in the application.
|
12
|
+
* Job workers are responsible for processing jobs generated by job producers and executing the required tasks.
|
13
|
+
*/
|
2
14
|
export * from "./jobs/base-worker";
|
15
|
+
/**
|
16
|
+
* Re-exports all the contents from the "base-namespace" module.
|
17
|
+
*
|
18
|
+
* The "base-namespace" module contains base classes and utilities for implementing custom namespaces in the application.
|
19
|
+
* Custom namespaces provide separate channels for communication between connected clients and the server, allowing for organized event handling within separate contexts.
|
20
|
+
*/
|
3
21
|
export * from "./listeners/base-namespace";
|