feat: add style kit production standards
This commit is contained in:
@@ -158,6 +158,7 @@ import {
|
||||
import { reclaimStorage, requireStorageQuota, storageCleanupPreview, storageSummary } from "./storage.mjs";
|
||||
import { backupSummary, createDatabaseBackup } from "./backup.mjs";
|
||||
import { systemReadiness } from "./readiness.mjs";
|
||||
import { bindProjectStyleKit, createStyleKit, getProjectStyleKit, getStyleKit, listStyleKits, updateStyleKit } from "./style-kits.mjs";
|
||||
import { dispatchNotificationEvent, listUserNotificationPreferences, listUserNotifications, markAllUserNotificationsRead, markUserNotificationRead, notificationDeliveries, updateUserNotificationPreference } from "./notifications.mjs";
|
||||
import { composeProject, listCompositions } from "./composition.mjs";
|
||||
import { listProjectArtifacts, readArtifactContent } from "./media-artifacts.mjs";
|
||||
@@ -1974,6 +1975,18 @@ createServer(async (req, res) => {
|
||||
return send(res, 200, { project: updateProject(context, projectId, await readBody(req)) });
|
||||
}
|
||||
|
||||
const projectStyleKitMatch = pathname.match(/^\/api\/projects\/([^/]+)\/style-kit$/);
|
||||
if (req.method === "GET" && projectStyleKitMatch) {
|
||||
const projectId = decodeURIComponent(projectStyleKitMatch[1]);
|
||||
const context = contextWith({ ...Object.fromEntries(url.searchParams), projectId }, req);
|
||||
return send(res, 200, getProjectStyleKit(context, projectId));
|
||||
}
|
||||
if (req.method === "POST" && projectStyleKitMatch) {
|
||||
const projectId = decodeURIComponent(projectStyleKitMatch[1]);
|
||||
const context = contextWith({ ...Object.fromEntries(url.searchParams), projectId }, req);
|
||||
return send(res, 200, bindProjectStyleKit(context, projectId, await readBody(req)));
|
||||
}
|
||||
|
||||
const projectMemberMatch = pathname.match(/^\/api\/projects\/([^/]+)\/members$/);
|
||||
if (req.method === "GET" && projectMemberMatch) {
|
||||
const context = resolveContext(req.headers, url.searchParams);
|
||||
@@ -2063,6 +2076,31 @@ createServer(async (req, res) => {
|
||||
return send(res, 200, { roles: payload.roles, permissions: payload.permissions, effective: context.permissions });
|
||||
}
|
||||
|
||||
if (req.method === "GET" && pathname === "/api/style-kits") {
|
||||
const context = resolveContext(req.headers, url.searchParams);
|
||||
return send(res, 200, listStyleKits(context, { includeArchived: url.searchParams.get("includeArchived") === "1" }));
|
||||
}
|
||||
|
||||
if (req.method === "POST" && pathname === "/api/style-kits") {
|
||||
const context = resolveContext(req.headers, url.searchParams);
|
||||
return send(res, 201, createStyleKit(context, await readBody(req)));
|
||||
}
|
||||
|
||||
if (req.method === "GET" && pathname === "/api/style-kits/effective") {
|
||||
const context = resolveContext(req.headers, url.searchParams);
|
||||
return send(res, 200, getProjectStyleKit(context, url.searchParams.get("projectId") || ""));
|
||||
}
|
||||
|
||||
const styleKitMatch = pathname.match(/^\/api\/style-kits\/([^/]+)$/);
|
||||
if (req.method === "GET" && styleKitMatch) {
|
||||
const context = resolveContext(req.headers, url.searchParams);
|
||||
return send(res, 200, getStyleKit(context, decodeURIComponent(styleKitMatch[1])));
|
||||
}
|
||||
if (req.method === "PATCH" && styleKitMatch) {
|
||||
const context = resolveContext(req.headers, url.searchParams);
|
||||
return send(res, 200, updateStyleKit(context, decodeURIComponent(styleKitMatch[1]), await readBody(req)));
|
||||
}
|
||||
|
||||
if (req.method === "GET" && pathname === "/api/project") {
|
||||
const context = resolveContext(req.headers, url.searchParams);
|
||||
const { project, jobs } = scopedProjectPayload(context);
|
||||
|
||||
Reference in New Issue
Block a user