notifications
Device and browser subscriptions, per-category preferences, and a fan-out other modules call.
What it is
notifications.
A subscription is a device or browser endpoint; a preference is per account and per category. Other modules do not talk to a push vendor: they call this module's fan-out and it delivers through the Push port, so APNs, FCM and Web Push are adapters rather than a dependency of whoever wanted to send something. Delivery is drained rather than attempted inline, so a slow vendor does not become a slow request.
Ports
Database · Push · Clock · IdGen
Routes
/v1/notifications
- GET
/v1/notifications/ - GET
/v1/notifications/unread-count - POST
/v1/notifications/read-all - GETPUT
/v1/notifications/preferences - POST
/v1/notifications/subscriptions - DELETE
/v1/notifications/subscriptions/ {id} - POST
/v1/notifications/email/ webhook
Before you compose it
Published and composable by hand today, but fz build cannot yet select it: the manifest's built-in catalogue lags the curated list (harness #451). Compose it directly in your venture until that lands.
History
Changelog.
From the crate’s CHANGELOG.md in the harness, as of 0c5560b. 5 versions recorded, newest first. Every published version is on crates.io.
Other
- updated the following local packages: cratefield-core, cratefield-mail-templates, cratefield-auth-client
Other
Added
- a
Channeltrait for extra delivery channels a venture registers with.channel(..), such as Telegram: one outbox row per registered channel on thenotifications.channeltopic, with the push adapters' error shapes (#764)
- a
3 earlier versions 0.2.1 to 0.3.1
Fixed
- close five input-validation gaps — an unescaped HTML sink, a javascript: URL, an unvalidated slug, an OAuth token sent to any host, and an unclamped page size (#826)
GET /v1/notifications?limit=0no longer returns an empty inbox. The page size is clamped to1..=INBOX_PAGE_MAX(the idiommodule-orgsandmodule-crmalready use) instead of only capped from above, so a zero limit is the default page rather than a page that looks full and hands back a next cursor for a page that cannot exist. A limit above the ceiling still clamps toINBOX_PAGE_MAX.
Added
Changed
- Breaking: requires
cratefield-core0.8 (was 0.7), and so a minor rather than a patch bump: a venture still on core 0.7 does not pick this release up through a caret requirement and end up with two copies of core (#712). - The notification email renders through the template registry as
notifications/email, in the venture's theme viacratefield-mail-templates, so a venture can restyle or reword it.default_templates()andthemed_templates(&theme)are new; subject selection,lang/dir,Content-Languageand the one-click unsubscribe headers are unchanged (#715).
- Breaking: requires
Other
- updated the following local packages: cratefield-core
One fan-out, three push vendors behind a port.