From 33d94b9497e070e6cc2207080a881ef54140e3a2 Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Thu, 12 Aug 2021 10:33:05 -0700 Subject: [PATCH] Migrate OutboundGroupSessionStore to TypeScript --- src/matrix/storage/idb/Transaction.js | 2 +- ...nStore.js => OutboundGroupSessionStore.ts} | 21 +++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) rename src/matrix/storage/idb/stores/{OutboundGroupSessionStore.js => OutboundGroupSessionStore.ts} (60%) diff --git a/src/matrix/storage/idb/Transaction.js b/src/matrix/storage/idb/Transaction.js index 4a7b66fe..092bbb05 100644 --- a/src/matrix/storage/idb/Transaction.js +++ b/src/matrix/storage/idb/Transaction.js @@ -30,7 +30,7 @@ import {UserIdentityStore} from "./stores/UserIdentityStore.js"; import {DeviceIdentityStore} from "./stores/DeviceIdentityStore.js"; import {OlmSessionStore} from "./stores/OlmSessionStore.js"; import {InboundGroupSessionStore} from "./stores/InboundGroupSessionStore.js"; -import {OutboundGroupSessionStore} from "./stores/OutboundGroupSessionStore.js"; +import {OutboundGroupSessionStore} from "./stores/OutboundGroupSessionStore"; import {GroupSessionDecryptionStore} from "./stores/GroupSessionDecryptionStore.js"; import {OperationStore} from "./stores/OperationStore.js"; import {AccountDataStore} from "./stores/AccountDataStore.js"; diff --git a/src/matrix/storage/idb/stores/OutboundGroupSessionStore.js b/src/matrix/storage/idb/stores/OutboundGroupSessionStore.ts similarity index 60% rename from src/matrix/storage/idb/stores/OutboundGroupSessionStore.js rename to src/matrix/storage/idb/stores/OutboundGroupSessionStore.ts index 9710765f..5a33ec2c 100644 --- a/src/matrix/storage/idb/stores/OutboundGroupSessionStore.js +++ b/src/matrix/storage/idb/stores/OutboundGroupSessionStore.ts @@ -13,21 +13,30 @@ 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"; + +interface OutboundSession { + roomId: string; + session: string; + createdAt: number; +} export class OutboundGroupSessionStore { - constructor(store) { + private _store: Store; + + constructor(store: Store) { this._store = store; } - remove(roomId) { - this._store.delete(roomId); + remove(roomId: string): Promise { + return this._store.delete(roomId); } - get(roomId) { + get(roomId: string): Promise { return this._store.get(roomId); } - set(session) { - this._store.put(session); + set(session: OutboundSession): Promise { + return this._store.put(session); } }