Observed since 20 Oct, 22:00 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
@021.is/spine-actions
Type-safe server-action helper: zod input validation + auth check + audit + auto revalidatePath, returning ResponseDto.
Type-safe server-action helper. Bakes zod input validation + auth + audit + revalidatePath into one wrapper. Always returns ResponseDto<T | null>.
"use server";
import { defineAction } from "@021.is/spine-actions";
import { z } from "zod";
import { requireUser } from "@/lib/auth";
import { publishEvent } from "@/feature/event";
export const publishEventAction = defineAction({
input: z.object({ eventId: z.string().min(1) }),
auth: requireUser,
audit: (input, principal) => ({
action: "event.publish",
targetId: input.eventId,
actorId: principal.sub,
}),
auditor: async (row) => db.audit.create({ data: row }),
revalidate: (input) => [`/events/${input.eventId}`, "/events"],
onRevalidate: revalidatePath,
handler: async ({ input, principal }) => publishEvent(input, { userId: principal.sub }),
}).run;
What the wrapper does in order: parse zod → run auth → run handler → audit on success → call onRevalidate for every returned path → wrap result in ok(...). Any thrown spine-errors exception (BadRequestException, ForbiddenException, etc.) maps to the correct ResponseDto envelope.
400 BadRequest with translation keys, not raw stack tracesawait action.run({ ... }) returns a typed ResponseDto, no Next.js context neededDownload counts and popularity will appear here as the collector receives them.
| Package / target | Requirement | Relationship |
|---|---|---|
@021.is/spine-errorsEnvironment{
"local_name": "@021.is/spine-errors",
"alias": false,
"peer_metadata": null
} | ^0.4.3 | runtime |
zodEnvironment{
"local_name": "zod",
"alias": false,
"peer_metadata": null
} | ^3.23.8 | runtime |
Source distribution
{
"integrity": "sha512-DAV8Qjz3AfiNu9G/FNEZgZDgiruzqnJYsyVFly0xfglF/RprbC4n+ZDa8wwZ4bIW3NWkNYvFAEnJR7MahwaONQ==",
"shasum": "a9a18875f103d5a2db9fc346a877671926126159",
"tarball": "https://registry.npmjs.org/@021.is/spine-actions/-/spine-actions-0.4.3.tgz",
"fileCount": 5,
"unpackedSize": 7730,
"signatures": [
{
"keyid": "SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U",
"sig": "MEQCICi2ccyBdwzX/T0CsIuQeTPh0wELejP1UuPVrhhwmLvcAiB34MngNbv7aycgMomAc45cMEBZBuzQ1mrPWUHpoelbZg=="
}
]
}Observed since 20 Oct, 22:00 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:76570f6ed97a4cf9fe628510200d5cd3480a7dc16bc83797ce993084e47b8ce0