Open-source status page, incident response and uptime monitoring
TypeScript alertingincident-managementmcpmcp-servermonitoringmonitoring-as-codeobservabilityon-callopen-sourcesrestatus-pagestatuspagesynthetic-monitoringterraformtinybirdtursouptimeuptime-checkeruptime-monitor
Status page api (#1800)
Thibault Le Ouay30bc1de08d2e
diff --git a/apps/server/src/routes/rpc/router.ts b/apps/server/src/routes/rpc/router.tsindex b4b83a927..52e332d54 100644--- a/apps/server/src/routes/rpc/router.ts+++ b/apps/server/src/routes/rpc/router.ts@@ -1,6 +1,7 @@import { createConnectRouter } from "@connectrpc/connect";import { HealthService } from "@openstatus/proto/health/v1";import { MonitorService } from "@openstatus/proto/monitor/v1";+import { StatusPageService } from "@openstatus/proto/status_page/v1";import { StatusReportService } from "@openstatus/proto/status_report/v1";import {@@ -11,6 +12,7 @@ import {} from "./interceptors";import { healthServiceImpl } from "./services/health";import { monitorServiceImpl } from "./services/monitor";+import { statusPageServiceImpl } from "./services/status-page";import { statusReportServiceImpl } from "./services/status-report";/**@@ -31,4 +33,5 @@ export const routes = createConnectRouter({}).service(MonitorService, monitorServiceImpl).service(HealthService, healthServiceImpl)- .service(StatusReportService, statusReportServiceImpl);+ .service(StatusReportService, statusReportServiceImpl)+ .service(StatusPageService, statusPageServiceImpl);diff --git a/apps/server/src/routes/rpc/services/status-page/__tests__/status-page.test.ts b/apps/server/src/routes/rpc/services/status-page/__tests__/status-page.test.tsnew file mode 100644index 000000000..e352bc634--- /dev/null+++ b/apps/server/src/routes/rpc/services/status-page/__tests__/status-page.test.ts@@ -0,0 +1,1530 @@+import { afterAll, beforeAll, describe, expect, test } from "bun:test";+import { db, eq } from "@openstatus/db";+import {+ monitor,+ page,+ pageComponent,+ pageComponentGroup,+ pageSubscriber,+ statusReport,+ statusReportsToPageComponents,+} from "@openstatus/db/src/schema";++import { app } from "@/index";++/**+ * Helper to make ConnectRPC requests using the Connect protocol (JSON).+ * Connect uses POST with JSON body at /rpc/<service>/<method>+ */+async function connectRequest(+ method: string,+ body: Record<string, unknown> = {},+ headers: Record<string, string> = {},+) {+ return app.request(+ `/rpc/openstatus.status_page.v1.StatusPageService/${method}`,+ {+ method: "POST",+ headers: {+ "Content-Type": "application/json",+ ...headers,+ },+ body: JSON.stringify(body),+ },+ );+}++const TEST_PREFIX = "rpc-status-page-test";+let testPageId: number;+let testPageSlug: string;+let testPageToDeleteId: number;+let testPageToUpdateId: number;+let testComponentId: number;+let testComponentToDeleteId: number;+let testComponentToUpdateId: number;+let testGroupId: number;+let testGroupToDeleteId: number;+let testGroupToUpdateId: number;+let testMonitorId: number;+let testSubscriberId: number;++beforeAll(async () => {+ // Clean up any existing test data+ await db+ .delete(pageSubscriber)+ .where(eq(pageSubscriber.email, `${TEST_PREFIX}@example.com`));+ await db+ .delete(pageComponent)+ .where(eq(pageComponent.name, `${TEST_PREFIX}-component`));+ await db+ .delete(pageComponent)+ .where(eq(pageComponent.name, `${TEST_PREFIX}-component-to-delete`));+ await db+ .delete(pageComponent)+ .where(eq(pageComponent.name, `${TEST_PREFIX}-component-to-update`));+ await db+ .delete(pageComponentGroup)+ .where(eq(pageComponentGroup.name, `${TEST_PREFIX}-group`));+ await db+ .delete(pageComponentGroup)+ .where(eq(pageComponentGroup.name, `${TEST_PREFIX}-group-to-delete`));+ await db+ .delete(pageComponentGroup)+ .where(eq(pageComponentGroup.name, `${TEST_PREFIX}-group-to-update`));+ await db.delete(page).where(eq(page.slug, `${TEST_PREFIX}-slug`));+ await db.delete(page).where(eq(page.slug, `${TEST_PREFIX}-slug-to-delete`));+ await db.delete(page).where(eq(page.slug, `${TEST_PREFIX}-slug-to-update`));+ await db.delete(monitor).where(eq(monitor.name, `${TEST_PREFIX}-monitor`));++ // Create a test monitor for component tests+ const testMonitor = await db+ .insert(monitor)+ .values({+ workspaceId: 1,+ name: `${TEST_PREFIX}-monitor`,+ url: "https://example.com",+ periodicity: "1m",+ active: true,+ jobType: "http",+ })+ .returning()+ .get();+ testMonitorId = testMonitor.id;++ // Create a test page (published and public for testing public access)+ const testPage = await db+ .insert(page)+ .values({+ workspaceId: 1,+ title: `${TEST_PREFIX}-page`,+ slug: `${TEST_PREFIX}-slug`,+ description: "Test page for status page tests",+ customDomain: "",+ published: true,+ accessType: "public",+ })+ .returning()+ .get();+ testPageId = testPage.id;+ testPageSlug = testPage.slug;++ // Create page to delete+ const pageToDelete = await db+ .insert(page)+ .values({+ workspaceId: 1,+ title: `${TEST_PREFIX}-page-to-delete`,+ slug: `${TEST_PREFIX}-slug-to-delete`,+ description: "Test page to delete",+ customDomain: "",+ })+ .returning()+ .get();+ testPageToDeleteId = pageToDelete.id;++ // Create page to update+ const pageToUpdate = await db+ .insert(page)+ .values({+ workspaceId: 1,+ title: `${TEST_PREFIX}-page-to-update`,+ slug: `${TEST_PREFIX}-slug-to-update`,+ description: "Test page to update",+ customDomain: "",+ })+ .returning()+ .get();+ testPageToUpdateId = pageToUpdate.id;++ // Create a test component group+ const testGroup = await db+ .insert(pageComponentGroup)+ .values({+ workspaceId: 1,+ pageId: testPageId,+ name: `${TEST_PREFIX}-group`,+ })+ .returning()+ .get();+ testGroupId = testGroup.id;++ // Create group to delete+ const groupToDelete = await db+ .insert(pageComponentGroup)+ .values({+ workspaceId: 1,+ pageId: testPageId,+ name: `${TEST_PREFIX}-group-to-delete`,+ })+ .returning()+ .get();+ testGroupToDeleteId = groupToDelete.id;++ // Create group to update+ const groupToUpdate = await db+ .insert(pageComponentGroup)+ .values({+ workspaceId: 1,+ pageId: testPageId,+ name: `${TEST_PREFIX}-group-to-update`,+ })+ .returning()+ .get();+ testGroupToUpdateId = groupToUpdate.id;++ // Create a test component+ const testComponent = await db+ .insert(pageComponent)+ .values({+ workspaceId: 1,+ pageId: testPageId,+ type: "static",+ name: `${TEST_PREFIX}-component`,+ description: "Test component",+ order: 100,+ })+ .returning()+ .get();+ testComponentId = testComponent.id;++ // Create component to delete+ const componentToDelete = await db+ .insert(pageComponent)+ .values({+ workspaceId: 1,+ pageId: testPageId,+ type: "static",+ name: `${TEST_PREFIX}-component-to-delete`,+ description: "Test component to delete",+ order: 101,+ })+ .returning()+ .get();+ testComponentToDeleteId = componentToDelete.id;++ // Create component to update+ const componentToUpdate = await db+ .insert(pageComponent)+ .values({+ workspaceId: 1,+ pageId: testPageId,+ type: "static",+ name: `${TEST_PREFIX}-component-to-update`,+ description: "Test component to update",+ order: 102,+ })+ .returning()+ .get();+ testComponentToUpdateId = componentToUpdate.id;++ // Create a test subscriber+ const testSubscriber = await db+ .insert(pageSubscriber)+ .values({+ pageId: testPageId,+ email: `${TEST_PREFIX}@example.com`,+ token: `${TEST_PREFIX}-token`,+ acceptedAt: new Date(),+ })+ .returning()+ .get();+ testSubscriberId = testSubscriber.id;+});++afterAll(async () => {+ // Clean up test data in proper order+ await db+ .delete(pageSubscriber)+ .where(eq(pageSubscriber.email, `${TEST_PREFIX}@example.com`));+ await db+ .delete(pageSubscriber)+ .where(eq(pageSubscriber.email, `${TEST_PREFIX}[email protected]`));++ await db+ .delete(pageComponent)+ .where(eq(pageComponent.name, `${TEST_PREFIX}-component`));+ await db+ .delete(pageComponent)+ .where(eq(pageComponent.name, `${TEST_PREFIX}-component-to-delete`));+ await db+ .delete(pageComponent)+ .where(eq(pageComponent.name, `${TEST_PREFIX}-component-to-update`));++ await db+ .delete(pageComponentGroup)+ .where(eq(pageComponentGroup.name, `${TEST_PREFIX}-group`));+ await db+ .delete(pageComponentGroup)+ .where(eq(pageComponentGroup.name, `${TEST_PREFIX}-group-to-delete`));+ await db+ .delete(pageComponentGroup)+ .where(eq(pageComponentGroup.name, `${TEST_PREFIX}-group-to-update`));++ await db.delete(page).where(eq(page.slug, `${TEST_PREFIX}-slug`));+ await db.delete(page).where(eq(page.slug, `${TEST_PREFIX}-slug-to-delete`));+ await db.delete(page).where(eq(page.slug, `${TEST_PREFIX}-slug-to-update`));+ await db.delete(page).where(eq(page.slug, `${TEST_PREFIX}-created-slug`));++ await db.delete(monitor).where(eq(monitor.name, `${TEST_PREFIX}-monitor`));+});++// ==========================================================================+// Page CRUD+// ==========================================================================++describe("StatusPageService.CreateStatusPage", () => {+ test("creates a new status page", async () => {+ const res = await connectRequest(+ "CreateStatusPage",+ {+ title: `${TEST_PREFIX}-created`,+ description: "A new test page",+ slug: `${TEST_PREFIX}-created-slug`,+ },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(200);++ const data = await res.json();+ expect(data).toHaveProperty("statusPage");+ expect(data.statusPage.title).toBe(`${TEST_PREFIX}-created`);+ expect(data.statusPage.description).toBe("A new test page");+ expect(data.statusPage.slug).toBe(`${TEST_PREFIX}-created-slug`);++ // Clean up+ await db.delete(page).where(eq(page.id, Number(data.statusPage.id)));+ });++ test("returns 401 when no auth key provided", async () => {+ const res = await connectRequest("CreateStatusPage", {+ title: "Unauthorized test",+ slug: "unauthorized-slug",+ });++ expect(res.status).toBe(401);+ });++ test("returns error when slug already exists", async () => {+ const res = await connectRequest(+ "CreateStatusPage",+ {+ title: "Duplicate slug test",+ slug: testPageSlug, // Already exists+ },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(409); // AlreadyExists+ });++ test("returns 403 when status page limit is exceeded", async () => {+ // Workspace 2 is on free plan with status-pages limit of 1+ // First, create a page for workspace 2 to hit the limit+ const firstPage = await db+ .insert(page)+ .values({+ workspaceId: 2,+ title: `${TEST_PREFIX}-limit-test`,+ slug: `${TEST_PREFIX}-limit-test-slug`,+ description: "First page for limit test",+ customDomain: "",+ })+ .returning()+ .get();++ try {+ // Try to create a second page - should fail with PermissionDenied+ const res = await connectRequest(+ "CreateStatusPage",+ {+ title: `${TEST_PREFIX}-limit-exceeded`,+ description: "Should fail due to limit",+ slug: `${TEST_PREFIX}-limit-exceeded-slug`,+ },+ { "x-openstatus-key": "2" },+ );++ expect(res.status).toBe(403); // PermissionDenied++ const data = await res.json();+ expect(data.message).toContain("Upgrade for more status pages");+ } finally {+ // Clean up+ await db.delete(page).where(eq(page.id, firstPage.id));+ }+ });+});++describe("StatusPageService.GetStatusPage", () => {+ test("returns status page by ID", async () => {+ const res = await connectRequest(+ "GetStatusPage",+ { id: String(testPageId) },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(200);++ const data = await res.json();+ expect(data).toHaveProperty("statusPage");+ expect(data.statusPage.id).toBe(String(testPageId));+ expect(data.statusPage.slug).toBe(testPageSlug);+ });++ test("returns 401 when no auth key provided", async () => {+ const res = await connectRequest("GetStatusPage", {+ id: String(testPageId),+ });++ expect(res.status).toBe(401);+ });++ test("returns 404 for non-existent status page", async () => {+ const res = await connectRequest(+ "GetStatusPage",+ { id: "99999" },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(404);+ });++ test("returns error when ID is empty", async () => {+ const res = await connectRequest(+ "GetStatusPage",+ { id: "" },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(400);+ });++ test("returns 404 for status page in different workspace", async () => {+ // Create page in workspace 2+ const otherPage = await db+ .insert(page)+ .values({+ workspaceId: 2,+ title: `${TEST_PREFIX}-other-workspace`,+ slug: `${TEST_PREFIX}-other-workspace-slug`,+ description: "Other workspace page",+ customDomain: "",+ })+ .returning()+ .get();++ try {+ const res = await connectRequest(+ "GetStatusPage",+ { id: String(otherPage.id) },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(404);+ } finally {+ await db.delete(page).where(eq(page.id, otherPage.id));+ }+ });+});++describe("StatusPageService.ListStatusPages", () => {+ test("returns status pages for authenticated workspace", async () => {+ const res = await connectRequest(+ "ListStatusPages",+ {},+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(200);++ const data = await res.json();+ expect(data).toHaveProperty("statusPages");+ expect(Array.isArray(data.statusPages)).toBe(true);+ expect(data).toHaveProperty("totalSize");+ });++ test("returns 401 when no auth key provided", async () => {+ const res = await connectRequest("ListStatusPages", {});++ expect(res.status).toBe(401);+ });++ test("respects limit parameter", async () => {+ const res = await connectRequest(+ "ListStatusPages",+ { limit: 1 },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(200);++ const data = await res.json();+ expect(data.statusPages?.length || 0).toBeLessThanOrEqual(1);+ });++ test("respects offset parameter", async () => {+ // Get first page+ const res1 = await connectRequest(+ "ListStatusPages",+ { limit: 1, offset: 0 },+ { "x-openstatus-key": "1" },+ );+ const data1 = await res1.json();++ // Get second page+ const res2 = await connectRequest(+ "ListStatusPages",+ { limit: 1, offset: 1 },+ { "x-openstatus-key": "1" },+ );+ const data2 = await res2.json();++ // Should have different pages if multiple exist+ if (data1.statusPages?.length > 0 && data2.statusPages?.length > 0) {+ expect(data1.statusPages[0].id).not.toBe(data2.statusPages[0].id);+ }+ });+});++describe("StatusPageService.UpdateStatusPage", () => {+ test("updates status page title", async () => {+ const res = await connectRequest(+ "UpdateStatusPage",+ {+ id: String(testPageToUpdateId),+ title: `${TEST_PREFIX}-updated-title`,+ },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(200);++ const data = await res.json();+ expect(data).toHaveProperty("statusPage");+ expect(data.statusPage.title).toBe(`${TEST_PREFIX}-updated-title`);++ // Restore original title+ await db+ .update(page)+ .set({ title: `${TEST_PREFIX}-page-to-update` })+ .where(eq(page.id, testPageToUpdateId));+ });++ test("returns 401 when no auth key provided", async () => {+ const res = await connectRequest("UpdateStatusPage", {+ id: String(testPageToUpdateId),+ title: "Unauthorized update",+ });++ expect(res.status).toBe(401);+ });++ test("returns 404 for non-existent status page", async () => {+ const res = await connectRequest(+ "UpdateStatusPage",+ { id: "99999", title: "Non-existent update" },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(404);+ });++ test("returns error when slug conflicts with another page", async () => {+ const res = await connectRequest(+ "UpdateStatusPage",+ {+ id: String(testPageToUpdateId),+ slug: testPageSlug, // Already exists on another page+ },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(409);+ });+});++describe("StatusPageService.DeleteStatusPage", () => {+ test("successfully deletes existing status page", async () => {+ const res = await connectRequest(+ "DeleteStatusPage",+ { id: String(testPageToDeleteId) },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(200);++ const data = await res.json();+ expect(data.success).toBe(true);++ // Verify it's deleted+ const deleted = await db+ .select()+ .from(page)+ .where(eq(page.id, testPageToDeleteId))+ .get();+ expect(deleted).toBeUndefined();+ });++ test("returns 401 when no auth key provided", async () => {+ const res = await connectRequest("DeleteStatusPage", { id: "1" });++ expect(res.status).toBe(401);+ });++ test("returns 404 for non-existent status page", async () => {+ const res = await connectRequest(+ "DeleteStatusPage",+ { id: "99999" },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(404);+ });+});++// ==========================================================================+// Component Management+// ==========================================================================++describe("StatusPageService.AddMonitorComponent", () => {+ test("adds monitor component to page", async () => {+ const res = await connectRequest(+ "AddMonitorComponent",+ {+ pageId: String(testPageId),+ monitorId: String(testMonitorId),+ name: `${TEST_PREFIX}-monitor-component`,+ order: 200,+ },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(200);++ const data = await res.json();+ expect(data).toHaveProperty("component");+ expect(data.component.name).toBe(`${TEST_PREFIX}-monitor-component`);+ expect(data.component.type).toBe("PAGE_COMPONENT_TYPE_MONITOR");+ expect(data.component.monitorId).toBe(String(testMonitorId));++ // Clean up+ await db+ .delete(pageComponent)+ .where(eq(pageComponent.id, Number(data.component.id)));+ });++ test("returns 401 when no auth key provided", async () => {+ const res = await connectRequest("AddMonitorComponent", {+ pageId: String(testPageId),+ monitorId: String(testMonitorId),+ });++ expect(res.status).toBe(401);+ });++ test("returns 404 for non-existent page", async () => {+ const res = await connectRequest(+ "AddMonitorComponent",+ {+ pageId: "99999",+ monitorId: String(testMonitorId),+ },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(404);+ });++ test("returns 404 for non-existent monitor", async () => {+ const res = await connectRequest(+ "AddMonitorComponent",+ {+ pageId: String(testPageId),+ monitorId: "99999",+ },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(404);+ });++ test("adds component with group", async () => {+ const res = await connectRequest(+ "AddMonitorComponent",+ {+ pageId: String(testPageId),+ monitorId: String(testMonitorId),+ name: `${TEST_PREFIX}-monitor-component-grouped`,+ groupId: String(testGroupId),+ },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(200);++ const data = await res.json();+ expect(data.component.groupId).toBe(String(testGroupId));++ // Clean up+ await db+ .delete(pageComponent)+ .where(eq(pageComponent.id, Number(data.component.id)));+ });+});++describe("StatusPageService.AddStaticComponent", () => {+ test("adds static component to page", async () => {+ const res = await connectRequest(+ "AddStaticComponent",+ {+ pageId: String(testPageId),+ name: `${TEST_PREFIX}-static-component`,+ description: "Static service",+ order: 300,+ },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(200);++ const data = await res.json();+ expect(data).toHaveProperty("component");+ expect(data.component.name).toBe(`${TEST_PREFIX}-static-component`);+ expect(data.component.type).toBe("PAGE_COMPONENT_TYPE_STATIC");+ expect(data.component.description).toBe("Static service");++ // Clean up+ await db+ .delete(pageComponent)+ .where(eq(pageComponent.id, Number(data.component.id)));+ });++ test("returns 401 when no auth key provided", async () => {+ const res = await connectRequest("AddStaticComponent", {+ pageId: String(testPageId),+ name: "Unauthorized component",+ });++ expect(res.status).toBe(401);+ });++ test("returns 404 for non-existent page", async () => {+ const res = await connectRequest(+ "AddStaticComponent",+ {+ pageId: "99999",+ name: "Component for non-existent page",+ },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(404);+ });+});++describe("StatusPageService.RemoveComponent", () => {+ test("successfully removes component", async () => {+ const res = await connectRequest(+ "RemoveComponent",+ { id: String(testComponentToDeleteId) },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(200);++ const data = await res.json();+ expect(data.success).toBe(true);++ // Verify it's deleted+ const deleted = await db+ .select()+ .from(pageComponent)+ .where(eq(pageComponent.id, testComponentToDeleteId))+ .get();+ expect(deleted).toBeUndefined();+ });++ test("returns 401 when no auth key provided", async () => {+ const res = await connectRequest("RemoveComponent", { id: "1" });++ expect(res.status).toBe(401);+ });++ test("returns 404 for non-existent component", async () => {+ const res = await connectRequest(+ "RemoveComponent",+ { id: "99999" },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(404);+ });+});++describe("StatusPageService.UpdateComponent", () => {+ test("updates component name", async () => {+ const res = await connectRequest(+ "UpdateComponent",+ {+ id: String(testComponentToUpdateId),+ name: `${TEST_PREFIX}-component-updated`,+ },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(200);++ const data = await res.json();+ expect(data).toHaveProperty("component");+ expect(data.component.name).toBe(`${TEST_PREFIX}-component-updated`);++ // Restore original name+ await db+ .update(pageComponent)+ .set({ name: `${TEST_PREFIX}-component-to-update` })+ .where(eq(pageComponent.id, testComponentToUpdateId));+ });++ test("updates component group", async () => {+ const res = await connectRequest(+ "UpdateComponent",+ {+ id: String(testComponentToUpdateId),+ groupId: String(testGroupId),+ },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(200);++ const data = await res.json();+ expect(data.component.groupId).toBe(String(testGroupId));++ // Remove from group+ await db+ .update(pageComponent)+ .set({ groupId: null })+ .where(eq(pageComponent.id, testComponentToUpdateId));+ });++ test("returns 401 when no auth key provided", async () => {+ const res = await connectRequest("UpdateComponent", {+ id: String(testComponentToUpdateId),+ name: "Unauthorized update",+ });++ expect(res.status).toBe(401);+ });++ test("returns 404 for non-existent component", async () => {+ const res = await connectRequest(+ "UpdateComponent",+ { id: "99999", name: "Non-existent update" },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(404);+ });++ test("returns 404 for non-existent group", async () => {+ const res = await connectRequest(+ "UpdateComponent",+ {+ id: String(testComponentToUpdateId),+ groupId: "99999",+ },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(404);+ });+});++// ==========================================================================+// Component Groups+// ==========================================================================++describe("StatusPageService.CreateComponentGroup", () => {+ test("creates a new component group", async () => {+ const res = await connectRequest(+ "CreateComponentGroup",+ {+ pageId: String(testPageId),+ name: `${TEST_PREFIX}-new-group`,+ },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(200);++ const data = await res.json();+ expect(data).toHaveProperty("group");+ expect(data.group.name).toBe(`${TEST_PREFIX}-new-group`);+ expect(data.group.pageId).toBe(String(testPageId));++ // Clean up+ await db+ .delete(pageComponentGroup)+ .where(eq(pageComponentGroup.id, Number(data.group.id)));+ });++ test("returns 401 when no auth key provided", async () => {+ const res = await connectRequest("CreateComponentGroup", {+ pageId: String(testPageId),+ name: "Unauthorized group",+ });++ expect(res.status).toBe(401);+ });++ test("returns 404 for non-existent page", async () => {+ const res = await connectRequest(+ "CreateComponentGroup",+ {+ pageId: "99999",+ name: "Group for non-existent page",+ },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(404);+ });+});++describe("StatusPageService.DeleteComponentGroup", () => {+ test("successfully deletes component group", async () => {+ const res = await connectRequest(+ "DeleteComponentGroup",+ { id: String(testGroupToDeleteId) },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(200);++ const data = await res.json();+ expect(data.success).toBe(true);++ // Verify it's deleted+ const deleted = await db+ .select()+ .from(pageComponentGroup)+ .where(eq(pageComponentGroup.id, testGroupToDeleteId))+ .get();+ expect(deleted).toBeUndefined();+ });++ test("returns 401 when no auth key provided", async () => {+ const res = await connectRequest("DeleteComponentGroup", { id: "1" });++ expect(res.status).toBe(401);+ });++ test("returns 404 for non-existent group", async () => {+ const res = await connectRequest(+ "DeleteComponentGroup",+ { id: "99999" },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(404);+ });+});++describe("StatusPageService.UpdateComponentGroup", () => {+ test("updates component group name", async () => {+ const res = await connectRequest(+ "UpdateComponentGroup",+ {+ id: String(testGroupToUpdateId),+ name: `${TEST_PREFIX}-group-updated`,+ },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(200);++ const data = await res.json();+ expect(data).toHaveProperty("group");+ expect(data.group.name).toBe(`${TEST_PREFIX}-group-updated`);++ // Restore original name+ await db+ .update(pageComponentGroup)+ .set({ name: `${TEST_PREFIX}-group-to-update` })+ .where(eq(pageComponentGroup.id, testGroupToUpdateId));+ });++ test("returns 401 when no auth key provided", async () => {+ const res = await connectRequest("UpdateComponentGroup", {+ id: String(testGroupToUpdateId),+ name: "Unauthorized update",+ });++ expect(res.status).toBe(401);+ });++ test("returns 404 for non-existent group", async () => {+ const res = await connectRequest(+ "UpdateComponentGroup",+ { id: "99999", name: "Non-existent update" },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(404);+ });+});++// ==========================================================================+// Subscribers+// ==========================================================================++describe("StatusPageService.SubscribeToPage", () => {+ test("subscribes new user to page", async () => {+ const res = await connectRequest(+ "SubscribeToPage",+ {+ pageId: String(testPageId),+ email: `${TEST_PREFIX}[email protected]`,+ },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(200);++ const data = await res.json();+ expect(data).toHaveProperty("subscriber");+ expect(data.subscriber.email).toBe(`${TEST_PREFIX}[email protected]`);+ expect(data.subscriber.pageId).toBe(String(testPageId));++ // Clean up+ await db+ .delete(pageSubscriber)+ .where(eq(pageSubscriber.id, Number(data.subscriber.id)));+ });++ test("returns existing subscriber when already subscribed", async () => {+ const res = await connectRequest(+ "SubscribeToPage",+ {+ pageId: String(testPageId),+ email: `${TEST_PREFIX}@example.com`, // Already exists+ },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(200);++ const data = await res.json();+ expect(data).toHaveProperty("subscriber");+ expect(data.subscriber.id).toBe(String(testSubscriberId));+ });++ test("returns 401 when no auth key provided", async () => {+ const res = await connectRequest("SubscribeToPage", {+ pageId: String(testPageId),+ email: "[email protected]",+ });++ expect(res.status).toBe(401);+ });++ test("returns 404 for non-existent page", async () => {+ const res = await connectRequest(+ "SubscribeToPage",+ {+ pageId: "99999",+ email: "[email protected]",+ },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(404);+ });+});++describe("StatusPageService.UnsubscribeFromPage", () => {+ test("unsubscribes by email", async () => {+ // First subscribe a new user+ const subscribeRes = await connectRequest(+ "SubscribeToPage",+ {+ pageId: String(testPageId),+ email: `${TEST_PREFIX}[email protected]`,+ },+ { "x-openstatus-key": "1" },+ );+ const subscribeData = await subscribeRes.json();++ // Then unsubscribe+ const res = await connectRequest(+ "UnsubscribeFromPage",+ {+ pageId: String(testPageId),+ email: `${TEST_PREFIX}[email protected]`,+ },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(200);++ const data = await res.json();+ expect(data.success).toBe(true);++ // Verify unsubscribedAt is set+ const subscriber = await db+ .select()+ .from(pageSubscriber)+ .where(eq(pageSubscriber.id, Number(subscribeData.subscriber.id)))+ .get();+ expect(subscriber?.unsubscribedAt).not.toBeNull();++ // Clean up+ await db+ .delete(pageSubscriber)+ .where(eq(pageSubscriber.id, Number(subscribeData.subscriber.id)));+ });++ test("unsubscribes by id", async () => {+ // First subscribe a new user+ const subscribeRes = await connectRequest(+ "SubscribeToPage",+ {+ pageId: String(testPageId),+ email: `${TEST_PREFIX}[email protected]`,+ },+ { "x-openstatus-key": "1" },+ );+ const subscribeData = await subscribeRes.json();++ // Then unsubscribe by id+ const res = await connectRequest(+ "UnsubscribeFromPage",+ {+ pageId: String(testPageId),+ id: subscribeData.subscriber.id,+ },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(200);++ const data = await res.json();+ expect(data.success).toBe(true);++ // Clean up+ await db+ .delete(pageSubscriber)+ .where(eq(pageSubscriber.id, Number(subscribeData.subscriber.id)));+ });++ test("returns 401 when no auth key provided", async () => {+ const res = await connectRequest("UnsubscribeFromPage", {+ pageId: String(testPageId),+ email: "[email protected]",+ });++ expect(res.status).toBe(401);+ });++ test("returns 404 for non-existent subscriber", async () => {+ const res = await connectRequest(+ "UnsubscribeFromPage",+ {+ pageId: String(testPageId),+ email: "[email protected]",+ },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(404);+ });++ test("returns error when no identifier provided", async () => {+ const res = await connectRequest(+ "UnsubscribeFromPage",+ {+ pageId: String(testPageId),+ },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(400);+ });+});++describe("StatusPageService.ListSubscribers", () => {+ test("returns subscribers for page", async () => {+ const res = await connectRequest(+ "ListSubscribers",+ { pageId: String(testPageId) },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(200);++ const data = await res.json();+ expect(data).toHaveProperty("subscribers");+ expect(Array.isArray(data.subscribers)).toBe(true);+ expect(data).toHaveProperty("totalSize");+ });++ test("returns 401 when no auth key provided", async () => {+ const res = await connectRequest("ListSubscribers", {+ pageId: String(testPageId),+ });++ expect(res.status).toBe(401);+ });++ test("returns 404 for non-existent page", async () => {+ const res = await connectRequest(+ "ListSubscribers",+ { pageId: "99999" },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(404);+ });++ test("filters out unsubscribed by default", async () => {+ // Create an unsubscribed subscriber+ const unsubscriber = await db+ .insert(pageSubscriber)+ .values({+ pageId: testPageId,+ email: `${TEST_PREFIX}[email protected]`,+ token: `${TEST_PREFIX}-unsubbed-token`,+ unsubscribedAt: new Date(),+ })+ .returning()+ .get();++ try {+ const res = await connectRequest(+ "ListSubscribers",+ { pageId: String(testPageId) },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(200);++ const data = await res.json();+ const subscriberEmails = (data.subscribers || []).map(+ (s: { email: string }) => s.email,+ );+ expect(subscriberEmails).not.toContain(+ `${TEST_PREFIX}[email protected]`,+ );+ } finally {+ await db+ .delete(pageSubscriber)+ .where(eq(pageSubscriber.id, unsubscriber.id));+ }+ });++ test("includes unsubscribed when flag is true", async () => {+ // Create an unsubscribed subscriber+ const unsubscriber = await db+ .insert(pageSubscriber)+ .values({+ pageId: testPageId,+ email: `${TEST_PREFIX}[email protected]`,+ token: `${TEST_PREFIX}-unsubbed2-token`,+ unsubscribedAt: new Date(),+ })+ .returning()+ .get();++ try {+ const res = await connectRequest(+ "ListSubscribers",+ { pageId: String(testPageId), includeUnsubscribed: true },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(200);++ const data = await res.json();+ const subscriberEmails = (data.subscribers || []).map(+ (s: { email: string }) => s.email,+ );+ expect(subscriberEmails).toContain(+ `${TEST_PREFIX}[email protected]`,+ );+ } finally {+ await db+ .delete(pageSubscriber)+ .where(eq(pageSubscriber.id, unsubscriber.id));+ }+ });+});++// ==========================================================================+// Full Content & Status+// ==========================================================================++describe("StatusPageService.GetStatusPageContent", () => {+ test("returns full content by ID", async () => {+ const res = await connectRequest(+ "GetStatusPageContent",+ { id: String(testPageId) },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(200);++ const data = await res.json();+ expect(data).toHaveProperty("statusPage");+ expect(data).toHaveProperty("components");+ expect(data).toHaveProperty("groups");+ // statusReports may be undefined/empty if there are no active reports+ expect(data.statusPage.id).toBe(String(testPageId));+ });++ test("returns full content by slug", async () => {+ const res = await connectRequest(+ "GetStatusPageContent",+ { slug: testPageSlug },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(200);++ const data = await res.json();+ expect(data).toHaveProperty("statusPage");+ expect(data.statusPage.slug).toBe(testPageSlug);+ });++ test("returns 401 when no auth key provided", async () => {+ const res = await connectRequest("GetStatusPageContent", {+ id: String(testPageId),+ });++ expect(res.status).toBe(401);+ });++ test("returns 404 for non-existent page", async () => {+ const res = await connectRequest(+ "GetStatusPageContent",+ { id: "99999" },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(404);+ });++ test("returns 404 for unpublished page accessed by slug", async () => {+ // Create an unpublished page+ const unpublishedPage = await db+ .insert(page)+ .values({+ workspaceId: 1,+ title: `${TEST_PREFIX}-unpublished`,+ slug: `${TEST_PREFIX}-unpublished-slug`,+ description: "Unpublished page",+ customDomain: "",+ published: false,+ accessType: "public",+ })+ .returning()+ .get();++ try {+ const res = await connectRequest(+ "GetStatusPageContent",+ { slug: unpublishedPage.slug },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(404);+ } finally {+ await db.delete(page).where(eq(page.id, unpublishedPage.id));+ }+ });++ test("returns 403 for password-protected page accessed by slug", async () => {+ // Create a password-protected page+ const protectedPage = await db+ .insert(page)+ .values({+ workspaceId: 1,+ title: `${TEST_PREFIX}-protected`,+ slug: `${TEST_PREFIX}-protected-slug`,+ description: "Password protected page",+ customDomain: "",+ published: true,+ accessType: "password",+ })+ .returning()+ .get();++ try {+ const res = await connectRequest(+ "GetStatusPageContent",+ { slug: protectedPage.slug },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(403);+ } finally {+ await db.delete(page).where(eq(page.id, protectedPage.id));+ }+ });++ test("allows workspace owner to access unpublished page by ID", async () => {+ // Create an unpublished page+ const unpublishedPage = await db+ .insert(page)+ .values({+ workspaceId: 1,+ title: `${TEST_PREFIX}-unpublished-by-id`,+ slug: `${TEST_PREFIX}-unpublished-by-id-slug`,+ description: "Unpublished page accessible by ID",+ customDomain: "",+ published: false,+ accessType: "public",+ })+ .returning()+ .get();++ try {+ const res = await connectRequest(+ "GetStatusPageContent",+ { id: String(unpublishedPage.id) },+ { "x-openstatus-key": "1" },+ );++ // Workspace owner can access their own unpublished pages by ID+ expect(res.status).toBe(200);+ } finally {+ await db.delete(page).where(eq(page.id, unpublishedPage.id));+ }+ });++ test("includes active status reports", async () => {+ // Create an active status report for the test page+ const report = await db+ .insert(statusReport)+ .values({+ workspaceId: 1,+ pageId: testPageId,+ title: `${TEST_PREFIX}-active-report`,+ status: "investigating",+ })+ .returning()+ .get();++ await db.insert(statusReportsToPageComponents).values({+ statusReportId: report.id,+ pageComponentId: testComponentId,+ });++ try {+ const res = await connectRequest(+ "GetStatusPageContent",+ { id: String(testPageId) },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(200);++ const data = await res.json();+ expect(data.statusReports.length).toBeGreaterThan(0);++ const testReport = data.statusReports.find(+ (r: { title: string }) => r.title === `${TEST_PREFIX}-active-report`,+ );+ expect(testReport).toBeDefined();+ } finally {+ await db+ .delete(statusReportsToPageComponents)+ .where(eq(statusReportsToPageComponents.statusReportId, report.id));+ await db.delete(statusReport).where(eq(statusReport.id, report.id));+ }+ });+});++describe("StatusPageService.GetOverallStatus", () => {+ test("returns overall status by ID", async () => {+ const res = await connectRequest(+ "GetOverallStatus",+ { id: String(testPageId) },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(200);++ const data = await res.json();+ expect(data).toHaveProperty("overallStatus");+ expect(data).toHaveProperty("componentStatuses");+ });++ test("returns overall status by slug", async () => {+ const res = await connectRequest(+ "GetOverallStatus",+ { slug: testPageSlug },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(200);++ const data = await res.json();+ expect(data).toHaveProperty("overallStatus");+ });++ test("returns 401 when no auth key provided", async () => {+ const res = await connectRequest("GetOverallStatus", {+ id: String(testPageId),+ });++ expect(res.status).toBe(401);+ });++ test("returns 404 for non-existent page", async () => {+ const res = await connectRequest(+ "GetOverallStatus",+ { id: "99999" },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(404);+ });++ test("returns degraded status when there are active incidents", async () => {+ // Create an active status report for the test page+ const report = await db+ .insert(statusReport)+ .values({+ workspaceId: 1,+ pageId: testPageId,+ title: `${TEST_PREFIX}-incident-report`,+ status: "investigating",+ })+ .returning()+ .get();++ await db.insert(statusReportsToPageComponents).values({+ statusReportId: report.id,+ pageComponentId: testComponentId,+ });++ try {+ const res = await connectRequest(+ "GetOverallStatus",+ { id: String(testPageId) },+ { "x-openstatus-key": "1" },+ );++ expect(res.status).toBe(200);++ const data = await res.json();+ expect(data.overallStatus).toBe("OVERALL_STATUS_DEGRADED");+ } finally {+ await db+ .delete(statusReportsToPageComponents)+ .where(eq(statusReportsToPageComponents.statusReportId, report.id));+ await db.delete(statusReport).where(eq(statusReport.id, report.id));+ }+ });+});diff --git a/apps/server/src/routes/rpc/services/status-page/converters.ts b/apps/server/src/routes/rpc/services/status-page/converters.tsnew file mode 100644index 000000000..32c7711e8--- /dev/null+++ b/apps/server/src/routes/rpc/services/status-page/converters.ts@@ -0,0 +1,266 @@+import type {+ PageComponent,+ PageComponentGroup,+ PageSubscriber,+ StatusPage,+ StatusPageSummary,+} from "@openstatus/proto/status_page/v1";+import {+ OverallStatus,+ PageAccessType,+ PageComponentType,+ PageTheme,+} from "@openstatus/proto/status_page/v1";++/**+ * Database types+ */+type DBPage = {+ id: number;+ title: string;+ description: string;+ slug: string;+ customDomain: string;+ published: boolean | null;+ forceTheme: "system" | "light" | "dark";+ accessType: "public" | "password" | "email-domain" | null;+ homepageUrl: string | null;+ contactUrl: string | null;+ icon: string | null;+ createdAt: Date | null;+ updatedAt: Date | null;+};++type DBPageComponent = {+ id: number;+ pageId: number;+ name: string;+ description: string | null;+ type: "static" | "monitor";+ monitorId: number | null;+ order: number | null;+ groupId: number | null;+ groupOrder: number | null;+ createdAt: Date | null;+ updatedAt: Date | null;+};++type DBPageComponentGroup = {+ id: number;+ pageId: number;+ name: string;+ createdAt: Date | null;+ updatedAt: Date | null;+};++type DBPageSubscriber = {+ id: number;+ pageId: number;+ email: string;+ acceptedAt: Date | null;+ unsubscribedAt: Date | null;+ createdAt: Date | null;+ updatedAt: Date | null;+};++/**+ * Convert DB access type string to proto enum.+ */+export function dbAccessTypeToProto(+ accessType: "public" | "password" | "email-domain" | null,+): PageAccessType {+ switch (accessType) {+ case "public":+ return PageAccessType.PUBLIC;+ case "password":+ return PageAccessType.PASSWORD_PROTECTED;+ case "email-domain":+ return PageAccessType.AUTHENTICATED;+ default:+ return PageAccessType.PUBLIC;+ }+}++/**+ * Convert proto access type enum to DB string.+ */+export function protoAccessTypeToDb(+ accessType: PageAccessType,+): "public" | "password" | "email-domain" {+ switch (accessType) {+ case PageAccessType.PUBLIC:+ return "public";+ case PageAccessType.PASSWORD_PROTECTED:+ return "password";+ case PageAccessType.AUTHENTICATED:+ return "email-domain";+ default:+ return "public";+ }+}++/**+ * Convert DB theme string to proto enum.+ */+export function dbThemeToProto(theme: "system" | "light" | "dark"): PageTheme {+ switch (theme) {+ case "system":+ return PageTheme.SYSTEM;+ case "light":+ return PageTheme.LIGHT;+ case "dark":+ return PageTheme.DARK;+ default:+ return PageTheme.SYSTEM;+ }+}++/**+ * Convert proto theme enum to DB string.+ */+export function protoThemeToDb(theme: PageTheme): "system" | "light" | "dark" {+ switch (theme) {+ case PageTheme.SYSTEM:+ return "system";+ case PageTheme.LIGHT:+ return "light";+ case PageTheme.DARK:+ return "dark";+ default:+ return "system";+ }+}++/**+ * Convert DB component type string to proto enum.+ */+export function dbComponentTypeToProto(+ type: "static" | "monitor",+): PageComponentType {+ switch (type) {+ case "monitor":+ return PageComponentType.MONITOR;+ case "static":+ return PageComponentType.STATIC;+ default:+ return PageComponentType.UNSPECIFIED;+ }+}++/**+ * Convert proto component type enum to DB string.+ */+export function protoComponentTypeToDb(+ type: PageComponentType,+): "static" | "monitor" {+ switch (type) {+ case PageComponentType.MONITOR:+ return "monitor";+ case PageComponentType.STATIC:+ return "static";+ default:+ return "static";+ }+}++/**+ * Convert a DB status page to full proto format.+ */+export function dbPageToProto(page: DBPage): StatusPage {+ return {+ $typeName: "openstatus.status_page.v1.StatusPage" as const,+ id: String(page.id),+ title: page.title,+ description: page.description,+ slug: page.slug,+ customDomain: page.customDomain ?? "",+ published: page.published ?? false,+ accessType: dbAccessTypeToProto(page.accessType),+ theme: dbThemeToProto(page.forceTheme),+ homepageUrl: page.homepageUrl ?? "",+ contactUrl: page.contactUrl ?? "",+ icon: page.icon ?? "",+ createdAt: page.createdAt?.toISOString() ?? "",+ updatedAt: page.updatedAt?.toISOString() ?? "",+ };+}++/**+ * Convert a DB status page to summary proto format.+ */+export function dbPageToProtoSummary(page: DBPage): StatusPageSummary {+ return {+ $typeName: "openstatus.status_page.v1.StatusPageSummary" as const,+ id: String(page.id),+ title: page.title,+ slug: page.slug,+ published: page.published ?? false,+ createdAt: page.createdAt?.toISOString() ?? "",+ updatedAt: page.updatedAt?.toISOString() ?? "",+ };+}++/**+ * Convert a DB page component to proto format.+ */+export function dbComponentToProto(component: DBPageComponent): PageComponent {+ return {+ $typeName: "openstatus.status_page.v1.PageComponent" as const,+ id: String(component.id),+ pageId: String(component.pageId),+ name: component.name,+ description: component.description ?? "",+ type: dbComponentTypeToProto(component.type),+ monitorId: component.monitorId != null ? String(component.monitorId) : "",+ order: component.order ?? 0,+ groupId: component.groupId != null ? String(component.groupId) : "",+ groupOrder: component.groupOrder ?? 0,+ createdAt: component.createdAt?.toISOString() ?? "",+ updatedAt: component.updatedAt?.toISOString() ?? "",+ };+}++/**+ * Convert a DB component group to proto format.+ */+export function dbGroupToProto(+ group: DBPageComponentGroup,+): PageComponentGroup {+ return {+ $typeName: "openstatus.status_page.v1.PageComponentGroup" as const,+ id: String(group.id),+ pageId: String(group.pageId),+ name: group.name,+ createdAt: group.createdAt?.toISOString() ?? "",+ updatedAt: group.updatedAt?.toISOString() ?? "",+ };+}++/**+ * Convert a DB subscriber to proto format.+ */+export function dbSubscriberToProto(+ subscriber: DBPageSubscriber,+): PageSubscriber {+ return {+ $typeName: "openstatus.status_page.v1.PageSubscriber" as const,+ id: String(subscriber.id),+ pageId: String(subscriber.pageId),+ email: subscriber.email,+ acceptedAt: subscriber.acceptedAt?.toISOString() ?? "",+ unsubscribedAt: subscriber.unsubscribedAt?.toISOString() ?? "",+ createdAt: subscriber.createdAt?.toISOString() ?? "",+ updatedAt: subscriber.updatedAt?.toISOString() ?? "",+ };+}++/**+ * Get overall status based on component statuses.+ * This is a placeholder - the actual implementation would look at+ * monitor statuses, active incidents, and maintenance windows.+ */+export function getOverallStatusValue(): OverallStatus {+ // Default to operational - in a real implementation this would+ // aggregate status from monitors and incidents+ return OverallStatus.OPERATIONAL;+}diff --git a/apps/server/src/routes/rpc/services/status-page/errors.ts b/apps/server/src/routes/rpc/services/status-page/errors.tsnew file mode 100644index 000000000..9fce592a5--- /dev/null+++ b/apps/server/src/routes/rpc/services/status-page/errors.ts@@ -0,0 +1,256 @@+import { Code, ConnectError } from "@connectrpc/connect";++/**+ * Error reasons for structured error handling.+ */+export const ErrorReason = {+ STATUS_PAGE_NOT_FOUND: "STATUS_PAGE_NOT_FOUND",+ STATUS_PAGE_ID_REQUIRED: "STATUS_PAGE_ID_REQUIRED",+ STATUS_PAGE_CREATE_FAILED: "STATUS_PAGE_CREATE_FAILED",+ STATUS_PAGE_UPDATE_FAILED: "STATUS_PAGE_UPDATE_FAILED",+ STATUS_PAGE_NOT_PUBLISHED: "STATUS_PAGE_NOT_PUBLISHED",+ STATUS_PAGE_ACCESS_DENIED: "STATUS_PAGE_ACCESS_DENIED",+ SLUG_ALREADY_EXISTS: "SLUG_ALREADY_EXISTS",+ PAGE_COMPONENT_NOT_FOUND: "PAGE_COMPONENT_NOT_FOUND",+ PAGE_COMPONENT_CREATE_FAILED: "PAGE_COMPONENT_CREATE_FAILED",+ PAGE_COMPONENT_UPDATE_FAILED: "PAGE_COMPONENT_UPDATE_FAILED",+ COMPONENT_GROUP_NOT_FOUND: "COMPONENT_GROUP_NOT_FOUND",+ COMPONENT_GROUP_CREATE_FAILED: "COMPONENT_GROUP_CREATE_FAILED",+ COMPONENT_GROUP_UPDATE_FAILED: "COMPONENT_GROUP_UPDATE_FAILED",+ MONITOR_NOT_FOUND: "MONITOR_NOT_FOUND",+ SUBSCRIBER_NOT_FOUND: "SUBSCRIBER_NOT_FOUND",+ SUBSCRIBER_CREATE_FAILED: "SUBSCRIBER_CREATE_FAILED",+ IDENTIFIER_REQUIRED: "IDENTIFIER_REQUIRED",+} as const;++export type ErrorReason = (typeof ErrorReason)[keyof typeof ErrorReason];++const DOMAIN = "openstatus.dev";++/**+ * Creates a ConnectError with structured metadata.+ */+function createError(+ message: string,+ code: Code,+ reason: ErrorReason,+ metadata?: Record<string, string>,+): ConnectError {+ const headers = new Headers({+ "error-domain": DOMAIN,+ "error-reason": reason,+ });++ if (metadata) {+ for (const [key, value] of Object.entries(metadata)) {+ headers.set(`error-${key}`, value);+ }+ }++ return new ConnectError(message, code, headers);+}++/**+ * Creates a "status page not found" error.+ */+export function statusPageNotFoundError(pageId: string): ConnectError {+ return createError(+ "Status page not found",+ Code.NotFound,+ ErrorReason.STATUS_PAGE_NOT_FOUND,+ { "page-id": pageId },+ );+}++/**+ * Creates a "status page ID required" error.+ */+export function statusPageIdRequiredError(): ConnectError {+ return createError(+ "Status page ID is required",+ Code.InvalidArgument,+ ErrorReason.STATUS_PAGE_ID_REQUIRED,+ );+}++/**+ * Creates a "failed to create status page" error.+ */+export function statusPageCreateFailedError(): ConnectError {+ return createError(+ "Failed to create status page",+ Code.Internal,+ ErrorReason.STATUS_PAGE_CREATE_FAILED,+ );+}++/**+ * Creates a "failed to update status page" error.+ */+export function statusPageUpdateFailedError(pageId: string): ConnectError {+ return createError(+ "Failed to update status page",+ Code.Internal,+ ErrorReason.STATUS_PAGE_UPDATE_FAILED,+ { "page-id": pageId },+ );+}++/**+ * Creates a "slug already exists" error.+ */+export function slugAlreadyExistsError(slug: string): ConnectError {+ return createError(+ "A status page with this slug already exists",+ Code.AlreadyExists,+ ErrorReason.SLUG_ALREADY_EXISTS,+ { slug },+ );+}++/**+ * Creates a "status page not published" error.+ * Used when trying to access an unpublished page via public slug.+ */+export function statusPageNotPublishedError(slug: string): ConnectError {+ return createError(+ "Status page is not published",+ Code.NotFound,+ ErrorReason.STATUS_PAGE_NOT_PUBLISHED,+ { slug },+ );+}++/**+ * Creates a "status page access denied" error.+ * Used when trying to access a protected page without proper authentication.+ */+export function statusPageAccessDeniedError(+ slug: string,+ accessType: string,+): ConnectError {+ return createError(+ `Status page requires ${accessType} access`,+ Code.PermissionDenied,+ ErrorReason.STATUS_PAGE_ACCESS_DENIED,+ { slug, "access-type": accessType },+ );+}++/**+ * Creates a "page component not found" error.+ */+export function pageComponentNotFoundError(componentId: string): ConnectError {+ return createError(+ "Page component not found",+ Code.NotFound,+ ErrorReason.PAGE_COMPONENT_NOT_FOUND,+ { "component-id": componentId },+ );+}++/**+ * Creates a "failed to create page component" error.+ */+export function pageComponentCreateFailedError(): ConnectError {+ return createError(+ "Failed to create page component",+ Code.Internal,+ ErrorReason.PAGE_COMPONENT_CREATE_FAILED,+ );+}++/**+ * Creates a "failed to update page component" error.+ */+export function pageComponentUpdateFailedError(+ componentId: string,+): ConnectError {+ return createError(+ "Failed to update page component",+ Code.Internal,+ ErrorReason.PAGE_COMPONENT_UPDATE_FAILED,+ { "component-id": componentId },+ );+}++/**+ * Creates a "component group not found" error.+ */+export function componentGroupNotFoundError(groupId: string): ConnectError {+ return createError(+ "Component group not found",+ Code.NotFound,+ ErrorReason.COMPONENT_GROUP_NOT_FOUND,+ { "group-id": groupId },+ );+}++/**+ * Creates a "failed to create component group" error.+ */+export function componentGroupCreateFailedError(): ConnectError {+ return createError(+ "Failed to create component group",+ Code.Internal,+ ErrorReason.COMPONENT_GROUP_CREATE_FAILED,+ );+}++/**+ * Creates a "failed to update component group" error.+ */+export function componentGroupUpdateFailedError(groupId: string): ConnectError {+ return createError(+ "Failed to update component group",+ Code.Internal,+ ErrorReason.COMPONENT_GROUP_UPDATE_FAILED,+ { "group-id": groupId },+ );+}++/**+ * Creates a "monitor not found" error.+ */+export function monitorNotFoundError(monitorId: string): ConnectError {+ return createError(+ "Monitor not found",+ Code.NotFound,+ ErrorReason.MONITOR_NOT_FOUND,+ { "monitor-id": monitorId },+ );+}++/**+ * Creates a "subscriber not found" error.+ */+export function subscriberNotFoundError(identifier: string): ConnectError {+ return createError(+ "Subscriber not found",+ Code.NotFound,+ ErrorReason.SUBSCRIBER_NOT_FOUND,+ { identifier },+ );+}++/**+ * Creates a "failed to create subscriber" error.+ */+export function subscriberCreateFailedError(): ConnectError {+ return createError(+ "Failed to create subscriber",+ Code.Internal,+ ErrorReason.SUBSCRIBER_CREATE_FAILED,+ );+}++/**+ * Creates an "identifier required" error.+ */+export function identifierRequiredError(): ConnectError {+ return createError(+ "Either email or token is required to identify the subscriber",+ Code.InvalidArgument,+ ErrorReason.IDENTIFIER_REQUIRED,+ );+}diff --git a/apps/server/src/routes/rpc/services/status-page/index.ts b/apps/server/src/routes/rpc/services/status-page/index.tsnew file mode 100644index 000000000..b20503cf9--- /dev/null+++ b/apps/server/src/routes/rpc/services/status-page/index.ts@@ -0,0 +1,1093 @@+import type { ServiceImpl } from "@connectrpc/connect";+import {+ and,+ count,+ db,+ desc,+ eq,+ gte,+ inArray,+ isNull,+ lte,+} from "@openstatus/db";+import {+ maintenance,+ maintenancesToPageComponents,+ monitor,+ page,+ pageComponent,+ pageComponentGroup,+ pageSubscriber,+ statusReport,+ statusReportUpdate,+ statusReportsToPageComponents,+} from "@openstatus/db/src/schema";+import type { StatusPageService } from "@openstatus/proto/status_page/v1";+import { OverallStatus } from "@openstatus/proto/status_page/v1";+import { nanoid } from "nanoid";++import { getRpcContext } from "../../interceptors";+import {+ dbComponentToProto,+ dbGroupToProto,+ dbPageToProto,+ dbPageToProtoSummary,+ dbSubscriberToProto,+} from "./converters";+import {+ componentGroupCreateFailedError,+ componentGroupNotFoundError,+ componentGroupUpdateFailedError,+ identifierRequiredError,+ monitorNotFoundError,+ pageComponentCreateFailedError,+ pageComponentNotFoundError,+ pageComponentUpdateFailedError,+ slugAlreadyExistsError,+ statusPageAccessDeniedError,+ statusPageCreateFailedError,+ statusPageIdRequiredError,+ statusPageNotFoundError,+ statusPageNotPublishedError,+ statusPageUpdateFailedError,+ subscriberCreateFailedError,+ subscriberNotFoundError,+} from "./errors";+import { checkStatusPageLimits } from "./limits";++/**+ * Helper to get a status page by ID with workspace scope.+ */+async function getPageById(id: number, workspaceId: number) {+ return db+ .select()+ .from(page)+ .where(and(eq(page.id, id), eq(page.workspaceId, workspaceId)))+ .get();+}++/**+ * Helper to get a status page by slug.+ * Normalizes the slug to lowercase before querying.+ */+async function getPageBySlug(slug: string) {+ const normalizedSlug = slug.toLowerCase();+ return db.select().from(page).where(eq(page.slug, normalizedSlug)).get();+}++/**+ * Validates public access to a status page.+ * Checks that the page is published and has public access type.+ * Throws appropriate errors if access is denied.+ */+function validatePublicAccess(+ pageData: { published: boolean | null; accessType: string | null },+ slug: string,+): void {+ // Check if page is published+ if (!pageData.published) {+ throw statusPageNotPublishedError(slug);+ }++ // Check access type - only public pages are accessible without authentication+ if (pageData.accessType && pageData.accessType !== "public") {+ throw statusPageAccessDeniedError(slug, pageData.accessType);+ }+}++/**+ * Helper to get a component by ID with workspace scope.+ */+async function getComponentById(id: number, workspaceId: number) {+ return db+ .select()+ .from(pageComponent)+ .where(+ and(eq(pageComponent.id, id), eq(pageComponent.workspaceId, workspaceId)),+ )+ .get();+}++/**+ * Helper to get a component group by ID with workspace scope.+ */+async function getGroupById(id: number, workspaceId: number) {+ return db+ .select()+ .from(pageComponentGroup)+ .where(+ and(+ eq(pageComponentGroup.id, id),+ eq(pageComponentGroup.workspaceId, workspaceId),+ ),+ )+ .get();+}++/**+ * Helper to get a monitor by ID with workspace scope.+ */+async function getMonitorById(id: number, workspaceId: number) {+ return db+ .select()+ .from(monitor)+ .where(and(eq(monitor.id, id), eq(monitor.workspaceId, workspaceId)))+ .get();+}++/**+ * Status page service implementation for ConnectRPC.+ */+export const statusPageServiceImpl: ServiceImpl<typeof StatusPageService> = {+ // ==========================================================================+ // Page CRUD+ // ==========================================================================++ async createStatusPage(req, ctx) {+ const rpcCtx = getRpcContext(ctx);+ const workspaceId = rpcCtx.workspace.id;+ const limits = rpcCtx.workspace.limits;++ // Check workspace limits for status pages+ await checkStatusPageLimits(workspaceId, limits);++ // Check if slug already exists+ const existingPage = await getPageBySlug(req.slug);+ if (existingPage) {+ throw slugAlreadyExistsError(req.slug);+ }++ // Create the status page+ const newPage = await db+ .insert(page)+ .values({+ workspaceId,+ title: req.title,+ description: req.description ?? "",+ slug: req.slug,+ customDomain: "",+ published: false,+ homepageUrl: req.homepageUrl ?? null,+ contactUrl: req.contactUrl ?? null,+ })+ .returning()+ .get();++ if (!newPage) {+ throw statusPageCreateFailedError();+ }++ return {+ statusPage: dbPageToProto(newPage),+ };+ },++ async getStatusPage(req, ctx) {+ const rpcCtx = getRpcContext(ctx);+ const workspaceId = rpcCtx.workspace.id;++ const id = req.id?.trim();+ if (!id) {+ throw statusPageIdRequiredError();+ }++ const pageData = await getPageById(Number(id), workspaceId);+ if (!pageData) {+ throw statusPageNotFoundError(id);+ }++ return {+ statusPage: dbPageToProto(pageData),+ };+ },++ async listStatusPages(req, ctx) {+ const rpcCtx = getRpcContext(ctx);+ const workspaceId = rpcCtx.workspace.id;++ const limit = Math.min(Math.max(req.limit ?? 50, 1), 100);+ const offset = req.offset ?? 0;++ // Get total count+ const countResult = await db+ .select({ count: count() })+ .from(page)+ .where(eq(page.workspaceId, workspaceId))+ .get();++ const totalCount = countResult?.count ?? 0;++ // Get pages+ const pages = await db+ .select()+ .from(page)+ .where(eq(page.workspaceId, workspaceId))+ .orderBy(desc(page.createdAt))+ .limit(limit)+ .offset(offset)+ .all();++ return {+ statusPages: pages.map(dbPageToProtoSummary),+ totalSize: totalCount,+ };+ },++ async updateStatusPage(req, ctx) {+ const rpcCtx = getRpcContext(ctx);+ const workspaceId = rpcCtx.workspace.id;++ const id = req.id?.trim();+ if (!id) {+ throw statusPageIdRequiredError();+ }++ const pageData = await getPageById(Number(id), workspaceId);+ if (!pageData) {+ throw statusPageNotFoundError(id);+ }++ // Check if new slug conflicts with another page+ if (req.slug && req.slug !== pageData.slug) {+ const existingPage = await getPageBySlug(req.slug);+ if (existingPage && existingPage.id !== pageData.id) {+ throw slugAlreadyExistsError(req.slug);+ }+ }++ // Build update values+ const updateValues: Record<string, unknown> = {+ updatedAt: new Date(),+ };++ if (req.title !== undefined && req.title !== "") {+ updateValues.title = req.title;+ }+ if (req.description !== undefined) {+ updateValues.description = req.description;+ }+ if (req.slug !== undefined && req.slug !== "") {+ updateValues.slug = req.slug;+ }+ if (req.homepageUrl !== undefined) {+ updateValues.homepageUrl = req.homepageUrl || null;+ }+ if (req.contactUrl !== undefined) {+ updateValues.contactUrl = req.contactUrl || null;+ }++ const updatedPage = await db+ .update(page)+ .set(updateValues)+ .where(eq(page.id, pageData.id))+ .returning()+ .get();++ if (!updatedPage) {+ throw statusPageUpdateFailedError(req.id);+ }++ return {+ statusPage: dbPageToProto(updatedPage),+ };+ },++ async deleteStatusPage(req, ctx) {+ const rpcCtx = getRpcContext(ctx);+ const workspaceId = rpcCtx.workspace.id;++ const id = req.id?.trim();+ if (!id) {+ throw statusPageIdRequiredError();+ }++ const pageData = await getPageById(Number(id), workspaceId);+ if (!pageData) {+ throw statusPageNotFoundError(id);+ }++ // Delete the page (cascade will delete components, groups, subscribers)+ await db.delete(page).where(eq(page.id, pageData.id));++ return { success: true };+ },++ // ==========================================================================+ // Component Management+ // ==========================================================================++ async addMonitorComponent(req, ctx) {+ const rpcCtx = getRpcContext(ctx);+ const workspaceId = rpcCtx.workspace.id;++ // Verify page exists and belongs to workspace+ const pageData = await getPageById(Number(req.pageId), workspaceId);+ if (!pageData) {+ throw statusPageNotFoundError(req.pageId);+ }++ // Verify monitor exists and belongs to workspace+ const monitorData = await getMonitorById(+ Number(req.monitorId),+ workspaceId,+ );+ if (!monitorData) {+ throw monitorNotFoundError(req.monitorId);+ }++ // Validate group exists if provided+ if (req.groupId) {+ const group = await getGroupById(Number(req.groupId), workspaceId);+ if (!group) {+ throw componentGroupNotFoundError(req.groupId);+ }+ }++ // Create the component+ const newComponent = await db+ .insert(pageComponent)+ .values({+ workspaceId,+ pageId: pageData.id,+ type: "monitor",+ monitorId: monitorData.id,+ name: req.name ?? monitorData.name,+ description: req.description ?? null,+ order: req.order ?? 0,+ groupId: req.groupId ? Number(req.groupId) : null,+ })+ .returning()+ .get();++ if (!newComponent) {+ throw pageComponentCreateFailedError();+ }++ return {+ component: dbComponentToProto(newComponent),+ };+ },++ async addStaticComponent(req, ctx) {+ const rpcCtx = getRpcContext(ctx);+ const workspaceId = rpcCtx.workspace.id;++ // Verify page exists and belongs to workspace+ const pageData = await getPageById(Number(req.pageId), workspaceId);+ if (!pageData) {+ throw statusPageNotFoundError(req.pageId);+ }++ // Validate group exists if provided+ if (req.groupId) {+ const group = await getGroupById(Number(req.groupId), workspaceId);+ if (!group) {+ throw componentGroupNotFoundError(req.groupId);+ }+ }++ // Create the component+ const newComponent = await db+ .insert(pageComponent)+ .values({+ workspaceId,+ pageId: pageData.id,+ type: "static",+ monitorId: null,+ name: req.name,+ description: req.description ?? null,+ order: req.order ?? 0,+ groupId: req.groupId ? Number(req.groupId) : null,+ })+ .returning()+ .get();++ if (!newComponent) {+ throw pageComponentCreateFailedError();+ }++ return {+ component: dbComponentToProto(newComponent),+ };+ },++ async removeComponent(req, ctx) {+ const rpcCtx = getRpcContext(ctx);+ const workspaceId = rpcCtx.workspace.id;++ const id = req.id?.trim();+ if (!id) {+ throw pageComponentNotFoundError(req.id);+ }++ const component = await getComponentById(Number(id), workspaceId);+ if (!component) {+ throw pageComponentNotFoundError(id);+ }++ // Delete the component+ await db.delete(pageComponent).where(eq(pageComponent.id, component.id));++ return { success: true };+ },++ async updateComponent(req, ctx) {+ const rpcCtx = getRpcContext(ctx);+ const workspaceId = rpcCtx.workspace.id;++ const id = req.id?.trim();+ if (!id) {+ throw pageComponentNotFoundError(req.id);+ }++ const component = await getComponentById(Number(id), workspaceId);+ if (!component) {+ throw pageComponentNotFoundError(id);+ }++ // Validate group exists if provided+ if (req.groupId !== undefined && req.groupId !== "") {+ const group = await getGroupById(Number(req.groupId), workspaceId);+ if (!group) {+ throw componentGroupNotFoundError(req.groupId);+ }+ }++ // Build update values+ const updateValues: Record<string, unknown> = {+ updatedAt: new Date(),+ };++ if (req.name !== undefined && req.name !== "") {+ updateValues.name = req.name;+ }+ if (req.description !== undefined) {+ updateValues.description = req.description || null;+ }+ if (req.order !== undefined) {+ updateValues.order = req.order;+ }+ if (req.groupId !== undefined) {+ // Empty string means remove from group+ updateValues.groupId = req.groupId === "" ? null : Number(req.groupId);+ }+ if (req.groupOrder !== undefined) {+ updateValues.groupOrder = req.groupOrder;+ }++ const updatedComponent = await db+ .update(pageComponent)+ .set(updateValues)+ .where(eq(pageComponent.id, component.id))+ .returning()+ .get();++ if (!updatedComponent) {+ throw pageComponentUpdateFailedError(req.id);+ }++ return {+ component: dbComponentToProto(updatedComponent),+ };+ },++ // ==========================================================================+ // Component Groups+ // ==========================================================================++ async createComponentGroup(req, ctx) {+ const rpcCtx = getRpcContext(ctx);+ const workspaceId = rpcCtx.workspace.id;++ // Verify page exists and belongs to workspace+ const pageData = await getPageById(Number(req.pageId), workspaceId);+ if (!pageData) {+ throw statusPageNotFoundError(req.pageId);+ }++ // Create the group+ const newGroup = await db+ .insert(pageComponentGroup)+ .values({+ workspaceId,+ pageId: pageData.id,+ name: req.name,+ })+ .returning()+ .get();++ if (!newGroup) {+ throw componentGroupCreateFailedError();+ }++ return {+ group: dbGroupToProto(newGroup),+ };+ },++ async deleteComponentGroup(req, ctx) {+ const rpcCtx = getRpcContext(ctx);+ const workspaceId = rpcCtx.workspace.id;++ const id = req.id?.trim();+ if (!id) {+ throw componentGroupNotFoundError(req.id);+ }++ const group = await getGroupById(Number(id), workspaceId);+ if (!group) {+ throw componentGroupNotFoundError(id);+ }++ // Delete the group (components will have groupId set to null due to FK constraint)+ await db+ .delete(pageComponentGroup)+ .where(eq(pageComponentGroup.id, group.id));++ return { success: true };+ },++ async updateComponentGroup(req, ctx) {+ const rpcCtx = getRpcContext(ctx);+ const workspaceId = rpcCtx.workspace.id;++ const id = req.id?.trim();+ if (!id) {+ throw componentGroupNotFoundError(req.id);+ }++ const group = await getGroupById(Number(id), workspaceId);+ if (!group) {+ throw componentGroupNotFoundError(id);+ }++ // Build update values+ const updateValues: Record<string, unknown> = {+ updatedAt: new Date(),+ };++ if (req.name !== undefined && req.name !== "") {+ updateValues.name = req.name;+ }++ const updatedGroup = await db+ .update(pageComponentGroup)+ .set(updateValues)+ .where(eq(pageComponentGroup.id, group.id))+ .returning()+ .get();++ if (!updatedGroup) {+ throw componentGroupUpdateFailedError(req.id);+ }++ return {+ group: dbGroupToProto(updatedGroup),+ };+ },++ // ==========================================================================+ // Subscribers+ // ==========================================================================++ async subscribeToPage(req, ctx) {+ const rpcCtx = getRpcContext(ctx);+ const workspaceId = rpcCtx.workspace.id;++ // Verify page exists and belongs to workspace+ const pageData = await getPageById(Number(req.pageId), workspaceId);+ if (!pageData) {+ throw statusPageNotFoundError(req.pageId);+ }++ // Check if already subscribed+ const existingSubscriber = await db+ .select()+ .from(pageSubscriber)+ .where(+ and(+ eq(pageSubscriber.pageId, pageData.id),+ eq(pageSubscriber.email, req.email),+ ),+ )+ .get();++ if (existingSubscriber) {+ // If unsubscribed, resubscribe within a transaction to ensure atomicity+ if (existingSubscriber.unsubscribedAt) {+ const updatedSubscriber = await db.transaction(async (tx) => {+ const result = await tx+ .update(pageSubscriber)+ .set({+ unsubscribedAt: null,+ updatedAt: new Date(),+ token: nanoid(),+ })+ .where(eq(pageSubscriber.id, existingSubscriber.id))+ .returning()+ .get();++ if (!result) {+ throw subscriberCreateFailedError();+ }++ return result;+ });++ return {+ subscriber: dbSubscriberToProto(updatedSubscriber),+ };+ }++ // Already subscribed, return existing+ return {+ subscriber: dbSubscriberToProto(existingSubscriber),+ };+ }++ // Create new subscriber+ const newSubscriber = await db+ .insert(pageSubscriber)+ .values({+ pageId: pageData.id,+ email: req.email,+ token: nanoid(),+ })+ .returning()+ .get();++ if (!newSubscriber) {+ throw subscriberCreateFailedError();+ }++ return {+ subscriber: dbSubscriberToProto(newSubscriber),+ };+ },++ async unsubscribeFromPage(req, ctx) {+ const rpcCtx = getRpcContext(ctx);+ const workspaceId = rpcCtx.workspace.id;++ // Verify page exists and belongs to workspace+ const pageData = await getPageById(Number(req.pageId), workspaceId);+ if (!pageData) {+ throw statusPageNotFoundError(req.pageId);+ }++ // Find subscriber based on identifier type+ if (req.identifier.case === "email") {+ const subscriber = await db+ .select()+ .from(pageSubscriber)+ .where(+ and(+ eq(pageSubscriber.pageId, pageData.id),+ eq(pageSubscriber.email, req.identifier.value),+ ),+ )+ .get();++ if (!subscriber) {+ throw subscriberNotFoundError(req.identifier.value);+ }++ await db+ .update(pageSubscriber)+ .set({ unsubscribedAt: new Date(), updatedAt: new Date() })+ .where(eq(pageSubscriber.id, subscriber.id));++ return { success: true };+ }++ if (req.identifier.case === "id") {+ const subscriber = await db+ .select()+ .from(pageSubscriber)+ .where(+ and(+ eq(pageSubscriber.pageId, pageData.id),+ eq(pageSubscriber.id, Number(req.identifier.value)),+ ),+ )+ .get();++ if (!subscriber) {+ throw subscriberNotFoundError(req.identifier.value);+ }++ await db+ .update(pageSubscriber)+ .set({ unsubscribedAt: new Date(), updatedAt: new Date() })+ .where(eq(pageSubscriber.id, subscriber.id));++ return { success: true };+ }++ throw identifierRequiredError();+ },++ async listSubscribers(req, ctx) {+ const rpcCtx = getRpcContext(ctx);+ const workspaceId = rpcCtx.workspace.id;++ // Verify page exists and belongs to workspace+ const pageData = await getPageById(Number(req.pageId), workspaceId);+ if (!pageData) {+ throw statusPageNotFoundError(req.pageId);+ }++ const limit = Math.min(Math.max(req.limit ?? 50, 1), 100);+ const offset = req.offset ?? 0;++ // Build conditions+ const conditions = [eq(pageSubscriber.pageId, pageData.id)];+ if (!req.includeUnsubscribed) {+ conditions.push(isNull(pageSubscriber.unsubscribedAt));+ }++ // Get total count+ const countResult = await db+ .select({ count: count() })+ .from(pageSubscriber)+ .where(and(...conditions))+ .get();++ const totalCount = countResult?.count ?? 0;++ // Get subscribers+ const subscribers = await db+ .select()+ .from(pageSubscriber)+ .where(and(...conditions))+ .orderBy(desc(pageSubscriber.createdAt))+ .limit(limit)+ .offset(offset)+ .all();++ return {+ subscribers: subscribers.map(dbSubscriberToProto),+ totalSize: totalCount,+ };+ },++ // ==========================================================================+ // Full Content & Status+ // ==========================================================================++ async getStatusPageContent(req, ctx) {+ // Note: This endpoint may be used publicly, so we need to handle+ // the case where we look up by slug without workspace scope+ type PageData = Awaited<ReturnType<typeof getPageById>>;+ let pageData: PageData;+ let identifierValue: string;+ let isPublicAccess = false;++ if (req.identifier.case === "id") {+ const rpcCtx = getRpcContext(ctx);+ const workspaceId = rpcCtx.workspace.id;+ identifierValue = req.identifier.value;+ pageData = await getPageById(Number(identifierValue), workspaceId);+ } else if (req.identifier.case === "slug") {+ identifierValue = req.identifier.value;+ pageData = await getPageBySlug(identifierValue);+ isPublicAccess = true;+ } else {+ throw statusPageIdRequiredError();+ }++ if (!pageData) {+ throw statusPageNotFoundError(identifierValue);+ }++ // Access control differs based on how the page is accessed:+ // - By slug (public): Validates page is published and publicly accessible+ // - By ID (workspace): Allows workspace members to preview unpublished pages+ if (isPublicAccess) {+ validatePublicAccess(pageData, identifierValue);+ }++ // Get components+ const components = await db+ .select()+ .from(pageComponent)+ .where(eq(pageComponent.pageId, pageData.id))+ .orderBy(pageComponent.order)+ .all();++ // Get groups+ const groups = await db+ .select()+ .from(pageComponentGroup)+ .where(eq(pageComponentGroup.pageId, pageData.id))+ .all();++ // Get active status reports (not resolved)+ const activeReports = await db+ .select()+ .from(statusReport)+ .where(+ and(+ eq(statusReport.pageId, pageData.id),+ inArray(statusReport.status, [+ "investigating",+ "identified",+ "monitoring",+ ]),+ ),+ )+ .orderBy(desc(statusReport.createdAt))+ .all();++ // Get status report updates for active reports+ const reportIds = activeReports.map((r) => r.id);+ const reportUpdates =+ reportIds.length > 0+ ? await db+ .select()+ .from(statusReportUpdate)+ .where(inArray(statusReportUpdate.statusReportId, reportIds))+ .orderBy(desc(statusReportUpdate.date))+ .all()+ : [];++ // Get page component IDs for each report+ const reportComponents =+ reportIds.length > 0+ ? await db+ .select()+ .from(statusReportsToPageComponents)+ .where(+ inArray(statusReportsToPageComponents.statusReportId, reportIds),+ )+ .all()+ : [];++ // Import the converter from status-report service+ const { dbStatusToProto } = await import("../status-report/converters");++ // Convert reports to proto format+ const statusReports = activeReports.map((report) => {+ const updates = reportUpdates.filter(+ (u) => u.statusReportId === report.id,+ );+ const componentIds = reportComponents+ .filter((rc) => rc.statusReportId === report.id)+ .map((rc) => String(rc.pageComponentId));++ return {+ $typeName: "openstatus.status_report.v1.StatusReport" as const,+ id: String(report.id),+ status: dbStatusToProto(report.status),+ title: report.title,+ pageComponentIds: componentIds,+ updates: updates.map((u) => ({+ $typeName: "openstatus.status_report.v1.StatusReportUpdate" as const,+ id: String(u.id),+ status: dbStatusToProto(u.status),+ date: u.date.toISOString(),+ message: u.message,+ createdAt: u.createdAt?.toISOString() ?? "",+ })),+ createdAt: report.createdAt?.toISOString() ?? "",+ updatedAt: report.updatedAt?.toISOString() ?? "",+ };+ });++ // Get maintenances for the page (upcoming and recent)+ const pageMaintenances = await db+ .select()+ .from(maintenance)+ .where(eq(maintenance.pageId, pageData.id))+ .orderBy(desc(maintenance.from))+ .all();++ // Get component associations for maintenances+ const maintenanceIds = pageMaintenances.map((m) => m.id);+ const maintenanceComponents =+ maintenanceIds.length > 0+ ? await db+ .select()+ .from(maintenancesToPageComponents)+ .where(+ inArray(+ maintenancesToPageComponents.maintenanceId,+ maintenanceIds,+ ),+ )+ .all()+ : [];++ // Convert maintenances to proto format+ const maintenancesProto = pageMaintenances.map((m) => {+ const componentIds = maintenanceComponents+ .filter((mc) => mc.maintenanceId === m.id)+ .map((mc) => String(mc.pageComponentId));++ return {+ $typeName: "openstatus.status_page.v1.Maintenance" as const,+ id: String(m.id),+ title: m.title,+ message: m.message,+ from: m.from.toISOString(),+ to: m.to.toISOString(),+ pageComponentIds: componentIds,+ createdAt: m.createdAt?.toISOString() ?? "",+ updatedAt: m.updatedAt?.toISOString() ?? "",+ };+ });++ return {+ statusPage: dbPageToProto(pageData),+ components: components.map(dbComponentToProto),+ groups: groups.map(dbGroupToProto),+ statusReports,+ maintenances: maintenancesProto,+ };+ },++ async getOverallStatus(req, ctx) {+ type PageData = Awaited<ReturnType<typeof getPageById>>;+ let pageData: PageData;+ let identifierValue: string;+ let isPublicAccess = false;++ if (req.identifier.case === "id") {+ const rpcCtx = getRpcContext(ctx);+ const workspaceId = rpcCtx.workspace.id;+ identifierValue = req.identifier.value;+ pageData = await getPageById(Number(identifierValue), workspaceId);+ } else if (req.identifier.case === "slug") {+ identifierValue = req.identifier.value;+ pageData = await getPageBySlug(identifierValue);+ isPublicAccess = true;+ } else {+ throw statusPageIdRequiredError();+ }++ if (!pageData) {+ throw statusPageNotFoundError(identifierValue);+ }++ // Access control differs based on how the page is accessed:+ // - By slug (public): Validates page is published and publicly accessible+ // - By ID (workspace): Allows workspace members to preview unpublished pages+ if (isPublicAccess) {+ validatePublicAccess(pageData, identifierValue);+ }++ // Get components+ const components = await db+ .select()+ .from(pageComponent)+ .where(eq(pageComponent.pageId, pageData.id))+ .all();++ const componentIds = components.map((c) => c.id);+ const now = new Date();++ // Check for active status reports (degraded state)+ let hasActiveStatusReport = false;+ const componentReportStatus = new Map<number, boolean>();++ if (componentIds.length > 0) {+ const activeReports = await db+ .select({+ componentId: statusReportsToPageComponents.pageComponentId,+ })+ .from(statusReportsToPageComponents)+ .innerJoin(+ statusReport,+ eq(statusReportsToPageComponents.statusReportId, statusReport.id),+ )+ .where(+ and(+ inArray(+ statusReportsToPageComponents.pageComponentId,+ componentIds,+ ),+ inArray(statusReport.status, [+ "investigating",+ "identified",+ "monitoring",+ ]),+ ),+ )+ .all();++ hasActiveStatusReport = activeReports.length > 0;++ // Track which components have active reports+ for (const report of activeReports) {+ componentReportStatus.set(report.componentId, true);+ }+ }++ // Check for active maintenances (info state - current time between from and to)+ let hasActiveMaintenance = false;+ const componentMaintenanceStatus = new Map<number, boolean>();++ const activeMaintenances = await db+ .select()+ .from(maintenance)+ .where(+ and(+ eq(maintenance.pageId, pageData.id),+ lte(maintenance.from, now),+ gte(maintenance.to, now),+ ),+ )+ .all();++ hasActiveMaintenance = activeMaintenances.length > 0;++ // Get component associations for active maintenances+ if (activeMaintenances.length > 0) {+ const maintenanceIds = activeMaintenances.map((m) => m.id);+ const maintenanceComponentAssocs = await db+ .select()+ .from(maintenancesToPageComponents)+ .where(+ inArray(maintenancesToPageComponents.maintenanceId, maintenanceIds),+ )+ .all();++ // Track which components are under maintenance+ for (const assoc of maintenanceComponentAssocs) {+ componentMaintenanceStatus.set(assoc.pageComponentId, true);+ }+ }++ // Determine overall status based on priority: degraded > maintenance > operational+ // Note: In the existing codebase, status reports indicate "degraded" state+ // and maintenances indicate "info/maintenance" state+ const overallStatus = hasActiveStatusReport+ ? OverallStatus.DEGRADED+ : hasActiveMaintenance+ ? OverallStatus.MAINTENANCE+ : OverallStatus.OPERATIONAL;++ // Build component statuses based on their individual state+ const componentStatuses = components.map((c) => {+ const hasReport = componentReportStatus.get(c.id) ?? false;+ const hasMaintenance = componentMaintenanceStatus.get(c.id) ?? false;++ const status = hasReport+ ? OverallStatus.DEGRADED+ : hasMaintenance+ ? OverallStatus.MAINTENANCE+ : OverallStatus.OPERATIONAL;++ return {+ $typeName: "openstatus.status_page.v1.ComponentStatus" as const,+ componentId: String(c.id),+ status,+ };+ });++ return {+ overallStatus,+ componentStatuses,+ };+ },+};diff --git a/apps/server/src/routes/rpc/services/status-page/limits.ts b/apps/server/src/routes/rpc/services/status-page/limits.tsnew file mode 100644index 000000000..aa6143e83--- /dev/null+++ b/apps/server/src/routes/rpc/services/status-page/limits.ts@@ -0,0 +1,64 @@+import { Code, ConnectError } from "@connectrpc/connect";+import { count, db, eq } from "@openstatus/db";+import { page } from "@openstatus/db/src/schema";+import type { Limits } from "@openstatus/db/src/schema/plan/schema";++/**+ * Check workspace limits for creating a new status page.+ * Throws ConnectError with PermissionDenied if limit is exceeded.+ */+export async function checkStatusPageLimits(+ workspaceId: number,+ limits: Limits,+): Promise<void> {+ // Check status page count limit+ const countResult = await db+ .select({ count: count() })+ .from(page)+ .where(eq(page.workspaceId, workspaceId))+ .get();++ const currentCount = countResult?.count ?? 0;+ if (currentCount >= limits["status-pages"]) {+ throw new ConnectError(+ "Upgrade for more status pages",+ Code.PermissionDenied,+ );+ }+}++/**+ * Check if custom domain feature is available on the workspace plan.+ * Throws ConnectError with PermissionDenied if not available.+ */+export function checkCustomDomainLimit(limits: Limits): void {+ if (!limits["custom-domain"]) {+ throw new ConnectError("Upgrade for custom domains", Code.PermissionDenied);+ }+}++/**+ * Check if password protection feature is available on the workspace plan.+ * Throws ConnectError with PermissionDenied if not available.+ */+export function checkPasswordProtectionLimit(limits: Limits): void {+ if (!limits["password-protection"]) {+ throw new ConnectError(+ "Upgrade for password protection",+ Code.PermissionDenied,+ );+ }+}++/**+ * Check if email domain protection feature is available on the workspace plan.+ * Throws ConnectError with PermissionDenied if not available.+ */+export function checkEmailDomainProtectionLimit(limits: Limits): void {+ if (!limits["email-domain-protection"]) {+ throw new ConnectError(+ "Upgrade for email domain protection",+ Code.PermissionDenied,+ );+ }+}diff --git a/packages/proto/api/openstatus/status_page/v1/page_component.proto b/packages/proto/api/openstatus/status_page/v1/page_component.protonew file mode 100644index 000000000..90bc00bfd--- /dev/null+++ b/packages/proto/api/openstatus/status_page/v1/page_component.proto@@ -0,0 +1,66 @@+syntax = "proto3";++package openstatus.status_page.v1;++option go_package = "github.com/openstatushq/openstatus/packages/proto/openstatus/status_page/v1;statuspagev1";++// PageComponentType defines the type of a component on a status page.+enum PageComponentType {+ PAGE_COMPONENT_TYPE_UNSPECIFIED = 0;+ PAGE_COMPONENT_TYPE_MONITOR = 1;+ PAGE_COMPONENT_TYPE_STATIC = 2;+}++// PageComponent represents a component displayed on a status page.+message PageComponent {+ // Unique identifier for the component.+ string id = 1;++ // ID of the status page this component belongs to.+ string page_id = 2;++ // Display name of the component.+ string name = 3;++ // Description of the component (optional).+ string description = 4;++ // Type of the component (monitor or static).+ PageComponentType type = 5;++ // ID of the monitor if type is MONITOR (optional).+ string monitor_id = 6;++ // Display order of the component.+ int32 order = 7;++ // ID of the group this component belongs to (optional).+ string group_id = 8;++ // Order within the group if grouped.+ int32 group_order = 9;++ // Timestamp when the component was created (RFC 3339 format).+ string created_at = 10;++ // Timestamp when the component was last updated (RFC 3339 format).+ string updated_at = 11;+}++// PageComponentGroup represents a group of components on a status page.+message PageComponentGroup {+ // Unique identifier for the group.+ string id = 1;++ // ID of the status page this group belongs to.+ string page_id = 2;++ // Display name of the group.+ string name = 3;++ // Timestamp when the group was created (RFC 3339 format).+ string created_at = 4;++ // Timestamp when the group was last updated (RFC 3339 format).+ string updated_at = 5;+}diff --git a/packages/proto/api/openstatus/status_page/v1/page_subscriber.proto b/packages/proto/api/openstatus/status_page/v1/page_subscriber.protonew file mode 100644index 000000000..3f12dd65f--- /dev/null+++ b/packages/proto/api/openstatus/status_page/v1/page_subscriber.proto@@ -0,0 +1,29 @@+syntax = "proto3";++package openstatus.status_page.v1;++option go_package = "github.com/openstatushq/openstatus/packages/proto/openstatus/status_page/v1;statuspagev1";++// PageSubscriber represents a subscriber to a status page.+message PageSubscriber {+ // Unique identifier for the subscriber.+ string id = 1;++ // ID of the status page the user is subscribed to.+ string page_id = 2;++ // Email address of the subscriber.+ string email = 3;++ // Timestamp when the subscription was accepted/confirmed (RFC 3339 format, optional).+ string accepted_at = 4;++ // Timestamp when the user unsubscribed (RFC 3339 format, optional).+ string unsubscribed_at = 5;++ // Timestamp when the subscription was created (RFC 3339 format).+ string created_at = 6;++ // Timestamp when the subscription was last updated (RFC 3339 format).+ string updated_at = 7;+}diff --git a/packages/proto/api/openstatus/status_page/v1/service.proto b/packages/proto/api/openstatus/status_page/v1/service.protonew file mode 100644index 000000000..29ed651e9--- /dev/null+++ b/packages/proto/api/openstatus/status_page/v1/service.proto@@ -0,0 +1,466 @@+syntax = "proto3";++package openstatus.status_page.v1;++import "buf/validate/validate.proto";+import "openstatus/status_page/v1/page_component.proto";+import "openstatus/status_page/v1/page_subscriber.proto";+import "openstatus/status_page/v1/status_page.proto";+import "openstatus/status_report/v1/status_report.proto";++option go_package = "github.com/openstatushq/openstatus/packages/proto/openstatus/status_page/v1;statuspagev1";++// StatusPageService provides CRUD and management operations for status pages.+service StatusPageService {+ // --- Page CRUD ---++ // CreateStatusPage creates a new status page.+ rpc CreateStatusPage(CreateStatusPageRequest) returns (CreateStatusPageResponse);++ // GetStatusPage retrieves a specific status page by ID.+ rpc GetStatusPage(GetStatusPageRequest) returns (GetStatusPageResponse);++ // ListStatusPages returns all status pages for the workspace.+ rpc ListStatusPages(ListStatusPagesRequest) returns (ListStatusPagesResponse);++ // UpdateStatusPage updates an existing status page.+ rpc UpdateStatusPage(UpdateStatusPageRequest) returns (UpdateStatusPageResponse);++ // DeleteStatusPage removes a status page.+ rpc DeleteStatusPage(DeleteStatusPageRequest) returns (DeleteStatusPageResponse);++ // --- Component Management ---++ // AddMonitorComponent adds a monitor-based component to a status page.+ rpc AddMonitorComponent(AddMonitorComponentRequest) returns (AddMonitorComponentResponse);++ // AddStaticComponent adds a static component to a status page.+ rpc AddStaticComponent(AddStaticComponentRequest) returns (AddStaticComponentResponse);++ // RemoveComponent removes a component from a status page.+ rpc RemoveComponent(RemoveComponentRequest) returns (RemoveComponentResponse);++ // UpdateComponent updates an existing component.+ rpc UpdateComponent(UpdateComponentRequest) returns (UpdateComponentResponse);++ // --- Component Groups ---++ // CreateComponentGroup creates a new component group.+ rpc CreateComponentGroup(CreateComponentGroupRequest) returns (CreateComponentGroupResponse);++ // DeleteComponentGroup removes a component group.+ rpc DeleteComponentGroup(DeleteComponentGroupRequest) returns (DeleteComponentGroupResponse);++ // UpdateComponentGroup updates an existing component group.+ rpc UpdateComponentGroup(UpdateComponentGroupRequest) returns (UpdateComponentGroupResponse);++ // --- Subscribers ---++ // SubscribeToPage subscribes an email to a status page.+ rpc SubscribeToPage(SubscribeToPageRequest) returns (SubscribeToPageResponse);++ // UnsubscribeFromPage removes a subscription from a status page.+ rpc UnsubscribeFromPage(UnsubscribeFromPageRequest) returns (UnsubscribeFromPageResponse);++ // ListSubscribers returns all subscribers for a status page.+ rpc ListSubscribers(ListSubscribersRequest) returns (ListSubscribersResponse);++ // --- Full Content & Status ---++ // GetStatusPageContent retrieves the full content of a status page including components and reports.+ rpc GetStatusPageContent(GetStatusPageContentRequest) returns (GetStatusPageContentResponse);++ // GetOverallStatus returns the aggregated status of a status page.+ rpc GetOverallStatus(GetOverallStatusRequest) returns (GetOverallStatusResponse);+}++// =============================================================================+// Page CRUD Messages+// =============================================================================++// --- Create Status Page ---++message CreateStatusPageRequest {+ // Title of the status page (required).+ string title = 1 [+ (buf.validate.field).string.min_len = 1,+ (buf.validate.field).string.max_len = 256+ ];++ // Description of the status page (optional).+ optional string description = 2 [(buf.validate.field).string.max_len = 1024];++ // URL-friendly slug for the status page (required).+ string slug = 3 [+ (buf.validate.field).string.min_len = 1,+ (buf.validate.field).string.max_len = 256,+ (buf.validate.field).string.pattern = "^[a-z0-9]+(?:-[a-z0-9]+)*$"+ ];++ // URL to the homepage (optional).+ optional string homepage_url = 4;++ // URL to the contact page (optional).+ optional string contact_url = 5;+}++message CreateStatusPageResponse {+ // The created status page.+ StatusPage status_page = 1;+}++// --- Get Status Page ---++message GetStatusPageRequest {+ // ID of the status page to retrieve (required).+ string id = 1 [(buf.validate.field).string.min_len = 1];+}++message GetStatusPageResponse {+ // The requested status page.+ StatusPage status_page = 1;+}++// --- List Status Pages ---++message ListStatusPagesRequest {+ // Maximum number of pages to return (1-100, defaults to 50).+ optional int32 limit = 1 [(buf.validate.field).int32 = {+ gte: 1+ lte: 100+ }];++ // Number of pages to skip for pagination (defaults to 0).+ optional int32 offset = 2 [(buf.validate.field).int32.gte = 0];+}++message ListStatusPagesResponse {+ // List of status pages (metadata only).+ repeated StatusPageSummary status_pages = 1;++ // Total number of status pages.+ int32 total_size = 2;+}++// --- Update Status Page ---++message UpdateStatusPageRequest {+ // ID of the status page to update (required).+ string id = 1 [(buf.validate.field).string.min_len = 1];++ // New title for the status page (optional).+ optional string title = 2 [(buf.validate.field).string = {+ min_len: 1+ max_len: 256+ }];++ // New description for the status page (optional).+ optional string description = 3 [(buf.validate.field).string.max_len = 1024];++ // New slug for the status page (optional).+ optional string slug = 4 [(buf.validate.field).string = {+ min_len: 1+ max_len: 256+ pattern: "^[a-z0-9]+(?:-[a-z0-9]+)*$"+ }];++ // New homepage URL (optional).+ optional string homepage_url = 5;++ // New contact URL (optional).+ optional string contact_url = 6;+}++message UpdateStatusPageResponse {+ // The updated status page.+ StatusPage status_page = 1;+}++// --- Delete Status Page ---++message DeleteStatusPageRequest {+ // ID of the status page to delete (required).+ string id = 1 [(buf.validate.field).string.min_len = 1];+}++message DeleteStatusPageResponse {+ // Whether the deletion was successful.+ bool success = 1;+}++// =============================================================================+// Component Management Messages+// =============================================================================++// --- Add Monitor Component ---++message AddMonitorComponentRequest {+ // ID of the status page to add the component to (required).+ string page_id = 1 [(buf.validate.field).string.min_len = 1];++ // ID of the monitor to associate with this component (required).+ string monitor_id = 2 [(buf.validate.field).string.min_len = 1];++ // Display name for the component (optional, defaults to monitor name).+ optional string name = 3 [(buf.validate.field).string.max_len = 256];++ // Description of the component (optional).+ optional string description = 4 [(buf.validate.field).string.max_len = 1024];++ // Display order of the component (optional).+ optional int32 order = 5;++ // ID of the group to add this component to (optional).+ optional string group_id = 6;+}++message AddMonitorComponentResponse {+ // The created component.+ PageComponent component = 1;+}++// --- Add Static Component ---++message AddStaticComponentRequest {+ // ID of the status page to add the component to (required).+ string page_id = 1 [(buf.validate.field).string.min_len = 1];++ // Display name for the component (required).+ string name = 2 [+ (buf.validate.field).string.min_len = 1,+ (buf.validate.field).string.max_len = 256+ ];++ // Description of the component (optional).+ optional string description = 3 [(buf.validate.field).string.max_len = 1024];++ // Display order of the component (optional).+ optional int32 order = 4;++ // ID of the group to add this component to (optional).+ optional string group_id = 5;+}++message AddStaticComponentResponse {+ // The created component.+ PageComponent component = 1;+}++// --- Remove Component ---++message RemoveComponentRequest {+ // ID of the component to remove (required).+ string id = 1 [(buf.validate.field).string.min_len = 1];+}++message RemoveComponentResponse {+ // Whether the removal was successful.+ bool success = 1;+}++// --- Update Component ---++message UpdateComponentRequest {+ // ID of the component to update (required).+ string id = 1 [(buf.validate.field).string.min_len = 1];++ // New display name for the component (optional).+ optional string name = 2 [(buf.validate.field).string.max_len = 256];++ // New description for the component (optional).+ optional string description = 3 [(buf.validate.field).string.max_len = 1024];++ // New display order (optional).+ optional int32 order = 4;++ // New group ID (optional, set to empty string to remove from group).+ optional string group_id = 5;++ // New order within the group (optional).+ optional int32 group_order = 6;+}++message UpdateComponentResponse {+ // The updated component.+ PageComponent component = 1;+}++// =============================================================================+// Component Group Messages+// =============================================================================++// --- Create Component Group ---++message CreateComponentGroupRequest {+ // ID of the status page to create the group in (required).+ string page_id = 1 [(buf.validate.field).string.min_len = 1];++ // Display name for the group (required).+ string name = 2 [+ (buf.validate.field).string.min_len = 1,+ (buf.validate.field).string.max_len = 256+ ];+}++message CreateComponentGroupResponse {+ // The created component group.+ PageComponentGroup group = 1;+}++// --- Delete Component Group ---++message DeleteComponentGroupRequest {+ // ID of the component group to delete (required).+ string id = 1 [(buf.validate.field).string.min_len = 1];+}++message DeleteComponentGroupResponse {+ // Whether the deletion was successful.+ bool success = 1;+}++// --- Update Component Group ---++message UpdateComponentGroupRequest {+ // ID of the component group to update (required).+ string id = 1 [(buf.validate.field).string.min_len = 1];++ // New display name for the group (optional).+ optional string name = 2 [(buf.validate.field).string = {+ min_len: 1+ max_len: 256+ }];+}++message UpdateComponentGroupResponse {+ // The updated component group.+ PageComponentGroup group = 1;+}++// =============================================================================+// Subscriber Messages+// =============================================================================++// --- Subscribe To Page ---++message SubscribeToPageRequest {+ // ID of the status page to subscribe to (required).+ string page_id = 1 [(buf.validate.field).string.min_len = 1];++ // Email address to subscribe (required).+ string email = 2 [(buf.validate.field).string.email = true];+}++message SubscribeToPageResponse {+ // The created subscriber.+ PageSubscriber subscriber = 1;+}++// --- Unsubscribe From Page ---++message UnsubscribeFromPageRequest {+ // ID of the status page to unsubscribe from (required).+ string page_id = 1 [(buf.validate.field).string.min_len = 1];++ // Identifier for the subscription (either email or id).+ oneof identifier {+ // Email address to unsubscribe.+ string email = 2;+ // Subscriber ID.+ string id = 3;+ }+}++message UnsubscribeFromPageResponse {+ // Whether the unsubscription was successful.+ bool success = 1;+}++// --- List Subscribers ---++message ListSubscribersRequest {+ // ID of the status page to list subscribers for (required).+ string page_id = 1 [(buf.validate.field).string.min_len = 1];++ // Maximum number of subscribers to return (1-100, defaults to 50).+ optional int32 limit = 2 [(buf.validate.field).int32 = {+ gte: 1+ lte: 100+ }];++ // Number of subscribers to skip for pagination (defaults to 0).+ optional int32 offset = 3 [(buf.validate.field).int32.gte = 0];++ // Whether to include unsubscribed users (defaults to false).+ optional bool include_unsubscribed = 4;+}++message ListSubscribersResponse {+ // List of subscribers.+ repeated PageSubscriber subscribers = 1;++ // Total number of subscribers matching the filter.+ int32 total_size = 2;+}++// =============================================================================+// Full Content & Status Messages+// =============================================================================++// --- Get Status Page Content ---++message GetStatusPageContentRequest {+ // Identifier for the status page (either id or slug).+ oneof identifier {+ // ID of the status page.+ string id = 1;+ // Slug of the status page.+ string slug = 2;+ }+}++message GetStatusPageContentResponse {+ // The status page details.+ StatusPage status_page = 1;++ // Components on the status page.+ repeated PageComponent components = 2;++ // Component groups on the status page.+ repeated PageComponentGroup groups = 3;++ // Active and recent status reports.+ repeated openstatus.status_report.v1.StatusReport status_reports = 4;++ // Scheduled maintenances.+ repeated Maintenance maintenances = 5;+}++// --- Get Overall Status ---++message GetOverallStatusRequest {+ // Identifier for the status page (either id or slug).+ oneof identifier {+ // ID of the status page.+ string id = 1;+ // Slug of the status page.+ string slug = 2;+ }+}++// ComponentStatus represents the status of a single component.+message ComponentStatus {+ // ID of the component.+ string component_id = 1;++ // Current status of the component.+ OverallStatus status = 2;+}++message GetOverallStatusResponse {+ // Aggregated status across all components.+ OverallStatus overall_status = 1;++ // Status of individual components.+ repeated ComponentStatus component_statuses = 2;+}diff --git a/packages/proto/api/openstatus/status_page/v1/status_page.proto b/packages/proto/api/openstatus/status_page/v1/status_page.protonew file mode 100644index 000000000..be13ae5e2--- /dev/null+++ b/packages/proto/api/openstatus/status_page/v1/status_page.proto@@ -0,0 +1,122 @@+syntax = "proto3";++package openstatus.status_page.v1;++option go_package = "github.com/openstatushq/openstatus/packages/proto/openstatus/status_page/v1;statuspagev1";++// PageAccessType defines who can access the status page.+enum PageAccessType {+ PAGE_ACCESS_TYPE_UNSPECIFIED = 0;+ PAGE_ACCESS_TYPE_PUBLIC = 1;+ PAGE_ACCESS_TYPE_PASSWORD_PROTECTED = 2;+ PAGE_ACCESS_TYPE_AUTHENTICATED = 3;+}++// PageTheme defines the visual theme of the status page.+enum PageTheme {+ PAGE_THEME_UNSPECIFIED = 0;+ PAGE_THEME_SYSTEM = 1;+ PAGE_THEME_LIGHT = 2;+ PAGE_THEME_DARK = 3;+}++// OverallStatus represents the aggregated status of all components on a page.+enum OverallStatus {+ OVERALL_STATUS_UNSPECIFIED = 0;+ OVERALL_STATUS_OPERATIONAL = 1;+ OVERALL_STATUS_DEGRADED = 2;+ OVERALL_STATUS_PARTIAL_OUTAGE = 3;+ OVERALL_STATUS_MAJOR_OUTAGE = 4;+ OVERALL_STATUS_MAINTENANCE = 5;+ OVERALL_STATUS_UNKNOWN = 6;+}++// StatusPage represents a full status page with all details.+message StatusPage {+ // Unique identifier for the status page.+ string id = 1;++ // Title of the status page.+ string title = 2;++ // Description of the status page.+ string description = 3;++ // URL-friendly slug for the status page.+ string slug = 4;++ // Custom domain for the status page (optional).+ string custom_domain = 5;++ // Whether the status page is published and visible.+ bool published = 6;++ // Access type for the status page.+ PageAccessType access_type = 7;++ // Visual theme for the status page.+ PageTheme theme = 8;++ // URL to the homepage (optional).+ string homepage_url = 9;++ // URL to the contact page (optional).+ string contact_url = 10;++ // Icon URL for the status page (optional).+ string icon = 11;++ // Timestamp when the page was created (RFC 3339 format).+ string created_at = 12;++ // Timestamp when the page was last updated (RFC 3339 format).+ string updated_at = 13;+}++// StatusPageSummary represents metadata for a status page (used in list responses).+message StatusPageSummary {+ // Unique identifier for the status page.+ string id = 1;++ // Title of the status page.+ string title = 2;++ // URL-friendly slug for the status page.+ string slug = 3;++ // Whether the status page is published and visible.+ bool published = 4;++ // Timestamp when the page was created (RFC 3339 format).+ string created_at = 5;++ // Timestamp when the page was last updated (RFC 3339 format).+ string updated_at = 6;+}++// Maintenance represents a scheduled maintenance window.+message Maintenance {+ // Unique identifier for the maintenance.+ string id = 1;++ // Title of the maintenance.+ string title = 2;++ // Message describing the maintenance.+ string message = 3;++ // Start time of the maintenance window (RFC 3339 format).+ string from = 4;++ // End time of the maintenance window (RFC 3339 format).+ string to = 5;++ // IDs of affected page components.+ repeated string page_component_ids = 6;++ // Timestamp when the maintenance was created (RFC 3339 format).+ string created_at = 7;++ // Timestamp when the maintenance was last updated (RFC 3339 format).+ string updated_at = 8;+}diff --git a/packages/proto/gen/ts/index.ts b/packages/proto/gen/ts/index.tsindex 3906733eb..6beebf151 100644--- a/packages/proto/gen/ts/index.ts+++ b/packages/proto/gen/ts/index.ts@@ -2,3 +2,4 @@export * from "./openstatus/monitor/v1/index.js";export * from "./openstatus/health/v1/index.js";export * from "./openstatus/status_report/v1/index.js";+export * from "./openstatus/status_page/v1/index.js";diff --git a/packages/proto/gen/ts/openstatus/status_page/v1/index.ts b/packages/proto/gen/ts/openstatus/status_page/v1/index.tsnew file mode 100644index 000000000..b1f257d44--- /dev/null+++ b/packages/proto/gen/ts/openstatus/status_page/v1/index.ts@@ -0,0 +1,5 @@+// Status page service exports+export * from "./status_page_pb.js";+export * from "./page_component_pb.js";+export * from "./page_subscriber_pb.js";+export * from "./service_pb.js";diff --git a/packages/proto/gen/ts/openstatus/status_page/v1/page_component_pb.ts b/packages/proto/gen/ts/openstatus/status_page/v1/page_component_pb.tsnew file mode 100644index 000000000..5b8006329--- /dev/null+++ b/packages/proto/gen/ts/openstatus/status_page/v1/page_component_pb.ts@@ -0,0 +1,182 @@+// @generated by protoc-gen-es v2.10.2 with parameter "target=ts,import_extension=.ts"+// @generated from file openstatus/status_page/v1/page_component.proto (package openstatus.status_page.v1, syntax proto3)+/* eslint-disable */++import type { GenEnum, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";+import { enumDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2";+import type { Message } from "@bufbuild/protobuf";++/**+ * Describes the file openstatus/status_page/v1/page_component.proto.+ */+export const file_openstatus_status_page_v1_page_component: GenFile = /*@__PURE__*/+ fileDesc("Ci5vcGVuc3RhdHVzL3N0YXR1c19wYWdlL3YxL3BhZ2VfY29tcG9uZW50LnByb3RvEhlvcGVuc3RhdHVzLnN0YXR1c19wYWdlLnYxIv0BCg1QYWdlQ29tcG9uZW50EgoKAmlkGAEgASgJEg8KB3BhZ2VfaWQYAiABKAkSDAoEbmFtZRgDIAEoCRITCgtkZXNjcmlwdGlvbhgEIAEoCRI6CgR0eXBlGAUgASgOMiwub3BlbnN0YXR1cy5zdGF0dXNfcGFnZS52MS5QYWdlQ29tcG9uZW50VHlwZRISCgptb25pdG9yX2lkGAYgASgJEg0KBW9yZGVyGAcgASgFEhAKCGdyb3VwX2lkGAggASgJEhMKC2dyb3VwX29yZGVyGAkgASgFEhIKCmNyZWF0ZWRfYXQYCiABKAkSEgoKdXBkYXRlZF9hdBgLIAEoCSJnChJQYWdlQ29tcG9uZW50R3JvdXASCgoCaWQYASABKAkSDwoHcGFnZV9pZBgCIAEoCRIMCgRuYW1lGAMgASgJEhIKCmNyZWF0ZWRfYXQYBCABKAkSEgoKdXBkYXRlZF9hdBgFIAEoCSp5ChFQYWdlQ29tcG9uZW50VHlwZRIjCh9QQUdFX0NPTVBPTkVOVF9UWVBFX1VOU1BFQ0lGSUVEEAASHwobUEFHRV9DT01QT05FTlRfVFlQRV9NT05JVE9SEAESHgoaUEFHRV9DT01QT05FTlRfVFlQRV9TVEFUSUMQAkJaWlhnaXRodWIuY29tL29wZW5zdGF0dXNocS9vcGVuc3RhdHVzL3BhY2thZ2VzL3Byb3RvL29wZW5zdGF0dXMvc3RhdHVzX3BhZ2UvdjE7c3RhdHVzcGFnZXYxYgZwcm90bzM");++/**+ * PageComponent represents a component displayed on a status page.+ *+ * @generated from message openstatus.status_page.v1.PageComponent+ */+export type PageComponent = Message<"openstatus.status_page.v1.PageComponent"> & {+ /**+ * Unique identifier for the component.+ *+ * @generated from field: string id = 1;+ */+ id: string;++ /**+ * ID of the status page this component belongs to.+ *+ * @generated from field: string page_id = 2;+ */+ pageId: string;++ /**+ * Display name of the component.+ *+ * @generated from field: string name = 3;+ */+ name: string;++ /**+ * Description of the component (optional).+ *+ * @generated from field: string description = 4;+ */+ description: string;++ /**+ * Type of the component (monitor or static).+ *+ * @generated from field: openstatus.status_page.v1.PageComponentType type = 5;+ */+ type: PageComponentType;++ /**+ * ID of the monitor if type is MONITOR (optional).+ *+ * @generated from field: string monitor_id = 6;+ */+ monitorId: string;++ /**+ * Display order of the component.+ *+ * @generated from field: int32 order = 7;+ */+ order: number;++ /**+ * ID of the group this component belongs to (optional).+ *+ * @generated from field: string group_id = 8;+ */+ groupId: string;++ /**+ * Order within the group if grouped.+ *+ * @generated from field: int32 group_order = 9;+ */+ groupOrder: number;++ /**+ * Timestamp when the component was created (RFC 3339 format).+ *+ * @generated from field: string created_at = 10;+ */+ createdAt: string;++ /**+ * Timestamp when the component was last updated (RFC 3339 format).+ *+ * @generated from field: string updated_at = 11;+ */+ updatedAt: string;+};++/**+ * Describes the message openstatus.status_page.v1.PageComponent.+ * Use `create(PageComponentSchema)` to create a new message.+ */+export const PageComponentSchema: GenMessage<PageComponent> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_page_component, 0);++/**+ * PageComponentGroup represents a group of components on a status page.+ *+ * @generated from message openstatus.status_page.v1.PageComponentGroup+ */+export type PageComponentGroup = Message<"openstatus.status_page.v1.PageComponentGroup"> & {+ /**+ * Unique identifier for the group.+ *+ * @generated from field: string id = 1;+ */+ id: string;++ /**+ * ID of the status page this group belongs to.+ *+ * @generated from field: string page_id = 2;+ */+ pageId: string;++ /**+ * Display name of the group.+ *+ * @generated from field: string name = 3;+ */+ name: string;++ /**+ * Timestamp when the group was created (RFC 3339 format).+ *+ * @generated from field: string created_at = 4;+ */+ createdAt: string;++ /**+ * Timestamp when the group was last updated (RFC 3339 format).+ *+ * @generated from field: string updated_at = 5;+ */+ updatedAt: string;+};++/**+ * Describes the message openstatus.status_page.v1.PageComponentGroup.+ * Use `create(PageComponentGroupSchema)` to create a new message.+ */+export const PageComponentGroupSchema: GenMessage<PageComponentGroup> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_page_component, 1);++/**+ * PageComponentType defines the type of a component on a status page.+ *+ * @generated from enum openstatus.status_page.v1.PageComponentType+ */+export enum PageComponentType {+ /**+ * @generated from enum value: PAGE_COMPONENT_TYPE_UNSPECIFIED = 0;+ */+ UNSPECIFIED = 0,++ /**+ * @generated from enum value: PAGE_COMPONENT_TYPE_MONITOR = 1;+ */+ MONITOR = 1,++ /**+ * @generated from enum value: PAGE_COMPONENT_TYPE_STATIC = 2;+ */+ STATIC = 2,+}++/**+ * Describes the enum openstatus.status_page.v1.PageComponentType.+ */+export const PageComponentTypeSchema: GenEnum<PageComponentType> = /*@__PURE__*/+ enumDesc(file_openstatus_status_page_v1_page_component, 0);+diff --git a/packages/proto/gen/ts/openstatus/status_page/v1/page_subscriber_pb.ts b/packages/proto/gen/ts/openstatus/status_page/v1/page_subscriber_pb.tsnew file mode 100644index 000000000..988aa4878--- /dev/null+++ b/packages/proto/gen/ts/openstatus/status_page/v1/page_subscriber_pb.ts@@ -0,0 +1,77 @@+// @generated by protoc-gen-es v2.10.2 with parameter "target=ts,import_extension=.ts"+// @generated from file openstatus/status_page/v1/page_subscriber.proto (package openstatus.status_page.v1, syntax proto3)+/* eslint-disable */++import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";+import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2";+import type { Message } from "@bufbuild/protobuf";++/**+ * Describes the file openstatus/status_page/v1/page_subscriber.proto.+ */+export const file_openstatus_status_page_v1_page_subscriber: GenFile = /*@__PURE__*/+ fileDesc("Ci9vcGVuc3RhdHVzL3N0YXR1c19wYWdlL3YxL3BhZ2Vfc3Vic2NyaWJlci5wcm90bxIZb3BlbnN0YXR1cy5zdGF0dXNfcGFnZS52MSKSAQoOUGFnZVN1YnNjcmliZXISCgoCaWQYASABKAkSDwoHcGFnZV9pZBgCIAEoCRINCgVlbWFpbBgDIAEoCRITCgthY2NlcHRlZF9hdBgEIAEoCRIXCg91bnN1YnNjcmliZWRfYXQYBSABKAkSEgoKY3JlYXRlZF9hdBgGIAEoCRISCgp1cGRhdGVkX2F0GAcgASgJQlpaWGdpdGh1Yi5jb20vb3BlbnN0YXR1c2hxL29wZW5zdGF0dXMvcGFja2FnZXMvcHJvdG8vb3BlbnN0YXR1cy9zdGF0dXNfcGFnZS92MTtzdGF0dXNwYWdldjFiBnByb3RvMw");++/**+ * PageSubscriber represents a subscriber to a status page.+ *+ * @generated from message openstatus.status_page.v1.PageSubscriber+ */+export type PageSubscriber = Message<"openstatus.status_page.v1.PageSubscriber"> & {+ /**+ * Unique identifier for the subscriber.+ *+ * @generated from field: string id = 1;+ */+ id: string;++ /**+ * ID of the status page the user is subscribed to.+ *+ * @generated from field: string page_id = 2;+ */+ pageId: string;++ /**+ * Email address of the subscriber.+ *+ * @generated from field: string email = 3;+ */+ email: string;++ /**+ * Timestamp when the subscription was accepted/confirmed (RFC 3339 format, optional).+ *+ * @generated from field: string accepted_at = 4;+ */+ acceptedAt: string;++ /**+ * Timestamp when the user unsubscribed (RFC 3339 format, optional).+ *+ * @generated from field: string unsubscribed_at = 5;+ */+ unsubscribedAt: string;++ /**+ * Timestamp when the subscription was created (RFC 3339 format).+ *+ * @generated from field: string created_at = 6;+ */+ createdAt: string;++ /**+ * Timestamp when the subscription was last updated (RFC 3339 format).+ *+ * @generated from field: string updated_at = 7;+ */+ updatedAt: string;+};++/**+ * Describes the message openstatus.status_page.v1.PageSubscriber.+ * Use `create(PageSubscriberSchema)` to create a new message.+ */+export const PageSubscriberSchema: GenMessage<PageSubscriber> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_page_subscriber, 0);+diff --git a/packages/proto/gen/ts/openstatus/status_page/v1/service_pb.ts b/packages/proto/gen/ts/openstatus/status_page/v1/service_pb.tsnew file mode 100644index 000000000..5ad755536--- /dev/null+++ b/packages/proto/gen/ts/openstatus/status_page/v1/service_pb.ts@@ -0,0 +1,1192 @@+// @generated by protoc-gen-es v2.10.2 with parameter "target=ts,import_extension=.ts"+// @generated from file openstatus/status_page/v1/service.proto (package openstatus.status_page.v1, syntax proto3)+/* eslint-disable */++import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";+import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2";+import { file_buf_validate_validate } from "../../../buf/validate/validate_pb.ts";+import type { PageComponent, PageComponentGroup } from "./page_component_pb.ts";+import { file_openstatus_status_page_v1_page_component } from "./page_component_pb.ts";+import type { PageSubscriber } from "./page_subscriber_pb.ts";+import { file_openstatus_status_page_v1_page_subscriber } from "./page_subscriber_pb.ts";+import type { Maintenance, OverallStatus, StatusPage, StatusPageSummary } from "./status_page_pb.ts";+import { file_openstatus_status_page_v1_status_page } from "./status_page_pb.ts";+import type { StatusReport } from "../../status_report/v1/status_report_pb.ts";+import { file_openstatus_status_report_v1_status_report } from "../../status_report/v1/status_report_pb.ts";+import type { Message } from "@bufbuild/protobuf";++/**+ * Describes the file openstatus/status_page/v1/service.proto.+ */+export const file_openstatus_status_page_v1_service: GenFile = /*@__PURE__*/+ fileDesc("CidvcGVuc3RhdHVzL3N0YXR1c19wYWdlL3YxL3NlcnZpY2UucHJvdG8SGW9wZW5zdGF0dXMuc3RhdHVzX3BhZ2UudjEi9AEKF0NyZWF0ZVN0YXR1c1BhZ2VSZXF1ZXN0EhkKBXRpdGxlGAEgASgJQgq6SAdyBRABGIACEiIKC2Rlc2NyaXB0aW9uGAIgASgJQgi6SAVyAxiACEgAiAEBEjQKBHNsdWcYAyABKAlCJrpII3IhEAEYgAIyGl5bYS16MC05XSsoPzotW2EtejAtOV0rKSokEhkKDGhvbWVwYWdlX3VybBgEIAEoCUgBiAEBEhgKC2NvbnRhY3RfdXJsGAUgASgJSAKIAQFCDgoMX2Rlc2NyaXB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fcGFnZS52MS5VbnN1YnNjcmliZUZyb21QYWdlUmVzcG9uc2USeAoPTGlzdFN1YnNjcmliZXJzEjEub3BlbnN0YXR1cy5zdGF0dXNfcGFnZS52MS5MaXN0U3Vic2NyaWJlcnNSZXF1ZXN0GjIub3BlbnN0YXR1cy5zdGF0dXNfcGFnZS52MS5MaXN0U3Vic2NyaWJlcnNSZXNwb25zZRKHAQoUR2V0U3RhdHVzUGFnZUNvbnRlbnQSNi5vcGVuc3RhdHVzLnN0YXR1c19wYWdlLnYxLkdldFN0YXR1c1BhZ2VDb250ZW50UmVxdWVzdBo3Lm9wZW5zdGF0dXMuc3RhdHVzX3BhZ2UudjEuR2V0U3RhdHVzUGFnZUNvbnRlbnRSZXNwb25zZRJ7ChBHZXRPdmVyYWxsU3RhdHVzEjIub3BlbnN0YXR1cy5zdGF0dXNfcGFnZS52MS5HZXRPdmVyYWxsU3RhdHVzUmVxdWVzdBozLm9wZW5zdGF0dXMuc3RhdHVzX3BhZ2UudjEuR2V0T3ZlcmFsbFN0YXR1c1Jlc3BvbnNlQlpaWGdpdGh1Yi5jb20vb3BlbnN0YXR1c2hxL29wZW5zdGF0dXMvcGFja2FnZXMvcHJvdG8vb3BlbnN0YXR1cy9zdGF0dXNfcGFnZS92MTtzdGF0dXNwYWdldjFiBnByb3RvMw", [file_buf_validate_validate, file_openstatus_status_page_v1_page_component, file_openstatus_status_page_v1_page_subscriber, file_openstatus_status_page_v1_status_page, file_openstatus_status_report_v1_status_report]);++/**+ * @generated from message openstatus.status_page.v1.CreateStatusPageRequest+ */+export type CreateStatusPageRequest = Message<"openstatus.status_page.v1.CreateStatusPageRequest"> & {+ /**+ * Title of the status page (required).+ *+ * @generated from field: string title = 1;+ */+ title: string;++ /**+ * Description of the status page (optional).+ *+ * @generated from field: optional string description = 2;+ */+ description?: string;++ /**+ * URL-friendly slug for the status page (required).+ *+ * @generated from field: string slug = 3;+ */+ slug: string;++ /**+ * URL to the homepage (optional).+ *+ * @generated from field: optional string homepage_url = 4;+ */+ homepageUrl?: string;++ /**+ * URL to the contact page (optional).+ *+ * @generated from field: optional string contact_url = 5;+ */+ contactUrl?: string;+};++/**+ * Describes the message openstatus.status_page.v1.CreateStatusPageRequest.+ * Use `create(CreateStatusPageRequestSchema)` to create a new message.+ */+export const CreateStatusPageRequestSchema: GenMessage<CreateStatusPageRequest> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_service, 0);++/**+ * @generated from message openstatus.status_page.v1.CreateStatusPageResponse+ */+export type CreateStatusPageResponse = Message<"openstatus.status_page.v1.CreateStatusPageResponse"> & {+ /**+ * The created status page.+ *+ * @generated from field: openstatus.status_page.v1.StatusPage status_page = 1;+ */+ statusPage?: StatusPage;+};++/**+ * Describes the message openstatus.status_page.v1.CreateStatusPageResponse.+ * Use `create(CreateStatusPageResponseSchema)` to create a new message.+ */+export const CreateStatusPageResponseSchema: GenMessage<CreateStatusPageResponse> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_service, 1);++/**+ * @generated from message openstatus.status_page.v1.GetStatusPageRequest+ */+export type GetStatusPageRequest = Message<"openstatus.status_page.v1.GetStatusPageRequest"> & {+ /**+ * ID of the status page to retrieve (required).+ *+ * @generated from field: string id = 1;+ */+ id: string;+};++/**+ * Describes the message openstatus.status_page.v1.GetStatusPageRequest.+ * Use `create(GetStatusPageRequestSchema)` to create a new message.+ */+export const GetStatusPageRequestSchema: GenMessage<GetStatusPageRequest> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_service, 2);++/**+ * @generated from message openstatus.status_page.v1.GetStatusPageResponse+ */+export type GetStatusPageResponse = Message<"openstatus.status_page.v1.GetStatusPageResponse"> & {+ /**+ * The requested status page.+ *+ * @generated from field: openstatus.status_page.v1.StatusPage status_page = 1;+ */+ statusPage?: StatusPage;+};++/**+ * Describes the message openstatus.status_page.v1.GetStatusPageResponse.+ * Use `create(GetStatusPageResponseSchema)` to create a new message.+ */+export const GetStatusPageResponseSchema: GenMessage<GetStatusPageResponse> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_service, 3);++/**+ * @generated from message openstatus.status_page.v1.ListStatusPagesRequest+ */+export type ListStatusPagesRequest = Message<"openstatus.status_page.v1.ListStatusPagesRequest"> & {+ /**+ * Maximum number of pages to return (1-100, defaults to 50).+ *+ * @generated from field: optional int32 limit = 1;+ */+ limit?: number;++ /**+ * Number of pages to skip for pagination (defaults to 0).+ *+ * @generated from field: optional int32 offset = 2;+ */+ offset?: number;+};++/**+ * Describes the message openstatus.status_page.v1.ListStatusPagesRequest.+ * Use `create(ListStatusPagesRequestSchema)` to create a new message.+ */+export const ListStatusPagesRequestSchema: GenMessage<ListStatusPagesRequest> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_service, 4);++/**+ * @generated from message openstatus.status_page.v1.ListStatusPagesResponse+ */+export type ListStatusPagesResponse = Message<"openstatus.status_page.v1.ListStatusPagesResponse"> & {+ /**+ * List of status pages (metadata only).+ *+ * @generated from field: repeated openstatus.status_page.v1.StatusPageSummary status_pages = 1;+ */+ statusPages: StatusPageSummary[];++ /**+ * Total number of status pages.+ *+ * @generated from field: int32 total_size = 2;+ */+ totalSize: number;+};++/**+ * Describes the message openstatus.status_page.v1.ListStatusPagesResponse.+ * Use `create(ListStatusPagesResponseSchema)` to create a new message.+ */+export const ListStatusPagesResponseSchema: GenMessage<ListStatusPagesResponse> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_service, 5);++/**+ * @generated from message openstatus.status_page.v1.UpdateStatusPageRequest+ */+export type UpdateStatusPageRequest = Message<"openstatus.status_page.v1.UpdateStatusPageRequest"> & {+ /**+ * ID of the status page to update (required).+ *+ * @generated from field: string id = 1;+ */+ id: string;++ /**+ * New title for the status page (optional).+ *+ * @generated from field: optional string title = 2;+ */+ title?: string;++ /**+ * New description for the status page (optional).+ *+ * @generated from field: optional string description = 3;+ */+ description?: string;++ /**+ * New slug for the status page (optional).+ *+ * @generated from field: optional string slug = 4;+ */+ slug?: string;++ /**+ * New homepage URL (optional).+ *+ * @generated from field: optional string homepage_url = 5;+ */+ homepageUrl?: string;++ /**+ * New contact URL (optional).+ *+ * @generated from field: optional string contact_url = 6;+ */+ contactUrl?: string;+};++/**+ * Describes the message openstatus.status_page.v1.UpdateStatusPageRequest.+ * Use `create(UpdateStatusPageRequestSchema)` to create a new message.+ */+export const UpdateStatusPageRequestSchema: GenMessage<UpdateStatusPageRequest> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_service, 6);++/**+ * @generated from message openstatus.status_page.v1.UpdateStatusPageResponse+ */+export type UpdateStatusPageResponse = Message<"openstatus.status_page.v1.UpdateStatusPageResponse"> & {+ /**+ * The updated status page.+ *+ * @generated from field: openstatus.status_page.v1.StatusPage status_page = 1;+ */+ statusPage?: StatusPage;+};++/**+ * Describes the message openstatus.status_page.v1.UpdateStatusPageResponse.+ * Use `create(UpdateStatusPageResponseSchema)` to create a new message.+ */+export const UpdateStatusPageResponseSchema: GenMessage<UpdateStatusPageResponse> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_service, 7);++/**+ * @generated from message openstatus.status_page.v1.DeleteStatusPageRequest+ */+export type DeleteStatusPageRequest = Message<"openstatus.status_page.v1.DeleteStatusPageRequest"> & {+ /**+ * ID of the status page to delete (required).+ *+ * @generated from field: string id = 1;+ */+ id: string;+};++/**+ * Describes the message openstatus.status_page.v1.DeleteStatusPageRequest.+ * Use `create(DeleteStatusPageRequestSchema)` to create a new message.+ */+export const DeleteStatusPageRequestSchema: GenMessage<DeleteStatusPageRequest> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_service, 8);++/**+ * @generated from message openstatus.status_page.v1.DeleteStatusPageResponse+ */+export type DeleteStatusPageResponse = Message<"openstatus.status_page.v1.DeleteStatusPageResponse"> & {+ /**+ * Whether the deletion was successful.+ *+ * @generated from field: bool success = 1;+ */+ success: boolean;+};++/**+ * Describes the message openstatus.status_page.v1.DeleteStatusPageResponse.+ * Use `create(DeleteStatusPageResponseSchema)` to create a new message.+ */+export const DeleteStatusPageResponseSchema: GenMessage<DeleteStatusPageResponse> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_service, 9);++/**+ * @generated from message openstatus.status_page.v1.AddMonitorComponentRequest+ */+export type AddMonitorComponentRequest = Message<"openstatus.status_page.v1.AddMonitorComponentRequest"> & {+ /**+ * ID of the status page to add the component to (required).+ *+ * @generated from field: string page_id = 1;+ */+ pageId: string;++ /**+ * ID of the monitor to associate with this component (required).+ *+ * @generated from field: string monitor_id = 2;+ */+ monitorId: string;++ /**+ * Display name for the component (optional, defaults to monitor name).+ *+ * @generated from field: optional string name = 3;+ */+ name?: string;++ /**+ * Description of the component (optional).+ *+ * @generated from field: optional string description = 4;+ */+ description?: string;++ /**+ * Display order of the component (optional).+ *+ * @generated from field: optional int32 order = 5;+ */+ order?: number;++ /**+ * ID of the group to add this component to (optional).+ *+ * @generated from field: optional string group_id = 6;+ */+ groupId?: string;+};++/**+ * Describes the message openstatus.status_page.v1.AddMonitorComponentRequest.+ * Use `create(AddMonitorComponentRequestSchema)` to create a new message.+ */+export const AddMonitorComponentRequestSchema: GenMessage<AddMonitorComponentRequest> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_service, 10);++/**+ * @generated from message openstatus.status_page.v1.AddMonitorComponentResponse+ */+export type AddMonitorComponentResponse = Message<"openstatus.status_page.v1.AddMonitorComponentResponse"> & {+ /**+ * The created component.+ *+ * @generated from field: openstatus.status_page.v1.PageComponent component = 1;+ */+ component?: PageComponent;+};++/**+ * Describes the message openstatus.status_page.v1.AddMonitorComponentResponse.+ * Use `create(AddMonitorComponentResponseSchema)` to create a new message.+ */+export const AddMonitorComponentResponseSchema: GenMessage<AddMonitorComponentResponse> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_service, 11);++/**+ * @generated from message openstatus.status_page.v1.AddStaticComponentRequest+ */+export type AddStaticComponentRequest = Message<"openstatus.status_page.v1.AddStaticComponentRequest"> & {+ /**+ * ID of the status page to add the component to (required).+ *+ * @generated from field: string page_id = 1;+ */+ pageId: string;++ /**+ * Display name for the component (required).+ *+ * @generated from field: string name = 2;+ */+ name: string;++ /**+ * Description of the component (optional).+ *+ * @generated from field: optional string description = 3;+ */+ description?: string;++ /**+ * Display order of the component (optional).+ *+ * @generated from field: optional int32 order = 4;+ */+ order?: number;++ /**+ * ID of the group to add this component to (optional).+ *+ * @generated from field: optional string group_id = 5;+ */+ groupId?: string;+};++/**+ * Describes the message openstatus.status_page.v1.AddStaticComponentRequest.+ * Use `create(AddStaticComponentRequestSchema)` to create a new message.+ */+export const AddStaticComponentRequestSchema: GenMessage<AddStaticComponentRequest> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_service, 12);++/**+ * @generated from message openstatus.status_page.v1.AddStaticComponentResponse+ */+export type AddStaticComponentResponse = Message<"openstatus.status_page.v1.AddStaticComponentResponse"> & {+ /**+ * The created component.+ *+ * @generated from field: openstatus.status_page.v1.PageComponent component = 1;+ */+ component?: PageComponent;+};++/**+ * Describes the message openstatus.status_page.v1.AddStaticComponentResponse.+ * Use `create(AddStaticComponentResponseSchema)` to create a new message.+ */+export const AddStaticComponentResponseSchema: GenMessage<AddStaticComponentResponse> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_service, 13);++/**+ * @generated from message openstatus.status_page.v1.RemoveComponentRequest+ */+export type RemoveComponentRequest = Message<"openstatus.status_page.v1.RemoveComponentRequest"> & {+ /**+ * ID of the component to remove (required).+ *+ * @generated from field: string id = 1;+ */+ id: string;+};++/**+ * Describes the message openstatus.status_page.v1.RemoveComponentRequest.+ * Use `create(RemoveComponentRequestSchema)` to create a new message.+ */+export const RemoveComponentRequestSchema: GenMessage<RemoveComponentRequest> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_service, 14);++/**+ * @generated from message openstatus.status_page.v1.RemoveComponentResponse+ */+export type RemoveComponentResponse = Message<"openstatus.status_page.v1.RemoveComponentResponse"> & {+ /**+ * Whether the removal was successful.+ *+ * @generated from field: bool success = 1;+ */+ success: boolean;+};++/**+ * Describes the message openstatus.status_page.v1.RemoveComponentResponse.+ * Use `create(RemoveComponentResponseSchema)` to create a new message.+ */+export const RemoveComponentResponseSchema: GenMessage<RemoveComponentResponse> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_service, 15);++/**+ * @generated from message openstatus.status_page.v1.UpdateComponentRequest+ */+export type UpdateComponentRequest = Message<"openstatus.status_page.v1.UpdateComponentRequest"> & {+ /**+ * ID of the component to update (required).+ *+ * @generated from field: string id = 1;+ */+ id: string;++ /**+ * New display name for the component (optional).+ *+ * @generated from field: optional string name = 2;+ */+ name?: string;++ /**+ * New description for the component (optional).+ *+ * @generated from field: optional string description = 3;+ */+ description?: string;++ /**+ * New display order (optional).+ *+ * @generated from field: optional int32 order = 4;+ */+ order?: number;++ /**+ * New group ID (optional, set to empty string to remove from group).+ *+ * @generated from field: optional string group_id = 5;+ */+ groupId?: string;++ /**+ * New order within the group (optional).+ *+ * @generated from field: optional int32 group_order = 6;+ */+ groupOrder?: number;+};++/**+ * Describes the message openstatus.status_page.v1.UpdateComponentRequest.+ * Use `create(UpdateComponentRequestSchema)` to create a new message.+ */+export const UpdateComponentRequestSchema: GenMessage<UpdateComponentRequest> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_service, 16);++/**+ * @generated from message openstatus.status_page.v1.UpdateComponentResponse+ */+export type UpdateComponentResponse = Message<"openstatus.status_page.v1.UpdateComponentResponse"> & {+ /**+ * The updated component.+ *+ * @generated from field: openstatus.status_page.v1.PageComponent component = 1;+ */+ component?: PageComponent;+};++/**+ * Describes the message openstatus.status_page.v1.UpdateComponentResponse.+ * Use `create(UpdateComponentResponseSchema)` to create a new message.+ */+export const UpdateComponentResponseSchema: GenMessage<UpdateComponentResponse> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_service, 17);++/**+ * @generated from message openstatus.status_page.v1.CreateComponentGroupRequest+ */+export type CreateComponentGroupRequest = Message<"openstatus.status_page.v1.CreateComponentGroupRequest"> & {+ /**+ * ID of the status page to create the group in (required).+ *+ * @generated from field: string page_id = 1;+ */+ pageId: string;++ /**+ * Display name for the group (required).+ *+ * @generated from field: string name = 2;+ */+ name: string;+};++/**+ * Describes the message openstatus.status_page.v1.CreateComponentGroupRequest.+ * Use `create(CreateComponentGroupRequestSchema)` to create a new message.+ */+export const CreateComponentGroupRequestSchema: GenMessage<CreateComponentGroupRequest> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_service, 18);++/**+ * @generated from message openstatus.status_page.v1.CreateComponentGroupResponse+ */+export type CreateComponentGroupResponse = Message<"openstatus.status_page.v1.CreateComponentGroupResponse"> & {+ /**+ * The created component group.+ *+ * @generated from field: openstatus.status_page.v1.PageComponentGroup group = 1;+ */+ group?: PageComponentGroup;+};++/**+ * Describes the message openstatus.status_page.v1.CreateComponentGroupResponse.+ * Use `create(CreateComponentGroupResponseSchema)` to create a new message.+ */+export const CreateComponentGroupResponseSchema: GenMessage<CreateComponentGroupResponse> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_service, 19);++/**+ * @generated from message openstatus.status_page.v1.DeleteComponentGroupRequest+ */+export type DeleteComponentGroupRequest = Message<"openstatus.status_page.v1.DeleteComponentGroupRequest"> & {+ /**+ * ID of the component group to delete (required).+ *+ * @generated from field: string id = 1;+ */+ id: string;+};++/**+ * Describes the message openstatus.status_page.v1.DeleteComponentGroupRequest.+ * Use `create(DeleteComponentGroupRequestSchema)` to create a new message.+ */+export const DeleteComponentGroupRequestSchema: GenMessage<DeleteComponentGroupRequest> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_service, 20);++/**+ * @generated from message openstatus.status_page.v1.DeleteComponentGroupResponse+ */+export type DeleteComponentGroupResponse = Message<"openstatus.status_page.v1.DeleteComponentGroupResponse"> & {+ /**+ * Whether the deletion was successful.+ *+ * @generated from field: bool success = 1;+ */+ success: boolean;+};++/**+ * Describes the message openstatus.status_page.v1.DeleteComponentGroupResponse.+ * Use `create(DeleteComponentGroupResponseSchema)` to create a new message.+ */+export const DeleteComponentGroupResponseSchema: GenMessage<DeleteComponentGroupResponse> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_service, 21);++/**+ * @generated from message openstatus.status_page.v1.UpdateComponentGroupRequest+ */+export type UpdateComponentGroupRequest = Message<"openstatus.status_page.v1.UpdateComponentGroupRequest"> & {+ /**+ * ID of the component group to update (required).+ *+ * @generated from field: string id = 1;+ */+ id: string;++ /**+ * New display name for the group (optional).+ *+ * @generated from field: optional string name = 2;+ */+ name?: string;+};++/**+ * Describes the message openstatus.status_page.v1.UpdateComponentGroupRequest.+ * Use `create(UpdateComponentGroupRequestSchema)` to create a new message.+ */+export const UpdateComponentGroupRequestSchema: GenMessage<UpdateComponentGroupRequest> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_service, 22);++/**+ * @generated from message openstatus.status_page.v1.UpdateComponentGroupResponse+ */+export type UpdateComponentGroupResponse = Message<"openstatus.status_page.v1.UpdateComponentGroupResponse"> & {+ /**+ * The updated component group.+ *+ * @generated from field: openstatus.status_page.v1.PageComponentGroup group = 1;+ */+ group?: PageComponentGroup;+};++/**+ * Describes the message openstatus.status_page.v1.UpdateComponentGroupResponse.+ * Use `create(UpdateComponentGroupResponseSchema)` to create a new message.+ */+export const UpdateComponentGroupResponseSchema: GenMessage<UpdateComponentGroupResponse> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_service, 23);++/**+ * @generated from message openstatus.status_page.v1.SubscribeToPageRequest+ */+export type SubscribeToPageRequest = Message<"openstatus.status_page.v1.SubscribeToPageRequest"> & {+ /**+ * ID of the status page to subscribe to (required).+ *+ * @generated from field: string page_id = 1;+ */+ pageId: string;++ /**+ * Email address to subscribe (required).+ *+ * @generated from field: string email = 2;+ */+ email: string;+};++/**+ * Describes the message openstatus.status_page.v1.SubscribeToPageRequest.+ * Use `create(SubscribeToPageRequestSchema)` to create a new message.+ */+export const SubscribeToPageRequestSchema: GenMessage<SubscribeToPageRequest> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_service, 24);++/**+ * @generated from message openstatus.status_page.v1.SubscribeToPageResponse+ */+export type SubscribeToPageResponse = Message<"openstatus.status_page.v1.SubscribeToPageResponse"> & {+ /**+ * The created subscriber.+ *+ * @generated from field: openstatus.status_page.v1.PageSubscriber subscriber = 1;+ */+ subscriber?: PageSubscriber;+};++/**+ * Describes the message openstatus.status_page.v1.SubscribeToPageResponse.+ * Use `create(SubscribeToPageResponseSchema)` to create a new message.+ */+export const SubscribeToPageResponseSchema: GenMessage<SubscribeToPageResponse> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_service, 25);++/**+ * @generated from message openstatus.status_page.v1.UnsubscribeFromPageRequest+ */+export type UnsubscribeFromPageRequest = Message<"openstatus.status_page.v1.UnsubscribeFromPageRequest"> & {+ /**+ * ID of the status page to unsubscribe from (required).+ *+ * @generated from field: string page_id = 1;+ */+ pageId: string;++ /**+ * Identifier for the subscription (either email or id).+ *+ * @generated from oneof openstatus.status_page.v1.UnsubscribeFromPageRequest.identifier+ */+ identifier: {+ /**+ * Email address to unsubscribe.+ *+ * @generated from field: string email = 2;+ */+ value: string;+ case: "email";+ } | {+ /**+ * Subscriber ID.+ *+ * @generated from field: string id = 3;+ */+ value: string;+ case: "id";+ } | { case: undefined; value?: undefined };+};++/**+ * Describes the message openstatus.status_page.v1.UnsubscribeFromPageRequest.+ * Use `create(UnsubscribeFromPageRequestSchema)` to create a new message.+ */+export const UnsubscribeFromPageRequestSchema: GenMessage<UnsubscribeFromPageRequest> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_service, 26);++/**+ * @generated from message openstatus.status_page.v1.UnsubscribeFromPageResponse+ */+export type UnsubscribeFromPageResponse = Message<"openstatus.status_page.v1.UnsubscribeFromPageResponse"> & {+ /**+ * Whether the unsubscription was successful.+ *+ * @generated from field: bool success = 1;+ */+ success: boolean;+};++/**+ * Describes the message openstatus.status_page.v1.UnsubscribeFromPageResponse.+ * Use `create(UnsubscribeFromPageResponseSchema)` to create a new message.+ */+export const UnsubscribeFromPageResponseSchema: GenMessage<UnsubscribeFromPageResponse> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_service, 27);++/**+ * @generated from message openstatus.status_page.v1.ListSubscribersRequest+ */+export type ListSubscribersRequest = Message<"openstatus.status_page.v1.ListSubscribersRequest"> & {+ /**+ * ID of the status page to list subscribers for (required).+ *+ * @generated from field: string page_id = 1;+ */+ pageId: string;++ /**+ * Maximum number of subscribers to return (1-100, defaults to 50).+ *+ * @generated from field: optional int32 limit = 2;+ */+ limit?: number;++ /**+ * Number of subscribers to skip for pagination (defaults to 0).+ *+ * @generated from field: optional int32 offset = 3;+ */+ offset?: number;++ /**+ * Whether to include unsubscribed users (defaults to false).+ *+ * @generated from field: optional bool include_unsubscribed = 4;+ */+ includeUnsubscribed?: boolean;+};++/**+ * Describes the message openstatus.status_page.v1.ListSubscribersRequest.+ * Use `create(ListSubscribersRequestSchema)` to create a new message.+ */+export const ListSubscribersRequestSchema: GenMessage<ListSubscribersRequest> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_service, 28);++/**+ * @generated from message openstatus.status_page.v1.ListSubscribersResponse+ */+export type ListSubscribersResponse = Message<"openstatus.status_page.v1.ListSubscribersResponse"> & {+ /**+ * List of subscribers.+ *+ * @generated from field: repeated openstatus.status_page.v1.PageSubscriber subscribers = 1;+ */+ subscribers: PageSubscriber[];++ /**+ * Total number of subscribers matching the filter.+ *+ * @generated from field: int32 total_size = 2;+ */+ totalSize: number;+};++/**+ * Describes the message openstatus.status_page.v1.ListSubscribersResponse.+ * Use `create(ListSubscribersResponseSchema)` to create a new message.+ */+export const ListSubscribersResponseSchema: GenMessage<ListSubscribersResponse> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_service, 29);++/**+ * @generated from message openstatus.status_page.v1.GetStatusPageContentRequest+ */+export type GetStatusPageContentRequest = Message<"openstatus.status_page.v1.GetStatusPageContentRequest"> & {+ /**+ * Identifier for the status page (either id or slug).+ *+ * @generated from oneof openstatus.status_page.v1.GetStatusPageContentRequest.identifier+ */+ identifier: {+ /**+ * ID of the status page.+ *+ * @generated from field: string id = 1;+ */+ value: string;+ case: "id";+ } | {+ /**+ * Slug of the status page.+ *+ * @generated from field: string slug = 2;+ */+ value: string;+ case: "slug";+ } | { case: undefined; value?: undefined };+};++/**+ * Describes the message openstatus.status_page.v1.GetStatusPageContentRequest.+ * Use `create(GetStatusPageContentRequestSchema)` to create a new message.+ */+export const GetStatusPageContentRequestSchema: GenMessage<GetStatusPageContentRequest> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_service, 30);++/**+ * @generated from message openstatus.status_page.v1.GetStatusPageContentResponse+ */+export type GetStatusPageContentResponse = Message<"openstatus.status_page.v1.GetStatusPageContentResponse"> & {+ /**+ * The status page details.+ *+ * @generated from field: openstatus.status_page.v1.StatusPage status_page = 1;+ */+ statusPage?: StatusPage;++ /**+ * Components on the status page.+ *+ * @generated from field: repeated openstatus.status_page.v1.PageComponent components = 2;+ */+ components: PageComponent[];++ /**+ * Component groups on the status page.+ *+ * @generated from field: repeated openstatus.status_page.v1.PageComponentGroup groups = 3;+ */+ groups: PageComponentGroup[];++ /**+ * Active and recent status reports.+ *+ * @generated from field: repeated openstatus.status_report.v1.StatusReport status_reports = 4;+ */+ statusReports: StatusReport[];++ /**+ * Scheduled maintenances.+ *+ * @generated from field: repeated openstatus.status_page.v1.Maintenance maintenances = 5;+ */+ maintenances: Maintenance[];+};++/**+ * Describes the message openstatus.status_page.v1.GetStatusPageContentResponse.+ * Use `create(GetStatusPageContentResponseSchema)` to create a new message.+ */+export const GetStatusPageContentResponseSchema: GenMessage<GetStatusPageContentResponse> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_service, 31);++/**+ * @generated from message openstatus.status_page.v1.GetOverallStatusRequest+ */+export type GetOverallStatusRequest = Message<"openstatus.status_page.v1.GetOverallStatusRequest"> & {+ /**+ * Identifier for the status page (either id or slug).+ *+ * @generated from oneof openstatus.status_page.v1.GetOverallStatusRequest.identifier+ */+ identifier: {+ /**+ * ID of the status page.+ *+ * @generated from field: string id = 1;+ */+ value: string;+ case: "id";+ } | {+ /**+ * Slug of the status page.+ *+ * @generated from field: string slug = 2;+ */+ value: string;+ case: "slug";+ } | { case: undefined; value?: undefined };+};++/**+ * Describes the message openstatus.status_page.v1.GetOverallStatusRequest.+ * Use `create(GetOverallStatusRequestSchema)` to create a new message.+ */+export const GetOverallStatusRequestSchema: GenMessage<GetOverallStatusRequest> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_service, 32);++/**+ * ComponentStatus represents the status of a single component.+ *+ * @generated from message openstatus.status_page.v1.ComponentStatus+ */+export type ComponentStatus = Message<"openstatus.status_page.v1.ComponentStatus"> & {+ /**+ * ID of the component.+ *+ * @generated from field: string component_id = 1;+ */+ componentId: string;++ /**+ * Current status of the component.+ *+ * @generated from field: openstatus.status_page.v1.OverallStatus status = 2;+ */+ status: OverallStatus;+};++/**+ * Describes the message openstatus.status_page.v1.ComponentStatus.+ * Use `create(ComponentStatusSchema)` to create a new message.+ */+export const ComponentStatusSchema: GenMessage<ComponentStatus> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_service, 33);++/**+ * @generated from message openstatus.status_page.v1.GetOverallStatusResponse+ */+export type GetOverallStatusResponse = Message<"openstatus.status_page.v1.GetOverallStatusResponse"> & {+ /**+ * Aggregated status across all components.+ *+ * @generated from field: openstatus.status_page.v1.OverallStatus overall_status = 1;+ */+ overallStatus: OverallStatus;++ /**+ * Status of individual components.+ *+ * @generated from field: repeated openstatus.status_page.v1.ComponentStatus component_statuses = 2;+ */+ componentStatuses: ComponentStatus[];+};++/**+ * Describes the message openstatus.status_page.v1.GetOverallStatusResponse.+ * Use `create(GetOverallStatusResponseSchema)` to create a new message.+ */+export const GetOverallStatusResponseSchema: GenMessage<GetOverallStatusResponse> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_service, 34);++/**+ * StatusPageService provides CRUD and management operations for status pages.+ *+ * --- Page CRUD ---+ *+ * @generated from service openstatus.status_page.v1.StatusPageService+ */+export const StatusPageService: GenService<{+ /**+ * CreateStatusPage creates a new status page.+ *+ * @generated from rpc openstatus.status_page.v1.StatusPageService.CreateStatusPage+ */+ createStatusPage: {+ methodKind: "unary";+ input: typeof CreateStatusPageRequestSchema;+ output: typeof CreateStatusPageResponseSchema;+ },+ /**+ * GetStatusPage retrieves a specific status page by ID.+ *+ * @generated from rpc openstatus.status_page.v1.StatusPageService.GetStatusPage+ */+ getStatusPage: {+ methodKind: "unary";+ input: typeof GetStatusPageRequestSchema;+ output: typeof GetStatusPageResponseSchema;+ },+ /**+ * ListStatusPages returns all status pages for the workspace.+ *+ * @generated from rpc openstatus.status_page.v1.StatusPageService.ListStatusPages+ */+ listStatusPages: {+ methodKind: "unary";+ input: typeof ListStatusPagesRequestSchema;+ output: typeof ListStatusPagesResponseSchema;+ },+ /**+ * UpdateStatusPage updates an existing status page.+ *+ * @generated from rpc openstatus.status_page.v1.StatusPageService.UpdateStatusPage+ */+ updateStatusPage: {+ methodKind: "unary";+ input: typeof UpdateStatusPageRequestSchema;+ output: typeof UpdateStatusPageResponseSchema;+ },+ /**+ * DeleteStatusPage removes a status page.+ *+ * @generated from rpc openstatus.status_page.v1.StatusPageService.DeleteStatusPage+ */+ deleteStatusPage: {+ methodKind: "unary";+ input: typeof DeleteStatusPageRequestSchema;+ output: typeof DeleteStatusPageResponseSchema;+ },+ /**+ * AddMonitorComponent adds a monitor-based component to a status page.+ *+ * @generated from rpc openstatus.status_page.v1.StatusPageService.AddMonitorComponent+ */+ addMonitorComponent: {+ methodKind: "unary";+ input: typeof AddMonitorComponentRequestSchema;+ output: typeof AddMonitorComponentResponseSchema;+ },+ /**+ * AddStaticComponent adds a static component to a status page.+ *+ * @generated from rpc openstatus.status_page.v1.StatusPageService.AddStaticComponent+ */+ addStaticComponent: {+ methodKind: "unary";+ input: typeof AddStaticComponentRequestSchema;+ output: typeof AddStaticComponentResponseSchema;+ },+ /**+ * RemoveComponent removes a component from a status page.+ *+ * @generated from rpc openstatus.status_page.v1.StatusPageService.RemoveComponent+ */+ removeComponent: {+ methodKind: "unary";+ input: typeof RemoveComponentRequestSchema;+ output: typeof RemoveComponentResponseSchema;+ },+ /**+ * UpdateComponent updates an existing component.+ *+ * @generated from rpc openstatus.status_page.v1.StatusPageService.UpdateComponent+ */+ updateComponent: {+ methodKind: "unary";+ input: typeof UpdateComponentRequestSchema;+ output: typeof UpdateComponentResponseSchema;+ },+ /**+ * CreateComponentGroup creates a new component group.+ *+ * @generated from rpc openstatus.status_page.v1.StatusPageService.CreateComponentGroup+ */+ createComponentGroup: {+ methodKind: "unary";+ input: typeof CreateComponentGroupRequestSchema;+ output: typeof CreateComponentGroupResponseSchema;+ },+ /**+ * DeleteComponentGroup removes a component group.+ *+ * @generated from rpc openstatus.status_page.v1.StatusPageService.DeleteComponentGroup+ */+ deleteComponentGroup: {+ methodKind: "unary";+ input: typeof DeleteComponentGroupRequestSchema;+ output: typeof DeleteComponentGroupResponseSchema;+ },+ /**+ * UpdateComponentGroup updates an existing component group.+ *+ * @generated from rpc openstatus.status_page.v1.StatusPageService.UpdateComponentGroup+ */+ updateComponentGroup: {+ methodKind: "unary";+ input: typeof UpdateComponentGroupRequestSchema;+ output: typeof UpdateComponentGroupResponseSchema;+ },+ /**+ * SubscribeToPage subscribes an email to a status page.+ *+ * @generated from rpc openstatus.status_page.v1.StatusPageService.SubscribeToPage+ */+ subscribeToPage: {+ methodKind: "unary";+ input: typeof SubscribeToPageRequestSchema;+ output: typeof SubscribeToPageResponseSchema;+ },+ /**+ * UnsubscribeFromPage removes a subscription from a status page.+ *+ * @generated from rpc openstatus.status_page.v1.StatusPageService.UnsubscribeFromPage+ */+ unsubscribeFromPage: {+ methodKind: "unary";+ input: typeof UnsubscribeFromPageRequestSchema;+ output: typeof UnsubscribeFromPageResponseSchema;+ },+ /**+ * ListSubscribers returns all subscribers for a status page.+ *+ * @generated from rpc openstatus.status_page.v1.StatusPageService.ListSubscribers+ */+ listSubscribers: {+ methodKind: "unary";+ input: typeof ListSubscribersRequestSchema;+ output: typeof ListSubscribersResponseSchema;+ },+ /**+ * GetStatusPageContent retrieves the full content of a status page including components and reports.+ *+ * @generated from rpc openstatus.status_page.v1.StatusPageService.GetStatusPageContent+ */+ getStatusPageContent: {+ methodKind: "unary";+ input: typeof GetStatusPageContentRequestSchema;+ output: typeof GetStatusPageContentResponseSchema;+ },+ /**+ * GetOverallStatus returns the aggregated status of a status page.+ *+ * @generated from rpc openstatus.status_page.v1.StatusPageService.GetOverallStatus+ */+ getOverallStatus: {+ methodKind: "unary";+ input: typeof GetOverallStatusRequestSchema;+ output: typeof GetOverallStatusResponseSchema;+ },+}> = /*@__PURE__*/+ serviceDesc(file_openstatus_status_page_v1_service, 0);+diff --git a/packages/proto/gen/ts/openstatus/status_page/v1/status_page_pb.ts b/packages/proto/gen/ts/openstatus/status_page/v1/status_page_pb.tsnew file mode 100644index 000000000..3059ca88f--- /dev/null+++ b/packages/proto/gen/ts/openstatus/status_page/v1/status_page_pb.ts@@ -0,0 +1,359 @@+// @generated by protoc-gen-es v2.10.2 with parameter "target=ts,import_extension=.ts"+// @generated from file openstatus/status_page/v1/status_page.proto (package openstatus.status_page.v1, syntax proto3)+/* eslint-disable */++import type { GenEnum, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";+import { enumDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2";+import type { Message } from "@bufbuild/protobuf";++/**+ * Describes the file openstatus/status_page/v1/status_page.proto.+ */+export const file_openstatus_status_page_v1_status_page: GenFile = /*@__PURE__*/+ fileDesc("CitvcGVuc3RhdHVzL3N0YXR1c19wYWdlL3YxL3N0YXR1c19wYWdlLnByb3RvEhlvcGVuc3RhdHVzLnN0YXR1c19wYWdlLnYxIsoCCgp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UEVDSUZJRUQQABIVChFQQUdFX1RIRU1FX1NZU1RFTRABEhQKEFBBR0VfVEhFTUVfTElHSFQQAhITCg9QQUdFX1RIRU1FX0RBUksQAyrsAQoNT3ZlcmFsbFN0YXR1cxIeChpPVkVSQUxMX1NUQVRVU19VTlNQRUNJRklFRBAAEh4KGk9WRVJBTExfU1RBVFVTX09QRVJBVElPTkFMEAESGwoXT1ZFUkFMTF9TVEFUVVNfREVHUkFERUQQAhIhCh1PVkVSQUxMX1NUQVRVU19QQVJUSUFMX09VVEFHRRADEh8KG09WRVJBTExfU1RBVFVTX01BSk9SX09VVEFHRRAEEh4KGk9WRVJBTExfU1RBVFVTX01BSU5URU5BTkNFEAUSGgoWT1ZFUkFMTF9TVEFUVVNfVU5LTk9XThAGQlpaWGdpdGh1Yi5jb20vb3BlbnN0YXR1c2hxL29wZW5zdGF0dXMvcGFja2FnZXMvcHJvdG8vb3BlbnN0YXR1cy9zdGF0dXNfcGFnZS92MTtzdGF0dXNwYWdldjFiBnByb3RvMw");++/**+ * StatusPage represents a full status page with all details.+ *+ * @generated from message openstatus.status_page.v1.StatusPage+ */+export type StatusPage = Message<"openstatus.status_page.v1.StatusPage"> & {+ /**+ * Unique identifier for the status page.+ *+ * @generated from field: string id = 1;+ */+ id: string;++ /**+ * Title of the status page.+ *+ * @generated from field: string title = 2;+ */+ title: string;++ /**+ * Description of the status page.+ *+ * @generated from field: string description = 3;+ */+ description: string;++ /**+ * URL-friendly slug for the status page.+ *+ * @generated from field: string slug = 4;+ */+ slug: string;++ /**+ * Custom domain for the status page (optional).+ *+ * @generated from field: string custom_domain = 5;+ */+ customDomain: string;++ /**+ * Whether the status page is published and visible.+ *+ * @generated from field: bool published = 6;+ */+ published: boolean;++ /**+ * Access type for the status page.+ *+ * @generated from field: openstatus.status_page.v1.PageAccessType access_type = 7;+ */+ accessType: PageAccessType;++ /**+ * Visual theme for the status page.+ *+ * @generated from field: openstatus.status_page.v1.PageTheme theme = 8;+ */+ theme: PageTheme;++ /**+ * URL to the homepage (optional).+ *+ * @generated from field: string homepage_url = 9;+ */+ homepageUrl: string;++ /**+ * URL to the contact page (optional).+ *+ * @generated from field: string contact_url = 10;+ */+ contactUrl: string;++ /**+ * Icon URL for the status page (optional).+ *+ * @generated from field: string icon = 11;+ */+ icon: string;++ /**+ * Timestamp when the page was created (RFC 3339 format).+ *+ * @generated from field: string created_at = 12;+ */+ createdAt: string;++ /**+ * Timestamp when the page was last updated (RFC 3339 format).+ *+ * @generated from field: string updated_at = 13;+ */+ updatedAt: string;+};++/**+ * Describes the message openstatus.status_page.v1.StatusPage.+ * Use `create(StatusPageSchema)` to create a new message.+ */+export const StatusPageSchema: GenMessage<StatusPage> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_status_page, 0);++/**+ * StatusPageSummary represents metadata for a status page (used in list responses).+ *+ * @generated from message openstatus.status_page.v1.StatusPageSummary+ */+export type StatusPageSummary = Message<"openstatus.status_page.v1.StatusPageSummary"> & {+ /**+ * Unique identifier for the status page.+ *+ * @generated from field: string id = 1;+ */+ id: string;++ /**+ * Title of the status page.+ *+ * @generated from field: string title = 2;+ */+ title: string;++ /**+ * URL-friendly slug for the status page.+ *+ * @generated from field: string slug = 3;+ */+ slug: string;++ /**+ * Whether the status page is published and visible.+ *+ * @generated from field: bool published = 4;+ */+ published: boolean;++ /**+ * Timestamp when the page was created (RFC 3339 format).+ *+ * @generated from field: string created_at = 5;+ */+ createdAt: string;++ /**+ * Timestamp when the page was last updated (RFC 3339 format).+ *+ * @generated from field: string updated_at = 6;+ */+ updatedAt: string;+};++/**+ * Describes the message openstatus.status_page.v1.StatusPageSummary.+ * Use `create(StatusPageSummarySchema)` to create a new message.+ */+export const StatusPageSummarySchema: GenMessage<StatusPageSummary> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_status_page, 1);++/**+ * Maintenance represents a scheduled maintenance window.+ *+ * @generated from message openstatus.status_page.v1.Maintenance+ */+export type Maintenance = Message<"openstatus.status_page.v1.Maintenance"> & {+ /**+ * Unique identifier for the maintenance.+ *+ * @generated from field: string id = 1;+ */+ id: string;++ /**+ * Title of the maintenance.+ *+ * @generated from field: string title = 2;+ */+ title: string;++ /**+ * Message describing the maintenance.+ *+ * @generated from field: string message = 3;+ */+ message: string;++ /**+ * Start time of the maintenance window (RFC 3339 format).+ *+ * @generated from field: string from = 4;+ */+ from: string;++ /**+ * End time of the maintenance window (RFC 3339 format).+ *+ * @generated from field: string to = 5;+ */+ to: string;++ /**+ * IDs of affected page components.+ *+ * @generated from field: repeated string page_component_ids = 6;+ */+ pageComponentIds: string[];++ /**+ * Timestamp when the maintenance was created (RFC 3339 format).+ *+ * @generated from field: string created_at = 7;+ */+ createdAt: string;++ /**+ * Timestamp when the maintenance was last updated (RFC 3339 format).+ *+ * @generated from field: string updated_at = 8;+ */+ updatedAt: string;+};++/**+ * Describes the message openstatus.status_page.v1.Maintenance.+ * Use `create(MaintenanceSchema)` to create a new message.+ */+export const MaintenanceSchema: GenMessage<Maintenance> = /*@__PURE__*/+ messageDesc(file_openstatus_status_page_v1_status_page, 2);++/**+ * PageAccessType defines who can access the status page.+ *+ * @generated from enum openstatus.status_page.v1.PageAccessType+ */+export enum PageAccessType {+ /**+ * @generated from enum value: PAGE_ACCESS_TYPE_UNSPECIFIED = 0;+ */+ UNSPECIFIED = 0,++ /**+ * @generated from enum value: PAGE_ACCESS_TYPE_PUBLIC = 1;+ */+ PUBLIC = 1,++ /**+ * @generated from enum value: PAGE_ACCESS_TYPE_PASSWORD_PROTECTED = 2;+ */+ PASSWORD_PROTECTED = 2,++ /**+ * @generated from enum value: PAGE_ACCESS_TYPE_AUTHENTICATED = 3;+ */+ AUTHENTICATED = 3,+}++/**+ * Describes the enum openstatus.status_page.v1.PageAccessType.+ */+export const PageAccessTypeSchema: GenEnum<PageAccessType> = /*@__PURE__*/+ enumDesc(file_openstatus_status_page_v1_status_page, 0);++/**+ * PageTheme defines the visual theme of the status page.+ *+ * @generated from enum openstatus.status_page.v1.PageTheme+ */+export enum PageTheme {+ /**+ * @generated from enum value: PAGE_THEME_UNSPECIFIED = 0;+ */+ UNSPECIFIED = 0,++ /**+ * @generated from enum value: PAGE_THEME_SYSTEM = 1;+ */+ SYSTEM = 1,++ /**+ * @generated from enum value: PAGE_THEME_LIGHT = 2;+ */+ LIGHT = 2,++ /**+ * @generated from enum value: PAGE_THEME_DARK = 3;+ */+ DARK = 3,+}++/**+ * Describes the enum openstatus.status_page.v1.PageTheme.+ */+export const PageThemeSchema: GenEnum<PageTheme> = /*@__PURE__*/+ enumDesc(file_openstatus_status_page_v1_status_page, 1);++/**+ * OverallStatus represents the aggregated status of all components on a page.+ *+ * @generated from enum openstatus.status_page.v1.OverallStatus+ */+export enum OverallStatus {+ /**+ * @generated from enum value: OVERALL_STATUS_UNSPECIFIED = 0;+ */+ UNSPECIFIED = 0,++ /**+ * @generated from enum value: OVERALL_STATUS_OPERATIONAL = 1;+ */+ OPERATIONAL = 1,++ /**+ * @generated from enum value: OVERALL_STATUS_DEGRADED = 2;+ */+ DEGRADED = 2,++ /**+ * @generated from enum value: OVERALL_STATUS_PARTIAL_OUTAGE = 3;+ */+ PARTIAL_OUTAGE = 3,++ /**+ * @generated from enum value: OVERALL_STATUS_MAJOR_OUTAGE = 4;+ */+ MAJOR_OUTAGE = 4,++ /**+ * @generated from enum value: OVERALL_STATUS_MAINTENANCE = 5;+ */+ MAINTENANCE = 5,++ /**+ * @generated from enum value: OVERALL_STATUS_UNKNOWN = 6;+ */+ UNKNOWN = 6,+}++/**+ * Describes the enum openstatus.status_page.v1.OverallStatus.+ */+export const OverallStatusSchema: GenEnum<OverallStatus> = /*@__PURE__*/+ enumDesc(file_openstatus_status_page_v1_status_page, 2);+diff --git a/packages/proto/package.json b/packages/proto/package.jsonindex c918ff31d..64e3ae3bc 100644--- a/packages/proto/package.json+++ b/packages/proto/package.json@@ -20,6 +20,10 @@"./status_report/v1": {"import": "./gen/ts/openstatus/status_report/v1/index.ts","types": "./gen/ts/openstatus/status_report/v1/index.ts"+ },+ "./status_page/v1": {+ "import": "./gen/ts/openstatus/status_page/v1/index.ts",+ "types": "./gen/ts/openstatus/status_page/v1/index.ts"}},"scripts": {diff --git a/packages/proto/api/openstatus/status_report/PLAN.md b/packages/proto/plan/PLAN.mdsimilarity index 100%rename from packages/proto/api/openstatus/status_report/PLAN.mdrename to packages/proto/plan/PLAN.mddiff --git a/packages/proto/plan/api.md b/packages/proto/plan/api.mdnew file mode 100644index 000000000..3fefa5b56--- /dev/null+++ b/packages/proto/plan/api.md@@ -0,0 +1,147 @@+# Status Page Proto Service Implementation Plan++## Overview++Create a new proto service for Status Pages in `packages/proto/api/openstatus/status_page/v1/` following existing patterns from `monitor` and `status_report` services.++## File Structure++```+packages/proto/api/openstatus/status_page/v1/+├── service.proto # RPC service definitions+├── status_page.proto # StatusPage message and enums+├── page_component.proto # PageComponent message and enums+└── page_subscriber.proto # PageSubscriber message+```++## Proto Definitions++### 1. `status_page.proto` - Core Types++**Enums:**+- `PageAccessType`: PUBLIC, PASSWORD_PROTECTED, AUTHENTICATED+- `PageTheme`: SYSTEM, LIGHT, DARK+- `OverallStatus`: OPERATIONAL, DEGRADED, PARTIAL_OUTAGE, MAJOR_OUTAGE, MAINTENANCE, UNKNOWN++**Messages:**+- `StatusPage` - Full page details (id, title, description, slug, custom_domain, published, access_type, theme, homepage_url, contact_url, icon, timestamps)+- `StatusPageSummary` - List response (id, title, slug, published, timestamps)++### 2. `page_component.proto` - Component Types++**Enums:**+- `PageComponentType`: MONITOR, STATIC++**Messages:**+- `PageComponent` - Component details (id, page_id, name, description, type, monitor_id, order, group_id, group_order, timestamps)+- `PageComponentGroup` - Group details (id, page_id, name, timestamps)++### 3. `page_subscriber.proto` - Subscriber Types++**Messages:**+- `PageSubscriber` - Subscriber details (id, page_id, email, accepted_at, unsubscribed_at, timestamps)++### 4. `service.proto` - RPC Service++```protobuf+service StatusPageService {+ // Page CRUD+ rpc CreateStatusPage(CreateStatusPageRequest) returns (CreateStatusPageResponse);+ rpc GetStatusPage(GetStatusPageRequest) returns (GetStatusPageResponse);+ rpc ListStatusPages(ListStatusPagesRequest) returns (ListStatusPagesResponse);+ rpc UpdateStatusPage(UpdateStatusPageRequest) returns (UpdateStatusPageResponse);+ rpc DeleteStatusPage(DeleteStatusPageRequest) returns (DeleteStatusPageResponse);++ // Components+ rpc AddMonitorComponent(AddMonitorComponentRequest) returns (AddMonitorComponentResponse);+ rpc AddExternalComponent(AddExternalComponentRequest) returns (AddExternalComponentResponse);+ rpc RemoveComponent(RemoveComponentRequest) returns (RemoveComponentResponse);+ rpc UpdateComponent(UpdateComponentRequest) returns (UpdateComponentResponse);++ // Component Groups+ rpc CreateComponentGroup(CreateComponentGroupRequest) returns (CreateComponentGroupResponse);+ rpc DeleteComponentGroup(DeleteComponentGroupRequest) returns (DeleteComponentGroupResponse);+ rpc UpdateComponentGroup(UpdateComponentGroupRequest) returns (UpdateComponentGroupResponse);++ // Subscribers+ rpc SubscribeToPage(SubscribeToPageRequest) returns (SubscribeToPageResponse);+ rpc UnsubscribeFromPage(UnsubscribeFromPageRequest) returns (UnsubscribeFromPageResponse);+ rpc ListSubscribers(ListSubscribersRequest) returns (ListSubscribersResponse);++ // Full Content & Status+ rpc GetStatusPageContent(GetStatusPageContentRequest) returns (GetStatusPageContentResponse);+ rpc GetOverallStatus(GetOverallStatusRequest) returns (GetOverallStatusResponse);+}+```++## RPC Methods Breakdown++### Page CRUD (5 methods)+| Method | Request Fields | Response |+|--------|---------------|----------|+| `CreateStatusPage` | title, description, slug, homepage_url?, contact_url?| StatusPage |+| `GetStatusPage` | id | StatusPage |+| `ListStatusPages` | limit?, offset? | StatusPageSummary[], total_size |+| `UpdateStatusPage` | id, title?, description?, slug?, homepage_url?, contact_url? | StatusPage |+| `DeleteStatusPage` | id | success |++### Component Management (4 methods)+| Method | Request Fields | Response |+|--------|---------------|----------|+| `AddMonitorComponent` | page_id, monitor_id, name?, description?, order?, group_id? | PageComponent |+| `AddExternalComponent` | page_id, name, description?, order?, group_id? | PageComponent |+| `RemoveComponent` | id | success |+| `UpdateComponent` | id, name?, description?, order?, group_id?, group_order? | PageComponent |++### Component Groups (3 methods)+| Method | Request Fields | Response |+|--------|---------------|----------|+| `CreateComponentGroup` | page_id, name | PageComponentGroup |+| `DeleteComponentGroup` | id | success |+| `UpdateComponentGroup` | id, name? | PageComponentGroup |++### Subscriber Management (3 methods)+| Method | Request Fields | Response |+|--------|---------------|----------|+| `SubscribeToPage` | page_id, email | PageSubscriber |+| `UnsubscribeFromPage` | page_id, email or token | success |+| `ListSubscribers` | page_id, limit?, offset?, include_unsubscribed? | PageSubscriber[], total_size |++### Full Content & Status (2 methods)+| Method | Request Fields | Response |+|--------|---------------|----------|+| `GetStatusPageContent` | id or slug | StatusPage, components[], groups[], status_reports[], maintenances[] |+| `GetOverallStatus` | id or slug | overall_status, component_statuses[] |++## Validation Rules (using buf.validate)++- `title`: min_len=1, max_len=256+- `description`: max_len=1024+- `slug`: min_len=1, max_len=256, pattern for valid slug+- `email`: email format validation+- `limit`: gte=1, lte=100+- `offset`: gte=0+- Enums: defined_only=true, not_in=[0] where appropriate++## Implementation Order++1. Create `status_page.proto` with enums and base messages+2. Create `page_component.proto` with component types+3. Create `page_subscriber.proto` with subscriber message+4. Create `service.proto` with all RPC definitions+5. Update buf.yaml if needed to include new package++## Files to Create++| File | Description |+|------|-------------|+| `packages/proto/api/openstatus/status_page/v1/status_page.proto` | Core enums and StatusPage messages |+| `packages/proto/api/openstatus/status_page/v1/page_component.proto` | PageComponent and PageComponentGroup messages |+| `packages/proto/api/openstatus/status_page/v1/page_subscriber.proto` | PageSubscriber message |+| `packages/proto/api/openstatus/status_page/v1/service.proto` | StatusPageService RPC definitions |++## Verification++1. Run `pnpm buf lint` to verify proto files are valid+2. Run `pnpm buf generate` to generate Go/TS code+3. Check generated code compiles without errors