@warlock.js/herald 4.1.7 → 4.1.8
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/cjs/index.cjs +10 -10
- package/esm/communicators/broker-registry.d.mts +1 -1
- package/esm/communicators/broker-registry.mjs +1 -1
- package/esm/communicators/broker.d.mts +1 -1
- package/esm/communicators/broker.mjs +1 -1
- package/esm/contracts/broker-driver.contract.d.mts +1 -1
- package/esm/contracts/channel.contract.d.mts +1 -1
- package/esm/decorators/consumable.d.mts +1 -1
- package/esm/decorators/consumable.mjs +1 -1
- package/esm/drivers/rabbitmq/rabbitmq-channel.d.mts +1 -1
- package/esm/drivers/rabbitmq/rabbitmq-channel.mjs +1 -1
- package/esm/drivers/rabbitmq/rabbitmq-driver.d.mts +1 -1
- package/esm/drivers/rabbitmq/rabbitmq-driver.mjs +1 -1
- package/esm/message-managers/event-consumer.d.mts +1 -1
- package/esm/message-managers/event-consumer.mjs +1 -1
- package/esm/message-managers/event-message.d.mts +1 -1
- package/esm/message-managers/event-message.mjs +1 -1
- package/esm/message-managers/prepare-consumer-subscription.mjs +1 -1
- package/esm/message-managers/types.d.mts +1 -1
- package/esm/types/channel.types.d.mts +1 -1
- package/esm/types/connection.types.d.mts +1 -1
- package/esm/types/driver.types.d.mts +1 -1
- package/esm/types/message.types.d.mts +1 -1
- package/esm/types/publish.types.d.mts +1 -1
- package/esm/types/registry.types.d.mts +1 -1
- package/esm/types/subscribe.types.d.mts +1 -1
- package/esm/use-case-broadcast.d.mts +1 -1
- package/esm/use-case-broadcast.mjs +1 -1
- package/esm/utils/connect-to-broker.d.mts +1 -1
- package/esm/utils/connect-to-broker.mjs +1 -1
- package/package.json +3 -3
package/cjs/index.cjs
CHANGED
|
@@ -21,7 +21,7 @@ let _warlock_js_seal = require("@warlock.js/seal");
|
|
|
21
21
|
let node_crypto = require("node:crypto");
|
|
22
22
|
let crypto = require("crypto");
|
|
23
23
|
|
|
24
|
-
//#region
|
|
24
|
+
//#region ../@warlock.js/herald/src/communicators/broker.ts
|
|
25
25
|
/**
|
|
26
26
|
* Broker - wrapper around a driver with metadata
|
|
27
27
|
*
|
|
@@ -123,7 +123,7 @@ var Broker = class {
|
|
|
123
123
|
};
|
|
124
124
|
|
|
125
125
|
//#endregion
|
|
126
|
-
//#region
|
|
126
|
+
//#region ../@warlock.js/herald/src/communicators/broker-registry.ts
|
|
127
127
|
/**
|
|
128
128
|
* Error thrown when a broker is not found
|
|
129
129
|
*/
|
|
@@ -322,7 +322,7 @@ var BrokerRegistry = class {
|
|
|
322
322
|
const brokerRegistry = new BrokerRegistry();
|
|
323
323
|
|
|
324
324
|
//#endregion
|
|
325
|
-
//#region
|
|
325
|
+
//#region ../@warlock.js/herald/src/message-managers/prepare-consumer-subscription.ts
|
|
326
326
|
function prepareConsumerSubscription(Consumer, onError) {
|
|
327
327
|
const callback = async (message, ctx) => {
|
|
328
328
|
const envelope = message.payload;
|
|
@@ -362,7 +362,7 @@ function prepareConsumerSubscription(Consumer, onError) {
|
|
|
362
362
|
}
|
|
363
363
|
|
|
364
364
|
//#endregion
|
|
365
|
-
//#region
|
|
365
|
+
//#region ../@warlock.js/herald/src/drivers/rabbitmq/rabbitmq-channel.ts
|
|
366
366
|
/**
|
|
367
367
|
* RabbitMQ Channel Implementation
|
|
368
368
|
*
|
|
@@ -709,7 +709,7 @@ var RabbitMQSubscription = class {
|
|
|
709
709
|
};
|
|
710
710
|
|
|
711
711
|
//#endregion
|
|
712
|
-
//#region
|
|
712
|
+
//#region ../@warlock.js/herald/src/drivers/rabbitmq/rabbitmq-driver.ts
|
|
713
713
|
var rabbitmq_driver_exports = /* @__PURE__ */ __exportAll({ RabbitMQDriver: () => RabbitMQDriver });
|
|
714
714
|
/**
|
|
715
715
|
* Cached amqplib module (loaded once, reused)
|
|
@@ -995,7 +995,7 @@ var RabbitMQDriver = class {
|
|
|
995
995
|
};
|
|
996
996
|
|
|
997
997
|
//#endregion
|
|
998
|
-
//#region
|
|
998
|
+
//#region ../@warlock.js/herald/src/utils/connect-to-broker.ts
|
|
999
999
|
/**
|
|
1000
1000
|
* Connect to a message broker and register it.
|
|
1001
1001
|
*
|
|
@@ -1158,7 +1158,7 @@ async function subscribeConsumer(Consumer) {
|
|
|
1158
1158
|
}
|
|
1159
1159
|
|
|
1160
1160
|
//#endregion
|
|
1161
|
-
//#region
|
|
1161
|
+
//#region ../@warlock.js/herald/src/decorators/consumable.ts
|
|
1162
1162
|
const pendingSubscribers = /* @__PURE__ */ new Set();
|
|
1163
1163
|
/**
|
|
1164
1164
|
* Register the consumer to the broker
|
|
@@ -1189,7 +1189,7 @@ brokerRegistry.on("connected", (broker) => {
|
|
|
1189
1189
|
});
|
|
1190
1190
|
|
|
1191
1191
|
//#endregion
|
|
1192
|
-
//#region
|
|
1192
|
+
//#region ../@warlock.js/herald/src/message-managers/event-consumer.ts
|
|
1193
1193
|
/**
|
|
1194
1194
|
* This class is used to be part of the Herald Event Consumer Manager.
|
|
1195
1195
|
* It should be used to consume events from Either RabbitMQ or Kafka through Herald
|
|
@@ -1245,7 +1245,7 @@ function defineConsumer(eventName, options) {
|
|
|
1245
1245
|
}
|
|
1246
1246
|
|
|
1247
1247
|
//#endregion
|
|
1248
|
-
//#region
|
|
1248
|
+
//#region ../@warlock.js/herald/src/message-managers/event-message.ts
|
|
1249
1249
|
var EventMessage = class {
|
|
1250
1250
|
/**
|
|
1251
1251
|
* Data that will be sent with the event (Payload)
|
|
@@ -1309,7 +1309,7 @@ function defineEvent(eventName, options = {}) {
|
|
|
1309
1309
|
}
|
|
1310
1310
|
|
|
1311
1311
|
//#endregion
|
|
1312
|
-
//#region
|
|
1312
|
+
//#region ../@warlock.js/herald/src/use-case-broadcast.ts
|
|
1313
1313
|
/**
|
|
1314
1314
|
* Channel adapter that publishes use-case broadcast events onto a herald broker.
|
|
1315
1315
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Broker, BrokerOptions } from "./broker.mjs";
|
|
2
2
|
import { BrokerRegistryEvent, BrokerRegistryListener } from "../types/registry.types.mjs";
|
|
3
|
-
//#region
|
|
3
|
+
//#region ../@warlock.js/herald/src/communicators/broker-registry.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Error thrown when a broker is not found
|
|
6
6
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Broker } from "./broker.mjs";
|
|
2
2
|
import { EventEmitter } from "node:events";
|
|
3
3
|
|
|
4
|
-
//#region
|
|
4
|
+
//#region ../@warlock.js/herald/src/communicators/broker-registry.ts
|
|
5
5
|
/**
|
|
6
6
|
* Error thrown when a broker is not found
|
|
7
7
|
*/
|
|
@@ -4,7 +4,7 @@ import { ChannelContract } from "../contracts/channel.contract.mjs";
|
|
|
4
4
|
import { EventMessage } from "../message-managers/event-message.mjs";
|
|
5
5
|
import { EventConsumerClass } from "../message-managers/types.mjs";
|
|
6
6
|
import { BrokerDriverContract } from "../contracts/broker-driver.contract.mjs";
|
|
7
|
-
//#region
|
|
7
|
+
//#region ../@warlock.js/herald/src/communicators/broker.d.ts
|
|
8
8
|
/**
|
|
9
9
|
* Options for creating a Broker
|
|
10
10
|
*/
|
|
@@ -3,7 +3,7 @@ import { BrokerDriverType, BrokerEvent, BrokerEventListener, HealthCheckResult }
|
|
|
3
3
|
import { ChannelContract } from "./channel.contract.mjs";
|
|
4
4
|
import { EventMessage } from "../message-managers/event-message.mjs";
|
|
5
5
|
import { EventConsumerClass } from "../message-managers/types.mjs";
|
|
6
|
-
//#region
|
|
6
|
+
//#region ../@warlock.js/herald/src/contracts/broker-driver.contract.d.ts
|
|
7
7
|
/**
|
|
8
8
|
* Broker Driver Contract
|
|
9
9
|
*
|
|
@@ -2,7 +2,7 @@ import { SubscribeOptions } from "../types/subscribe.types.mjs";
|
|
|
2
2
|
import { ChannelOptions, ChannelStats } from "../types/channel.types.mjs";
|
|
3
3
|
import { MessageHandler, ResponseHandler, Subscription } from "../types/message.types.mjs";
|
|
4
4
|
import { PublishOptions, RequestOptions } from "../types/publish.types.mjs";
|
|
5
|
-
//#region
|
|
5
|
+
//#region ../@warlock.js/herald/src/contracts/channel.contract.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* Channel contract - represents a queue (RabbitMQ) or topic (Kafka)
|
|
8
8
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { brokerRegistry } from "../communicators/broker-registry.mjs";
|
|
2
2
|
import "../communicators/index.mjs";
|
|
3
3
|
|
|
4
|
-
//#region
|
|
4
|
+
//#region ../@warlock.js/herald/src/decorators/consumable.ts
|
|
5
5
|
const pendingSubscribers = /* @__PURE__ */ new Set();
|
|
6
6
|
/**
|
|
7
7
|
* Register the consumer to the broker
|
|
@@ -3,7 +3,7 @@ import { ChannelOptions, ChannelStats } from "../../types/channel.types.mjs";
|
|
|
3
3
|
import { MessageHandler, ResponseHandler, Subscription } from "../../types/message.types.mjs";
|
|
4
4
|
import { PublishOptions, RequestOptions } from "../../types/publish.types.mjs";
|
|
5
5
|
import { ChannelContract } from "../../contracts/channel.contract.mjs";
|
|
6
|
-
//#region
|
|
6
|
+
//#region ../@warlock.js/herald/src/drivers/rabbitmq/rabbitmq-channel.d.ts
|
|
7
7
|
/**
|
|
8
8
|
* RabbitMQ Channel Implementation
|
|
9
9
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { v } from "@warlock.js/seal";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
|
|
4
|
-
//#region
|
|
4
|
+
//#region ../@warlock.js/herald/src/drivers/rabbitmq/rabbitmq-channel.ts
|
|
5
5
|
/**
|
|
6
6
|
* RabbitMQ Channel Implementation
|
|
7
7
|
*
|
|
@@ -5,7 +5,7 @@ import { ChannelContract } from "../../contracts/channel.contract.mjs";
|
|
|
5
5
|
import { EventMessage } from "../../message-managers/event-message.mjs";
|
|
6
6
|
import { EventConsumerClass } from "../../message-managers/types.mjs";
|
|
7
7
|
import { BrokerDriverContract } from "../../contracts/broker-driver.contract.mjs";
|
|
8
|
-
//#region
|
|
8
|
+
//#region ../@warlock.js/herald/src/drivers/rabbitmq/rabbitmq-driver.d.ts
|
|
9
9
|
/**
|
|
10
10
|
* RabbitMQ Driver
|
|
11
11
|
*
|
|
@@ -2,7 +2,7 @@ import { prepareConsumerSubscription } from "../../message-managers/prepare-cons
|
|
|
2
2
|
import { RabbitMQChannel } from "./rabbitmq-channel.mjs";
|
|
3
3
|
import { EventEmitter } from "node:events";
|
|
4
4
|
|
|
5
|
-
//#region
|
|
5
|
+
//#region ../@warlock.js/herald/src/drivers/rabbitmq/rabbitmq-driver.ts
|
|
6
6
|
/**
|
|
7
7
|
* Cached amqplib module (loaded once, reused)
|
|
8
8
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ConsumedEventMessage, EventConsumerClass } from "./types.mjs";
|
|
2
2
|
import { ObjectValidator, ValidationResult } from "@warlock.js/seal";
|
|
3
3
|
|
|
4
|
-
//#region
|
|
4
|
+
//#region ../@warlock.js/herald/src/message-managers/event-consumer.d.ts
|
|
5
5
|
declare abstract class EventConsumer<Payload = Record<string, any>> {
|
|
6
6
|
/**
|
|
7
7
|
* Event name
|
|
@@ -3,7 +3,7 @@ import "../decorators/index.mjs";
|
|
|
3
3
|
import { v } from "@warlock.js/seal";
|
|
4
4
|
import { randomUUID } from "crypto";
|
|
5
5
|
|
|
6
|
-
//#region
|
|
6
|
+
//#region ../@warlock.js/herald/src/message-managers/event-consumer.ts
|
|
7
7
|
/**
|
|
8
8
|
* This class is used to be part of the Herald Event Consumer Manager.
|
|
9
9
|
* It should be used to consume events from Either RabbitMQ or Kafka through Herald
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ObjectValidator } from "@warlock.js/seal";
|
|
2
2
|
import { GenericObject } from "@mongez/reinforcements";
|
|
3
3
|
|
|
4
|
-
//#region
|
|
4
|
+
//#region ../@warlock.js/herald/src/message-managers/event-message.d.ts
|
|
5
5
|
declare abstract class EventMessage<TPayload = Record<string, any>> {
|
|
6
6
|
protected data?: TPayload | undefined;
|
|
7
7
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { randomUUID } from "crypto";
|
|
2
2
|
|
|
3
|
-
//#region
|
|
3
|
+
//#region ../@warlock.js/herald/src/message-managers/event-message.ts
|
|
4
4
|
var EventMessage = class {
|
|
5
5
|
/**
|
|
6
6
|
* Data that will be sent with the event (Payload)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region
|
|
1
|
+
//#region ../@warlock.js/herald/src/message-managers/prepare-consumer-subscription.ts
|
|
2
2
|
function prepareConsumerSubscription(Consumer, onError) {
|
|
3
3
|
const callback = async (message, ctx) => {
|
|
4
4
|
const envelope = message.payload;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Message } from "../types/message.types.mjs";
|
|
2
2
|
import { EventConsumer } from "./event-consumer.mjs";
|
|
3
|
-
//#region
|
|
3
|
+
//#region ../@warlock.js/herald/src/message-managers/types.d.ts
|
|
4
4
|
type ConsumedEventMessage = {
|
|
5
5
|
version?: number;
|
|
6
6
|
occurredAt?: Date;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DeadLetterOptions } from "./subscribe.types.mjs";
|
|
2
2
|
import { BaseValidator } from "@warlock.js/seal";
|
|
3
3
|
|
|
4
|
-
//#region
|
|
4
|
+
//#region ../@warlock.js/herald/src/types/channel.types.d.ts
|
|
5
5
|
type ChannelOptions<TPayload = unknown> = {
|
|
6
6
|
type?: "queue" | "topic" | "fanout";
|
|
7
7
|
durable?: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region
|
|
1
|
+
//#region ../@warlock.js/herald/src/types/driver.types.d.ts
|
|
2
2
|
type BrokerDriverType = "rabbitmq" | "kafka" | "redis-streams" | "sqs";
|
|
3
3
|
type BrokerEvent = "connected" | "disconnected" | "error" | "reconnecting";
|
|
4
4
|
type BrokerEventListener = (...args: unknown[]) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Broker } from "../communicators/broker.mjs";
|
|
2
2
|
|
|
3
|
-
//#region
|
|
3
|
+
//#region ../@warlock.js/herald/src/types/registry.types.d.ts
|
|
4
4
|
type BrokerRegistryEvent = "registered" | "default-registered" | "connected" | "disconnected";
|
|
5
5
|
type BrokerRegistryListener = (broker: Broker) => void;
|
|
6
6
|
//#endregion
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { herald } from "./utils/connect-to-broker.mjs";
|
|
2
2
|
|
|
3
|
-
//#region
|
|
3
|
+
//#region ../@warlock.js/herald/src/use-case-broadcast.ts
|
|
4
4
|
/**
|
|
5
5
|
* Channel adapter that publishes use-case broadcast events onto a herald broker.
|
|
6
6
|
*
|
|
@@ -4,7 +4,7 @@ import { ChannelContract } from "../contracts/channel.contract.mjs";
|
|
|
4
4
|
import { EventMessage } from "../message-managers/event-message.mjs";
|
|
5
5
|
import { EventConsumerClass } from "../message-managers/types.mjs";
|
|
6
6
|
import { Broker } from "../communicators/broker.mjs";
|
|
7
|
-
//#region
|
|
7
|
+
//#region ../@warlock.js/herald/src/utils/connect-to-broker.d.ts
|
|
8
8
|
/**
|
|
9
9
|
* Connect to a message broker and register it.
|
|
10
10
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { brokerRegistry } from "../communicators/broker-registry.mjs";
|
|
2
2
|
import "../communicators/index.mjs";
|
|
3
3
|
|
|
4
|
-
//#region
|
|
4
|
+
//#region ../@warlock.js/herald/src/utils/connect-to-broker.ts
|
|
5
5
|
/**
|
|
6
6
|
* Connect to a message broker and register it.
|
|
7
7
|
*
|
package/package.json
CHANGED
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
"@mongez/copper": "^2.1.2",
|
|
23
23
|
"@mongez/events": "^2.2.6",
|
|
24
24
|
"@mongez/reinforcements": "^3.2.0",
|
|
25
|
-
"@warlock.js/logger": "
|
|
26
|
-
"@warlock.js/seal": "
|
|
25
|
+
"@warlock.js/logger": "*",
|
|
26
|
+
"@warlock.js/seal": "*"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"amqplib": "^0.10.0"
|
|
30
30
|
},
|
|
31
|
-
"version": "4.1.
|
|
31
|
+
"version": "4.1.8",
|
|
32
32
|
"main": "./cjs/index.cjs",
|
|
33
33
|
"module": "./esm/index.mjs",
|
|
34
34
|
"types": "./esm/index.d.mts",
|