@molecule/app-status-dashboard-http 1.0.0 → 1.0.2
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 +168 -0
- package/package.json +9 -8
package/README.md
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
3
|
+
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
|
+
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
|
+
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
+
Generated: 2026-08-04T01:52:48.086Z
|
|
7
|
+
-->
|
|
8
|
+
|
|
9
|
+
# @molecule/app-status-dashboard-http
|
|
10
|
+
|
|
11
|
+
> **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
|
|
12
|
+
> It is written to be read by coding agents as much as by people, and is generated from this
|
|
13
|
+
> package's source — edit `src/index.ts` JSDoc, not this file.
|
|
14
|
+
|
|
15
|
+
HTTP status dashboard provider for molecule.dev.
|
|
16
|
+
|
|
17
|
+
Implements `StatusDashboardProvider` from `@molecule/app-status-dashboard` by
|
|
18
|
+
fetching status data from the backend over plain HTTP, with automatic polling.
|
|
19
|
+
Pairs with `@molecule/api-resource-status-page`, which serves the expected
|
|
20
|
+
endpoints: `GET /status`, `GET /status/incidents`, and `GET /status/uptime`.
|
|
21
|
+
|
|
22
|
+
## Quick Start
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import { setProvider } from '@molecule/app-status-dashboard'
|
|
26
|
+
import { createProvider } from '@molecule/app-status-dashboard-http'
|
|
27
|
+
|
|
28
|
+
setProvider(createProvider({ baseUrl: '/api' }))
|
|
29
|
+
// Now GET /api/status, /api/status/incidents?status=&limit=,
|
|
30
|
+
// /api/status/uptime?serviceId= back the dashboard.
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Type
|
|
34
|
+
|
|
35
|
+
`provider`
|
|
36
|
+
|
|
37
|
+
## Installation
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install @molecule/app-status-dashboard-http @molecule/app-i18n @molecule/app-status-dashboard
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## API
|
|
44
|
+
|
|
45
|
+
### Interfaces
|
|
46
|
+
|
|
47
|
+
#### `HttpStatusDashboardConfig`
|
|
48
|
+
|
|
49
|
+
Configuration for http status dashboard provider.
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
interface HttpStatusDashboardConfig {
|
|
53
|
+
/** Base URL for API requests. Defaults to '' (same origin). */
|
|
54
|
+
baseUrl?: string
|
|
55
|
+
/** Custom headers to include in requests. */
|
|
56
|
+
headers?: Record<string, string>
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Classes
|
|
61
|
+
|
|
62
|
+
#### `HttpStatusDashboardProvider`
|
|
63
|
+
|
|
64
|
+
HTTP-based implementation of `StatusDashboardProvider`. Fetches system status,
|
|
65
|
+
incidents, and uptime data from backend API endpoints via standard HTTP requests.
|
|
66
|
+
|
|
67
|
+
### Functions
|
|
68
|
+
|
|
69
|
+
#### `createProvider(config)`
|
|
70
|
+
|
|
71
|
+
Creates an `HttpStatusDashboardProvider` instance with optional configuration.
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
function createProvider(config?: HttpStatusDashboardConfig): HttpStatusDashboardProvider
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
- `config` — HTTP-specific status dashboard configuration (base URL, headers).
|
|
78
|
+
|
|
79
|
+
**Returns:** An `HttpStatusDashboardProvider` that communicates with the backend via HTTP.
|
|
80
|
+
|
|
81
|
+
### Constants
|
|
82
|
+
|
|
83
|
+
#### `provider`
|
|
84
|
+
|
|
85
|
+
Pre-instantiated provider singleton.
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
const provider: HttpStatusDashboardProvider
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Core Interface
|
|
92
|
+
|
|
93
|
+
Implements `@molecule/app-status-dashboard` interface.
|
|
94
|
+
|
|
95
|
+
## Bond Wiring
|
|
96
|
+
|
|
97
|
+
Setup function to register this provider with the core interface:
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
import { setProvider } from '@molecule/app-status-dashboard'
|
|
101
|
+
import { provider } from '@molecule/app-status-dashboard-http'
|
|
102
|
+
|
|
103
|
+
export function setupStatusDashboardHttp(): void {
|
|
104
|
+
setProvider(provider)
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Injection Notes
|
|
109
|
+
|
|
110
|
+
### Requirements
|
|
111
|
+
|
|
112
|
+
Peer dependencies:
|
|
113
|
+
|
|
114
|
+
- `@molecule/app-status-dashboard` ^1.0.1
|
|
115
|
+
- `@molecule/app-i18n` ^1.0.1
|
|
116
|
+
|
|
117
|
+
### Runtime Dependencies
|
|
118
|
+
|
|
119
|
+
- `@molecule/app-i18n`
|
|
120
|
+
- `@molecule/app-status-dashboard`
|
|
121
|
+
|
|
122
|
+
- **The backend must serve the three endpoints** (`/status`,
|
|
123
|
+
`/status/incidents`, `/status/uptime`) relative to `baseUrl` — responses are
|
|
124
|
+
`SystemStatus`, `{ incidents: StatusIncident[] }`, and
|
|
125
|
+
`{ uptime: ServiceUptime[] }` respectively. `@molecule/api-resource-status-page`
|
|
126
|
+
provides them.
|
|
127
|
+
- **Error semantics differ per method**: `fetchStatus()` throws on non-2xx;
|
|
128
|
+
`fetchIncidents()`/`fetchUptime()` return `[]` on ANY failure — an empty
|
|
129
|
+
incidents list can mean "endpoint missing", not "all clear". Verify `/status`
|
|
130
|
+
works first.
|
|
131
|
+
- Polling defaults to every 30 s (`pollIntervalMs`), fetches immediately, and
|
|
132
|
+
swallows per-tick errors (next tick retries). Keep the stop function returned by
|
|
133
|
+
`startPolling()` and call it on unmount; `stopPolling()` cancels everything.
|
|
134
|
+
- Per-call `config.apiBaseUrl`/`headers` override/merge over the constructor's
|
|
135
|
+
`baseUrl`/`headers`.
|
|
136
|
+
|
|
137
|
+
## E2E Tests
|
|
138
|
+
|
|
139
|
+
Integration checklist — drive the real status page in the live preview (no
|
|
140
|
+
mocks), adapt each item to this app's actual screens, and check every box
|
|
141
|
+
off one by one. A box you can't check is an integration bug to fix — not a
|
|
142
|
+
skip:
|
|
143
|
+
|
|
144
|
+
- [ ] Every monitored service returned by `fetchStatus` renders as its own
|
|
145
|
+
tile/row showing the service name and a status indicator, grouped by
|
|
146
|
+
`groupName` when present — no service silently missing from the page.
|
|
147
|
+
- [ ] Each status indicator reflects that service's real `ServiceStatus`: an
|
|
148
|
+
`operational` service shows the up/green treatment, `down` shows the
|
|
149
|
+
down/red treatment, and `degraded`/`unknown` each show their own distinct
|
|
150
|
+
state — never one uniform color regardless of status.
|
|
151
|
+
- [ ] The overall system-status banner is DERIVED from the tiles, not
|
|
152
|
+
hardcoded: with all services operational it reads operational; flip one
|
|
153
|
+
service to `down` in the data and the banner flips to down/degraded on the
|
|
154
|
+
next fetch — it never stays green while a tile is red.
|
|
155
|
+
- [ ] Metric values render as real numbers with units — service latency as
|
|
156
|
+
e.g. `142 ms` and each `UptimeWindow` as a percentage (e.g. `99.98%`) for
|
|
157
|
+
the selected window (1h/24h/7d/30d/90d) — not `0`, `NaN`, or a placeholder.
|
|
158
|
+
- [ ] Active incidents render with title, severity, and status; when there
|
|
159
|
+
are none the page shows an all-clear/empty state, not a blank or broken
|
|
160
|
+
incidents area.
|
|
161
|
+
- [ ] Polling updates the tiles without a manual reload: with `startPolling`
|
|
162
|
+
running, change the underlying status and confirm the affected tile AND the
|
|
163
|
+
overall banner update on the next poll; navigating away calls the returned
|
|
164
|
+
stop function so polls don't pile up.
|
|
165
|
+
- [ ] Loading and failure are observable: a loading indicator shows while
|
|
166
|
+
`fetchStatus` is in flight, and a fetch error surfaces a visible message
|
|
167
|
+
(from `state.error`) — never a blank page or a stale dashboard shown as
|
|
168
|
+
fresh.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-status-dashboard-http",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "HTTP status dashboard provider implementation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"files": [
|
|
20
|
-
"dist"
|
|
20
|
+
"dist",
|
|
21
|
+
"README.md"
|
|
21
22
|
],
|
|
22
23
|
"keywords": [
|
|
23
24
|
"molecule",
|
|
@@ -27,15 +28,15 @@
|
|
|
27
28
|
],
|
|
28
29
|
"license": "Apache-2.0",
|
|
29
30
|
"devDependencies": {
|
|
30
|
-
"@molecule/app-status-dashboard": "1.0.
|
|
31
|
-
"@molecule/app-i18n": "1.0.
|
|
31
|
+
"@molecule/app-status-dashboard": "1.0.2",
|
|
32
|
+
"@molecule/app-i18n": "1.0.2",
|
|
32
33
|
"@types/node": "26.1.2",
|
|
33
34
|
"typescript": "6.0.3",
|
|
34
|
-
"vitest": "4.1.
|
|
35
|
+
"vitest": "4.1.11"
|
|
35
36
|
},
|
|
36
37
|
"peerDependencies": {
|
|
37
|
-
"@molecule/app-status-dashboard": "^1.0.
|
|
38
|
-
"@molecule/app-i18n": "^1.0.
|
|
38
|
+
"@molecule/app-status-dashboard": "^1.0.1",
|
|
39
|
+
"@molecule/app-i18n": "^1.0.1"
|
|
39
40
|
},
|
|
40
41
|
"peerDependenciesMeta": {
|
|
41
42
|
"@molecule/app-status-dashboard": {
|
|
@@ -47,7 +48,7 @@
|
|
|
47
48
|
"url": "https://github.com/molecule-dev/molecule.git",
|
|
48
49
|
"directory": "packages/app/bonds/status-dashboard/http"
|
|
49
50
|
},
|
|
50
|
-
"homepage": "https://
|
|
51
|
+
"homepage": "https://www.molecule.dev/packages/app-status-dashboard-http",
|
|
51
52
|
"bugs": "https://github.com/molecule-dev/molecule/issues",
|
|
52
53
|
"publishConfig": {
|
|
53
54
|
"access": "public"
|