@palmetto/pubsub 2.1.0 → 2.1.2
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/dist/bullmq/config.d.ts
CHANGED
|
@@ -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;
|
package/dist/bullmq/config.js
CHANGED
|
@@ -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
|
+
}
|
package/dist/message-logger.js
CHANGED
|
@@ -14,13 +14,20 @@ function logMessage({ note, message, logger, level = "debug", extra, }) {
|
|
|
14
14
|
if (level === "off") {
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
|
-
const logFn = level === "info" ? logger.log.bind(logger) : (_a = logger.debug) === null || _a === void 0 ? void 0 : _a.bind(logger);
|
|
18
|
-
if (!logFn) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
17
|
const msg = {
|
|
22
18
|
message: note,
|
|
23
19
|
extra: Object.assign(Object.assign({}, extra), { message }),
|
|
24
20
|
};
|
|
25
|
-
|
|
21
|
+
if (level === "info") {
|
|
22
|
+
logger.log(msg);
|
|
23
|
+
}
|
|
24
|
+
else if (level === "error") {
|
|
25
|
+
logger.error(msg);
|
|
26
|
+
}
|
|
27
|
+
else if (level === "warn") {
|
|
28
|
+
logger.warn(msg);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
(_a = logger.debug) === null || _a === void 0 ? void 0 : _a.call(logger, msg);
|
|
32
|
+
}
|
|
26
33
|
}
|
|
@@ -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;
|
package/dist/rabbitmq/config.js
CHANGED
|
@@ -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
|
*
|
package/dist/subscriber.js
CHANGED
|
@@ -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,
|
|
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;
|