@checkstack/anomaly-backend 1.1.4 → 1.1.5

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,57 @@
1
1
  # @checkstack/anomaly-backend
2
2
 
3
+ ## 1.1.5
4
+
5
+ ### Patch Changes
6
+
7
+ - f23f3c9: Add `correlationMiddleware` to `@checkstack/backend-api` and apply it
8
+ to every plugin/core router so each request carries a stable
9
+ `x-correlation-id` (read from the inbound header, or freshly minted
10
+ via `crypto.randomUUID()` when absent) and an auto-injected child
11
+ logger bound with `{ correlationId, pluginId, userId? }`. The ID is
12
+ echoed back on the response header so the caller can correlate their
13
+ client-side trace to the server logs.
14
+
15
+ The `Logger` interface in `@checkstack/backend-api` now formally
16
+ documents the structured-metadata convention (`logger.info("msg",
17
+ { ...meta })`) alongside the long-standing varargs shape. Winston's
18
+ splat handling already routes both shapes through the same vararg
19
+ slot, so existing call sites are unaffected. A new optional
20
+ `Logger.child(meta)` method captures the metadata-binding contract the
21
+ new middleware relies on; production loggers always implement it,
22
+ minimal test mocks may omit it (the middleware falls back gracefully).
23
+
24
+ `RpcContext` grew two optional `Headers` bags, `requestHeaders` and
25
+ `responseHeaders`, populated by the outer Hono `/api/*` and `/rest/*`
26
+ handlers in `@checkstack/backend`. They are write-through observation
27
+ points for middleware; an `RpcContext` constructed without them (S2S
28
+ clients, tests) keeps working — the echo is a silent no-op and the ID
29
+ is still bound onto the child logger for server-side correlation.
30
+
31
+ The scaffolding template in `@checkstack/scripts` was updated so any
32
+ new plugin generated via `bun run create` wires the middleware in the
33
+ expected `.use(correlationMiddleware).use(autoAuthMiddleware)` order
34
+ out of the box.
35
+
36
+ - Updated dependencies [f23f3c9]
37
+ - Updated dependencies [f23f3c9]
38
+ - Updated dependencies [f23f3c9]
39
+ - Updated dependencies [f23f3c9]
40
+ - @checkstack/common@0.11.0
41
+ - @checkstack/backend-api@0.17.0
42
+ - @checkstack/catalog-backend@1.1.5
43
+ - @checkstack/gitops-backend@0.3.5
44
+ - @checkstack/healthcheck-backend@1.1.4
45
+ - @checkstack/notification-common@1.2.0
46
+ - @checkstack/anomaly-common@1.2.2
47
+ - @checkstack/catalog-common@2.2.2
48
+ - @checkstack/gitops-common@0.4.1
49
+ - @checkstack/healthcheck-common@1.1.2
50
+ - @checkstack/signal-common@0.2.4
51
+ - @checkstack/cache-api@0.3.4
52
+ - @checkstack/queue-api@0.3.4
53
+ - @checkstack/cache-utils@0.2.9
54
+
3
55
  ## 1.1.4
4
56
 
5
57
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checkstack/anomaly-backend",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "license": "Elastic-2.0",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -14,20 +14,20 @@
14
14
  "lint:code": "eslint . --max-warnings 0"
15
15
  },
16
16
  "dependencies": {
17
- "@checkstack/backend-api": "0.15.3",
17
+ "@checkstack/backend-api": "0.16.0",
18
18
  "@checkstack/common": "0.10.0",
19
- "@checkstack/anomaly-common": "1.2.0",
19
+ "@checkstack/anomaly-common": "1.2.1",
20
20
  "@checkstack/signal-common": "0.2.3",
21
- "@checkstack/healthcheck-common": "1.1.0",
22
- "@checkstack/queue-api": "0.3.2",
23
- "@checkstack/cache-api": "0.3.2",
24
- "@checkstack/cache-utils": "0.2.7",
25
- "@checkstack/healthcheck-backend": "1.1.2",
26
- "@checkstack/catalog-backend": "1.1.3",
27
- "@checkstack/gitops-backend": "0.3.3",
21
+ "@checkstack/healthcheck-common": "1.1.1",
22
+ "@checkstack/queue-api": "0.3.3",
23
+ "@checkstack/cache-api": "0.3.3",
24
+ "@checkstack/cache-utils": "0.2.8",
25
+ "@checkstack/healthcheck-backend": "1.1.3",
26
+ "@checkstack/catalog-backend": "1.1.4",
27
+ "@checkstack/gitops-backend": "0.3.4",
28
28
  "@checkstack/gitops-common": "0.4.0",
29
- "@checkstack/catalog-common": "2.2.0",
30
- "@checkstack/notification-common": "1.1.0",
29
+ "@checkstack/catalog-common": "2.2.1",
30
+ "@checkstack/notification-common": "1.1.1",
31
31
  "drizzle-orm": "^0.45.0",
32
32
  "hono": "^4.12.14",
33
33
  "zod": "^4.2.1",
@@ -36,7 +36,7 @@
36
36
  "devDependencies": {
37
37
  "@checkstack/drizzle-helper": "0.0.5",
38
38
  "@checkstack/scripts": "0.3.2",
39
- "@checkstack/test-utils-backend": "0.1.27",
39
+ "@checkstack/test-utils-backend": "0.1.28",
40
40
  "@checkstack/tsconfig": "0.0.7",
41
41
  "@types/bun": "^1.0.0",
42
42
  "date-fns": "^4.1.0",
package/src/router.ts CHANGED
@@ -3,6 +3,7 @@ import { anomalyContract } from "@checkstack/anomaly-common";
3
3
  import type { AnomalyService } from "./service";
4
4
  import {
5
5
  autoAuthMiddleware,
6
+ correlationMiddleware,
6
7
  type Logger,
7
8
  type RealUser,
8
9
  type RpcContext,
@@ -18,6 +19,7 @@ export function createRouter(
18
19
  ) {
19
20
  const os = implement(anomalyContract)
20
21
  .$context<RpcContext>()
22
+ .use(correlationMiddleware)
21
23
  .use(autoAuthMiddleware);
22
24
 
23
25
  return os.router({