Skip to content

Commit d430976

Browse files
authored
Fixing undefined schemaVersion on autofill + test (#196)
* Fixing undefined schemaVersion on autofill + test * core patch release prepare
1 parent 92a4d14 commit d430976

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

packages/core/lib/events/DomainEventEmitter.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ describe('AutopilotEventEmitter', () => {
114114
})
115115
expect(fakeListener.receivedEvents[0].metadata).toMatchObject({
116116
correlationId: expect.any(String),
117+
schemaVersion: '1.0.0',
118+
producedBy: 'test',
119+
originatedFrom: 'test',
117120
})
118121
})
119122

packages/core/lib/events/DomainEventEmitter.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,12 @@ export class DomainEventEmitter<SupportedEvents extends CommonEventDefinition[]>
7272
}
7373

7474
if (!data.metadata) {
75-
data.metadata = precedingMessageMetadata
76-
? // @ts-ignore
77-
this.metadataFiller.produceMetadata(data, supportedEvent, precedingMessageMetadata)
78-
: {
79-
correlationId: this.metadataFiller.produceId(),
80-
schemaVersion: supportedEvent.schemaVersion,
81-
producedBy: this.metadataFiller.produceCurrentServiceId(),
82-
originatedFrom: this.metadataFiller.produceCurrentServiceId(),
83-
}
75+
data.metadata = this.metadataFiller.produceMetadata(
76+
// @ts-ignore
77+
data,
78+
supportedEvent,
79+
precedingMessageMetadata ?? {},
80+
)
8481
}
8582

8683
if (!data.metadata.correlationId) {

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@message-queue-toolkit/core",
3-
"version": "16.0.0",
3+
"version": "16.0.1",
44
"private": false,
55
"license": "MIT",
66
"description": "Useful utilities, interfaces and base classes for message queue handling. Supports AMQP and SQS with a common abstraction on top currently",

0 commit comments

Comments
 (0)