diff --git a/src/plugins/holynotes/utils.ts b/src/plugins/holynotes/utils.ts index 520fb2f28..ffea89786 100644 --- a/src/plugins/holynotes/utils.ts +++ b/src/plugins/holynotes/utils.ts @@ -4,23 +4,24 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ +import { createStore } from "@api/DataStore"; import { DataStore } from "@api/index"; import { noteHandlerCache } from "./noteHandler"; import { HolyNotes } from "./types"; - +export const HolyNoteStore = createStore("HolyNoteData", "HolyNoteStore"); export async function saveCacheToDataStore(key: string, value?: HolyNotes.Note[]) { - await DataStore.set(key, value); + await DataStore.set(key, value, HolyNoteStore); } export async function deleteCacheFromDataStore(key: string) { - await DataStore.del(key); + await DataStore.del(key, HolyNoteStore); } export async function getFormatedEntries() { - const data = await DataStore.entries(); + const data = await DataStore.entries(HolyNoteStore); const notebooks: Record = {}; data.forEach(function (note) { @@ -31,9 +32,13 @@ export async function getFormatedEntries() { } export async function DataStoreToCache() { - const data = await DataStore.entries(); + const data = await DataStore.entries(HolyNoteStore); data.forEach(function (note) { noteHandlerCache.set(note[0], note[1]); }); } + +export async function DeleteEntireStore() { + await DataStore.clear(HolyNoteStore); +}