@molecule/api-resource-status-page 1.0.9 → 1.0.10
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-
|
|
6
|
+
Generated: 2026-11-22T19:00:41.814Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/api-resource-status-page
|
|
@@ -59,7 +59,7 @@ const requestHandlerMap = createRequestHandlerMap(createRequestHandler)
|
|
|
59
59
|
## Installation
|
|
60
60
|
|
|
61
61
|
```bash
|
|
62
|
-
npm install @molecule/api-resource-status-page @molecule/api-bond @molecule/api-database @molecule/api-i18n @molecule/api-locales-status-page @molecule/api-
|
|
62
|
+
npm install @molecule/api-resource-status-page @molecule/api-bond @molecule/api-database @molecule/api-i18n @molecule/api-locales-status-page @molecule/api-resource zod
|
|
63
63
|
```
|
|
64
64
|
|
|
65
65
|
## API
|
|
@@ -905,11 +905,11 @@ Peer dependencies:
|
|
|
905
905
|
- `@molecule/api-bond` ^1.0.1
|
|
906
906
|
- `@molecule/api-database` ^1.0.1
|
|
907
907
|
- `@molecule/api-i18n` ^1.0.1
|
|
908
|
-
- `@molecule/api-monitoring` ^1.0.1
|
|
909
|
-
- `@molecule/api-notifications` ^1.0.1
|
|
910
|
-
- `@molecule/api-permissions` ^1.0.1
|
|
908
|
+
- `@molecule/api-monitoring` ^1.0.1 _(optional)_
|
|
909
|
+
- `@molecule/api-notifications` ^1.0.1 _(optional)_
|
|
910
|
+
- `@molecule/api-permissions` ^1.0.1 _(optional)_
|
|
911
911
|
- `@molecule/api-resource` ^1.0.1
|
|
912
|
-
- `@molecule/api-scheduler` ^1.0.1
|
|
912
|
+
- `@molecule/api-scheduler` ^1.0.1 _(optional)_
|
|
913
913
|
- `@molecule/api-locales-status-page` ^1.0.1
|
|
914
914
|
|
|
915
915
|
### Runtime Dependencies
|
|
@@ -918,11 +918,11 @@ Peer dependencies:
|
|
|
918
918
|
- `@molecule/api-database`
|
|
919
919
|
- `@molecule/api-i18n`
|
|
920
920
|
- `@molecule/api-locales-status-page`
|
|
921
|
-
- `@molecule/api-monitoring`
|
|
922
|
-
- `@molecule/api-notifications`
|
|
923
|
-
- `@molecule/api-permissions`
|
|
921
|
+
- `@molecule/api-monitoring` _(optional)_
|
|
922
|
+
- `@molecule/api-notifications` _(optional)_
|
|
923
|
+
- `@molecule/api-permissions` _(optional)_
|
|
924
924
|
- `@molecule/api-resource`
|
|
925
|
-
- `@molecule/api-scheduler`
|
|
925
|
+
- `@molecule/api-scheduler` _(optional)_
|
|
926
926
|
- `zod`
|
|
927
927
|
|
|
928
928
|
The GET routes are PUBLIC by design — a status page is a public surface; do
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/api-resource-status-page",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.0.10",
|
|
4
|
+
"description": "Status page resource with service monitoring, incidents, and uptime",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
"zod": "4.6.7"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@molecule/api-bond": "1.0.
|
|
35
|
+
"@molecule/api-bond": "1.0.5",
|
|
36
36
|
"@molecule/api-permissions": "1.0.4",
|
|
37
37
|
"@types/node": "26.6.5",
|
|
38
38
|
"typescript": "6.0.3",
|
|
39
39
|
"vitest": "4.1.12",
|
|
40
|
-
"@molecule/api-locales-status-page": "1.0.
|
|
40
|
+
"@molecule/api-locales-status-page": "1.0.4"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"@molecule/api-bond": "^1.0.1",
|
package/src/__setup__/checks.sql
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
CREATE TABLE IF NOT EXISTS "checks" (
|
|
2
|
-
"id" uuid
|
|
2
|
+
"id" uuid PRIMARY KEY NOT NULL,
|
|
3
3
|
"serviceId" uuid NOT NULL REFERENCES "services"("id") ON DELETE CASCADE,
|
|
4
|
-
"status" varchar(20) NOT NULL,
|
|
4
|
+
"status" varchar(20) NOT NULL CHECK ("status" IN ('up', 'down', 'degraded')),
|
|
5
5
|
"httpStatus" integer,
|
|
6
|
-
"latencyMs" integer,
|
|
6
|
+
"latencyMs" integer CHECK ("latencyMs" >= 0),
|
|
7
7
|
"error" text,
|
|
8
8
|
"checkedAt" timestamptz DEFAULT current_timestamp NOT NULL
|
|
9
9
|
);
|
|
10
|
-
CREATE INDEX IF NOT EXISTS "checks_serviceId_index" ON "checks" ("serviceId");
|
|
11
10
|
CREATE INDEX IF NOT EXISTS "checks_checkedAt_index" ON "checks" ("checkedAt");
|
|
12
11
|
CREATE INDEX IF NOT EXISTS "checks_serviceId_checkedAt_index" ON "checks" ("serviceId", "checkedAt" DESC);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
CREATE TABLE IF NOT EXISTS "incidents" (
|
|
2
|
-
"id" uuid
|
|
2
|
+
"id" uuid PRIMARY KEY NOT NULL,
|
|
3
3
|
"createdAt" timestamptz DEFAULT current_timestamp NOT NULL,
|
|
4
4
|
"updatedAt" timestamptz DEFAULT current_timestamp NOT NULL,
|
|
5
5
|
"serviceId" uuid NOT NULL REFERENCES "services"("id") ON DELETE CASCADE,
|
|
6
6
|
"title" varchar(500) NOT NULL,
|
|
7
7
|
"description" text,
|
|
8
|
-
"severity" varchar(20) NOT NULL,
|
|
9
|
-
"status" varchar(20) NOT NULL,
|
|
8
|
+
"severity" varchar(20) NOT NULL CHECK ("severity" IN ('minor', 'major', 'critical')),
|
|
9
|
+
"status" varchar(20) NOT NULL CHECK ("status" IN ('investigating', 'identified', 'monitoring', 'resolved')),
|
|
10
10
|
"autoDetected" boolean DEFAULT false NOT NULL,
|
|
11
11
|
"startedAt" timestamptz NOT NULL,
|
|
12
12
|
"resolvedAt" timestamptz
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
CREATE TABLE IF NOT EXISTS "services" (
|
|
2
|
-
"id" uuid
|
|
2
|
+
"id" uuid PRIMARY KEY NOT NULL,
|
|
3
3
|
"createdAt" timestamptz DEFAULT current_timestamp NOT NULL,
|
|
4
4
|
"updatedAt" timestamptz DEFAULT current_timestamp NOT NULL,
|
|
5
5
|
"name" varchar(255) NOT NULL,
|
|
6
6
|
"url" text NOT NULL,
|
|
7
|
-
"method" varchar(10) DEFAULT 'GET' NOT NULL,
|
|
7
|
+
"method" varchar(10) DEFAULT 'GET' NOT NULL CHECK ("method" IN ('GET', 'HEAD', 'POST')),
|
|
8
8
|
"expectedStatus" integer DEFAULT 200 NOT NULL,
|
|
9
9
|
"timeoutMs" integer DEFAULT 10000 NOT NULL,
|
|
10
10
|
"intervalMs" integer DEFAULT 60000 NOT NULL,
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
CREATE TABLE IF NOT EXISTS "uptimeWindows" (
|
|
2
|
-
"id" uuid
|
|
2
|
+
"id" uuid PRIMARY KEY NOT NULL,
|
|
3
3
|
"serviceId" uuid NOT NULL REFERENCES "services"("id") ON DELETE CASCADE,
|
|
4
|
-
"window" varchar(10) NOT NULL,
|
|
5
|
-
"uptimePct" numeric(6,3) NOT NULL,
|
|
6
|
-
"totalChecks" integer NOT NULL,
|
|
7
|
-
"upChecks" integer NOT NULL,
|
|
8
|
-
"avgLatencyMs" numeric(10,2) NOT NULL
|
|
4
|
+
"window" varchar(10) NOT NULL CHECK ("window" IN ('1h', '24h', '7d', '30d', '90d')),
|
|
5
|
+
"uptimePct" numeric(6,3) NOT NULL CHECK ("uptimePct" BETWEEN 0 AND 100),
|
|
6
|
+
"totalChecks" integer NOT NULL CHECK ("totalChecks" >= 0),
|
|
7
|
+
"upChecks" integer NOT NULL CHECK ("upChecks" BETWEEN 0 AND "totalChecks"),
|
|
8
|
+
"avgLatencyMs" numeric(10,2) NOT NULL CHECK ("avgLatencyMs" >= 0)
|
|
9
9
|
);
|
|
10
|
-
CREATE INDEX IF NOT EXISTS "uptimeWindows_serviceId_index" ON "uptimeWindows" ("serviceId");
|
|
11
10
|
CREATE UNIQUE INDEX IF NOT EXISTS "uptimeWindows_serviceId_window_index" ON "uptimeWindows" ("serviceId", "window");
|