Skip to content

Commit

Permalink
Fixing undefined schemaVersion on autofill + test (#196)
Browse files Browse the repository at this point in the history
* Fixing undefined schemaVersion on autofill + test

* core patch release prepare
  • Loading branch information
CarlosGamero authored Jul 27, 2024
1 parent 92a4d14 commit d430976
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
3 changes: 3 additions & 0 deletions packages/core/lib/events/DomainEventEmitter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ describe('AutopilotEventEmitter', () => {
})
expect(fakeListener.receivedEvents[0].metadata).toMatchObject({
correlationId: expect.any(String),
schemaVersion: '1.0.0',
producedBy: 'test',
originatedFrom: 'test',
})
})

Expand Down
15 changes: 6 additions & 9 deletions packages/core/lib/events/DomainEventEmitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,12 @@ export class DomainEventEmitter<SupportedEvents extends CommonEventDefinition[]>
}

if (!data.metadata) {
data.metadata = precedingMessageMetadata
? // @ts-ignore
this.metadataFiller.produceMetadata(data, supportedEvent, precedingMessageMetadata)
: {
correlationId: this.metadataFiller.produceId(),
schemaVersion: supportedEvent.schemaVersion,
producedBy: this.metadataFiller.produceCurrentServiceId(),
originatedFrom: this.metadataFiller.produceCurrentServiceId(),
}
data.metadata = this.metadataFiller.produceMetadata(
// @ts-ignore
data,
supportedEvent,
precedingMessageMetadata ?? {},
)
}

if (!data.metadata.correlationId) {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@message-queue-toolkit/core",
"version": "16.0.0",
"version": "16.0.1",
"private": false,
"license": "MIT",
"description": "Useful utilities, interfaces and base classes for message queue handling. Supports AMQP and SQS with a common abstraction on top currently",
Expand Down

0 comments on commit d430976

Please sign in to comment.