arnavmq 0.16.1 → 0.16.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arnavmq",
3
- "version": "0.16.1",
3
+ "version": "0.16.3",
4
4
  "description": "ArnavMQ is a RabbitMQ wrapper",
5
5
  "keywords": [
6
6
  "rabbitmq",
@@ -34,13 +34,13 @@
34
34
  },
35
35
  "homepage": "https://github.com/bringg/node-arnavmq#readme",
36
36
  "dependencies": {
37
+ "@types/amqplib": "^0.10.5",
37
38
  "amqplib": "^0.10.3",
38
39
  "p-defer": "^3.0.0",
39
40
  "serialize-error": "^8.0.1",
40
41
  "uuid": "^9.0.0"
41
42
  },
42
43
  "devDependencies": {
43
- "@types/amqplib": "^0.10.5",
44
44
  "child-process-promise": "^2.2.1",
45
45
  "dot-only-hunter": "^1.0.3",
46
46
  "eslint": "^8.25.0",
package/types/index.d.ts CHANGED
@@ -16,7 +16,8 @@ import arnavmq = require('./modules/arnavmq');
16
16
  declare function arnavmqFactory(config: ConnectionConfig): arnavmq.Arnavmq;
17
17
 
18
18
  declare namespace arnavmqFactory {
19
- export type ArnavmqFactory = (config: ConnectionConfig) => arnavmq.Arnavmq;
19
+ export type Arnavmq = arnavmq.Arnavmq;
20
+ export type ArnavmqFactory = (config: ConnectionConfig) => Arnavmq;
20
21
 
21
22
  export { ConnectionConfig, Connection, Consumer, Producer, ConnectionHooks, ConsumerHooks, ProducerHooks };
22
23
  }
@@ -60,4 +60,8 @@ declare class Consumer {
60
60
  ): Promise<void>;
61
61
  }
62
62
 
63
+ declare namespace Consumer {
64
+ export { ConsumeOptions, ConsumeCallback };
65
+ }
66
+
63
67
  export = Consumer;
@@ -7,7 +7,7 @@ declare class ProducerError extends Error {
7
7
  constructor(error: { name: string; message: string });
8
8
  }
9
9
 
10
- interface PublishOptions extends amqp.Options.Publish {
10
+ interface ProduceOptions extends amqp.Options.Publish {
11
11
  routingKey?: string;
12
12
  rpc?: boolean;
13
13
  }
@@ -45,7 +45,7 @@ declare class Producer {
45
45
  * @param msg The message to publish
46
46
  * @param options The publish options
47
47
  */
48
- publishOrSendToQueue(queue: string, msg: Buffer, options: PublishOptions): Promise<boolean>;
48
+ private publishOrSendToQueue(queue: string, msg: Buffer, options: ProduceOptions): Promise<boolean>;
49
49
  /**
50
50
  * Start a timer to reject the pending RPC call if no answer is received within the given timeout
51
51
  * @param queue The queue where the RPC request was sent
@@ -61,7 +61,7 @@ declare class Producer {
61
61
  * @param options contain rpc property (if true, enable rpc for this message)
62
62
  * @return Resolves when message is correctly sent, or when response is received when rpc is enabled
63
63
  */
64
- private checkRpc(queue: string, msg: Buffer, options: PublishOptions): Promise<boolean>;
64
+ private checkRpc(queue: string, msg: Buffer, options: ProduceOptions): Promise<boolean>;
65
65
  /**
66
66
  * @deprecated Use publish instead
67
67
  * Ensure channel exists and send message using `checkRpc`
@@ -70,18 +70,22 @@ declare class Producer {
70
70
  * @param options message options (persistent, durable, rpc, etc.)
71
71
  * @return checkRpc response
72
72
  */
73
- produce(queue: string, msg: unknown, options: PublishOptions): Promise<unknown>;
73
+ produce(queue: string, msg: unknown, options: ProduceOptions): Promise<unknown>;
74
74
  /** @see Producer.produce */
75
- publish(queue: string, msg: unknown, options: PublishOptions): Promise<unknown>;
75
+ publish(queue: string, msg: unknown, options: ProduceOptions): Promise<unknown>;
76
76
 
77
77
  private _sendToQueue(
78
78
  queue: string,
79
79
  message: unknown,
80
- settings: PublishOptions,
80
+ settings: ProduceOptions,
81
81
  currentRetryNumber: number,
82
82
  ): Promise<unknown>;
83
83
 
84
84
  private _shouldRetry(error: Error | ProducerError, currentRetryNumber: number): boolean;
85
85
  }
86
86
 
87
+ declare namespace Producer {
88
+ export { ProduceOptions, ProducerError };
89
+ }
90
+
87
91
  export = Producer;