watchfor 0.9.0 → 0.11.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
@@ -1,7 +1,7 @@
1
1
  # watchfor
2
2
 
3
3
  Official TypeScript SDK + CLI for [WatchFor](https://watchfor.io) —
4
- uptime & infrastructure monitoring (25 check types, confirmed alerting,
4
+ uptime & infrastructure monitoring (27 check types, confirmed alerting,
5
5
  status pages, on-call).
6
6
 
7
7
  ```bash
@@ -39,6 +39,14 @@ await wf.incidents.exclude(19351, { reason: "Probe-side DNS hiccup" });
39
39
  // Irreversible: wipe a monitor's checks and incidents; uptime restarts "since reset".
40
40
  await wf.monitors.reset(monitor.id!);
41
41
 
42
+ // Page integrity: after a deploy, accept what the newest check saw as the new baseline.
43
+ await wf.monitors.acceptBaseline(integrityMonitorId);
44
+
45
+ // Browser checks: try a Playwright script once (nothing saved), then read the result.
46
+ const { id } = await wf.playwright.testRun({ script, target: "https://shop.example.com" });
47
+ const run = await wf.playwright.getTestRun(id); // status: queued | running | done | error
48
+ await wf.variables.put("LOGIN_PASSWORD", { value: process.env.PW!, secret: true });
49
+
42
50
  // Older checks: pass next_cursor back as cursor (keep the same hours/success).
43
51
  const page = await wf.monitors.checks(monitor.id!, { hours: 24, limit: 100 });
44
52
  if (page.next_cursor) {
@@ -97,5 +105,5 @@ npx watchfor report --period 30d
97
105
  ## Links
98
106
 
99
107
  - API docs: https://watchfor.io/docs/api
100
- - MCP server for AI agents (54 tools): https://watchfor.io/docs/api/mcp
108
+ - MCP server for AI agents (59 tools): https://watchfor.io/docs/api/mcp
101
109
  - Create an API key: dashboard → Settings → API keys (`read` or `read+write` scope)
package/dist/client.d.ts CHANGED
@@ -10,6 +10,17 @@ export type Monitor = components["schemas"]["Monitor"];
10
10
  /** Monitor + `available_metrics` (GET /monitors/{id} only). */
11
11
  export type MonitorDetail = components["schemas"]["MonitorDetail"];
12
12
  export type MonitorReset = components["schemas"]["MonitorReset"];
13
+ export type IntegrityBaseline = components["schemas"]["IntegrityBaseline"];
14
+ export type IntegrityBaselineAccept = components["schemas"]["IntegrityBaselineAccept"];
15
+ export type PlaywrightTestRunRequest = components["schemas"]["PlaywrightTestRunRequest"];
16
+ export type PlaywrightTestRunAccepted = components["schemas"]["PlaywrightTestRunAccepted"];
17
+ export type PlaywrightTestRun = components["schemas"]["PlaywrightTestRun"];
18
+ export type PlaywrightRun = components["schemas"]["PlaywrightRun"];
19
+ export type PlaywrightRunSummary = components["schemas"]["PlaywrightRunSummary"];
20
+ export type ScriptVersion = components["schemas"]["ScriptVersion"];
21
+ export type ScriptVersionSummary = components["schemas"]["ScriptVersionSummary"];
22
+ export type Variable = components["schemas"]["Variable"];
23
+ export type VariableDeleted = components["schemas"]["VariableDeleted"];
13
24
  export type Incident = components["schemas"]["Incident"];
14
25
  export type AlertRule = components["schemas"]["AlertRule"];
15
26
  export type Contact = components["schemas"]["Contact"];
@@ -124,6 +135,37 @@ export declare class WatchFor {
124
135
  * the monitor and start uptime over ("since reset"). The monitor and
125
136
  * its configuration, alert rules, tags and locations stay. */
126
137
  reset: (id: string) => Promise<MonitorReset>;
138
+ /** Page integrity monitors: the accepted baseline of every watched
139
+ * page (whether it has one, when and how it was captured). */
140
+ getBaseline: (id: string) => Promise<IntegrityBaseline>;
141
+ /** Page integrity monitors: accept what the newest check saw as the
142
+ * new baseline — all pages, or only `pages`. Call it from a deploy
143
+ * pipeline a minute after the release; unfetched pages come back in
144
+ * `skipped`. */
145
+ acceptBaseline: (id: string, body?: {
146
+ pages?: string[];
147
+ }, idempotencyKey?: string) => Promise<IntegrityBaselineAccept>;
148
+ /** Browser checks: runs, newest first (`status` failed | flaky). */
149
+ runs: (id: string, params?: {
150
+ status?: "all" | "failed" | "flaky";
151
+ limit?: number;
152
+ cursor?: string;
153
+ }) => Promise<{
154
+ object: "list";
155
+ data: PlaywrightRunSummary[];
156
+ total?: number;
157
+ has_more: boolean;
158
+ next_cursor: string | null;
159
+ }>;
160
+ /** Browser checks: one run — steps, errors, Web Vitals, screenshot
161
+ * URLs (15 min) and the trace-viewer link. */
162
+ run: (id: string, runId: string) => Promise<PlaywrightRun>;
163
+ /** Browser checks: saved script versions (last 50). */
164
+ scriptVersions: (id: string) => Promise<{
165
+ object: "list";
166
+ data: ScriptVersionSummary[];
167
+ }>;
168
+ scriptVersion: (id: string, version: number) => Promise<ScriptVersion>;
127
169
  uptime: (id: string, period?: "1h" | "24h" | "7d" | "30d" | "90d") => Promise<Uptime>;
128
170
  /** Recent probe results, newest first. Page with `next_cursor` →
129
171
  * `cursor` (keep the same `hours`/`success`); `locations` is the
@@ -144,6 +186,29 @@ export declare class WatchFor {
144
186
  update: (monitorId: string, ruleId: string, body: Record<string, unknown>) => Promise<AlertRule>;
145
187
  delete: (monitorId: string, ruleId: string) => Promise<Deleted>;
146
188
  };
189
+ /**
190
+ * Browser checks (Playwright): run a script once without saving it —
191
+ * `testRun()` returns an id, `getTestRun()` its live progress and result.
192
+ */
193
+ readonly playwright: {
194
+ testRun: (body: PlaywrightTestRunRequest, idempotencyKey?: string) => Promise<PlaywrightTestRunAccepted>;
195
+ getTestRun: (id: string) => Promise<PlaywrightTestRun>;
196
+ };
197
+ /**
198
+ * Org variables and secrets browser checks read as process.env.NAME.
199
+ * Secrets are write-only: `list()` never returns their value.
200
+ */
201
+ readonly variables: {
202
+ list: () => Promise<{
203
+ object: "list";
204
+ data: Variable[];
205
+ }>;
206
+ put: (name: string, body: {
207
+ value?: string;
208
+ secret?: boolean;
209
+ }) => Promise<Variable>;
210
+ delete: (name: string) => Promise<VariableDeleted>;
211
+ };
147
212
  readonly incidents: {
148
213
  list: (q?: {
149
214
  status?: "firing" | "acknowledged" | "resolved";
package/dist/client.js CHANGED
@@ -130,6 +130,25 @@ export class WatchFor {
130
130
  * the monitor and start uptime over ("since reset"). The monitor and
131
131
  * its configuration, alert rules, tags and locations stay. */
132
132
  reset: (id) => this.request("POST", `/monitors/${id}/reset`),
133
+ /** Page integrity monitors: the accepted baseline of every watched
134
+ * page (whether it has one, when and how it was captured). */
135
+ getBaseline: (id) => this.request("GET", `/monitors/${id}/baseline`),
136
+ /** Page integrity monitors: accept what the newest check saw as the
137
+ * new baseline — all pages, or only `pages`. Call it from a deploy
138
+ * pipeline a minute after the release; unfetched pages come back in
139
+ * `skipped`. */
140
+ acceptBaseline: (id, body, idempotencyKey) => this.request("POST", `/monitors/${id}/baseline`, {
141
+ body: body ?? {},
142
+ idempotencyKey,
143
+ }),
144
+ /** Browser checks: runs, newest first (`status` failed | flaky). */
145
+ runs: (id, params = {}) => this.request("GET", `/monitors/${id}/runs`, { query: params }),
146
+ /** Browser checks: one run — steps, errors, Web Vitals, screenshot
147
+ * URLs (15 min) and the trace-viewer link. */
148
+ run: (id, runId) => this.request("GET", `/monitors/${id}/runs/${runId}`),
149
+ /** Browser checks: saved script versions (last 50). */
150
+ scriptVersions: (id) => this.request("GET", `/monitors/${id}/script/versions`),
151
+ scriptVersion: (id, version) => this.request("GET", `/monitors/${id}/script/versions/${version}`),
133
152
  uptime: (id, period) => this.request("GET", `/monitors/${id}/uptime`, { query: { period } }),
134
153
  /** Recent probe results, newest first. Page with `next_cursor` →
135
154
  * `cursor` (keep the same `hours`/`success`); `locations` is the
@@ -152,6 +171,23 @@ export class WatchFor {
152
171
  delete: (monitorId, ruleId) => this.request("DELETE", `/monitors/${monitorId}/alert-rules/${ruleId}`),
153
172
  };
154
173
  // ── Incidents ─────────────────────────────────────────────────
174
+ /**
175
+ * Browser checks (Playwright): run a script once without saving it —
176
+ * `testRun()` returns an id, `getTestRun()` its live progress and result.
177
+ */
178
+ playwright = {
179
+ testRun: (body, idempotencyKey) => this.request("POST", "/playwright/test-runs", { body, idempotencyKey }),
180
+ getTestRun: (id) => this.request("GET", `/playwright/test-runs/${id}`),
181
+ };
182
+ /**
183
+ * Org variables and secrets browser checks read as process.env.NAME.
184
+ * Secrets are write-only: `list()` never returns their value.
185
+ */
186
+ variables = {
187
+ list: () => this.request("GET", "/variables"),
188
+ put: (name, body) => this.request("PUT", `/variables/${encodeURIComponent(name)}`, { body }),
189
+ delete: (name) => this.request("DELETE", `/variables/${encodeURIComponent(name)}`),
190
+ };
155
191
  incidents = {
156
192
  list: (q) => this.request("GET", "/incidents", { query: q }),
157
193
  get: (id) => this.request("GET", `/incidents/${id}`),
package/dist/index.d.ts CHANGED
@@ -1 +1 @@
1
- export { type ActivityEvent, type AlertRule, type ApiErrorBody, 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 List, type MaintenanceWindow, type Monitor, type MonitorDetail, type MonitorReset, 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 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 List, type MaintenanceWindow, type Monitor, type MonitorDetail, type MonitorReset, type Notification, type Plan, type PlaywrightRun, type PlaywrightRunSummary, type PlaywrightTestRun, type PlaywrightTestRunAccepted, type PlaywrightTestRunRequest, type ScriptVersion, type ScriptVersionSummary, type StatusPage, type Summary, type Uptime, type Variable, type VariableDeleted, WatchFor, WatchForError, type WatchForOptions, } from "./client.js";
package/dist/schema.d.ts CHANGED
@@ -4,6 +4,146 @@
4
4
  */
5
5
 
6
6
  export interface paths {
7
+ "/playwright/test-runs": {
8
+ parameters: {
9
+ query?: never;
10
+ header?: never;
11
+ path?: never;
12
+ cookie?: never;
13
+ };
14
+ get?: never;
15
+ put?: never;
16
+ /**
17
+ * Run a browser-check script once without saving it (returns 202 + id to poll)
18
+ * @description Validates the script (400 names the line), then runs it in a sandboxed browser on a browser location. Org variables and secrets the script reads are provided exactly as for a saved check. Poll GET /playwright/test-runs/{id}. Counts against the plan's playwrightTestRunsPerHour (429 when spent); an organization can have 3 test runs in flight at once (429 beyond).
19
+ */
20
+ post: operations["createPlaywrightTestRun"];
21
+ delete?: never;
22
+ options?: never;
23
+ head?: never;
24
+ patch?: never;
25
+ trace?: never;
26
+ };
27
+ "/playwright/test-runs/{id}": {
28
+ parameters: {
29
+ query?: never;
30
+ header?: never;
31
+ path?: never;
32
+ cookie?: never;
33
+ };
34
+ /** A test run's live progress and, when done, its result (kept 1 hour) */
35
+ get: operations["getPlaywrightTestRun"];
36
+ put?: never;
37
+ post?: never;
38
+ delete?: never;
39
+ options?: never;
40
+ head?: never;
41
+ patch?: never;
42
+ trace?: never;
43
+ };
44
+ "/monitors/{id}/runs": {
45
+ parameters: {
46
+ query?: never;
47
+ header?: never;
48
+ path?: never;
49
+ cookie?: never;
50
+ };
51
+ /** A browser check's runs, newest first (404 for other monitor types) */
52
+ get: operations["listMonitorRuns"];
53
+ put?: never;
54
+ post?: never;
55
+ delete?: never;
56
+ options?: never;
57
+ head?: never;
58
+ patch?: never;
59
+ trace?: never;
60
+ };
61
+ "/monitors/{id}/runs/{run_id}": {
62
+ parameters: {
63
+ query?: never;
64
+ header?: never;
65
+ path?: never;
66
+ cookie?: never;
67
+ };
68
+ /** One browser-check run: steps, errors with code frames, Web Vitals, screenshots (presigned 15 min), trace link */
69
+ get: operations["getMonitorRun"];
70
+ put?: never;
71
+ post?: never;
72
+ delete?: never;
73
+ options?: never;
74
+ head?: never;
75
+ patch?: never;
76
+ trace?: never;
77
+ };
78
+ "/monitors/{id}/script/versions": {
79
+ parameters: {
80
+ query?: never;
81
+ header?: never;
82
+ path?: never;
83
+ cookie?: never;
84
+ };
85
+ /** Saved versions of a browser check's script (last 50) */
86
+ get: operations["listScriptVersions"];
87
+ put?: never;
88
+ post?: never;
89
+ delete?: never;
90
+ options?: never;
91
+ head?: never;
92
+ patch?: never;
93
+ trace?: never;
94
+ };
95
+ "/monitors/{id}/script/versions/{version}": {
96
+ parameters: {
97
+ query?: never;
98
+ header?: never;
99
+ path?: never;
100
+ cookie?: never;
101
+ };
102
+ /** One saved version of a browser check's script */
103
+ get: operations["getScriptVersion"];
104
+ put?: never;
105
+ post?: never;
106
+ delete?: never;
107
+ options?: never;
108
+ head?: never;
109
+ patch?: never;
110
+ trace?: never;
111
+ };
112
+ "/variables": {
113
+ parameters: {
114
+ query?: never;
115
+ header?: never;
116
+ path?: never;
117
+ cookie?: never;
118
+ };
119
+ /** Org variables and secrets browser checks read as process.env.NAME (secrets without values) */
120
+ get: operations["listVariables"];
121
+ put?: never;
122
+ post?: never;
123
+ delete?: never;
124
+ options?: never;
125
+ head?: never;
126
+ patch?: never;
127
+ trace?: never;
128
+ };
129
+ "/variables/{name}": {
130
+ parameters: {
131
+ query?: never;
132
+ header?: never;
133
+ path?: never;
134
+ cookie?: never;
135
+ };
136
+ get?: never;
137
+ /** Create or replace a variable or secret; checks that read it are re-synced */
138
+ put: operations["putVariable"];
139
+ post?: never;
140
+ /** Delete a variable; checks that read it get undefined from their next run */
141
+ delete: operations["deleteVariable"];
142
+ options?: never;
143
+ head?: never;
144
+ patch?: never;
145
+ trace?: never;
146
+ };
7
147
  "/diagnostics": {
8
148
  parameters: {
9
149
  query?: never;
@@ -260,6 +400,30 @@ export interface paths {
260
400
  patch?: never;
261
401
  trace?: never;
262
402
  };
403
+ "/monitors/{id}/baseline": {
404
+ parameters: {
405
+ query?: never;
406
+ header?: never;
407
+ path?: never;
408
+ cookie?: never;
409
+ };
410
+ /**
411
+ * Page integrity baseline — what each watched page is compared against
412
+ * @description Page integrity monitors only (404 for other types). One row per watched page: whether it has an accepted baseline, when it was captured, and how (auto = recorded from the first check, manual = accepted in the dashboard, api = this endpoint, timer = accepted automatically after the monitor's autoAcceptAfterHours).
413
+ */
414
+ get: operations["getMonitorBaseline"];
415
+ put?: never;
416
+ /**
417
+ * Accept the latest state of the watched pages as the new baseline — call it after a deploy
418
+ * @description Page integrity monitors only. Takes the newest checked fingerprint (and text) of every watched page — or only `pages` — as the accepted baseline, so an intended change stops alerting and the next check compares against it. Pages no check has fetched yet are returned in `skipped`. Typical use: the last step of a deploy pipeline, a minute after the release (so a check has seen the new version).
419
+ */
420
+ post: operations["acceptMonitorBaseline"];
421
+ delete?: never;
422
+ options?: never;
423
+ head?: never;
424
+ patch?: never;
425
+ trace?: never;
426
+ };
263
427
  "/monitors/{id}/uptime": {
264
428
  parameters: {
265
429
  query?: never;
@@ -917,6 +1081,166 @@ export interface paths {
917
1081
  export type webhooks = Record<string, never>;
918
1082
  export interface components {
919
1083
  schemas: {
1084
+ PlaywrightTestRunRequest: {
1085
+ /** @description A Playwright Test file (TypeScript or JavaScript). Imports: @playwright/test, otpauth, @faker-js/faker, Node built-ins. Read org variables as process.env.NAME; TARGET_URL is `target`. */
1086
+ script: string;
1087
+ /**
1088
+ * Format: uri
1089
+ * @description The site under test (process.env.TARGET_URL)
1090
+ */
1091
+ target: string;
1092
+ /**
1093
+ * Format: uuid
1094
+ * @description A browser location (GET /locations, browser: true); omit for the nearest
1095
+ */
1096
+ location_id?: string;
1097
+ /** @description Per-attempt timeout, capped by the plan (maxPlaywrightTimeoutSeconds); default 60 */
1098
+ timeout_seconds?: number;
1099
+ /**
1100
+ * @description Retry a failed test once inside the run
1101
+ * @default true
1102
+ */
1103
+ retry: boolean;
1104
+ };
1105
+ PlaywrightTestRunAccepted: {
1106
+ /** @constant */
1107
+ object: "playwright_test_run";
1108
+ /** Format: uuid */
1109
+ id: string;
1110
+ /** @constant */
1111
+ status: "queued";
1112
+ location?: {
1113
+ /** Format: uuid */
1114
+ id?: string;
1115
+ name?: string;
1116
+ };
1117
+ timeout_seconds?: number;
1118
+ /** @description process.env names the script reads that no org variable defines (they are undefined in the run) */
1119
+ missing_variables?: string[];
1120
+ };
1121
+ /** @description One browser-check run. `result` is the stored run result (credentials masked): status, attempts, duration_ms, runtime, tests[].steps[] (title, status, duration_ms, error {message, location, snippet}), failure, navigations (Web Vitals per page), console_errors, page_errors, failed_requests, blocked_requests, artifacts. */
1122
+ PlaywrightRun: {
1123
+ /** @constant */
1124
+ object: "playwright_run";
1125
+ /** Format: uuid */
1126
+ run_id: string;
1127
+ timestamp?: string;
1128
+ location?: string;
1129
+ /** @enum {string} */
1130
+ status:
1131
+ | "passed"
1132
+ | "flaky"
1133
+ | "failed"
1134
+ | "timed_out"
1135
+ | "script_error"
1136
+ | "infra_error";
1137
+ duration_ms?: number;
1138
+ result: {
1139
+ [key: string]: unknown;
1140
+ };
1141
+ /** @description Artefact key → presigned screenshot URL (valid 15 minutes) */
1142
+ screenshot_urls?: {
1143
+ [key: string]: string;
1144
+ };
1145
+ /**
1146
+ * Format: uri
1147
+ * @description The Playwright trace in WatchFor's own trace viewer (opens for a signed-in member; traces never leave our origin). Null when no trace was kept.
1148
+ */
1149
+ trace_url?: string | null;
1150
+ };
1151
+ PlaywrightRunSummary: {
1152
+ /** @constant */
1153
+ object: "playwright_run";
1154
+ /** Format: uuid */
1155
+ run_id: string;
1156
+ timestamp: string;
1157
+ status: string;
1158
+ duration_ms?: number;
1159
+ attempts?: number;
1160
+ location?: string;
1161
+ failed_step?: string | null;
1162
+ console_errors?: number;
1163
+ failed_requests?: number;
1164
+ /** @enum {string} */
1165
+ artifacts?: "full" | "failure" | "none";
1166
+ has_trace?: boolean;
1167
+ };
1168
+ PlaywrightTestRun: {
1169
+ /** @constant */
1170
+ object: "playwright_test_run";
1171
+ /** Format: uuid */
1172
+ id: string;
1173
+ /** @enum {string} */
1174
+ status: "queued" | "running" | "done" | "error";
1175
+ /** Format: date-time */
1176
+ started_at?: string;
1177
+ /** Format: date-time */
1178
+ finished_at?: string | null;
1179
+ location?: {
1180
+ id?: string;
1181
+ name?: string;
1182
+ } | null;
1183
+ /** @description Streamed progress lines: test_begin, step_begin, step_end (status, duration_ms, error), test_end */
1184
+ events: {
1185
+ [key: string]: unknown;
1186
+ }[];
1187
+ result?: components["schemas"]["PlaywrightRun"] | null;
1188
+ /** @description Why the run could not happen (our side), when status is error */
1189
+ error?: string | null;
1190
+ };
1191
+ ScriptVersionSummary: {
1192
+ /** @constant */
1193
+ object: "script_version";
1194
+ version: number;
1195
+ current?: boolean;
1196
+ saved_by?: string | null;
1197
+ /** Format: date-time */
1198
+ created_at?: string;
1199
+ lines?: number;
1200
+ };
1201
+ ScriptVersion: {
1202
+ /** @constant */
1203
+ object: "script_version";
1204
+ version: number;
1205
+ saved_by?: string | null;
1206
+ /** Format: date-time */
1207
+ created_at?: string;
1208
+ script: string;
1209
+ };
1210
+ Variable: {
1211
+ /** @constant */
1212
+ object: "variable";
1213
+ name: string;
1214
+ secret: boolean;
1215
+ /** @description Null for secrets — a secret's value is never returned */
1216
+ value?: string | null;
1217
+ /** Format: date-time */
1218
+ updated_at?: string;
1219
+ used_by?: {
1220
+ /** Format: uuid */
1221
+ id?: string;
1222
+ name?: string;
1223
+ }[];
1224
+ /** @description Browser checks re-synced by this write */
1225
+ checks_updated?: number;
1226
+ };
1227
+ VariablePut: {
1228
+ /** @description The value. For an existing secret, omit it to keep the stored one. */
1229
+ value?: string;
1230
+ /**
1231
+ * @description Store encrypted and never show again; masked in logs, errors, traces and screenshots
1232
+ * @default false
1233
+ */
1234
+ secret: boolean;
1235
+ };
1236
+ VariableDeleted: {
1237
+ /** @constant */
1238
+ object: "variable";
1239
+ name: string;
1240
+ /** @constant */
1241
+ deleted: true;
1242
+ checks_updated?: number;
1243
+ };
920
1244
  /** @description Error envelope. Status by code: 400 invalid_request (a field path + human message; unknown enum values list the valid ones), 401 unauthorized, 403 forbidden, 404 not_found, 405 method_not_allowed, 409 conflict, 413 payload_too_large (request body over 256 KiB), 429 rate_limited (Retry-After set), 501 not_implemented, 500 internal_error. Every authenticated response — errors included — carries the real X-RateLimit-*\/RateLimit-* remaining count. */
921
1245
  Error: {
922
1246
  error: {
@@ -1196,7 +1520,7 @@ export interface components {
1196
1520
  CatalogConfigField: {
1197
1521
  key: string;
1198
1522
  /** @enum {string} */
1199
- type: "string" | "number" | "boolean" | "enum" | "array";
1523
+ type: "string" | "number" | "boolean" | "enum" | "array" | "object";
1200
1524
  enum?: string[];
1201
1525
  default?: unknown;
1202
1526
  /** @description Write-only credential; read back as [redacted] */
@@ -1209,7 +1533,10 @@ export interface components {
1209
1533
  /** @constant */
1210
1534
  object?: "monitor";
1211
1535
  name?: string;
1212
- /** @enum {string} */
1536
+ /**
1537
+ * @description Monitor type id; the catalog with target formats and config fields is GET /meta/monitor-types. `playwright` = browser checks (scripted Playwright journeys: login, checkout, search); `browser` = Core Web Vitals (a Lighthouse audit of one page).
1538
+ * @enum {string}
1539
+ */
1213
1540
  type?:
1214
1541
  | "tcp"
1215
1542
  | "dns"
@@ -1235,7 +1562,9 @@ export interface components {
1235
1562
  | "browser"
1236
1563
  | "heartbeat"
1237
1564
  | "mcp"
1238
- | "api";
1565
+ | "api"
1566
+ | "integrity"
1567
+ | "playwright";
1239
1568
  target?: string;
1240
1569
  description?: string | null;
1241
1570
  interval_seconds?: number;
@@ -1372,7 +1701,10 @@ export interface components {
1372
1701
  };
1373
1702
  MonitorCreate: {
1374
1703
  name: string;
1375
- /** @enum {string} */
1704
+ /**
1705
+ * @description Monitor type id; the catalog with target formats and config fields is GET /meta/monitor-types. `playwright` = browser checks (scripted Playwright journeys: login, checkout, search); `browser` = Core Web Vitals (a Lighthouse audit of one page).
1706
+ * @enum {string}
1707
+ */
1376
1708
  type:
1377
1709
  | "tcp"
1378
1710
  | "dns"
@@ -1398,7 +1730,9 @@ export interface components {
1398
1730
  | "browser"
1399
1731
  | "heartbeat"
1400
1732
  | "mcp"
1401
- | "api";
1733
+ | "api"
1734
+ | "integrity"
1735
+ | "playwright";
1402
1736
  /** @description Format per type (see GET /meta/monitor-types). Targets in private, loopback, link-local or cloud-metadata address space (and internal hostnames such as localhost, *.internal) are rejected with 400. */
1403
1737
  target: string;
1404
1738
  /** @description Seconds; validated against the plan's per-type minimum */
@@ -1423,7 +1757,7 @@ export interface components {
1423
1757
  */
1424
1758
  cloneFromMonitorId?: string;
1425
1759
  };
1426
- /** @description Partial update — send only what changes. `config` is MERGED into the stored config (see the property). */
1760
+ /** @description Partial update — send only what changes. `config` is MERGED into the stored config (see the property). An unknown top-level field is a 400 naming it (e.g. `interval_seconds` — the field is `interval`), never silently ignored. */
1427
1761
  MonitorUpdate: {
1428
1762
  name?: string;
1429
1763
  target?: string;
@@ -1626,6 +1960,8 @@ export interface components {
1626
1960
  region?: string;
1627
1961
  country?: string;
1628
1962
  country_code?: string;
1963
+ /** @description The location can run real-browser checks (Core Web Vitals, Page integrity in browser mode). */
1964
+ browser?: boolean;
1629
1965
  };
1630
1966
  Incident: {
1631
1967
  id?: number;
@@ -1660,12 +1996,23 @@ export interface components {
1660
1996
  expected?: string;
1661
1997
  detected?: string;
1662
1998
  metric_failure?: boolean;
1999
+ /** @description Page integrity monitors in browser mode, single-incident responses only: the screenshots the check that opened the incident took (a page is photographed only when it differs from its baseline). `url` is a signed link valid for `expires_in` seconds — fetch the incident again for a fresh one. Absent for other monitor types; empty when the check took none. */
2000
+ screenshots?: {
2001
+ /** Format: uri */
2002
+ page_url?: string;
2003
+ /** Format: uri */
2004
+ url?: string;
2005
+ /** Format: date-time */
2006
+ taken_at?: string | null;
2007
+ expires_in?: number;
2008
+ }[];
1663
2009
  } | null;
1664
2010
  /** @description The fire-time snapshot the alerting engine stored: the metrics the probe reported (http.status_code, response_time_ms, ssl.days_until_expiry, …), an optional response excerpt, the rule expression, the failure threshold, which prober fired and which probers confirmed. Values under sensitive keys are redacted. */
1665
2011
  trigger?: {
1666
2012
  metrics?: {
1667
2013
  [key: string]: unknown;
1668
2014
  } | null;
2015
+ /** @description The response excerpt the probe kept (status, headers, body_snippet) plus page_title and visible_text — the readable part of an HTML body — and, from newer probes, final_url and redirect_chain. */
1669
2016
  response?: {
1670
2017
  [key: string]: unknown;
1671
2018
  } | null;
@@ -1688,6 +2035,9 @@ export interface components {
1688
2035
  at?: string;
1689
2036
  type?: string;
1690
2037
  source?: string | null;
2038
+ /** @description On the resolved event: exact seconds from start to resolution */
2039
+ duration_seconds?: number;
2040
+ /** @description The event payload without the fire-time snapshot (that is `trigger`) */
1691
2041
  detail?: {
1692
2042
  [key: string]: unknown;
1693
2043
  } | null;
@@ -1703,6 +2053,46 @@ export interface components {
1703
2053
  /** Format: date-time */
1704
2054
  excluded_at?: string | null;
1705
2055
  };
2056
+ /** @description The accepted baseline of a page integrity monitor */
2057
+ IntegrityBaseline: {
2058
+ /** @constant */
2059
+ object: "integrity_baseline";
2060
+ /** Format: uuid */
2061
+ monitor_id: string;
2062
+ pages: {
2063
+ /** Format: uri */
2064
+ url: string;
2065
+ has_baseline: boolean;
2066
+ /** Format: date-time */
2067
+ captured_at: string | null;
2068
+ /**
2069
+ * @description auto = recorded from the first check, manual = accepted in the dashboard, api = accepted via this API, timer = accepted automatically because nobody reviewed the change within the monitor's autoAcceptAfterHours
2070
+ * @enum {string|null}
2071
+ */
2072
+ source: "auto" | "manual" | "api" | "timer" | null;
2073
+ /** @description User or API key name; null for auto and timer */
2074
+ accepted_by?: string | null;
2075
+ }[];
2076
+ trusted_origins?: string[];
2077
+ text_change_threshold?: number;
2078
+ };
2079
+ IntegrityBaselineAcceptRequest: {
2080
+ /** @description Accept only these watched pages; omit for all */
2081
+ pages?: string[];
2082
+ };
2083
+ IntegrityBaselineAccept: {
2084
+ /** @constant */
2085
+ object: "integrity_baseline_accept";
2086
+ /** Format: uuid */
2087
+ monitor_id: string;
2088
+ accepted: string[];
2089
+ skipped: {
2090
+ url: string;
2091
+ reason: string;
2092
+ }[];
2093
+ /** Format: date-time */
2094
+ captured_at?: string | null;
2095
+ };
1706
2096
  MonitorReset: {
1707
2097
  /** @constant */
1708
2098
  object?: "monitor_reset";
@@ -1718,7 +2108,7 @@ export interface components {
1718
2108
  /** @description Best-effort steps that failed (e.g. clickhouse); the reset marker is set regardless */
1719
2109
  warnings?: string[];
1720
2110
  };
1721
- /** @description A server running watchfor-agent. `status` is the agent's liveness (online = a batch in the last 90 s, stale = none for 90 s, offline = none for 10 min, never = not reported yet). `monitor_id` is the host's internal monitor — use it wherever a monitor id is asked for (status-page components, maintenance windows, incidents). `metrics` are the latest gauges from the last five minutes, null when the host is silent. */
2111
+ /** @description A server running watchfor-agent. `status` is the agent's liveness (online = a batch within three push intervals and never less than 90 s, stale = none for that long, offline = none for 10 min, never = not reported yet). `monitor_id` is the host's internal monitor — use it wherever a monitor id is asked for (status-page components, maintenance windows, incidents). `metrics` are the latest gauges from the last five minutes, null when the host is silent. */
1722
2112
  Host: {
1723
2113
  /** Format: uuid */
1724
2114
  id?: string;
@@ -1736,6 +2126,7 @@ export interface components {
1736
2126
  os?: string | null;
1737
2127
  kernel?: string | null;
1738
2128
  arch?: string | null;
2129
+ /** @description The agent's tags as key=value strings, sorted (e.g. env=prod, role=db) */
1739
2130
  tags?: string[];
1740
2131
  push_interval_seconds?: number;
1741
2132
  /** Format: uuid */
@@ -2087,6 +2478,11 @@ export interface components {
2087
2478
  position?: number;
2088
2479
  /** @enum {string} */
2089
2480
  display_mode?: "rolled_up" | "expanded" | "collapsible_group";
2481
+ /**
2482
+ * @description How much an auto-published incident notice says about why this component's monitors or hosts fail: hidden = generic 'service disruption'; cause = a plain-words category ('Disk space running low', 'Returning errors'), no values; full = the category plus the detected value ('Disk / is 92.0% full'), for internal pages. A notice covering several components uses the most private level among them. Set in the dashboard component editor.
2483
+ * @enum {string}
2484
+ */
2485
+ public_cause?: "hidden" | "cause" | "full";
2090
2486
  monitor_ids?: string[];
2091
2487
  monitor_tags?: string[];
2092
2488
  /**
@@ -2258,7 +2654,10 @@ export interface components {
2258
2654
  MonitorType: {
2259
2655
  /** @constant */
2260
2656
  object?: "monitor_type";
2261
- /** @enum {string} */
2657
+ /**
2658
+ * @description Monitor type id; the catalog with target formats and config fields is GET /meta/monitor-types. `playwright` = browser checks (scripted Playwright journeys: login, checkout, search); `browser` = Core Web Vitals (a Lighthouse audit of one page).
2659
+ * @enum {string}
2660
+ */
2262
2661
  type?:
2263
2662
  | "tcp"
2264
2663
  | "dns"
@@ -2284,7 +2683,9 @@ export interface components {
2284
2683
  | "browser"
2285
2684
  | "heartbeat"
2286
2685
  | "mcp"
2287
- | "api";
2686
+ | "api"
2687
+ | "integrity"
2688
+ | "playwright";
2288
2689
  label?: string;
2289
2690
  description?: string;
2290
2691
  target_format?: string;
@@ -2325,7 +2726,7 @@ export interface components {
2325
2726
  started_24h?: number;
2326
2727
  };
2327
2728
  open_maintenance_windows?: number;
2328
- /** @description Servers running the agent (revoked ones excluded) by liveness — the same rule as GET /hosts: online = reported within 90 s, stale = 90 s–10 min, offline = longer, never = has not reported yet */
2729
+ /** @description Servers running the agent (revoked ones excluded) by liveness — the same rule as GET /hosts: online = reported within three push intervals (at least 90 s), stale = longer but under 10 min, offline = longer, never = has not reported yet */
2329
2730
  hosts?: {
2330
2731
  total?: number;
2331
2732
  online?: number;
@@ -2508,6 +2909,29 @@ export interface components {
2508
2909
  active?: boolean;
2509
2910
  }[];
2510
2911
  };
2912
+ PlaywrightRunSummaryList: {
2913
+ /** @constant */
2914
+ object: "list";
2915
+ data: components["schemas"]["PlaywrightRunSummary"][];
2916
+ has_more: boolean;
2917
+ total?: number;
2918
+ next_cursor?: string | null;
2919
+ };
2920
+ ScriptVersionSummaryList: {
2921
+ /** @constant */
2922
+ object: "list";
2923
+ data: components["schemas"]["ScriptVersionSummary"][];
2924
+ has_more: boolean;
2925
+ };
2926
+ VariableList: {
2927
+ /** @constant */
2928
+ object: "list";
2929
+ data: components["schemas"]["Variable"][];
2930
+ has_more: boolean;
2931
+ secrets_available?: boolean;
2932
+ /** @description Names checks read that no variable defines */
2933
+ undefined_refs?: string[];
2934
+ };
2511
2935
  MonitorTypeList: {
2512
2936
  /** @constant */
2513
2937
  object: "list";
@@ -2799,7 +3223,313 @@ export interface components {
2799
3223
  }
2800
3224
  export type $defs = Record<string, never>;
2801
3225
  export interface operations {
2802
- listDiagnostics: {
3226
+ createPlaywrightTestRun: {
3227
+ parameters: {
3228
+ query?: never;
3229
+ header?: never;
3230
+ path?: never;
3231
+ cookie?: never;
3232
+ };
3233
+ requestBody: {
3234
+ content: {
3235
+ "application/json": components["schemas"]["PlaywrightTestRunRequest"];
3236
+ };
3237
+ };
3238
+ responses: {
3239
+ /** @description Queued */
3240
+ 202: {
3241
+ headers: {
3242
+ [name: string]: unknown;
3243
+ };
3244
+ content: {
3245
+ "application/json": components["schemas"]["PlaywrightTestRunAccepted"];
3246
+ };
3247
+ };
3248
+ /** @description Error */
3249
+ default: {
3250
+ headers: {
3251
+ [name: string]: unknown;
3252
+ };
3253
+ content: {
3254
+ "application/json": components["schemas"]["Error"];
3255
+ };
3256
+ };
3257
+ };
3258
+ };
3259
+ getPlaywrightTestRun: {
3260
+ parameters: {
3261
+ query?: never;
3262
+ header?: never;
3263
+ path: {
3264
+ /** @description Test run id returned by POST /playwright/test-runs */
3265
+ id: string;
3266
+ };
3267
+ cookie?: never;
3268
+ };
3269
+ requestBody?: never;
3270
+ responses: {
3271
+ /** @description OK */
3272
+ 200: {
3273
+ headers: {
3274
+ [name: string]: unknown;
3275
+ };
3276
+ content: {
3277
+ "application/json": components["schemas"]["PlaywrightTestRun"];
3278
+ };
3279
+ };
3280
+ /** @description Error */
3281
+ default: {
3282
+ headers: {
3283
+ [name: string]: unknown;
3284
+ };
3285
+ content: {
3286
+ "application/json": components["schemas"]["Error"];
3287
+ };
3288
+ };
3289
+ };
3290
+ };
3291
+ listMonitorRuns: {
3292
+ parameters: {
3293
+ query?: {
3294
+ status?: "all" | "failed" | "flaky";
3295
+ /** @description Page size, 1–100 (default 50). Any other value — 0, negative, non-integer — returns 400. A `sort` query parameter is not supported and returns 400 naming the fixed order. */
3296
+ limit?: number;
3297
+ /** @description Opaque cursor from the previous page's next_cursor */
3298
+ cursor?: string;
3299
+ };
3300
+ header?: never;
3301
+ path: {
3302
+ /** @description Resource id (UUID) */
3303
+ id: string;
3304
+ };
3305
+ cookie?: never;
3306
+ };
3307
+ requestBody?: never;
3308
+ responses: {
3309
+ /** @description OK */
3310
+ 200: {
3311
+ headers: {
3312
+ [name: string]: unknown;
3313
+ };
3314
+ content: {
3315
+ "application/json": components["schemas"]["PlaywrightRunSummaryList"];
3316
+ };
3317
+ };
3318
+ /** @description Error */
3319
+ default: {
3320
+ headers: {
3321
+ [name: string]: unknown;
3322
+ };
3323
+ content: {
3324
+ "application/json": components["schemas"]["Error"];
3325
+ };
3326
+ };
3327
+ };
3328
+ };
3329
+ getMonitorRun: {
3330
+ parameters: {
3331
+ query?: never;
3332
+ header?: never;
3333
+ path: {
3334
+ /** @description Resource id (UUID) */
3335
+ id: string;
3336
+ /** @description Run id from GET /monitors/{id}/runs */
3337
+ run_id: string;
3338
+ };
3339
+ cookie?: never;
3340
+ };
3341
+ requestBody?: never;
3342
+ responses: {
3343
+ /** @description OK */
3344
+ 200: {
3345
+ headers: {
3346
+ [name: string]: unknown;
3347
+ };
3348
+ content: {
3349
+ "application/json": components["schemas"]["PlaywrightRun"];
3350
+ };
3351
+ };
3352
+ /** @description Error */
3353
+ default: {
3354
+ headers: {
3355
+ [name: string]: unknown;
3356
+ };
3357
+ content: {
3358
+ "application/json": components["schemas"]["Error"];
3359
+ };
3360
+ };
3361
+ };
3362
+ };
3363
+ listScriptVersions: {
3364
+ parameters: {
3365
+ query?: never;
3366
+ header?: never;
3367
+ path: {
3368
+ /** @description Resource id (UUID) */
3369
+ id: string;
3370
+ };
3371
+ cookie?: never;
3372
+ };
3373
+ requestBody?: never;
3374
+ responses: {
3375
+ /** @description OK */
3376
+ 200: {
3377
+ headers: {
3378
+ [name: string]: unknown;
3379
+ };
3380
+ content: {
3381
+ "application/json": components["schemas"]["ScriptVersionSummaryList"];
3382
+ };
3383
+ };
3384
+ /** @description Error */
3385
+ default: {
3386
+ headers: {
3387
+ [name: string]: unknown;
3388
+ };
3389
+ content: {
3390
+ "application/json": components["schemas"]["Error"];
3391
+ };
3392
+ };
3393
+ };
3394
+ };
3395
+ getScriptVersion: {
3396
+ parameters: {
3397
+ query?: never;
3398
+ header?: never;
3399
+ path: {
3400
+ /** @description Resource id (UUID) */
3401
+ id: string;
3402
+ version: number;
3403
+ };
3404
+ cookie?: never;
3405
+ };
3406
+ requestBody?: never;
3407
+ responses: {
3408
+ /** @description OK */
3409
+ 200: {
3410
+ headers: {
3411
+ [name: string]: unknown;
3412
+ };
3413
+ content: {
3414
+ "application/json": components["schemas"]["ScriptVersion"];
3415
+ };
3416
+ };
3417
+ /** @description Error */
3418
+ default: {
3419
+ headers: {
3420
+ [name: string]: unknown;
3421
+ };
3422
+ content: {
3423
+ "application/json": components["schemas"]["Error"];
3424
+ };
3425
+ };
3426
+ };
3427
+ };
3428
+ listVariables: {
3429
+ parameters: {
3430
+ query?: never;
3431
+ header?: never;
3432
+ path?: never;
3433
+ cookie?: never;
3434
+ };
3435
+ requestBody?: never;
3436
+ responses: {
3437
+ /** @description OK */
3438
+ 200: {
3439
+ headers: {
3440
+ [name: string]: unknown;
3441
+ };
3442
+ content: {
3443
+ "application/json": components["schemas"]["VariableList"];
3444
+ };
3445
+ };
3446
+ /** @description Error */
3447
+ default: {
3448
+ headers: {
3449
+ [name: string]: unknown;
3450
+ };
3451
+ content: {
3452
+ "application/json": components["schemas"]["Error"];
3453
+ };
3454
+ };
3455
+ };
3456
+ };
3457
+ putVariable: {
3458
+ parameters: {
3459
+ query?: never;
3460
+ header?: never;
3461
+ path: {
3462
+ name: string;
3463
+ };
3464
+ cookie?: never;
3465
+ };
3466
+ requestBody: {
3467
+ content: {
3468
+ "application/json": components["schemas"]["VariablePut"];
3469
+ };
3470
+ };
3471
+ responses: {
3472
+ /** @description Updated */
3473
+ 200: {
3474
+ headers: {
3475
+ [name: string]: unknown;
3476
+ };
3477
+ content: {
3478
+ "application/json": components["schemas"]["Variable"];
3479
+ };
3480
+ };
3481
+ /** @description Created */
3482
+ 201: {
3483
+ headers: {
3484
+ [name: string]: unknown;
3485
+ };
3486
+ content: {
3487
+ "application/json": components["schemas"]["Variable"];
3488
+ };
3489
+ };
3490
+ /** @description Error */
3491
+ default: {
3492
+ headers: {
3493
+ [name: string]: unknown;
3494
+ };
3495
+ content: {
3496
+ "application/json": components["schemas"]["Error"];
3497
+ };
3498
+ };
3499
+ };
3500
+ };
3501
+ deleteVariable: {
3502
+ parameters: {
3503
+ query?: never;
3504
+ header?: never;
3505
+ path: {
3506
+ name: string;
3507
+ };
3508
+ cookie?: never;
3509
+ };
3510
+ requestBody?: never;
3511
+ responses: {
3512
+ /** @description OK */
3513
+ 200: {
3514
+ headers: {
3515
+ [name: string]: unknown;
3516
+ };
3517
+ content: {
3518
+ "application/json": components["schemas"]["VariableDeleted"];
3519
+ };
3520
+ };
3521
+ /** @description Error */
3522
+ default: {
3523
+ headers: {
3524
+ [name: string]: unknown;
3525
+ };
3526
+ content: {
3527
+ "application/json": components["schemas"]["Error"];
3528
+ };
3529
+ };
3530
+ };
3531
+ };
3532
+ listDiagnostics: {
2803
3533
  parameters: {
2804
3534
  query?: never;
2805
3535
  header?: never;
@@ -3382,6 +4112,77 @@ export interface operations {
3382
4112
  };
3383
4113
  };
3384
4114
  };
4115
+ getMonitorBaseline: {
4116
+ parameters: {
4117
+ query?: never;
4118
+ header?: never;
4119
+ path: {
4120
+ /** @description Resource id (UUID) */
4121
+ id: string;
4122
+ };
4123
+ cookie?: never;
4124
+ };
4125
+ requestBody?: never;
4126
+ responses: {
4127
+ /** @description OK */
4128
+ 200: {
4129
+ headers: {
4130
+ [name: string]: unknown;
4131
+ };
4132
+ content: {
4133
+ "application/json": components["schemas"]["IntegrityBaseline"];
4134
+ };
4135
+ };
4136
+ /** @description Error */
4137
+ default: {
4138
+ headers: {
4139
+ [name: string]: unknown;
4140
+ };
4141
+ content: {
4142
+ "application/json": components["schemas"]["Error"];
4143
+ };
4144
+ };
4145
+ };
4146
+ };
4147
+ acceptMonitorBaseline: {
4148
+ parameters: {
4149
+ query?: never;
4150
+ header?: {
4151
+ /** @description Unique key for safe retries (Stripe semantics, 24h window): the same key + body replays the original response instead of re-creating. */
4152
+ "Idempotency-Key"?: string;
4153
+ };
4154
+ path: {
4155
+ /** @description Resource id (UUID) */
4156
+ id: string;
4157
+ };
4158
+ cookie?: never;
4159
+ };
4160
+ requestBody?: {
4161
+ content: {
4162
+ "application/json": components["schemas"]["IntegrityBaselineAcceptRequest"];
4163
+ };
4164
+ };
4165
+ responses: {
4166
+ /** @description The pages accepted and the ones skipped */
4167
+ 200: {
4168
+ headers: {
4169
+ [name: string]: unknown;
4170
+ };
4171
+ content: {
4172
+ "application/json": components["schemas"]["IntegrityBaselineAccept"];
4173
+ };
4174
+ };
4175
+ /** @description Error */
4176
+ default: {
4177
+ headers: {
4178
+ [name: string]: unknown;
4179
+ };
4180
+ content: {
4181
+ "application/json": components["schemas"]["Error"];
4182
+ };
4183
+ };
4184
+ };
4185
+ };
3385
4186
  getMonitorUptime: {
3386
4187
  parameters: {
3387
4188
  query?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "watchfor",
3
- "version": "0.9.0",
3
+ "version": "0.11.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",