File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import {
2121 buildMetadataSection ,
2222} from "./storage/backup-metadata.js" ;
2323import { formatStorageErrorHint } from "./storage/error-hints.js" ;
24+ import { loadFlaggedAccountsFromFile } from "./storage/flagged-storage-file.js" ;
2425import {
2526 collectNamedBackups ,
2627 type NamedBackupSummary ,
@@ -507,9 +508,10 @@ function isCacheLikeBackupArtifactName(entryName: string): boolean {
507508async function loadFlaggedAccountsFromPath (
508509 path : string ,
509510) : Promise < FlaggedAccountStorageV1 > {
510- const content = await fs . readFile ( path , "utf-8" ) ;
511- const data = JSON . parse ( content ) as unknown ;
512- return normalizeFlaggedStorage ( data ) ;
511+ return loadFlaggedAccountsFromFile ( path , {
512+ readFile : fs . readFile ,
513+ normalizeFlaggedStorage,
514+ } ) ;
513515}
514516
515517type AccountsJournalEntry = {
Original file line number Diff line number Diff line change 1+ import type { FlaggedAccountStorageV1 } from "../storage.js" ;
2+
3+ export async function loadFlaggedAccountsFromFile (
4+ path : string ,
5+ deps : {
6+ readFile : typeof import ( "node:fs" ) . promises . readFile ;
7+ normalizeFlaggedStorage : ( data : unknown ) => FlaggedAccountStorageV1 ;
8+ } ,
9+ ) : Promise < FlaggedAccountStorageV1 > {
10+ const content = await deps . readFile ( path , "utf-8" ) ;
11+ const data = JSON . parse ( content ) as unknown ;
12+ return deps . normalizeFlaggedStorage ( data ) ;
13+ }
You can’t perform that action at this time.
0 commit comments