@ministryofjustice/hmpps-digital-prison-reporting-frontend
Version:
The Digital Prison Reporting Frontend contains templates and code to help display data effectively in UI applications.
60 lines (59 loc) • 1.9 kB
TypeScript
import { RedisClient } from '../data/reportDataStore';
import { MigrationServiceConfig } from '../data/types';
/**
* One-off migration that updates report IDs stored in Redis
* from: abc123
* to: dpr_abc123
*
* The migration is idempotent and will only be marked as complete once
* all user configs have been successfully processed.
*/
export declare class ReportIdMigrationService {
private readonly redisClient;
enabled: boolean;
private static readonly MIGRATION_KEY;
private static readonly USER_CONFIG_PREFIX;
private static readonly MAX_RETRIES;
constructor(redisClient: RedisClient, migrationServiceConfig?: MigrationServiceConfig | undefined);
/**
* Runs the migration.
*/
migrate(): Promise<void>;
/**
* Retries failed migrations up to the configured maximum number
* of attempts.
*/
private retryFailedConfigs;
/**
* Migrates a single user config and persists it if any report IDs
* were updated.
*/
private migrateSingleConfig;
/**
* Retrieves every stored report config from Redis together with its
* associated Redis key.
*/
private getAllConfigs;
/**
* Retrieves all Redis keys containing user report store data.
*/
private getUserConfigKeys;
/**
* Updates all report IDs in a user config and returns the updated
* config along with whether any changes were made.
*/
private migrateConfig;
/**
* Updates report IDs in a collection and returns the updated
* collection together with whether any items changed.
*/
private updateReportIds;
/**
* Converts a legacy report ID into the new DPR-prefixed format.
*
* The method is intentionally idempotent so that rerunning the
* migration will never double-prefix IDs.
*/
private getMigratedReportId;
private ensureConnected;
}