@molecule/api-resource-status-page 1.0.3 → 1.0.4

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/README.md CHANGED
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
3
  Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
4
  Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
5
  To change this document, edit the module-level JSDoc in src/index.ts.
6
- Generated: 2026-10-16T15:23:41.923Z
6
+ Generated: 2026-10-16T20:59:34.726Z
7
7
  -->
8
8
 
9
9
  # @molecule/api-resource-status-page
@@ -22,6 +22,20 @@ a public status page; the mutation endpoints are for operators.
22
22
  `uptimeWindows` each join to it on their own `serviceId` = `services.id` (a declared FK,
23
23
  `ON DELETE CASCADE`) — that `serviceId` is the column every per-service query filters on.
24
24
 
25
+ **`handlers.*` return `{ statusCode, headers?, body }` and never write to `res`** — not through
26
+ `res.json`, not through `res.send`, not through `res.end`. The mounted routes apply that object
27
+ for you (`createRequestHandler` does `res.set(headers)`, `res.status(statusCode)`,
28
+ `res.send(body)`); calling a handler directly is only correct if you apply the result yourself:
29
+
30
+ ```typescript
31
+ const { statusCode, headers, body } = await handlers.getStatus(resource)(req, res)
32
+ if (headers) res.set(headers)
33
+ res.status(statusCode).send(body)
34
+ ```
35
+
36
+ Monkey-patching `res.json` to re-shape a handler's answer intercepts nothing the handler
37
+ produces, so the request it was meant to answer is left unanswered and hangs.
38
+
25
39
  ## Quick Start
26
40
 
27
41
  ```typescript
package/dist/index.d.ts CHANGED
@@ -9,6 +9,20 @@
9
9
  * `uptimeWindows` each join to it on their own `serviceId` = `services.id` (a declared FK,
10
10
  * `ON DELETE CASCADE`) — that `serviceId` is the column every per-service query filters on.
11
11
  *
12
+ * **`handlers.*` return `{ statusCode, headers?, body }` and never write to `res`** — not through
13
+ * `res.json`, not through `res.send`, not through `res.end`. The mounted routes apply that object
14
+ * for you (`createRequestHandler` does `res.set(headers)`, `res.status(statusCode)`,
15
+ * `res.send(body)`); calling a handler directly is only correct if you apply the result yourself:
16
+ *
17
+ * ```typescript
18
+ * const { statusCode, headers, body } = await handlers.getStatus(resource)(req, res)
19
+ * if (headers) res.set(headers)
20
+ * res.status(statusCode).send(body)
21
+ * ```
22
+ *
23
+ * Monkey-patching `res.json` to re-shape a handler's answer intercepts nothing the handler
24
+ * produces, so the request it was meant to answer is left unanswered and hangs.
25
+ *
12
26
  * @e2e
13
27
  * Integration checklist — drive the real UI (live preview, no mocks), adapt
14
28
  * each item to this app's actual status-page screens/flows, and check every
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwFG;AAEH,cAAc,wBAAwB,CAAA;AACtC,cAAc,oBAAoB,CAAA;AAClC,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAA;AAC/C,cAAc,WAAW,CAAA;AACzB,cAAc,wBAAwB,CAAA;AACtC,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsGG;AAEH,cAAc,wBAAwB,CAAA;AACtC,cAAc,oBAAoB,CAAA;AAClC,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAA;AAC/C,cAAc,WAAW,CAAA;AACzB,cAAc,wBAAwB,CAAA;AACtC,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA"}
package/dist/index.js CHANGED
@@ -9,6 +9,20 @@
9
9
  * `uptimeWindows` each join to it on their own `serviceId` = `services.id` (a declared FK,
10
10
  * `ON DELETE CASCADE`) — that `serviceId` is the column every per-service query filters on.
11
11
  *
12
+ * **`handlers.*` return `{ statusCode, headers?, body }` and never write to `res`** — not through
13
+ * `res.json`, not through `res.send`, not through `res.end`. The mounted routes apply that object
14
+ * for you (`createRequestHandler` does `res.set(headers)`, `res.status(statusCode)`,
15
+ * `res.send(body)`); calling a handler directly is only correct if you apply the result yourself:
16
+ *
17
+ * ```typescript
18
+ * const { statusCode, headers, body } = await handlers.getStatus(resource)(req, res)
19
+ * if (headers) res.set(headers)
20
+ * res.status(statusCode).send(body)
21
+ * ```
22
+ *
23
+ * Monkey-patching `res.json` to re-shape a handler's answer intercepts nothing the handler
24
+ * produces, so the request it was meant to answer is left unanswered and hangs.
25
+ *
12
26
  * @e2e
13
27
  * Integration checklist — drive the real UI (live preview, no mocks), adapt
14
28
  * each item to this app's actual status-page screens/flows, and check every
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwFG;AAEH,cAAc,wBAAwB,CAAA;AACtC,cAAc,oBAAoB,CAAA;AAClC,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAA;AAC/C,cAAc,WAAW,CAAA;AACzB,cAAc,wBAAwB,CAAA;AACtC,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsGG;AAEH,cAAc,wBAAwB,CAAA;AACtC,cAAc,oBAAoB,CAAA;AAClC,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAA;AAC/C,cAAc,WAAW,CAAA;AACzB,cAAc,wBAAwB,CAAA;AACtC,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/api-resource-status-page",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "System status page resource for molecule.dev.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",