diff --git a/README.md b/README.md index f4fd198..8b71aca 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ const monitor = await client.monitors.create({ // re-deploy, or `TERRAFORM` if it lives in `.tf` you re-apply. managedBy: 'DASHBOARD', }) +// Note: `monitor.currentStatus` is null until the first probe runs (~1 minute); display `monitor.currentStatus ?? 'PENDING'`. // Get a single monitor const fetched = await client.monitors.get(monitor.id) diff --git a/src/types.ts b/src/types.ts index e2946a6..cbec11a 100644 --- a/src/types.ts +++ b/src/types.ts @@ -6,7 +6,24 @@ export type Schemas = components['schemas'] // ── Response DTOs ────────────────────────────────────────────────────── -export type MonitorDto = z.infer +type MonitorDtoBase = z.infer + +/** + * Full monitor representation returned by GET, POST, and PUT endpoints. + * + * `currentStatus` is the derived health of the monitor (e.g. `"up"`, + * `"degraded"`, `"down"`). It is populated after the first probe runs — + * typically ~1 minute after create — so on a freshly-created monitor it + * may be `null` or `undefined`. Always provide a fallback when displaying + * it, e.g. `monitor.currentStatus ?? 'PENDING'`. + */ +export type MonitorDto = MonitorDtoBase & { + /** + * Populated after the first probe (~1 minute after create). May be + * null or undefined immediately after create. + */ + currentStatus?: string | null +} export type IncidentDto = z.infer export type IncidentDetailDto = z.infer export type AlertChannelDto = z.infer