A middleware with its config pre-applied, ready to be passed to pipeline.
Carries its contributions as a record phantom — key-to-type for every key
it puts on ctx — so pipeline can accumulate them onto the handler's ctx
with no manual annotation. A middleware authored with defineMiddleware
contributes a single key and so has a single-entry record; a composite built
with defineComposite carries one entry per part.
SingleKeyEntry spells the one-key case without the braces.
Remarks
__contributes is an optional phantom — it never exists as a value, so it
cannot be required — which means any(handler) => handler structurally
satisfies any Entry. Annotate a function with a record it does not produce
and it compiles, with the keys typed as present and undefined at runtime.
So the no-over-declaring guarantee belongs to defineComposite, which
derives contributions from its parts, not to this type. Build multi-key
contributions with that; reach for a bare Entry annotation only to describe
a function you did not write, and treat it as an assertion you own.
A middleware with its config pre-applied, ready to be passed to pipeline.
Carries its contributions as a record phantom — key-to-type for every key it puts on
ctx— sopipelinecan accumulate them onto the handler'sctxwith no manual annotation. A middleware authored with defineMiddleware contributes a single key and so has a single-entry record; a composite built with defineComposite carries one entry per part.SingleKeyEntry spells the one-key case without the braces.
Remarks
__contributesis an optional phantom — it never exists as a value, so it cannot be required — which means any(handler) => handlerstructurally satisfies anyEntry. Annotate a function with a record it does not produce and it compiles, with the keys typed as present andundefinedat runtime.So the no-over-declaring guarantee belongs to defineComposite, which derives contributions from its parts, not to this type. Build multi-key contributions with that; reach for a bare
Entryannotation only to describe a function you did not write, and treat it as an assertion you own.