From 4f84c13cb7bed3387c50f72367c4daf57f66bcfd Mon Sep 17 00:00:00 2001 From: abujalance Date: Mon, 17 Aug 2026 19:10:16 +0200 Subject: [PATCH] feat(types): carry the notification grouping and outcome fields MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The API returns `outcome`, `groupKey` and `groupLabel` on every automation notification and this mirror does not have them, so an app building against the published package is told they do not exist. `outcome` is the one that matters. Without it the only way to know whether a run failed is to match on `title`, and `title` is built from the user's own automation name — an automation called "Failover sync" reports every successful run as a failure to anything reading the copy. That is not hypothetical; it shipped in our own client and had to be fixed there. --- .changeset/notification-outcome-grouping.md | 12 +++++++++++ src/types/notifications.ts | 23 +++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 .changeset/notification-outcome-grouping.md diff --git a/.changeset/notification-outcome-grouping.md b/.changeset/notification-outcome-grouping.md new file mode 100644 index 0000000..d1c22d9 --- /dev/null +++ b/.changeset/notification-outcome-grouping.md @@ -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. diff --git a/src/types/notifications.ts b/src/types/notifications.ts index 8fd2106..523e21d 100644 --- a/src/types/notifications.ts +++ b/src/types/notifications.ts @@ -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. */