SubmitMutation

cart · /core·type

Server-action signature that transport layers (Next.js, Remix, tRPC) implement to accept a from the client and return a . Wires the kernel into the framework's action pipeline while keeping the kernel itself framework-agnostic.

Definition

@nordcom/commerce-cart
type SubmitMutation = (envelope: MutationEnvelope) => Promise<CartActionResult<TExt>>;

(envelope: MutationEnvelope) => Promise<CartActionResult<TExt>>

Example

const submitMutation: SubmitMutation = async (envelope) => {
  const cart = await kernel.mutate({ ...ctx, idempotencyKey: envelope.idempotencyKey }, envelope.mutation);
  return { ok: true, cart };
};

RunCartAdapterContractOpts runCartAdapterContract CartCapabilityUnsupportedError CartError CartNotFoundError CartProviderError CartUserError CartAdapter

Sourcetypes.ts:284Edit the JSDoc directly

On this page