feat: component subscriptions - #1901
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR introduces a new subscriptions module with component-scoped subscriptions, updates the DB schema to support per-component subscriber associations and multi-channel delivery, and wires the new subscription/dispatch logic into the API, server routes, and status-page UI.
Changes:
- Add
@openstatus/subscriptionspackage (service layer, dispatchers, email/webhook channels) with Bun test setup and coverage. - Extend DB schema for
page_subscriberto supportchannelType+ webhook fields and addpage_subscriber_to_page_componentjoin table + migration. - Update API/server routes and status-page UI to create, verify, manage, and dispatch component-scoped notifications.
Reviewed changes
Copilot reviewed 51 out of 55 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Adds workspace package + deps |
| packages/ui/src/components/ui/button.tsx | Update cn import path |
| packages/subscriptions/package.json | New subscriptions package manifest |
| packages/subscriptions/tsconfig.json | TS config for new package |
| packages/subscriptions/bunfig.toml | Bun test preload config |
| packages/subscriptions/src/index.ts | Public exports for package |
| packages/subscriptions/src/types.ts | Core subscription/channel types |
| packages/subscriptions/src/test-preload.ts | Sets test env vars |
| packages/subscriptions/src/service.ts | Subscription CRUD/service logic |
| packages/subscriptions/src/service.test.ts | Service layer tests |
| packages/subscriptions/src/dispatcher.ts | Dispatch logic + component filtering |
| packages/subscriptions/src/dispatcher.test.ts | Dispatcher filtering/edge tests |
| packages/subscriptions/src/channels/index.ts | Channel registry (getChannel) |
| packages/subscriptions/src/channels/index.test.ts | Channel registry tests |
| packages/subscriptions/src/channels/email.ts | Email channel implementation |
| packages/subscriptions/src/channels/email.test.ts | Email channel tests |
| packages/subscriptions/src/channels/webhook.ts | Webhook channel implementation |
| packages/subscriptions/src/channels/webhook.test.ts | Webhook channel tests |
| packages/db/src/schema/page_subscribers/page_subscribers.ts | Add channel fields + indexes + CHECK |
| packages/db/src/schema/page_subscribers/page_subscriber_to_page_component.ts | New join table schema |
| packages/db/src/schema/page_subscribers/index.ts | Export new join table |
| packages/db/src/schema/page_subscribers/validation.ts | Add zod schemas/types for channels |
| packages/db/drizzle/meta/_journal.json | Register new migration |
| packages/db/drizzle/0056_violet_shotgun.sql | Migration for schema + join table |
| packages/api/package.json | Add subscriptions dependency |
| packages/api/src/router/statusPage.ts | Subscribe/verify/manage via subscriptions svc |
| packages/api/src/router/pageSubscriber.ts | Add public subscription endpoints + list mapping |
| packages/api/src/router/email/index.ts | Route dispatching + new verification sender |
| apps/status-page/src/components/status-page/status-updates.tsx | Subscribe UI passes component fields |
| apps/status-page/src/components/nav/header.tsx | Pass new subscribe payload shape |
| apps/status-page/src/components/forms/form-subscribe-email.tsx | Add component subscription fields (hidden) |
| apps/status-page/src/components/forms/form-manage-subscription.tsx | New manage subscription form |
| apps/status-page/src/components/forms/form-card.tsx | New form card UI components |
| apps/status-page/src/app/(status-page)/[domain]/(public)/manage/layout.tsx | Manage layout (client) |
| apps/status-page/src/app/(status-page)/[domain]/(public)/manage/[token]/layout.tsx | Prefetch subscription query |
| apps/status-page/src/app/(status-page)/[domain]/(public)/manage/[token]/page.tsx | Subscription management page |
| apps/status-page/next-env.d.ts | Next route types import path |
| apps/server/package.json | Add subscriptions dependency |
| apps/server/dofigen.yml | Include subscriptions package in build |
| apps/server/dofigen.lock | Generated lock updates for build |
| apps/server/Dockerfile | Generated Dockerfile updates |
| apps/server/.dockerignore | Generated ignore updates |
| apps/server/src/routes/v1/statusReports/post.ts | Use dispatcher for notifications |
| apps/server/src/routes/v1/statusReports/post.test.ts | Assert dispatcher called |
| apps/server/src/routes/v1/statusReportUpdates/post.ts | Use dispatcher for notifications |
| apps/server/src/routes/v1/statusReportUpdates/post.test.ts | Assert dispatcher called |
| apps/server/src/routes/v1/maintenances/post.ts | Use dispatcher for notifications |
| apps/server/src/routes/v1/maintenances/post.test.ts | Assert dispatcher called |
| apps/server/src/routes/rpc/services/status-report/index.ts | Replace email sending with dispatcher |
| apps/server/src/routes/rpc/services/status-report/tests/status-report.test.ts | Assert dispatcher called |
| apps/server/src/routes/rpc/services/maintenance/index.ts | Replace email sending with dispatcher |
| apps/server/src/routes/rpc/services/maintenance/tests/maintenance.test.ts | Assert dispatcher called |
| apps/server/src/libs/test/preload.ts | Mock subscriptions dispatchers in tests |
| apps/dashboard/src/app/(dashboard)/status-pages/[id]/subscribers/page.tsx | Update subscriber list example typing |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 56 out of 60 changed files in this pull request and generated 5 comments.
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.