@gigamusic/core
v4.2.0
Published
Pure utilities for the gigamusic platform: pricing math, slugging, JWT helpers, zod input schemas.
Readme
@gigamusic/core
Pure, framework-agnostic utilities shared across the gigamusic platform:
slugging, JWT helpers (signSessionToken / signOrderToken /
signDownloadToken + their verify pairs), bcrypt password hashing, and
zod input schemas for releases and link pages.
No React. No I/O. No process.env access — secrets are passed in as
arguments.
import {
slugify,
signSessionToken,
hashPassword,
ReleaseInputSchema,
} from "@gigamusic/core";Extending input schemas
Every *InputSchema exported from this package is a z.ZodObject. Consumers
extend the validation surface with .extend() and pass the extended schema
to @gigamusic/admin's handler factories via inputSchema:.
import { ReleaseInputSchema } from "@gigamusic/core";
import { z } from "zod";
export const StorefrontReleaseInputSchema = ReleaseInputSchema.extend({
embed: z.string().nullable(),
linkGateUrl: z.string().url().nullable(),
externalUrl: z.string().url().nullable(),
});The admin handler factory then runs validation against the extended shape,
and beforeWrite / afterWrite hooks receive z.infer<typeof
StorefrontReleaseInputSchema> so the consumer can persist the extras inside
the same Drizzle transaction as the gigamusic-managed INSERT/UPDATE.
