@checkstack/incident-common 0.5.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +131 -0
- package/package.json +5 -3
- package/src/index.ts +1 -0
- package/src/notifications.ts +36 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,136 @@
|
|
|
1
1
|
# @checkstack/incident-common
|
|
2
2
|
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 32d52c6: feat: notification target pattern + per-spec subscriptions
|
|
8
|
+
|
|
9
|
+
Replaces the all-or-nothing catalog system/group notification model with a
|
|
10
|
+
platform-level target pattern. Each notification-emitting plugin declares
|
|
11
|
+
_subscription specs_ against typed _target_ objects exported from the
|
|
12
|
+
target's owning plugin (catalog ships `catalogSystemTarget` and
|
|
13
|
+
`catalogGroupTarget`). Notification-backend handles every per-resource
|
|
14
|
+
group lifecycle, parent-edge inheritance, and legacy-subscription seeding
|
|
15
|
+
— plugins never author groupId helpers, lifecycle hooks, or migration
|
|
16
|
+
code again.
|
|
17
|
+
|
|
18
|
+
**Plugin-author surface area is now ~12 lines per emitter:**
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
// <plugin>-common
|
|
22
|
+
const { defineSubscription } = createSubscriptionFactory(pluginMetadata);
|
|
23
|
+
export const fooSystemSubscription = defineSubscription({
|
|
24
|
+
localId: "system",
|
|
25
|
+
target: catalogSystemTarget,
|
|
26
|
+
display: { title: "Foo Alerts", description: "...", iconName: "Bell" },
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// <plugin>-backend register()
|
|
30
|
+
env.registerSubscriptionSpecs([fooSystemSubscription]);
|
|
31
|
+
// ^ feeds the plugin loader's dependency sorter — each spec's
|
|
32
|
+
// target.ownerPlugin becomes an implicit init-order dep, so this
|
|
33
|
+
// plugin automatically waits for catalog (the target owner) to
|
|
34
|
+
// finish init + afterPluginsReady before its own runs.
|
|
35
|
+
|
|
36
|
+
// <plugin>-backend afterPluginsReady
|
|
37
|
+
await notificationClient.registerSubscriptionSpec(
|
|
38
|
+
specToRegistration(fooSystemSubscription)
|
|
39
|
+
);
|
|
40
|
+
// dispatch
|
|
41
|
+
await notificationClient.notifyForSubscription({
|
|
42
|
+
specId: fooSystemSubscription.specId,
|
|
43
|
+
resourceKeys: [systemId],
|
|
44
|
+
title,
|
|
45
|
+
body,
|
|
46
|
+
importance,
|
|
47
|
+
action,
|
|
48
|
+
collapseKey,
|
|
49
|
+
subjects,
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// <plugin>-frontend
|
|
53
|
+
createNotificationSubscriptionExtension({ spec: fooSystemSubscription });
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Migrated plugins**: anomaly, incident, maintenance, healthcheck,
|
|
57
|
+
dependency. Each lost its bespoke `notification-groups.ts`,
|
|
58
|
+
`bootstrap*NotificationGroups`, `ensure*Group`, and inheritance walk —
|
|
59
|
+
all of that is now centralized in notification-backend's
|
|
60
|
+
`subscription-engine`.
|
|
61
|
+
|
|
62
|
+
**Plugin loader change** (`@checkstack/backend-api`,
|
|
63
|
+
`@checkstack/backend`): the register-time API gains
|
|
64
|
+
`env.registerSubscriptionSpecs([...specs])`. The dependency sorter
|
|
65
|
+
walks `spec.target.ownerPlugin` for every declared spec and adds the
|
|
66
|
+
target owner as an init-order dependency of the emitting plugin. This
|
|
67
|
+
guarantees that catalog (the owner of the platform's `system` and
|
|
68
|
+
`group` targets) completes init + afterPluginsReady before any
|
|
69
|
+
emitting plugin tries to register its specs against the notification
|
|
70
|
+
service — no string-prefix heuristics, no manual `dependsOnPlugins`
|
|
71
|
+
list, no stub rows. Plugins that fail to declare their specs at
|
|
72
|
+
register time get a clear `Target type X is not registered. Did the
|
|
73
|
+
emitting plugin declare this spec via env.registerSubscriptionSpecs?`
|
|
74
|
+
error from the dispatcher.
|
|
75
|
+
|
|
76
|
+
**Removed** (no backwards compat):
|
|
77
|
+
|
|
78
|
+
- `catalogClient.notifySystemSubscribers` and
|
|
79
|
+
`catalogClient.notifyManySystemSubscribers`
|
|
80
|
+
- `notificationClient.notifyUsers` and `notificationClient.notifyGroups`
|
|
81
|
+
as direct dispatch primitives — replaced by spec-bound
|
|
82
|
+
`notifyForSubscription`
|
|
83
|
+
- catalog's `bootstrapNotificationGroups` (replaced by
|
|
84
|
+
`bootstrapNotificationTargets`)
|
|
85
|
+
|
|
86
|
+
**Enforcement**: the dispatcher rejects calls referencing unregistered
|
|
87
|
+
specIds, specs owned by other plugins, or resourceKeys that haven't been
|
|
88
|
+
pushed via `upsertNotificationResource`. Display metadata for any
|
|
89
|
+
groupId is recoverable via the spec registry, so audit lists render
|
|
90
|
+
correct labels even when an emitter's frontend isn't loaded.
|
|
91
|
+
|
|
92
|
+
**Per-field anomaly mute** keeps working — it now lives inside the
|
|
93
|
+
generic SubscriptionRow's optional `SubControls` panel
|
|
94
|
+
(`AnomalyFieldMuteList`), exposed through the catalog system detail
|
|
95
|
+
page's notifications card.
|
|
96
|
+
|
|
97
|
+
The catalog system detail page renders a "Notifications" card hosting
|
|
98
|
+
`SystemNotificationSubscriptionsSlot`. The matching group surface is
|
|
99
|
+
not yet rendered — group-level subscriptions are wired end-to-end on
|
|
100
|
+
the backend; a follow-up will add the host UI.
|
|
101
|
+
|
|
102
|
+
**Migration of existing subscribers**: target types declare a
|
|
103
|
+
`legacyGroupIdTemplate`; on first registration of each spec,
|
|
104
|
+
notification-backend reads subscribers from the legacy
|
|
105
|
+
`catalog.system.<id>` / `catalog.group.<id>` groups and seeds the new
|
|
106
|
+
spec groups exactly once per (spec × resource) pair, tracked in
|
|
107
|
+
`subscription_migrations`. Anomaly stays opt-in (its target also
|
|
108
|
+
declares the template, but the user-explicit nature of the original
|
|
109
|
+
opt-in flow means the seeding produces the same set of subscribers
|
|
110
|
+
they already had).
|
|
111
|
+
|
|
112
|
+
### Minor Changes
|
|
113
|
+
|
|
114
|
+
- 32d52c6: Bulk notifications affecting multiple systems and collapse lifecycle events into a single card.
|
|
115
|
+
|
|
116
|
+
Notifications now carry an optional `subjects` array (the entities they affect) and an optional `collapseKey` (so related notifications collapse into one row per recipient). Incidents, maintenances, anomalies, healthchecks, and dependency-impact events route through these new fields, so an incident affecting three systems produces one in-app notification + one external send per subscriber instead of three. Lifecycle updates for the same entity (created → updated → resolved) also collapse, with an expandable "+N updates" timeline.
|
|
117
|
+
|
|
118
|
+
Subject kinds are namespaced as `<pluginId>.<localKind>` and built via type-safe helpers exported from each domain's common package (`createSystemSubject`, `incidentCollapseKey`, etc.). The frontend kind registry (`registerSubjectKind`) lets plugins bind icon + label for their kinds; unknown kinds fall back to a generic chip.
|
|
119
|
+
|
|
120
|
+
All notification strategies (SMTP, Slack, Discord, Teams, Telegram, Pushover, Gotify, Webex, Backstage) render the affected subjects natively in their format (HTML cards, Slack blocks, Discord embed fields, adaptive cards, markdown lists, etc.).
|
|
121
|
+
|
|
122
|
+
### Patch Changes
|
|
123
|
+
|
|
124
|
+
- Updated dependencies [32d52c6]
|
|
125
|
+
- Updated dependencies [32d52c6]
|
|
126
|
+
- Updated dependencies [32d52c6]
|
|
127
|
+
- Updated dependencies [32d52c6]
|
|
128
|
+
- Updated dependencies [32d52c6]
|
|
129
|
+
- Updated dependencies [32d52c6]
|
|
130
|
+
- @checkstack/notification-common@1.0.0
|
|
131
|
+
- @checkstack/catalog-common@2.0.0
|
|
132
|
+
- @checkstack/frontend-api@0.4.1
|
|
133
|
+
|
|
3
134
|
## 0.5.0
|
|
4
135
|
|
|
5
136
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@checkstack/incident-common",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -9,8 +9,10 @@
|
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@checkstack/common": "0.7.0",
|
|
12
|
-
"@checkstack/
|
|
13
|
-
"@checkstack/
|
|
12
|
+
"@checkstack/catalog-common": "1.5.3",
|
|
13
|
+
"@checkstack/frontend-api": "0.4.0",
|
|
14
|
+
"@checkstack/notification-common": "0.3.0",
|
|
15
|
+
"@checkstack/signal-common": "0.2.0",
|
|
14
16
|
"@orpc/contract": "^1.13.14",
|
|
15
17
|
"zod": "^4.2.1"
|
|
16
18
|
},
|
package/src/index.ts
CHANGED
|
@@ -26,6 +26,7 @@ export {
|
|
|
26
26
|
} from "./schemas";
|
|
27
27
|
export { IncidentDetailsSlot, IncidentStatusSlot } from "./slots";
|
|
28
28
|
export * from "./plugin-metadata";
|
|
29
|
+
export * from "./notifications";
|
|
29
30
|
export { incidentRoutes } from "./routes";
|
|
30
31
|
|
|
31
32
|
// =============================================================================
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createCollapseKeyBuilder,
|
|
3
|
+
createSubscriptionFactory,
|
|
4
|
+
} from "@checkstack/notification-common";
|
|
5
|
+
import {
|
|
6
|
+
catalogSystemTarget,
|
|
7
|
+
catalogGroupTarget,
|
|
8
|
+
} from "@checkstack/catalog-common";
|
|
9
|
+
import { pluginMetadata } from "./plugin-metadata";
|
|
10
|
+
|
|
11
|
+
export const incidentCollapseKey = createCollapseKeyBuilder(
|
|
12
|
+
pluginMetadata,
|
|
13
|
+
"incident",
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
const { defineSubscription } = createSubscriptionFactory(pluginMetadata);
|
|
17
|
+
|
|
18
|
+
export const incidentSystemSubscription = defineSubscription({
|
|
19
|
+
localId: "system",
|
|
20
|
+
target: catalogSystemTarget,
|
|
21
|
+
display: {
|
|
22
|
+
title: "Incidents",
|
|
23
|
+
description: "Incidents reported, updated, and resolved for this system.",
|
|
24
|
+
iconName: "AlertTriangle",
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export const incidentGroupSubscription = defineSubscription({
|
|
29
|
+
localId: "group",
|
|
30
|
+
target: catalogGroupTarget,
|
|
31
|
+
display: {
|
|
32
|
+
title: "Incidents",
|
|
33
|
+
description: "Incidents for any system in this group.",
|
|
34
|
+
iconName: "AlertTriangle",
|
|
35
|
+
},
|
|
36
|
+
});
|