@gigamusic/links
v4.2.0
Published
Editable Linktree-style link pages for gigamusic artist sites. Ships admin API handler factories and platform-detection helpers (the Drizzle schema + queries live in @gigamusic/db).
Readme
@gigamusic/links
Linktree-style per-release link pages for the gigamusic platform. Ships admin API handler factories, platform-detection helpers, and a small SVG LinkPlatformIcon component.
The link_pages / link_page_items Drizzle schema and the link-page queries live in @gigamusic/db — they're folded into the single createQueries(db) so a consumer builds one query object for every table. This package re-exports the link-page row types for convenience.
import {
detectLinkPlatform,
PLATFORM_LABELS,
LinkPlatformIcon,
type KnownLinkPlatform,
type LinkPageWithItems,
} from "@gigamusic/links";
// Admin handler factories live on the /server subpath
import {
createAdminLinkPagesHandlers,
createAdminLinkPageByIdHandlers,
createAdminLinkPageItemsHandlers,
} from "@gigamusic/links/server";Reads and writes
All link-page DB access comes from @gigamusic/db's queries:
import { createQueries } from "@gigamusic/db";
const queries = createQueries(db); // one object, every table
// Public link-page UI — fetch and render whatever you want:
const page = await queries.getPublicLinkPageBySlug(slug);The admin handler factories from @gigamusic/links/server take that same queries object:
const handlers = createAdminLinkPagesHandlers({ queries });Release back-reference
linkPages.releaseId is a nullable FK to releases.id. Both tables and their relations live in @gigamusic/db/schema; linkPagesRelations already declares the linkPage.release direction. If you want a release.linkPages back-reference (for db.query.releases.findFirst({ with: { linkPages: true } })), compose it onto the base releasesRelations in your own schema file:
import { relations } from "drizzle-orm";
import { releases, linkPages } from "@gigamusic/db/schema";
export const releasesRelations = relations(releases, ({ many }) => ({
// ...keep the existing many() relations from @gigamusic/db/schema if you need them...
linkPages: many(linkPages),
}));Because relations are TS modules, you compose them once and never re-apply patches on package upgrades.
