diff --git a/src/matrix/storage/idb/Transaction.js b/src/matrix/storage/idb/Transaction.js index d4949b02..c92999b8 100644 --- a/src/matrix/storage/idb/Transaction.js +++ b/src/matrix/storage/idb/Transaction.js @@ -18,7 +18,7 @@ import {txnAsPromise} from "./utils"; import {StorageError} from "../common"; import {Store} from "./Store"; import {SessionStore} from "./stores/SessionStore"; -import {RoomSummaryStore} from "./stores/RoomSummaryStore.js"; +import {RoomSummaryStore} from "./stores/RoomSummaryStore"; import {InviteStore} from "./stores/InviteStore.js"; import {TimelineEventStore} from "./stores/TimelineEventStore.js"; import {TimelineRelationStore} from "./stores/TimelineRelationStore.js"; diff --git a/src/matrix/storage/idb/stores/RoomSummaryStore.js b/src/matrix/storage/idb/stores/RoomSummaryStore.ts similarity index 57% rename from src/matrix/storage/idb/stores/RoomSummaryStore.js rename to src/matrix/storage/idb/stores/RoomSummaryStore.ts index 426a01bb..19e847b1 100644 --- a/src/matrix/storage/idb/stores/RoomSummaryStore.js +++ b/src/matrix/storage/idb/stores/RoomSummaryStore.ts @@ -27,31 +27,35 @@ store contains: inviteCount joinCount */ +import {Store} from "../Store"; +import {SummaryData} from "../../../room/RoomSummary"; /** Used for both roomSummary and archivedRoomSummary stores */ export class RoomSummaryStore { - constructor(summaryStore) { - this._summaryStore = summaryStore; - } + private _summaryStore: Store; - getAll() { - return this._summaryStore.selectAll(); - } + constructor(summaryStore: Store) { + this._summaryStore = summaryStore; + } - set(summary) { - return this._summaryStore.put(summary); - } + getAll(): Promise { + return this._summaryStore.selectAll(); + } - get(roomId) { - return this._summaryStore.get(roomId); - } + set(summary: SummaryData): Promise { + return this._summaryStore.put(summary); + } - async has(roomId) { + get(roomId: string): Promise { + return this._summaryStore.get(roomId); + } + + async has(roomId: string): Promise { const fetchedKey = await this._summaryStore.getKey(roomId); return roomId === fetchedKey; - } + } - remove(roomId) { - return this._summaryStore.delete(roomId); - } + remove(roomId: string): Promise { + return this._summaryStore.delete(roomId); + } }