watchfor 0.16.0 → 0.17.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
@@ -36,6 +36,12 @@ await wf.alertRules.create(monitor.id!, {
36
36
  // uptime, SLA, reports and the status page (include() undoes it).
37
37
  await wf.incidents.exclude(19351, { reason: "Probe-side DNS hiccup" });
38
38
 
39
+ // Post-mortem: creates the draft on first use; only the sections you name change.
40
+ await wf.incidents.updatePostmortem(19351, {
41
+ sections: { summary: "Checkout returned 502 for 14 minutes." },
42
+ add_action_items: [{ title: "Validate upstreams in CI" }],
43
+ });
44
+
39
45
  // Irreversible: wipe a monitor's checks and incidents; uptime restarts "since reset".
40
46
  await wf.monitors.reset(monitor.id!);
41
47
 
@@ -193,5 +199,5 @@ WATCHFOR_ORGANIZATION=<organization-id> npx watchfor summary
193
199
  ## Links
194
200
 
195
201
  - API docs: https://watchfor.io/docs/api
196
- - MCP server for AI agents (59 tools): https://watchfor.io/docs/api/mcp
202
+ - MCP server for AI agents (61 tools): https://watchfor.io/docs/api/mcp
197
203
  - Create an API key: dashboard → Settings → API keys (`read` or `read+write` scope)
package/dist/client.d.ts CHANGED
@@ -37,6 +37,10 @@ export type ScriptVersionSummary = components["schemas"]["ScriptVersionSummary"]
37
37
  export type Variable = components["schemas"]["Variable"];
38
38
  export type VariableDeleted = components["schemas"]["VariableDeleted"];
39
39
  export type Incident = components["schemas"]["Incident"];
40
+ /** An incident's post-mortem (plan feature). */
41
+ export type Postmortem = components["schemas"]["Postmortem"];
42
+ /** `incidents.updatePostmortem()` body — omitted fields are kept. */
43
+ export type PostmortemUpdate = components["schemas"]["PostmortemUpdate"];
40
44
  export type AlertRule = components["schemas"]["AlertRule"];
41
45
  export type Contact = components["schemas"]["Contact"];
42
46
  export type ContactGroup = components["schemas"]["ContactGroup"];
@@ -401,6 +405,14 @@ export declare class WatchFor {
401
405
  * it (marking again returns the same one); delete that window to
402
406
  * undo. */
403
407
  markMaintenance: (id: number, idempotencyKey?: string) => Promise<MaintenanceMarking>;
408
+ /** The incident's post-mortem. 404 when it has none yet —
409
+ * `updatePostmortem` creates it. */
410
+ getPostmortem: (id: number) => Promise<Postmortem>;
411
+ /** Create the post-mortem draft on first use, then apply only what is
412
+ * given: `sections` replaces just the sections named; `add_timeline`
413
+ * and `add_action_items` append (repeats skipped). Publishing and
414
+ * deleting stay in the dashboard. */
415
+ updatePostmortem: (id: number, body: PostmortemUpdate) => Promise<Postmortem>;
404
416
  };
405
417
  readonly statusPages: {
406
418
  list: (q?: {
package/dist/client.js CHANGED
@@ -318,6 +318,14 @@ export class WatchFor {
318
318
  markMaintenance: (id, idempotencyKey) => this.request("POST", `/incidents/${id}/mark-maintenance`, {
319
319
  idempotencyKey,
320
320
  }),
321
+ /** The incident's post-mortem. 404 when it has none yet —
322
+ * `updatePostmortem` creates it. */
323
+ getPostmortem: (id) => this.request("GET", `/incidents/${id}/postmortem`),
324
+ /** Create the post-mortem draft on first use, then apply only what is
325
+ * given: `sections` replaces just the sections named; `add_timeline`
326
+ * and `add_action_items` append (repeats skipped). Publishing and
327
+ * deleting stay in the dashboard. */
328
+ updatePostmortem: (id, body) => this.request("PATCH", `/incidents/${id}/postmortem`, { body }),
321
329
  };
322
330
  // ── Status pages, on-call, channels ──────────────────────────
323
331
  statusPages = {
package/dist/index.d.ts CHANGED
@@ -1 +1 @@
1
- export { type ActivityEvent, type AlertingState, type AlertRule, type Announcement, type AnnouncementCreate, type AnnouncementUpdate, type ApiErrorBody, type BatchOperation, type BatchResult, type BulkResult, type Check, type CheckList, type CheckNowAck, type Contact, type ContactGroup, type Deleted, type DiagnosticCatalog, type DiagnosticCatalogEntry, type DiagnosticReport, type DiagnosticRun, type DiagnosticSlug, type Incident, type IncidentStats, type IntegrityBaseline, type IntegrityBaselineAccept, type IntegrityBaselineAcceptPending, type List, type MaintenanceMarking, type MaintenanceWindow, type Me, type Monitor, type MonitorDetail, type MonitorReset, type Notification, ORGANIZATION_HEADER, type Organization, type Plan, type PlaywrightRun, type PlaywrightRunSummary, type PlaywrightTestRun, type PlaywrightTestRunAccepted, type PlaywrightTestRunRequest, type ReportFilters, type ResponseTimeBucket, type ScriptVersion, type ScriptVersionSummary, type StatusPage, type StatusPageComponentCreate, type StatusPageCreate, type StatusPageUpdate, type Summary, type Uptime, type Variable, type VariableDeleted, WatchFor, WatchForError, type WatchForGrade, type WatchForOptions, } from "./client.js";
1
+ export { type ActivityEvent, type AlertingState, type AlertRule, type Announcement, type AnnouncementCreate, type AnnouncementUpdate, type ApiErrorBody, type BatchOperation, type BatchResult, type BulkResult, type Check, type CheckList, type CheckNowAck, type Contact, type ContactGroup, type Deleted, type DiagnosticCatalog, type DiagnosticCatalogEntry, type DiagnosticReport, type DiagnosticRun, type DiagnosticSlug, type Incident, type IncidentStats, type IntegrityBaseline, type IntegrityBaselineAccept, type IntegrityBaselineAcceptPending, type List, type MaintenanceMarking, type MaintenanceWindow, type Me, type Monitor, type MonitorDetail, type MonitorReset, type Notification, ORGANIZATION_HEADER, type Organization, type Plan, type PlaywrightRun, type PlaywrightRunSummary, type PlaywrightTestRun, type PlaywrightTestRunAccepted, type PlaywrightTestRunRequest, type Postmortem, type PostmortemUpdate, type ReportFilters, type ResponseTimeBucket, type ScriptVersion, type ScriptVersionSummary, type StatusPage, type StatusPageComponentCreate, type StatusPageCreate, type StatusPageUpdate, type Summary, type Uptime, type Variable, type VariableDeleted, WatchFor, WatchForError, type WatchForGrade, type WatchForOptions, } from "./client.js";
package/dist/schema.d.ts CHANGED
@@ -665,6 +665,30 @@ export interface paths {
665
665
  patch?: never;
666
666
  trace?: never;
667
667
  };
668
+ "/incidents/{id}/postmortem": {
669
+ parameters: {
670
+ query?: never;
671
+ header?: never;
672
+ path?: never;
673
+ cookie?: never;
674
+ };
675
+ /**
676
+ * Get the incident's post-mortem
677
+ * @description Plan feature (post-mortems). 404 when the incident is not in this organization, or when it has no post-mortem yet (the message says so — PATCH creates it).
678
+ */
679
+ get: operations["getIncidentPostmortem"];
680
+ put?: never;
681
+ post?: never;
682
+ delete?: never;
683
+ options?: never;
684
+ head?: never;
685
+ /**
686
+ * Create or update the incident's post-mortem draft
687
+ * @description Creates the post-mortem with the dashboard's template on first use (title from the monitor, severity from the incident), then applies the fields given. Any member may write and complete post-mortems, as in the dashboard; publishing to the status page and deleting stay owner/admin actions in the dashboard. Every change lands in the activity log.
688
+ */
689
+ patch: operations["updateIncidentPostmortem"];
690
+ trace?: never;
691
+ };
668
692
  "/incidents/{id}/mark-maintenance": {
669
693
  parameters: {
670
694
  query?: never;
@@ -1036,7 +1060,7 @@ export interface paths {
1036
1060
  path?: never;
1037
1061
  cookie?: never;
1038
1062
  };
1039
- /** One-call org snapshot: monitor status counts, active incidents, open maintenance */
1063
+ /** One-call org snapshot: monitor status counts, active incidents, open maintenance, expiring certificates and domains */
1040
1064
  get: operations["getOrgSummary"];
1041
1065
  put?: never;
1042
1066
  post?: never;
@@ -1974,7 +1998,12 @@ export interface components {
1974
1998
  timestamp?: string;
1975
1999
  success?: boolean;
1976
2000
  duration_ms?: number;
2001
+ /** @description The probe location's system name */
1977
2002
  location?: string;
2003
+ /** @description The location's display name (city), when it is one of WatchFor's locations */
2004
+ location_name?: string;
2005
+ /** @description ISO 3166-1 alpha-2 country of the location */
2006
+ location_country_code?: string;
1978
2007
  target?: string;
1979
2008
  error?: string | null;
1980
2009
  status_code?: number;
@@ -2411,6 +2440,126 @@ export interface components {
2411
2440
  incident_id: number;
2412
2441
  maintenance_window: components["schemas"]["MaintenanceWindow"];
2413
2442
  };
2443
+ /** @description An incident's post-mortem — the same document the dashboard edits. `sections` is `body` split by its template headings; `timeline` holds only the entries authors added (the incident's automatic events are in GET /incidents/{id}). */
2444
+ Postmortem: {
2445
+ /** Format: uuid */
2446
+ id: string;
2447
+ /** @constant */
2448
+ object: "postmortem";
2449
+ incident_id: number;
2450
+ title?: string | null;
2451
+ /** @enum {string} */
2452
+ status: "draft" | "completed";
2453
+ /** @description Published to the status page (owner/admin, dashboard only). Shown publicly only while also completed and the incident is on a status page. */
2454
+ is_public: boolean;
2455
+ /** @enum {string|null} */
2456
+ severity?: "minor" | "major" | "critical" | null;
2457
+ /** @enum {string|null} */
2458
+ root_cause_category?:
2459
+ | "deploy"
2460
+ | "config_change"
2461
+ | "dependency"
2462
+ | "capacity"
2463
+ | "network"
2464
+ | "hardware"
2465
+ | "security"
2466
+ | "human_error"
2467
+ | "unknown"
2468
+ | "other"
2469
+ | null;
2470
+ /** @description Text under each template heading (markdown-lite); "" when empty. */
2471
+ sections: {
2472
+ summary?: string;
2473
+ impact?: string;
2474
+ root_cause?: string;
2475
+ detection?: string;
2476
+ resolution?: string;
2477
+ what_went_well?: string;
2478
+ what_could_have_gone_better?: string;
2479
+ };
2480
+ /** @description The whole document, markdown-lite (## / ### headings, **bold**, *italic*, `code`, - lists) */
2481
+ body: string;
2482
+ timeline: {
2483
+ /** Format: date-time */
2484
+ at: string;
2485
+ text: string;
2486
+ }[];
2487
+ action_items: {
2488
+ /** Format: uuid */
2489
+ id: string;
2490
+ title: string;
2491
+ /** @enum {string} */
2492
+ status: "open" | "done";
2493
+ assignee?: {
2494
+ id?: string;
2495
+ name?: string;
2496
+ } | null;
2497
+ /** Format: date-time */
2498
+ due_date?: string | null;
2499
+ /** Format: date-time */
2500
+ completed_at?: string | null;
2501
+ }[];
2502
+ /** @description The member who started it; null when an API key did */
2503
+ created_by?: {
2504
+ id?: string;
2505
+ name?: string;
2506
+ } | null;
2507
+ /** Format: date-time */
2508
+ created_at: string;
2509
+ /** Format: date-time */
2510
+ updated_at: string;
2511
+ /** Format: date-time */
2512
+ completed_at?: string | null;
2513
+ };
2514
+ /** @description Omitted fields are kept. `sections` replaces only the sections it names ("" empties one; other sections and custom headings stay as written). `add_timeline` and `add_action_items` append — exact repeats (same time and text / same title, case-insensitive) are skipped, so a retry never duplicates. Publishing and deleting are not available here. */
2515
+ PostmortemUpdate: {
2516
+ title?: string;
2517
+ /**
2518
+ * @description Author-assessed impact, independent of the alert severity
2519
+ * @enum {string|null}
2520
+ */
2521
+ severity?: "minor" | "major" | "critical" | null;
2522
+ /** @enum {string|null} */
2523
+ root_cause_category?:
2524
+ | "deploy"
2525
+ | "config_change"
2526
+ | "dependency"
2527
+ | "capacity"
2528
+ | "network"
2529
+ | "hardware"
2530
+ | "security"
2531
+ | "human_error"
2532
+ | "unknown"
2533
+ | "other"
2534
+ | null;
2535
+ /**
2536
+ * @description completed sets completed_at; draft reopens
2537
+ * @enum {string}
2538
+ */
2539
+ status?: "draft" | "completed";
2540
+ /** @description Markdown-lite text per section. A `## ` line inside a section becomes `### ` so it cannot split the document. The whole document is capped at 50,000 characters. */
2541
+ sections?: {
2542
+ summary?: string;
2543
+ impact?: string;
2544
+ root_cause?: string;
2545
+ detection?: string;
2546
+ resolution?: string;
2547
+ what_went_well?: string;
2548
+ what_could_have_gone_better?: string;
2549
+ };
2550
+ /** @description Timeline entries to add (a post-mortem holds up to 100) */
2551
+ add_timeline?: {
2552
+ /** Format: date-time */
2553
+ at: string;
2554
+ text: string;
2555
+ }[];
2556
+ /** @description Follow-ups to add, open and unassigned (a post-mortem holds up to 50) */
2557
+ add_action_items?: {
2558
+ title: string;
2559
+ /** Format: date-time */
2560
+ due_date?: string | null;
2561
+ }[];
2562
+ };
2414
2563
  MaintenanceWindow: {
2415
2564
  /** Format: uuid */
2416
2565
  id?: string;
@@ -2988,6 +3137,32 @@ export interface components {
2988
3137
  /** @description Active monitors whose alerts would reach nobody (no alert rule with a contact group and no notification group) */
2989
3138
  silent_monitors?: number;
2990
3139
  };
3140
+ /** @description Certificate (SSL monitors) and domain (RDAP monitors) expiry in one bulk lookup; null when it can't be read right now */
3141
+ expiring?: {
3142
+ certificates?: components["schemas"]["ExpiryCounts"];
3143
+ domains?: components["schemas"]["ExpiryCounts"];
3144
+ /** @description The ten soonest expiries across both kinds, expired first */
3145
+ soonest?: {
3146
+ /** Format: uuid */
3147
+ monitor_id?: string;
3148
+ name?: string;
3149
+ /** @enum {string} */
3150
+ kind?: "certificate" | "domain";
3151
+ target?: string;
3152
+ /** Format: date-time */
3153
+ expires_at?: string;
3154
+ /** @description Negative once expired */
3155
+ days_left?: number;
3156
+ }[];
3157
+ } | null;
3158
+ };
3159
+ ExpiryCounts: {
3160
+ /** @description Monitors with a known expiry */
3161
+ monitored?: number;
3162
+ expired?: number;
3163
+ within_7_days?: number;
3164
+ /** @description 7 to 29 days left (buckets don't overlap) */
3165
+ within_30_days?: number;
2991
3166
  };
2992
3167
  IncidentStats: {
2993
3168
  /** @constant */
@@ -3202,6 +3377,8 @@ export interface components {
3202
3377
  /** @description Per-location breakdown for the whole window (not paginated) */
3203
3378
  locations?: {
3204
3379
  location?: string;
3380
+ location_name?: string;
3381
+ location_country_code?: string;
3205
3382
  checks?: number;
3206
3383
  success_percent?: number;
3207
3384
  /**
@@ -3482,7 +3659,7 @@ export interface components {
3482
3659
  };
3483
3660
  responses: never;
3484
3661
  parameters: {
3485
- /** @description OAuth tokens only: the id of the organization to act on. The token's user must be a member (otherwise 403 forbidden), and their role there applies — members can read, acknowledge incidents and run diagnostics; creating, changing and deleting needs owner or admin, as in the dashboard. Omitted: the user's oldest owned organization, else their oldest membership. With an API key the header may only repeat the key's own organization id (anything else is 403). */
3662
+ /** @description OAuth tokens only: the id of the organization to act on. The token's user must be a member (otherwise 403 forbidden), and their role there applies — members can read, acknowledge incidents, run diagnostics and write post-mortems; creating, changing and deleting needs owner or admin, as in the dashboard. Omitted: the user's oldest owned organization, else their oldest membership. With an API key the header may only repeat the key's own organization id (anything else is 403). */
3486
3663
  OrganizationHeader: string;
3487
3664
  };
3488
3665
  requestBodies: never;
@@ -5050,6 +5227,83 @@ export interface operations {
5050
5227
  };
5051
5228
  };
5052
5229
  };
5230
+ getIncidentPostmortem: {
5231
+ parameters: {
5232
+ query?: never;
5233
+ header?: never;
5234
+ path: {
5235
+ /** @description Incident id (integer) */
5236
+ id: string;
5237
+ };
5238
+ cookie?: never;
5239
+ };
5240
+ requestBody?: never;
5241
+ responses: {
5242
+ /** @description OK */
5243
+ 200: {
5244
+ headers: {
5245
+ [name: string]: unknown;
5246
+ };
5247
+ content: {
5248
+ "application/json": components["schemas"]["Postmortem"];
5249
+ };
5250
+ };
5251
+ /** @description Error */
5252
+ default: {
5253
+ headers: {
5254
+ [name: string]: unknown;
5255
+ };
5256
+ content: {
5257
+ "application/json": components["schemas"]["Error"];
5258
+ };
5259
+ };
5260
+ };
5261
+ };
5262
+ updateIncidentPostmortem: {
5263
+ parameters: {
5264
+ query?: never;
5265
+ header?: never;
5266
+ path: {
5267
+ /** @description Incident id (integer) */
5268
+ id: string;
5269
+ };
5270
+ cookie?: never;
5271
+ };
5272
+ requestBody?: {
5273
+ content: {
5274
+ "application/json": components["schemas"]["PostmortemUpdate"];
5275
+ };
5276
+ };
5277
+ responses: {
5278
+ /** @description Updated (or unchanged) */
5279
+ 200: {
5280
+ headers: {
5281
+ [name: string]: unknown;
5282
+ };
5283
+ content: {
5284
+ "application/json": components["schemas"]["Postmortem"];
5285
+ };
5286
+ };
5287
+ /** @description Created the draft */
5288
+ 201: {
5289
+ headers: {
5290
+ [name: string]: unknown;
5291
+ };
5292
+ content: {
5293
+ "application/json": components["schemas"]["Postmortem"];
5294
+ };
5295
+ };
5296
+ /** @description Error */
5297
+ default: {
5298
+ headers: {
5299
+ [name: string]: unknown;
5300
+ };
5301
+ content: {
5302
+ "application/json": components["schemas"]["Error"];
5303
+ };
5304
+ };
5305
+ };
5306
+ };
5053
5307
  markIncidentMaintenance: {
5054
5308
  parameters: {
5055
5309
  query?: never;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "watchfor",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "description": "Official TypeScript SDK + CLI for WatchFor — uptime & infrastructure monitoring (monitors, alert rules, incidents, maintenance windows) over the REST API.",
5
5
  "keywords": [
6
6
  "watchfor",