From c20ecd4b1aff30d1adcb0532fb8480ad84faf802 Mon Sep 17 00:00:00 2001 From: Linus Rath <139418639+rathlinus@users.noreply.github.com> Date: Sat, 31 Oct 2026 22:42:14 +0100 Subject: [PATCH] refactor: let each store bring its own step for the shared-store import --- lib/shared-store/import.ts | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/shared-store/import.ts b/lib/shared-store/import.ts index 0256f5204..b6ed02af5 100644 --- a/lib/shared-store/import.ts +++ b/lib/shared-store/import.ts @@ -2,12 +2,21 @@ import type { ImportSummary } from './boot'; /** * Copy an existing single-instance install's local files into an - * uninitialised shared store (#1066). Every store adds its own step here; - * each step writes only what the store doesn't hold yet (put with - * ifVersion: null), so running it again changes nothing, and it never - * changes or deletes a local file. + * uninitialised shared store (#1066). Every store brings its own steps (in + * lib/shared-store/import/.ts); each step reads that store's local + * files exactly as local mode would and writes only what the store doesn't + * hold yet (put with ifVersion: null), so running it again changes nothing. + * It never changes or deletes a local file. Returns how many items it wrote. */ -export async function importLocalData(): Promise { +export interface ImportStep { + name: string; + run(): Promise; +} + +const STEPS: ImportStep[] = []; + +export async function importLocalData(steps: ImportStep[] = STEPS): Promise { const imported: Record = {}; + for (const step of steps) imported[step.name] = await step.run(); return { imported }; }