mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
Reduce IDBValidKey returns to the public API
This commit is contained in:
parent
ce20d40ff7
commit
16d3ed579b
@ -148,7 +148,7 @@ export class Store<T> extends QueryTarget<T> {
|
||||
return new QueryTarget<T>(new QueryTargetWrapper<T>(this._idbStore.index(indexName)));
|
||||
}
|
||||
|
||||
put(value: T): Promise<IDBValidKey> {
|
||||
put(value: T): void {
|
||||
// If this request fails, the error will bubble up to the transaction and abort it,
|
||||
// which is the behaviour we want. Therefore, it is ok to not create a promise for this
|
||||
// request and await it.
|
||||
@ -159,12 +159,12 @@ export class Store<T> extends QueryTarget<T> {
|
||||
//
|
||||
// Note that this can still throw synchronously, like it does for TransactionInactiveError,
|
||||
// see https://www.w3.org/TR/IndexedDB-2/#transaction-lifetime-concept
|
||||
return reqAsPromise(this._idbStore.put(value));
|
||||
this._idbStore.put(value);
|
||||
}
|
||||
|
||||
add(value: T): Promise<IDBValidKey> {
|
||||
add(value: T): void {
|
||||
// ok to not monitor result of request, see comment in `put`.
|
||||
return reqAsPromise(this._idbStore.add(value));
|
||||
this._idbStore.add(value);
|
||||
}
|
||||
|
||||
delete(keyOrKeyRange: IDBValidKey | IDBKeyRange): Promise<undefined> {
|
||||
|
@ -4,7 +4,7 @@ import {addRoomToIdentity} from "../../e2ee/DeviceTracker.js";
|
||||
import {RoomMemberStore} from "./stores/RoomMemberStore";
|
||||
import {SessionStore} from "./stores/SessionStore";
|
||||
import {encodeScopeTypeKey} from "./stores/OperationStore.js";
|
||||
import {MAX_UNICODE} from "./stores/common.js";
|
||||
import {MAX_UNICODE} from "./stores/common";
|
||||
|
||||
// FUNCTIONS SHOULD ONLY BE APPENDED!!
|
||||
// the index in the array is the database version
|
||||
|
@ -41,8 +41,8 @@ export class InviteStore {
|
||||
return this._inviteStore.selectAll();
|
||||
}
|
||||
|
||||
set(invite: InviteData): Promise<IDBValidKey> {
|
||||
return this._inviteStore.put(invite);
|
||||
set(invite: InviteData): void {
|
||||
this._inviteStore.put(invite);
|
||||
}
|
||||
|
||||
remove(roomId: string): void {
|
||||
|
@ -50,10 +50,10 @@ export class RoomMemberStore {
|
||||
return this._roomMembersStore.get(encodeKey(roomId, userId));
|
||||
}
|
||||
|
||||
async set(member: MemberData): Promise<IDBValidKey> {
|
||||
set(member: MemberData): void {
|
||||
// Object.assign would be more typesafe, but small objects
|
||||
(member as any).key = encodeKey(member.roomId, member.userId);
|
||||
return this._roomMembersStore.put(member as MemberStorageEntry);
|
||||
this._roomMembersStore.put(member as MemberStorageEntry);
|
||||
}
|
||||
|
||||
getAll(roomId: string): Promise<MemberData[]> {
|
||||
|
@ -42,8 +42,8 @@ export class RoomSummaryStore {
|
||||
return this._summaryStore.selectAll();
|
||||
}
|
||||
|
||||
set(summary: SummaryData): Promise<IDBValidKey> {
|
||||
return this._summaryStore.put(summary);
|
||||
set(summary: SummaryData): void {
|
||||
this._summaryStore.put(summary);
|
||||
}
|
||||
|
||||
get(roomId: string): Promise<SummaryData | null> {
|
||||
|
@ -27,7 +27,7 @@ export class SessionStore {
|
||||
this._sessionStore = sessionStore;
|
||||
}
|
||||
|
||||
async get(key: IDBValidKey): Promise<any> {
|
||||
async get(key: string): Promise<any> {
|
||||
const entry = await this._sessionStore.get(key);
|
||||
if (entry) {
|
||||
return entry.value;
|
||||
@ -42,7 +42,7 @@ export class SessionStore {
|
||||
this._sessionStore.add({key, value});
|
||||
}
|
||||
|
||||
remove(key: IDBValidKey): void {
|
||||
remove(key: string): void {
|
||||
this._sessionStore.delete(key);
|
||||
}
|
||||
}
|
||||
|
@ -39,8 +39,8 @@ export class TimelineRelationStore {
|
||||
this._store = store;
|
||||
}
|
||||
|
||||
add(roomId: string, targetEventId: string, relType: string, sourceEventId: string): Promise<IDBValidKey> {
|
||||
return this._store.add({key: encodeKey(roomId, targetEventId, relType, sourceEventId)});
|
||||
add(roomId: string, targetEventId: string, relType: string, sourceEventId: string): void {
|
||||
this._store.add({key: encodeKey(roomId, targetEventId, relType, sourceEventId)});
|
||||
}
|
||||
|
||||
remove(roomId: string, targetEventId: string, relType: string, sourceEventId: string): Promise<undefined> {
|
||||
|
Loading…
Reference in New Issue
Block a user