Skip to content

Open-source status page, incident response and uptime monitoring

Status report (#1796)

Thibault Le Ouay77dec981daae
diff --git a/apps/server/src/routes/rpc/router.ts b/apps/server/src/routes/rpc/router.ts
index 85545d398..b4b83a927 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 { StatusReportService } from "@openstatus/proto/status_report/v1";
import {
authInterceptor,
@@ -10,6 +11,7 @@ import {
} from "./interceptors";
import { healthServiceImpl } from "./services/health";
import { monitorServiceImpl } from "./services/monitor";
+import { statusReportServiceImpl } from "./services/status-report";
/**
* Create ConnectRPC router with services.
@@ -28,4 +30,5 @@ export const routes = createConnectRouter({
],
})
.service(MonitorService, monitorServiceImpl)
- .service(HealthService, healthServiceImpl);
+ .service(HealthService, healthServiceImpl)
+ .service(StatusReportService, statusReportServiceImpl);
diff --git a/apps/server/src/routes/rpc/services/status-report/__tests__/status-report.test.ts b/apps/server/src/routes/rpc/services/status-report/__tests__/status-report.test.ts
new file mode 100644
index 000000000..f13daea2f
--- /dev/null
+++ b/apps/server/src/routes/rpc/services/status-report/__tests__/status-report.test.ts
@@ -0,0 +1,1521 @@
+import { afterAll, beforeAll, describe, expect, spyOn, test } from "bun:test";
+import { db, eq } from "@openstatus/db";
+import {
+ page,
+ pageComponent,
+ pageSubscriber,
+ statusReport,
+ statusReportUpdate,
+ statusReportsToPageComponents,
+} from "@openstatus/db/src/schema";
+import { EmailClient } from "@openstatus/emails";
+import { StatusReportStatus } from "@openstatus/proto/status_report/v1";
+
+import { app } from "@/index";
+import { protoStatusToDb } from "../converters";
+
+// Mock the sendStatusReportUpdate method
+const sendStatusReportUpdateMock = spyOn(
+ EmailClient.prototype,
+ "sendStatusReportUpdate",
+).mockResolvedValue(undefined);
+
+/**
+ * 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_report.v1.StatusReportService/${method}`,
+ {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ ...headers,
+ },
+ body: JSON.stringify(body),
+ },
+ );
+}
+
+const TEST_PREFIX = "rpc-status-report-test";
+let testPageComponentId: number;
+let testStatusReportId: number;
+let testStatusReportToDeleteId: number;
+let testStatusReportToUpdateId: number;
+let testStatusReportForNotifyId: number;
+let testSubscriberId: number;
+// For mixed-page validation tests
+let testPage2Id: number;
+let testPage2ComponentId: number;
+
+beforeAll(async () => {
+ // Clean up any existing test data
+ await db
+ .delete(statusReport)
+ .where(eq(statusReport.title, `${TEST_PREFIX}-main`));
+ await db
+ .delete(statusReport)
+ .where(eq(statusReport.title, `${TEST_PREFIX}-to-delete`));
+ await db
+ .delete(statusReport)
+ .where(eq(statusReport.title, `${TEST_PREFIX}-to-update`));
+ await db
+ .delete(pageComponent)
+ .where(eq(pageComponent.name, `${TEST_PREFIX}-component`));
+
+ // Create a test page component (using existing page 1 from seed)
+ const component = await db
+ .insert(pageComponent)
+ .values({
+ workspaceId: 1,
+ pageId: 1,
+ type: "external",
+ name: `${TEST_PREFIX}-component`,
+ description: "Test component for status report tests",
+ order: 100,
+ })
+ .returning()
+ .get();
+ testPageComponentId = component.id;
+
+ // Create a second page and component for mixed-page validation tests
+ const page2 = await db
+ .insert(page)
+ .values({
+ workspaceId: 1,
+ title: `${TEST_PREFIX}-page-2`,
+ slug: `${TEST_PREFIX}-page-2-slug`,
+ description: "Second test page for mixed-page tests",
+ customDomain: "",
+ })
+ .returning()
+ .get();
+ testPage2Id = page2.id;
+
+ const component2 = await db
+ .insert(pageComponent)
+ .values({
+ workspaceId: 1,
+ pageId: testPage2Id,
+ type: "external",
+ name: `${TEST_PREFIX}-component-2`,
+ description: "Test component on page 2",
+ order: 100,
+ })
+ .returning()
+ .get();
+ testPage2ComponentId = component2.id;
+
+ // Create test status report
+ const report = await db
+ .insert(statusReport)
+ .values({
+ workspaceId: 1,
+ pageId: 1,
+ title: `${TEST_PREFIX}-main`,
+ status: "investigating",
+ })
+ .returning()
+ .get();
+ testStatusReportId = report.id;
+
+ // Create page component association
+ await db.insert(statusReportsToPageComponents).values({
+ statusReportId: report.id,
+ pageComponentId: testPageComponentId,
+ });
+
+ // Create status report updates
+ await db.insert(statusReportUpdate).values([
+ {
+ statusReportId: report.id,
+ status: "investigating",
+ date: new Date(Date.now() - 60 * 60 * 1000), // 1 hour ago
+ message: "We are investigating the issue.",
+ },
+ {
+ statusReportId: report.id,
+ status: "identified",
+ date: new Date(Date.now() - 30 * 60 * 1000), // 30 min ago
+ message: "We have identified the root cause.",
+ },
+ ]);
+
+ // Create status report to delete
+ const deleteReport = await db
+ .insert(statusReport)
+ .values({
+ workspaceId: 1,
+ pageId: 1,
+ title: `${TEST_PREFIX}-to-delete`,
+ status: "investigating",
+ })
+ .returning()
+ .get();
+ testStatusReportToDeleteId = deleteReport.id;
+
+ // Create status report to update
+ const updateReport = await db
+ .insert(statusReport)
+ .values({
+ workspaceId: 1,
+ pageId: 1,
+ title: `${TEST_PREFIX}-to-update`,
+ status: "investigating",
+ })
+ .returning()
+ .get();
+ testStatusReportToUpdateId = updateReport.id;
+
+ await db.insert(statusReportsToPageComponents).values({
+ statusReportId: updateReport.id,
+ pageComponentId: testPageComponentId,
+ });
+
+ // Create status report for notify tests
+ const notifyReport = await db
+ .insert(statusReport)
+ .values({
+ workspaceId: 1,
+ pageId: 1,
+ title: `${TEST_PREFIX}-for-notify`,
+ status: "investigating",
+ })
+ .returning()
+ .get();
+ testStatusReportForNotifyId = notifyReport.id;
+
+ await db.insert(statusReportsToPageComponents).values({
+ statusReportId: notifyReport.id,
+ pageComponentId: testPageComponentId,
+ });
+
+ // Create a verified subscriber for notification tests
+ const subscriber = await db
+ .insert(pageSubscriber)
+ .values({
+ pageId: 1,
+ email: `${TEST_PREFIX}@example.com`,
+ token: `${TEST_PREFIX}-token`,
+ acceptedAt: new Date(),
+ })
+ .returning()
+ .get();
+ testSubscriberId = subscriber.id;
+});
+
+afterAll(async () => {
+ // Clean up subscriber first (only if it was created)
+ if (testSubscriberId) {
+ await db
+ .delete(pageSubscriber)
+ .where(eq(pageSubscriber.id, testSubscriberId));
+ }
+
+ // Clean up status report updates first (due to foreign key)
+ await db
+ .delete(statusReportUpdate)
+ .where(eq(statusReportUpdate.statusReportId, testStatusReportId));
+ await db
+ .delete(statusReportUpdate)
+ .where(eq(statusReportUpdate.statusReportId, testStatusReportToUpdateId));
+ await db
+ .delete(statusReportUpdate)
+ .where(eq(statusReportUpdate.statusReportId, testStatusReportForNotifyId));
+
+ // Clean up associations
+ await db
+ .delete(statusReportsToPageComponents)
+ .where(
+ eq(statusReportsToPageComponents.statusReportId, testStatusReportId),
+ );
+ await db
+ .delete(statusReportsToPageComponents)
+ .where(
+ eq(
+ statusReportsToPageComponents.statusReportId,
+ testStatusReportToUpdateId,
+ ),
+ );
+ await db
+ .delete(statusReportsToPageComponents)
+ .where(
+ eq(
+ statusReportsToPageComponents.statusReportId,
+ testStatusReportForNotifyId,
+ ),
+ );
+
+ // Clean up status reports
+ await db
+ .delete(statusReport)
+ .where(eq(statusReport.title, `${TEST_PREFIX}-main`));
+ await db
+ .delete(statusReport)
+ .where(eq(statusReport.title, `${TEST_PREFIX}-to-delete`));
+ await db
+ .delete(statusReport)
+ .where(eq(statusReport.title, `${TEST_PREFIX}-to-update`));
+ await db
+ .delete(statusReport)
+ .where(eq(statusReport.title, `${TEST_PREFIX}-for-notify`));
+
+ // Clean up page component
+ await db
+ .delete(pageComponent)
+ .where(eq(pageComponent.name, `${TEST_PREFIX}-component`));
+
+ // Clean up second page component and page (for mixed-page tests)
+ await db
+ .delete(pageComponent)
+ .where(eq(pageComponent.name, `${TEST_PREFIX}-component-2`));
+ await db.delete(page).where(eq(page.title, `${TEST_PREFIX}-page-2`));
+});
+
+describe("StatusReportService.CreateStatusReport", () => {
+ test("creates a new status report with initial update", async () => {
+ const res = await connectRequest(
+ "CreateStatusReport",
+ {
+ title: `${TEST_PREFIX}-created`,
+ status: "STATUS_REPORT_STATUS_INVESTIGATING",
+ message: "We are looking into this issue.",
+ date: new Date().toISOString(),
+ pageId: "1",
+ pageComponentIds: [String(testPageComponentId)],
+ },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(200);
+
+ const data = await res.json();
+ expect(data).toHaveProperty("statusReport");
+ expect(data.statusReport.title).toBe(`${TEST_PREFIX}-created`);
+ expect(data.statusReport.status).toBe("STATUS_REPORT_STATUS_INVESTIGATING");
+ expect(data.statusReport.pageComponentIds).toContain(
+ String(testPageComponentId),
+ );
+ expect(data.statusReport.updates).toHaveLength(1);
+ expect(data.statusReport.updates[0].message).toBe(
+ "We are looking into this issue.",
+ );
+
+ // Clean up
+ await db
+ .delete(statusReportUpdate)
+ .where(
+ eq(statusReportUpdate.statusReportId, Number(data.statusReport.id)),
+ );
+ await db
+ .delete(statusReportsToPageComponents)
+ .where(
+ eq(
+ statusReportsToPageComponents.statusReportId,
+ Number(data.statusReport.id),
+ ),
+ );
+ await db
+ .delete(statusReport)
+ .where(eq(statusReport.id, Number(data.statusReport.id)));
+ });
+
+ test("returns 401 when no auth key provided", async () => {
+ const res = await connectRequest("CreateStatusReport", {
+ title: "Unauthorized test",
+ status: "STATUS_REPORT_STATUS_INVESTIGATING",
+ message: "Test message",
+ date: new Date().toISOString(),
+ pageId: "1",
+ pageComponentIds: ["1"],
+ });
+
+ expect(res.status).toBe(401);
+ });
+
+ test("returns error for invalid page component ID", async () => {
+ const res = await connectRequest(
+ "CreateStatusReport",
+ {
+ title: "Invalid component test",
+ status: "STATUS_REPORT_STATUS_INVESTIGATING",
+ message: "Test message",
+ date: new Date().toISOString(),
+ pageId: "1",
+ pageComponentIds: ["99999"],
+ },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(404);
+ });
+
+ test("returns error when page components are from different pages", async () => {
+ const res = await connectRequest(
+ "CreateStatusReport",
+ {
+ title: `${TEST_PREFIX}-mixed-pages`,
+ status: "STATUS_REPORT_STATUS_INVESTIGATING",
+ message: "Test message",
+ date: new Date().toISOString(),
+ pageId: "1",
+ pageComponentIds: [
+ String(testPageComponentId),
+ String(testPage2ComponentId),
+ ],
+ },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(400);
+ const data = await res.json();
+ expect(data.message).toContain(
+ "All page components must belong to the same page",
+ );
+ });
+
+ test("derives pageId from components when creating status report", async () => {
+ const res = await connectRequest(
+ "CreateStatusReport",
+ {
+ title: `${TEST_PREFIX}-derived-pageid`,
+ status: "STATUS_REPORT_STATUS_INVESTIGATING",
+ message: "Test deriving pageId from components.",
+ date: new Date().toISOString(),
+ pageId: "1", // This is ignored, pageId is derived from components
+ pageComponentIds: [String(testPage2ComponentId)],
+ },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(200);
+
+ const data = await res.json();
+ expect(data).toHaveProperty("statusReport");
+ expect(data.statusReport.pageComponentIds).toContain(
+ String(testPage2ComponentId),
+ );
+
+ // Verify the pageId was derived from the component (page 2)
+ const createdReport = await db
+ .select()
+ .from(statusReport)
+ .where(eq(statusReport.id, Number(data.statusReport.id)))
+ .get();
+ expect(createdReport?.pageId).toBe(testPage2Id);
+
+ // Clean up
+ await db
+ .delete(statusReportUpdate)
+ .where(
+ eq(statusReportUpdate.statusReportId, Number(data.statusReport.id)),
+ );
+ await db
+ .delete(statusReportsToPageComponents)
+ .where(
+ eq(
+ statusReportsToPageComponents.statusReportId,
+ Number(data.statusReport.id),
+ ),
+ );
+ await db
+ .delete(statusReport)
+ .where(eq(statusReport.id, Number(data.statusReport.id)));
+ });
+
+ test("sets pageId to null when no components provided", async () => {
+ const res = await connectRequest(
+ "CreateStatusReport",
+ {
+ title: `${TEST_PREFIX}-null-pageid`,
+ status: "STATUS_REPORT_STATUS_INVESTIGATING",
+ message: "Test null pageId when no components.",
+ date: new Date().toISOString(),
+ pageId: "1", // This should be ignored
+ pageComponentIds: [],
+ },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(200);
+
+ const data = await res.json();
+ expect(data).toHaveProperty("statusReport");
+
+ // Verify the pageId is null
+ const createdReport = await db
+ .select()
+ .from(statusReport)
+ .where(eq(statusReport.id, Number(data.statusReport.id)))
+ .get();
+ expect(createdReport?.pageId).toBeNull();
+
+ // Clean up
+ await db
+ .delete(statusReportUpdate)
+ .where(
+ eq(statusReportUpdate.statusReportId, Number(data.statusReport.id)),
+ );
+ await db
+ .delete(statusReport)
+ .where(eq(statusReport.id, Number(data.statusReport.id)));
+ });
+
+ test("creates status report with empty pageComponentIds", async () => {
+ const res = await connectRequest(
+ "CreateStatusReport",
+ {
+ title: `${TEST_PREFIX}-no-components`,
+ status: "STATUS_REPORT_STATUS_INVESTIGATING",
+ message: "Report without components.",
+ date: new Date().toISOString(),
+ pageId: "1",
+ pageComponentIds: [],
+ },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(200);
+
+ const data = await res.json();
+ expect(data).toHaveProperty("statusReport");
+ expect(data.statusReport.title).toBe(`${TEST_PREFIX}-no-components`);
+ // Empty array may be serialized as undefined or empty array in proto
+ const pageComponentIds = data.statusReport.pageComponentIds ?? [];
+ expect(pageComponentIds).toHaveLength(0);
+
+ // Clean up
+ await db
+ .delete(statusReportUpdate)
+ .where(
+ eq(statusReportUpdate.statusReportId, Number(data.statusReport.id)),
+ );
+ await db
+ .delete(statusReport)
+ .where(eq(statusReport.id, Number(data.statusReport.id)));
+ });
+
+ test("creates status report with notify=true", async () => {
+ sendStatusReportUpdateMock.mockClear();
+
+ const res = await connectRequest(
+ "CreateStatusReport",
+ {
+ title: `${TEST_PREFIX}-with-notify`,
+ status: "STATUS_REPORT_STATUS_INVESTIGATING",
+ message: "Notifying subscribers about this issue.",
+ date: new Date().toISOString(),
+ pageId: "1",
+ pageComponentIds: [String(testPageComponentId)],
+ notify: true,
+ },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(200);
+
+ const data = await res.json();
+ expect(data).toHaveProperty("statusReport");
+ expect(data.statusReport.title).toBe(`${TEST_PREFIX}-with-notify`);
+ expect(data.statusReport.updates).toHaveLength(1);
+
+ // Verify notification was sent
+ expect(sendStatusReportUpdateMock).toHaveBeenCalledTimes(1);
+ const mockCall = sendStatusReportUpdateMock.mock.calls[0][0];
+ expect(mockCall.reportTitle).toBe(`${TEST_PREFIX}-with-notify`);
+ expect(mockCall.status).toBe("investigating");
+ expect(mockCall.message).toBe("Notifying subscribers about this issue.");
+
+ // Clean up
+ await db
+ .delete(statusReportUpdate)
+ .where(
+ eq(statusReportUpdate.statusReportId, Number(data.statusReport.id)),
+ );
+ await db
+ .delete(statusReportsToPageComponents)
+ .where(
+ eq(
+ statusReportsToPageComponents.statusReportId,
+ Number(data.statusReport.id),
+ ),
+ );
+ await db
+ .delete(statusReport)
+ .where(eq(statusReport.id, Number(data.statusReport.id)));
+ });
+
+ test("creates status report with notify=false (default)", async () => {
+ sendStatusReportUpdateMock.mockClear();
+
+ const res = await connectRequest(
+ "CreateStatusReport",
+ {
+ title: `${TEST_PREFIX}-no-notify`,
+ status: "STATUS_REPORT_STATUS_IDENTIFIED",
+ message: "No notification for this one.",
+ date: new Date().toISOString(),
+ pageId: "1",
+ pageComponentIds: [],
+ notify: false,
+ },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(200);
+
+ const data = await res.json();
+ expect(data).toHaveProperty("statusReport");
+ expect(data.statusReport.title).toBe(`${TEST_PREFIX}-no-notify`);
+
+ // Verify notification was NOT sent
+ expect(sendStatusReportUpdateMock).not.toHaveBeenCalled();
+
+ // Clean up
+ await db
+ .delete(statusReportUpdate)
+ .where(
+ eq(statusReportUpdate.statusReportId, Number(data.statusReport.id)),
+ );
+ await db
+ .delete(statusReport)
+ .where(eq(statusReport.id, Number(data.statusReport.id)));
+ });
+
+ test("returns error for invalid date format", async () => {
+ const res = await connectRequest(
+ "CreateStatusReport",
+ {
+ title: `${TEST_PREFIX}-invalid-date`,
+ status: "STATUS_REPORT_STATUS_INVESTIGATING",
+ message: "Test with invalid date.",
+ date: "not-a-valid-date",
+ pageId: "1",
+ pageComponentIds: [],
+ },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(400);
+ const data = await res.json();
+ expect(data.message).toContain("date: value does not match regex pattern");
+ });
+});
+
+describe("StatusReportService.GetStatusReport", () => {
+ test("returns status report with updates", async () => {
+ const res = await connectRequest(
+ "GetStatusReport",
+ { id: String(testStatusReportId) },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(200);
+
+ const data = await res.json();
+ expect(data).toHaveProperty("statusReport");
+ expect(data.statusReport.id).toBe(String(testStatusReportId));
+ expect(data.statusReport.title).toBe(`${TEST_PREFIX}-main`);
+ expect(data.statusReport.pageComponentIds).toContain(
+ String(testPageComponentId),
+ );
+ expect(data.statusReport.updates).toHaveLength(2);
+ expect(data.statusReport).toHaveProperty("createdAt");
+ expect(data.statusReport).toHaveProperty("updatedAt");
+ });
+
+ test("returns 401 when no auth key provided", async () => {
+ const res = await connectRequest("GetStatusReport", {
+ id: String(testStatusReportId),
+ });
+
+ expect(res.status).toBe(401);
+ });
+
+ test("returns 404 for non-existent status report", async () => {
+ const res = await connectRequest(
+ "GetStatusReport",
+ { id: "99999" },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(404);
+ });
+
+ test("returns 404 for status report in different workspace", async () => {
+ // Create status report in workspace 2
+ const otherReport = await db
+ .insert(statusReport)
+ .values({
+ workspaceId: 2,
+ title: `${TEST_PREFIX}-other-workspace`,
+ status: "investigating",
+ })
+ .returning()
+ .get();
+
+ try {
+ const res = await connectRequest(
+ "GetStatusReport",
+ { id: String(otherReport.id) },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(404);
+ } finally {
+ await db.delete(statusReport).where(eq(statusReport.id, otherReport.id));
+ }
+ });
+
+ test("returns error when ID is empty string", async () => {
+ const res = await connectRequest(
+ "GetStatusReport",
+ { id: "" },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(400);
+ });
+
+ test("returns error when ID is whitespace only", async () => {
+ const res = await connectRequest(
+ "GetStatusReport",
+ { id: " " },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(400);
+ });
+});
+
+describe("StatusReportService.ListStatusReports", () => {
+ test("returns status reports for authenticated workspace", async () => {
+ const res = await connectRequest(
+ "ListStatusReports",
+ {},
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(200);
+
+ const data = await res.json();
+ expect(data).toHaveProperty("statusReports");
+ expect(Array.isArray(data.statusReports)).toBe(true);
+ expect(data).toHaveProperty("totalSize");
+ });
+
+ test("returns status reports with correct structure (summary only)", async () => {
+ const res = await connectRequest(
+ "ListStatusReports",
+ { limit: 100 },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(200);
+
+ const data = await res.json();
+ const report = data.statusReports?.find(
+ (r: { id: string }) => r.id === String(testStatusReportId),
+ );
+
+ expect(report).toBeDefined();
+ expect(report.title).toBe(`${TEST_PREFIX}-main`);
+ expect(report.pageComponentIds).toBeDefined();
+ expect(report.createdAt).toBeDefined();
+ expect(report.updatedAt).toBeDefined();
+ // Summary should NOT include updates
+ expect(report.updates).toBeUndefined();
+ });
+
+ test("returns 401 when no auth key provided", async () => {
+ const res = await connectRequest("ListStatusReports", {});
+
+ expect(res.status).toBe(401);
+ });
+
+ test("respects limit parameter", async () => {
+ const res = await connectRequest(
+ "ListStatusReports",
+ { limit: 1 },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(200);
+
+ const data = await res.json();
+ expect(data.statusReports?.length || 0).toBeLessThanOrEqual(1);
+ });
+
+ test("respects offset parameter", async () => {
+ // Get total count first
+ const res1 = await connectRequest(
+ "ListStatusReports",
+ {},
+ { "x-openstatus-key": "1" },
+ );
+ const data1 = await res1.json();
+ const totalSize = data1.totalSize;
+
+ if (totalSize > 1) {
+ // Get first page
+ const res2 = await connectRequest(
+ "ListStatusReports",
+ { limit: 1, offset: 0 },
+ { "x-openstatus-key": "1" },
+ );
+ const data2 = await res2.json();
+
+ // Get second page
+ const res3 = await connectRequest(
+ "ListStatusReports",
+ { limit: 1, offset: 1 },
+ { "x-openstatus-key": "1" },
+ );
+ const data3 = await res3.json();
+
+ // Should have different reports
+ if (data2.statusReports?.length > 0 && data3.statusReports?.length > 0) {
+ expect(data2.statusReports[0].id).not.toBe(data3.statusReports[0].id);
+ }
+ }
+ });
+
+ test("filters by status", async () => {
+ const res = await connectRequest(
+ "ListStatusReports",
+ { statuses: ["STATUS_REPORT_STATUS_INVESTIGATING"] },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(200);
+
+ const data = await res.json();
+ // All returned reports should have investigating status
+ for (const report of data.statusReports || []) {
+ expect(report.status).toBe("STATUS_REPORT_STATUS_INVESTIGATING");
+ }
+ });
+
+ test("only returns reports for authenticated workspace", async () => {
+ // Create status report in workspace 2
+ const otherReport = await db
+ .insert(statusReport)
+ .values({
+ workspaceId: 2,
+ title: `${TEST_PREFIX}-other-workspace-list`,
+ status: "investigating",
+ })
+ .returning()
+ .get();
+
+ try {
+ const res = await connectRequest(
+ "ListStatusReports",
+ { limit: 100 },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(200);
+
+ const data = await res.json();
+ const reportIds = (data.statusReports || []).map(
+ (r: { id: string }) => r.id,
+ );
+
+ expect(reportIds).not.toContain(String(otherReport.id));
+ } finally {
+ await db.delete(statusReport).where(eq(statusReport.id, otherReport.id));
+ }
+ });
+
+ test("filters by multiple statuses", async () => {
+ // Create reports with different statuses
+ const monitoringReport = await db
+ .insert(statusReport)
+ .values({
+ workspaceId: 1,
+ pageId: 1,
+ title: `${TEST_PREFIX}-monitoring-filter`,
+ status: "monitoring",
+ })
+ .returning()
+ .get();
+
+ const resolvedReport = await db
+ .insert(statusReport)
+ .values({
+ workspaceId: 1,
+ pageId: 1,
+ title: `${TEST_PREFIX}-resolved-filter`,
+ status: "resolved",
+ })
+ .returning()
+ .get();
+
+ try {
+ const res = await connectRequest(
+ "ListStatusReports",
+ {
+ statuses: [
+ "STATUS_REPORT_STATUS_MONITORING",
+ "STATUS_REPORT_STATUS_RESOLVED",
+ ],
+ },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(200);
+
+ const data = await res.json();
+ // All returned reports should have monitoring or resolved status
+ for (const report of data.statusReports || []) {
+ expect([
+ "STATUS_REPORT_STATUS_MONITORING",
+ "STATUS_REPORT_STATUS_RESOLVED",
+ ]).toContain(report.status);
+ }
+ } finally {
+ await db
+ .delete(statusReport)
+ .where(eq(statusReport.id, monitoringReport.id));
+ await db
+ .delete(statusReport)
+ .where(eq(statusReport.id, resolvedReport.id));
+ }
+ });
+
+ test("returns all statuses when statuses filter is empty", async () => {
+ const res = await connectRequest(
+ "ListStatusReports",
+ { statuses: [] },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(200);
+
+ const data = await res.json();
+ expect(data).toHaveProperty("statusReports");
+ expect(data).toHaveProperty("totalSize");
+ });
+
+ test("ignores UNSPECIFIED status in filter", async () => {
+ const res = await connectRequest(
+ "ListStatusReports",
+ {
+ statuses: [
+ "STATUS_REPORT_STATUS_UNSPECIFIED",
+ "STATUS_REPORT_STATUS_INVESTIGATING",
+ ],
+ },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(200);
+
+ const data = await res.json();
+ // Should only return investigating status (UNSPECIFIED is ignored)
+ for (const report of data.statusReports || []) {
+ expect(report.status).toBe("STATUS_REPORT_STATUS_INVESTIGATING");
+ }
+ });
+});
+
+describe("StatusReportService.UpdateStatusReport", () => {
+ test("updates status report title", async () => {
+ const res = await connectRequest(
+ "UpdateStatusReport",
+ {
+ id: String(testStatusReportToUpdateId),
+ title: `${TEST_PREFIX}-updated-title`,
+ },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(200);
+
+ const data = await res.json();
+ expect(data).toHaveProperty("statusReport");
+ expect(data.statusReport.title).toBe(`${TEST_PREFIX}-updated-title`);
+
+ // Restore original title
+ await db
+ .update(statusReport)
+ .set({ title: `${TEST_PREFIX}-to-update` })
+ .where(eq(statusReport.id, testStatusReportToUpdateId));
+ });
+
+ test("updates page component associations", async () => {
+ // Use existing seeded page component 1
+ const res = await connectRequest(
+ "UpdateStatusReport",
+ {
+ id: String(testStatusReportToUpdateId),
+ pageComponentIds: ["1"],
+ },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(200);
+
+ const data = await res.json();
+ expect(data.statusReport.pageComponentIds).toContain("1");
+ });
+
+ test("returns 401 when no auth key provided", async () => {
+ const res = await connectRequest("UpdateStatusReport", {
+ id: String(testStatusReportToUpdateId),
+ title: "Unauthorized update",
+ });
+
+ expect(res.status).toBe(401);
+ });
+
+ test("returns 404 for non-existent status report", async () => {
+ const res = await connectRequest(
+ "UpdateStatusReport",
+ { id: "99999", title: "Non-existent update" },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(404);
+ });
+
+ test("returns error when ID is empty string", async () => {
+ const res = await connectRequest(
+ "UpdateStatusReport",
+ { id: "", title: "Empty ID update" },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(400);
+ });
+
+ test("returns error when ID is whitespace only", async () => {
+ const res = await connectRequest(
+ "UpdateStatusReport",
+ { id: " ", title: "Whitespace ID update" },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(400);
+ });
+
+ test("returns 404 for status report in different workspace", async () => {
+ // Create status report in workspace 2
+ const otherReport = await db
+ .insert(statusReport)
+ .values({
+ workspaceId: 2,
+ title: `${TEST_PREFIX}-other-workspace-update`,
+ status: "investigating",
+ })
+ .returning()
+ .get();
+
+ try {
+ const res = await connectRequest(
+ "UpdateStatusReport",
+ { id: String(otherReport.id), title: "Should not update" },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(404);
+ } finally {
+ await db.delete(statusReport).where(eq(statusReport.id, otherReport.id));
+ }
+ });
+
+ test("returns error for invalid page component ID on update", async () => {
+ const res = await connectRequest(
+ "UpdateStatusReport",
+ {
+ id: String(testStatusReportToUpdateId),
+ pageComponentIds: ["99999"],
+ },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(404);
+ });
+
+ test("returns error when updating with components from different pages", async () => {
+ const res = await connectRequest(
+ "UpdateStatusReport",
+ {
+ id: String(testStatusReportToUpdateId),
+ pageComponentIds: [
+ String(testPageComponentId),
+ String(testPage2ComponentId),
+ ],
+ },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(400);
+ const data = await res.json();
+ expect(data.message).toContain(
+ "All page components must belong to the same page",
+ );
+ });
+
+ test("updates pageId when changing components to different page", async () => {
+ // First verify the current pageId
+ const beforeReport = await db
+ .select()
+ .from(statusReport)
+ .where(eq(statusReport.id, testStatusReportToUpdateId))
+ .get();
+ expect(beforeReport?.pageId).toBe(1);
+
+ // Update to use component from page 2
+ const res = await connectRequest(
+ "UpdateStatusReport",
+ {
+ id: String(testStatusReportToUpdateId),
+ pageComponentIds: [String(testPage2ComponentId)],
+ },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(200);
+
+ // Verify the pageId was updated to page 2
+ const afterReport = await db
+ .select()
+ .from(statusReport)
+ .where(eq(statusReport.id, testStatusReportToUpdateId))
+ .get();
+ expect(afterReport?.pageId).toBe(testPage2Id);
+
+ // Restore original component association
+ await connectRequest(
+ "UpdateStatusReport",
+ {
+ id: String(testStatusReportToUpdateId),
+ pageComponentIds: [String(testPageComponentId)],
+ },
+ { "x-openstatus-key": "1" },
+ );
+ });
+
+ test("clears pageId when removing all components", async () => {
+ // Create a temporary status report for this test
+ const tempReport = await db
+ .insert(statusReport)
+ .values({
+ workspaceId: 1,
+ pageId: 1,
+ title: `${TEST_PREFIX}-clear-pageid`,
+ status: "investigating",
+ })
+ .returning()
+ .get();
+
+ await db.insert(statusReportsToPageComponents).values({
+ statusReportId: tempReport.id,
+ pageComponentId: testPageComponentId,
+ });
+
+ try {
+ // Clear all components
+ const res = await connectRequest(
+ "UpdateStatusReport",
+ {
+ id: String(tempReport.id),
+ pageComponentIds: [],
+ },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(200);
+
+ // Verify the pageId is now null
+ const afterReport = await db
+ .select()
+ .from(statusReport)
+ .where(eq(statusReport.id, tempReport.id))
+ .get();
+ expect(afterReport?.pageId).toBeNull();
+ } finally {
+ // Clean up
+ await db
+ .delete(statusReportsToPageComponents)
+ .where(eq(statusReportsToPageComponents.statusReportId, tempReport.id));
+ await db.delete(statusReport).where(eq(statusReport.id, tempReport.id));
+ }
+ });
+});
+
+describe("StatusReportService.DeleteStatusReport", () => {
+ test("successfully deletes existing status report", async () => {
+ const res = await connectRequest(
+ "DeleteStatusReport",
+ { id: String(testStatusReportToDeleteId) },
+ { "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(statusReport)
+ .where(eq(statusReport.id, testStatusReportToDeleteId))
+ .get();
+ expect(deleted).toBeUndefined();
+ });
+
+ test("returns 401 when no auth key provided", async () => {
+ const res = await connectRequest("DeleteStatusReport", { id: "1" });
+
+ expect(res.status).toBe(401);
+ });
+
+ test("returns 404 for non-existent status report", async () => {
+ const res = await connectRequest(
+ "DeleteStatusReport",
+ { id: "99999" },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(404);
+ });
+
+ test("returns error when ID is empty string", async () => {
+ const res = await connectRequest(
+ "DeleteStatusReport",
+ { id: "" },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(400);
+ });
+
+ test("returns error when ID is whitespace only", async () => {
+ const res = await connectRequest(
+ "DeleteStatusReport",
+ { id: " " },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(400);
+ });
+
+ test("returns 404 for status report in different workspace", async () => {
+ // Create status report in workspace 2
+ const otherReport = await db
+ .insert(statusReport)
+ .values({
+ workspaceId: 2,
+ title: `${TEST_PREFIX}-other-workspace-delete`,
+ status: "investigating",
+ })
+ .returning()
+ .get();
+
+ try {
+ const res = await connectRequest(
+ "DeleteStatusReport",
+ { id: String(otherReport.id) },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(404);
+
+ // Verify it wasn't deleted
+ const stillExists = await db
+ .select()
+ .from(statusReport)
+ .where(eq(statusReport.id, otherReport.id))
+ .get();
+ expect(stillExists).toBeDefined();
+ } finally {
+ await db.delete(statusReport).where(eq(statusReport.id, otherReport.id));
+ }
+ });
+});
+
+describe("StatusReportService.AddStatusReportUpdate", () => {
+ test("adds update to existing status report", async () => {
+ const res = await connectRequest(
+ "AddStatusReportUpdate",
+ {
+ statusReportId: String(testStatusReportId),
+ status: "STATUS_REPORT_STATUS_MONITORING",
+ message: "We are monitoring the fix.",
+ date: new Date().toISOString(),
+ },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(200);
+
+ const data = await res.json();
+ expect(data).toHaveProperty("statusReport");
+ expect(data.statusReport.status).toBe("STATUS_REPORT_STATUS_MONITORING");
+ // Should now have 3 updates (2 initial + 1 new)
+ expect(data.statusReport.updates.length).toBeGreaterThanOrEqual(3);
+
+ const newUpdate = data.statusReport.updates.find(
+ (u: { message: string }) => u.message === "We are monitoring the fix.",
+ );
+ expect(newUpdate).toBeDefined();
+ expect(newUpdate.status).toBe("STATUS_REPORT_STATUS_MONITORING");
+ });
+
+ test("uses current time when date is not provided", async () => {
+ // Allow 2 second tolerance for timing differences
+ const beforeTime = new Date(Date.now() - 2000);
+
+ const res = await connectRequest(
+ "AddStatusReportUpdate",
+ {
+ statusReportId: String(testStatusReportId),
+ status: "STATUS_REPORT_STATUS_RESOLVED",
+ message: "Issue has been resolved.",
+ },
+ { "x-openstatus-key": "1" },
+ );
+
+ const afterTime = new Date(Date.now() + 2000);
+
+ expect(res.status).toBe(200);
+
+ const data = await res.json();
+ expect(data.statusReport.status).toBe("STATUS_REPORT_STATUS_RESOLVED");
+
+ const newUpdate = data.statusReport.updates.find(
+ (u: { message: string }) => u.message === "Issue has been resolved.",
+ );
+ expect(newUpdate).toBeDefined();
+
+ const updateDate = new Date(newUpdate.date);
+ expect(updateDate.getTime()).toBeGreaterThanOrEqual(beforeTime.getTime());
+ expect(updateDate.getTime()).toBeLessThanOrEqual(afterTime.getTime());
+ });
+
+ test("returns 401 when no auth key provided", async () => {
+ const res = await connectRequest("AddStatusReportUpdate", {
+ statusReportId: String(testStatusReportId),
+ status: "STATUS_REPORT_STATUS_RESOLVED",
+ message: "Unauthorized update",
+ });
+
+ expect(res.status).toBe(401);
+ });
+
+ test("returns 404 for non-existent status report", async () => {
+ const res = await connectRequest(
+ "AddStatusReportUpdate",
+ {
+ statusReportId: "99999",
+ status: "STATUS_REPORT_STATUS_RESOLVED",
+ message: "Non-existent report",
+ },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(404);
+ });
+
+ test("returns error when statusReportId is empty string", async () => {
+ const res = await connectRequest(
+ "AddStatusReportUpdate",
+ {
+ statusReportId: "",
+ status: "STATUS_REPORT_STATUS_RESOLVED",
+ message: "Empty ID update",
+ },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(400);
+ });
+
+ test("returns error when statusReportId is whitespace only", async () => {
+ const res = await connectRequest(
+ "AddStatusReportUpdate",
+ {
+ statusReportId: " ",
+ status: "STATUS_REPORT_STATUS_RESOLVED",
+ message: "Whitespace ID update",
+ },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(400);
+ });
+
+ test("returns 404 for status report in different workspace", async () => {
+ // Create status report in workspace 2
+ const otherReport = await db
+ .insert(statusReport)
+ .values({
+ workspaceId: 2,
+ title: `${TEST_PREFIX}-other-workspace-add-update`,
+ status: "investigating",
+ })
+ .returning()
+ .get();
+
+ try {
+ const res = await connectRequest(
+ "AddStatusReportUpdate",
+ {
+ statusReportId: String(otherReport.id),
+ status: "STATUS_REPORT_STATUS_RESOLVED",
+ message: "Should not add to other workspace",
+ },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(404);
+ } finally {
+ await db.delete(statusReport).where(eq(statusReport.id, otherReport.id));
+ }
+ });
+
+ test("adds update with notify=true", async () => {
+ sendStatusReportUpdateMock.mockClear();
+
+ const res = await connectRequest(
+ "AddStatusReportUpdate",
+ {
+ statusReportId: String(testStatusReportForNotifyId),
+ status: "STATUS_REPORT_STATUS_IDENTIFIED",
+ message: "We identified the issue and are notifying subscribers.",
+ date: new Date().toISOString(),
+ notify: true,
+ },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(200);
+
+ const data = await res.json();
+ expect(data).toHaveProperty("statusReport");
+ expect(data.statusReport.status).toBe("STATUS_REPORT_STATUS_IDENTIFIED");
+
+ const newUpdate = data.statusReport.updates.find(
+ (u: { message: string }) =>
+ u.message === "We identified the issue and are notifying subscribers.",
+ );
+ expect(newUpdate).toBeDefined();
+
+ // Verify notification was sent
+ expect(sendStatusReportUpdateMock).toHaveBeenCalledTimes(1);
+ const mockCall = sendStatusReportUpdateMock.mock.calls[0][0];
+ expect(mockCall.reportTitle).toBe(`${TEST_PREFIX}-for-notify`);
+ expect(mockCall.status).toBe("identified");
+ expect(mockCall.message).toBe(
+ "We identified the issue and are notifying subscribers.",
+ );
+ });
+
+ test("adds update with notify=false", async () => {
+ sendStatusReportUpdateMock.mockClear();
+
+ const res = await connectRequest(
+ "AddStatusReportUpdate",
+ {
+ statusReportId: String(testStatusReportForNotifyId),
+ status: "STATUS_REPORT_STATUS_MONITORING",
+ message: "Monitoring without notification.",
+ date: new Date().toISOString(),
+ notify: false,
+ },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(200);
+
+ const data = await res.json();
+ expect(data).toHaveProperty("statusReport");
+ expect(data.statusReport.status).toBe("STATUS_REPORT_STATUS_MONITORING");
+
+ // Verify notification was NOT sent
+ expect(sendStatusReportUpdateMock).not.toHaveBeenCalled();
+ });
+
+ test("updates status report status when adding update", async () => {
+ // First verify the current status
+ const getRes = await connectRequest(
+ "GetStatusReport",
+ { id: String(testStatusReportForNotifyId) },
+ { "x-openstatus-key": "1" },
+ );
+ const getData = await getRes.json();
+ const initialStatus = getData.statusReport.status;
+
+ // Add update with different status
+ const newStatus =
+ initialStatus === "STATUS_REPORT_STATUS_RESOLVED"
+ ? "STATUS_REPORT_STATUS_INVESTIGATING"
+ : "STATUS_REPORT_STATUS_RESOLVED";
+
+ const res = await connectRequest(
+ "AddStatusReportUpdate",
+ {
+ statusReportId: String(testStatusReportForNotifyId),
+ status: newStatus,
+ message: "Status change test.",
+ },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(200);
+
+ const data = await res.json();
+ expect(data.statusReport.status).toBe(newStatus);
+ });
+
+ test("returns error for invalid date format", async () => {
+ const res = await connectRequest(
+ "AddStatusReportUpdate",
+ {
+ statusReportId: String(testStatusReportId),
+ status: "STATUS_REPORT_STATUS_MONITORING",
+ message: "Test with invalid date.",
+ date: "not-a-valid-date",
+ },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(400);
+ const data = await res.json();
+ expect(data.message).toContain("date: value does not match regex pattern");
+ });
+});
+
+describe("protoStatusToDb converter", () => {
+ test("converts valid statuses correctly", () => {
+ expect(protoStatusToDb(StatusReportStatus.INVESTIGATING)).toBe(
+ "investigating",
+ );
+ expect(protoStatusToDb(StatusReportStatus.IDENTIFIED)).toBe("identified");
+ expect(protoStatusToDb(StatusReportStatus.MONITORING)).toBe("monitoring");
+ expect(protoStatusToDb(StatusReportStatus.RESOLVED)).toBe("resolved");
+ });
+
+ test("throws error for UNSPECIFIED status", () => {
+ expect(() => protoStatusToDb(StatusReportStatus.UNSPECIFIED)).toThrow(
+ "Invalid status value",
+ );
+ });
+
+ test("throws error for unknown status values", () => {
+ // Simulate a new status value being added to the proto
+ const unknownStatus = 999 as StatusReportStatus;
+ expect(() => protoStatusToDb(unknownStatus)).toThrow(
+ "Invalid status value",
+ );
+ });
+});
diff --git a/apps/server/src/routes/rpc/services/status-report/converters.ts b/apps/server/src/routes/rpc/services/status-report/converters.ts
new file mode 100644
index 000000000..50981dd4b
--- /dev/null
+++ b/apps/server/src/routes/rpc/services/status-report/converters.ts
@@ -0,0 +1,123 @@
+import type {
+ StatusReport,
+ StatusReportSummary,
+ StatusReportUpdate,
+} from "@openstatus/proto/status_report/v1";
+import { StatusReportStatus } from "@openstatus/proto/status_report/v1";
+import { invalidStatusError } from "./errors";
+
+type DBStatusReport = {
+ id: number;
+ status: "investigating" | "identified" | "monitoring" | "resolved";
+ title: string;
+ workspaceId: number | null;
+ pageId: number | null;
+ createdAt: Date | null;
+ updatedAt: Date | null;
+};
+
+type DBStatusReportUpdate = {
+ id: number;
+ status: "investigating" | "identified" | "monitoring" | "resolved";
+ date: Date;
+ message: string;
+ statusReportId: number;
+ createdAt: Date | null;
+ updatedAt: Date | null;
+};
+
+/**
+ * Convert DB status string to proto enum.
+ */
+export function dbStatusToProto(
+ status: "investigating" | "identified" | "monitoring" | "resolved",
+): StatusReportStatus {
+ switch (status) {
+ case "investigating":
+ return StatusReportStatus.INVESTIGATING;
+ case "identified":
+ return StatusReportStatus.IDENTIFIED;
+ case "monitoring":
+ return StatusReportStatus.MONITORING;
+ case "resolved":
+ return StatusReportStatus.RESOLVED;
+ default:
+ return StatusReportStatus.UNSPECIFIED;
+ }
+}
+
+/**
+ * Convert proto enum to DB status string.
+ */
+export function protoStatusToDb(
+ status: StatusReportStatus,
+): "investigating" | "identified" | "monitoring" | "resolved" {
+ switch (status) {
+ case StatusReportStatus.INVESTIGATING:
+ return "investigating";
+ case StatusReportStatus.IDENTIFIED:
+ return "identified";
+ case StatusReportStatus.MONITORING:
+ return "monitoring";
+ case StatusReportStatus.RESOLVED:
+ return "resolved";
+ case StatusReportStatus.UNSPECIFIED:
+ throw invalidStatusError(status);
+ default:
+ throw invalidStatusError(status);
+ }
+}
+
+/**
+ * Convert a DB status report update to proto format.
+ */
+export function dbUpdateToProto(
+ update: DBStatusReportUpdate,
+): StatusReportUpdate {
+ return {
+ $typeName: "openstatus.status_report.v1.StatusReportUpdate" as const,
+ id: String(update.id),
+ status: dbStatusToProto(update.status),
+ date: update.date.toISOString(),
+ message: update.message,
+ createdAt: update.createdAt?.toISOString() ?? "",
+ };
+}
+
+/**
+ * Convert a DB status report to proto summary format (metadata only).
+ */
+export function dbReportToProtoSummary(
+ report: DBStatusReport,
+ pageComponentIds: string[],
+): StatusReportSummary {
+ return {
+ $typeName: "openstatus.status_report.v1.StatusReportSummary" as const,
+ id: String(report.id),
+ status: dbStatusToProto(report.status),
+ title: report.title,
+ pageComponentIds,
+ createdAt: report.createdAt?.toISOString() ?? "",
+ updatedAt: report.updatedAt?.toISOString() ?? "",
+ };
+}
+
+/**
+ * Convert a DB status report to full proto format (with updates).
+ */
+export function dbReportToProto(
+ report: DBStatusReport,
+ pageComponentIds: string[],
+ updates: DBStatusReportUpdate[],
+): StatusReport {
+ return {
+ $typeName: "openstatus.status_report.v1.StatusReport" as const,
+ id: String(report.id),
+ status: dbStatusToProto(report.status),
+ title: report.title,
+ pageComponentIds,
+ updates: updates.map(dbUpdateToProto),
+ createdAt: report.createdAt?.toISOString() ?? "",
+ updatedAt: report.updatedAt?.toISOString() ?? "",
+ };
+}
diff --git a/apps/server/src/routes/rpc/services/status-report/errors.ts b/apps/server/src/routes/rpc/services/status-report/errors.ts
new file mode 100644
index 000000000..f4101983c
--- /dev/null
+++ b/apps/server/src/routes/rpc/services/status-report/errors.ts
@@ -0,0 +1,141 @@
+import { Code, ConnectError } from "@connectrpc/connect";
+
+/**
+ * Error reasons for structured error handling.
+ */
+export const ErrorReason = {
+ STATUS_REPORT_NOT_FOUND: "STATUS_REPORT_NOT_FOUND",
+ STATUS_REPORT_ID_REQUIRED: "STATUS_REPORT_ID_REQUIRED",
+ STATUS_REPORT_CREATE_FAILED: "STATUS_REPORT_CREATE_FAILED",
+ STATUS_REPORT_UPDATE_FAILED: "STATUS_REPORT_UPDATE_FAILED",
+ PAGE_COMPONENT_NOT_FOUND: "PAGE_COMPONENT_NOT_FOUND",
+ PAGE_COMPONENTS_MIXED_PAGES: "PAGE_COMPONENTS_MIXED_PAGES",
+ INVALID_DATE_FORMAT: "INVALID_DATE_FORMAT",
+ INVALID_STATUS: "INVALID_STATUS",
+} 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 report not found" error.
+ */
+export function statusReportNotFoundError(
+ statusReportId: string,
+): ConnectError {
+ return createError(
+ "Status report not found",
+ Code.NotFound,
+ ErrorReason.STATUS_REPORT_NOT_FOUND,
+ { "status-report-id": statusReportId },
+ );
+}
+
+/**
+ * Creates a "status report ID required" error.
+ */
+export function statusReportIdRequiredError(): ConnectError {
+ return createError(
+ "Status report ID is required",
+ Code.InvalidArgument,
+ ErrorReason.STATUS_REPORT_ID_REQUIRED,
+ );
+}
+
+/**
+ * Creates a "failed to create status report" error.
+ */
+export function statusReportCreateFailedError(): ConnectError {
+ return createError(
+ "Failed to create status report",
+ Code.Internal,
+ ErrorReason.STATUS_REPORT_CREATE_FAILED,
+ );
+}
+
+/**
+ * Creates a "failed to update status report" error.
+ */
+export function statusReportUpdateFailedError(
+ statusReportId: string,
+): ConnectError {
+ return createError(
+ "Failed to update status report",
+ Code.Internal,
+ ErrorReason.STATUS_REPORT_UPDATE_FAILED,
+ { "status-report-id": statusReportId },
+ );
+}
+
+/**
+ * Creates a "page component not found" error.
+ */
+export function pageComponentNotFoundError(
+ pageComponentId: string,
+): ConnectError {
+ return createError(
+ "Page component not found",
+ Code.NotFound,
+ ErrorReason.PAGE_COMPONENT_NOT_FOUND,
+ { "page-component-id": pageComponentId },
+ );
+}
+
+/**
+ * Creates a "page components from mixed pages" error.
+ */
+export function pageComponentsMixedPagesError(): ConnectError {
+ return createError(
+ "All page components must belong to the same page",
+ Code.InvalidArgument,
+ ErrorReason.PAGE_COMPONENTS_MIXED_PAGES,
+ );
+}
+
+/**
+ * Creates an "invalid date format" error.
+ */
+export function invalidDateFormatError(dateValue: string): ConnectError {
+ return createError(
+ "Invalid date format. Expected RFC 3339 format (e.g., 2024-01-15T10:30:00Z)",
+ Code.InvalidArgument,
+ ErrorReason.INVALID_DATE_FORMAT,
+ { "date-value": dateValue },
+ );
+}
+
+/**
+ * Creates an "invalid status" error.
+ */
+export function invalidStatusError(statusValue: number): ConnectError {
+ return createError(
+ `Invalid status value: ${statusValue}. Expected INVESTIGATING, IDENTIFIED, MONITORING, or RESOLVED`,
+ Code.InvalidArgument,
+ ErrorReason.INVALID_STATUS,
+ { "status-value": String(statusValue) },
+ );
+}
diff --git a/apps/server/src/routes/rpc/services/status-report/index.ts b/apps/server/src/routes/rpc/services/status-report/index.ts
new file mode 100644
index 000000000..3581cf0d1
--- /dev/null
+++ b/apps/server/src/routes/rpc/services/status-report/index.ts
@@ -0,0 +1,589 @@
+import type { ServiceImpl } from "@connectrpc/connect";
+import {
+ and,
+ db,
+ desc,
+ eq,
+ inArray,
+ isNotNull,
+ isNull,
+ sql,
+} from "@openstatus/db";
+
+// Type that works with both db instance and transaction
+type DB = typeof db;
+type Transaction = Parameters<Parameters<DB["transaction"]>[0]>[0];
+import {
+ page,
+ pageComponent,
+ pageSubscriber,
+ statusReport,
+ statusReportUpdate,
+ statusReportsToPageComponents,
+} from "@openstatus/db/src/schema";
+import type { Limits } from "@openstatus/db/src/schema/plan/schema";
+import { EmailClient } from "@openstatus/emails";
+import type { StatusReportService } from "@openstatus/proto/status_report/v1";
+import { StatusReportStatus } from "@openstatus/proto/status_report/v1";
+
+import { env } from "@/env";
+import { getRpcContext } from "../../interceptors";
+import {
+ dbReportToProto,
+ dbReportToProtoSummary,
+ protoStatusToDb,
+} from "./converters";
+import {
+ invalidDateFormatError,
+ pageComponentNotFoundError,
+ pageComponentsMixedPagesError,
+ statusReportCreateFailedError,
+ statusReportIdRequiredError,
+ statusReportNotFoundError,
+ statusReportUpdateFailedError,
+} from "./errors";
+
+const emailClient = new EmailClient({ apiKey: env.RESEND_API_KEY });
+
+/**
+ * Helper to send status report notifications to page subscribers.
+ */
+async function sendStatusReportNotification(params: {
+ statusReportId: number;
+ pageId: number;
+ reportTitle: string;
+ status: "investigating" | "identified" | "monitoring" | "resolved";
+ message: string;
+ date: Date;
+ limits: Limits;
+}) {
+ const { statusReportId, pageId, reportTitle, status, message, date, limits } =
+ params;
+
+ // Check if workspace has status-subscribers feature enabled
+ if (!limits["status-subscribers"]) {
+ return;
+ }
+
+ // Get page info
+ const pageInfo = await db.query.page.findFirst({
+ where: eq(page.id, pageId),
+ });
+
+ if (!pageInfo) {
+ return;
+ }
+
+ // Get verified subscribers who haven't unsubscribed
+ const subscribers = await db
+ .select()
+ .from(pageSubscriber)
+ .where(
+ and(
+ eq(pageSubscriber.pageId, pageId),
+ isNotNull(pageSubscriber.acceptedAt),
+ isNull(pageSubscriber.unsubscribedAt),
+ ),
+ )
+ .all();
+
+ const validSubscribers = subscribers.filter(
+ (s): s is typeof s & { token: string } =>
+ s.token !== null && s.acceptedAt !== null && s.unsubscribedAt === null,
+ );
+
+ if (validSubscribers.length === 0) {
+ return;
+ }
+
+ // Get page components for this status report
+ const statusReportWithComponents = await db.query.statusReport.findFirst({
+ where: eq(statusReport.id, statusReportId),
+ with: {
+ statusReportsToPageComponents: {
+ with: { pageComponent: true },
+ },
+ },
+ });
+
+ const pageComponents =
+ statusReportWithComponents?.statusReportsToPageComponents.map(
+ (i) => i.pageComponent.name,
+ ) ?? [];
+
+ // Send notification emails
+ await emailClient.sendStatusReportUpdate({
+ subscribers: validSubscribers.map((subscriber) => ({
+ email: subscriber.email,
+ token: subscriber.token,
+ })),
+ pageTitle: pageInfo.title,
+ pageSlug: pageInfo.slug,
+ customDomain: pageInfo.customDomain,
+ reportTitle,
+ status,
+ message,
+ date: date.toISOString(),
+ pageComponents,
+ });
+}
+
+/**
+ * Helper to get a status report by ID with workspace scope.
+ */
+async function getStatusReportById(id: number, workspaceId: number) {
+ return db
+ .select()
+ .from(statusReport)
+ .where(
+ and(eq(statusReport.id, id), eq(statusReport.workspaceId, workspaceId)),
+ )
+ .get();
+}
+
+/**
+ * Helper to get page component IDs for a status report.
+ */
+async function getPageComponentIdsForReport(statusReportId: number) {
+ const components = await db
+ .select({ pageComponentId: statusReportsToPageComponents.pageComponentId })
+ .from(statusReportsToPageComponents)
+ .where(eq(statusReportsToPageComponents.statusReportId, statusReportId))
+ .all();
+
+ return components.map((c) => String(c.pageComponentId));
+}
+
+/**
+ * Helper to get updates for a status report, ordered by date descending.
+ */
+async function getUpdatesForReport(statusReportId: number) {
+ return db
+ .select()
+ .from(statusReportUpdate)
+ .where(eq(statusReportUpdate.statusReportId, statusReportId))
+ .orderBy(desc(statusReportUpdate.date))
+ .all();
+}
+
+/**
+ * Result of validating page component IDs.
+ */
+interface ValidatedPageComponents {
+ componentIds: number[];
+ pageId: number | null;
+}
+
+/**
+ * Helper to validate page component IDs belong to the workspace and same page.
+ * Accepts an optional transaction to ensure atomicity with subsequent operations.
+ */
+async function validatePageComponentIds(
+ pageComponentIds: string[],
+ workspaceId: number,
+ tx: DB | Transaction = db,
+): Promise<ValidatedPageComponents> {
+ if (pageComponentIds.length === 0) {
+ return { componentIds: [], pageId: null };
+ }
+
+ const numericIds = pageComponentIds.map((id) => Number(id));
+
+ const validComponents = await tx
+ .select({ id: pageComponent.id, pageId: pageComponent.pageId })
+ .from(pageComponent)
+ .where(
+ and(
+ inArray(pageComponent.id, numericIds),
+ eq(pageComponent.workspaceId, workspaceId),
+ ),
+ )
+ .all();
+
+ const validComponentsMap = new Map(
+ validComponents.map((c) => [c.id, c.pageId]),
+ );
+
+ // Check all requested IDs exist
+ for (const id of numericIds) {
+ if (!validComponentsMap.has(id)) {
+ throw pageComponentNotFoundError(String(id));
+ }
+ }
+
+ // Validate all components belong to the same page
+ const pageIds = new Set(validComponents.map((c) => c.pageId));
+ if (pageIds.size > 1) {
+ throw pageComponentsMixedPagesError();
+ }
+
+ const pageId = validComponents[0]?.pageId ?? null;
+
+ return { componentIds: numericIds, pageId };
+}
+
+/**
+ * Helper to update page component associations for a status report.
+ * Accepts an optional transaction to ensure atomicity.
+ */
+async function updatePageComponentAssociations(
+ statusReportId: number,
+ pageComponentIds: number[],
+ tx: DB | Transaction = db,
+) {
+ // Delete existing associations
+ await tx
+ .delete(statusReportsToPageComponents)
+ .where(eq(statusReportsToPageComponents.statusReportId, statusReportId));
+
+ // Insert new associations
+ if (pageComponentIds.length > 0) {
+ await tx.insert(statusReportsToPageComponents).values(
+ pageComponentIds.map((pageComponentId) => ({
+ statusReportId,
+ pageComponentId,
+ })),
+ );
+ }
+}
+
+/**
+ * Parses and validates a date string.
+ * Throws invalidDateFormatError if the date is invalid.
+ */
+function parseDate(dateString: string): Date {
+ const date = new Date(dateString);
+ if (Number.isNaN(date.getTime())) {
+ throw invalidDateFormatError(dateString);
+ }
+ return date;
+}
+
+/**
+ * Status report service implementation for ConnectRPC.
+ */
+export const statusReportServiceImpl: ServiceImpl<typeof StatusReportService> =
+ {
+ async createStatusReport(req, ctx) {
+ const rpcCtx = getRpcContext(ctx);
+ const workspaceId = rpcCtx.workspace.id;
+
+ // Parse and validate the date before the transaction
+ const date = parseDate(req.date);
+
+ // Create status report, associations, and initial update in a transaction
+ const { report: newReport, pageId } = await db.transaction(async (tx) => {
+ // Validate page component IDs inside transaction to prevent TOCTOU race condition
+ const validatedComponents = await validatePageComponentIds(
+ req.pageComponentIds,
+ workspaceId,
+ tx,
+ );
+
+ // Derive pageId from validated components (ensures consistency)
+ const pageId = validatedComponents.pageId;
+
+ // Create the status report
+ const report = await tx
+ .insert(statusReport)
+ .values({
+ workspaceId,
+ pageId,
+ title: req.title,
+ status: protoStatusToDb(req.status),
+ })
+ .returning()
+ .get();
+
+ if (!report) {
+ throw statusReportCreateFailedError();
+ }
+
+ // Create page component associations
+ await updatePageComponentAssociations(
+ report.id,
+ validatedComponents.componentIds,
+ tx,
+ );
+
+ // Create the initial update
+ const newUpdate = await tx
+ .insert(statusReportUpdate)
+ .values({
+ statusReportId: report.id,
+ status: protoStatusToDb(req.status),
+ date,
+ message: req.message,
+ })
+ .returning()
+ .get();
+
+ if (!newUpdate) {
+ throw statusReportCreateFailedError();
+ }
+
+ return { report, pageId };
+ });
+
+ // Send notifications if requested (outside transaction)
+ if (req.notify) {
+ await sendStatusReportNotification({
+ statusReportId: newReport.id,
+ pageId,
+ reportTitle: newReport.title,
+ status: protoStatusToDb(req.status),
+ message: req.message,
+ date,
+ limits: rpcCtx.workspace.limits,
+ });
+ }
+
+ // Fetch the updates for the response
+ const updates = await getUpdatesForReport(newReport.id);
+
+ return {
+ statusReport: dbReportToProto(newReport, req.pageComponentIds, updates),
+ };
+ },
+
+ async getStatusReport(req, ctx) {
+ const rpcCtx = getRpcContext(ctx);
+ const workspaceId = rpcCtx.workspace.id;
+
+ if (!req.id || req.id.trim() === "") {
+ throw statusReportIdRequiredError();
+ }
+
+ const report = await getStatusReportById(Number(req.id), workspaceId);
+ if (!report) {
+ throw statusReportNotFoundError(req.id);
+ }
+
+ const pageComponentIds = await getPageComponentIdsForReport(report.id);
+ const updates = await getUpdatesForReport(report.id);
+
+ return {
+ statusReport: dbReportToProto(report, pageComponentIds, updates),
+ };
+ },
+
+ async listStatusReports(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;
+
+ // Build conditions
+ const conditions = [eq(statusReport.workspaceId, workspaceId)];
+
+ // Add status filter if provided
+ if (req.statuses.length > 0) {
+ const dbStatuses = req.statuses
+ .filter((s) => s !== StatusReportStatus.UNSPECIFIED)
+ .map(protoStatusToDb);
+ if (dbStatuses.length > 0) {
+ conditions.push(inArray(statusReport.status, dbStatuses));
+ }
+ }
+
+ // Get total count
+ const countResult = await db
+ .select({ count: sql<number>`count(*)` })
+ .from(statusReport)
+ .where(and(...conditions))
+ .get();
+
+ const totalCount = countResult?.count ?? 0;
+
+ // Get status reports
+ const reports = await db
+ .select()
+ .from(statusReport)
+ .where(and(...conditions))
+ .orderBy(desc(statusReport.createdAt))
+ .limit(limit)
+ .offset(offset)
+ .all();
+
+ // Get page component IDs for each report
+ const statusReports = await Promise.all(
+ reports.map(async (report) => {
+ const pageComponentIds = await getPageComponentIdsForReport(
+ report.id,
+ );
+ return dbReportToProtoSummary(report, pageComponentIds);
+ }),
+ );
+
+ return {
+ statusReports,
+ totalSize: totalCount,
+ };
+ },
+
+ async updateStatusReport(req, ctx) {
+ const rpcCtx = getRpcContext(ctx);
+ const workspaceId = rpcCtx.workspace.id;
+
+ if (!req.id || req.id.trim() === "") {
+ throw statusReportIdRequiredError();
+ }
+
+ const report = await getStatusReportById(Number(req.id), workspaceId);
+ if (!report) {
+ throw statusReportNotFoundError(req.id);
+ }
+
+ // Update report, associations in a transaction
+ const updatedReport = await db.transaction(async (tx) => {
+ // Validate page component IDs inside transaction to prevent TOCTOU race condition
+ // Allows empty array to clear associations; ensures all components belong to same page
+ const validatedComponents = await validatePageComponentIds(
+ req.pageComponentIds,
+ workspaceId,
+ tx,
+ );
+
+ // Build update values
+ const updateValues: Record<string, unknown> = {
+ updatedAt: new Date(),
+ // Set pageId from validated components (null if no components)
+ pageId: validatedComponents.pageId,
+ };
+
+ if (req.title !== undefined && req.title !== "") {
+ updateValues.title = req.title;
+ }
+
+ // Always update page component associations (empty array clears all)
+ await updatePageComponentAssociations(
+ report.id,
+ validatedComponents.componentIds,
+ tx,
+ );
+
+ // Update the report
+ const updated = await tx
+ .update(statusReport)
+ .set(updateValues)
+ .where(eq(statusReport.id, report.id))
+ .returning()
+ .get();
+
+ if (!updated) {
+ throw statusReportUpdateFailedError(req.id);
+ }
+
+ return updated;
+ });
+
+ // Fetch updated data
+ const pageComponentIds = await getPageComponentIdsForReport(
+ updatedReport.id,
+ );
+ const updates = await getUpdatesForReport(updatedReport.id);
+
+ return {
+ statusReport: dbReportToProto(updatedReport, pageComponentIds, updates),
+ };
+ },
+
+ async deleteStatusReport(req, ctx) {
+ const rpcCtx = getRpcContext(ctx);
+ const workspaceId = rpcCtx.workspace.id;
+
+ if (!req.id || req.id.trim() === "") {
+ throw statusReportIdRequiredError();
+ }
+
+ const report = await getStatusReportById(Number(req.id), workspaceId);
+ if (!report) {
+ throw statusReportNotFoundError(req.id);
+ }
+
+ // Delete the status report (cascade will delete updates and associations)
+ await db.delete(statusReport).where(eq(statusReport.id, report.id));
+
+ return { success: true };
+ },
+
+ async addStatusReportUpdate(req, ctx) {
+ const rpcCtx = getRpcContext(ctx);
+ const workspaceId = rpcCtx.workspace.id;
+
+ if (!req.statusReportId || req.statusReportId.trim() === "") {
+ throw statusReportIdRequiredError();
+ }
+
+ const report = await getStatusReportById(
+ Number(req.statusReportId),
+ workspaceId,
+ );
+ if (!report) {
+ throw statusReportNotFoundError(req.statusReportId);
+ }
+
+ // Parse and validate the date or use current time
+ const date = req.date ? parseDate(req.date) : new Date();
+
+ // Create update and update status report in a transaction
+ const updatedReport = await db.transaction(async (tx) => {
+ // Create the update
+ const newUpdate = await tx
+ .insert(statusReportUpdate)
+ .values({
+ statusReportId: report.id,
+ status: protoStatusToDb(req.status),
+ date,
+ message: req.message,
+ })
+ .returning()
+ .get();
+
+ if (!newUpdate) {
+ throw statusReportUpdateFailedError(req.statusReportId);
+ }
+
+ // Update the status report's status and updatedAt
+ const updated = await tx
+ .update(statusReport)
+ .set({
+ status: protoStatusToDb(req.status),
+ updatedAt: new Date(),
+ })
+ .where(eq(statusReport.id, report.id))
+ .returning()
+ .get();
+
+ if (!updated) {
+ throw statusReportUpdateFailedError(req.statusReportId);
+ }
+
+ return updated;
+ });
+
+ // Send notifications if requested (outside transaction)
+ if (req.notify && updatedReport.pageId) {
+ await sendStatusReportNotification({
+ statusReportId: updatedReport.id,
+ pageId: updatedReport.pageId,
+ reportTitle: updatedReport.title,
+ status: protoStatusToDb(req.status),
+ message: req.message,
+ date,
+ limits: rpcCtx.workspace.limits,
+ });
+ }
+
+ // Fetch all updates
+ const pageComponentIds = await getPageComponentIdsForReport(
+ updatedReport.id,
+ );
+ const updates = await getUpdatesForReport(updatedReport.id);
+
+ return {
+ statusReport: dbReportToProto(updatedReport, pageComponentIds, updates),
+ };
+ },
+ };
diff --git a/packages/proto/api/openstatus/status_report/PLAN.md b/packages/proto/api/openstatus/status_report/PLAN.md
new file mode 100644
index 000000000..bc94b76ae
--- /dev/null
+++ b/packages/proto/api/openstatus/status_report/PLAN.md
@@ -0,0 +1,307 @@
+# Status Report Proto Implementation Plan
+
+## Overview
+
+Create proto definitions for Status Report CRUD operations, following the existing patterns in `packages/proto/api/openstatus/monitor/v1/`.
+
+## Directory Structure
+
+```
+packages/proto/api/openstatus/status_report/
+└── v1/
+ ├── status_report.proto # Message definitions
+ └── service.proto # Service and RPC definitions
+```
+
+## Database Schema Reference
+
+From `packages/db/src/schema/status_reports/status_reports.ts`:
+
+### StatusReport Table
+| Field | Type | Constraints |
+|-------|------|-------------|
+| id | integer | primary key |
+| status | enum | "investigating", "identified", "monitoring", "resolved" |
+| title | text(256) | not null |
+| workspaceId | integer | foreign key |
+| pageId | integer | foreign key (cascade delete) |
+| createdAt | timestamp | default now |
+| updatedAt | timestamp | default now |
+
+### StatusReportUpdate Table
+| Field | Type | Constraints |
+|-------|------|-------------|
+| id | integer | primary key |
+| status | enum | same as above |
+| date | timestamp | not null |
+| message | text | not null |
+| statusReportId | integer | foreign key, not null (cascade delete) |
+| createdAt | timestamp | default now |
+| updatedAt | timestamp | default now |
+
+### Relationships
+- StatusReport has many StatusReportUpdates
+- StatusReport belongs to Workspace
+- StatusReport can be linked to multiple PageComponents (via `statusReportsToPageComponents` junction table)
+- Legacy: StatusReport belongs to Page (deprecated, use page components instead)
+- Legacy: StatusReport can be linked to Monitors (via `monitorsToStatusReport`, deprecated)
+
+---
+
+## Proto Definitions
+
+### File 1: `status_report.proto`
+
+```protobuf
+syntax = "proto3";
+
+package openstatus.status_report.v1;
+
+option go_package = "github.com/openstatushq/openstatus/packages/proto/openstatus/status_report/v1;statusreportv1";
+
+// StatusReportStatus represents the current state of a status report.
+enum StatusReportStatus {
+ STATUS_REPORT_STATUS_UNSPECIFIED = 0;
+ STATUS_REPORT_STATUS_INVESTIGATING = 1;
+ STATUS_REPORT_STATUS_IDENTIFIED = 2;
+ STATUS_REPORT_STATUS_MONITORING = 3;
+ STATUS_REPORT_STATUS_RESOLVED = 4;
+}
+
+// StatusReportUpdate represents a single update entry in a status report timeline.
+message StatusReportUpdate {
+ // Unique identifier for the update.
+ string id = 1;
+
+ // Status at the time of this update.
+ StatusReportStatus status = 2;
+
+ // Timestamp when this update occurred (RFC 3339 format).
+ string date = 3;
+
+ // Message describing the update.
+ string message = 4;
+
+ // Timestamp when the update was created (RFC 3339 format).
+ string created_at = 5;
+}
+
+// StatusReportSummary represents metadata for a status report (used in list responses).
+message StatusReportSummary {
+ // Unique identifier for the status report.
+ string id = 1;
+
+ // Current status of the report.
+ StatusReportStatus status = 2;
+
+ // Title of the status report.
+ string title = 3;
+
+ // IDs of affected page components.
+ repeated string page_component_ids = 4;
+
+ // Timestamp when the report was created (RFC 3339 format).
+ string created_at = 5;
+
+ // Timestamp when the report was last updated (RFC 3339 format).
+ string updated_at = 6;
+}
+
+// StatusReport represents an incident or maintenance report with full details.
+message StatusReport {
+ // Unique identifier for the status report.
+ string id = 1;
+
+ // Current status of the report.
+ StatusReportStatus status = 2;
+
+ // Title of the status report.
+ string title = 3;
+
+ // IDs of affected page components.
+ repeated string page_component_ids = 4;
+
+ // Timeline of updates for this report (only included in GetStatusReport).
+ repeated StatusReportUpdate updates = 5;
+
+ // Timestamp when the report was created (RFC 3339 format).
+ string created_at = 6;
+
+ // Timestamp when the report was last updated (RFC 3339 format).
+ string updated_at = 7;
+}
+```
+
+### File 2: `service.proto`
+
+```protobuf
+syntax = "proto3";
+
+package openstatus.status_report.v1;
+
+import "buf/validate/validate.proto";
+import "openstatus/status_report/v1/status_report.proto";
+
+option go_package = "github.com/openstatushq/openstatus/packages/proto/openstatus/status_report/v1;statusreportv1";
+
+// StatusReportService provides CRUD operations for status reports.
+service StatusReportService {
+ // CreateStatusReport creates a new status report.
+ rpc CreateStatusReport(CreateStatusReportRequest) returns (CreateStatusReportResponse);
+
+ // GetStatusReport retrieves a specific status report by ID (includes full update timeline).
+ rpc GetStatusReport(GetStatusReportRequest) returns (GetStatusReportResponse);
+
+ // ListStatusReports returns all status reports for the workspace (metadata only).
+ rpc ListStatusReports(ListStatusReportsRequest) returns (ListStatusReportsResponse);
+
+ // UpdateStatusReport updates the metadata of a status report (title, page, monitors).
+ rpc UpdateStatusReport(UpdateStatusReportRequest) returns (UpdateStatusReportResponse);
+
+ // DeleteStatusReport removes a status report and all its updates.
+ rpc DeleteStatusReport(DeleteStatusReportRequest) returns (DeleteStatusReportResponse);
+
+ // AddStatusReportUpdate adds a new update to an existing status report timeline.
+ rpc AddStatusReportUpdate(AddStatusReportUpdateRequest) returns (AddStatusReportUpdateResponse);
+}
+
+// --- Create Status Report ---
+
+message CreateStatusReportRequest {
+ // Title of the status report (required).
+ string title = 1 [(buf.validate.field).string.min_len = 1];
+
+ // Initial status (required).
+ StatusReportStatus status = 2 [(buf.validate.field).enum.defined_only = true];
+
+ // Initial message describing the incident (required).
+ string message = 3 [(buf.validate.field).string.min_len = 1];
+
+ // Date when the event occurred (RFC 3339 format, required).
+ string date = 4 [(buf.validate.field).string.min_len = 1];
+
+ // Page component IDs to associate with this report (required).
+ repeated string page_component_ids = 5 [(buf.validate.field).repeated.min_items = 1];
+}
+
+message CreateStatusReportResponse {
+ // The created status report.
+ StatusReport status_report = 1;
+}
+
+// --- Get Status Report ---
+
+message GetStatusReportRequest {
+ // ID of the status report to retrieve (required).
+ string id = 1 [(buf.validate.field).string.min_len = 1];
+}
+
+message GetStatusReportResponse {
+ // The requested status report.
+ StatusReport status_report = 1;
+}
+
+// --- List Status Reports ---
+
+message ListStatusReportsRequest {
+ // Maximum number of reports to return (1-100, defaults to 50).
+ optional int32 limit = 1 [(buf.validate.field).int32 = {
+ gte: 1
+ lte: 100
+ }];
+
+ // Number of reports to skip for pagination (defaults to 0).
+ optional int32 offset = 2 [(buf.validate.field).int32.gte = 0];
+
+ // Filter by status (optional). If empty, returns all statuses.
+ repeated StatusReportStatus statuses = 3;
+}
+
+message ListStatusReportsResponse {
+ // List of status reports (metadata only, use GetStatusReport for full details).
+ repeated StatusReportSummary status_reports = 1;
+
+ // Total number of reports matching the filter.
+ int32 total_size = 2;
+}
+
+// --- Update Status Report ---
+
+message UpdateStatusReportRequest {
+ // ID of the status report to update (required).
+ string id = 1 [(buf.validate.field).string.min_len = 1];
+
+ // New title for the report (optional).
+ optional string title = 2;
+
+ // New list of page component IDs (optional, replaces existing list).
+ repeated string page_component_ids = 3;
+}
+
+message UpdateStatusReportResponse {
+ // The updated status report.
+ StatusReport status_report = 1;
+}
+
+// --- Delete Status Report ---
+
+message DeleteStatusReportRequest {
+ // ID of the status report to delete (required).
+ string id = 1 [(buf.validate.field).string.min_len = 1];
+}
+
+message DeleteStatusReportResponse {
+ // Whether the deletion was successful.
+ bool success = 1;
+}
+
+// --- Add Status Report Update ---
+
+message AddStatusReportUpdateRequest {
+ // ID of the status report to update (required).
+ string status_report_id = 1 [(buf.validate.field).string.min_len = 1];
+
+ // New status for the report (required).
+ StatusReportStatus status = 2 [(buf.validate.field).enum.defined_only = true];
+
+ // Message describing what changed (required).
+ string message = 3 [(buf.validate.field).string.min_len = 1];
+
+ // Optional date for the update. Defaults to current time if not provided.
+ optional string date = 4;
+}
+
+message AddStatusReportUpdateResponse {
+ // The updated status report with the new update included.
+ StatusReport status_report = 1;
+}
+```
+
+---
+
+## Questions Resolved
+
+Based on the database schema:
+
+1. **Status Report Structure**: Uses `id`, `status`, `title`, `workspaceId`, `createdAt`, `updatedAt`
+2. **Updates**: Separate table `status_report_update` with timeline entries (id, status, date, message, statusReportId)
+3. **Status Values**: `investigating`, `identified`, `monitoring`, `resolved`
+4. **Relationships**: Links to PageComponents (many-to-many via `statusReportsToPageComponents` junction table)
+
+---
+
+## Implementation Notes
+
+1. **Workspace ID**: Not included in request/response as it should be derived from the authenticated context (API key belongs to workspace)
+2. **Timestamps**: Use RFC 3339 format strings for interoperability
+3. **Pagination**: Uses offset-based pagination with `limit` and `offset` parameters
+4. **Validation**: Use `buf.validate` for field validation
+
+---
+
+## Decisions Made
+
+1. **Delete Operation**: Yes - `DeleteStatusReport` RPC added (cascade deletes all updates)
+2. **Update Status Report**: Yes - `UpdateStatusReport` RPC added to modify title/page/monitors without creating a timeline entry
+3. **Filtering**: `ListStatusReports` supports filtering by status only (via `statuses` field)
+4. **Include Updates**: `ListStatusReports` returns `StatusReportSummary` (metadata only), `GetStatusReport` returns full `StatusReport` with update timeline
diff --git a/packages/proto/api/openstatus/status_report/v1/service.proto b/packages/proto/api/openstatus/status_report/v1/service.proto
new file mode 100644
index 000000000..172ef519b
--- /dev/null
+++ b/packages/proto/api/openstatus/status_report/v1/service.proto
@@ -0,0 +1,149 @@
+syntax = "proto3";
+
+package openstatus.status_report.v1;
+
+import "buf/validate/validate.proto";
+import "openstatus/status_report/v1/status_report.proto";
+
+option go_package = "github.com/openstatushq/openstatus/packages/proto/openstatus/status_report/v1;statusreportv1";
+
+// StatusReportService provides CRUD operations for status reports.
+service StatusReportService {
+ // CreateStatusReport creates a new status report.
+ rpc CreateStatusReport(CreateStatusReportRequest) returns (CreateStatusReportResponse);
+
+ // GetStatusReport retrieves a specific status report by ID (includes full update timeline).
+ rpc GetStatusReport(GetStatusReportRequest) returns (GetStatusReportResponse);
+
+ // ListStatusReports returns all status reports for the workspace (metadata only).
+ rpc ListStatusReports(ListStatusReportsRequest) returns (ListStatusReportsResponse);
+
+ // UpdateStatusReport updates the metadata of a status report (title, page components).
+ rpc UpdateStatusReport(UpdateStatusReportRequest) returns (UpdateStatusReportResponse);
+
+ // DeleteStatusReport removes a status report and all its updates.
+ rpc DeleteStatusReport(DeleteStatusReportRequest) returns (DeleteStatusReportResponse);
+
+ // AddStatusReportUpdate adds a new update to an existing status report timeline.
+ rpc AddStatusReportUpdate(AddStatusReportUpdateRequest) returns (AddStatusReportUpdateResponse);
+}
+
+// --- Create Status Report ---
+
+message CreateStatusReportRequest {
+ // Title of the status report (required).
+ string title = 1 [(buf.validate.field).string.min_len = 1];
+
+ // Initial status (required).
+ StatusReportStatus status = 2 [(buf.validate.field).enum.defined_only = true];
+
+ // Initial message describing the incident (required).
+ string message = 3 [(buf.validate.field).string.min_len = 1];
+
+ // Date when the event occurred (RFC 3339 format, required).
+ string date = 4 [(buf.validate.field).string.pattern = "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}"];
+
+ // Page ID to associate with this report (required).
+ string page_id = 5 [(buf.validate.field).string.min_len = 1];
+
+ // Page component IDs to associate with this report (optional).
+ repeated string page_component_ids = 6;
+
+ // Whether to notify subscribers about this status report (optional, defaults to false).
+ optional bool notify = 7;
+}
+
+message CreateStatusReportResponse {
+ // The created status report.
+ StatusReport status_report = 1;
+}
+
+// --- Get Status Report ---
+
+message GetStatusReportRequest {
+ // ID of the status report to retrieve (required).
+ string id = 1 [(buf.validate.field).string.min_len = 1];
+}
+
+message GetStatusReportResponse {
+ // The requested status report.
+ StatusReport status_report = 1;
+}
+
+// --- List Status Reports ---
+
+message ListStatusReportsRequest {
+ // Maximum number of reports to return (1-100, defaults to 50).
+ optional int32 limit = 1 [(buf.validate.field).int32 = {
+ gte: 1
+ lte: 100
+ }];
+
+ // Number of reports to skip for pagination (defaults to 0).
+ optional int32 offset = 2 [(buf.validate.field).int32.gte = 0];
+
+ // Filter by status (optional). If empty, returns all statuses.
+ repeated StatusReportStatus statuses = 3;
+}
+
+message ListStatusReportsResponse {
+ // List of status reports (metadata only, use GetStatusReport for full details).
+ repeated StatusReportSummary status_reports = 1;
+
+ // Total number of reports matching the filter.
+ int32 total_size = 2;
+}
+
+// --- Update Status Report ---
+
+message UpdateStatusReportRequest {
+ // ID of the status report to update (required).
+ string id = 1 [(buf.validate.field).string.min_len = 1];
+
+ // New title for the report (optional).
+ optional string title = 2;
+
+ // New list of page component IDs (optional, replaces existing list).
+ repeated string page_component_ids = 3;
+}
+
+message UpdateStatusReportResponse {
+ // The updated status report.
+ StatusReport status_report = 1;
+}
+
+// --- Delete Status Report ---
+
+message DeleteStatusReportRequest {
+ // ID of the status report to delete (required).
+ string id = 1 [(buf.validate.field).string.min_len = 1];
+}
+
+message DeleteStatusReportResponse {
+ // Whether the deletion was successful.
+ bool success = 1;
+}
+
+// --- Add Status Report Update ---
+
+message AddStatusReportUpdateRequest {
+ // ID of the status report to update (required).
+ string status_report_id = 1 [(buf.validate.field).string.min_len = 1];
+
+ // New status for the report (required).
+ StatusReportStatus status = 2 [(buf.validate.field).enum.defined_only = true];
+
+ // Message describing what changed (required).
+ string message = 3 [(buf.validate.field).string.min_len = 1];
+
+ // Optional date for the update (RFC 3339 format). Defaults to current time if not provided.
+ optional string date = 4 [(buf.validate.field).string.pattern = "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}"];
+
+ // Whether to notify subscribers about this update (optional, defaults to false).
+ optional bool notify = 5;
+}
+
+message AddStatusReportUpdateResponse {
+ // The updated status report with the new update included.
+ StatusReport status_report = 1;
+}
diff --git a/packages/proto/api/openstatus/status_report/v1/status_report.proto b/packages/proto/api/openstatus/status_report/v1/status_report.proto
new file mode 100644
index 000000000..cb232bd69
--- /dev/null
+++ b/packages/proto/api/openstatus/status_report/v1/status_report.proto
@@ -0,0 +1,77 @@
+syntax = "proto3";
+
+package openstatus.status_report.v1;
+
+option go_package = "github.com/openstatushq/openstatus/packages/proto/openstatus/status_report/v1;statusreportv1";
+
+// StatusReportStatus represents the current state of a status report.
+enum StatusReportStatus {
+ STATUS_REPORT_STATUS_UNSPECIFIED = 0;
+ STATUS_REPORT_STATUS_INVESTIGATING = 1;
+ STATUS_REPORT_STATUS_IDENTIFIED = 2;
+ STATUS_REPORT_STATUS_MONITORING = 3;
+ STATUS_REPORT_STATUS_RESOLVED = 4;
+}
+
+// StatusReportUpdate represents a single update entry in a status report timeline.
+message StatusReportUpdate {
+ // Unique identifier for the update.
+ string id = 1;
+
+ // Status at the time of this update.
+ StatusReportStatus status = 2;
+
+ // Timestamp when this update occurred (RFC 3339 format).
+ string date = 3;
+
+ // Message describing the update.
+ string message = 4;
+
+ // Timestamp when the update was created (RFC 3339 format).
+ string created_at = 5;
+}
+
+// StatusReportSummary represents metadata for a status report (used in list responses).
+message StatusReportSummary {
+ // Unique identifier for the status report.
+ string id = 1;
+
+ // Current status of the report.
+ StatusReportStatus status = 2;
+
+ // Title of the status report.
+ string title = 3;
+
+ // IDs of affected page components.
+ repeated string page_component_ids = 4;
+
+ // Timestamp when the report was created (RFC 3339 format).
+ string created_at = 5;
+
+ // Timestamp when the report was last updated (RFC 3339 format).
+ string updated_at = 6;
+}
+
+// StatusReport represents an incident or maintenance report with full details.
+message StatusReport {
+ // Unique identifier for the status report.
+ string id = 1;
+
+ // Current status of the report.
+ StatusReportStatus status = 2;
+
+ // Title of the status report.
+ string title = 3;
+
+ // IDs of affected page components.
+ repeated string page_component_ids = 4;
+
+ // Timeline of updates for this report (only included in GetStatusReport).
+ repeated StatusReportUpdate updates = 5;
+
+ // Timestamp when the report was created (RFC 3339 format).
+ string created_at = 6;
+
+ // Timestamp when the report was last updated (RFC 3339 format).
+ string updated_at = 7;
+}
diff --git a/packages/proto/gen/ts/index.ts b/packages/proto/gen/ts/index.ts
index f066e09aa..3906733eb 100644
--- a/packages/proto/gen/ts/index.ts
+++ b/packages/proto/gen/ts/index.ts
@@ -1,3 +1,4 @@
// @openstatus/proto main exports
export * from "./openstatus/monitor/v1/index.js";
export * from "./openstatus/health/v1/index.js";
+export * from "./openstatus/status_report/v1/index.js";
diff --git a/packages/proto/gen/ts/openstatus/status_report/v1/index.ts b/packages/proto/gen/ts/openstatus/status_report/v1/index.ts
new file mode 100644
index 000000000..5e96a884c
--- /dev/null
+++ b/packages/proto/gen/ts/openstatus/status_report/v1/index.ts
@@ -0,0 +1,3 @@
+// Status report service exports
+export * from "./status_report_pb.js";
+export * from "./service_pb.js";
diff --git a/packages/proto/gen/ts/openstatus/status_report/v1/service_pb.ts b/packages/proto/gen/ts/openstatus/status_report/v1/service_pb.ts
new file mode 100644
index 000000000..80367e464
--- /dev/null
+++ b/packages/proto/gen/ts/openstatus/status_report/v1/service_pb.ts
@@ -0,0 +1,419 @@
+// @generated by protoc-gen-es v2.10.2 with parameter "target=ts,import_extension=.ts"
+// @generated from file openstatus/status_report/v1/service.proto (package openstatus.status_report.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 { StatusReport, StatusReportStatus, StatusReportSummary } from "./status_report_pb.ts";
+import { file_openstatus_status_report_v1_status_report } from "./status_report_pb.ts";
+import type { Message } from "@bufbuild/protobuf";
+
+/**
+ * Describes the file openstatus/status_report/v1/service.proto.
+ */
+export const file_openstatus_status_report_v1_service: GenFile = /*@__PURE__*/
+ fileDesc("CilvcGVuc3RhdHVzL3N0YXR1c19yZXBvcnQvdjEvc2VydmljZS5wcm90bxIbb3BlbnN0YXR1cy5zdGF0dXNfcmVwb3J0LnYxIqkCChlDcmVhdGVTdGF0dXNSZXBvcnRSZXF1ZXN0EhYKBXRpdGxlGAEgASgJQge6SARyAhABEkkKBnN0YXR1cxgCIAEoDjIvLm9wZW5zdGF0dXMuc3RhdHVzX3JlcG9ydC52MS5TdGF0dXNSZXBvcnRTdGF0dXNCCLpIBYIBAhABEhgKB21lc3NhZ2UYAyABKAlCB7pIBHICEAESOQoEZGF0ZRgEIAEoCUIrukgociYyJF5cZHs0fS1cZHsyfS1cZHsyfVRcZHsyfTpcZHsyfTpcZHsyfRIYCgdwYWdlX2lkGAUgASgJQge6SARyAhABEhoKEnBhZ2VfY29tcG9uZW50X2lkcxgGIAMoCRITCgZub3RpZnkYByABKAhIAIgBAUIJCgdfbm90aWZ5Il4KGkNyZWF0ZVN0YXR1c1JlcG9ydFJlc3BvbnNlEkAKDXN0YXR1c19yZXBvcnQYASABKAsyKS5vcGVuc3RhdHVzLnN0YXR1c19yZXBvcnQudjEuU3RhdHVzUmVwb3J0Ii0KFkdldFN0YXR1c1JlcG9ydFJlcXVlc3QSEwoCaWQYASABKAlCB7pIBHICEAEiWwoXR2V0U3RhdHVzUmVwb3J0UmVzcG9uc2USQAoNc3RhdHVzX3JlcG9ydBgBIAEoCzIpLm9wZW5zdGF0dXMuc3RhdHVzX3JlcG9ydC52MS5TdGF0dXNSZXBvcnQirwEKGExpc3RTdGF0dXNSZXBvcnRzUmVxdWVzdBIdCgVsaW1pdBgBIAEoBUIJukgGGgQYZCgBSACIAQESHAoGb2Zmc2V0GAIgASgFQge6SAQaAigASAGIAQESQQoIc3RhdHVzZXMYAyADKA4yLy5vcGVuc3RhdHVzLnN0YXR1c19yZXBvcnQudjEuU3RhdHVzUmVwb3J0U3RhdHVzQggKBl9saW1pdEIJCgdfb2Zmc2V0InkKGUxpc3RTdGF0dXNSZXBvcnRzUmVzcG9uc2USSAoOc3RhdHVzX3JlcG9ydHMYASADKAsyMC5vcGVuc3RhdHVzLnN0YXR1c19yZXBvcnQudjEuU3RhdHVzUmVwb3J0U3VtbWFyeRISCgp0b3RhbF9zaXplGAIgASgFImoKGVVwZGF0ZVN0YXR1c1JlcG9ydFJlcXVlc3QSEwoCaWQYASABKAlCB7pIBHICEAESEgoFdGl0bGUYAiABKAlIAIgBARIaChJwYWdlX2NvbXBvbmVudF9pZHMYAyADKAlCCAoGX3RpdGxlIl4KGlVwZGF0ZVN0YXR1c1JlcG9ydFJlc3BvbnNlEkAKDXN0YXR1c19yZXBvcnQYASABKAsyKS5vcGVuc3RhdHVzLnN0YXR1c19yZXBvcnQudjEuU3RhdHVzUmVwb3J0IjAKGURlbGV0ZVN0YXR1c1JlcG9ydFJlcXVlc3QSEwoCaWQYASABKAlCB7pIBHICEAEiLQoaRGVsZXRlU3RhdHVzUmVwb3J0UmVzcG9uc2USDwoHc3VjY2VzcxgBIAEoCCKPAgocQWRkU3RhdHVzUmVwb3J0VXBkYXRlUmVxdWVzdBIhChBzdGF0dXNfcmVwb3J0X2lkGAEgASgJQge6SARyAhABEkkKBnN0YXR1cxgCIAEoDjIvLm9wZW5zdGF0dXMuc3RhdHVzX3JlcG9ydC52MS5TdGF0dXNSZXBvcnRTdGF0dXNCCLpIBYIBAhABEhgKB21lc3NhZ2UYAyABKAlCB7pIBHICEAESPgoEZGF0ZRgEIAEoCUIrukgociYyJF5cZHs0fS1cZHsyfS1cZHsyfVRcZHsyfTpcZHsyfTpcZHsyfUgAiAEBEhMKBm5vdGlmeRgFIAEoCEgBiAEBQgcKBV9kYXRlQgkKB19ub3RpZnkiYQodQWRkU3RhdHVzUmVwb3J0VXBkYXRlUmVzcG9uc2USQAoNc3RhdHVzX3JlcG9ydBgBIAEoCzIpLm9wZW5zdGF0dXMuc3RhdHVzX3JlcG9ydC52MS5TdGF0dXNSZXBvcnQywQYKE1N0YXR1c1JlcG9ydFNlcnZpY2UShQEKEkNyZWF0ZVN0YXR1c1JlcG9ydBI2Lm9wZW5zdGF0dXMuc3RhdHVzX3JlcG9ydC52MS5DcmVhdGVTdGF0dXNSZXBvcnRSZXF1ZXN0Gjcub3BlbnN0YXR1cy5zdGF0dXNfcmVwb3J0LnYxLkNyZWF0ZVN0YXR1c1JlcG9ydFJlc3BvbnNlEnwKD0dldFN0YXR1c1JlcG9ydBIzLm9wZW5zdGF0dXMuc3RhdHVzX3JlcG9ydC52MS5HZXRTdGF0dXNSZXBvcnRSZXF1ZXN0GjQub3BlbnN0YXR1cy5zdGF0dXNfcmVwb3J0LnYxLkdldFN0YXR1c1JlcG9ydFJlc3BvbnNlEoIBChFMaXN0U3RhdHVzUmVwb3J0cxI1Lm9wZW5zdGF0dXMuc3RhdHVzX3JlcG9ydC52MS5MaXN0U3RhdHVzUmVwb3J0c1JlcXVlc3QaNi5vcGVuc3RhdHVzLnN0YXR1c19yZXBvcnQudjEuTGlzdFN0YXR1c1JlcG9ydHNSZXNwb25zZRKFAQoSVXBkYXRlU3RhdHVzUmVwb3J0EjYub3BlbnN0YXR1cy5zdGF0dXNfcmVwb3J0LnYxLlVwZGF0ZVN0YXR1c1JlcG9ydFJlcXVlc3QaNy5vcGVuc3RhdHVzLnN0YXR1c19yZXBvcnQudjEuVXBkYXRlU3RhdHVzUmVwb3J0UmVzcG9uc2UShQEKEkRlbGV0ZVN0YXR1c1JlcG9ydBI2Lm9wZW5zdGF0dXMuc3RhdHVzX3JlcG9ydC52MS5EZWxldGVTdGF0dXNSZXBvcnRSZXF1ZXN0Gjcub3BlbnN0YXR1cy5zdGF0dXNfcmVwb3J0LnYxLkRlbGV0ZVN0YXR1c1JlcG9ydFJlc3BvbnNlEo4BChVBZGRTdGF0dXNSZXBvcnRVcGRhdGUSOS5vcGVuc3RhdHVzLnN0YXR1c19yZXBvcnQudjEuQWRkU3RhdHVzUmVwb3J0VXBkYXRlUmVxdWVzdBo6Lm9wZW5zdGF0dXMuc3RhdHVzX3JlcG9ydC52MS5BZGRTdGF0dXNSZXBvcnRVcGRhdGVSZXNwb25zZUJeWlxnaXRodWIuY29tL29wZW5zdGF0dXNocS9vcGVuc3RhdHVzL3BhY2thZ2VzL3Byb3RvL29wZW5zdGF0dXMvc3RhdHVzX3JlcG9ydC92MTtzdGF0dXNyZXBvcnR2MWIGcHJvdG8z", [file_buf_validate_validate, file_openstatus_status_report_v1_status_report]);
+
+/**
+ * @generated from message openstatus.status_report.v1.CreateStatusReportRequest
+ */
+export type CreateStatusReportRequest = Message<"openstatus.status_report.v1.CreateStatusReportRequest"> & {
+ /**
+ * Title of the status report (required).
+ *
+ * @generated from field: string title = 1;
+ */
+ title: string;
+
+ /**
+ * Initial status (required).
+ *
+ * @generated from field: openstatus.status_report.v1.StatusReportStatus status = 2;
+ */
+ status: StatusReportStatus;
+
+ /**
+ * Initial message describing the incident (required).
+ *
+ * @generated from field: string message = 3;
+ */
+ message: string;
+
+ /**
+ * Date when the event occurred (RFC 3339 format, required).
+ *
+ * @generated from field: string date = 4;
+ */
+ date: string;
+
+ /**
+ * Page ID to associate with this report (required).
+ *
+ * @generated from field: string page_id = 5;
+ */
+ pageId: string;
+
+ /**
+ * Page component IDs to associate with this report (optional).
+ *
+ * @generated from field: repeated string page_component_ids = 6;
+ */
+ pageComponentIds: string[];
+
+ /**
+ * Whether to notify subscribers about this status report (optional, defaults to false).
+ *
+ * @generated from field: optional bool notify = 7;
+ */
+ notify?: boolean;
+};
+
+/**
+ * Describes the message openstatus.status_report.v1.CreateStatusReportRequest.
+ * Use `create(CreateStatusReportRequestSchema)` to create a new message.
+ */
+export const CreateStatusReportRequestSchema: GenMessage<CreateStatusReportRequest> = /*@__PURE__*/
+ messageDesc(file_openstatus_status_report_v1_service, 0);
+
+/**
+ * @generated from message openstatus.status_report.v1.CreateStatusReportResponse
+ */
+export type CreateStatusReportResponse = Message<"openstatus.status_report.v1.CreateStatusReportResponse"> & {
+ /**
+ * The created status report.
+ *
+ * @generated from field: openstatus.status_report.v1.StatusReport status_report = 1;
+ */
+ statusReport?: StatusReport;
+};
+
+/**
+ * Describes the message openstatus.status_report.v1.CreateStatusReportResponse.
+ * Use `create(CreateStatusReportResponseSchema)` to create a new message.
+ */
+export const CreateStatusReportResponseSchema: GenMessage<CreateStatusReportResponse> = /*@__PURE__*/
+ messageDesc(file_openstatus_status_report_v1_service, 1);
+
+/**
+ * @generated from message openstatus.status_report.v1.GetStatusReportRequest
+ */
+export type GetStatusReportRequest = Message<"openstatus.status_report.v1.GetStatusReportRequest"> & {
+ /**
+ * ID of the status report to retrieve (required).
+ *
+ * @generated from field: string id = 1;
+ */
+ id: string;
+};
+
+/**
+ * Describes the message openstatus.status_report.v1.GetStatusReportRequest.
+ * Use `create(GetStatusReportRequestSchema)` to create a new message.
+ */
+export const GetStatusReportRequestSchema: GenMessage<GetStatusReportRequest> = /*@__PURE__*/
+ messageDesc(file_openstatus_status_report_v1_service, 2);
+
+/**
+ * @generated from message openstatus.status_report.v1.GetStatusReportResponse
+ */
+export type GetStatusReportResponse = Message<"openstatus.status_report.v1.GetStatusReportResponse"> & {
+ /**
+ * The requested status report.
+ *
+ * @generated from field: openstatus.status_report.v1.StatusReport status_report = 1;
+ */
+ statusReport?: StatusReport;
+};
+
+/**
+ * Describes the message openstatus.status_report.v1.GetStatusReportResponse.
+ * Use `create(GetStatusReportResponseSchema)` to create a new message.
+ */
+export const GetStatusReportResponseSchema: GenMessage<GetStatusReportResponse> = /*@__PURE__*/
+ messageDesc(file_openstatus_status_report_v1_service, 3);
+
+/**
+ * @generated from message openstatus.status_report.v1.ListStatusReportsRequest
+ */
+export type ListStatusReportsRequest = Message<"openstatus.status_report.v1.ListStatusReportsRequest"> & {
+ /**
+ * Maximum number of reports to return (1-100, defaults to 50).
+ *
+ * @generated from field: optional int32 limit = 1;
+ */
+ limit?: number;
+
+ /**
+ * Number of reports to skip for pagination (defaults to 0).
+ *
+ * @generated from field: optional int32 offset = 2;
+ */
+ offset?: number;
+
+ /**
+ * Filter by status (optional). If empty, returns all statuses.
+ *
+ * @generated from field: repeated openstatus.status_report.v1.StatusReportStatus statuses = 3;
+ */
+ statuses: StatusReportStatus[];
+};
+
+/**
+ * Describes the message openstatus.status_report.v1.ListStatusReportsRequest.
+ * Use `create(ListStatusReportsRequestSchema)` to create a new message.
+ */
+export const ListStatusReportsRequestSchema: GenMessage<ListStatusReportsRequest> = /*@__PURE__*/
+ messageDesc(file_openstatus_status_report_v1_service, 4);
+
+/**
+ * @generated from message openstatus.status_report.v1.ListStatusReportsResponse
+ */
+export type ListStatusReportsResponse = Message<"openstatus.status_report.v1.ListStatusReportsResponse"> & {
+ /**
+ * List of status reports (metadata only, use GetStatusReport for full details).
+ *
+ * @generated from field: repeated openstatus.status_report.v1.StatusReportSummary status_reports = 1;
+ */
+ statusReports: StatusReportSummary[];
+
+ /**
+ * Total number of reports matching the filter.
+ *
+ * @generated from field: int32 total_size = 2;
+ */
+ totalSize: number;
+};
+
+/**
+ * Describes the message openstatus.status_report.v1.ListStatusReportsResponse.
+ * Use `create(ListStatusReportsResponseSchema)` to create a new message.
+ */
+export const ListStatusReportsResponseSchema: GenMessage<ListStatusReportsResponse> = /*@__PURE__*/
+ messageDesc(file_openstatus_status_report_v1_service, 5);
+
+/**
+ * @generated from message openstatus.status_report.v1.UpdateStatusReportRequest
+ */
+export type UpdateStatusReportRequest = Message<"openstatus.status_report.v1.UpdateStatusReportRequest"> & {
+ /**
+ * ID of the status report to update (required).
+ *
+ * @generated from field: string id = 1;
+ */
+ id: string;
+
+ /**
+ * New title for the report (optional).
+ *
+ * @generated from field: optional string title = 2;
+ */
+ title?: string;
+
+ /**
+ * New list of page component IDs (optional, replaces existing list).
+ *
+ * @generated from field: repeated string page_component_ids = 3;
+ */
+ pageComponentIds: string[];
+};
+
+/**
+ * Describes the message openstatus.status_report.v1.UpdateStatusReportRequest.
+ * Use `create(UpdateStatusReportRequestSchema)` to create a new message.
+ */
+export const UpdateStatusReportRequestSchema: GenMessage<UpdateStatusReportRequest> = /*@__PURE__*/
+ messageDesc(file_openstatus_status_report_v1_service, 6);
+
+/**
+ * @generated from message openstatus.status_report.v1.UpdateStatusReportResponse
+ */
+export type UpdateStatusReportResponse = Message<"openstatus.status_report.v1.UpdateStatusReportResponse"> & {
+ /**
+ * The updated status report.
+ *
+ * @generated from field: openstatus.status_report.v1.StatusReport status_report = 1;
+ */
+ statusReport?: StatusReport;
+};
+
+/**
+ * Describes the message openstatus.status_report.v1.UpdateStatusReportResponse.
+ * Use `create(UpdateStatusReportResponseSchema)` to create a new message.
+ */
+export const UpdateStatusReportResponseSchema: GenMessage<UpdateStatusReportResponse> = /*@__PURE__*/
+ messageDesc(file_openstatus_status_report_v1_service, 7);
+
+/**
+ * @generated from message openstatus.status_report.v1.DeleteStatusReportRequest
+ */
+export type DeleteStatusReportRequest = Message<"openstatus.status_report.v1.DeleteStatusReportRequest"> & {
+ /**
+ * ID of the status report to delete (required).
+ *
+ * @generated from field: string id = 1;
+ */
+ id: string;
+};
+
+/**
+ * Describes the message openstatus.status_report.v1.DeleteStatusReportRequest.
+ * Use `create(DeleteStatusReportRequestSchema)` to create a new message.
+ */
+export const DeleteStatusReportRequestSchema: GenMessage<DeleteStatusReportRequest> = /*@__PURE__*/
+ messageDesc(file_openstatus_status_report_v1_service, 8);
+
+/**
+ * @generated from message openstatus.status_report.v1.DeleteStatusReportResponse
+ */
+export type DeleteStatusReportResponse = Message<"openstatus.status_report.v1.DeleteStatusReportResponse"> & {
+ /**
+ * Whether the deletion was successful.
+ *
+ * @generated from field: bool success = 1;
+ */
+ success: boolean;
+};
+
+/**
+ * Describes the message openstatus.status_report.v1.DeleteStatusReportResponse.
+ * Use `create(DeleteStatusReportResponseSchema)` to create a new message.
+ */
+export const DeleteStatusReportResponseSchema: GenMessage<DeleteStatusReportResponse> = /*@__PURE__*/
+ messageDesc(file_openstatus_status_report_v1_service, 9);
+
+/**
+ * @generated from message openstatus.status_report.v1.AddStatusReportUpdateRequest
+ */
+export type AddStatusReportUpdateRequest = Message<"openstatus.status_report.v1.AddStatusReportUpdateRequest"> & {
+ /**
+ * ID of the status report to update (required).
+ *
+ * @generated from field: string status_report_id = 1;
+ */
+ statusReportId: string;
+
+ /**
+ * New status for the report (required).
+ *
+ * @generated from field: openstatus.status_report.v1.StatusReportStatus status = 2;
+ */
+ status: StatusReportStatus;
+
+ /**
+ * Message describing what changed (required).
+ *
+ * @generated from field: string message = 3;
+ */
+ message: string;
+
+ /**
+ * Optional date for the update (RFC 3339 format). Defaults to current time if not provided.
+ *
+ * @generated from field: optional string date = 4;
+ */
+ date?: string;
+
+ /**
+ * Whether to notify subscribers about this update (optional, defaults to false).
+ *
+ * @generated from field: optional bool notify = 5;
+ */
+ notify?: boolean;
+};
+
+/**
+ * Describes the message openstatus.status_report.v1.AddStatusReportUpdateRequest.
+ * Use `create(AddStatusReportUpdateRequestSchema)` to create a new message.
+ */
+export const AddStatusReportUpdateRequestSchema: GenMessage<AddStatusReportUpdateRequest> = /*@__PURE__*/
+ messageDesc(file_openstatus_status_report_v1_service, 10);
+
+/**
+ * @generated from message openstatus.status_report.v1.AddStatusReportUpdateResponse
+ */
+export type AddStatusReportUpdateResponse = Message<"openstatus.status_report.v1.AddStatusReportUpdateResponse"> & {
+ /**
+ * The updated status report with the new update included.
+ *
+ * @generated from field: openstatus.status_report.v1.StatusReport status_report = 1;
+ */
+ statusReport?: StatusReport;
+};
+
+/**
+ * Describes the message openstatus.status_report.v1.AddStatusReportUpdateResponse.
+ * Use `create(AddStatusReportUpdateResponseSchema)` to create a new message.
+ */
+export const AddStatusReportUpdateResponseSchema: GenMessage<AddStatusReportUpdateResponse> = /*@__PURE__*/
+ messageDesc(file_openstatus_status_report_v1_service, 11);
+
+/**
+ * StatusReportService provides CRUD operations for status reports.
+ *
+ * @generated from service openstatus.status_report.v1.StatusReportService
+ */
+export const StatusReportService: GenService<{
+ /**
+ * CreateStatusReport creates a new status report.
+ *
+ * @generated from rpc openstatus.status_report.v1.StatusReportService.CreateStatusReport
+ */
+ createStatusReport: {
+ methodKind: "unary";
+ input: typeof CreateStatusReportRequestSchema;
+ output: typeof CreateStatusReportResponseSchema;
+ },
+ /**
+ * GetStatusReport retrieves a specific status report by ID (includes full update timeline).
+ *
+ * @generated from rpc openstatus.status_report.v1.StatusReportService.GetStatusReport
+ */
+ getStatusReport: {
+ methodKind: "unary";
+ input: typeof GetStatusReportRequestSchema;
+ output: typeof GetStatusReportResponseSchema;
+ },
+ /**
+ * ListStatusReports returns all status reports for the workspace (metadata only).
+ *
+ * @generated from rpc openstatus.status_report.v1.StatusReportService.ListStatusReports
+ */
+ listStatusReports: {
+ methodKind: "unary";
+ input: typeof ListStatusReportsRequestSchema;
+ output: typeof ListStatusReportsResponseSchema;
+ },
+ /**
+ * UpdateStatusReport updates the metadata of a status report (title, page components).
+ *
+ * @generated from rpc openstatus.status_report.v1.StatusReportService.UpdateStatusReport
+ */
+ updateStatusReport: {
+ methodKind: "unary";
+ input: typeof UpdateStatusReportRequestSchema;
+ output: typeof UpdateStatusReportResponseSchema;
+ },
+ /**
+ * DeleteStatusReport removes a status report and all its updates.
+ *
+ * @generated from rpc openstatus.status_report.v1.StatusReportService.DeleteStatusReport
+ */
+ deleteStatusReport: {
+ methodKind: "unary";
+ input: typeof DeleteStatusReportRequestSchema;
+ output: typeof DeleteStatusReportResponseSchema;
+ },
+ /**
+ * AddStatusReportUpdate adds a new update to an existing status report timeline.
+ *
+ * @generated from rpc openstatus.status_report.v1.StatusReportService.AddStatusReportUpdate
+ */
+ addStatusReportUpdate: {
+ methodKind: "unary";
+ input: typeof AddStatusReportUpdateRequestSchema;
+ output: typeof AddStatusReportUpdateResponseSchema;
+ },
+}> = /*@__PURE__*/
+ serviceDesc(file_openstatus_status_report_v1_service, 0);
+
diff --git a/packages/proto/gen/ts/openstatus/status_report/v1/status_report_pb.ts b/packages/proto/gen/ts/openstatus/status_report/v1/status_report_pb.ts
new file mode 100644
index 000000000..150983bf3
--- /dev/null
+++ b/packages/proto/gen/ts/openstatus/status_report/v1/status_report_pb.ts
@@ -0,0 +1,220 @@
+// @generated by protoc-gen-es v2.10.2 with parameter "target=ts,import_extension=.ts"
+// @generated from file openstatus/status_report/v1/status_report.proto (package openstatus.status_report.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_report/v1/status_report.proto.
+ */
+export const file_openstatus_status_report_v1_status_report: GenFile = /*@__PURE__*/
+ fileDesc("Ci9vcGVuc3RhdHVzL3N0YXR1c19yZXBvcnQvdjEvc3RhdHVzX3JlcG9ydC5wcm90bxIbb3BlbnN0YXR1cy5zdGF0dXNfcmVwb3J0LnYxIpQBChJTdGF0dXNSZXBvcnRVcGRhdGUSCgoCaWQYASABKAkSPwoGc3RhdHVzGAIgASgOMi8ub3BlbnN0YXR1cy5zdGF0dXNfcmVwb3J0LnYxLlN0YXR1c1JlcG9ydFN0YXR1cxIMCgRkYXRlGAMgASgJEg8KB21lc3NhZ2UYBCABKAkSEgoKY3JlYXRlZF9hdBgFIAEoCSK1AQoTU3RhdHVzUmVwb3J0U3VtbWFyeRIKCgJpZBgBIAEoCRI/CgZzdGF0dXMYAiABKA4yLy5vcGVuc3RhdHVzLnN0YXR1c19yZXBvcnQudjEuU3RhdHVzUmVwb3J0U3RhdHVzEg0KBXRpdGxlGAMgASgJEhoKEnBhZ2VfY29tcG9uZW50X2lkcxgEIAMoCRISCgpjcmVhdGVkX2F0GAUgASgJEhIKCnVwZGF0ZWRfYXQYBiABKAki8AEKDFN0YXR1c1JlcG9ydBIKCgJpZBgBIAEoCRI/CgZzdGF0dXMYAiABKA4yLy5vcGVuc3RhdHVzLnN0YXR1c19yZXBvcnQudjEuU3RhdHVzUmVwb3J0U3RhdHVzEg0KBXRpdGxlGAMgASgJEhoKEnBhZ2VfY29tcG9uZW50X2lkcxgEIAMoCRJACgd1cGRhdGVzGAUgAygLMi8ub3BlbnN0YXR1cy5zdGF0dXNfcmVwb3J0LnYxLlN0YXR1c1JlcG9ydFVwZGF0ZRISCgpjcmVhdGVkX2F0GAYgASgJEhIKCnVwZGF0ZWRfYXQYByABKAkqzwEKElN0YXR1c1JlcG9ydFN0YXR1cxIkCiBTVEFUVVNfUkVQT1JUX1NUQVRVU19VTlNQRUNJRklFRBAAEiYKIlNUQVRVU19SRVBPUlRfU1RBVFVTX0lOVkVTVElHQVRJTkcQARIjCh9TVEFUVVNfUkVQT1JUX1NUQVRVU19JREVOVElGSUVEEAISIwofU1RBVFVTX1JFUE9SVF9TVEFUVVNfTU9OSVRPUklORxADEiEKHVNUQVRVU19SRVBPUlRfU1RBVFVTX1JFU09MVkVEEARCXlpcZ2l0aHViLmNvbS9vcGVuc3RhdHVzaHEvb3BlbnN0YXR1cy9wYWNrYWdlcy9wcm90by9vcGVuc3RhdHVzL3N0YXR1c19yZXBvcnQvdjE7c3RhdHVzcmVwb3J0djFiBnByb3RvMw");
+
+/**
+ * StatusReportUpdate represents a single update entry in a status report timeline.
+ *
+ * @generated from message openstatus.status_report.v1.StatusReportUpdate
+ */
+export type StatusReportUpdate = Message<"openstatus.status_report.v1.StatusReportUpdate"> & {
+ /**
+ * Unique identifier for the update.
+ *
+ * @generated from field: string id = 1;
+ */
+ id: string;
+
+ /**
+ * Status at the time of this update.
+ *
+ * @generated from field: openstatus.status_report.v1.StatusReportStatus status = 2;
+ */
+ status: StatusReportStatus;
+
+ /**
+ * Timestamp when this update occurred (RFC 3339 format).
+ *
+ * @generated from field: string date = 3;
+ */
+ date: string;
+
+ /**
+ * Message describing the update.
+ *
+ * @generated from field: string message = 4;
+ */
+ message: string;
+
+ /**
+ * Timestamp when the update was created (RFC 3339 format).
+ *
+ * @generated from field: string created_at = 5;
+ */
+ createdAt: string;
+};
+
+/**
+ * Describes the message openstatus.status_report.v1.StatusReportUpdate.
+ * Use `create(StatusReportUpdateSchema)` to create a new message.
+ */
+export const StatusReportUpdateSchema: GenMessage<StatusReportUpdate> = /*@__PURE__*/
+ messageDesc(file_openstatus_status_report_v1_status_report, 0);
+
+/**
+ * StatusReportSummary represents metadata for a status report (used in list responses).
+ *
+ * @generated from message openstatus.status_report.v1.StatusReportSummary
+ */
+export type StatusReportSummary = Message<"openstatus.status_report.v1.StatusReportSummary"> & {
+ /**
+ * Unique identifier for the status report.
+ *
+ * @generated from field: string id = 1;
+ */
+ id: string;
+
+ /**
+ * Current status of the report.
+ *
+ * @generated from field: openstatus.status_report.v1.StatusReportStatus status = 2;
+ */
+ status: StatusReportStatus;
+
+ /**
+ * Title of the status report.
+ *
+ * @generated from field: string title = 3;
+ */
+ title: string;
+
+ /**
+ * IDs of affected page components.
+ *
+ * @generated from field: repeated string page_component_ids = 4;
+ */
+ pageComponentIds: string[];
+
+ /**
+ * Timestamp when the report was created (RFC 3339 format).
+ *
+ * @generated from field: string created_at = 5;
+ */
+ createdAt: string;
+
+ /**
+ * Timestamp when the report was last updated (RFC 3339 format).
+ *
+ * @generated from field: string updated_at = 6;
+ */
+ updatedAt: string;
+};
+
+/**
+ * Describes the message openstatus.status_report.v1.StatusReportSummary.
+ * Use `create(StatusReportSummarySchema)` to create a new message.
+ */
+export const StatusReportSummarySchema: GenMessage<StatusReportSummary> = /*@__PURE__*/
+ messageDesc(file_openstatus_status_report_v1_status_report, 1);
+
+/**
+ * StatusReport represents an incident or maintenance report with full details.
+ *
+ * @generated from message openstatus.status_report.v1.StatusReport
+ */
+export type StatusReport = Message<"openstatus.status_report.v1.StatusReport"> & {
+ /**
+ * Unique identifier for the status report.
+ *
+ * @generated from field: string id = 1;
+ */
+ id: string;
+
+ /**
+ * Current status of the report.
+ *
+ * @generated from field: openstatus.status_report.v1.StatusReportStatus status = 2;
+ */
+ status: StatusReportStatus;
+
+ /**
+ * Title of the status report.
+ *
+ * @generated from field: string title = 3;
+ */
+ title: string;
+
+ /**
+ * IDs of affected page components.
+ *
+ * @generated from field: repeated string page_component_ids = 4;
+ */
+ pageComponentIds: string[];
+
+ /**
+ * Timeline of updates for this report (only included in GetStatusReport).
+ *
+ * @generated from field: repeated openstatus.status_report.v1.StatusReportUpdate updates = 5;
+ */
+ updates: StatusReportUpdate[];
+
+ /**
+ * Timestamp when the report was created (RFC 3339 format).
+ *
+ * @generated from field: string created_at = 6;
+ */
+ createdAt: string;
+
+ /**
+ * Timestamp when the report was last updated (RFC 3339 format).
+ *
+ * @generated from field: string updated_at = 7;
+ */
+ updatedAt: string;
+};
+
+/**
+ * Describes the message openstatus.status_report.v1.StatusReport.
+ * Use `create(StatusReportSchema)` to create a new message.
+ */
+export const StatusReportSchema: GenMessage<StatusReport> = /*@__PURE__*/
+ messageDesc(file_openstatus_status_report_v1_status_report, 2);
+
+/**
+ * StatusReportStatus represents the current state of a status report.
+ *
+ * @generated from enum openstatus.status_report.v1.StatusReportStatus
+ */
+export enum StatusReportStatus {
+ /**
+ * @generated from enum value: STATUS_REPORT_STATUS_UNSPECIFIED = 0;
+ */
+ UNSPECIFIED = 0,
+
+ /**
+ * @generated from enum value: STATUS_REPORT_STATUS_INVESTIGATING = 1;
+ */
+ INVESTIGATING = 1,
+
+ /**
+ * @generated from enum value: STATUS_REPORT_STATUS_IDENTIFIED = 2;
+ */
+ IDENTIFIED = 2,
+
+ /**
+ * @generated from enum value: STATUS_REPORT_STATUS_MONITORING = 3;
+ */
+ MONITORING = 3,
+
+ /**
+ * @generated from enum value: STATUS_REPORT_STATUS_RESOLVED = 4;
+ */
+ RESOLVED = 4,
+}
+
+/**
+ * Describes the enum openstatus.status_report.v1.StatusReportStatus.
+ */
+export const StatusReportStatusSchema: GenEnum<StatusReportStatus> = /*@__PURE__*/
+ enumDesc(file_openstatus_status_report_v1_status_report, 0);
+
diff --git a/packages/proto/package.json b/packages/proto/package.json
index 1e0173765..c918ff31d 100644
--- a/packages/proto/package.json
+++ b/packages/proto/package.json
@@ -16,6 +16,10 @@
"./health/v1": {
"import": "./gen/ts/openstatus/health/v1/index.ts",
"types": "./gen/ts/openstatus/health/v1/index.ts"
+ },
+ "./status_report/v1": {
+ "import": "./gen/ts/openstatus/status_report/v1/index.ts",
+ "types": "./gen/ts/openstatus/status_report/v1/index.ts"
}
},
"scripts": {