Graphorin API reference v0.4.0
Graphorin API reference / @graphorin/provider / / CANONICAL_MIDDLEWARE_ORDER
Variable: CANONICAL_MIDDLEWARE_ORDER
ts
const CANONICAL_MIDDLEWARE_ORDER: readonly string[];Defined in: packages/provider/src/middleware/compose.ts:53
Canonical middleware ordering — outermost → innermost. The table is enforced by composeProviderMiddleware and is part of the provider layer's public contract (DEC-145 / ADR-039).
Why this order
Composition is outermost-first, so a request flows top→bottom and a response flows bottom→top:
withTracingis outermost so the span wraps everything below — including retries — and records true end-to-end latency.withRetrysits above the rate/cost limiters so each retry attempt is independently counted and throttled.withRateLimit→withCostLimit→withCostTrackingform the budget stack: throttle before admitting, reject over-budget calls before spending, then meter what actually went through.withFallbackis just above redaction so a fallback to a secondary provider still passes through the redactor.withRedactionis innermost (closest to the provider) so it is the last thing to touch the outbound payload and the first to touch the inbound stream — guaranteeing every retry, fallback, and cost-tracked request sees an already-redacted payload and no secret can bypass it.