CartMiddleware
●cart · /core·type
Higher-order function that wraps a to inject cross-cutting behavior (logging, retrying, tracing). Middleware layers compose into a single pipeline via .
Definition
type CartMiddleware = (next: MutationFn) => MutationFn;(next: MutationFn) => MutationFn
Example
const timestamp: CartMiddleware = (next) => async (mutation, ctx) => {
console.time(mutation.kind);
const result = await next(mutation, ctx);
console.timeEnd(mutation.kind);
return result;
};Related
RunCartAdapterContractOpts runCartAdapterContract CartCapabilityUnsupportedError CartError CartNotFoundError CartProviderError CartUserError CartAdapter
MetadataOpen in GitHub ↗
CartLine
A single line item in a , combining a quantity, merchandise snapshot, and linelevel cost breakdown. The L generic carries optional providerspecific extensions (
CartMutation
Discriminated union of every operation the kernel can route to an adapter. Pass to ; the kernel dispatches on kind to the corresponding adapter method, guarded