import StorageInterface from "../storage/StorageInterface" ; import { VaultSourceID } from "../types" ; const STORAGE_PREFIX = "bcup_archivecache_" ; export function getSourceOfflineArchive ( storage , sourceID ) { const sourceKey = `${ STORAGE_PREFIX }${ sourceID }` ; return storage . getValue ( sourceKey ) ; } export function sourceHasOfflineCopy ( storage , sourceID ) { return getSourceOfflineArchive ( storage , sourceID ) . then ( archiveContents => ! ! archiveContents && archiveContents . length > 0 ) ; } export function storeSourceOfflineCopy ( storage , sourceID , content ) { const sourceKey = `${ STORAGE_PREFIX }${ sourceID }` ; return storage . setValue ( sourceKey , content ) ; }