Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
19 changes: 18 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,24 @@ export type Schemas = components['schemas']

// ── Response DTOs ──────────────────────────────────────────────────────

export type MonitorDto = z.infer<typeof S.MonitorDtoSchema>
type MonitorDtoBase = z.infer<typeof S.MonitorDtoSchema>

/**
* 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<typeof S.IncidentDtoSchema>
export type IncidentDetailDto = z.infer<typeof S.IncidentDetailDtoSchema>
export type AlertChannelDto = z.infer<typeof S.AlertChannelDtoSchema>
Expand Down
Loading