CustomMutationHandler
Handler registered on a for a named custom mutation —
an operation with no first-class kernel method. Every name declared in
CartCapabilities.customMutations must map to a handler of this type.
Definition
type CustomMutationHandler = (ctx: AdapterCtx, args: { cartId: string; payload: unknown }) => Promise<Cart<TExt>>;(ctx: AdapterCtx, args: { cartId: string; payload: unknown }) => Promise<Cart<TExt>>
Example
const handler: CustomMutationHandler = async (ctx, { cartId, payload }) => {
const lines = (payload as { variantId: string }[]).map((v) => ({ ...v, quantity: 1 }));
return myAdapter.addLines(ctx, { cartId, lines });
};Related
RunCartAdapterContractOpts runCartAdapterContract CartCapabilityUnsupportedError CartError CartNotFoundError CartProviderError CartUserError CartAdapter
CurrencyCode
ISO 4217 alphabetic currency code (e.g. "USD", "EUR", "JPY"). Used wherever a currency denomination is required in the cart API to ensure currency is always exp
ILogger
Minimal structuredlogging interface threaded through . Adapters and middleware log to this sink rather than console directly so hosts can route output to their