@hastehaul/common 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (22) hide show
  1. package/build/events/common/enums/durable-names/customer-dname.d.ts +17 -0
  2. package/build/events/common/enums/durable-names/customer-dname.js +21 -0
  3. package/build/events/common/enums/durable-names/index.d.ts +2 -1
  4. package/build/events/common/enums/streams/customer-stream.d.ts +9 -0
  5. package/build/events/common/enums/streams/customer-stream.js +13 -0
  6. package/build/events/common/enums/streams/index.d.ts +2 -1
  7. package/build/events/common/enums/subjects/customer-subjects.d.ts +17 -0
  8. package/build/events/common/enums/subjects/customer-subjects.js +21 -0
  9. package/build/events/common/enums/subjects/index.d.ts +2 -1
  10. package/build/events/common/enums/subjects/main-subjects.d.ts +2 -1
  11. package/build/events/common/enums/subjects/main-subjects.js +1 -0
  12. package/build/events/common/interfaces/customer-events-interfaces/customer-created-event.d.ts +34 -0
  13. package/build/events/common/interfaces/customer-events-interfaces/customer-created-event.js +2 -0
  14. package/build/events/common/interfaces/customer-events-interfaces/customer-new-event.d.ts +35 -0
  15. package/build/events/common/interfaces/customer-events-interfaces/customer-new-event.js +2 -0
  16. package/build/events/common/interfaces/customer-events-interfaces/customer-unblocked-event.d.ts +35 -0
  17. package/build/events/common/interfaces/customer-events-interfaces/customer-unblocked-event.js +2 -0
  18. package/build/events/common/interfaces/stream-interfaces/customer-stream-interface.d.ts +23 -0
  19. package/build/events/common/interfaces/stream-interfaces/customer-stream-interface.js +2 -0
  20. package/build/index.d.ts +13 -15
  21. package/build/index.js +15 -15
  22. package/package.json +1 -1
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Enum representing durable names for consumers associated with different customer events.
3
+ */
4
+ export declare enum CustomerDurableName {
5
+ /**
6
+ * The durable name for the consumer handling customer unblocked events.
7
+ */
8
+ CustomerUnblockedDurablename = "customer-unblocked-consumer",
9
+ /**
10
+ * The durable name for the consumer handling customer new events.
11
+ */
12
+ CustomerNewDurablename = "customer-new-consumer",
13
+ /**
14
+ * The durable name for the consumer handling customer created events.
15
+ */
16
+ CustomerCreatedDurablename = "customer-created-consumer"
17
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CustomerDurableName = void 0;
4
+ /**
5
+ * Enum representing durable names for consumers associated with different customer events.
6
+ */
7
+ var CustomerDurableName;
8
+ (function (CustomerDurableName) {
9
+ /**
10
+ * The durable name for the consumer handling customer unblocked events.
11
+ */
12
+ CustomerDurableName["CustomerUnblockedDurablename"] = "customer-unblocked-consumer";
13
+ /**
14
+ * The durable name for the consumer handling customer new events.
15
+ */
16
+ CustomerDurableName["CustomerNewDurablename"] = "customer-new-consumer";
17
+ /**
18
+ * The durable name for the consumer handling customer created events.
19
+ */
20
+ CustomerDurableName["CustomerCreatedDurablename"] = "customer-created-consumer";
21
+ })(CustomerDurableName || (exports.CustomerDurableName = CustomerDurableName = {}));
@@ -1,8 +1,9 @@
1
1
  import { PaymentDurableName } from "./payment-dname";
2
2
  import { OrderDurableName } from "./order-dname";
3
+ import { CustomerDurableName } from './customer-dname';
3
4
  /**
4
5
  * Type alias representing a durable name that can be associated with different event consumers.
5
6
  *
6
7
  * The `DurableName` type can be one of the durable names defined in `OrderDurableName` or `PaymentDurableName`.
7
8
  */
8
- export type DurableName = OrderDurableName | PaymentDurableName;
9
+ export type DurableName = OrderDurableName | PaymentDurableName | CustomerDurableName;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Enum representing the name of the JetStream stream used for handling customer events.
3
+ */
4
+ export declare enum CustomerStream {
5
+ /**
6
+ * The name of the JetStream stream for customer events.
7
+ */
8
+ Customer = "CUSTOMER"
9
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CustomerStream = void 0;
4
+ /**
5
+ * Enum representing the name of the JetStream stream used for handling customer events.
6
+ */
7
+ var CustomerStream;
8
+ (function (CustomerStream) {
9
+ /**
10
+ * The name of the JetStream stream for customer events.
11
+ */
12
+ CustomerStream["Customer"] = "CUSTOMER";
13
+ })(CustomerStream || (exports.CustomerStream = CustomerStream = {}));
@@ -1,8 +1,9 @@
1
1
  import { PaymentStream } from './payment-stream';
2
2
  import { OrderStream } from './order-stream';
3
+ import { CustomerStream } from './customer-stream';
3
4
  /**
4
5
  * Type alias representing a JetStream stream that can handle different event types.
5
6
  *
6
7
  * The `Streams` type can be one of the streams defined in `OrderStream` or `PaymentStream`.
7
8
  */
8
- export type Streams = OrderStream | PaymentStream;
9
+ export type Streams = OrderStream | PaymentStream | CustomerStream;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Enum representing the subjects for different customer events.
3
+ */
4
+ export declare enum CustomerSubjects {
5
+ /**
6
+ * The subject for customer new events.
7
+ */
8
+ CustomerNew = "customer.new",
9
+ /**
10
+ * The subject for customer created events.
11
+ */
12
+ CustomerCreated = "customer.created",
13
+ /**
14
+ * The subject for customer unblocked events.
15
+ */
16
+ CustomerUnblocked = "customer.unblocked"
17
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CustomerSubjects = void 0;
4
+ /**
5
+ * Enum representing the subjects for different customer events.
6
+ */
7
+ var CustomerSubjects;
8
+ (function (CustomerSubjects) {
9
+ /**
10
+ * The subject for customer new events.
11
+ */
12
+ CustomerSubjects["CustomerNew"] = "customer.new";
13
+ /**
14
+ * The subject for customer created events.
15
+ */
16
+ CustomerSubjects["CustomerCreated"] = "customer.created";
17
+ /**
18
+ * The subject for customer unblocked events.
19
+ */
20
+ CustomerSubjects["CustomerUnblocked"] = "customer.unblocked";
21
+ })(CustomerSubjects || (exports.CustomerSubjects = CustomerSubjects = {}));
@@ -1,8 +1,9 @@
1
1
  import { PaymentSubjects } from './payment-subjects';
2
2
  import { OrderSubjects } from './order-subjects';
3
+ import { CustomerSubjects } from './customer-subjects';
3
4
  /**
4
5
  * Type alias representing the subjects for different event types.
5
6
  *
6
7
  * The `Subjects` type can be one of the subjects defined in `OrderSubjects` or `PaymentSubjects`.
7
8
  */
8
- export type Subjects = OrderSubjects | PaymentSubjects;
9
+ export type Subjects = OrderSubjects | PaymentSubjects | CustomerSubjects;
@@ -4,7 +4,8 @@
4
4
  export declare enum MainSubjects {
5
5
  ORDER = "order.*",
6
6
  PAYMENT = "payment.*",
7
- ETA = "eta.*"
7
+ ETA = "eta.*",
8
+ CUSTOMER = "customer.*"
8
9
  }
9
10
  /**
10
11
  * Type utility to concatenate two strings into a valid subject format.
@@ -9,6 +9,7 @@ var MainSubjects;
9
9
  MainSubjects["ORDER"] = "order.*";
10
10
  MainSubjects["PAYMENT"] = "payment.*";
11
11
  MainSubjects["ETA"] = "eta.*";
12
+ MainSubjects["CUSTOMER"] = "customer.*";
12
13
  })(MainSubjects || (exports.MainSubjects = MainSubjects = {}));
13
14
  /**
14
15
  * Utility function to spread enum values into an array of strings.
@@ -0,0 +1,34 @@
1
+ import { CustomerDurableName } from '../../enums/durable-names/customer-dname';
2
+ import { CustomerStream } from '../../enums/streams/customer-stream';
3
+ import { CustomerSubjects } from '../../enums/subjects/customer-subjects';
4
+ /**
5
+ * Interface representing the "Customer Created" event.
6
+ *
7
+ * The "CustomerCreatedEvent" interface defines the structure of an event related to the cancellation of an customer.
8
+ * Events of this type are used to communicate customer cancellation details across the application.
9
+ */
10
+ export interface CustomerCreatedEvent {
11
+ /**
12
+ * The subject of the event, specifying that it represents an "Customer Created" event.
13
+ */
14
+ subject: CustomerSubjects.CustomerCreated;
15
+ /**
16
+ * The durable name associated with the consumer handling the "Customer Created" event.
17
+ * This property is optional and may be used to identify the consumer processing the event in a durable manner.
18
+ */
19
+ durableName?: CustomerDurableName.CustomerCreatedDurablename;
20
+ /**
21
+ * The stream to which the event belongs, specifying that it is an "Customer" stream.
22
+ * Events of different types may be grouped into different streams based on their common characteristics.
23
+ */
24
+ stream: CustomerStream.Customer;
25
+ type: string;
26
+ /**
27
+ * The data payload of the "Customer Created" event.
28
+ * The data payload contains specific details related to the customer cancellation, such as customer ID, version, status, user ID, and trip ID.
29
+ */
30
+ data: {
31
+ userId: null | string;
32
+ phoneNumber: string;
33
+ };
34
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,35 @@
1
+ import { CustomerDurableName } from "../../enums/durable-names/customer-dname";
2
+ import { CustomerStream } from "../../enums/streams/customer-stream";
3
+ import { CustomerSubjects } from "../../enums/subjects/customer-subjects";
4
+ /**
5
+ * Interface representing the "Customer New" event.
6
+ *
7
+ * The "CustomerNewEvent" interface defines the structure of an event related to the request for an customer.
8
+ * Events of this type are used to communicate customer request details across the application.
9
+ */
10
+ export interface CustomerNewEvent {
11
+ /**
12
+ * The subject of the event, specifying that it represents an "Customer New" event.
13
+ */
14
+ subject: CustomerSubjects.CustomerNew;
15
+ /**
16
+ * The durable name associated with the consumer handling the "Customer New" event.
17
+ * This property is optional and may be used to identify the consumer processing the event in a durable manner.
18
+ */
19
+ durableName?: CustomerDurableName.CustomerNewDurablename;
20
+ /**
21
+ * The stream to which the event belongs, specifying that it is an "Customer" stream.
22
+ * Events of different types may be grouped into different streams based on their common characteristics.
23
+ */
24
+ stream: CustomerStream.Customer;
25
+ /**
26
+ * The data payload of the "Customer New" event.
27
+ * The data payload contains specific details related to the customer request, such as customer ID, version, status, user ID, and trip ID.
28
+ */
29
+ data: {
30
+ userId: string;
31
+ phoneNumber: string;
32
+ phoneUniqueId: string;
33
+ hashedOtp: string;
34
+ };
35
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,35 @@
1
+ import { CustomerDurableName } from "../../enums/durable-names/customer-dname";
2
+ import { CustomerStream } from "../../enums/streams/customer-stream";
3
+ import { CustomerSubjects } from "../../enums/subjects/customer-subjects";
4
+ /**
5
+ * Interface representing the "Customer Unblocked" event.
6
+ *
7
+ * The "CustomerUnblockedEvent" interface defines the structure of an event related to the completion of an customer.
8
+ * Events of this type are used to communicate customer completion details across the application.
9
+ */
10
+ export interface CustomerUnblockedEvent {
11
+ /**
12
+ * The subject of the event, specifying that it represents an "Customer Unblocked" event.
13
+ */
14
+ subject: CustomerSubjects.CustomerUnblocked;
15
+ /**
16
+ * The durable name associated with the consumer handling the "Customer Unblocked" event.
17
+ * This property is optional and may be used to identify the consumer processing the event in a durable manner.
18
+ */
19
+ durableName?: CustomerDurableName.CustomerUnblockedDurablename;
20
+ /**
21
+ * The stream to which the event belongs, specifying that it is an "Customer" stream.
22
+ * Events of different types may be grouped into different streams based on their common characteristics.
23
+ */
24
+ stream: CustomerStream.Customer;
25
+ /**
26
+ * The data payload of the "Customer Unblocked" event.
27
+ * The data payload contains specific details related to the customer completion, such as customer ID, version, status, user ID, and trip ID.
28
+ */
29
+ data: {
30
+ userId: string;
31
+ phoneNumber: string;
32
+ phoneUniqueId: string;
33
+ hashedOtp: string;
34
+ };
35
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,23 @@
1
+ import { CustomerStream } from "../../enums/streams/customer-stream";
2
+ import { MainSubjects } from "../../enums/subjects/main-subjects";
3
+ /**
4
+ * Interface representing an event associated with the "Customer" stream.
5
+ *
6
+ * The "CustomerStreamEvent" interface defines the structure of an event related to the "Customer" stream.
7
+ * Events of this type are used to communicate specific details related to the "Customer" stream.
8
+ */
9
+ export interface CustomerStreamEvent {
10
+ /**
11
+ * The subject of the event, specifying that it is associated with the "Customer" stream.
12
+ *
13
+ * In this case, the subject is derived from the "MainSubjects.CUSTOMER" enum value, indicating that this event is related to customers.
14
+ */
15
+ subject: MainSubjects.CUSTOMER;
16
+ /**
17
+ * The stream to which the event belongs, specifying that it is an "Customer" 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 "CustomerStream.Customer", indicating that it is an event related to the "Customer" stream.
21
+ */
22
+ stream: CustomerStream.Customer;
23
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/build/index.d.ts CHANGED
@@ -130,24 +130,12 @@ export * from "./events/base/base-publisher";
130
130
  * It provides common functionality and methods that can be extended by specific stream implementations.
131
131
  */
132
132
  export * from "./events/base/base-stream";
133
- /**
134
- * Re-exports the "OrderCancelledEvent" class from the "order-cancelled-event" file.
135
- *
136
- * The "OrderCancelledEvent" class represents an event related to the cancellation of an order.
137
- */
138
133
  export * from "./events/common/interfaces/order-events-interfaces/order-cancelled-event";
139
- /**
140
- * Re-exports the "OrderCompletedEvent" class from the "order-completed-event" file.
141
- *
142
- * The "OrderCompletedEvent" class represents an event related to the completion of an order.
143
- */
144
134
  export * from "./events/common/interfaces/order-events-interfaces/order-completed-event";
145
- /**
146
- * Re-exports the "OrderRequestedEvent" class from the "order-requested-event" file.
147
- *
148
- * The "OrderRequestedEvent" class represents an event related to a request for an order.
149
- */
150
135
  export * from "./events/common/interfaces/order-events-interfaces/order-requested-event";
136
+ export * from "./events/common/interfaces/customer-events-interfaces/customer-created-event";
137
+ export * from "./events/common/interfaces/customer-events-interfaces/customer-unblocked-event";
138
+ export * from "./events/common/interfaces/customer-events-interfaces/customer-new-event";
151
139
  /**
152
140
  * Re-exports all the interfaces related to streams from the "stream-interfaces" file.
153
141
  *
@@ -155,22 +143,32 @@ export * from "./events/common/interfaces/order-events-interfaces/order-requeste
155
143
  * For example, "OrderStreamEvent" represents an event associated with the "Order" stream.
156
144
  */
157
145
  export * from "./events/common/interfaces/stream-interfaces/order-stream-interface";
146
+ export * from "./events/common/interfaces/stream-interfaces/customer-stream-interface";
158
147
  /**
159
148
  * Re-exports all the types related to durable names from the "durable-names" file.
160
149
  *
161
150
  * The types include enums and utility types used to define durable names for consumers of different event types.
162
151
  */
163
152
  export * from "./events/common/enums/durable-names";
153
+ export * from "./events/common/enums/durable-names/customer-dname";
154
+ export * from "./events/common/enums/durable-names/order-dname";
155
+ export * from "./events/common/enums/durable-names/payment-dname";
164
156
  /**
165
157
  * Re-exports the type related to streams from the "streams" file.
166
158
  *
167
159
  * The "Streams" type alias represents a JetStream stream that can handle different event types.
168
160
  */
169
161
  export * from "./events/common/enums/streams";
162
+ export * from "./events/common/enums/streams/order-stream";
163
+ export * from "./events/common/enums/streams/payment-stream";
164
+ export * from "./events/common/enums/streams/customer-stream";
170
165
  /**
171
166
  * Re-exports the type related to subjects from the "subjects" file.
172
167
  *
173
168
  * The "Subjects" type alias represents the subjects for different event types.
174
169
  */
175
170
  export * from "./events/common/enums/subjects";
171
+ export * from "./events/common/enums/subjects/order-subjects";
172
+ export * from "./events/common/enums/subjects/payment-subjects";
176
173
  export * from "./events/common/enums/subjects/main-subjects";
174
+ export * from "./events/common/enums/subjects/customer-subjects";
package/build/index.js CHANGED
@@ -160,24 +160,14 @@ __exportStar(require("./events/base/base-publisher"), exports);
160
160
  */
161
161
  __exportStar(require("./events/base/base-stream"), exports);
162
162
  //* Import and re-export multiple interfaces related to different events and streams.
163
- /**
164
- * Re-exports the "OrderCancelledEvent" class from the "order-cancelled-event" file.
165
- *
166
- * The "OrderCancelledEvent" class represents an event related to the cancellation of an order.
167
- */
163
+ // ORDER EVENTS
168
164
  __exportStar(require("./events/common/interfaces/order-events-interfaces/order-cancelled-event"), exports);
169
- /**
170
- * Re-exports the "OrderCompletedEvent" class from the "order-completed-event" file.
171
- *
172
- * The "OrderCompletedEvent" class represents an event related to the completion of an order.
173
- */
174
165
  __exportStar(require("./events/common/interfaces/order-events-interfaces/order-completed-event"), exports);
175
- /**
176
- * Re-exports the "OrderRequestedEvent" class from the "order-requested-event" file.
177
- *
178
- * The "OrderRequestedEvent" class represents an event related to a request for an order.
179
- */
180
166
  __exportStar(require("./events/common/interfaces/order-events-interfaces/order-requested-event"), exports);
167
+ // CUSTOMER EVENTS
168
+ __exportStar(require("./events/common/interfaces/customer-events-interfaces/customer-created-event"), exports);
169
+ __exportStar(require("./events/common/interfaces/customer-events-interfaces/customer-unblocked-event"), exports);
170
+ __exportStar(require("./events/common/interfaces/customer-events-interfaces/customer-new-event"), exports);
181
171
  //! Interfaces related to payment events are currently commented out using '//'.
182
172
  // export * from "./payment-event-interfaces";
183
173
  /**
@@ -187,6 +177,7 @@ __exportStar(require("./events/common/interfaces/order-events-interfaces/order-r
187
177
  * For example, "OrderStreamEvent" represents an event associated with the "Order" stream.
188
178
  */
189
179
  __exportStar(require("./events/common/interfaces/stream-interfaces/order-stream-interface"), exports);
180
+ __exportStar(require("./events/common/interfaces/stream-interfaces/customer-stream-interface"), exports);
190
181
  //* Import and re-export types from other files in events enums for easier access.
191
182
  /**
192
183
  * Re-exports all the types related to durable names from the "durable-names" file.
@@ -194,16 +185,25 @@ __exportStar(require("./events/common/interfaces/stream-interfaces/order-stream-
194
185
  * The types include enums and utility types used to define durable names for consumers of different event types.
195
186
  */
196
187
  __exportStar(require("./events/common/enums/durable-names"), exports);
188
+ __exportStar(require("./events/common/enums/durable-names/customer-dname"), exports);
189
+ __exportStar(require("./events/common/enums/durable-names/order-dname"), exports);
190
+ __exportStar(require("./events/common/enums/durable-names/payment-dname"), exports);
197
191
  /**
198
192
  * Re-exports the type related to streams from the "streams" file.
199
193
  *
200
194
  * The "Streams" type alias represents a JetStream stream that can handle different event types.
201
195
  */
202
196
  __exportStar(require("./events/common/enums/streams"), exports);
197
+ __exportStar(require("./events/common/enums/streams/order-stream"), exports);
198
+ __exportStar(require("./events/common/enums/streams/payment-stream"), exports);
199
+ __exportStar(require("./events/common/enums/streams/customer-stream"), exports);
203
200
  /**
204
201
  * Re-exports the type related to subjects from the "subjects" file.
205
202
  *
206
203
  * The "Subjects" type alias represents the subjects for different event types.
207
204
  */
208
205
  __exportStar(require("./events/common/enums/subjects"), exports);
206
+ __exportStar(require("./events/common/enums/subjects/order-subjects"), exports);
207
+ __exportStar(require("./events/common/enums/subjects/payment-subjects"), exports);
209
208
  __exportStar(require("./events/common/enums/subjects/main-subjects"), exports);
209
+ __exportStar(require("./events/common/enums/subjects/customer-subjects"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hastehaul/common",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",