config and plugin

This commit is contained in:
2026-09-12 19:11:44 -04:00
parent 85bcb05a7d
commit 8c40bbeff1
19 changed files with 1685 additions and 86 deletions
+25
View File
@@ -0,0 +1,25 @@
// Thin wrapper around /api/scripts pinned to config-kind artifacts. Both
// overlays (kind='config') and baselines (kind='baseline') share this endpoint
// — the caller sets `kind` in the form (defaults to 'config').
import { GET as scriptsGET, POST as scriptsPOST } from '../scripts/+server.js';
function withDefaultKind(url: URL, fallback: string): URL {
if (!url.searchParams.has('kind')) {
const clone = new URL(url.href);
clone.searchParams.set('kind', fallback);
return clone;
}
return url;
}
export async function GET(event: { url: URL }) {
// Default to listing overlays. Baselines live at /api/configs?kind=baseline.
return scriptsGET({ url: withDefaultKind(event.url, 'config') });
}
export async function POST(event: { request: Request; url: URL }) {
return scriptsPOST({
request: event.request,
url: withDefaultKind(event.url, 'config')
});
}