@hasna/uptime 0.1.0 → 0.1.1

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
@@ -6,6 +6,33 @@ project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.1.1] - 2026-06-28
10
+
11
+ ### Added
12
+
13
+ - Report generation and optional delivery through Open Mailery email, Open
14
+ Telephony SMS, and Open Logs structured logs.
15
+ - `uptime report`, `GET /api/report`, `POST /api/report`,
16
+ `uptime_send_report`, and SDK report helpers.
17
+
18
+ ### Fixed
19
+
20
+ - Prevented stale in-flight checks from overwriting monitor updates, target
21
+ changes, or pauses.
22
+ - Closed existing open incidents when a monitor target is changed, without
23
+ marking the old target as recovered by the new target.
24
+ - Added SQLite-backed check leases to avoid duplicate due checks across
25
+ multiple service instances sharing one database.
26
+ - Rejected non-boolean `enabled` values at the SDK/API boundary.
27
+ - Counted all open incidents in summaries instead of using the paginated
28
+ incident-list cap.
29
+ - Rejected control characters in monitor names and TCP hosts, and sanitized
30
+ human CLI output for legacy stored values.
31
+ - Rejected state-changing API requests for non-loopback Host values unless a
32
+ configured API token or explicit unsafe mode is used.
33
+
34
+ ## [0.1.0] - 2026-06-28
35
+
9
36
  ### Added
10
37
 
11
38
  - Initial local-first uptime and downtime monitoring service.
package/README.md CHANGED
@@ -24,6 +24,9 @@ uptime add postgres --tcp db.internal --port 5432
24
24
  uptime list
25
25
  uptime check --all
26
26
  uptime summary
27
+ uptime report --dry-run
28
+ uptime report --email ops@example.com --from alerts@example.com --send-key "$MAILERY_SEND_KEY"
29
+ uptime report --sms +15550000001 --logs
27
30
  uptime incidents
28
31
  uptime serve --port 3899 --check
29
32
  ```
@@ -34,8 +37,11 @@ The local dashboard and API bind to `127.0.0.1` by default:
34
37
  open http://127.0.0.1:3899
35
38
  ```
36
39
 
37
- State-changing API requests reject cross-origin browser requests. Endpoints that
38
- accept request bodies require `content-type: application/json`.
40
+ State-changing API requests reject cross-origin browser requests and
41
+ non-loopback mutation hosts by default. For a trusted remote bind, set
42
+ `HASNA_UPTIME_API_TOKEN` or pass `uptime serve --api-token <token>` and send
43
+ `Authorization: Bearer <token>` or `X-Uptime-Token: <token>`.
44
+ Endpoints that accept request bodies require `content-type: application/json`.
39
45
 
40
46
  ## Uptime Semantics
41
47
 
@@ -64,7 +70,7 @@ claude mcp add --scope user uptime -- uptime-mcp
64
70
  ```
65
71
 
66
72
  The MCP server exposes monitor CRUD, check execution, summary, incident, and
67
- result tools.
73
+ result tools, plus an `uptime_send_report` tool for report delivery.
68
74
 
69
75
  ## SDK
70
76
 
@@ -81,6 +87,17 @@ await uptime.createMonitor({
81
87
 
82
88
  await uptime.checkAll();
83
89
  console.log(await uptime.summary());
90
+
91
+ await uptime.sendReport({
92
+ email: {
93
+ apiUrl: "http://localhost:3900",
94
+ sendKey: process.env.MAILERY_SEND_KEY,
95
+ from: "alerts@example.com",
96
+ to: "ops@example.com",
97
+ },
98
+ sms: { apiUrl: "http://localhost:19451", to: "+15550000001" },
99
+ logs: { apiUrl: "http://localhost:3460", apiKey: process.env.HASNA_LOGS_API_TOKEN, projectId: "open-uptime" },
100
+ });
84
101
  ```
85
102
 
86
103
  ## API
@@ -89,6 +106,8 @@ Run `uptime serve` and use:
89
106
 
90
107
  - `GET /health`
91
108
  - `GET /api/summary`
109
+ - `GET /api/report`
110
+ - `POST /api/report`
92
111
  - `GET /api/monitors`
93
112
  - `POST /api/monitors`
94
113
  - `GET /api/monitors/:id`
@@ -109,6 +128,7 @@ First release:
109
128
  - uptime percentage and latency summaries
110
129
  - local dashboard/API
111
130
  - CLI, MCP, SDK, and tests
131
+ - Optional report delivery through Open Mailery, Open Telephony, and Open Logs
112
132
 
113
133
  Non-goals for this first release:
114
134
 
@@ -116,7 +136,8 @@ Non-goals for this first release:
116
136
  - hosted multi-tenant SaaS billing
117
137
  - synthetic browser journeys
118
138
  - public incident pages
119
- - external notification providers beyond extension points
139
+ - provider-owned delivery configuration; Open Uptime sends through existing
140
+ Mailery, Telephony, and Logs services instead of storing their credentials
120
141
 
121
142
  ## License
122
143
 
package/dist/api.d.ts CHANGED
@@ -5,8 +5,16 @@ export interface ServeOptions extends UptimeServiceOptions {
5
5
  port?: number;
6
6
  check?: boolean;
7
7
  service?: UptimeService;
8
+ apiToken?: string;
9
+ allowUnsafeRemoteMutations?: boolean;
8
10
  }
9
- export declare function createApiHandler(service: UptimeService): (request: Request) => Promise<Response>;
11
+ export interface CreateApiHandlerOptions {
12
+ apiToken?: string;
13
+ allowUnsafeRemoteMutations?: boolean;
14
+ fetchImpl?: typeof fetch;
15
+ trustedLoopback?: boolean;
16
+ }
17
+ export declare function createApiHandler(service: UptimeService, options?: CreateApiHandlerOptions): (request: Request) => Promise<Response>;
10
18
  export declare function serveUptime(options?: ServeOptions): {
11
19
  server: ReturnType<typeof Bun.serve>;
12
20
  service: UptimeService;
package/dist/api.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,KAAK,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,WAAW,YAAa,SAAQ,oBAAoB;IACxD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,aAAa,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CA8DhG;AAED,wBAAgB,WAAW,CAAC,OAAO,GAAE,YAAiB,GAAG;IAAE,MAAM,EAAE,UAAU,CAAC,OAAO,GAAG,CAAC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