@zapaction/core
v0.2.2
Published
Type-safe Server Action contracts and cache primitives for Next.js 15+
Readme
@zapaction/core
Core contracts for ZapAction.
Install
npm install @zapaction/core zod
# or pnpm/yarn/bunExports
defineActionsetActionContextcreateQueryKeyscreateFeatureKeyscreateFeatureTagsrevalidateTagsconfigureLogger
Feature-first helpers
const todoKeys = createFeatureKeys("todos", {
list: () => [],
detail: (id: string) => [id],
});
const todoTags = createFeatureTags("todos", {
list: () => [],
detail: (id: string) => [id],
});Logging
configureLogger({
enabled: true,
level: "info",
onLog: (event) => console.log(event),
});Notes
defineActionreturns a standard async function.- Errors are passthrough.
setActionContextmust run in a server-only bootstrap.createQueryKeysremains available as the low-level API.
