Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .changeset/notification-outcome-grouping.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
'@thatopen/services': patch
---

Add `outcome`, `groupKey` and `groupLabel` to `NotificationDto`, matching what
the API already returns.

Read `outcome` to tell how an automation run ended rather than matching on the
copy: `title` is built from the user's own automation name, so an automation
called "Failover sync" makes every successful run look failed to anything
parsing the text. `groupKey` and `groupLabel` are what a client needs to
collapse a busy automation's runs into one row.
23 changes: 23 additions & 0 deletions src/types/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,29 @@ export interface NotificationDto {
muted: boolean;
readAt: string | null;
createdAt: string;
/**
* What to group consecutive notifications by — the automation id for a run,
* absent for anything that should stand alone.
*
* Derived rather than the raw producer payload, so fifty runs of one
* automation can collapse into a single row without the whole payload being
* on the wire for every notification type, forever.
*/
groupKey?: string;
/**
* How an automation run ended, straight from the producer's result.
*
* Use this rather than reading the copy. `title` is built from the user's own
* automation name, so an automation called "Failover sync" makes every
* successful run look failed to anything matching on the text.
*/
outcome?: 'success' | 'error' | 'warning';
/**
* The automation's name, for a grouped row's heading. Here for the same
* reason as `outcome`: recovering it by stripping words off the title breaks
* on any name that contains them.
*/
groupLabel?: string;
}

/** `nextCursor` is opaque — pass it back verbatim. Null means the last page. */
Expand Down
Loading