diff --git a/src/matrix/storage/idb/Transaction.js b/src/matrix/storage/idb/Transaction.js index 4c543f4c..d4949b02 100644 --- a/src/matrix/storage/idb/Transaction.js +++ b/src/matrix/storage/idb/Transaction.js @@ -17,7 +17,7 @@ limitations under the License. import {txnAsPromise} from "./utils"; import {StorageError} from "../common"; import {Store} from "./Store"; -import {SessionStore} from "./stores/SessionStore.js"; +import {SessionStore} from "./stores/SessionStore"; import {RoomSummaryStore} from "./stores/RoomSummaryStore.js"; import {InviteStore} from "./stores/InviteStore.js"; import {TimelineEventStore} from "./stores/TimelineEventStore.js"; diff --git a/src/matrix/storage/idb/schema.js b/src/matrix/storage/idb/schema.js index d593f6b9..fdfc78d7 100644 --- a/src/matrix/storage/idb/schema.js +++ b/src/matrix/storage/idb/schema.js @@ -1,7 +1,7 @@ import {iterateCursor, reqAsPromise} from "./utils"; import {RoomMember, EVENT_TYPE as MEMBER_EVENT_TYPE} from "../../room/members/RoomMember.js"; import {RoomMemberStore} from "./stores/RoomMemberStore.js"; -import {SessionStore} from "./stores/SessionStore.js"; +import {SessionStore} from "./stores/SessionStore"; import {encodeScopeTypeKey} from "./stores/OperationStore.js"; // FUNCTIONS SHOULD ONLY BE APPENDED!! diff --git a/src/matrix/storage/idb/stores/SessionStore.js b/src/matrix/storage/idb/stores/SessionStore.ts similarity index 59% rename from src/matrix/storage/idb/stores/SessionStore.js rename to src/matrix/storage/idb/stores/SessionStore.ts index 3be8e875..4da63649 100644 --- a/src/matrix/storage/idb/stores/SessionStore.js +++ b/src/matrix/storage/idb/stores/SessionStore.ts @@ -13,28 +13,31 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ +import {Store} from "../Store" export class SessionStore { - constructor(sessionStore) { - this._sessionStore = sessionStore; - } + private _sessionStore: Store - async get(key) { - const entry = await this._sessionStore.get(key); - if (entry) { - return entry.value; - } - } + constructor(sessionStore: Store) { + this._sessionStore = sessionStore; + } - set(key, value) { - this._sessionStore.put({key, value}); - } + async get(key: IDBValidKey) { + const entry = await this._sessionStore.get(key); + if (entry) { + return entry.value; + } + } - add(key, value) { + set(key: IDBValidKey, value: any) { + this._sessionStore.put({key, value}); + } + + add(key: IDBValidKey, value: any) { this._sessionStore.add({key, value}); } - remove(key) { + remove(key: IDBValidKey) { this._sessionStore.delete(key); } }