-
Notifications
You must be signed in to change notification settings - Fork 22
Add automatic message encoding/decoding via codec registry #192
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
Open
baelter
wants to merge
50
commits into
main
Choose a base branch
from
message-codec-registry
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
ef66945
Add automatic message encoding/decoding via codec registry
baelter 2e8dbd7
Add e2e integration tests for codec registry
baelter ff6eeb0
Address PR review feedback
baelter b6b6485
Improve error messages and feature detection
baelter d442966
Bump minimum Node version to 18
baelter 06616f1
Fail fast on misconfigured publish
baelter a50d7ef
Wire codec registry into RPC client and server
baelter 38953ee
Fix TS4111: use AMQPProperties type instead of Record for replyProps
baelter 0264b60
Add type-safe publish overloads and fix unsafe as casts (#193)
baelter 249915f
Fix undefined body guard, decode asymmetry, RPC type holes
baelter 5e79d10
Redesign codec typing with inferred generic and SessionMessage
baelter ba66e7d
Replace boolean generic with CodecMode string literal union
baelter 238cb6b
Replace SessionMessage wrapper with AMQPMessage<CodecMode> generic
baelter a6f04e4
Extract isBody() type guard from inline checks
baelter cb45020
Move CodecMode to amqp-message, reduce public API surface
baelter e623a05
Skip decodeMessage in plain mode, trust the type system
baelter c5b1115
Type publish pipeline with PublishBody<C> instead of unknown
baelter e3f80d7
Replace unknown with PublishBody<C> | Serializable in overload impls
baelter acad8a6
Remove generic from consume-side classes
baelter 21c118d
Fix prettier formatting
baelter b06d0fe
Fix type errors in low-level tests after msg.body became unknown
baelter fe80e98
Keep body as Uint8Array field, add decodedBody for codec output
baelter aae8780
Simplify implementation overload body type to Serializable
baelter 86e418a
Remove Serializable overloads from publish methods
baelter 207b9f4
Rename Serializable to Body, old Body to WireBody
baelter 622c50d
Rename WireBody to PlainBody
baelter cbe578c
Rename PublishBody to Body, make Serializable internal
baelter de5e911
Simplify subscribe callback wrapping in AMQPQueue
baelter 75cacea
Replace callback chaining with single wrapper in subscribe
baelter c6ec8ac
Extract wrapCallback utility from subscribe
baelter 5e9365f
Rename wrapCallback to wrapCallbackWithAutoDecodeAndAck
baelter 8af06fd
Move undefined check into wrapCallbackWithAutoDecodeAndAck
baelter d4e4eb6
Reassign callback instead of creating wrappedCallback
baelter cfe9182
Move decodeMessage into AMQPCodecRegistry, delete amqp-session-messag…
baelter 9ef71e0
Make msg.body the single decoded field, drop _ prefix convention
baelter 9531dbe
Restore property documentation on AMQPMessage as inline JSDoc
baelter 2354772
Add inline JSDoc to all public class fields
baelter bb261b6
Revert eslint config to recommended, remove unneeded disable comments
baelter 7fc6a86
Restore direct reply-to comment in AMQPRPCClient
baelter e422e3f
Move CodecMode from amqp-message to amqp-publisher
baelter 2e347ef
Add compile-time type safety tests for CodecMode generics
baelter e035394
Address review feedback: type-safe RPCHandler, decode-in-try, sync fa…
baelter ef78ea3
Use instanceof AMQPError to distinguish channel-close from decode errors
baelter f18839f
Fix formatting, add CLAUDE.md with pre-commit checks
baelter 6950ba5
Make AMQPMessage generic on CodecMode
baelter bbd9944
Use requeueOnNack for decode errors in generator subscriptions
baelter 4475334
Codec registry refactor (#198)
antondalgren e17645f
Replace codec factory functions with builtin registry constants
baelter 0a2ae91
Accept AMQPExchange handle in AMQPQueue bind/unbind
baelter 492c6c0
Default deliveryMode to 2 (persistent) in publish
baelter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| REVIEWER=copilot | ||
| CRITERIA=.github/copilot-instructions.md | ||
| MODEL=gpt-4.1 |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # amqp-client.js | ||
|
|
||
| AMQP 0-9-1 client library for Node.js and browsers. | ||
|
|
||
| ## Before committing | ||
|
|
||
| Run these checks and fix any issues: | ||
|
|
||
| ```sh | ||
| npm run format:check # prettier | ||
| npm run lint # eslint | ||
| npm run typecheck # tsc --noEmit | ||
| ``` | ||
|
|
||
| To auto-fix formatting: `npm run format` | ||
|
|
||
| ## Testing | ||
|
|
||
| ```sh | ||
| npx vitest run test/<file>.ts # run specific test file | ||
| npm run test:local # run local tests with coverage | ||
| ``` | ||
|
|
||
| Full `npm test` (with coverage for all tests) may OOM — prefer targeted runs. | ||
|
|
||
| ## Project structure | ||
|
|
||
| - `src/` — TypeScript source (ESM) | ||
| - `test/` — vitest tests | ||
| - `lib/` — build output (gitignored) | ||
| - `types/` — generated declarations (gitignored) | ||
|
|
||
| ## Key conventions | ||
|
|
||
| - Prettier for formatting, eslint for linting | ||
| - `CodecMode` generic (`"plain" | "codec"`) threads through session/queue/exchange/rpc classes | ||
| - `AMQPMessage.body` starts as raw bytes, gets replaced by decoded value when codecs are configured | ||
| - `@internal` JSDoc + `stripInternal: true` hides internal API from declarations |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.