@checkstack/theme-backend 0.1.32 → 0.1.34

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