Skip to main content

Class: MigrationRegistry

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

Registry for migration rules per monitor type.

Remarks

Stores and retrieves migration rules, calculates migration paths, and validates migration feasibility. Used by orchestrators and migration utilities.

Constructors

Constructor

new MigrationRegistry(): MigrationRegistry

Returns

MigrationRegistry

Properties

migrations

private readonly migrations: Map<string, MigrationRule[]>

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

Methods

canMigrate()

canMigrate(monitorType: string, fromVersion: string, toVersion: string): boolean

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

Determines if migration is possible between two versions for a monitor type.

Parameters

monitorType

string

The monitor type.

fromVersion

string

The source version.

toVersion

string

The target version.

Returns

boolean

True if migration is possible, false otherwise.

Remarks

Returns true if a valid migration path exists, false otherwise. Does not mutate state.


getMigrationPath()

getMigrationPath(monitorType: string, fromVersion: string, toVersion: string): MigrationRule[]

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

Calculates the migration path (sequence of rules) from one version to another.

Parameters

monitorType

string

The monitor type.

fromVersion

string

The source version.

toVersion

string

The target version.

Returns

MigrationRule[]

Array of migration rules to apply in order.

Remarks

Throws if no valid path exists, a circular path is detected, or the path exceeds the maximum steps limit. Used internally by orchestrators and for migration feasibility checks.

Algorithm ensures no infinite loops by checking for visited versions before adding them to the path. The maximum path length prevents excessive migration chains that could indicate design issues.

Throws

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error If no migration path exists, circular path detected, or path exceeds maximum steps.


registerMigration()

registerMigration(monitorType: string, rule: MigrationRule): void

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

Registers a migration rule for a monitor type.

Parameters

monitorType

string

The monitor type.

rule

MigrationRule

The migration rule to register.

Returns

void

Remarks

Rules are sorted by source version after registration. Throws if migration rules cannot be created for the monitor type.

Throws

Throws if migration rules cannot be created for the monitor type.


compareVersions()

private compareVersions(a: string, b: string): number

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

Internal

Compares two semantic version strings.

Parameters

a

string

First version string.

b

string

Second version string.

Returns

number

-1 if a < b, 1 if a > b, 0 if equal.

Remarks

Used for sorting migration rules and determining migration order. Now includes validation to prevent NaN comparisons from malformed versions.

Throws

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error If either version string is malformed.


validateVersionString()

private validateVersionString(version: string, parameterName: string): void

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

Internal

Validates a version string format to ensure safe processing.

Parameters

version

string

The version string to validate.

parameterName

string

The parameter name for error reporting.

Returns

void

Remarks

Ensures version strings follow semantic versioning pattern and contain only valid characters. Prevents injection attacks and ensures consistent version comparison behavior.

Throws

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error If the version string format is invalid.