@message-queue-toolkit/core 23.2.0 → 24.2.0
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/README.md +360 -0
- package/dist/events/DomainEventEmitter.d.ts +2 -2
- package/dist/events/DomainEventEmitter.js +4 -5
- package/dist/events/DomainEventEmitter.js.map +1 -1
- package/dist/events/EventRegistry.js +1 -1
- package/dist/events/EventRegistry.js.map +1 -1
- package/dist/events/baseEventSchemas.d.ts +1 -1
- package/dist/events/baseEventSchemas.js +1 -1
- package/dist/events/baseEventSchemas.js.map +1 -1
- package/dist/events/eventTypes.d.ts +1 -1
- package/dist/index.d.ts +24 -23
- package/dist/index.js +20 -19
- package/dist/index.js.map +1 -1
- package/dist/message-deduplication/messageDeduplicationTypes.d.ts +1 -1
- package/dist/messages/baseMessageSchemas.d.ts +1 -1
- package/dist/messages/baseMessageSchemas.js +1 -1
- package/dist/messages/baseMessageSchemas.js.map +1 -1
- package/dist/payload-store/offloadedPayloadMessageSchemas.d.ts +24 -3
- package/dist/payload-store/offloadedPayloadMessageSchemas.js +39 -5
- package/dist/payload-store/offloadedPayloadMessageSchemas.js.map +1 -1
- package/dist/payload-store/payloadStoreTypes.d.ts +63 -3
- package/dist/payload-store/payloadStoreTypes.js +27 -0
- package/dist/payload-store/payloadStoreTypes.js.map +1 -1
- package/dist/queues/AbstractPublisherManager.d.ts +1 -1
- package/dist/queues/AbstractPublisherManager.js +4 -4
- package/dist/queues/AbstractPublisherManager.js.map +1 -1
- package/dist/queues/AbstractQueueService.d.ts +33 -3
- package/dist/queues/AbstractQueueService.js +137 -28
- package/dist/queues/AbstractQueueService.js.map +1 -1
- package/dist/queues/HandlerContainer.d.ts +49 -1
- package/dist/queues/HandlerContainer.js +65 -12
- package/dist/queues/HandlerContainer.js.map +1 -1
- package/dist/queues/HandlerSpy.d.ts +1 -0
- package/dist/queues/HandlerSpy.js +6 -5
- package/dist/queues/HandlerSpy.js.map +1 -1
- package/dist/queues/MessageSchemaContainer.js.map +1 -1
- package/dist/types/queueOptionsTypes.d.ts +1 -1
- package/dist/utils/matchUtils.js +5 -5
- package/dist/utils/matchUtils.js.map +1 -1
- package/dist/utils/waitUtils.js +1 -1
- package/dist/utils/waitUtils.js.map +1 -1
- package/package.json +15 -7
package/README.md
ADDED
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
# @message-queue-toolkit/core
|
|
2
|
+
|
|
3
|
+
Core library for message-queue-toolkit. Provides foundational abstractions, utilities, and base classes for building message queue publishers and consumers.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Installation](#installation)
|
|
8
|
+
- [Overview](#overview)
|
|
9
|
+
- [Core Concepts](#core-concepts)
|
|
10
|
+
- [Message Schemas](#message-schemas)
|
|
11
|
+
- [Handler Configuration](#handler-configuration)
|
|
12
|
+
- [Pre-handlers and Barriers](#pre-handlers-and-barriers)
|
|
13
|
+
- [Handler Spies](#handler-spies)
|
|
14
|
+
- [Key Classes](#key-classes)
|
|
15
|
+
- [AbstractQueueService](#abstractqueueservice)
|
|
16
|
+
- [MessageHandlerConfigBuilder](#messagehandlerconfigbuilder)
|
|
17
|
+
- [HandlerContainer](#handlercontainer)
|
|
18
|
+
- [MessageSchemaContainer](#messageschemacontainer)
|
|
19
|
+
- [AbstractPublisherManager](#abstractpublishermanager)
|
|
20
|
+
- [DomainEventEmitter](#domaineventemitter)
|
|
21
|
+
- [Utilities](#utilities)
|
|
22
|
+
- [NO_MESSAGE_TYPE_FIELD](#no_message_type_field)
|
|
23
|
+
- [Error Classes](#error-classes)
|
|
24
|
+
- [Message Deduplication](#message-deduplication)
|
|
25
|
+
- [Payload Offloading](#payload-offloading)
|
|
26
|
+
- [API Reference](#api-reference)
|
|
27
|
+
- [Links](#links)
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install @message-queue-toolkit/core zod
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**Peer Dependencies:**
|
|
36
|
+
- `zod` - Schema validation
|
|
37
|
+
|
|
38
|
+
## Overview
|
|
39
|
+
|
|
40
|
+
The core package provides the foundational building blocks used by all protocol-specific implementations (SQS, SNS, AMQP, Kafka, GCP Pub/Sub). It includes:
|
|
41
|
+
|
|
42
|
+
- **Base Classes**: Abstract classes for publishers and consumers
|
|
43
|
+
- **Handler System**: Type-safe message routing and handling
|
|
44
|
+
- **Validation**: Zod schema validation and message parsing
|
|
45
|
+
- **Utilities**: Retry logic, date handling, environment utilities
|
|
46
|
+
- **Testing**: Handler spies for testing async message flows
|
|
47
|
+
- **Extensibility**: Interfaces for payload stores, deduplication stores, and metrics
|
|
48
|
+
|
|
49
|
+
## Core Concepts
|
|
50
|
+
|
|
51
|
+
### Message Schemas
|
|
52
|
+
|
|
53
|
+
Messages are validated using Zod schemas. The library uses configurable field names:
|
|
54
|
+
|
|
55
|
+
- **`messageTypeField`** (required): Field containing the message type discriminator (must be `z.literal()` for routing)
|
|
56
|
+
- **`messageIdField`** (default: `'id'`): Field containing the message ID
|
|
57
|
+
- **`messageTimestampField`** (default: `'timestamp'`): Field containing the timestamp
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
import { z } from 'zod'
|
|
61
|
+
|
|
62
|
+
const UserCreatedSchema = z.object({
|
|
63
|
+
id: z.string(),
|
|
64
|
+
type: z.literal('user.created'), // Used for routing
|
|
65
|
+
timestamp: z.string().datetime(),
|
|
66
|
+
userId: z.string(),
|
|
67
|
+
email: z.string().email(),
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
type UserCreated = z.infer<typeof UserCreatedSchema>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Handler Configuration
|
|
74
|
+
|
|
75
|
+
Use `MessageHandlerConfigBuilder` to configure handlers for different message types:
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
import { MessageHandlerConfigBuilder } from '@message-queue-toolkit/core'
|
|
79
|
+
|
|
80
|
+
const handlers = new MessageHandlerConfigBuilder<SupportedMessages, ExecutionContext>()
|
|
81
|
+
.addConfig(
|
|
82
|
+
UserCreatedSchema,
|
|
83
|
+
async (message, context, preHandlingOutputs) => {
|
|
84
|
+
await context.userService.createUser(message.userId)
|
|
85
|
+
return { result: 'success' }
|
|
86
|
+
}
|
|
87
|
+
)
|
|
88
|
+
.addConfig(
|
|
89
|
+
UserUpdatedSchema,
|
|
90
|
+
async (message, context, preHandlingOutputs) => {
|
|
91
|
+
await context.userService.updateUser(message.userId, message.changes)
|
|
92
|
+
return { result: 'success' }
|
|
93
|
+
}
|
|
94
|
+
)
|
|
95
|
+
.build()
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Pre-handlers and Barriers
|
|
99
|
+
|
|
100
|
+
**Pre-handlers** are middleware functions that run before the main handler:
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
const preHandlers = [
|
|
104
|
+
(message, context, output, next) => {
|
|
105
|
+
// Enrich context, validate prerequisites, etc.
|
|
106
|
+
output.logger = context.logger.child({ messageId: message.id })
|
|
107
|
+
next({ result: 'success' })
|
|
108
|
+
},
|
|
109
|
+
]
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
**Barriers** control whether a message should be processed or retried later:
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
const preHandlerBarrier = async (message, context, preHandlerOutput) => {
|
|
116
|
+
const prerequisiteMet = await checkPrerequisite(message)
|
|
117
|
+
return {
|
|
118
|
+
isPassing: prerequisiteMet,
|
|
119
|
+
output: { ready: true },
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Handler Spies
|
|
125
|
+
|
|
126
|
+
Handler spies enable testing of async message flows:
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
// Enable in consumer/publisher options
|
|
130
|
+
{ handlerSpy: true }
|
|
131
|
+
|
|
132
|
+
// Wait for specific messages in tests
|
|
133
|
+
const result = await consumer.handlerSpy.waitForMessageWithId('msg-123', 'consumed', 5000)
|
|
134
|
+
expect(result.userId).toBe('user-456')
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Key Classes
|
|
138
|
+
|
|
139
|
+
### AbstractQueueService
|
|
140
|
+
|
|
141
|
+
Base class for all queue services. Provides:
|
|
142
|
+
|
|
143
|
+
- Message serialization/deserialization
|
|
144
|
+
- Schema validation
|
|
145
|
+
- Retry logic with exponential backoff
|
|
146
|
+
- Payload offloading support
|
|
147
|
+
- Message deduplication primitives
|
|
148
|
+
|
|
149
|
+
### MessageHandlerConfigBuilder
|
|
150
|
+
|
|
151
|
+
Fluent builder for configuring message handlers:
|
|
152
|
+
|
|
153
|
+
```typescript
|
|
154
|
+
import { MessageHandlerConfigBuilder } from '@message-queue-toolkit/core'
|
|
155
|
+
|
|
156
|
+
const handlers = new MessageHandlerConfigBuilder<
|
|
157
|
+
SupportedMessages,
|
|
158
|
+
ExecutionContext,
|
|
159
|
+
PrehandlerOutput
|
|
160
|
+
>()
|
|
161
|
+
.addConfig(Schema1, handler1)
|
|
162
|
+
.addConfig(Schema2, handler2, {
|
|
163
|
+
preHandlers: [preHandler1, preHandler2],
|
|
164
|
+
preHandlerBarrier: barrierFn,
|
|
165
|
+
messageLogFormatter: (msg) => ({ id: msg.id }),
|
|
166
|
+
})
|
|
167
|
+
.build()
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### HandlerContainer
|
|
171
|
+
|
|
172
|
+
Routes messages to appropriate handlers based on message type:
|
|
173
|
+
|
|
174
|
+
```typescript
|
|
175
|
+
import { HandlerContainer } from '@message-queue-toolkit/core'
|
|
176
|
+
|
|
177
|
+
const container = new HandlerContainer({
|
|
178
|
+
messageHandlers: handlers,
|
|
179
|
+
messageTypeField: 'type',
|
|
180
|
+
})
|
|
181
|
+
|
|
182
|
+
const handler = container.resolveHandler(message.type)
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### MessageSchemaContainer
|
|
186
|
+
|
|
187
|
+
Manages Zod schemas and validates messages:
|
|
188
|
+
|
|
189
|
+
```typescript
|
|
190
|
+
import { MessageSchemaContainer } from '@message-queue-toolkit/core'
|
|
191
|
+
|
|
192
|
+
const container = new MessageSchemaContainer({
|
|
193
|
+
messageSchemas: [Schema1, Schema2],
|
|
194
|
+
messageTypeField: 'type',
|
|
195
|
+
})
|
|
196
|
+
|
|
197
|
+
const schema = container.resolveSchema(message.type)
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### AbstractPublisherManager
|
|
201
|
+
|
|
202
|
+
Factory pattern for spawning publishers on demand:
|
|
203
|
+
|
|
204
|
+
```typescript
|
|
205
|
+
import { AbstractPublisherManager } from '@message-queue-toolkit/core'
|
|
206
|
+
|
|
207
|
+
// Automatically spawns publishers and fills metadata
|
|
208
|
+
await publisherManager.publish('user-events-topic', {
|
|
209
|
+
type: 'user.created',
|
|
210
|
+
userId: 'user-123',
|
|
211
|
+
})
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### DomainEventEmitter
|
|
215
|
+
|
|
216
|
+
Event emitter for domain events:
|
|
217
|
+
|
|
218
|
+
```typescript
|
|
219
|
+
import { DomainEventEmitter } from '@message-queue-toolkit/core'
|
|
220
|
+
|
|
221
|
+
const emitter = new DomainEventEmitter()
|
|
222
|
+
|
|
223
|
+
emitter.on('user.created', async (event) => {
|
|
224
|
+
console.log('User created:', event.userId)
|
|
225
|
+
})
|
|
226
|
+
|
|
227
|
+
await emitter.emit('user.created', { userId: 'user-123' })
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## Utilities
|
|
231
|
+
|
|
232
|
+
### NO_MESSAGE_TYPE_FIELD
|
|
233
|
+
|
|
234
|
+
Use this constant when your consumer should accept all message types without routing:
|
|
235
|
+
|
|
236
|
+
```typescript
|
|
237
|
+
import { NO_MESSAGE_TYPE_FIELD } from '@message-queue-toolkit/core'
|
|
238
|
+
|
|
239
|
+
// Consumer will use a single handler for all messages
|
|
240
|
+
{
|
|
241
|
+
messageTypeField: NO_MESSAGE_TYPE_FIELD,
|
|
242
|
+
handlers: new MessageHandlerConfigBuilder()
|
|
243
|
+
.addConfig(PassthroughSchema, async (message) => {
|
|
244
|
+
// Handles any message type
|
|
245
|
+
return { result: 'success' }
|
|
246
|
+
})
|
|
247
|
+
.build(),
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Error Classes
|
|
252
|
+
|
|
253
|
+
```typescript
|
|
254
|
+
import {
|
|
255
|
+
MessageValidationError,
|
|
256
|
+
MessageInvalidFormatError,
|
|
257
|
+
DoNotProcessMessageError,
|
|
258
|
+
RetryMessageLaterError,
|
|
259
|
+
} from '@message-queue-toolkit/core'
|
|
260
|
+
|
|
261
|
+
// Validation failed
|
|
262
|
+
throw new MessageValidationError(zodError.issues)
|
|
263
|
+
|
|
264
|
+
// Message format is invalid (cannot parse)
|
|
265
|
+
throw new MessageInvalidFormatError({ message: 'Invalid JSON' })
|
|
266
|
+
|
|
267
|
+
// Do not process this message (skip without retry)
|
|
268
|
+
throw new DoNotProcessMessageError({ message: 'Duplicate message' })
|
|
269
|
+
|
|
270
|
+
// Retry this message later
|
|
271
|
+
throw new RetryMessageLaterError({ message: 'Dependency not ready' })
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### Message Deduplication
|
|
275
|
+
|
|
276
|
+
Interfaces for implementing deduplication stores:
|
|
277
|
+
|
|
278
|
+
```typescript
|
|
279
|
+
import type { MessageDeduplicationStore, ReleasableLock } from '@message-queue-toolkit/core'
|
|
280
|
+
|
|
281
|
+
// Implement custom deduplication store
|
|
282
|
+
class MyDeduplicationStore implements MessageDeduplicationStore {
|
|
283
|
+
async keyExists(key: string): Promise<boolean> { /* ... */ }
|
|
284
|
+
async setKey(key: string, ttlSeconds: number): Promise<void> { /* ... */ }
|
|
285
|
+
async acquireLock(key: string, options: AcquireLockOptions): Promise<ReleasableLock> { /* ... */ }
|
|
286
|
+
}
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### Payload Offloading
|
|
290
|
+
|
|
291
|
+
Interfaces for implementing payload stores:
|
|
292
|
+
|
|
293
|
+
```typescript
|
|
294
|
+
import type { PayloadStore, PayloadStoreConfig } from '@message-queue-toolkit/core'
|
|
295
|
+
|
|
296
|
+
// Implement custom payload store
|
|
297
|
+
class MyPayloadStore implements PayloadStore {
|
|
298
|
+
async storePayload(payload: Buffer, messageId: string): Promise<PayloadRef> { /* ... */ }
|
|
299
|
+
async retrievePayload(ref: PayloadRef): Promise<Buffer> { /* ... */ }
|
|
300
|
+
}
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
## API Reference
|
|
304
|
+
|
|
305
|
+
### Types
|
|
306
|
+
|
|
307
|
+
```typescript
|
|
308
|
+
// Handler result type
|
|
309
|
+
type HandlerResult = Either<'retryLater', 'success'>
|
|
310
|
+
|
|
311
|
+
// Pre-handler signature
|
|
312
|
+
type Prehandler<Message, Context, Output> = (
|
|
313
|
+
message: Message,
|
|
314
|
+
context: Context,
|
|
315
|
+
output: Output,
|
|
316
|
+
next: (result: PrehandlerResult) => void
|
|
317
|
+
) => void
|
|
318
|
+
|
|
319
|
+
// Barrier signature
|
|
320
|
+
type BarrierCallback<Message, Context, PrehandlerOutput, BarrierOutput> = (
|
|
321
|
+
message: Message,
|
|
322
|
+
context: Context,
|
|
323
|
+
preHandlerOutput: PrehandlerOutput
|
|
324
|
+
) => Promise<BarrierResult<BarrierOutput>>
|
|
325
|
+
|
|
326
|
+
// Barrier result
|
|
327
|
+
type BarrierResult<Output> =
|
|
328
|
+
| { isPassing: true; output: Output }
|
|
329
|
+
| { isPassing: false; output?: never }
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
### Utility Functions
|
|
333
|
+
|
|
334
|
+
```typescript
|
|
335
|
+
// Environment utilities
|
|
336
|
+
isProduction(): boolean
|
|
337
|
+
reloadConfig(): void
|
|
338
|
+
|
|
339
|
+
// Date utilities
|
|
340
|
+
isRetryDateExceeded(timestamp: string | Date, maxRetryDuration: number): boolean
|
|
341
|
+
|
|
342
|
+
// Message parsing
|
|
343
|
+
parseMessage<T>(data: unknown, schema: ZodSchema<T>): ParseMessageResult<T>
|
|
344
|
+
|
|
345
|
+
// Wait utilities
|
|
346
|
+
waitAndRetry<T>(fn: () => Promise<T>, options: WaitAndRetryOptions): Promise<T>
|
|
347
|
+
|
|
348
|
+
// Object utilities
|
|
349
|
+
objectMatches(obj: unknown, pattern: unknown): boolean
|
|
350
|
+
isShallowSubset(subset: object, superset: object): boolean
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
## Links
|
|
354
|
+
|
|
355
|
+
- [Main Repository](https://github.com/kibertoad/message-queue-toolkit)
|
|
356
|
+
- [SQS Package](https://www.npmjs.com/package/@message-queue-toolkit/sqs)
|
|
357
|
+
- [SNS Package](https://www.npmjs.com/package/@message-queue-toolkit/sns)
|
|
358
|
+
- [AMQP Package](https://www.npmjs.com/package/@message-queue-toolkit/amqp)
|
|
359
|
+
- [GCP Pub/Sub Package](https://www.npmjs.com/package/@message-queue-toolkit/gcp-pubsub)
|
|
360
|
+
- [Kafka Package](https://www.npmjs.com/package/@message-queue-toolkit/kafka)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type CommonLogger, type ErrorReporter, type TransactionObservabilityManager } from '@lokalise/node-core';
|
|
2
|
+
import type { ConsumerMessageMetadataType } from '@message-queue-toolkit/schemas';
|
|
2
3
|
import type { MetadataFiller } from '../messages/MetadataFiller.ts';
|
|
3
4
|
import type { HandlerSpy, HandlerSpyParams, PublicHandlerSpy } from '../queues/HandlerSpy.ts';
|
|
4
|
-
import type { ConsumerMessageMetadataType } from '@message-queue-toolkit/schemas';
|
|
5
5
|
import type { EventRegistry } from './EventRegistry.ts';
|
|
6
6
|
import type { AnyEventHandler, CommonEventDefinition, CommonEventDefinitionConsumerSchemaType, CommonEventDefinitionPublisherSchemaType, EventTypeNames, SingleEventHandler } from './eventTypes.ts';
|
|
7
7
|
export type DomainEventEmitterDependencies<SupportedEvents extends CommonEventDefinition[]> = {
|
|
@@ -23,7 +23,7 @@ export declare class DomainEventEmitter<SupportedEvents extends CommonEventDefin
|
|
|
23
23
|
constructor(deps: DomainEventEmitterDependencies<SupportedEvents>, options?: {
|
|
24
24
|
handlerSpy?: HandlerSpy<object> | HandlerSpyParams | boolean;
|
|
25
25
|
});
|
|
26
|
-
get handlerSpy(): PublicHandlerSpy<
|
|
26
|
+
get handlerSpy(): PublicHandlerSpy<CommonEventDefinitionConsumerSchemaType<SupportedEvents[number]>>;
|
|
27
27
|
dispose(): Promise<void>;
|
|
28
28
|
emit<SupportedEvent extends SupportedEvents[number]>(supportedEvent: SupportedEvent, data: Omit<CommonEventDefinitionPublisherSchemaType<SupportedEvent>, 'type'>, precedingMessageMetadata?: Partial<ConsumerMessageMetadataType>): Promise<Omit<CommonEventDefinitionConsumerSchemaType<SupportedEvent>, 'type'>>;
|
|
29
29
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
1
2
|
import { InternalError, resolveGlobalErrorLogObject, } from '@lokalise/node-core';
|
|
2
3
|
import { resolveHandlerSpy } from "../queues/HandlerSpy.js";
|
|
3
|
-
import { randomUUID } from 'node:crypto';
|
|
4
4
|
export class DomainEventEmitter {
|
|
5
5
|
eventRegistry;
|
|
6
6
|
metadataFiller;
|
|
@@ -47,7 +47,7 @@ export class DomainEventEmitter {
|
|
|
47
47
|
data.id = this.metadataFiller.produceId();
|
|
48
48
|
if (!data.metadata) {
|
|
49
49
|
data.metadata = this.metadataFiller.produceMetadata(
|
|
50
|
-
// @ts-
|
|
50
|
+
// @ts-expect-error
|
|
51
51
|
data, supportedEvent, precedingMessageMetadata ?? {});
|
|
52
52
|
}
|
|
53
53
|
if (!data.metadata.correlationId)
|
|
@@ -55,9 +55,9 @@ export class DomainEventEmitter {
|
|
|
55
55
|
const validatedEvent = this.eventRegistry
|
|
56
56
|
.getEventDefinitionByTypeName(eventTypeName)
|
|
57
57
|
.publisherSchema.parse({ type: eventTypeName, ...data });
|
|
58
|
-
// @ts-
|
|
58
|
+
// @ts-expect-error
|
|
59
59
|
await this.handleEvent(validatedEvent);
|
|
60
|
-
// @ts-
|
|
60
|
+
// @ts-expect-error
|
|
61
61
|
return validatedEvent;
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
@@ -98,7 +98,6 @@ export class DomainEventEmitter {
|
|
|
98
98
|
if (!this._handlerSpy)
|
|
99
99
|
return;
|
|
100
100
|
this._handlerSpy.addProcessedMessage({
|
|
101
|
-
// @ts-ignore
|
|
102
101
|
message: event,
|
|
103
102
|
processingResult: { status: 'consumed' },
|
|
104
103
|
}, event.id);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DomainEventEmitter.js","sourceRoot":"","sources":["../../lib/events/DomainEventEmitter.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"DomainEventEmitter.js","sourceRoot":"","sources":["../../lib/events/DomainEventEmitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAGL,aAAa,EACb,2BAA2B,GAE5B,MAAM,qBAAqB,CAAA;AAI5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAyB3D,MAAM,OAAO,kBAAkB;IACZ,aAAa,CAAgC;IAC7C,cAAc,CAAgB;IAC9B,MAAM,CAAc;IACpB,aAAa,CAAgB;IAC7B,+BAA+B,CAAkC;IACjE,WAAW,CAE3B;IAEgB,eAAe,CAG/B;IACgB,oCAAoC,CAA4B;IAEjF,YACE,IAAqD,EACrD,UAEI,EAAE;QAEN,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAA;QACvC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAA;QACzC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;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,mBAA4B;QAE5B,OAAO,GAAG,mBAAmB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,mBAAmB,KAAK,CAAC,IAAI,IAAI,OAAO,CAAC,cAAc,EAAE,CAAA;IACtG,CAAC;CACF"}
|
|
@@ -11,7 +11,7 @@ export class EventRegistry {
|
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
getEventDefinitionByTypeName = (eventTypeName) => {
|
|
14
|
-
// biome-ignore lint/style/noNonNullAssertion:
|
|
14
|
+
// biome-ignore lint/style/noNonNullAssertion: It's ok
|
|
15
15
|
return this.supportedEventMap[eventTypeName];
|
|
16
16
|
};
|
|
17
17
|
isSupportedEvent(eventTypeName) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventRegistry.js","sourceRoot":"","sources":["../../lib/events/EventRegistry.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,aAAa;IACR,eAAe,CAAiB;IAChC,mBAAmB,CAAa;IAC/B,iBAAiB,GAA0C,EAAE,CAAA;IAE9E,YAAY,eAAgC;QAC1C,IAAI,CAAC,eAAe,GAAG,eAAe,CAAA;QACtC,IAAI,CAAC,mBAAmB,GAAG,IAAI,GAAG,EAAU,CAAA;QAE5C,KAAK,MAAM,cAAc,IAAI,eAAe,EAAE,CAAC;YAC7C,IAAI,CAAC,iBAAiB,CAAC,cAAc,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,cAAc,CAAA;YACvF,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,cAAc,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAC9E,CAAC;IACH,CAAC;IAEM,4BAA4B,GAAG,CAGpC,aAA4B,EACL,EAAE;QACzB,
|
|
1
|
+
{"version":3,"file":"EventRegistry.js","sourceRoot":"","sources":["../../lib/events/EventRegistry.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,aAAa;IACR,eAAe,CAAiB;IAChC,mBAAmB,CAAa;IAC/B,iBAAiB,GAA0C,EAAE,CAAA;IAE9E,YAAY,eAAgC;QAC1C,IAAI,CAAC,eAAe,GAAG,eAAe,CAAA;QACtC,IAAI,CAAC,mBAAmB,GAAG,IAAI,GAAG,EAAU,CAAA;QAE5C,KAAK,MAAM,cAAc,IAAI,eAAe,EAAE,CAAC;YAC7C,IAAI,CAAC,iBAAiB,CAAC,cAAc,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,cAAc,CAAA;YACvF,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,cAAc,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAC9E,CAAC;IACH,CAAC;IAEM,4BAA4B,GAAG,CAGpC,aAA4B,EACL,EAAE;QACzB,sDAAsD;QACtD,OAAO,IAAI,CAAC,iBAAiB,CAAC,aAAa,CAAE,CAAA;IAC/C,CAAC,CAAA;IAEM,gBAAgB,CAAC,aAAqB;QAC3C,OAAO,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;IACpD,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { CONSUMER_BASE_EVENT_SCHEMA, CORE_EVENT_SCHEMA, type ConsumerBaseEventType, type CoreEventType, type enrichEventSchemaWithBase, GENERATED_BASE_EVENT_SCHEMA, type GeneratedBaseEventType, OPTIONAL_GENERATED_BASE_EVENT_SCHEMA, PUBLISHER_BASE_EVENT_SCHEMA, type PublisherBaseEventType, } from '@message-queue-toolkit/schemas';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { CONSUMER_BASE_EVENT_SCHEMA, CORE_EVENT_SCHEMA, GENERATED_BASE_EVENT_SCHEMA, OPTIONAL_GENERATED_BASE_EVENT_SCHEMA, PUBLISHER_BASE_EVENT_SCHEMA, } from '@message-queue-toolkit/schemas';
|
|
2
2
|
//# sourceMappingURL=baseEventSchemas.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseEventSchemas.js","sourceRoot":"","sources":["../../lib/events/baseEventSchemas.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"baseEventSchemas.js","sourceRoot":"","sources":["../../lib/events/baseEventSchemas.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,iBAAiB,EAIjB,2BAA2B,EAE3B,oCAAoC,EACpC,2BAA2B,GAE5B,MAAM,gCAAgC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type {
|
|
1
|
+
export type { AnyEventHandler, CommonEventDefinition, CommonEventDefinitionConsumerSchemaType, CommonEventDefinitionPublisherSchemaType, EventHandler, EventTypeNames, SingleEventHandler, } from '@message-queue-toolkit/schemas';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,30 +1,31 @@
|
|
|
1
|
-
export type { QueueConsumer, AsyncPublisher, SyncPublisher, TransactionObservabilityManager, SchemaMap, ExtraParams, MessageProcessingResult, } from './types/MessageQueueTypes.ts';
|
|
2
|
-
export { AbstractQueueService, type Deserializer, type ResolvedMessage, } from './queues/AbstractQueueService.ts';
|
|
3
|
-
export * from './types/queueOptionsTypes.ts';
|
|
4
|
-
export { isMessageError, MessageValidationError, MessageInvalidFormatError, } from './errors/Errors.ts';
|
|
5
|
-
export { isShallowSubset, objectMatches } from './utils/matchUtils.ts';
|
|
6
|
-
export { RetryMessageLaterError } from './errors/RetryMessageLaterError.ts';
|
|
7
1
|
export { DoNotProcessMessageError } from './errors/DoNotProcessError.ts';
|
|
8
|
-
export {
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export { MessageSchemaContainer } from './queues/MessageSchemaContainer.ts';
|
|
12
|
-
export type { MessageSchemaContainerOptions } from './queues/MessageSchemaContainer.ts';
|
|
13
|
-
export { objectToBuffer } from './utils/queueUtils.ts';
|
|
14
|
-
export { waitAndRetry } from './utils/waitUtils.ts';
|
|
15
|
-
export { type ParseMessageResult, parseMessage } from './utils/parseUtils.ts';
|
|
16
|
-
export { isRetryDateExceeded } from './utils/dateUtils.ts';
|
|
17
|
-
export { toDatePreprocessor } from './utils/toDateProcessor.ts';
|
|
18
|
-
export { reloadConfig, isProduction } from './utils/envUtils.ts';
|
|
2
|
+
export { isMessageError, MessageInvalidFormatError, MessageValidationError, } from './errors/Errors.ts';
|
|
3
|
+
export { RetryMessageLaterError } from './errors/RetryMessageLaterError.ts';
|
|
4
|
+
export * from './events/baseEventSchemas.ts';
|
|
19
5
|
export { DomainEventEmitter } from './events/DomainEventEmitter.ts';
|
|
20
6
|
export { EventRegistry } from './events/EventRegistry.ts';
|
|
21
|
-
export { FakeListener } from './events/fakes/FakeListener.ts';
|
|
22
7
|
export * from './events/eventTypes.ts';
|
|
23
|
-
export
|
|
8
|
+
export { FakeListener } from './events/fakes/FakeListener.ts';
|
|
9
|
+
export * from './message-deduplication/AcquireLockTimeoutError.ts';
|
|
10
|
+
export { type AcquireLockOptions, type DeduplicationRequester, DeduplicationRequesterEnum, type MessageDeduplicationConfig, type MessageDeduplicationStore, noopReleasableLock, type ReleasableLock, } from './message-deduplication/messageDeduplicationTypes.ts';
|
|
24
11
|
export * from './messages/baseMessageSchemas.ts';
|
|
25
12
|
export * from './messages/MetadataFiller.ts';
|
|
13
|
+
export { isOffloadedPayloadPointerPayload, OFFLOADED_PAYLOAD_POINTER_PAYLOAD_SCHEMA, type OffloadedPayloadPointerPayload, PAYLOAD_REF_SCHEMA, type PayloadRef, } from './payload-store/offloadedPayloadMessageSchemas.ts';
|
|
14
|
+
export type { MultiPayloadStoreConfig, PayloadSerializer, PayloadStore, PayloadStoreConfig, SerializedPayload, SinglePayloadStoreConfig, } from './payload-store/payloadStoreTypes.ts';
|
|
15
|
+
export { createMultiStoreConfig, isMultiPayloadStoreConfig, } from './payload-store/payloadStoreTypes.ts';
|
|
26
16
|
export * from './queues/AbstractPublisherManager.ts';
|
|
27
|
-
export
|
|
28
|
-
export {
|
|
29
|
-
export {
|
|
30
|
-
export
|
|
17
|
+
export { AbstractQueueService, type Deserializer, type ResolvedMessage, } from './queues/AbstractQueueService.ts';
|
|
18
|
+
export type { BarrierCallback, BarrierResult, BarrierResultNegative, BarrierResultPositive, Handler, HandlerContainerOptions, PreHandlingOutputs, Prehandler, } from './queues/HandlerContainer.ts';
|
|
19
|
+
export { HandlerContainer, MessageHandlerConfig, MessageHandlerConfigBuilder, NO_MESSAGE_TYPE_FIELD, type PrehandlerResult, } from './queues/HandlerContainer.ts';
|
|
20
|
+
export { HandlerSpy, type HandlerSpyParams, type PublicHandlerSpy, resolveHandlerSpy, type SpyResultInput, } from './queues/HandlerSpy.ts';
|
|
21
|
+
export type { MessageSchemaContainerOptions } from './queues/MessageSchemaContainer.ts';
|
|
22
|
+
export { MessageSchemaContainer } from './queues/MessageSchemaContainer.ts';
|
|
23
|
+
export type { AsyncPublisher, ExtraParams, MessageProcessingResult, QueueConsumer, SchemaMap, SyncPublisher, TransactionObservabilityManager, } from './types/MessageQueueTypes.ts';
|
|
24
|
+
export * from './types/queueOptionsTypes.ts';
|
|
25
|
+
export { isRetryDateExceeded } from './utils/dateUtils.ts';
|
|
26
|
+
export { isProduction, reloadConfig } from './utils/envUtils.ts';
|
|
27
|
+
export { isShallowSubset, objectMatches } from './utils/matchUtils.ts';
|
|
28
|
+
export { type ParseMessageResult, parseMessage } from './utils/parseUtils.ts';
|
|
29
|
+
export { objectToBuffer } from './utils/queueUtils.ts';
|
|
30
|
+
export { toDatePreprocessor } from './utils/toDateProcessor.ts';
|
|
31
|
+
export { waitAndRetry } from './utils/waitUtils.ts';
|
package/dist/index.js
CHANGED
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
export { AbstractQueueService, } from "./queues/AbstractQueueService.js";
|
|
2
|
-
export * from "./types/queueOptionsTypes.js";
|
|
3
|
-
export { isMessageError, MessageValidationError, MessageInvalidFormatError, } from "./errors/Errors.js";
|
|
4
|
-
export { isShallowSubset, objectMatches } from "./utils/matchUtils.js";
|
|
5
|
-
export { RetryMessageLaterError } from "./errors/RetryMessageLaterError.js";
|
|
6
1
|
export { DoNotProcessMessageError } from "./errors/DoNotProcessError.js";
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export
|
|
10
|
-
export { objectToBuffer } from "./utils/queueUtils.js";
|
|
11
|
-
export { waitAndRetry } from "./utils/waitUtils.js";
|
|
12
|
-
export { parseMessage } from "./utils/parseUtils.js";
|
|
13
|
-
export { isRetryDateExceeded } from "./utils/dateUtils.js";
|
|
14
|
-
export { toDatePreprocessor } from "./utils/toDateProcessor.js";
|
|
15
|
-
export { reloadConfig, isProduction } from "./utils/envUtils.js";
|
|
2
|
+
export { isMessageError, MessageInvalidFormatError, MessageValidationError, } from "./errors/Errors.js";
|
|
3
|
+
export { RetryMessageLaterError } from "./errors/RetryMessageLaterError.js";
|
|
4
|
+
export * from "./events/baseEventSchemas.js";
|
|
16
5
|
export { DomainEventEmitter } from "./events/DomainEventEmitter.js";
|
|
17
6
|
export { EventRegistry } from "./events/EventRegistry.js";
|
|
18
|
-
export { FakeListener } from "./events/fakes/FakeListener.js";
|
|
19
7
|
export * from "./events/eventTypes.js";
|
|
20
|
-
export
|
|
8
|
+
export { FakeListener } from "./events/fakes/FakeListener.js";
|
|
9
|
+
export * from "./message-deduplication/AcquireLockTimeoutError.js";
|
|
10
|
+
export { DeduplicationRequesterEnum, noopReleasableLock, } from "./message-deduplication/messageDeduplicationTypes.js";
|
|
21
11
|
export * from "./messages/baseMessageSchemas.js";
|
|
22
12
|
export * from "./messages/MetadataFiller.js";
|
|
13
|
+
export { isOffloadedPayloadPointerPayload, OFFLOADED_PAYLOAD_POINTER_PAYLOAD_SCHEMA, PAYLOAD_REF_SCHEMA, } from "./payload-store/offloadedPayloadMessageSchemas.js";
|
|
14
|
+
export { createMultiStoreConfig, isMultiPayloadStoreConfig, } from "./payload-store/payloadStoreTypes.js";
|
|
23
15
|
export * from "./queues/AbstractPublisherManager.js";
|
|
24
|
-
export {
|
|
25
|
-
export {
|
|
26
|
-
export
|
|
16
|
+
export { AbstractQueueService, } from "./queues/AbstractQueueService.js";
|
|
17
|
+
export { HandlerContainer, MessageHandlerConfig, MessageHandlerConfigBuilder, NO_MESSAGE_TYPE_FIELD, } from "./queues/HandlerContainer.js";
|
|
18
|
+
export { HandlerSpy, resolveHandlerSpy, } from "./queues/HandlerSpy.js";
|
|
19
|
+
export { MessageSchemaContainer } from "./queues/MessageSchemaContainer.js";
|
|
20
|
+
export * from "./types/queueOptionsTypes.js";
|
|
21
|
+
export { isRetryDateExceeded } from "./utils/dateUtils.js";
|
|
22
|
+
export { isProduction, reloadConfig } from "./utils/envUtils.js";
|
|
23
|
+
export { isShallowSubset, objectMatches } from "./utils/matchUtils.js";
|
|
24
|
+
export { parseMessage } from "./utils/parseUtils.js";
|
|
25
|
+
export { objectToBuffer } from "./utils/queueUtils.js";
|
|
26
|
+
export { toDatePreprocessor } from "./utils/toDateProcessor.js";
|
|
27
|
+
export { waitAndRetry } from "./utils/waitUtils.js";
|
|
27
28
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AACxE,OAAO,EACL,cAAc,EACd,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAA;AAC3E,cAAc,8BAA8B,CAAA;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,2B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-
import type { AcquireLockTimeoutError } from './AcquireLockTimeoutError.
|
|
3
|
+
import type { AcquireLockTimeoutError } from './AcquireLockTimeoutError.ts';
|
|
4
4
|
export interface ReleasableLock {
|
|
5
5
|
release(): Promise<void>;
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { CONSUMER_BASE_MESSAGE_SCHEMA, CONSUMER_MESSAGE_METADATA_SCHEMA, type CommonMessageDefinitionSchemaType, type ConsumerBaseMessageType, type ConsumerMessageMetadataType, enrichMessageSchemaWithBase, PUBLISHER_BASE_MESSAGE_SCHEMA, PUBLISHER_MESSAGE_METADATA_SCHEMA, type PublisherBaseMessageType, type PublisherMessageMetadataType, } from '@message-queue-toolkit/schemas';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { CONSUMER_BASE_MESSAGE_SCHEMA, CONSUMER_MESSAGE_METADATA_SCHEMA, enrichMessageSchemaWithBase, PUBLISHER_BASE_MESSAGE_SCHEMA, PUBLISHER_MESSAGE_METADATA_SCHEMA, } from '@message-queue-toolkit/schemas';
|
|
2
2
|
//# sourceMappingURL=baseMessageSchemas.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseMessageSchemas.js","sourceRoot":"","sources":["../../lib/messages/baseMessageSchemas.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"baseMessageSchemas.js","sourceRoot":"","sources":["../../lib/messages/baseMessageSchemas.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAC5B,gCAAgC,EAIhC,2BAA2B,EAC3B,6BAA6B,EAC7B,iCAAiC,GAGlC,MAAM,gCAAgC,CAAA"}
|