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