@warlock.js/herald 4.0.157 → 4.0.158

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.
Files changed (125) hide show
  1. package/package.json +3 -3
  2. package/cjs/communicators/communicator-registry.d.ts +0 -155
  3. package/cjs/communicators/communicator-registry.d.ts.map +0 -1
  4. package/cjs/communicators/communicator-registry.js +0 -206
  5. package/cjs/communicators/communicator-registry.js.map +0 -1
  6. package/cjs/communicators/communicator.d.ts +0 -100
  7. package/cjs/communicators/communicator.d.ts.map +0 -1
  8. package/cjs/communicators/communicator.js +0 -105
  9. package/cjs/communicators/communicator.js.map +0 -1
  10. package/cjs/communicators/index.d.ts +0 -3
  11. package/cjs/communicators/index.d.ts.map +0 -1
  12. package/cjs/contracts/channel.contract.d.ts +0 -186
  13. package/cjs/contracts/channel.contract.d.ts.map +0 -1
  14. package/cjs/contracts/communicator-driver.contract.d.ts +0 -196
  15. package/cjs/contracts/communicator-driver.contract.d.ts.map +0 -1
  16. package/cjs/contracts/index.d.ts +0 -3
  17. package/cjs/contracts/index.d.ts.map +0 -1
  18. package/cjs/decorators/consumable.d.ts +0 -13
  19. package/cjs/decorators/consumable.d.ts.map +0 -1
  20. package/cjs/decorators/consumable.js +0 -33
  21. package/cjs/decorators/consumable.js.map +0 -1
  22. package/cjs/decorators/index.d.ts +0 -2
  23. package/cjs/decorators/index.d.ts.map +0 -1
  24. package/cjs/drivers/index.d.ts +0 -2
  25. package/cjs/drivers/index.d.ts.map +0 -1
  26. package/cjs/drivers/rabbitmq/index.d.ts +0 -3
  27. package/cjs/drivers/rabbitmq/index.d.ts.map +0 -1
  28. package/cjs/drivers/rabbitmq/rabbitmq-channel.d.ts +0 -78
  29. package/cjs/drivers/rabbitmq/rabbitmq-channel.d.ts.map +0 -1
  30. package/cjs/drivers/rabbitmq/rabbitmq-channel.js +0 -412
  31. package/cjs/drivers/rabbitmq/rabbitmq-channel.js.map +0 -1
  32. package/cjs/drivers/rabbitmq/rabbitmq-driver.d.ts +0 -122
  33. package/cjs/drivers/rabbitmq/rabbitmq-driver.d.ts.map +0 -1
  34. package/cjs/drivers/rabbitmq/rabbitmq-driver.js +0 -346
  35. package/cjs/drivers/rabbitmq/rabbitmq-driver.js.map +0 -1
  36. package/cjs/index.d.ts +0 -47
  37. package/cjs/index.d.ts.map +0 -1
  38. package/cjs/index.js +0 -1
  39. package/cjs/index.js.map +0 -1
  40. package/cjs/message-managers/event-consumer.d.ts +0 -63
  41. package/cjs/message-managers/event-consumer.d.ts.map +0 -1
  42. package/cjs/message-managers/event-consumer.js +0 -65
  43. package/cjs/message-managers/event-consumer.js.map +0 -1
  44. package/cjs/message-managers/event-message.d.ts +0 -87
  45. package/cjs/message-managers/event-message.d.ts.map +0 -1
  46. package/cjs/message-managers/event-message.js +0 -84
  47. package/cjs/message-managers/event-message.js.map +0 -1
  48. package/cjs/message-managers/index.d.ts +0 -4
  49. package/cjs/message-managers/index.d.ts.map +0 -1
  50. package/cjs/message-managers/prepare-consumer-subscription.d.ts +0 -4
  51. package/cjs/message-managers/prepare-consumer-subscription.d.ts.map +0 -1
  52. package/cjs/message-managers/prepare-consumer-subscription.js +0 -39
  53. package/cjs/message-managers/prepare-consumer-subscription.js.map +0 -1
  54. package/cjs/message-managers/types.d.ts +0 -20
  55. package/cjs/message-managers/types.d.ts.map +0 -1
  56. package/cjs/types.d.ts +0 -399
  57. package/cjs/types.d.ts.map +0 -1
  58. package/cjs/utils/connect-to-communicator.d.ts +0 -129
  59. package/cjs/utils/connect-to-communicator.d.ts.map +0 -1
  60. package/cjs/utils/connect-to-communicator.js +0 -169
  61. package/cjs/utils/connect-to-communicator.js.map +0 -1
  62. package/cjs/utils/index.d.ts +0 -2
  63. package/cjs/utils/index.d.ts.map +0 -1
  64. package/esm/communicators/communicator-registry.d.ts +0 -155
  65. package/esm/communicators/communicator-registry.d.ts.map +0 -1
  66. package/esm/communicators/communicator-registry.js +0 -206
  67. package/esm/communicators/communicator-registry.js.map +0 -1
  68. package/esm/communicators/communicator.d.ts +0 -100
  69. package/esm/communicators/communicator.d.ts.map +0 -1
  70. package/esm/communicators/communicator.js +0 -105
  71. package/esm/communicators/communicator.js.map +0 -1
  72. package/esm/communicators/index.d.ts +0 -3
  73. package/esm/communicators/index.d.ts.map +0 -1
  74. package/esm/contracts/channel.contract.d.ts +0 -186
  75. package/esm/contracts/channel.contract.d.ts.map +0 -1
  76. package/esm/contracts/communicator-driver.contract.d.ts +0 -196
  77. package/esm/contracts/communicator-driver.contract.d.ts.map +0 -1
  78. package/esm/contracts/index.d.ts +0 -3
  79. package/esm/contracts/index.d.ts.map +0 -1
  80. package/esm/decorators/consumable.d.ts +0 -13
  81. package/esm/decorators/consumable.d.ts.map +0 -1
  82. package/esm/decorators/consumable.js +0 -33
  83. package/esm/decorators/consumable.js.map +0 -1
  84. package/esm/decorators/index.d.ts +0 -2
  85. package/esm/decorators/index.d.ts.map +0 -1
  86. package/esm/drivers/index.d.ts +0 -2
  87. package/esm/drivers/index.d.ts.map +0 -1
  88. package/esm/drivers/rabbitmq/index.d.ts +0 -3
  89. package/esm/drivers/rabbitmq/index.d.ts.map +0 -1
  90. package/esm/drivers/rabbitmq/rabbitmq-channel.d.ts +0 -78
  91. package/esm/drivers/rabbitmq/rabbitmq-channel.d.ts.map +0 -1
  92. package/esm/drivers/rabbitmq/rabbitmq-channel.js +0 -412
  93. package/esm/drivers/rabbitmq/rabbitmq-channel.js.map +0 -1
  94. package/esm/drivers/rabbitmq/rabbitmq-driver.d.ts +0 -122
  95. package/esm/drivers/rabbitmq/rabbitmq-driver.d.ts.map +0 -1
  96. package/esm/drivers/rabbitmq/rabbitmq-driver.js +0 -346
  97. package/esm/drivers/rabbitmq/rabbitmq-driver.js.map +0 -1
  98. package/esm/index.d.ts +0 -47
  99. package/esm/index.d.ts.map +0 -1
  100. package/esm/index.js +0 -1
  101. package/esm/index.js.map +0 -1
  102. package/esm/message-managers/event-consumer.d.ts +0 -63
  103. package/esm/message-managers/event-consumer.d.ts.map +0 -1
  104. package/esm/message-managers/event-consumer.js +0 -65
  105. package/esm/message-managers/event-consumer.js.map +0 -1
  106. package/esm/message-managers/event-message.d.ts +0 -87
  107. package/esm/message-managers/event-message.d.ts.map +0 -1
  108. package/esm/message-managers/event-message.js +0 -84
  109. package/esm/message-managers/event-message.js.map +0 -1
  110. package/esm/message-managers/index.d.ts +0 -4
  111. package/esm/message-managers/index.d.ts.map +0 -1
  112. package/esm/message-managers/prepare-consumer-subscription.d.ts +0 -4
  113. package/esm/message-managers/prepare-consumer-subscription.d.ts.map +0 -1
  114. package/esm/message-managers/prepare-consumer-subscription.js +0 -39
  115. package/esm/message-managers/prepare-consumer-subscription.js.map +0 -1
  116. package/esm/message-managers/types.d.ts +0 -20
  117. package/esm/message-managers/types.d.ts.map +0 -1
  118. package/esm/types.d.ts +0 -399
  119. package/esm/types.d.ts.map +0 -1
  120. package/esm/utils/connect-to-communicator.d.ts +0 -129
  121. package/esm/utils/connect-to-communicator.d.ts.map +0 -1
  122. package/esm/utils/connect-to-communicator.js +0 -169
  123. package/esm/utils/connect-to-communicator.js.map +0 -1
  124. package/esm/utils/index.d.ts +0 -2
  125. package/esm/utils/index.d.ts.map +0 -1
