@hastehaul/common 1.0.13 → 1.0.15
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.
- package/build/connections-wrappers/nats-wrapper.d.ts +19 -0
- package/build/connections-wrappers/nats-wrapper.js +19 -0
- 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 +57 -0
- package/build/events/base/base-consumer.js +33 -0
- package/build/events/base/base-publisher.d.ts +19 -0
- package/build/events/base/base-publisher.js +13 -0
- package/build/events/base/base-stream.d.ts +21 -0
- package/build/events/base/base-stream.js +12 -0
- package/build/events/base/index.d.ts +21 -0
- package/build/events/base/index.js +38 -0
- package/build/events/common/enums/durable-names/index.d.ts +5 -0
- package/build/events/common/enums/durable-names/order-dname.d.ts +12 -0
- package/build/events/common/enums/durable-names/order-dname.js +12 -0
- package/build/events/common/enums/durable-names/payment-dname.d.ts +9 -0
- package/build/events/common/enums/durable-names/payment-dname.js +9 -0
- package/build/events/common/enums/index.d.ts +15 -0
- package/build/events/common/enums/index.js +16 -0
- package/build/events/common/enums/streams/index.d.ts +5 -0
- package/build/events/common/enums/streams/order-stream.d.ts +6 -0
- package/build/events/common/enums/streams/order-stream.js +6 -0
- package/build/events/common/enums/streams/payment-stream.d.ts +6 -0
- package/build/events/common/enums/streams/payment-stream.js +6 -0
- package/build/events/common/enums/subjects/index.d.ts +5 -0
- package/build/events/common/enums/subjects/main-subjects.d.ts +29 -0
- package/build/events/common/enums/subjects/main-subjects.js +11 -0
- package/build/events/common/enums/subjects/order-subjects.d.ts +12 -0
- package/build/events/common/enums/subjects/order-subjects.js +12 -0
- package/build/events/common/enums/subjects/payment-subjects.d.ts +9 -0
- package/build/events/common/enums/subjects/payment-subjects.js +9 -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 +1 -0
- package/build/index.js +1 -0
- package/build/utils/base_classes/index.d.ts +18 -0
- package/build/utils/base_classes/index.js +19 -0
- 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
@@ -11,11 +11,24 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
12
|
exports.NatsPublisher = void 0;
|
13
13
|
const nats_1 = require("nats");
|
14
|
+
/**
|
15
|
+
* Abstract class representing a NATS publisher for publishing events to NATS.
|
16
|
+
*
|
17
|
+
* @typeparam {T} - The type of event to be published, extending the Event interface.
|
18
|
+
*/
|
14
19
|
class NatsPublisher {
|
15
20
|
constructor() {
|
16
21
|
this.jc = (0, nats_1.JSONCodec)();
|
17
22
|
this.sc = (0, nats_1.StringCodec)();
|
18
23
|
}
|
24
|
+
/**
|
25
|
+
* Publishes an event to NATS using the provided NATS connection.
|
26
|
+
*
|
27
|
+
* @param {NatsConnection} nc - The NATS connection instance.
|
28
|
+
* @param {T["data"]} data - The data to be published as part of the event.
|
29
|
+
* @returns {Promise<PubAck>} - A Promise that resolves with the PubAck response from NATS.
|
30
|
+
* @throws {Error} - Throws an error if there is an issue while publishing the event.
|
31
|
+
*/
|
19
32
|
publish(nc, data) {
|
20
33
|
return __awaiter(this, void 0, void 0, function* () {
|
21
34
|
try {
|
@@ -1,13 +1,34 @@
|
|
1
1
|
import { NatsConnection } from "nats";
|
2
2
|
import { Streams } from "../common/enums";
|
3
3
|
import { MainSubjects } from "../common/enums/subjects/main-subjects";
|
4
|
+
/**
|
5
|
+
* Interface representing an event to be used with NATS streams.
|
6
|
+
*/
|
4
7
|
interface Event {
|
5
8
|
subject: MainSubjects;
|
6
9
|
stream: Streams;
|
7
10
|
}
|
11
|
+
/**
|
12
|
+
* Abstract class representing a NATS stream for handling events in a JetStream stream.
|
13
|
+
*
|
14
|
+
* @typeparam {T} - The type of event to be handled, extending the Event interface.
|
15
|
+
*/
|
8
16
|
export declare abstract class NatsStream<T extends Event> {
|
17
|
+
/**
|
18
|
+
* The subject representing the event type to be handled.
|
19
|
+
*/
|
9
20
|
abstract subject: T["subject"];
|
21
|
+
/**
|
22
|
+
* The name of the JetStream stream to handle events from.
|
23
|
+
*/
|
10
24
|
abstract stream: T['stream'];
|
25
|
+
/**
|
26
|
+
* Initializes the NATS stream and adds it to the JetStream server using the provided NATS connection.
|
27
|
+
*
|
28
|
+
* @param {NatsConnection} client - The NATS connection instance.
|
29
|
+
* @returns {Promise<void>} - A Promise that resolves once the stream is successfully added to the JetStream server.
|
30
|
+
* @throws {Error} - Throws an error if there is an issue while adding the stream to the JetStream server.
|
31
|
+
*/
|
11
32
|
init(client: NatsConnection): Promise<void>;
|
12
33
|
}
|
13
34
|
export {};
|
@@ -10,7 +10,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
10
10
|
};
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
12
|
exports.NatsStream = void 0;
|
13
|
+
/**
|
14
|
+
* Abstract class representing a NATS stream for handling events in a JetStream stream.
|
15
|
+
*
|
16
|
+
* @typeparam {T} - The type of event to be handled, extending the Event interface.
|
17
|
+
*/
|
13
18
|
class NatsStream {
|
19
|
+
/**
|
20
|
+
* Initializes the NATS stream and adds it to the JetStream server using the provided NATS connection.
|
21
|
+
*
|
22
|
+
* @param {NatsConnection} client - The NATS connection instance.
|
23
|
+
* @returns {Promise<void>} - A Promise that resolves once the stream is successfully added to the JetStream server.
|
24
|
+
* @throws {Error} - Throws an error if there is an issue while adding the stream to the JetStream server.
|
25
|
+
*/
|
14
26
|
init(client) {
|
15
27
|
return __awaiter(this, void 0, void 0, function* () {
|
16
28
|
try {
|
@@ -0,0 +1,21 @@
|
|
1
|
+
/**
|
2
|
+
* Re-exports the "BaseConsumer" class from the "base-consumer" file.
|
3
|
+
*
|
4
|
+
* The "BaseConsumer" class serves as a base class for implementing event consumers.
|
5
|
+
* It provides common functionality and methods that can be extended by specific consumer implementations.
|
6
|
+
*/
|
7
|
+
export * from "./base-consumer";
|
8
|
+
/**
|
9
|
+
* Re-exports the "BasePublisher" class from the "base-publisher" file.
|
10
|
+
*
|
11
|
+
* The "BasePublisher" class serves as a base class for implementing event publishers.
|
12
|
+
* It provides common functionality and methods that can be extended by specific publisher implementations.
|
13
|
+
*/
|
14
|
+
export * from "./base-publisher";
|
15
|
+
/**
|
16
|
+
* Re-exports the "BaseStream" class from the "base-stream" file.
|
17
|
+
*
|
18
|
+
* The "BaseStream" class serves as a base class for implementing event streams.
|
19
|
+
* It provides common functionality and methods that can be extended by specific stream implementations.
|
20
|
+
*/
|
21
|
+
export * from "./base-stream";
|
@@ -0,0 +1,38 @@
|
|
1
|
+
"use strict";
|
2
|
+
// Import and re-export base classes for consumers, publishers, and streams.
|
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 the "BaseConsumer" class from the "base-consumer" file.
|
20
|
+
*
|
21
|
+
* The "BaseConsumer" class serves as a base class for implementing event consumers.
|
22
|
+
* It provides common functionality and methods that can be extended by specific consumer implementations.
|
23
|
+
*/
|
24
|
+
__exportStar(require("./base-consumer"), exports);
|
25
|
+
/**
|
26
|
+
* Re-exports the "BasePublisher" class from the "base-publisher" file.
|
27
|
+
*
|
28
|
+
* The "BasePublisher" class serves as a base class for implementing event publishers.
|
29
|
+
* It provides common functionality and methods that can be extended by specific publisher implementations.
|
30
|
+
*/
|
31
|
+
__exportStar(require("./base-publisher"), exports);
|
32
|
+
/**
|
33
|
+
* Re-exports the "BaseStream" class from the "base-stream" file.
|
34
|
+
*
|
35
|
+
* The "BaseStream" class serves as a base class for implementing event streams.
|
36
|
+
* It provides common functionality and methods that can be extended by specific stream implementations.
|
37
|
+
*/
|
38
|
+
__exportStar(require("./base-stream"), exports);
|
@@ -1,3 +1,8 @@
|
|
1
1
|
import { PaymentDurableName } from "./payment-dname";
|
2
2
|
import { OrderDurableName } from "./order-dname";
|
3
|
+
/**
|
4
|
+
* Type alias representing a durable name that can be associated with different event consumers.
|
5
|
+
*
|
6
|
+
* The `DurableName` type can be one of the durable names defined in `OrderDurableName` or `PaymentDurableName`.
|
7
|
+
*/
|
3
8
|
export type DurableName = OrderDurableName | PaymentDurableName;
|
@@ -1,5 +1,17 @@
|
|
1
|
+
/**
|
2
|
+
* Enum representing durable names for consumers associated with different order events.
|
3
|
+
*/
|
1
4
|
export declare enum OrderDurableName {
|
5
|
+
/**
|
6
|
+
* The durable name for the consumer handling order cancelled events.
|
7
|
+
*/
|
2
8
|
OrderCancelledDurablename = "order-cancelled-consumer",
|
9
|
+
/**
|
10
|
+
* The durable name for the consumer handling order requested events.
|
11
|
+
*/
|
3
12
|
OrderRequestDurablename = "order-requested-consumer",
|
13
|
+
/**
|
14
|
+
* The durable name for the consumer handling order completed events.
|
15
|
+
*/
|
4
16
|
OrderCompletedDurablename = "order-completed-consumer"
|
5
17
|
}
|
@@ -1,9 +1,21 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.OrderDurableName = void 0;
|
4
|
+
/**
|
5
|
+
* Enum representing durable names for consumers associated with different order events.
|
6
|
+
*/
|
4
7
|
var OrderDurableName;
|
5
8
|
(function (OrderDurableName) {
|
9
|
+
/**
|
10
|
+
* The durable name for the consumer handling order cancelled events.
|
11
|
+
*/
|
6
12
|
OrderDurableName["OrderCancelledDurablename"] = "order-cancelled-consumer";
|
13
|
+
/**
|
14
|
+
* The durable name for the consumer handling order requested events.
|
15
|
+
*/
|
7
16
|
OrderDurableName["OrderRequestDurablename"] = "order-requested-consumer";
|
17
|
+
/**
|
18
|
+
* The durable name for the consumer handling order completed events.
|
19
|
+
*/
|
8
20
|
OrderDurableName["OrderCompletedDurablename"] = "order-completed-consumer";
|
9
21
|
})(OrderDurableName || (exports.OrderDurableName = OrderDurableName = {}));
|
@@ -1,4 +1,13 @@
|
|
1
|
+
/**
|
2
|
+
* Enum representing durable names for consumers associated with different payment events.
|
3
|
+
*/
|
1
4
|
export declare enum PaymentDurableName {
|
5
|
+
/**
|
6
|
+
* The durable name for the consumer handling payment failed events.
|
7
|
+
*/
|
2
8
|
PaymentFailedDurableName = "payment-failed-consumer",
|
9
|
+
/**
|
10
|
+
* The durable name for the consumer handling payment created events.
|
11
|
+
*/
|
3
12
|
PaymentCreatedDurableName = "payment-created-consumer"
|
4
13
|
}
|
@@ -1,8 +1,17 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.PaymentDurableName = void 0;
|
4
|
+
/**
|
5
|
+
* Enum representing durable names for consumers associated with different payment events.
|
6
|
+
*/
|
4
7
|
var PaymentDurableName;
|
5
8
|
(function (PaymentDurableName) {
|
9
|
+
/**
|
10
|
+
* The durable name for the consumer handling payment failed events.
|
11
|
+
*/
|
6
12
|
PaymentDurableName["PaymentFailedDurableName"] = "payment-failed-consumer";
|
13
|
+
/**
|
14
|
+
* The durable name for the consumer handling payment created events.
|
15
|
+
*/
|
7
16
|
PaymentDurableName["PaymentCreatedDurableName"] = "payment-created-consumer";
|
8
17
|
})(PaymentDurableName || (exports.PaymentDurableName = PaymentDurableName = {}));
|
@@ -1,3 +1,18 @@
|
|
1
|
+
/**
|
2
|
+
* Re-exports all the types related to durable names from the "durable-names" file.
|
3
|
+
*
|
4
|
+
* The types include enums and utility types used to define durable names for consumers of different event types.
|
5
|
+
*/
|
1
6
|
export * from "./durable-names";
|
7
|
+
/**
|
8
|
+
* Re-exports the type related to streams from the "streams" file.
|
9
|
+
*
|
10
|
+
* The "Streams" type alias represents a JetStream stream that can handle different event types.
|
11
|
+
*/
|
2
12
|
export * from "./streams";
|
13
|
+
/**
|
14
|
+
* Re-exports the type related to subjects from the "subjects" file.
|
15
|
+
*
|
16
|
+
* The "Subjects" type alias represents the subjects for different event types.
|
17
|
+
*/
|
3
18
|
export * from "./subjects";
|
@@ -1,4 +1,5 @@
|
|
1
1
|
"use strict";
|
2
|
+
// Import and re-export types from other files for easier access.
|
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,21 @@ 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 types related to durable names from the "durable-names" file.
|
20
|
+
*
|
21
|
+
* The types include enums and utility types used to define durable names for consumers of different event types.
|
22
|
+
*/
|
17
23
|
__exportStar(require("./durable-names"), exports);
|
24
|
+
/**
|
25
|
+
* Re-exports the type related to streams from the "streams" file.
|
26
|
+
*
|
27
|
+
* The "Streams" type alias represents a JetStream stream that can handle different event types.
|
28
|
+
*/
|
18
29
|
__exportStar(require("./streams"), exports);
|
30
|
+
/**
|
31
|
+
* Re-exports the type related to subjects from the "subjects" file.
|
32
|
+
*
|
33
|
+
* The "Subjects" type alias represents the subjects for different event types.
|
34
|
+
*/
|
19
35
|
__exportStar(require("./subjects"), exports);
|
@@ -1,3 +1,8 @@
|
|
1
1
|
import { PaymentStream } from './payment-stream';
|
2
2
|
import { OrderStream } from './order-stream';
|
3
|
+
/**
|
4
|
+
* Type alias representing a JetStream stream that can handle different event types.
|
5
|
+
*
|
6
|
+
* The `Streams` type can be one of the streams defined in `OrderStream` or `PaymentStream`.
|
7
|
+
*/
|
3
8
|
export type Streams = OrderStream | PaymentStream;
|
@@ -1,7 +1,13 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.OrderStream = void 0;
|
4
|
+
/**
|
5
|
+
* Enum representing the name of the JetStream stream used for handling order events.
|
6
|
+
*/
|
4
7
|
var OrderStream;
|
5
8
|
(function (OrderStream) {
|
9
|
+
/**
|
10
|
+
* The name of the JetStream stream for order events.
|
11
|
+
*/
|
6
12
|
OrderStream["Order"] = "ORDER";
|
7
13
|
})(OrderStream || (exports.OrderStream = OrderStream = {}));
|
@@ -1,7 +1,13 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.PaymentStream = void 0;
|
4
|
+
/**
|
5
|
+
* Enum representing the name of the JetStream stream used for handling payment events.
|
6
|
+
*/
|
4
7
|
var PaymentStream;
|
5
8
|
(function (PaymentStream) {
|
9
|
+
/**
|
10
|
+
* The name of the JetStream stream for payment events.
|
11
|
+
*/
|
6
12
|
PaymentStream["Payment"] = "PAYMENT";
|
7
13
|
})(PaymentStream || (exports.PaymentStream = PaymentStream = {}));
|
@@ -1,3 +1,8 @@
|
|
1
1
|
import { PaymentSubjects } from './payment-subjects';
|
2
2
|
import { OrderSubjects } from './order-subjects';
|
3
|
+
/**
|
4
|
+
* Type alias representing the subjects for different event types.
|
5
|
+
*
|
6
|
+
* The `Subjects` type can be one of the subjects defined in `OrderSubjects` or `PaymentSubjects`.
|
7
|
+
*/
|
3
8
|
export type Subjects = OrderSubjects | PaymentSubjects;
|
@@ -1,10 +1,39 @@
|
|
1
|
+
/**
|
2
|
+
* Enum representing the main subjects used for NATS subjects.
|
3
|
+
*/
|
1
4
|
export declare enum MainSubjects {
|
2
5
|
ORDER = "order.*",
|
3
6
|
PAYMENT = "payment.*",
|
4
7
|
ETA = "eta.*"
|
5
8
|
}
|
9
|
+
/**
|
10
|
+
* Type utility to concatenate two strings into a valid subject format.
|
11
|
+
*
|
12
|
+
* This utility is used to combine a prefix and a postfix with a period (".") in between to form a valid subject format.
|
13
|
+
* The resulting subject format must adhere to the pattern `${T}.${U}`.
|
14
|
+
*/
|
6
15
|
type SubjectFormat<T extends string, U extends string> = `${T}.${U}`;
|
16
|
+
/**
|
17
|
+
* Type utility to extract the string before the first colon (".") in a subject format.
|
18
|
+
*
|
19
|
+
* This utility extracts the substring before the first colon in a subject format of the pattern `${T}.*`.
|
20
|
+
*/
|
7
21
|
type ExtractStringBeforeColon<T extends string> = T extends `${infer StringBeforeColon}.*` ? StringBeforeColon : never;
|
22
|
+
/**
|
23
|
+
* Type utility to validate and enforce subject formats based on main subject patterns.
|
24
|
+
*
|
25
|
+
* The utility ensures that the given subject format adheres to the pattern `${T}.${U}`.
|
26
|
+
* The `T` part of the subject format is validated against the prefix of the main subjects defined in the `MainSubjects` enum.
|
27
|
+
* The `U` part of the subject format can be any string.
|
28
|
+
*/
|
8
29
|
export type ValidateSubjectFormat<T extends string, U extends string> = U extends MainSubjects ? T extends SubjectFormat<ExtractStringBeforeColon<MainSubjects>, string> ? T : never : never;
|
30
|
+
/**
|
31
|
+
* Utility function to spread enum values into an array of strings.
|
32
|
+
*
|
33
|
+
* This utility function takes an object representing an enum and returns an array containing all the string values of the enum.
|
34
|
+
*
|
35
|
+
* @param {T} enumObject - The object representing the enum.
|
36
|
+
* @returns {string[]} - An array containing all the string values of the enum.
|
37
|
+
*/
|
9
38
|
export declare const spreadEnumValues: <T extends Record<string, string>>(enumObject: T) => string[];
|
10
39
|
export {};
|
@@ -1,11 +1,22 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.spreadEnumValues = exports.MainSubjects = void 0;
|
4
|
+
/**
|
5
|
+
* Enum representing the main subjects used for NATS subjects.
|
6
|
+
*/
|
4
7
|
var MainSubjects;
|
5
8
|
(function (MainSubjects) {
|
6
9
|
MainSubjects["ORDER"] = "order.*";
|
7
10
|
MainSubjects["PAYMENT"] = "payment.*";
|
8
11
|
MainSubjects["ETA"] = "eta.*";
|
9
12
|
})(MainSubjects || (exports.MainSubjects = MainSubjects = {}));
|
13
|
+
/**
|
14
|
+
* Utility function to spread enum values into an array of strings.
|
15
|
+
*
|
16
|
+
* This utility function takes an object representing an enum and returns an array containing all the string values of the enum.
|
17
|
+
*
|
18
|
+
* @param {T} enumObject - The object representing the enum.
|
19
|
+
* @returns {string[]} - An array containing all the string values of the enum.
|
20
|
+
*/
|
10
21
|
const spreadEnumValues = (enumObject) => Object.values(enumObject);
|
11
22
|
exports.spreadEnumValues = spreadEnumValues;
|
@@ -1,5 +1,17 @@
|
|
1
|
+
/**
|
2
|
+
* Enum representing the subjects for different order events.
|
3
|
+
*/
|
1
4
|
export declare enum OrderSubjects {
|
5
|
+
/**
|
6
|
+
* The subject for order cancelled events.
|
7
|
+
*/
|
2
8
|
OrderCancelled = "order.cancelled",
|
9
|
+
/**
|
10
|
+
* The subject for order requested events.
|
11
|
+
*/
|
3
12
|
OrderRequested = "order.requested",
|
13
|
+
/**
|
14
|
+
* The subject for order completed events.
|
15
|
+
*/
|
4
16
|
OrderCompleted = "order.completed"
|
5
17
|
}
|
@@ -1,9 +1,21 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.OrderSubjects = void 0;
|
4
|
+
/**
|
5
|
+
* Enum representing the subjects for different order events.
|
6
|
+
*/
|
4
7
|
var OrderSubjects;
|
5
8
|
(function (OrderSubjects) {
|
9
|
+
/**
|
10
|
+
* The subject for order cancelled events.
|
11
|
+
*/
|
6
12
|
OrderSubjects["OrderCancelled"] = "order.cancelled";
|
13
|
+
/**
|
14
|
+
* The subject for order requested events.
|
15
|
+
*/
|
7
16
|
OrderSubjects["OrderRequested"] = "order.requested";
|
17
|
+
/**
|
18
|
+
* The subject for order completed events.
|
19
|
+
*/
|
8
20
|
OrderSubjects["OrderCompleted"] = "order.completed";
|
9
21
|
})(OrderSubjects || (exports.OrderSubjects = OrderSubjects = {}));
|
@@ -1,4 +1,13 @@
|
|
1
|
+
/**
|
2
|
+
* Enum representing the subjects for different payment events.
|
3
|
+
*/
|
1
4
|
export declare enum PaymentSubjects {
|
5
|
+
/**
|
6
|
+
* The subject for payment created events.
|
7
|
+
*/
|
2
8
|
PaymentCreated = "payment.created",
|
9
|
+
/**
|
10
|
+
* The subject for payment failed events.
|
11
|
+
*/
|
3
12
|
PaymentFailed = "payment.failed"
|
4
13
|
}
|
@@ -1,8 +1,17 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.PaymentSubjects = void 0;
|
4
|
+
/**
|
5
|
+
* Enum representing the subjects for different payment events.
|
6
|
+
*/
|
4
7
|
var PaymentSubjects;
|
5
8
|
(function (PaymentSubjects) {
|
9
|
+
/**
|
10
|
+
* The subject for payment created events.
|
11
|
+
*/
|
6
12
|
PaymentSubjects["PaymentCreated"] = "payment.created";
|
13
|
+
/**
|
14
|
+
* The subject for payment failed events.
|
15
|
+
*/
|
7
16
|
PaymentSubjects["PaymentFailed"] = "payment.failed";
|
8
17
|
})(PaymentSubjects || (exports.PaymentSubjects = PaymentSubjects = {}));
|
@@ -0,0 +1,14 @@
|
|
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
|
+
*/
|
7
|
+
export * from "./enums";
|
8
|
+
/**
|
9
|
+
* Re-exports all the interfaces from the "interfaces" module.
|
10
|
+
*
|
11
|
+
* The "interfaces" module contains various interfaces used in the application to define data structures and contracts.
|
12
|
+
* Interfaces are used to describe the shape of objects and provide a common structure for communication between different parts of the application.
|
13
|
+
*/
|
14
|
+
export * from "./interfaces";
|
@@ -0,0 +1,31 @@
|
|
1
|
+
"use strict";
|
2
|
+
// Import and re-export multiple modules related to enums and interfaces.
|
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 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
|
+
*/
|
24
|
+
__exportStar(require("./enums"), exports);
|
25
|
+
/**
|
26
|
+
* Re-exports all the interfaces from the "interfaces" module.
|
27
|
+
*
|
28
|
+
* The "interfaces" module contains various interfaces used in the application to define data structures and contracts.
|
29
|
+
* Interfaces are used to describe the shape of objects and provide a common structure for communication between different parts of the application.
|
30
|
+
*/
|
31
|
+
__exportStar(require("./interfaces"), exports);
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/**
|
2
|
+
* Re-exports all the interfaces related to order events from the "order-events-interfaces" file.
|
3
|
+
*
|
4
|
+
* The "order-events-interfaces" file contains interfaces for various order-related events such as order requested, order cancelled, and order completed.
|
5
|
+
*/
|
6
|
+
export * from "./order-events-interfaces";
|
7
|
+
/**
|
8
|
+
* Re-exports all the interfaces related to streams from the "stream-interfaces" file.
|
9
|
+
*
|
10
|
+
* The "stream-interfaces" file contains interfaces for various streams used in the application.
|
11
|
+
* For example, "OrderStreamEvent" represents an event associated with the "Order" stream.
|
12
|
+
*/
|
13
|
+
export * from "./stream-interfaces";
|
@@ -0,0 +1,33 @@
|
|
1
|
+
"use strict";
|
2
|
+
// Import and re-export multiple interfaces related to different events and streams.
|
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 interfaces related to order events from the "order-events-interfaces" file.
|
20
|
+
*
|
21
|
+
* The "order-events-interfaces" file contains interfaces for various order-related events such as order requested, order cancelled, and order completed.
|
22
|
+
*/
|
23
|
+
__exportStar(require("./order-events-interfaces"), exports);
|
24
|
+
// Interfaces related to payment events are currently commented out using '//'.
|
25
|
+
// If needed, uncomment the following line to re-export the payment event interfaces.
|
26
|
+
// export * from "./payment-event-interfaces";
|
27
|
+
/**
|
28
|
+
* Re-exports all the interfaces related to streams from the "stream-interfaces" file.
|
29
|
+
*
|
30
|
+
* The "stream-interfaces" file contains interfaces for various streams used in the application.
|
31
|
+
* For example, "OrderStreamEvent" represents an event associated with the "Order" stream.
|
32
|
+
*/
|
33
|
+
__exportStar(require("./stream-interfaces"), exports);
|
@@ -0,0 +1,18 @@
|
|
1
|
+
/**
|
2
|
+
* Re-exports the "OrderCancelledEvent" class from the "order-cancelled-event" file.
|
3
|
+
*
|
4
|
+
* The "OrderCancelledEvent" class represents an event related to the cancellation of an order.
|
5
|
+
*/
|
6
|
+
export * from "./order-cancelled-event";
|
7
|
+
/**
|
8
|
+
* Re-exports the "OrderCompletedEvent" class from the "order-completed-event" file.
|
9
|
+
*
|
10
|
+
* The "OrderCompletedEvent" class represents an event related to the completion of an order.
|
11
|
+
*/
|
12
|
+
export * from "./order-completed-event";
|
13
|
+
/**
|
14
|
+
* Re-exports the "OrderRequestedEvent" class from the "order-requested-event" file.
|
15
|
+
*
|
16
|
+
* The "OrderRequestedEvent" class represents an event related to a request for an order.
|
17
|
+
*/
|
18
|
+
export * from "./order-requested-event";
|
@@ -0,0 +1,35 @@
|
|
1
|
+
"use strict";
|
2
|
+
// Import and re-export event classes for easier access.
|
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 the "OrderCancelledEvent" class from the "order-cancelled-event" file.
|
20
|
+
*
|
21
|
+
* The "OrderCancelledEvent" class represents an event related to the cancellation of an order.
|
22
|
+
*/
|
23
|
+
__exportStar(require("./order-cancelled-event"), exports);
|
24
|
+
/**
|
25
|
+
* Re-exports the "OrderCompletedEvent" class from the "order-completed-event" file.
|
26
|
+
*
|
27
|
+
* The "OrderCompletedEvent" class represents an event related to the completion of an order.
|
28
|
+
*/
|
29
|
+
__exportStar(require("./order-completed-event"), exports);
|
30
|
+
/**
|
31
|
+
* Re-exports the "OrderRequestedEvent" class from the "order-requested-event" file.
|
32
|
+
*
|
33
|
+
* The "OrderRequestedEvent" class represents an event related to a request for an order.
|
34
|
+
*/
|
35
|
+
__exportStar(require("./order-requested-event"), exports);
|