watchfor 0.11.0 → 0.12.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/README.md +15 -1
- package/dist/cli.js +11 -0
- package/dist/client.d.ts +30 -5
- package/dist/client.js +30 -6
- package/dist/schema.d.ts +97 -13
- package/package.json +1 -1
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 (
|
|
4
|
+
uptime & infrastructure monitoring (30 check types, confirmed alerting,
|
|
5
5
|
status pages, on-call).
|
|
6
6
|
|
|
7
7
|
```bash
|
|
@@ -47,6 +47,12 @@ const { id } = await wf.playwright.testRun({ script, target: "https://shop.examp
|
|
|
47
47
|
const run = await wf.playwright.getTestRun(id); // status: queued | running | done | error
|
|
48
48
|
await wf.variables.put("LOGIN_PASSWORD", { value: process.env.PW!, secret: true });
|
|
49
49
|
|
|
50
|
+
// The same org secrets in HTTP/API/MCP checks: {{NAME}} in auth, a header or the body.
|
|
51
|
+
await wf.variables.put("API_TOKEN", { value: process.env.API_TOKEN!, secret: true });
|
|
52
|
+
await wf.monitors.update(apiMonitorId, {
|
|
53
|
+
config: { requestHeaders: [{ key: "Authorization", value: "Bearer {{API_TOKEN}}" }] },
|
|
54
|
+
});
|
|
55
|
+
|
|
50
56
|
// Older checks: pass next_cursor back as cursor (keep the same hours/success).
|
|
51
57
|
const page = await wf.monitors.checks(monitor.id!, { hours: 24, limit: 100 });
|
|
52
58
|
if (page.next_cursor) {
|
|
@@ -91,6 +97,14 @@ Toolbox. Details: https://watchfor.io/docs/api/diagnostics
|
|
|
91
97
|
- `WatchForError` carries `status`, `code` and `retryAfterSeconds`
|
|
92
98
|
- Pass an idempotency key as the second argument of any `create` call for safe retries
|
|
93
99
|
|
|
100
|
+
## Prometheus metrics (Pro plan and above)
|
|
101
|
+
|
|
102
|
+
```ts
|
|
103
|
+
const text = await wf.metrics({ tag: "production" }); // Prometheus text format
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Usually you point Prometheus at `https://watchfor.io/api/v1/metrics` directly; this is for scripts and one-off checks. See https://watchfor.io/docs/api/prometheus.
|
|
107
|
+
|
|
94
108
|
## CLI
|
|
95
109
|
|
|
96
110
|
```bash
|
package/dist/cli.js
CHANGED
|
@@ -19,6 +19,8 @@ Usage:
|
|
|
19
19
|
Recent probe results for one monitor
|
|
20
20
|
(prints the next_cursor for older pages)
|
|
21
21
|
watchfor report [--period 7d|30d] Org report vs the previous period
|
|
22
|
+
watchfor metrics [--tag t] [--type t]
|
|
23
|
+
Prometheus text format (Pro plan and above)
|
|
22
24
|
watchfor help
|
|
23
25
|
|
|
24
26
|
Environment:
|
|
@@ -55,6 +57,15 @@ async function main() {
|
|
|
55
57
|
console.log(`incidents: ${i.firing} firing (${i.firing_critical} critical) · ${i.acknowledged} acknowledged · ${i.started_24h} started in 24h`);
|
|
56
58
|
return 0;
|
|
57
59
|
}
|
|
60
|
+
case "metrics": {
|
|
61
|
+
const tag = flag(args, "tag");
|
|
62
|
+
const type = flag(args, "type");
|
|
63
|
+
process.stdout.write(await wf.metrics({
|
|
64
|
+
...(tag && tag !== "true" ? { tag } : {}),
|
|
65
|
+
...(type && type !== "true" ? { type } : {}),
|
|
66
|
+
}));
|
|
67
|
+
return 0;
|
|
68
|
+
}
|
|
58
69
|
case "report": {
|
|
59
70
|
const idx = args.indexOf("--period");
|
|
60
71
|
const period = idx !== -1 && (args[idx + 1] === "30d" || args[idx + 1] === "7d")
|
package/dist/client.d.ts
CHANGED
|
@@ -80,6 +80,18 @@ export declare class WatchFor {
|
|
|
80
80
|
me(): Promise<unknown>;
|
|
81
81
|
/** One-call org snapshot: monitor status counts + active incidents. */
|
|
82
82
|
summary(): Promise<Summary>;
|
|
83
|
+
/**
|
|
84
|
+
* The organization in Prometheus text format (Pro plan and above):
|
|
85
|
+
* status, uptime, response times, expiry, heartbeats, hosts. Cached for
|
|
86
|
+
* 60 s server-side. Filters: tag, type, monitor_id (comma-separated),
|
|
87
|
+
* include_hosts.
|
|
88
|
+
*/
|
|
89
|
+
metrics(query?: {
|
|
90
|
+
tag?: string;
|
|
91
|
+
type?: string;
|
|
92
|
+
monitor_id?: string;
|
|
93
|
+
include_hosts?: boolean;
|
|
94
|
+
}): Promise<string>;
|
|
83
95
|
/** Plan limits and live usage. */
|
|
84
96
|
plan(): Promise<Plan>;
|
|
85
97
|
/** Aggregate incident stats: MTTR, MTBF, most unstable monitors. */
|
|
@@ -109,7 +121,7 @@ export declare class WatchFor {
|
|
|
109
121
|
}): Promise<Record<string, unknown>>;
|
|
110
122
|
/** Probe locations for monitor creation. */
|
|
111
123
|
locations(): Promise<List<Record<string, unknown>>>;
|
|
112
|
-
/**
|
|
124
|
+
/** Every monitor type with its exact alert metrics + config fields. */
|
|
113
125
|
monitorTypes(): Promise<List<Record<string, unknown>>>;
|
|
114
126
|
readonly monitors: {
|
|
115
127
|
list: (q?: {
|
|
@@ -123,7 +135,18 @@ export declare class WatchFor {
|
|
|
123
135
|
/** The monitor plus `available_metrics` — the alert metrics valid for
|
|
124
136
|
* its type. */
|
|
125
137
|
get: (id: string) => Promise<MonitorDetail>;
|
|
138
|
+
/** Create a monitor; `config` keys per type come from `monitorTypes()`.
|
|
139
|
+
* Credentials (catalog fields marked `secret` — mailbox/SMTP/FTP
|
|
140
|
+
* passwords, SSH keys, HTTP/API/MCP auth passwords and bearer
|
|
141
|
+
* tokens, credential header values) are write-only: stored encrypted
|
|
142
|
+
* and returned as `"[redacted]"`. `{{NAME}}` in an auth field,
|
|
143
|
+
* header value or request body uses an org variable or secret. */
|
|
126
144
|
create: (body: Record<string, unknown>, idempotencyKey?: string) => Promise<Monitor>;
|
|
145
|
+
/** Partial update; `config` is merged (omitted keys kept, `null`
|
|
146
|
+
* removes). A `"[redacted]"` credential is kept when omitted or sent
|
|
147
|
+
* back unchanged; changing the server, port, TLS mode or login it is
|
|
148
|
+
* used with (HTTP: the URL's host, port or scheme) needs it again in
|
|
149
|
+
* the same call (else 400). */
|
|
127
150
|
update: (id: string, body: Record<string, unknown>) => Promise<Monitor>;
|
|
128
151
|
delete: (id: string) => Promise<Deleted>;
|
|
129
152
|
pause: (id: string) => Promise<Monitor>;
|
|
@@ -139,9 +162,10 @@ export declare class WatchFor {
|
|
|
139
162
|
* page (whether it has one, when and how it was captured). */
|
|
140
163
|
getBaseline: (id: string) => Promise<IntegrityBaseline>;
|
|
141
164
|
/** Page integrity monitors: accept what the newest check saw as the
|
|
142
|
-
* new baseline — all pages, or only `pages
|
|
143
|
-
*
|
|
144
|
-
*
|
|
165
|
+
* new baseline — all pages, or only `pages` — and start a check of
|
|
166
|
+
* them (`check_requested`). In a deploy pipeline, run `checkNow` and
|
|
167
|
+
* wait for a newer check first, so the release is what gets
|
|
168
|
+
* accepted; unfetched pages come back in `skipped`. */
|
|
145
169
|
acceptBaseline: (id: string, body?: {
|
|
146
170
|
pages?: string[];
|
|
147
171
|
}, idempotencyKey?: string) => Promise<IntegrityBaselineAccept>;
|
|
@@ -195,7 +219,8 @@ export declare class WatchFor {
|
|
|
195
219
|
getTestRun: (id: string) => Promise<PlaywrightTestRun>;
|
|
196
220
|
};
|
|
197
221
|
/**
|
|
198
|
-
* Org variables and secrets browser checks read as
|
|
222
|
+
* Org variables and secrets — browser checks read them as
|
|
223
|
+
* process.env.NAME, HTTP/API/MCP checks as {{NAME}}.
|
|
199
224
|
* Secrets are write-only: `list()` never returns their value.
|
|
200
225
|
*/
|
|
201
226
|
readonly variables: {
|
package/dist/client.js
CHANGED
|
@@ -29,7 +29,7 @@ export class WatchFor {
|
|
|
29
29
|
}
|
|
30
30
|
const headers = {
|
|
31
31
|
Authorization: `Bearer ${this.apiKey}`,
|
|
32
|
-
Accept: "application/json",
|
|
32
|
+
Accept: opts.text ? "text/plain, application/json" : "application/json",
|
|
33
33
|
};
|
|
34
34
|
if (opts.body !== undefined)
|
|
35
35
|
headers["Content-Type"] = "application/json";
|
|
@@ -42,6 +42,8 @@ export class WatchFor {
|
|
|
42
42
|
});
|
|
43
43
|
if (res.status === 204)
|
|
44
44
|
return undefined;
|
|
45
|
+
if (opts.text && res.ok)
|
|
46
|
+
return (await res.text());
|
|
45
47
|
let json = null;
|
|
46
48
|
try {
|
|
47
49
|
json = await res.json();
|
|
@@ -66,6 +68,15 @@ export class WatchFor {
|
|
|
66
68
|
summary() {
|
|
67
69
|
return this.request("GET", "/summary");
|
|
68
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* The organization in Prometheus text format (Pro plan and above):
|
|
73
|
+
* status, uptime, response times, expiry, heartbeats, hosts. Cached for
|
|
74
|
+
* 60 s server-side. Filters: tag, type, monitor_id (comma-separated),
|
|
75
|
+
* include_hosts.
|
|
76
|
+
*/
|
|
77
|
+
metrics(query = {}) {
|
|
78
|
+
return this.request("GET", "/metrics", { query, text: true });
|
|
79
|
+
}
|
|
69
80
|
/** Plan limits and live usage. */
|
|
70
81
|
plan() {
|
|
71
82
|
return this.request("GET", "/plan");
|
|
@@ -108,7 +119,7 @@ export class WatchFor {
|
|
|
108
119
|
locations() {
|
|
109
120
|
return this.request("GET", "/locations");
|
|
110
121
|
}
|
|
111
|
-
/**
|
|
122
|
+
/** Every monitor type with its exact alert metrics + config fields. */
|
|
112
123
|
monitorTypes() {
|
|
113
124
|
return this.request("GET", "/meta/monitor-types");
|
|
114
125
|
}
|
|
@@ -118,7 +129,18 @@ export class WatchFor {
|
|
|
118
129
|
/** The monitor plus `available_metrics` — the alert metrics valid for
|
|
119
130
|
* its type. */
|
|
120
131
|
get: (id) => this.request("GET", `/monitors/${id}`),
|
|
132
|
+
/** Create a monitor; `config` keys per type come from `monitorTypes()`.
|
|
133
|
+
* Credentials (catalog fields marked `secret` — mailbox/SMTP/FTP
|
|
134
|
+
* passwords, SSH keys, HTTP/API/MCP auth passwords and bearer
|
|
135
|
+
* tokens, credential header values) are write-only: stored encrypted
|
|
136
|
+
* and returned as `"[redacted]"`. `{{NAME}}` in an auth field,
|
|
137
|
+
* header value or request body uses an org variable or secret. */
|
|
121
138
|
create: (body, idempotencyKey) => this.request("POST", "/monitors", { body, idempotencyKey }),
|
|
139
|
+
/** Partial update; `config` is merged (omitted keys kept, `null`
|
|
140
|
+
* removes). A `"[redacted]"` credential is kept when omitted or sent
|
|
141
|
+
* back unchanged; changing the server, port, TLS mode or login it is
|
|
142
|
+
* used with (HTTP: the URL's host, port or scheme) needs it again in
|
|
143
|
+
* the same call (else 400). */
|
|
122
144
|
update: (id, body) => this.request("PATCH", `/monitors/${id}`, { body }),
|
|
123
145
|
delete: (id) => this.request("DELETE", `/monitors/${id}`),
|
|
124
146
|
pause: (id) => this.request("POST", `/monitors/${id}/pause`),
|
|
@@ -134,9 +156,10 @@ export class WatchFor {
|
|
|
134
156
|
* page (whether it has one, when and how it was captured). */
|
|
135
157
|
getBaseline: (id) => this.request("GET", `/monitors/${id}/baseline`),
|
|
136
158
|
/** Page integrity monitors: accept what the newest check saw as the
|
|
137
|
-
* new baseline — all pages, or only `pages
|
|
138
|
-
*
|
|
139
|
-
*
|
|
159
|
+
* new baseline — all pages, or only `pages` — and start a check of
|
|
160
|
+
* them (`check_requested`). In a deploy pipeline, run `checkNow` and
|
|
161
|
+
* wait for a newer check first, so the release is what gets
|
|
162
|
+
* accepted; unfetched pages come back in `skipped`. */
|
|
140
163
|
acceptBaseline: (id, body, idempotencyKey) => this.request("POST", `/monitors/${id}/baseline`, {
|
|
141
164
|
body: body ?? {},
|
|
142
165
|
idempotencyKey,
|
|
@@ -180,7 +203,8 @@ export class WatchFor {
|
|
|
180
203
|
getTestRun: (id) => this.request("GET", `/playwright/test-runs/${id}`),
|
|
181
204
|
};
|
|
182
205
|
/**
|
|
183
|
-
* Org variables and secrets browser checks read as
|
|
206
|
+
* Org variables and secrets — browser checks read them as
|
|
207
|
+
* process.env.NAME, HTTP/API/MCP checks as {{NAME}}.
|
|
184
208
|
* Secrets are write-only: `list()` never returns their value.
|
|
185
209
|
*/
|
|
186
210
|
variables = {
|
package/dist/schema.d.ts
CHANGED
|
@@ -116,7 +116,7 @@ export interface paths {
|
|
|
116
116
|
path?: never;
|
|
117
117
|
cookie?: never;
|
|
118
118
|
};
|
|
119
|
-
/** Org variables and secrets browser checks read as process.env.NAME (secrets without values) */
|
|
119
|
+
/** Org variables and secrets — browser checks read them as process.env.NAME, HTTP/API/MCP checks as {{NAME}} (secrets without values) */
|
|
120
120
|
get: operations["listVariables"];
|
|
121
121
|
put?: never;
|
|
122
122
|
post?: never;
|
|
@@ -415,7 +415,7 @@ export interface paths {
|
|
|
415
415
|
put?: never;
|
|
416
416
|
/**
|
|
417
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
|
|
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. A check of the pages starts right away (`check_requested`), so open findings close on a clean check within a minute or two. Pages no check has fetched yet are returned in `skipped`. Typical use: the last step of a deploy pipeline — first `POST /v1/monitors/{id}/check-now`, wait until `GET /v1/monitors/{id}/checks` shows a check newer than the release, then accept, so the baseline is the new version and not the one before it.
|
|
419
419
|
*/
|
|
420
420
|
post: operations["acceptMonitorBaseline"];
|
|
421
421
|
delete?: never;
|
|
@@ -1009,6 +1009,26 @@ export interface paths {
|
|
|
1009
1009
|
patch?: never;
|
|
1010
1010
|
trace?: never;
|
|
1011
1011
|
};
|
|
1012
|
+
"/metrics": {
|
|
1013
|
+
parameters: {
|
|
1014
|
+
query?: never;
|
|
1015
|
+
header?: never;
|
|
1016
|
+
path?: never;
|
|
1017
|
+
cookie?: never;
|
|
1018
|
+
};
|
|
1019
|
+
/**
|
|
1020
|
+
* Prometheus metrics: monitor status, uptime 24h/7d/30d, last check and 24h response times, certificate and domain expiry, heartbeat last ping, hosts, fleet health and open incidents (Pro plan and above)
|
|
1021
|
+
* @description Prometheus text exposition 0.0.4 for `scrape_configs` (`authorization: { credentials: wf_live_… }`). The body is computed at most once a minute per organization and filter and cached for 60 s — scrape every 60s; `watchfor_scrape_generated_timestamp_seconds` shows its age. Own limit: 30 requests a minute per organization, on top of the per-key API limit. Per-object series carry only `monitor_id` / `host_id`; join names with `* on(monitor_id) group_left(name, type) watchfor_monitor_info`. Uptime is incident-based (confirmed critical downtime, maintenance excluded), identical to the dashboard. 403 when the plan does not include it.
|
|
1022
|
+
*/
|
|
1023
|
+
get: operations["getPrometheusMetrics"];
|
|
1024
|
+
put?: never;
|
|
1025
|
+
post?: never;
|
|
1026
|
+
delete?: never;
|
|
1027
|
+
options?: never;
|
|
1028
|
+
head?: never;
|
|
1029
|
+
patch?: never;
|
|
1030
|
+
trace?: never;
|
|
1031
|
+
};
|
|
1012
1032
|
"/incidents/stats": {
|
|
1013
1033
|
parameters: {
|
|
1014
1034
|
query?: never;
|
|
@@ -1523,7 +1543,7 @@ export interface components {
|
|
|
1523
1543
|
type: "string" | "number" | "boolean" | "enum" | "array" | "object";
|
|
1524
1544
|
enum?: string[];
|
|
1525
1545
|
default?: unknown;
|
|
1526
|
-
/** @description Write-only credential; read back as [redacted] */
|
|
1546
|
+
/** @description Write-only credential, stored encrypted; read back as "[redacted]". On update omit it, send "" or "[redacted]" to keep it, null to remove it */
|
|
1527
1547
|
secret?: boolean;
|
|
1528
1548
|
description?: string;
|
|
1529
1549
|
};
|
|
@@ -1564,7 +1584,10 @@ export interface components {
|
|
|
1564
1584
|
| "mcp"
|
|
1565
1585
|
| "api"
|
|
1566
1586
|
| "integrity"
|
|
1567
|
-
| "playwright"
|
|
1587
|
+
| "playwright"
|
|
1588
|
+
| "imap"
|
|
1589
|
+
| "pop3"
|
|
1590
|
+
| "email_roundtrip";
|
|
1568
1591
|
target?: string;
|
|
1569
1592
|
description?: string | null;
|
|
1570
1593
|
interval_seconds?: number;
|
|
@@ -1609,8 +1632,10 @@ export interface components {
|
|
|
1609
1632
|
/** @description true when an alert rule is routed to a contact group or the monitor has its own notification groups; false = the dashboard's silent-monitor warning: an incident here would reach nobody. */
|
|
1610
1633
|
has_notification_route?: boolean;
|
|
1611
1634
|
tags?: string[];
|
|
1612
|
-
/** @description Type-specific config
|
|
1613
|
-
config?:
|
|
1635
|
+
/** @description Type-specific config (keys per type under config_fields in GET /meta/monitor-types). Credentials (catalog fields marked secret) are write-only and read back as "[redacted]" */
|
|
1636
|
+
config?: {
|
|
1637
|
+
[key: string]: unknown;
|
|
1638
|
+
};
|
|
1614
1639
|
/** Format: date-time */
|
|
1615
1640
|
created_at?: string;
|
|
1616
1641
|
/**
|
|
@@ -1732,7 +1757,10 @@ export interface components {
|
|
|
1732
1757
|
| "mcp"
|
|
1733
1758
|
| "api"
|
|
1734
1759
|
| "integrity"
|
|
1735
|
-
| "playwright"
|
|
1760
|
+
| "playwright"
|
|
1761
|
+
| "imap"
|
|
1762
|
+
| "pop3"
|
|
1763
|
+
| "email_roundtrip";
|
|
1736
1764
|
/** @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. */
|
|
1737
1765
|
target: string;
|
|
1738
1766
|
/** @description Seconds; validated against the plan's per-type minimum */
|
|
@@ -1747,8 +1775,10 @@ export interface components {
|
|
|
1747
1775
|
/** @description Lowercase alphanumeric with hyphens or colons, e.g. prod, team:web */
|
|
1748
1776
|
tags?: string[];
|
|
1749
1777
|
description?: string | null;
|
|
1750
|
-
/** @description Type-specific settings — the keys and types are listed per type under config_fields in GET /meta/monitor-types. Validated against the monitor type: a wrong value returns 400 naming the field (e.g. `config.timeoutSeconds`); keys the type does not use are dropped. Config that drives an alert preset (dns expectedValues, cdn expectedProvider, cms expectedCms, tcp/udp expectMatchRegexp, websocket expectPattern, mcp expectedProtocolVersion, http failIfBody*Regexp) also creates that preset's alert rule. */
|
|
1751
|
-
config?:
|
|
1778
|
+
/** @description Type-specific settings — the keys and types are listed per type under config_fields in GET /meta/monitor-types. Validated against the monitor type: a wrong value returns 400 naming the field (e.g. `config.timeoutSeconds`); keys the type does not use are dropped. Config that drives an alert preset (dns expectedValues, cdn expectedProvider, cms expectedCms, tcp/udp expectMatchRegexp, websocket expectPattern, mcp expectedProtocolVersion, http failIfBody*Regexp) also creates that preset's alert rule. Credential keys (marked secret in the catalog: password, smtpPassword, receivePassword, privateKey, …) are write-only and stored encrypted; responses return them as "[redacted]". */
|
|
1779
|
+
config?: {
|
|
1780
|
+
[key: string]: unknown;
|
|
1781
|
+
};
|
|
1752
1782
|
/** @default false */
|
|
1753
1783
|
isPaused: boolean;
|
|
1754
1784
|
/**
|
|
@@ -1768,8 +1798,10 @@ export interface components {
|
|
|
1768
1798
|
schedulingStrategy?: "roundrobin" | "random" | "parallel";
|
|
1769
1799
|
locations?: string[];
|
|
1770
1800
|
tags?: string[];
|
|
1771
|
-
/** @description Merged into the stored config: an omitted key is kept, a key set to null is removed, any other value replaces the stored one — arrays and nested objects are replaced whole (requestHeaders: [] clears all headers). The merged result is validated against the monitor type (400 with the field path on a bad value; unknown keys dropped). Alerting-owned keys (notificationGroupIds, confirmationThreshold, durationWindow, repeatIntervalSeconds, failIfBody*Regexp, …) follow the same rule. */
|
|
1772
|
-
config?:
|
|
1801
|
+
/** @description Merged into the stored config: an omitted key is kept, a key set to null is removed, any other value replaces the stored one — arrays and nested objects are replaced whole (requestHeaders: [] clears all headers). The merged result is validated against the monitor type (400 with the field path on a bad value; unknown keys dropped). Alerting-owned keys (notificationGroupIds, confirmationThreshold, durationWindow, repeatIntervalSeconds, expiryReminderDays, failIfBody*Regexp, …) follow the same rule. expiryReminderDays (http, api, mcp, ssl, rdap only) takes whole days 1–365, at most 5, e.g. [14, 3]: an open, unacknowledged certificate- or domain-expiry incident is notified again once when that many days are left. Credentials (catalog fields marked secret — incl. HTTP/API/MCP authPassword and bearerToken — and the values of credential request headers such as Authorization, Cookie or X-API-Key) are write-only and stored encrypted: omitting one, sending "" or the "[redacted]" a read returned keeps the stored value (headers: same header name), null removes it, a new value replaces it; a mask on a header with nothing stored is a 400 naming the field. A requestBody read back as "[redacted]" and sent back unchanged keeps the stored body. {{NAME}} in an auth field, header value or request body references an org variable or secret (GET /v1/variables); it is stored as written and an unknown name is a 400. Changing the server, port, TLS mode or login a stored credential is used with (target, port, tlsMode, username, the round trip's smtp*\/receive* legs; for HTTP/API/MCP the URL's host, port or scheme and the basic-auth username) or turning verifyTls off requires sending the credential again in the same request — otherwise 400 `config.<field>: Re-enter the …`. */
|
|
1802
|
+
config?: {
|
|
1803
|
+
[key: string]: unknown;
|
|
1804
|
+
};
|
|
1773
1805
|
};
|
|
1774
1806
|
CheckNowAck: {
|
|
1775
1807
|
/** @constant */
|
|
@@ -2029,7 +2061,7 @@ export interface components {
|
|
|
2029
2061
|
/** @description Evaluations that fired before and during the incident */
|
|
2030
2062
|
fire_count?: number;
|
|
2031
2063
|
flapping?: boolean;
|
|
2032
|
-
/** @description Only on GET /incidents/{id}: the incident's events in order (opened, notified, acknowledged, resolved, …). */
|
|
2064
|
+
/** @description Only on GET /incidents/{id}: the incident's events in order (opened, notified, acknowledged, resolved, …). A certificate- or domain-expiry incident also records a `reminder` event each time a reminder day is reached (detail: days_left, expires_on, milestone, kind, subject). */
|
|
2033
2065
|
timeline?: {
|
|
2034
2066
|
/** Format: date-time */
|
|
2035
2067
|
at?: string;
|
|
@@ -2092,6 +2124,8 @@ export interface components {
|
|
|
2092
2124
|
}[];
|
|
2093
2125
|
/** Format: date-time */
|
|
2094
2126
|
captured_at?: string | null;
|
|
2127
|
+
/** @description A check of the pages was started right after the accept, so open findings close on it within a minute or two instead of at the next scheduled check */
|
|
2128
|
+
check_requested?: boolean;
|
|
2095
2129
|
};
|
|
2096
2130
|
MonitorReset: {
|
|
2097
2131
|
/** @constant */
|
|
@@ -2685,7 +2719,10 @@ export interface components {
|
|
|
2685
2719
|
| "mcp"
|
|
2686
2720
|
| "api"
|
|
2687
2721
|
| "integrity"
|
|
2688
|
-
| "playwright"
|
|
2722
|
+
| "playwright"
|
|
2723
|
+
| "imap"
|
|
2724
|
+
| "pop3"
|
|
2725
|
+
| "email_roundtrip";
|
|
2689
2726
|
label?: string;
|
|
2690
2727
|
description?: string;
|
|
2691
2728
|
target_format?: string;
|
|
@@ -2702,6 +2739,8 @@ export interface components {
|
|
|
2702
2739
|
severity?: "critical" | "warning";
|
|
2703
2740
|
}[];
|
|
2704
2741
|
};
|
|
2742
|
+
/** @description Prometheus text exposition format 0.0.4: `# HELP` / `# TYPE` lines and one sample per line. Families: watchfor_organization_info, watchfor_monitors, watchfor_health_score, watchfor_incidents_firing, watchfor_incidents_acknowledged, watchfor_maintenance_windows_active, watchfor_hosts, watchfor_monitor_info, watchfor_monitor_up, watchfor_monitor_state, watchfor_monitor_paused, watchfor_monitor_open_incident_severity, watchfor_monitor_check_interval_seconds, watchfor_monitor_last_check_timestamp_seconds, watchfor_monitor_last_check_success, watchfor_monitor_last_check_duration_seconds, watchfor_monitor_checks_24h, watchfor_monitor_avg_duration_24h_seconds, watchfor_monitor_uptime_ratio, watchfor_ssl_certificate_expiry_timestamp_seconds, watchfor_domain_expiry_timestamp_seconds, watchfor_heartbeat_last_ping_timestamp_seconds, watchfor_host_info, watchfor_host_up, watchfor_host_last_seen_timestamp_seconds, watchfor_scrape_generated_timestamp_seconds, watchfor_scrape_duration_seconds. */
|
|
2743
|
+
PrometheusExposition: string;
|
|
2705
2744
|
Summary: {
|
|
2706
2745
|
/** @constant */
|
|
2707
2746
|
object?: "summary";
|
|
@@ -5983,6 +6022,51 @@ export interface operations {
|
|
|
5983
6022
|
};
|
|
5984
6023
|
};
|
|
5985
6024
|
};
|
|
6025
|
+
getPrometheusMetrics: {
|
|
6026
|
+
parameters: {
|
|
6027
|
+
query?: {
|
|
6028
|
+
/** @description Only monitors carrying one of these tags (repeat or comma-separate). Organization totals always cover the whole organization. */
|
|
6029
|
+
tag?: string;
|
|
6030
|
+
/** @description Only monitors of these types (repeat or comma-separate) */
|
|
6031
|
+
type?: string;
|
|
6032
|
+
/** @description Only these monitors (repeat or comma-separate) */
|
|
6033
|
+
monitor_id?: string;
|
|
6034
|
+
/** @description false drops the host families */
|
|
6035
|
+
include_hosts?: boolean;
|
|
6036
|
+
};
|
|
6037
|
+
header?: never;
|
|
6038
|
+
path?: never;
|
|
6039
|
+
cookie?: never;
|
|
6040
|
+
};
|
|
6041
|
+
requestBody?: never;
|
|
6042
|
+
responses: {
|
|
6043
|
+
/** @description Prometheus text exposition (format 0.0.4) */
|
|
6044
|
+
200: {
|
|
6045
|
+
headers: {
|
|
6046
|
+
/** @description Unix seconds when this (possibly cached) body was computed */
|
|
6047
|
+
"X-WatchFor-Metrics-Generated"?: number;
|
|
6048
|
+
[name: string]: unknown;
|
|
6049
|
+
};
|
|
6050
|
+
content: {
|
|
6051
|
+
/**
|
|
6052
|
+
* @example # HELP watchfor_monitor_up 1 unless a confirmed critical incident is open on the monitor.
|
|
6053
|
+
* # TYPE watchfor_monitor_up gauge
|
|
6054
|
+
* watchfor_monitor_up{monitor_id="0fe0d9ba-c062-48f5-a9ec-ead9a4076ebd"} 1
|
|
6055
|
+
*/
|
|
6056
|
+
"text/plain": components["schemas"]["PrometheusExposition"];
|
|
6057
|
+
};
|
|
6058
|
+
};
|
|
6059
|
+
/** @description Error */
|
|
6060
|
+
default: {
|
|
6061
|
+
headers: {
|
|
6062
|
+
[name: string]: unknown;
|
|
6063
|
+
};
|
|
6064
|
+
content: {
|
|
6065
|
+
"application/json": components["schemas"]["Error"];
|
|
6066
|
+
};
|
|
6067
|
+
};
|
|
6068
|
+
};
|
|
6069
|
+
};
|
|
5986
6070
|
getIncidentStats: {
|
|
5987
6071
|
parameters: {
|
|
5988
6072
|
query?: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "watchfor",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.1",
|
|
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",
|