message-brokers 1.0.11 → 1.0.12

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.
@@ -1,16 +1,48 @@
1
1
  declare module "message-brokers" {
2
+ interface MongoDbCredentials {
3
+ /**
4
+ * The connection string for MongoDB, including protocol, host, and port.
5
+ */
6
+ mongoDbUrl: string;
7
+
8
+ /**
9
+ * The name of the MongoDB database to connect to.
10
+ */
11
+ mongoDbName?: string;
12
+ }
13
+
2
14
  interface PublishResponse {
3
15
  success: boolean;
4
16
  message: string;
5
17
  data: any;
6
18
  }
7
19
 
20
+ interface MessageBrokersConfig {
21
+ /**
22
+ * The RabbitMQ connection URL.
23
+ */
24
+ rabbitmqUrl?: string;
25
+
26
+ /**
27
+ * The name of the RabbitMQ exchange.
28
+ */
29
+ exchangeName?: string;
30
+
31
+ /**
32
+ * MongoDB credentials for database connection.
33
+ */
34
+ mongoDbCredentials?: MongoDbCredentials;
35
+ }
36
+
8
37
  class MessageBrokers {
9
38
  /**
10
39
  * Initializes the MessageBrokers instance.
11
- * Throws an error if required configurations are missing.
40
+ * Throws an error if required configurations (like RabbitMQ URL) are missing.
41
+ *
42
+ * @param mongoDbCredentials - MongoDB credentials for connecting to the database.
43
+ * @param config - Optional configurations for the message broker (e.g., RabbitMQ URL, exchange name).
12
44
  */
13
- constructor();
45
+ constructor(mongoDbCredentials: MongoDbCredentials, config?: MessageBrokersConfig);
14
46
 
15
47
  /**
16
48
  * Publishes a HAR object into the exchange.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "message-brokers",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "This package contains functions to publish the messages into the message brokers like rabbitmq.",
5
5
  "main": "lib/message-brokers.js",
6
6
  "types": "lib/types/message-brokers.d.ts",