@gigamusic/links 2.0.3 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/api/handlers.ts +1 -1
- package/src/api/validation.ts +3 -10
- package/src/queries/link-pages.ts +2 -2
- package/src/schema/index.ts +2 -2
- package/src/schema/relations.ts +1 -1
- package/src/types.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gigamusic/links",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "Editable Linktree-style link pages for gigamusic artist sites. Ships a Drizzle schema, admin API handler factories, and platform-detection helpers.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@gigamusic/core": "1.0.0",
|
|
35
|
-
"@gigamusic/db": "2.0
|
|
35
|
+
"@gigamusic/db": "2.1.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"drizzle-orm": ">=0.45",
|
package/src/api/handlers.ts
CHANGED
|
@@ -68,7 +68,7 @@ export function createAdminLinkPagesHandlers(deps: LinkPagesAdminDeps): {
|
|
|
68
68
|
POST: RouteHandler<Record<string, never>>;
|
|
69
69
|
} {
|
|
70
70
|
return {
|
|
71
|
-
GET: async (
|
|
71
|
+
GET: async (_req) => {
|
|
72
72
|
const pages = await deps.queries.listAllLinkPages();
|
|
73
73
|
return json(pages);
|
|
74
74
|
},
|
package/src/api/validation.ts
CHANGED
|
@@ -5,13 +5,6 @@ export const INVALID_SLUG_MESSAGE =
|
|
|
5
5
|
"Slug must be lowercase letters, numbers, and dashes";
|
|
6
6
|
export const RESERVED_SLUG_MESSAGE = "Slug is reserved";
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* and nests the original pg error under `err.cause`.
|
|
12
|
-
*/
|
|
13
|
-
export function isUniqueConstraintError(err: unknown, depth = 0): boolean {
|
|
14
|
-
if (!err || typeof err !== "object" || depth > 5) return false;
|
|
15
|
-
if ((err as { code?: string }).code === "23505") return true;
|
|
16
|
-
return isUniqueConstraintError((err as { cause?: unknown }).cause, depth + 1);
|
|
17
|
-
}
|
|
8
|
+
// Re-exported from `@gigamusic/db` so existing consumers of
|
|
9
|
+
// `@gigamusic/links`' `isUniqueConstraintError` keep working unchanged.
|
|
10
|
+
export { isUniqueConstraintError } from "@gigamusic/db";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { and, asc, desc, eq, max } from "drizzle-orm";
|
|
2
2
|
import type { NodePgDatabase } from "drizzle-orm/node-postgres";
|
|
3
3
|
import type * as gigamusicDbSchema from "@gigamusic/db/schema";
|
|
4
|
-
import type * as linksSchema from "../schema/index
|
|
5
|
-
import { linkPageItems, linkPages } from "../schema/index
|
|
4
|
+
import type * as linksSchema from "../schema/index";
|
|
5
|
+
import { linkPageItems, linkPages } from "../schema/index";
|
|
6
6
|
import type {
|
|
7
7
|
LinkPage,
|
|
8
8
|
LinkPageInput,
|
package/src/schema/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./link-pages
|
|
2
|
-
export * from "./relations
|
|
1
|
+
export * from "./link-pages";
|
|
2
|
+
export * from "./relations";
|
package/src/schema/relations.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { relations } from "drizzle-orm";
|
|
2
2
|
import { releases } from "@gigamusic/db/schema";
|
|
3
|
-
import { linkPages, linkPageItems } from "./link-pages
|
|
3
|
+
import { linkPages, linkPageItems } from "./link-pages";
|
|
4
4
|
|
|
5
5
|
export const linkPagesRelations = relations(linkPages, ({ one, many }) => ({
|
|
6
6
|
release: one(releases, { fields: [linkPages.releaseId], references: [releases.id] }),
|
package/src/types.ts
CHANGED