Skip to main content

Interface: MigrationRule

Defined in: electron/services/monitoring/MigrationSystem.ts:47

Describes a migration rule for a monitor type.

Remarks

Each migration rule transforms monitor configuration data from one version to another. Used by the migration system to upgrade or modify monitor configuration schemas.

Example

{
description: "Add timeout field",
fromVersion: "1.0.0",
toVersion: "1.1.0",
isBreaking: false,
transform: async (data) => ({ ...data, timeout: 30000 })
}

Properties

description

description: string

Defined in: electron/services/monitoring/MigrationSystem.ts:54

Human-readable description of the migration.

Remarks

Used for logging and diagnostics.


fromVersion

fromVersion: string

Defined in: electron/services/monitoring/MigrationSystem.ts:61

Source version for the migration.

Remarks

The version string this migration starts from (e.g., "1.0.0").


isBreaking

isBreaking: boolean

Defined in: electron/services/monitoring/MigrationSystem.ts:68

Indicates if the migration is breaking.

Remarks

If true, migration may require user intervention or data review.


toVersion

toVersion: string

Defined in: electron/services/monitoring/MigrationSystem.ts:75

Target version for the migration.

Remarks

The version string this migration upgrades to (e.g., "1.1.0").


transform()

transform: (data: {[key: string]: unknown; [key: number]: unknown; [key: symbol]: unknown; history?: StatusHistory[]; activeOperations?: string[]; baselineUrl?: string; bodyKeyword?: string; certificateWarningDays?: number; checkInterval?: number; edgeLocations?: string; expectedHeaderValue?: string; expectedJsonValue?: string; expectedStatusCode?: number; expectedValue?: string; headerName?: string; heartbeatExpectedStatus?: string; heartbeatMaxDriftSeconds?: number; heartbeatStatusField?: string; heartbeatTimestampField?: string; host?: string; id?: string; jsonPath?: string; lastChecked?: Date; maxPongDelayMs?: number; maxReplicationLagSeconds?: number; maxResponseTime?: number; monitoring?: boolean; port?: number; primaryStatusUrl?: string; recordType?: string; replicaStatusUrl?: string; replicationTimestampField?: string; responseTime?: number; retryAttempts?: number; status?: "degraded" | "down" | "paused" | "pending" | "up"; timeout?: number; url?: string; }) => Promise<{[key: string]: unknown; [key: number]: unknown; [key: symbol]: unknown; history?: StatusHistory[]; activeOperations?: string[]; baselineUrl?: string; bodyKeyword?: string; certificateWarningDays?: number; checkInterval?: number; edgeLocations?: string; expectedHeaderValue?: string; expectedJsonValue?: string; expectedStatusCode?: number; expectedValue?: string; headerName?: string; heartbeatExpectedStatus?: string; heartbeatMaxDriftSeconds?: number; heartbeatStatusField?: string; heartbeatTimestampField?: string; host?: string; id?: string; jsonPath?: string; lastChecked?: Date; maxPongDelayMs?: number; maxReplicationLagSeconds?: number; maxResponseTime?: number; monitoring?: boolean; port?: number; primaryStatusUrl?: string; recordType?: string; replicaStatusUrl?: string; replicationTimestampField?: string; responseTime?: number; retryAttempts?: number; status?: "degraded" | "down" | "paused" | "pending" | "up"; timeout?: number; url?: string; }>

Defined in: electron/services/monitoring/MigrationSystem.ts:92

Transformation function to migrate monitor configuration data.

Parameters

data

Monitor configuration data to transform.

history?

StatusHistory[]

Optional history collection supplied by advanced flows.

activeOperations?

string[]

Array of currently active operations for this monitor

baselineUrl?

string

Baseline origin URL when comparing CDN edge consistency

bodyKeyword?

string

Keyword that must be present in HTTP response bodies

certificateWarningDays?

number

Certificate expiry warning threshold in days for SSL monitoring

checkInterval?

number

Interval between checks in milliseconds

edgeLocations?

string

Optional list of encoded CDN edge endpoints (comma or newline separated)

expectedHeaderValue?

string

Expected value for HTTP header verification

expectedJsonValue?

string

Expected value within a JSON payload

expectedStatusCode?

number

Expected HTTP status code for status-based HTTP monitors

expectedValue?

string

Expected value for DNS record verification

headerName?

string

HTTP header name to inspect

heartbeatExpectedStatus?

string

Expected status string returned by heartbeat endpoints

heartbeatMaxDriftSeconds?

number

Maximum tolerated heartbeat staleness in seconds

heartbeatStatusField?

string

Field name (dot notation supported) that exposes heartbeat status

heartbeatTimestampField?

string

Field name (dot notation supported) that exposes heartbeat timestamp

host?

string

Hostname or IP address to monitor

id?

string

Unique identifier for the monitor

jsonPath?

string

JSON path expression used for HTTP JSON monitors

lastChecked?

Date

Timestamp of the last check performed

maxPongDelayMs?

number

Maximum acceptable delay before a WebSocket pong response (milliseconds)

maxReplicationLagSeconds?

number

Maximum allowable replication lag in seconds

maxResponseTime?

number

Maximum allowed response time for latency monitors

monitoring?

boolean

Whether monitoring is currently active for this monitor

port?

number

Port number for port-based monitoring

primaryStatusUrl?

string

Primary node status endpoint used for replication comparisons

recordType?

string

DNS record type to query (A, AAAA, CNAME, etc.)

replicaStatusUrl?

string

Replica node status endpoint used for replication comparisons

replicationTimestampField?

string

JSON field (dot notation supported) containing replication timestamps

responseTime?

number

Latest response time measurement in milliseconds

retryAttempts?

number

Number of retry attempts when a check fails

status?

"degraded" | "down" | "paused" | "pending" | "up"

Current status of the monitor

timeout?

number

Timeout for monitor checks in milliseconds

url?

string

URL to monitor for HTTP-based checks

Returns

Promise<{[key: string]: unknown; [key: number]: unknown; [key: symbol]: unknown; history?: StatusHistory[]; activeOperations?: string[]; baselineUrl?: string; bodyKeyword?: string; certificateWarningDays?: number; checkInterval?: number; edgeLocations?: string; expectedHeaderValue?: string; expectedJsonValue?: string; expectedStatusCode?: number; expectedValue?: string; headerName?: string; heartbeatExpectedStatus?: string; heartbeatMaxDriftSeconds?: number; heartbeatStatusField?: string; heartbeatTimestampField?: string; host?: string; id?: string; jsonPath?: string; lastChecked?: Date; maxPongDelayMs?: number; maxReplicationLagSeconds?: number; maxResponseTime?: number; monitoring?: boolean; port?: number; primaryStatusUrl?: string; recordType?: string; replicaStatusUrl?: string; replicationTimestampField?: string; responseTime?: number; retryAttempts?: number; status?: "degraded" | "down" | "paused" | "pending" | "up"; timeout?: number; url?: string; }>

A promise resolving to the transformed monitor configuration.

Remarks

Receives the monitor configuration data and returns a Promise resolving to the transformed data. Must handle all data validation and transformation logic for the version upgrade. May throw if transformation fails or data is invalid.

Throws

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error When transformation fails due to invalid data, missing required fields, or data validation errors