Skip to content

Codec registry refactor#198

Merged
baelter merged 13 commits intomessage-codec-registryfrom
codec-registry-refactor
May 6, 2026
Merged

Codec registry refactor#198
baelter merged 13 commits intomessage-codec-registryfrom
codec-registry-refactor

Conversation

@antondalgren
Copy link
Copy Markdown
Contributor

No description provided.

antondalgren and others added 12 commits March 20, 2026 14:33
- Add createParserRegistry factory with typed ParserMap/Registry
- Add ResolveBody<T, O> helper for content-type → body type cascade
- Default K to never (no default contentType = PlainBody)
- Make AMQPSessionOptions, AMQPSession, AMQPQueue generic on T/K
- Add serializeBody with contentType constrained to parser keys
- Update type-safety tests for ResolveBody and parser-aware queues
- QueuePublishOptions now constrains contentType to registered parsers

Known issues: downstream classes (Exchange, RPC) not yet threaded with T/K

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…nSerializable

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds CoderMap/CoderRegistry types and a createCoderRegistry() factory
parallel to createParserRegistry(), with optional built-in gzip/deflate
coders via the useDefaults flag.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… path

Extract logic from AMQPCodecRegistry into standalone exported functions that
accept ParserRegistry/CoderRegistry objects directly. Returns a sync result
when no coder is involved, or a Promise when encoding/decoding is needed.
Also adds a standalone decodeMessage helper for use in Task 4.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use ParserMap/CoderMap base types for standalone function parameters
instead of ParserRegistry<any>/CoderRegistry<any>. This eliminates
all type casts at call sites and ~20 eslint-disable comments.

ResolveBody now uses InferParserInput<P[O]> instead of structural match.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ence types

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace AMQPCodecRegistry/CodecMode with createCoderRegistry and P/C/KP/KC generics.
Fix serializeBody call, unused properties params, q.publish leftover, and RPC handler return types.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…t config

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@antondalgren antondalgren requested a review from baelter March 23, 2026 06:52
Method shorthand on AMQPParser gives bivariance, so AMQPParser<unknown,
unknown> accepts narrower parsers. Inference helpers use unknown/never
in the slot we discard so eslint no-explicit-any is satisfied without
disable comments.
@baelter baelter marked this pull request as ready for review May 6, 2026 04:55
@baelter baelter merged commit 4475334 into message-codec-registry May 6, 2026
6 checks passed
@baelter baelter deleted the codec-registry-refactor branch May 6, 2026 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants