@checkstack/notification-common 1.1.0 → 1.1.1

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 CHANGED
@@ -1,5 +1,34 @@
1
1
  # @checkstack/notification-common
2
2
 
3
+ ## 1.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - a06b899: Dead-code audit cleanup and a small platform of shared notification helpers.
8
+
9
+ **Removed (dead code)**
10
+
11
+ - `core/backend/src/plugin-manager/deregistration-guard.ts` deleted. The exported `assertCanDeregister()` was never called and was a less-complete version of the dependents+isUninstallable checks already done inline by `previewUninstallOriginator` / `uninstallOriginator` in `plugin-manager-orchestrator.ts`.
12
+ - `createMockQueueFactory` deprecated alias removed from `@checkstack/test-utils-backend`. Use `createMockQueueManager` directly.
13
+
14
+ **New shared helpers**
15
+
16
+ - `@checkstack/backend-api` now exports `requestTimeoutMs()` — a Zod field builder for outbound HTTP request timeouts (1s..60s, default 10s). Replaces hand-rolled `configNumber({}).min(1000).max(60_000).default(10_000)` in `integration-webhook-backend`, `integration-script-backend`, and `healthcheck-script-backend`'s inline collector.
17
+ - `@checkstack/notification-common` now exports `SubjectStatusSchema` / `SubjectStatus`, mirroring the existing `ImportanceSchema`.
18
+ - `@checkstack/notification-backend` now exports:
19
+ - `SUBJECT_STATUS_EMOJI` / `IMPORTANCE_EMOJI` — the shared status / importance emoji maps that Discord, Slack, Teams, Webex and Telegram previously each redefined inline.
20
+ - `postJson(opts)` — a timeout-bounded `fetch` wrapper that handles non-2xx logging and error mapping for webhook-style POSTs. Returns `{ ok: true, response } | { ok: false, error }`.
21
+
22
+ **Migrated to shared helpers**
23
+
24
+ - Discord, Slack, Gotify, Pushover notification backends now use `postJson`. Outer try/catch + per-plugin error mapping deleted (~140 LOC).
25
+ - Discord, Slack, Teams, Telegram, Webex notification backends now use `IMPORTANCE_EMOJI`. Discord, Slack, Teams use `SUBJECT_STATUS_EMOJI`.
26
+ - Teams, Webex, Backstage, Telegram kept their inline fetch/Bot logic: their error strings surface server response bodies to operators, or the transport isn't raw `fetch` (Telegram uses `grammy`'s `Bot`).
27
+
28
+ **API surface tightening**
29
+
30
+ - Per-plugin test-only re-exports in 6 notification backends (Pushover, Gotify, Backstage, Slack, Discord, Teams) and the `CertificateInfo` interface in `healthcheck-tls-backend/strategy.ts` are now JSDoc-tagged `@internal`. No behaviour change; signals that downstream consumers must not depend on them.
31
+
3
32
  ## 1.1.0
4
33
 
5
34
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checkstack/notification-common",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "license": "Elastic-2.0",
5
5
  "type": "module",
6
6
  "exports": {
@@ -10,15 +10,15 @@
10
10
  }
11
11
  },
12
12
  "dependencies": {
13
- "@checkstack/common": "0.9.0",
14
- "@checkstack/signal-common": "0.2.2",
13
+ "@checkstack/common": "0.10.0",
14
+ "@checkstack/signal-common": "0.2.3",
15
15
  "@orpc/contract": "^1.13.14",
16
16
  "zod": "^4.0.0"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@checkstack/tsconfig": "0.0.7",
20
20
  "typescript": "^5.7.2",
21
- "@checkstack/scripts": "0.3.1"
21
+ "@checkstack/scripts": "0.3.2"
22
22
  },
23
23
  "scripts": {
24
24
  "typecheck": "tsgo -b",
package/src/schemas.ts CHANGED
@@ -4,6 +4,15 @@ import { z } from "zod";
4
4
  export const ImportanceSchema = z.enum(["info", "warning", "critical"]);
5
5
  export type Importance = z.infer<typeof ImportanceSchema>;
6
6
 
7
+ // Optional health/status hint for affected subjects.
8
+ export const SubjectStatusSchema = z.enum([
9
+ "healthy",
10
+ "unhealthy",
11
+ "degraded",
12
+ "unknown",
13
+ ]);
14
+ export type SubjectStatus = z.infer<typeof SubjectStatusSchema>;
15
+
7
16
  // Notification action for CTA buttons
8
17
  export const NotificationActionSchema = z.object({
9
18
  label: z.string(),
@@ -48,7 +57,7 @@ export const NotificationSubjectSchema = z.object({
48
57
  * Optional health/status hint, used to color the chip and add an icon.
49
58
  * Strategies that cannot render color simply ignore it.
50
59
  */
51
- status: z.enum(["healthy", "unhealthy", "degraded", "unknown"]).optional(),
60
+ status: SubjectStatusSchema.optional(),
52
61
  });
53
62
  export type NotificationSubject = z.infer<typeof NotificationSubjectSchema>;
54
63