@molecule/api-resource-status-page 1.0.8 → 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-10-26T04:23:56.122Z
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-monitoring @molecule/api-notifications @molecule/api-permissions @molecule/api-resource @molecule/api-scheduler zod
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
@@ -146,7 +146,7 @@ export async function isStatusAdmin(res) {
146
146
  export const requireAdmin = () => async (_req, res, next) => {
147
147
  const session = res.locals.session;
148
148
  if (!session?.userId) {
149
- return next(t('resource.error.unauthorized', undefined, { defaultValue: 'Unauthorized' }));
149
+ return next(t('resource.error.unauthorized', undefined, { defaultValue: 'Unauthorized.' }));
150
150
  }
151
151
  if (await isStatusAdmin(res)) {
152
152
  return next();
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/authorizers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAA;AAGtC,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;AAE1B;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,QAAQ,CAAA;AAEhD;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,QAAQ,CAAA;AAElD;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,0BAA0B,IAAI,wBAAwB,EAAE,CAAA;AAqBlG;;;;;;;GAOG;AACH,SAAS,mBAAmB,CAAC,OAAkC;IAC7D,IAAI,CA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,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@molecule/api-resource-status-page",
3
- "version": "1.0.8",
4
- "description": "System status page resource for molecule.dev.",
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.4",
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.2"
40
+ "@molecule/api-locales-status-page": "1.0.4"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "@molecule/api-bond": "^1.0.1",
@@ -1,12 +1,11 @@
1
1
  CREATE TABLE IF NOT EXISTS "checks" (
2
- "id" uuid UNIQUE PRIMARY KEY NOT NULL,
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 UNIQUE PRIMARY KEY NOT NULL,
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 UNIQUE PRIMARY KEY NOT NULL,
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 UNIQUE PRIMARY KEY NOT NULL,
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");