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

@nordcom/commerce-cart

(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;
};

RunCartAdapterContractOpts runCartAdapterContract CartCapabilityUnsupportedError CartError CartNotFoundError CartProviderError CartUserError CartAdapter

Sourcecompose.ts:30Edit the JSDoc directly

On this page