Skip to content

Commit 32e403c

Browse files
committed
Use shared plugin store package
1 parent 5347e0e commit 32e403c

6 files changed

Lines changed: 43 additions & 183 deletions

File tree

apps/web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
},
1111
"dependencies": {
1212
"@iarna/toml": "^2.2.5",
13-
"@profullstack/pluginstore": "workspace:*",
1413
"@profullstack/autoblog": "github:profullstack/autoblog#f76b7d3",
14+
"@profullstack/pluginstore": "github:profullstack/pluginstore",
1515
"@supabase/supabase-js": "^2.101.1",
1616
"isomorphic-dompurify": "^3.12.0",
1717
"next": "16.2.2",

apps/web/src/app/api/modules/[slug]/install/route.ts

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,13 @@
11
import { NextRequest, NextResponse } from "next/server";
22
import { getSupabaseAdmin } from "@/lib/supabase";
33
import { getAuthenticatedRequestUser } from "@/lib/api-auth";
4-
import { normalizeConfigSchema } from "@profullstack/pluginstore";
4+
import { createPluginInstallPayload } from "@profullstack/pluginstore";
55

66
type RouteContext = { params: Promise<{ slug: string }> };
77

88
const MODULE_INSTALL_COLUMNS =
99
"id, name, slug, version, downloads, git_url, npm_package, tarball_url, min_threatcrush_version, os_support, license, config_schema, config_notes";
1010

11-
function installPayload(mod: {
12-
id?: string;
13-
name: string;
14-
slug: string;
15-
version: string;
16-
downloads?: number | null;
17-
git_url?: string | null;
18-
npm_package?: string | null;
19-
tarball_url?: string | null;
20-
min_threatcrush_version?: string | null;
21-
os_support?: string[] | null;
22-
license?: string | null;
23-
config_schema?: unknown;
24-
config_notes?: string | null;
25-
}) {
26-
return {
27-
name: mod.name,
28-
slug: mod.slug,
29-
version: mod.version,
30-
downloads: mod.downloads || 0,
31-
license: mod.license,
32-
min_threatcrush_version: mod.min_threatcrush_version,
33-
min_version: mod.min_threatcrush_version,
34-
os_support: mod.os_support,
35-
config_schema: normalizeConfigSchema(mod.config_schema),
36-
config_notes: mod.config_notes || null,
37-
install: {
38-
npm_package: mod.npm_package || null,
39-
git_url: mod.git_url || null,
40-
tarball_url: mod.tarball_url || null,
41-
},
42-
};
43-
}
44-
4511
/**
4612
* GET /api/modules/[slug]/install
4713
* Query module install info without incrementing download count.
@@ -65,7 +31,7 @@ export async function GET(
6531
}
6632

6733
return NextResponse.json({
68-
module: installPayload(mod),
34+
module: createPluginInstallPayload(mod),
6935
});
7036
}
7137

@@ -133,6 +99,6 @@ export async function POST(
13399
success: true,
134100
downloads: newCount,
135101
installed: !!user,
136-
module: installPayload({ ...mod, downloads: newCount }),
102+
module: createPluginInstallPayload({ ...mod, downloads: newCount }),
137103
});
138104
}

packages/pluginstore/package.json

Lines changed: 0 additions & 30 deletions
This file was deleted.

packages/pluginstore/src/index.ts

Lines changed: 0 additions & 83 deletions
This file was deleted.

packages/pluginstore/tsconfig.json

Lines changed: 0 additions & 18 deletions
This file was deleted.

pnpm-lock.yaml

Lines changed: 39 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)