@checkstack/notification-common 1.0.2 → 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 +87 -0
- package/package.json +4 -4
- package/src/rpc-contract.ts +5 -0
- package/src/schemas.ts +10 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,92 @@
|
|
|
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
|
+
|
|
32
|
+
## 1.1.0
|
|
33
|
+
|
|
34
|
+
### Minor Changes
|
|
35
|
+
|
|
36
|
+
- 9016526: Add a `/rest/:pluginId/*` HTTP mount that serves every plugin's oRPC contract
|
|
37
|
+
through the REST/OpenAPI shape described by `/api/openapi.json`. Queries are
|
|
38
|
+
`GET` with query parameters, mutations are `POST` with the input as the raw
|
|
39
|
+
JSON body. The existing `/api/:pluginId/*` mount continues to serve oRPC's
|
|
40
|
+
native wire protocol unchanged, so existing clients are not affected.
|
|
41
|
+
|
|
42
|
+
The OpenAPI spec at `/api/openapi.json` now reflects the real mount: every
|
|
43
|
+
`paths` entry is prefixed with `/rest` instead of `/api`.
|
|
44
|
+
|
|
45
|
+
Also fixes a SPA-fallback bug: the backend's `/api-docs` route previously
|
|
46
|
+
returned 404 on production deployments because the static-file middleware
|
|
47
|
+
skipped any path starting with `/api`, capturing `/api-docs` along with real
|
|
48
|
+
API routes. The skip now requires a trailing slash (`/api/`, `/rest/`).
|
|
49
|
+
|
|
50
|
+
Required access rules are now visible in the API Docs UI. The OpenAPI spec
|
|
51
|
+
generator was reading a non-existent `accessRules` field on procedure
|
|
52
|
+
metadata; the real field is `access: AccessRule[]`. Each procedure's access
|
|
53
|
+
rules are now flattened to fully-qualified IDs (e.g. `catalog.system.read`)
|
|
54
|
+
and emitted under `x-orpc-meta.accessRules`, which the existing
|
|
55
|
+
`Required Access Rules` section in the docs UI already knew how to render.
|
|
56
|
+
|
|
57
|
+
The API Docs schema renderer now handles record types (zod `z.record`),
|
|
58
|
+
`$ref`s into `components.schemas`, `oneOf`/`anyOf`/`allOf`, nullable union
|
|
59
|
+
types (`type: ["string", "null"]`), and `format` qualifiers. Previously
|
|
60
|
+
record outputs like `{ statuses: object }` masked the actual value type;
|
|
61
|
+
they now render as `{ [key]: <ResolvedType> { ... } }` with the inner
|
|
62
|
+
schema expanded, capped at 12 levels with cycle detection.
|
|
63
|
+
|
|
64
|
+
**REST method conventions.** `proc()` now defaults to `GET` for queries and
|
|
65
|
+
`POST` for mutations on the `/rest` mount, using bracket-notation query
|
|
66
|
+
params (`?filter[status]=active&ids[0]=a`) for GET inputs. Existing
|
|
67
|
+
procedures were updated to follow REST semantics:
|
|
68
|
+
|
|
69
|
+
- `update*` mutations → `PATCH`
|
|
70
|
+
- `delete*` / `remove*` mutations → `DELETE`
|
|
71
|
+
- `getBulk*` queries and any query taking a large array input → `POST`
|
|
72
|
+
(because `@orpc/openapi@1.13.x` has no GET→POST URL-length fallback)
|
|
73
|
+
|
|
74
|
+
GET endpoints require an `object` input — bare scalars like
|
|
75
|
+
`.input(z.string())` are not valid on GET. `getSystemConfigurations` was
|
|
76
|
+
refactored from `.input(z.string())` to `.input(z.object({ systemId: ... }))`
|
|
77
|
+
to fit the GET shape; the only call-site update was the in-process router
|
|
78
|
+
unpacking `input.systemId` instead of passing `input` directly.
|
|
79
|
+
|
|
80
|
+
The API Docs UI now renders query parameters (path/query/header/cookie) in a
|
|
81
|
+
dedicated table for GET endpoints, and the fetch example shows them in the
|
|
82
|
+
URL with `<required>` / `<optional>` placeholders.
|
|
83
|
+
|
|
84
|
+
### Patch Changes
|
|
85
|
+
|
|
86
|
+
- Updated dependencies [9016526]
|
|
87
|
+
- @checkstack/common@0.10.0
|
|
88
|
+
- @checkstack/signal-common@0.2.3
|
|
89
|
+
|
|
3
90
|
## 1.0.2
|
|
4
91
|
|
|
5
92
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@checkstack/notification-common",
|
|
3
|
-
"version": "1.
|
|
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.
|
|
14
|
-
"@checkstack/signal-common": "0.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.
|
|
21
|
+
"@checkstack/scripts": "0.3.2"
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
24
|
"typecheck": "tsgo -b",
|
package/src/rpc-contract.ts
CHANGED
|
@@ -112,6 +112,7 @@ export const notificationContract = {
|
|
|
112
112
|
userType: "user",
|
|
113
113
|
access: [],
|
|
114
114
|
})
|
|
115
|
+
.route({ method: "DELETE" })
|
|
115
116
|
.input(z.object({ notificationId: z.string().uuid() }))
|
|
116
117
|
.output(z.void()),
|
|
117
118
|
|
|
@@ -164,6 +165,7 @@ export const notificationContract = {
|
|
|
164
165
|
userType: "user",
|
|
165
166
|
access: [],
|
|
166
167
|
})
|
|
168
|
+
.route({ method: "POST" })
|
|
167
169
|
.input(z.object({ groupIds: z.array(z.string()) }))
|
|
168
170
|
.output(z.record(z.string(), z.boolean())),
|
|
169
171
|
|
|
@@ -226,6 +228,7 @@ export const notificationContract = {
|
|
|
226
228
|
userType: "service",
|
|
227
229
|
access: [],
|
|
228
230
|
})
|
|
231
|
+
.route({ method: "DELETE" })
|
|
229
232
|
.input(
|
|
230
233
|
z.object({
|
|
231
234
|
groupId: z.string().describe("Full namespaced group ID to delete"),
|
|
@@ -337,6 +340,7 @@ export const notificationContract = {
|
|
|
337
340
|
userType: "service",
|
|
338
341
|
access: [],
|
|
339
342
|
})
|
|
343
|
+
.route({ method: "DELETE" })
|
|
340
344
|
.input(
|
|
341
345
|
z.object({
|
|
342
346
|
targetTypeId: z.string(),
|
|
@@ -530,6 +534,7 @@ export const notificationContract = {
|
|
|
530
534
|
userType: "user",
|
|
531
535
|
access: [notificationAccess.admin],
|
|
532
536
|
})
|
|
537
|
+
.route({ method: "PATCH" })
|
|
533
538
|
.input(
|
|
534
539
|
z.object({
|
|
535
540
|
strategyId: z.string().describe("Qualified strategy ID"),
|
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:
|
|
60
|
+
status: SubjectStatusSchema.optional(),
|
|
52
61
|
});
|
|
53
62
|
export type NotificationSubject = z.infer<typeof NotificationSubjectSchema>;
|
|
54
63
|
|