feat(core): adds support for extendable message schemas based on the cloudevents spec#52
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates Nimbus message factories and base Zod schemas to support CloudEvents extension attributes (e.g., metadata, authcontext) while adding warnings for invalid extension attribute names per the CloudEvents spec.
Changes:
- Allow unknown/extension attributes to pass validation by switching base
commandSchema/eventSchema/querySchemato loose objects. - Extend
createCommand/createEvent/createQueryinputs to accept extension attributes and pass them through to the created message. - Add shared validation + new unit tests verifying extension passthrough and warning behavior.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/eventsourcingdb/src/lib/eventMapping.ts | Adjusts typing for event creation to align with updated createEvent input typing. |
| packages/core/src/lib/message/message.ts | Introduces shared helper to warn on invalid CloudEvents extension attribute names. |
| packages/core/src/lib/message/command.ts | Enables extension attributes in schema + factory, and adds validation warnings. |
| packages/core/src/lib/message/command.test.ts | Adds tests for extension passthrough, validation, and warning behavior. |
| packages/core/src/lib/message/event.ts | Enables extension attributes in schema + factory, and adds validation warnings. |
| packages/core/src/lib/message/event.test.ts | Adds tests for extension passthrough, validation, and warning behavior. |
| packages/core/src/lib/message/query.ts | Enables extension attributes in schema + factory, and adds validation warnings. |
| packages/core/src/lib/message/query.test.ts | Adds tests for extension passthrough, validation, and warning behavior. |
| examples/eventsourcing-demo/src/write/iam/users/shell/http.ts | Demonstrates passing auth context as an extension attribute in HTTP example. |
| examples/eventsourcing-demo/src/write/iam/users/core/commands/inviteUser.command.ts | Demonstrates extending command schema with an auth context extension attribute. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



No description provided.