fix: canonical dispatch, HTTP-only compose, omit from wrap()#170
Merged
brendanjryan merged 2 commits intomainfrom Mar 10, 2026
Merged
fix: canonical dispatch, HTTP-only compose, omit from wrap()#170brendanjryan merged 2 commits intomainfrom
brendanjryan merged 2 commits intomainfrom
Conversation
…omit from wrap() - Store schema-parsed canonical request in _internal instead of raw options so dispatch narrowing works with methods that transform fields (e.g. tempo) - Add chainId to narrowing fields - Runtime guard: compose() throws on non-HTTP transports - Type-level: compose only present when transport extends Transport.Http - Omit compose from wrapped middleware objects (type + runtime) - Update test: compose is omitted from wrapped object
e4bdedc to
e860153
Compare
commit: |
- One-line if/throw for biome formatter - Restore flat fields in _internal (method, defaults, options spread) so proxy service discovery keeps working - Exclude _canonicalRequest from proxy resolvePayment spread
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Follow-up to #166 — addresses code review findings for
compose().Changes
Canonical dispatch fingerprint —
_internalnow stores_canonicalRequestviaPaymentRequest.fromMethod()(the schema-parsed form) instead of raw options. This ensurescompose()dispatch narrowing works correctly with real methods liketempo.chargewhere fields are transformed (e.g.amountnormalized bydecimals).Added
chainIdto the narrowing fields (amount,currency,recipient,chainId).compose()restricted to HTTP transport:composeonly appears onMppxwhentransport extends Transport.Http"compose() only supports HTTP transport"on non-HTTP instancescomposeomitted from wrapped middleware —Wraptype filters it out,wrap()removes it at runtime. Avoids exposing a raw HTTP handler on middleware-shaped objects. Users should useMppx.compose()static instead.Test coverage
compose is omitted from wrapped object