watchfor 0.4.0 → 0.5.0

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
@@ -31,6 +31,13 @@ await wf.alertRules.create(monitor.id!, {
31
31
  value: "2000",
32
32
  severity: "warning",
33
33
  });
34
+
35
+ // False positive? Keep the resolved incident on record but drop it from
36
+ // uptime, SLA, reports and the status page (include() undoes it).
37
+ await wf.incidents.exclude(19351, { reason: "Probe-side DNS hiccup" });
38
+
39
+ // Irreversible: wipe a monitor's checks and incidents; uptime restarts "since reset".
40
+ await wf.monitors.reset(monitor.id!);
34
41
  ```
35
42
 
36
43
  - Fully typed from the [OpenAPI spec](https://watchfor.io/openapi.json)
@@ -52,5 +59,5 @@ npx watchfor report --period 30d
52
59
  ## Links
53
60
 
54
61
  - API docs: https://watchfor.io/docs/api
55
- - MCP server for AI agents (40 tools): https://watchfor.io/docs/api/mcp
62
+ - MCP server for AI agents (42 tools): https://watchfor.io/docs/api/mcp
56
63
  - Create an API key: dashboard → Settings → API keys (`read` or `read+write` scope)
package/dist/client.d.ts CHANGED
@@ -7,6 +7,7 @@ import type { components } from "./schema.js";
7
7
  * const summary = await wf.summary();
8
8
  */
9
9
  export type Monitor = components["schemas"]["Monitor"];
10
+ export type MonitorReset = components["schemas"]["MonitorReset"];
10
11
  export type Incident = components["schemas"]["Incident"];
11
12
  export type AlertRule = components["schemas"]["AlertRule"];
12
13
  export type Contact = components["schemas"]["Contact"];
@@ -98,6 +99,10 @@ export declare class WatchFor {
98
99
  pause: (id: string) => Promise<Monitor>;
99
100
  resume: (id: string) => Promise<Monitor>;
100
101
  checkNow: (id: string) => Promise<unknown>;
102
+ /** IRREVERSIBLE: delete every check, incident, note and post-mortem of
103
+ * the monitor and start uptime over ("since reset"). The monitor and
104
+ * its configuration, alert rules, tags and locations stay. */
105
+ reset: (id: string) => Promise<MonitorReset>;
101
106
  uptime: (id: string, period?: "1h" | "24h" | "7d" | "30d" | "90d") => Promise<Uptime>;
102
107
  checks: (id: string, q?: {
103
108
  hours?: number;
@@ -125,6 +130,14 @@ export declare class WatchFor {
125
130
  get: (id: number) => Promise<Incident>;
126
131
  acknowledge: (id: number) => Promise<Incident>;
127
132
  resolve: (id: number) => Promise<Incident>;
133
+ /** Mark a RESOLVED incident as a false positive: kept on record, left
134
+ * out of uptime, SLA, reports and the public status page. 409 while
135
+ * the incident is still open. */
136
+ exclude: (id: number, body?: {
137
+ reason?: string;
138
+ }) => Promise<Incident>;
139
+ /** Undo `exclude` — the incident counts as downtime again. */
140
+ include: (id: number) => Promise<Incident>;
128
141
  };
129
142
  readonly maintenanceWindows: {
130
143
  list: (q?: {
package/dist/client.js CHANGED
@@ -122,6 +122,10 @@ export class WatchFor {
122
122
  pause: (id) => this.request("POST", `/monitors/${id}/pause`),
123
123
  resume: (id) => this.request("POST", `/monitors/${id}/resume`),
124
124
  checkNow: (id) => this.request("POST", `/monitors/${id}/check-now`),
125
+ /** IRREVERSIBLE: delete every check, incident, note and post-mortem of
126
+ * the monitor and start uptime over ("since reset"). The monitor and
127
+ * its configuration, alert rules, tags and locations stay. */
128
+ reset: (id) => this.request("POST", `/monitors/${id}/reset`),
125
129
  uptime: (id, period) => this.request("GET", `/monitors/${id}/uptime`, { query: { period } }),
126
130
  checks: (id, q) => this.request("GET", `/monitors/${id}/checks`, { query: q }),
127
131
  };
@@ -144,6 +148,12 @@ export class WatchFor {
144
148
  get: (id) => this.request("GET", `/incidents/${id}`),
145
149
  acknowledge: (id) => this.request("POST", `/incidents/${id}/acknowledge`),
146
150
  resolve: (id) => this.request("POST", `/incidents/${id}/resolve`),
151
+ /** Mark a RESOLVED incident as a false positive: kept on record, left
152
+ * out of uptime, SLA, reports and the public status page. 409 while
153
+ * the incident is still open. */
154
+ exclude: (id, body) => this.request("POST", `/incidents/${id}/exclude`, { body: body ?? {} }),
155
+ /** Undo `exclude` — the incident counts as downtime again. */
156
+ include: (id) => this.request("POST", `/incidents/${id}/include`),
147
157
  };
148
158
  // ── Maintenance windows ───────────────────────────────────────
149
159
  maintenanceWindows = {
package/dist/index.d.ts CHANGED
@@ -1 +1 @@
1
- export { type ActivityEvent, type AlertRule, type ApiErrorBody, type Check, type Contact, type ContactGroup, type Incident, type IncidentStats, type List, type MaintenanceWindow, type Monitor, type Notification, type Plan, type StatusPage, type Summary, type Uptime, WatchFor, WatchForError, type WatchForOptions, } from "./client.js";
1
+ export { type ActivityEvent, type AlertRule, type ApiErrorBody, type Check, type Contact, type ContactGroup, type Incident, type IncidentStats, type List, type MaintenanceWindow, type Monitor, type MonitorReset, type Notification, type Plan, type StatusPage, type Summary, type Uptime, WatchFor, WatchForError, type WatchForOptions, } from "./client.js";
package/dist/schema.d.ts CHANGED
@@ -180,6 +180,26 @@ export interface paths {
180
180
  patch?: never;
181
181
  trace?: never;
182
182
  };
183
+ "/monitors/{id}/reset": {
184
+ parameters: {
185
+ query?: never;
186
+ header?: never;
187
+ path?: never;
188
+ cookie?: never;
189
+ };
190
+ get?: never;
191
+ put?: never;
192
+ /**
193
+ * Reset history — delete every check, incident, note and post-mortem of the monitor and start uptime over (irreversible)
194
+ * @description The monitor keeps its id, configuration, alert rules, tags, locations and status-page membership. Everything it recorded is deleted: check and latency history, incidents with their timelines and delivery history, internal notes, post-mortems and the auto-published status-page incidents. Uptime is measured from the reset (the dashboard says 'since reset'). Owner/admin action in the dashboard; write scope here.
195
+ */
196
+ post: operations["resetMonitorHistory"];
197
+ delete?: never;
198
+ options?: never;
199
+ head?: never;
200
+ patch?: never;
201
+ trace?: never;
202
+ };
183
203
  "/monitors/{id}/uptime": {
184
204
  parameters: {
185
205
  query?: never;
@@ -336,6 +356,40 @@ export interface paths {
336
356
  patch?: never;
337
357
  trace?: never;
338
358
  };
359
+ "/incidents/{id}/exclude": {
360
+ parameters: {
361
+ query?: never;
362
+ header?: never;
363
+ path?: never;
364
+ cookie?: never;
365
+ };
366
+ get?: never;
367
+ put?: never;
368
+ /** Mark a resolved incident as a false positive — kept on record, excluded from uptime, SLA, reports and the public status page */
369
+ post: operations["excludeIncidentFromUptime"];
370
+ delete?: never;
371
+ options?: never;
372
+ head?: never;
373
+ patch?: never;
374
+ trace?: never;
375
+ };
376
+ "/incidents/{id}/include": {
377
+ parameters: {
378
+ query?: never;
379
+ header?: never;
380
+ path?: never;
381
+ cookie?: never;
382
+ };
383
+ get?: never;
384
+ put?: never;
385
+ /** Undo a false-positive mark — the incident counts as downtime again */
386
+ post: operations["includeIncidentInUptime"];
387
+ delete?: never;
388
+ options?: never;
389
+ head?: never;
390
+ patch?: never;
391
+ trace?: never;
392
+ };
339
393
  "/incidents/{id}/mark-maintenance": {
340
394
  parameters: {
341
395
  query?: never;
@@ -736,6 +790,11 @@ export interface components {
736
790
  config?: Record<string, never>;
737
791
  /** Format: date-time */
738
792
  created_at?: string;
793
+ /**
794
+ * Format: date-time
795
+ * @description Set by POST /monitors/{id}/reset; uptime windows start here instead of at created_at
796
+ */
797
+ history_reset_at?: string | null;
739
798
  /** Format: date-time */
740
799
  updated_at?: string;
741
800
  };
@@ -902,6 +961,27 @@ export interface components {
902
961
  resolved_at?: string | null;
903
962
  /** @description started_at → resolved_at in seconds; null while open */
904
963
  duration_seconds?: number | null;
964
+ /** @description Marked as a false positive: the incident stays on record but is left out of uptime, SLA, reports and the public status page (POST /incidents/{id}/exclude) */
965
+ excluded_from_uptime?: boolean;
966
+ exclusion_reason?: string | null;
967
+ excluded_by?: string | null;
968
+ /** Format: date-time */
969
+ excluded_at?: string | null;
970
+ };
971
+ MonitorReset: {
972
+ /** @constant */
973
+ object?: "monitor_reset";
974
+ /** Format: uuid */
975
+ monitor_id?: string;
976
+ /** Format: date-time */
977
+ reset_at?: string;
978
+ incidents_deleted?: number;
979
+ postmortems_deleted?: number;
980
+ comments_deleted?: number;
981
+ status_page_incidents_deleted?: number;
982
+ check_history_deleted?: boolean;
983
+ /** @description Best-effort steps that failed (e.g. clickhouse); the reset marker is set regardless */
984
+ warnings?: string[];
905
985
  };
906
986
  MaintenanceWindow: {
907
987
  /** Format: uuid */
@@ -1911,6 +1991,41 @@ export interface operations {
1911
1991
  };
1912
1992
  };
1913
1993
  };
1994
+ resetMonitorHistory: {
1995
+ parameters: {
1996
+ query?: never;
1997
+ header?: {
1998
+ /** @description Unique key for safe retries (Stripe semantics, 24h window): the same key + body replays the original response instead of re-creating. */
1999
+ "Idempotency-Key"?: string;
2000
+ };
2001
+ path: {
2002
+ /** @description Resource id (UUID) */
2003
+ id: string;
2004
+ };
2005
+ cookie?: never;
2006
+ };
2007
+ requestBody?: never;
2008
+ responses: {
2009
+ /** @description History deleted; counts of what went */
2010
+ 200: {
2011
+ headers: {
2012
+ [name: string]: unknown;
2013
+ };
2014
+ content: {
2015
+ "application/json": components["schemas"]["MonitorReset"];
2016
+ };
2017
+ };
2018
+ /** @description Error */
2019
+ default: {
2020
+ headers: {
2021
+ [name: string]: unknown;
2022
+ };
2023
+ content: {
2024
+ "application/json": components["schemas"]["Error"];
2025
+ };
2026
+ };
2027
+ };
2028
+ };
1914
2029
  getMonitorUptime: {
1915
2030
  parameters: {
1916
2031
  query?: {
@@ -2340,6 +2455,92 @@ export interface operations {
2340
2455
  };
2341
2456
  };
2342
2457
  };
2458
+ excludeIncidentFromUptime: {
2459
+ parameters: {
2460
+ query?: never;
2461
+ header?: {
2462
+ /** @description Unique key for safe retries (Stripe semantics, 24h window): the same key + body replays the original response instead of re-creating. */
2463
+ "Idempotency-Key"?: string;
2464
+ };
2465
+ path: {
2466
+ /** @description Incident id (integer) */
2467
+ id: string;
2468
+ };
2469
+ cookie?: never;
2470
+ };
2471
+ requestBody?: {
2472
+ content: {
2473
+ "application/json": {
2474
+ /** @description Why this was not real downtime */
2475
+ reason?: string;
2476
+ };
2477
+ };
2478
+ };
2479
+ responses: {
2480
+ /** @description Incident with excluded_from_uptime = true */
2481
+ 200: {
2482
+ headers: {
2483
+ [name: string]: unknown;
2484
+ };
2485
+ content: {
2486
+ "application/json": components["schemas"]["Incident"];
2487
+ };
2488
+ };
2489
+ /** @description Incident is still open — resolve it first */
2490
+ 409: {
2491
+ headers: {
2492
+ [name: string]: unknown;
2493
+ };
2494
+ content: {
2495
+ "application/json": components["schemas"]["Error"];
2496
+ };
2497
+ };
2498
+ /** @description Error */
2499
+ default: {
2500
+ headers: {
2501
+ [name: string]: unknown;
2502
+ };
2503
+ content: {
2504
+ "application/json": components["schemas"]["Error"];
2505
+ };
2506
+ };
2507
+ };
2508
+ };
2509
+ includeIncidentInUptime: {
2510
+ parameters: {
2511
+ query?: never;
2512
+ header?: {
2513
+ /** @description Unique key for safe retries (Stripe semantics, 24h window): the same key + body replays the original response instead of re-creating. */
2514
+ "Idempotency-Key"?: string;
2515
+ };
2516
+ path: {
2517
+ /** @description Incident id (integer) */
2518
+ id: string;
2519
+ };
2520
+ cookie?: never;
2521
+ };
2522
+ requestBody?: never;
2523
+ responses: {
2524
+ /** @description Incident with excluded_from_uptime = false */
2525
+ 200: {
2526
+ headers: {
2527
+ [name: string]: unknown;
2528
+ };
2529
+ content: {
2530
+ "application/json": components["schemas"]["Incident"];
2531
+ };
2532
+ };
2533
+ /** @description Error */
2534
+ default: {
2535
+ headers: {
2536
+ [name: string]: unknown;
2537
+ };
2538
+ content: {
2539
+ "application/json": components["schemas"]["Error"];
2540
+ };
2541
+ };
2542
+ };
2543
+ };
2343
2544
  markIncidentMaintenance: {
2344
2545
  parameters: {
2345
2546
  query?: never;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "watchfor",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Official TypeScript SDK + CLI for WatchFor \u2014 uptime & infrastructure monitoring (monitors, alert rules, incidents, maintenance windows) over the REST API.",
5
5
  "keywords": [
6
6
  "watchfor",