@@ -1,186 +0,0 @@
1
- import type { ChannelOptions, ChannelStats, MessageHandler, PublishOptions, RequestOptions, ResponseHandler, SubscribeOptions, Subscription } from "../types";
2
- /**
3
- * Channel contract - represents a queue (RabbitMQ) or topic (Kafka)
4
- *
5
- * Provides a unified pub/sub interface across different message brokers.
6
- *
7
- * @template TPayload - The typed payload for messages on this channel
8
- *
9
- * @example
10
- * ```typescript
11
- * // Get a typed channel
12
- * const userChannel = communicators().channel<UserPayload>("user.created");
13
- *
14
- * // Publish
15
- * await userChannel.publish({ userId: 1, email: "test@example.com" });
16
- *
17
- * // Subscribe
18
- * userChannel.subscribe(async (message, ctx) => {
19
- * console.log(message.payload.userId);
20
- * await ctx.ack();
21
- * });
22
- * ```
23
- */
24
- export interface ChannelContract<TPayload = unknown> {
25
- /**
26
- * Channel name/routing key
27
- */
28
- readonly name: string;
29
- /**
30
- * Channel options
31
- */
32
- readonly options: ChannelOptions<TPayload>;
33
- /**
34
- * Publish a message to this channel
35
- *
36
- * @param payload - The message payload
37
- * @param options - Optional publish options
38
- *
39
- * @example
40
- * ```typescript
41
- * await channel.publish({ orderId: 123 });
42
- *
43
- * // With options
44
- * await channel.publish({ orderId: 123 }, {
45
- * priority: 5,
46
- * persistent: true,
47
- * correlationId: "req-123",
48
- * });
49
- * ```
50
- */
51
- publish(payload: TPayload, options?: PublishOptions): Promise<void>;
52
- /**
53
- * Publish multiple messages in a batch
54
- *
55
- * More efficient than publishing one by one.
56
- *
57
- * @param messages - Array of payloads to publish
58
- * @param options - Optional publish options (applied to all messages)
59
- *
60
- * @example
61
- * ```typescript
62
- * await channel.publishBatch([
63
- * { event: "page_view", page: "/home" },
64
- * { event: "page_view", page: "/products" },
65
- * ]);
66
- * ```
67
- */
68
- publishBatch(messages: TPayload[], options?: PublishOptions): Promise<void>;
69
- /**
70
- * Subscribe to messages on this channel
71
- *
72
- * @param handler - Function to handle incoming messages
73
- * @param options - Optional subscribe options
74
- * @returns Subscription object for managing the subscription
75
- *
76
- * @example
77
- * ```typescript
78
- * const subscription = await channel.subscribe(
79
- * async (message, ctx) => {
80
- * await processOrder(message.payload);
81
- * await ctx.ack();
82
- * },
83
- * {
84
- * prefetch: 10,
85
- * retry: { maxRetries: 3, delay: 1000 },
86
- * }
87
- * );
88
- *
89
- * // Later: unsubscribe
90
- * await subscription.unsubscribe();
91
- * ```
92
- */
93
- subscribe(handler: MessageHandler<TPayload>, options?: SubscribeOptions): Promise<Subscription>;
94
- /**
95
- * Unsubscribe a consumer by its ID
96
- *
97
- * @param consumerId - The consumer ID to unsubscribe
98
- *
99
- * @example
100
- * ```typescript
101
- * await channel.unsubscribeById("consumer-uuid");
102
- * ```
103
- */
104
- unsubscribeById(consumerId: string): Promise<void>;
105
- /**
106
- * Request-Response pattern (RPC)
107
- *
108
- * Publishes a message and waits for a response.
109
- *
110
- * @param payload - The request payload
111
- * @param options - Request options including timeout
112
- * @returns Promise resolving to the response
113
- *
114
- * @example
115
- * ```typescript
116
- * const result = await channel.request<ProcessResult>(
117
- * { imageUrl: "https://..." },
118
- * { timeout: 30000 }
119
- * );
120
- * console.log(result.processedUrl);
121
- * ```
122
- */
123
- request<TResponse = unknown>(payload: TPayload, options?: RequestOptions): Promise<TResponse>;
124
- /**
125
- * Register a response handler for RPC pattern
126
- *
127
- * The return value of the handler becomes the response.
128
- *
129
- * @param handler - Function to handle requests and return responses
130
- * @returns Subscription for managing the responder
131
- *
132
- * @example
133
- * ```typescript
134
- * channel.respond(async (message, ctx) => {
135
- * const result = await processImage(message.payload);
136
- * return { processedUrl: result.url };
137
- * });
138
- * ```
139
- */
140
- respond<TResponse = unknown>(handler: ResponseHandler<TPayload, TResponse>): Promise<Subscription>;
141
- /**
142
- * Get channel statistics
143
- *
144
- * @returns Channel stats including message count and consumer count
145
- *
146
- * @example
147
- * ```typescript
148
- * const stats = await channel.stats();
149
- * console.log(`Messages: ${stats.messageCount}, Consumers: ${stats.consumerCount}`);
150
- * ```
151
- */
152
- stats(): Promise<ChannelStats>;
153
- /**
154
- * Purge all messages from the channel
155
- *
156
- * Use with caution - this deletes all pending messages.
157
- *
158
- * @returns Number of messages purged
159
- *
160
- * @example
161
- * ```typescript
162
- * const purgedCount = await channel.purge();
163
- * console.log(`Purged ${purgedCount} messages`);
164
- * ```
165
- */
166
- purge(): Promise<number>;
167
- /**
168
- * Check if the channel exists
169
- *
170
- * @returns True if the channel exists on the broker
171
- */
172
- exists(): Promise<boolean>;
173
- /**
174
- * Delete the channel
175
- *
176
- * Use with caution - this removes the queue/topic entirely.
177
- */
178
- delete(): Promise<void>;
179
- /**
180
- * Assert/create the channel with its options
181
- *
182
- * Creates the channel if it doesn't exist, or verifies options match.
183
- */
184
- assert(): Promise<void>;
185
- }
186
- //# sourceMappingURL=channel.contract.d.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CAAC,QAAQ,EAAE,SAAS,CAAC,GAC5C,OAAO,CAAC,YAAY,CAAC,CAAC;IAEzB;;;;;;;;;;OAUG;IACH,KAAK,IAAI,OAAO,CAAC,YAAY,CAAC,CAAC;IAE/B;;;;;;;;;;;;OAYG;IACH,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAEzB;;;;OAIG;IACH,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAE3B;;;;OAIG;IACH,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAExB;;;;OAIG;IACH,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACzB"}
@@ -1,196 +0,0 @@
1
- import { type EventMessage } from "../message-managers/event-message";
2
- import { EventConsumerClass } from "../message-managers/types";
3
- import type { ChannelOptions, CommunicatorDriverType, CommunicatorEvent, CommunicatorEventListener, HealthCheckResult } from "../types";
4
- import type { ChannelContract } from "./channel.contract";
5
- /**
6
- * Communicator Driver Contract
7
- *
8
- * Base contract for all message bus drivers (RabbitMQ, Kafka, etc.)
9
- * Similar to DriverContract in @warlock.js/cascade
10
- *
11
- * @example
12
- * ```typescript
13
- * // Driver implementation
14
- * class RabbitMQDriver implements CommunicatorDriverContract {
15
- * readonly name = "rabbitmq";
16
- * // ...
17
- * }
18
- * ```
19
- */
20
- export interface CommunicatorDriverContract {
21
- /**
22
- * Driver name identifier
23
- *
24
- * @example "rabbitmq", "kafka", "redis-streams"
25
- */
26
- readonly name: CommunicatorDriverType;
27
- /**
28
- * Whether currently connected to the message broker
29
- */
30
- readonly isConnected: boolean;
31
- /**
32
- * Establish connection to the message broker
33
- *
34
- * @throws Error if connection fails
35
- *
36
- * @example
37
- * ```typescript
38
- * await driver.connect();
39
- * console.log("Connected to RabbitMQ");
40
- * ```
41
- */
42
- connect(): Promise<void>;
43
- /**
44
- * Close connection gracefully
45
- *
46
- * Ensures all pending operations complete before disconnecting.
47
- *
48
- * @example
49
- * ```typescript
50
- * await driver.disconnect();
51
- * ```
52
- */
53
- disconnect(): Promise<void>;
54
- /**
55
- * Register event listeners for driver lifecycle events
56
- *
57
- * @param event - Event name to listen for
58
- * @param listener - Callback function
59
- *
60
- * @example
61
- * ```typescript
62
- * driver.on("connected", () => {
63
- * console.log("Connected to broker");
64
- * });
65
- *
66
- * driver.on("disconnected", () => {
67
- * console.log("Disconnected from broker");
68
- * });
69
- *
70
- * driver.on("error", (error) => {
71
- * console.error("Driver error:", error);
72
- * });
73
- *
74
- * driver.on("reconnecting", (attempt) => {
75
- * console.log(`Reconnection attempt ${attempt}`);
76
- * });
77
- * ```
78
- */
79
- on(event: CommunicatorEvent, listener: CommunicatorEventListener): void;
80
- /**
81
- * Remove an event listener
82
- *
83
- * @param event - Event name
84
- * @param listener - Callback to remove
85
- */
86
- off(event: CommunicatorEvent, listener: CommunicatorEventListener): void;
87
- /**
88
- * Subscribe the given consumer class to the driver
89
- *
90
- * @param consumer - Consumer class to subscribe
91
- * @returns Unsubscribe function
92
- * @example
93
- * ```typescript
94
- * driver.subscribe(UserUpdatedConsumer);
95
- * ```
96
- */
97
- subscribe(consumer: EventConsumerClass): () => void;
98
- /**
99
- * Unsubscribe the given consumer class from the driver
100
- *
101
- * @param consumer - Consumer class to unsubscribe
102
- *
103
- * @example
104
- * ```typescript
105
- * driver.unsubscribe(UserUpdatedConsumer);
106
- * ```
107
- */
108
- unsubscribe(consumer: EventConsumerClass): void;
109
- /**
110
- * Publish the given event message
111
- */
112
- publish<TPayload = Record<string, any>>(event: EventMessage<TPayload>): void;
113
- /**
114
- * Get or create a channel
115
- *
116
- * Channels are lazy-created and cached for reuse.
117
- *
118
- * @param name - Channel/queue/topic name
119
- * @param options - Channel configuration
120
- * @returns Channel instance
121
- *
122
- * @example
123
- * ```typescript
124
- * // Simple channel
125
- * const channel = driver.channel("user.created");
126
- *
127
- * // With options
128
- * const orderChannel = driver.channel("orders", {
129
- * durable: true,
130
- * deadLetter: { channel: "orders.failed" },
131
- * });
132
- *
133
- * // Typed channel
134
- * const typedChannel = driver.channel<OrderPayload>("orders", {
135
- * schema: OrderSchema,
136
- * });
137
- * ```
138
- */
139
- channel<TPayload = unknown>(name: string, options?: ChannelOptions<TPayload>): ChannelContract<TPayload>;
140
- /**
141
- * Start consuming messages from all subscribed channels
142
- *
143
- * Call this after setting up all subscriptions to begin processing.
144
- *
145
- * @example
146
- * ```typescript
147
- * // Set up subscriptions
148
- * channel1.subscribe(handler1);
149
- * channel2.subscribe(handler2);
150
- *
151
- * // Start consuming
152
- * await driver.startConsuming();
153
- * ```
154
- */
155
- startConsuming(): Promise<void>;
156
- /**
157
- * Stop consuming messages gracefully
158
- *
159
- * Waits for currently processing messages to complete.
160
- *
161
- * @example
162
- * ```typescript
163
- * await driver.stopConsuming();
164
- * ```
165
- */
166
- stopConsuming(): Promise<void>;
167
- /**
168
- * Perform a health check on the connection
169
- *
170
- * @returns Health check result with status and optional latency
171
- *
172
- * @example
173
- * ```typescript
174
- * const health = await driver.healthCheck();
175
- * if (health.healthy) {
176
- * console.log(`Healthy, latency: ${health.latency}ms`);
177
- * } else {
178
- * console.error(`Unhealthy: ${health.error}`);
179
- * }
180
- * ```
181
- */
182
- healthCheck(): Promise<HealthCheckResult>;
183
- /**
184
- * Get list of all channels managed by this driver
185
- *
186
- * @returns Array of channel names
187
- */
188
- getChannelNames(): string[];
189
- /**
190
- * Close and remove a specific channel
191
- *
192
- * @param name - Channel name to close
193
- */
194
- closeChannel(name: string): Promise<void>;
195
- }
196
- //# sourceMappingURL=communicator-driver.contract.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"communicator-driver.contract.d.ts","sourceRoot":"","sources":["../../src/contracts/communicator-driver.contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EACV,cAAc,EACd,sBAAsB,EACtB,iBAAiB,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OASG;IACH,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE/B;;;;;;;;;;;;;;OAcG;IACH,WAAW,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAE1C;;;;OAIG;IACH,eAAe,IAAI,MAAM,EAAE,CAAC;IAE5B;;;;OAIG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3C"}
@@ -1,3 +0,0 @@
1
- export * from "./channel.contract";
2
- export * from "./communicator-driver.contract";
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,gCAAgC,CAAC"}
@@ -1,13 +0,0 @@
1
- import { type EventConsumerClass } from "../message-managers/types";
2
- export type ConsumableOptions = {
3
- communicator?: string;
4
- };
5
- export declare const pendingSubscribers: Set<{
6
- Consumer: EventConsumerClass;
7
- options?: ConsumableOptions;
8
- }>;
9
- /**
10
- * Register the consumer to the communicator
11
- */
12
- export declare function Consumable(options?: ConsumableOptions): (target: EventConsumerClass) => void;
13
- //# sourceMappingURL=consumable.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"consumable.d.ts","sourceRoot":"","sources":["../../src/decorators/consumable.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,kBAAkB;cACnB,kBAAkB;cAClB,iBAAiB;EACzB,CAAC;AAEL;;GAEG;AACH,wBAAgB,UAAU,CAAC,OAAO,CAAC,EAAE,iBAAiB,YAC3B,kBAAkB,UAkB5C"}
@@ -1,33 +0,0 @@
1
- 'use strict';var communicatorRegistry=require('../communicators/communicator-registry.js');const pendingSubscribers = new Set();
2
- /**
3
- * Register the consumer to the communicator
4
- */
5
- function Consumable(options) {
6
- return function (target) {
7
- const communicatorDriver = options?.communicator;
8
- try {
9
- const currentCommunicator = communicatorRegistry.communicatorRegistry.get(communicatorDriver);
10
- // if communicator is connected, subscribe the consumer
11
- if (currentCommunicator?.isConnected) {
12
- currentCommunicator.subscribe(target);
13
- }
14
- else {
15
- pendingSubscribers.add({ Consumer: target, options });
16
- }
17
- }
18
- catch {
19
- // mostly it will be an error that communicator is not registered yet
20
- // then add it to the pending subscribers
21
- pendingSubscribers.add({ Consumer: target, options });
22
- }
23
- };
24
- }
25
- // Register pending consumers on communicator's connection is done
26
- communicatorRegistry.communicatorRegistry.on("connected", (communicator) => {
27
- for (const { Consumer, options } of pendingSubscribers) {
28
- if (options?.communicator && communicator.name !== options.communicator) {
29
- continue;
30
- }
31
- communicator.subscribe(Consumer);
32
- }
33
- });exports.Consumable=Consumable;exports.pendingSubscribers=pendingSubscribers;//# sourceMappingURL=consumable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"consumable.js","sources":["../../src/decorators/consumable.ts"],"sourcesContent":[null],"names":["communicatorRegistry"],"mappings":"2FAOa,MAAA,kBAAkB,GAAG,IAAI,GAAG,GAGpC;AAEL;;AAEG;AACG,SAAU,UAAU,CAAC,OAA2B,EAAA;AACpD,IAAA,OAAO,UAAU,MAA0B,EAAA;AACzC,QAAA,MAAM,kBAAkB,GAAG,OAAO,EAAE,YAAY,CAAC;QAEjD,IAAI;YACF,MAAM,mBAAmB,GAAGA,yCAAoB,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;;YAGzE,IAAI,mBAAmB,EAAE,WAAW,EAAE;AACpC,gBAAA,mBAAmB,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;AACvC,aAAA;AAAM,iBAAA;gBACL,kBAAkB,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;AACvD,aAAA;AACF,SAAA;QAAC,MAAM;;;YAGN,kBAAkB,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;AACvD,SAAA;AACH,KAAC,CAAC;AACJ,CAAC;AAED;AACAA,yCAAoB,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,YAAY,KAAI;IACpD,KAAK,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,kBAAkB,EAAE;QACtD,IAAI,OAAO,EAAE,YAAY,IAAI,YAAY,CAAC,IAAI,KAAK,OAAO,CAAC,YAAY,EAAE;YACvE,SAAS;AACV,SAAA;AAED,QAAA,YAAY,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;AAClC,KAAA;AACH,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from "./consumable";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/decorators/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from "./rabbitmq";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/drivers/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
@@ -1,3 +0,0 @@
1
- export * from "./rabbitmq-driver";
2
- export * from "./rabbitmq-channel";
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/drivers/rabbitmq/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC"}
@@ -1,78 +0,0 @@
1
- import type { ChannelContract } from "../../contracts";
2
- import type { ChannelOptions, ChannelStats, MessageHandler, PublishOptions, RequestOptions, ResponseHandler, SubscribeOptions, Subscription } from "../../types";
3
- /**
4
- * RabbitMQ Channel Implementation
5
- *
6
- * Wraps a RabbitMQ queue/exchange with a unified API.
7
- *
8
- * @template TPayload - The typed payload
9
- */
10
- export declare class RabbitMQChannel<TPayload = unknown> implements ChannelContract<TPayload> {
11
- readonly name: string;
12
- readonly options: ChannelOptions<TPayload>;
13
- private readonly amqpChannel;
14
- private readonly subscriptions;
15
- private asserted;
16
- /**
17
- * Create a new RabbitMQ channel
18
- */
19
- constructor(name: string, amqpChannel: any, options?: ChannelOptions<TPayload>);
20
- /**
21
- * Assert the queue exists
22
- */
23
- assert(): Promise<void>;
24
- /**
25
- * Publish a message
26
- */
27
- publish(payload: TPayload, options?: PublishOptions): Promise<void>;
28
- /**
29
- * Publish multiple messages
30
- */
31
- publishBatch(messages: TPayload[], options?: PublishOptions): Promise<void>;
32
- /**
33
- * Subscribe to messages
34
- *
35
- * Smart auto-ack behavior (when autoAck is not true):
36
- * - If handler completes successfully without explicit ack/nack/reject → auto-ack
37
- * - If handler throws an error → auto-nack (with retry if configured)
38
- * - If handler explicitly calls ack/nack/reject → respects that call
39
- */
40
- subscribe(handler: MessageHandler<TPayload>, options?: SubscribeOptions): Promise<Subscription>;
41
- /**
42
- * Unsubscribe by consumer ID
43
- */
44
- unsubscribeById(consumerId: string): Promise<void>;
45
- /**
46
- * Stop consuming subscriptions
47
- */
48
- stopConsuming(): Promise<void>;
49
- /**
50
- * Send message to dead-letter queue
51
- */
52
- private sendToDeadLetter;
53
- /**
54
- * Request-response pattern
55
- */
56
- request<TResponse = unknown>(payload: TPayload, options?: RequestOptions): Promise<TResponse>;
57
- /**
58
- * Register response handler for RPC
59
- */
60
- respond<TResponse = unknown>(handler: ResponseHandler<TPayload, TResponse>): Promise<Subscription>;
61
- /**
62
- * Get queue statistics
63
- */
64
- stats(): Promise<ChannelStats>;
65
- /**
66
- * Purge all messages
67
- */
68
- purge(): Promise<number>;
69
- /**
70
- * Check if queue exists
71
- */
72
- exists(): Promise<boolean>;
73
- /**
74
- * Delete the queue
75
- */
76
- delete(): Promise<void>;
77
- }
78
- //# sourceMappingURL=rabbitmq-channel.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rabbitmq-channel.d.ts","sourceRoot":"","sources":["../../../src/drivers/rabbitmq/rabbitmq-channel.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EAGZ,cAAc,EAEd,cAAc,EACd,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,YAAY,EACb,MAAM,aAAa,CAAC;AAErB;;;;;;GAMG;AACH,qBAAa,eAAe,CAAC,QAAQ,GAAG,OAAO,CAAE,YAAW,eAAe,CAAC,QAAQ,CAAC;IACnF,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,OAAO,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC;IAElD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAM;IAClC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA2C;IACzE,OAAO,CAAC,QAAQ,CAAS;IAEzB;;OAEG;gBACgB,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,cAAc,CAAC,QAAQ,CAAC;IAMrF;;OAEG;IACU,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAiBpC;;OAEG;IACU,OAAO,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAkDhF;;OAEG;IACU,YAAY,CAAC,QAAQ,EAAE,QAAQ,EAAE,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAMxF;;;;;;;OAOG;IACU,SAAS,CACpB,OAAO,EAAE,cAAc,CAAC,QAAQ,CAAC,EACjC,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,YAAY,CAAC;IA+KxB;;OAEG;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