@palmetto/pubsub 2.1.0 → 2.1.1

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,5 +1,10 @@
1
1
  import { MessageContext, PubSubConfiguration } from "../interfaces.js";
2
+ import { BULLMQ_TRANSPORT } from "./connection.js";
2
3
  export interface BullMqQueueConfiguration extends PubSubConfiguration {
4
+ /**
5
+ * Transport is always BULLMQ_TRANSPORT
6
+ */
7
+ transport: typeof BULLMQ_TRANSPORT;
3
8
  /**
4
9
  * The name of the queue
5
10
  */
@@ -19,3 +24,4 @@ export interface BullMqMessageContext extends MessageContext {
19
24
  */
20
25
  reply?: unknown;
21
26
  }
27
+ export declare function isBullMqQueueConfiguration(config: PubSubConfiguration): config is BullMqQueueConfiguration;
@@ -1,2 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isBullMqQueueConfiguration = isBullMqQueueConfiguration;
4
+ const connection_js_1 = require("./connection.js");
5
+ function isBullMqQueueConfiguration(config) {
6
+ return config.transport === connection_js_1.BULLMQ_TRANSPORT;
7
+ }
@@ -1,5 +1,6 @@
1
1
  import { AmqpConnectionManagerOptions } from "amqp-connection-manager";
2
2
  import { MessageContext, PubSubConfiguration } from "../interfaces.js";
3
+ import { RABBITMQ_TRANSPORT } from "./connection.js";
3
4
  export interface RabbitMqConnectionConfig {
4
5
  /**
5
6
  * The URL to the RabbitMQ host
@@ -21,6 +22,10 @@ export interface RabbitMqConnectionConfig {
21
22
  export type QueueType = "default" | "dead-letter" | "retry";
22
23
  export type ExchangeType = "direct" | "topic" | "fanout";
23
24
  export interface RabbitQueueExchangeConfiguration extends PubSubConfiguration {
25
+ /**
26
+ * Transport is always RABBITMQ_TRANSPORT
27
+ */
28
+ transport: typeof RABBITMQ_TRANSPORT;
24
29
  /**
25
30
  * The queue name prefix
26
31
  */
@@ -56,6 +61,7 @@ export interface RabbitQueueExchangeConfiguration extends PubSubConfiguration {
56
61
  */
57
62
  publishToSpecificQueue?: string;
58
63
  }
64
+ export declare function isRabbitQueueExchangeConfiguration(config: PubSubConfiguration): config is RabbitQueueExchangeConfiguration;
59
65
  export interface RabbitQueueExchangeNames {
60
66
  queueName?: string;
61
67
  exchangeName?: string;
@@ -1,12 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.QueueNameExtensions = exports.ExchangeNameExtensions = void 0;
4
+ exports.isRabbitQueueExchangeConfiguration = isRabbitQueueExchangeConfiguration;
4
5
  exports.getQueueName = getQueueName;
5
6
  exports.getExchangeName = getExchangeName;
6
7
  exports.getQueueType = getQueueType;
7
8
  exports.getRoutingKey = getRoutingKey;
8
9
  exports.getExchangeType = getExchangeType;
9
10
  const errors_js_1 = require("../errors.js");
11
+ const connection_js_1 = require("./connection.js");
12
+ function isRabbitQueueExchangeConfiguration(config) {
13
+ return config.transport === connection_js_1.RABBITMQ_TRANSPORT;
14
+ }
10
15
  /**
11
16
  * Returns the queue name based on the configuration
12
17
  *
@@ -94,7 +94,8 @@ class Subscriber {
94
94
  message: r.data,
95
95
  level: config.messageLogLevel,
96
96
  logger: this.logger,
97
- extra: Object.assign({ transport: provider.transport, name: config.name, durationMs, result: result.toString() }, provider.enrichHandledMesssageLog(config)),
97
+ extra: Object.assign({ transport: provider.transport, name: config.name, durationMs,
98
+ result }, provider.enrichHandledMesssageLog(config)),
98
99
  });
99
100
  this.events.emit("messageHandled", eventContext);
100
101
  return result;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@palmetto/pubsub",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "main": "./dist/main.js",
5
5
  "scripts": {
6
6
  "lint": "yarn run -T eslint --fix ./src",