import type { FlexStore } from '../ts/classes.flexstore.js'; import { FlexHarnessV3MigrationRunner } from './v10_flexharnessv3migration.js'; import { FlexProjectionOrderMigration } from './v13_flexprojectionorder.js'; export interface IFlexPersistenceMigrationOptions { store: FlexStore; storageKeys: Iterable; } export class FlexPersistenceMigrationRunner { private readonly store: FlexStore; private readonly storageKeys: string[]; constructor(optionsArg: IFlexPersistenceMigrationOptions) { this.store = optionsArg.store; this.storageKeys = [...new Set(optionsArg.storageKeys)].sort(); } public async run(signalArg?: AbortSignal): Promise { await new FlexHarnessV3MigrationRunner({ store: this.store, storageKeys: this.storageKeys, }).run(signalArg); await new FlexProjectionOrderMigration({ store: this.store, storageKeys: this.storageKeys, }).run(signalArg); for (const storageKey of this.storageKeys) { signalArg?.throwIfAborted(); await this.store.ensurePublicProjection(storageKey); } } }