Remove matrix-events-sdk dependency (#31398)

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski
2025-12-04 13:24:28 +00:00
committed by GitHub
parent d1f45da51a
commit e7be9d16b9
40 changed files with 70 additions and 106 deletions

View File

@@ -15,7 +15,6 @@ import { KnownMembership } from "matrix-js-sdk/src/types";
import { logger } from "matrix-js-sdk/src/logger";
import { type ViewRoom as ViewRoomEvent } from "@matrix-org/analytics-events/types/typescript/ViewRoom";
import { type JoinedRoom as JoinedRoomEvent } from "@matrix-org/analytics-events/types/typescript/JoinedRoom";
import { type Optional } from "matrix-events-sdk";
import EventEmitter from "events";
import {
RoomViewLifecycle,
@@ -664,16 +663,16 @@ export class RoomViewStore extends EventEmitter {
}
// The room ID of the room currently being viewed
public getRoomId(): Optional<string> {
public getRoomId(): string | null {
return this.state.roomId;
}
public getThreadId(): Optional<string> {
public getThreadId(): string | null {
return this.state.threadId;
}
// The event to scroll to when the room is first viewed
public getInitialEventId(): Optional<string> {
public getInitialEventId(): string | null {
return this.state.initialEventId;
}
@@ -688,7 +687,7 @@ export class RoomViewStore extends EventEmitter {
}
// The room alias of the room (or null if not originally specified in view_room)
public getRoomAlias(): Optional<string> {
public getRoomAlias(): string | null {
return this.state.roomAlias;
}
@@ -698,7 +697,7 @@ export class RoomViewStore extends EventEmitter {
}
// Any error that has occurred during loading
public getRoomLoadError(): Optional<MatrixError> {
public getRoomLoadError(): MatrixError | null {
return this.state.roomLoadError;
}
@@ -730,7 +729,7 @@ export class RoomViewStore extends EventEmitter {
}
// Any error that has occurred during joining
public getJoinError(): Optional<Error> {
public getJoinError(): Error | null {
return this.state.joinError;
}

View File

@@ -6,7 +6,6 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Com
Please see LICENSE files in the repository root for full details.
*/
import { type Optional } from "matrix-events-sdk";
import { type Room, type IEventRelation, RelationType } from "matrix-js-sdk/src/matrix";
import { AsyncStoreWithClient } from "./AsyncStoreWithClient";
@@ -17,7 +16,7 @@ import { createVoiceMessageRecording, type VoiceMessageRecording } from "../audi
const SEPARATOR = "|";
interface IState {
[voiceRecordingId: string]: Optional<VoiceMessageRecording>;
[voiceRecordingId: string]: VoiceMessageRecording;
}
export class VoiceRecordingStore extends AsyncStoreWithClient<IState> {
@@ -51,9 +50,9 @@ export class VoiceRecordingStore extends AsyncStoreWithClient<IState> {
/**
* Gets the active recording instance, if any.
* @param {string} voiceRecordingId The room ID (with optionally the thread ID if in one) to get the recording in.
* @returns {Optional<VoiceRecording>} The recording, if any.
* @returns {VoiceRecording?} The recording, if any.
*/
public getActiveRecording(voiceRecordingId: string): Optional<VoiceMessageRecording> {
public getActiveRecording(voiceRecordingId: string): VoiceMessageRecording | undefined {
return this.state[voiceRecordingId];
}

View File

@@ -8,7 +8,6 @@ Please see LICENSE files in the repository root for full details.
import { logger } from "matrix-js-sdk/src/logger";
import { CryptoEvent } from "matrix-js-sdk/src/crypto-api";
import { type Optional } from "matrix-events-sdk";
import defaultDispatcher from "../../dispatcher/dispatcher";
import { pendingVerificationRequestForUser } from "../../verification";
@@ -58,7 +57,7 @@ export default class RightPanelStore extends ReadyWatchingStore {
private global?: IRightPanelForRoom;
private byRoom: { [roomId: string]: IRightPanelForRoom } = {};
private viewedRoomId: Optional<string>;
private viewedRoomId: string | null = null;
private constructor() {
super(defaultDispatcher);
@@ -419,7 +418,7 @@ export default class RightPanelStore extends ReadyWatchingStore {
}
};
private handleViewedRoomChange(oldRoomId: Optional<string>, newRoomId: Optional<string>): void {
private handleViewedRoomChange(oldRoomId: string | null, newRoomId: string | null): void {
if (!this.mxClient) return; // not ready, onReady will handle the first room
this.viewedRoomId = newRoomId;
// load values from byRoomCache with the viewedRoomId.

View File

@@ -7,7 +7,6 @@
*/
import { type Room, RoomStateEvent, type MatrixEvent } from "matrix-js-sdk/src/matrix";
import { type Optional } from "matrix-events-sdk";
import { MapWithDefault, recursiveMapToObject } from "matrix-js-sdk/src/utils";
import { type IWidget } from "matrix-widget-api";
import { clamp, defaultNumber, sum } from "@element-hq/web-shared-components";
@@ -316,7 +315,7 @@ export class WidgetLayoutStore extends ReadyWatchingStore {
}
}
public getContainerWidgets(room: Optional<Room>, container: Container): IWidget[] {
public getContainerWidgets(room: Room | null, container: Container): IWidget[] {
return (room && this.byRoom.get(room.roomId)?.get(container)?.ordered) || [];
}