MutationFn
●cart · /core·type
Core mutation primitive: an async function that accepts a and its dispatch context, and returns the resulting cart snapshot.
Definition
type MutationFn = (mutation: CartMutation, ctx: AdapterCtx) => Promise<Cart>;(mutation: CartMutation, ctx: AdapterCtx) => Promise<Cart>
Example
const terminal: MutationFn = async (mutation, ctx) =>
adapter.addLines(ctx, { cartId: ctx.cartId ?? '', lines: [] });Related
RunCartAdapterContractOpts runCartAdapterContract CartCapabilityUnsupportedError CartError CartNotFoundError CartProviderError CartUserError CartAdapter
MetadataOpen in GitHub ↗
MutationEnvelope
Wraps a with an idempotency key for transport across the serveraction boundary. Used by implementations to carry the key alongside the mutation payload.
NewCartLine
Minimal input needed to add a variant to a cart. Passed to createCart or the addline mutation; the adapter expands it into a full using catalog data from the pr