@checkstack/anomaly-backend 1.1.4 → 1.1.6

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