-
Notifications
You must be signed in to change notification settings - Fork 1
feat: support the CloudEvents spec #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for the CloudEvents specification across the Nimbus core package and example apps by introducing validation schemas, updating exports, and aligning handlers and workflows with the new envelope shape.
- Introduce Zod schemas (
mediaType,absoluteUri,CloudEvent) to validate CloudEvent fields. - Update core exports and example handlers/routers to consume and emit CloudEvents envelopes.
- Bump Deno versions, add
ulidfor event IDs, and refresh example imports and README examples.
Reviewed Changes
Copilot reviewed 41 out of 41 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/core/src/lib/cloudEvent/mediaType.ts | Add mediaType Zod schema for MIME type validation |
| packages/core/src/lib/cloudEvent/absoluteUri.ts | Add absoluteUri Zod schema for URI validation |
| packages/core/src/lib/cloudEvent/cloudEvent.ts | Implement generic CloudEvent Zod schema and type alias |
| packages/core/src/index.ts | Export new CloudEvent APIs |
| packages/core/README.md | Add quickstart examples using CloudEvent envelopes |
| examples/the-expense/src/account/shell/queries/listAccounts.handler.ts | Read pagination/filter from data.payload and data.authContext |
| examples/the-expense/src/account/shell/queries/getAccount.handler.ts | Read query ID and authContext from data.payload |
| examples/the-expense/src/account/shell/events/accountAdded.handler.ts | Access event.data.payload and return payload |
| examples/the-expense/src/account/shell/commands/deleteAccount.handler.ts | Use command.data.payload and command.data.authContext |
| examples/the-expense/src/account/shell/commands/addAccount.handler.ts | Generate CloudEvent envelope with ulid, specversion, and data.payload |
| examples/the-expense/src/account/shell/account.router.ts | Rename routes to use CloudEvent type strings |
| examples/the-expense/src/account/shell/account.eventBus.ts | Update subscription key to CloudEvent type |
| examples/the-expense/src/account/core/queries/listAccounts.ts | Change query literal and pass AuthContext directly |
| examples/the-expense/src/account/core/queries/getAccount.ts | Change query literal and pass AuthContext directly |
| examples/the-expense/src/account/core/events/accountAdded.ts | Change event literal and remove metadata wrapper |
| examples/the-expense/src/account/core/commands/deleteAccount.ts | Change command literal and pass AuthContext directly |
| examples/the-expense/src/account/core/commands/addAccount.ts | Change command literal and pass AuthContext directly |
| examples/the-expense/deno.json | Add @std/ulid import for ID generation |
| .github/workflows/publish.yaml | Bump Deno version to v2.3.x |
| .github/workflows/checks.yaml | Bump Deno version to v2.3.x |
Comments suppressed due to low confidence (3)
packages/core/src/lib/cloudEvent/mediaType.ts:16
- Add unit tests for the
mediaTypeschema to cover a variety of valid and invalid MIME types, including edge cases like single-character tokens and quoted parameters.
export const mediaType = z.string().refine((value) => {
packages/core/src/lib/cloudEvent/absoluteUri.ts:7
- Introduce unit tests for the
absoluteUrischema using valid and invalid URIs (e.g., missing scheme, invalid characters) to ensure full RFC-compliance coverage.
export const absoluteUri = z.string().refine((value) => {
packages/core/src/lib/cloudEvent/cloudEvent.ts:53
- [nitpick] The
CloudEventtype alias name conflicts with theCloudEventfactory function. Consider renaming the type alias (e.g.,CloudEventType) to avoid shadowing and improve clarity.
export type CloudEvent<TType, TData> = z.infer<
|

No description provided.