Documentation Index
Fetch the complete documentation index at: https://kubo-47e69177.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Products Cart Module
Goal
Keep cart reads/writes isolated by feature while preserving global invalidation behavior.
features/cart/query-keys.ts
import { createFeatureKeys, createFeatureTags } from "@zapaction/core";
export const cartKeys = createFeatureKeys("cart", {
all: () => [],
byUser: (userId: string) => ["by-user", userId]
});
export const cartTags = createFeatureTags("cart", {
byUser: (userId: string) => ["by-user", userId]
});
Action contracts
import { defineAction } from "@zapaction/core";
import { z } from "zod";
export const addToCart = defineAction({
input: z.object({ userId: z.string(), productId: z.string(), qty: z.number().min(1) }),
output: z.object({ ok: z.literal(true) }),
tags: ["cart"],
handler: async () => ({ ok: true })
});
Registry alignment
import { setTagRegistry } from "@zapaction/query";
import { cartKeys } from "../features/cart/query-keys";
setTagRegistry({
cart: [cartKeys.all()]
});