1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-07-30 04:23:07 +03:00

Update dependency prettier to v3 (#3983)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
renovate[bot]
2024-01-02 17:56:06 +00:00
committed by GitHub
parent a1ff63adcb
commit 0f65088fd9
50 changed files with 240 additions and 107 deletions

View File

@ -16,7 +16,7 @@
"gendoc": "typedoc",
"lint": "yarn lint:types && yarn lint:js && yarn lint:workflows",
"lint:js": "eslint --max-warnings 0 src spec && prettier --check .",
"lint:js-fix": "prettier --loglevel=warn --write . && eslint --fix src spec",
"lint:js-fix": "prettier --log-level=warn --write . && eslint --fix src spec",
"lint:types": "tsc --noEmit",
"lint:workflows": "find .github/workflows -type f \\( -iname '*.yaml' -o -iname '*.yml' \\) | xargs -I {} sh -c 'echo \"Linting {}\"; action-validator \"{}\"'",
"test": "jest",
@ -117,7 +117,7 @@
"jest-mock": "^29.0.0",
"lint-staged": "^15.0.2",
"matrix-mock-request": "^2.5.0",
"prettier": "2.8.8",
"prettier": "3.1.1",
"rimraf": "^5.0.0",
"ts-node": "^10.9.1",
"typedoc": "^0.24.0",

View File

@ -269,7 +269,11 @@ export class MockRTCRtpTransceiver {
}
export class MockMediaStreamTrack {
constructor(public readonly id: string, public readonly kind: "audio" | "video", public enabled = true) {}
constructor(
public readonly id: string,
public readonly kind: "audio" | "video",
public enabled = true,
) {}
public stop = jest.fn<void, []>();
@ -306,7 +310,10 @@ export class MockMediaStreamTrack {
// XXX: Using EventTarget in jest doesn't seem to work, so we write our own
// implementation
export class MockMediaStream {
constructor(public id: string, private tracks: MockMediaStreamTrack[] = []) {}
constructor(
public id: string,
private tracks: MockMediaStreamTrack[] = [],
) {}
public listeners: [string, (...args: any[]) => any][] = [];
public isStopped = false;
@ -435,7 +442,11 @@ type EmittedEventMap = CallEventHandlerEventHandlerMap &
export class MockCallMatrixClient extends TypedEventEmitter<EmittedEvents, EmittedEventMap> {
public mediaHandler = new MockMediaHandler();
constructor(public userId: string, public deviceId: string, public sessionId: string) {
constructor(
public userId: string,
public deviceId: string,
public sessionId: string,
) {
super();
}
@ -502,7 +513,10 @@ export class MockCallMatrixClient extends TypedEventEmitter<EmittedEvents, Emitt
}
export class MockMatrixCall extends TypedEventEmitter<CallEvent, CallEventHandlerMap> {
constructor(public roomId: string, public groupCallId?: string) {
constructor(
public roomId: string,
public groupCallId?: string,
) {
super();
}
@ -550,7 +564,11 @@ export class MockMatrixCall extends TypedEventEmitter<CallEvent, CallEventHandle
}
export class MockCallFeed {
constructor(public userId: string, public deviceId: string | undefined, public stream: MockMediaStream) {}
constructor(
public userId: string,
public deviceId: string | undefined,
public stream: MockMediaStream,
) {}
public measureVolumeActivity(val: boolean) {}
public dispose() {}

View File

@ -1263,7 +1263,7 @@ describe("Crypto", function () {
({
init_with_private_key: jest.fn(),
free,
} as unknown as PkDecryption),
}) as unknown as PkDecryption,
);
client.client.checkSecretStoragePrivateKey(new Uint8Array(), "");
expect(free).toHaveBeenCalled();
@ -1289,7 +1289,7 @@ describe("Crypto", function () {
({
init_with_seed: jest.fn(),
free,
} as unknown as PkSigning),
}) as unknown as PkSigning,
);
client.client.checkCrossSigningPrivateKey(new Uint8Array(), "");
expect(free).toHaveBeenCalled();

View File

@ -106,7 +106,7 @@ describe("Cross Signing", function () {
});
alice.uploadKeySignatures = async () => ({ failures: {} });
alice.setAccountData = async () => ({});
alice.getAccountDataFromServer = async <T>() => ({} as T);
alice.getAccountDataFromServer = async <T>() => ({}) as T;
// set Alice's cross-signing key
await alice.bootstrapCrossSigning({
authUploadDeviceSigningKeys: async (func) => {
@ -146,7 +146,7 @@ describe("Cross Signing", function () {
};
alice.uploadKeySignatures = async () => ({ failures: {} });
alice.setAccountData = async () => ({});
alice.getAccountDataFromServer = async <T extends { [k: string]: any }>(): Promise<T | null> => ({} as T);
alice.getAccountDataFromServer = async <T extends { [k: string]: any }>(): Promise<T | null> => ({}) as T;
const authUploadDeviceSigningKeys: BootstrapCrossSigningOpts["authUploadDeviceSigningKeys"] = async (func) => {
await func({});
};

View File

@ -189,12 +189,10 @@ describe("SAS verification", function () {
const origSendToDevice = bob.client.sendToDevice.bind(bob.client);
bob.client.sendToDevice = async (type, map) => {
if (type === "m.key.verification.accept") {
macMethod = map
.get(alice.client.getUserId()!)
?.get(alice.client.deviceId!)?.message_authentication_code;
keyAgreement = map
.get(alice.client.getUserId()!)
?.get(alice.client.deviceId!)?.key_agreement_protocol;
macMethod = map.get(alice.client.getUserId()!)?.get(alice.client.deviceId!)
?.message_authentication_code;
keyAgreement = map.get(alice.client.getUserId()!)?.get(alice.client.deviceId!)
?.key_agreement_protocol;
}
return origSendToDevice(type, map);
};

View File

@ -213,7 +213,7 @@ describe("MSC3089Branch", () => {
expect(eventId).toEqual(fileEventId);
return fileEvent;
},
} as EventTimelineSet);
}) as EventTimelineSet;
client.mxcUrlToHttp = (mxc: string) => {
expect(mxc).toEqual("mxc://" + mxcLatter);
return `https://example.org/_matrix/media/v1/download/${mxcLatter}`;
@ -239,7 +239,7 @@ describe("MSC3089Branch", () => {
expect(eventId).toEqual(fileEventId);
return fileEvent;
},
} as EventTimelineSet);
}) as EventTimelineSet;
client.mxcUrlToHttp = (mxc: string) => {
expect(mxc).toEqual("mxc://" + mxcLatter);
return `https://example.org/_matrix/media/v1/download/${mxcLatter}`;
@ -332,7 +332,7 @@ describe("MSC3089Branch", () => {
getId: () => "$unknown",
},
];
staticRoom.getLiveTimeline = () => ({ getEvents: () => events } as EventTimeline);
staticRoom.getLiveTimeline = () => ({ getEvents: () => events }) as EventTimeline;
directory.getFile = (evId: string) => {
expect(evId).toEqual(fileEventId);

View File

@ -399,7 +399,7 @@ describe("MSC3089TreeSpace", () => {
];
},
};
client.getRoom = () => ({} as Room); // to appease the TreeSpace constructor
client.getRoom = () => ({}) as Room; // to appease the TreeSpace constructor
const getFn = jest.fn().mockImplementation((roomId: string) => {
if (roomId === thirdChildRoom) {
@ -422,7 +422,7 @@ describe("MSC3089TreeSpace", () => {
});
it("should find specific directories", () => {
client.getRoom = () => ({} as Room); // to appease the TreeSpace constructor
client.getRoom = () => ({}) as Room; // to appease the TreeSpace constructor
// Only mocking used API
const firstSubdirectory = { roomId: "!first:example.org" } as any as MSC3089TreeSpace;

View File

@ -32,7 +32,10 @@ export class DummyTransport<D extends RendezvousTransportDetails, T> implements
ready = false;
cancelled = false;
constructor(private name: string, private mockDetails: D) {}
constructor(
private name: string,
private mockDetails: D,
) {}
onCancelled?: RendezvousFailureListener;
details(): Promise<RendezvousTransportDetails> {

View File

@ -3315,7 +3315,7 @@ describe("Room", function () {
return event1 === `eventId${i}` ? 1 : -1;
},
findEventById: jest.fn().mockReturnValue({} as MatrixEvent),
} as unknown as EventTimelineSet);
}) as unknown as EventTimelineSet;
expect(room.getEventReadUpTo(userA)).toEqual(`eventId${i}`);
}
@ -3328,7 +3328,7 @@ describe("Room", function () {
({
compareEventOrdering: () => null,
findEventById: jest.fn().mockReturnValue({} as MatrixEvent),
} as unknown as EventTimelineSet);
}) as unknown as EventTimelineSet;
room.getReadReceiptForUserId = (userId, ignore, receiptType): WrappedReceipt | null => {
if (receiptType === ReceiptType.ReadPrivate) {
return { eventId: "eventId1", data: { ts: i === 1 ? 2 : 1 } } as WrappedReceipt;
@ -3348,7 +3348,7 @@ describe("Room", function () {
({
compareEventOrdering: () => null,
findEventById: jest.fn().mockReturnValue({} as MatrixEvent),
} as unknown as EventTimelineSet);
}) as unknown as EventTimelineSet;
room.getReadReceiptForUserId = (userId, ignore, receiptType): WrappedReceipt | null => {
if (receiptType === ReceiptType.Read) {
return { eventId: "eventId2", data: { ts: 1 } } as WrappedReceipt;
@ -3366,7 +3366,7 @@ describe("Room", function () {
({
compareEventOrdering: () => null,
findEventById: jest.fn().mockReturnValue({} as MatrixEvent),
} as unknown as EventTimelineSet);
}) as unknown as EventTimelineSet;
});
it("should give precedence to m.read.private", () => {

View File

@ -484,7 +484,7 @@ describe("RustCrypto", () => {
decryptEvent: () =>
({
senderCurve25519Key: "1234",
} as IEventDecryptionResult),
}) as IEventDecryptionResult,
} as unknown as CryptoBackend;
await event.attemptDecryption(mockCryptoBackend);
@ -524,7 +524,7 @@ describe("RustCrypto", () => {
decryptEvent: () =>
({
clearEvent: { content: { body: "1234" } },
} as unknown as IEventDecryptionResult),
}) as unknown as IEventDecryptionResult,
} as unknown as CryptoBackend;
await encryptedEvent.attemptDecryption(mockCryptoBackend);
return encryptedEvent;

View File

@ -954,7 +954,7 @@ describe("Group Call", function () {
},
},
}),
} as MatrixEvent);
}) as MatrixEvent;
it("should mute remote feed's audio after receiving metadata with video audio", async () => {
const metadataEvent = getMetadataEvent(true, false);
@ -965,7 +965,7 @@ describe("Group Call", function () {
// @ts-ignore
const call = groupCall.calls.get(FAKE_USER_ID_2)!.get(FAKE_DEVICE_ID_2)!;
call.getOpponentMember = () => ({ userId: call.invitee } as RoomMember);
call.getOpponentMember = () => ({ userId: call.invitee }) as RoomMember;
// @ts-ignore Mock
call.pushRemoteFeed(
// @ts-ignore Mock
@ -992,7 +992,7 @@ describe("Group Call", function () {
// @ts-ignore
const call = groupCall.calls.get(FAKE_USER_ID_2).get(FAKE_DEVICE_ID_2)!;
call.getOpponentMember = () => ({ userId: call.invitee } as RoomMember);
call.getOpponentMember = () => ({ userId: call.invitee }) as RoomMember;
// @ts-ignore Mock
call.pushRemoteFeed(
// @ts-ignore Mock
@ -1310,7 +1310,7 @@ describe("Group Call", function () {
// @ts-ignore
const call = groupCall.calls.get(FAKE_USER_ID_2)!.get(FAKE_DEVICE_ID_2)!;
call.getOpponentMember = () => ({ userId: call.invitee } as RoomMember);
call.getOpponentMember = () => ({ userId: call.invitee }) as RoomMember;
call.onNegotiateReceived({
getContent: () => ({
[SDPStreamMetadataKey]: {

View File

@ -26,7 +26,10 @@ export class NamespacedValue<S extends string, U extends string> {
public constructor(stable: S, unstable: U);
public constructor(stable: S, unstable?: U);
public constructor(stable: null | undefined, unstable: U);
public constructor(public readonly stable?: S | null, public readonly unstable?: U) {
public constructor(
public readonly stable?: S | null,
public readonly unstable?: U,
) {
if (!this.unstable && !this.stable) {
throw new Error("One of stable or unstable values must be supplied");
}

View File

@ -38,7 +38,10 @@ interface ISecretRequestInternal {
export class SecretSharing {
private requests = new Map<string, ISecretRequestInternal>();
public constructor(private readonly baseApis: MatrixClient, private readonly cryptoCallbacks: ICryptoCallbacks) {}
public constructor(
private readonly baseApis: MatrixClient,
private readonly cryptoCallbacks: ICryptoCallbacks,
) {}
/**
* Request a secret from another device

View File

@ -210,7 +210,11 @@ export abstract class DecryptionAlgorithm {
export class DecryptionError extends Error {
public readonly detailedString: string;
public constructor(public readonly code: string, msg: string, details?: Record<string, string | Error>) {
public constructor(
public readonly code: string,
msg: string,
details?: Record<string, string | Error>,
) {
super(msg);
this.code = code;
this.name = "DecryptionError";
@ -242,7 +246,11 @@ export class UnknownDeviceError extends Error {
* @param msg - message describing the problem
* @param devices - set of unknown devices per user we're warning about
*/
public constructor(msg: string, public readonly devices: DeviceInfoMap, public event?: MatrixEvent) {
public constructor(
msg: string,
public readonly devices: DeviceInfoMap,
public event?: MatrixEvent,
) {
super(msg);
this.name = "UnknownDeviceError";
this.devices = devices;

View File

@ -164,7 +164,10 @@ class OutboundSessionInfo {
* @param sharedHistory - whether the session can be freely shared with
* other group members, according to the room history visibility settings
*/
public constructor(public readonly sessionId: string, public readonly sharedHistory = false) {
public constructor(
public readonly sessionId: string,
public readonly sharedHistory = false,
) {
this.creationTime = new Date().getTime();
}

View File

@ -124,7 +124,10 @@ export class BackupManager {
// The backup manager will schedule backup of keys when active (`scheduleKeyBackupSend`), this allows cancel when client is stopped
private clientRunning = true;
public constructor(private readonly baseApis: MatrixClient, public readonly getKey: GetKey) {
public constructor(
private readonly baseApis: MatrixClient,
public readonly getKey: GetKey,
) {
this.checkedForBackup = false;
this.sendingBackups = false;
}
@ -773,7 +776,10 @@ const UNSTABLE_MSC3270_NAME = new UnstableValue(
export class Aes256 implements BackupAlgorithm {
public static algorithmName = UNSTABLE_MSC3270_NAME.name;
public constructor(public readonly authData: IAes256AuthData, private readonly key: Uint8Array) {}
public constructor(
public readonly authData: IAes256AuthData,
private readonly key: Uint8Array,
) {}
public static async init(authData: IAes256AuthData, getKey: () => Promise<Uint8Array>): Promise<Aes256> {
if (!authData) {

View File

@ -973,7 +973,7 @@ export class Crypto extends TypedEventEmitter<CryptoEvent, CryptoEventHandlerMap
*/
// TODO this does not resolve with what it says it does
public async bootstrapSecretStorage({
createSecretStorageKey = async (): Promise<IRecoveryKey> => ({} as IRecoveryKey),
createSecretStorageKey = async (): Promise<IRecoveryKey> => ({}) as IRecoveryKey,
keyBackupInfo,
setupNewKeyBackup,
setupNewSecretStorage,
@ -2243,10 +2243,13 @@ export class Crypto extends TypedEventEmitter<CryptoEvent, CryptoEventHandlerMap
const res = await this.baseApis.uploadKeysRequest(requestBody);
if (fallbackJson) {
this.fallbackCleanup = setTimeout(() => {
delete this.fallbackCleanup;
this.olmDevice.forgetOldFallbackKey();
}, 60 * 60 * 1000);
this.fallbackCleanup = setTimeout(
() => {
delete this.fallbackCleanup;
this.olmDevice.forgetOldFallbackKey();
},
60 * 60 * 1000,
);
}
await this.olmDevice.markKeysAsPublished();

View File

@ -71,7 +71,10 @@ export class IndexedDBCryptoStore implements CryptoStore {
* @param indexedDB - global indexedDB instance
* @param dbName - name of db to connect to
*/
public constructor(private readonly indexedDB: IDBFactory, private readonly dbName: string) {}
public constructor(
private readonly indexedDB: IDBFactory,
private readonly dbName: string,
) {}
/**
* Returns true if this CryptoStore has ever been initialised (ie, it might contain data).

View File

@ -137,12 +137,15 @@ export class VerificationBase<
if (this.transactionTimeoutTimer !== null) {
clearTimeout(this.transactionTimeoutTimer);
}
this.transactionTimeoutTimer = setTimeout(() => {
if (!this._done && !this.cancelled) {
logger.info("Triggering verification timeout");
this.cancel(timeoutException);
}
}, 10 * 60 * 1000); // 10 minutes
this.transactionTimeoutTimer = setTimeout(
() => {
if (!this._done && !this.cancelled) {
logger.info("Triggering verification timeout");
this.cancel(timeoutException);
}
},
10 * 60 * 1000,
); // 10 minutes
}
private endTimer(): void {

View File

@ -39,7 +39,11 @@ export class InRoomChannel implements IVerificationChannel {
* @param roomId - id of the room where verification events should be posted in, should be a DM with the given user.
* @param userId - id of user that the verification request is directed at, should be present in the room.
*/
public constructor(private readonly client: MatrixClient, public readonly roomId: string, public userId?: string) {}
public constructor(
private readonly client: MatrixClient,
public readonly roomId: string,
public userId?: string,
) {}
public get receiveStartFromOtherDevices(): boolean {
return true;

View File

@ -21,7 +21,10 @@ export enum InvalidStoreState {
export class InvalidStoreError extends Error {
public static TOGGLED_LAZY_LOADING = InvalidStoreState.ToggledLazyLoading;
public constructor(public readonly reason: InvalidStoreState, public readonly value: any) {
public constructor(
public readonly reason: InvalidStoreState,
public readonly value: any,
) {
const message =
`Store is invalid because ${reason}, ` +
`please stop the client, delete all data and start the client again`;
@ -47,7 +50,10 @@ export class InvalidCryptoStoreError extends Error {
}
export class KeySignatureUploadError extends Error {
public constructor(message: string, public readonly value: any) {
public constructor(
message: string,
public readonly value: any,
) {
super(message);
}
}

View File

@ -62,7 +62,10 @@ export interface IFilterComponent {
* 'Filters' are referred to as 'FilterCollections'.
*/
export class FilterComponent {
public constructor(private filterJson: IFilterComponent, public readonly userId?: string | undefined | null) {}
public constructor(
private filterJson: IFilterComponent,
public readonly userId?: string | undefined | null,
) {}
/**
* Checks with the filter component matches the given event

View File

@ -92,7 +92,10 @@ export class Filter {
* @param userId - The user ID for this filter.
* @param filterId - The filter ID if known.
*/
public constructor(public readonly userId: string | undefined | null, public filterId?: string) {}
public constructor(
public readonly userId: string | undefined | null,
public filterId?: string,
) {}
/**
* Get the ID of this filter on your homeserver (if known)

View File

@ -30,7 +30,10 @@ interface IErrorJson extends Partial<IUsageLimit> {
* @param httpStatus - The HTTP response status code.
*/
export class HTTPError extends Error {
public constructor(msg: string, public readonly httpStatus?: number) {
public constructor(
msg: string,
public readonly httpStatus?: number,
) {
super(msg);
}
}

View File

@ -33,8 +33,8 @@ interface TypedResponse<T> extends Response {
export type ResponseType<T, O extends IHttpOpts> = O extends undefined
? T
: O extends { onlyData: true }
? T
: TypedResponse<T>;
? T
: TypedResponse<T>;
export class FetchHttpApi<O extends IHttpOpts> {
private abortController = new AbortController();

View File

@ -149,8 +149,12 @@ export type IAuthDict = AuthDict;
export class NoAuthFlowFoundError extends Error {
public name = "NoAuthFlowFoundError";
// eslint-disable-next-line @typescript-eslint/naming-convention, camelcase
public constructor(m: string, public readonly required_stages: string[], public readonly flows: UIAFlow[]) {
public constructor(
m: string,
// eslint-disable-next-line @typescript-eslint/naming-convention, camelcase
public readonly required_stages: string[],
public readonly flows: UIAFlow[],
) {
super(m);
}
}

View File

@ -156,7 +156,10 @@ extendLogger(logger);
export class LogSpan implements BaseLogger {
private readonly name;
public constructor(private readonly parent: BaseLogger, name: string) {
public constructor(
private readonly parent: BaseLogger,
name: string,
) {
this.name = name + ":";
}

View File

@ -37,7 +37,10 @@ export class CallMembership {
return deepCompare(a.data, b.data);
}
public constructor(private parentEvent: MatrixEvent, private data: CallMembershipData) {
public constructor(
private parentEvent: MatrixEvent,
private data: CallMembershipData,
) {
if (typeof data.expires !== "number") throw new Error("Malformed membership: expires must be numeric");
if (typeof data.device_id !== "string") throw new Error("Malformed membership event: device_id must be string");
if (typeof data.call_id !== "string") throw new Error("Malformed membership event: call_id must be string");

View File

@ -85,7 +85,10 @@ export enum TreePermissions {
export class MSC3089TreeSpace {
public readonly room: Room;
public constructor(private client: MatrixClient, public readonly roomId: string) {
public constructor(
private client: MatrixClient,
public readonly roomId: string,
) {
this.room = this.client.getRoom(this.roomId)!;
if (!this.room) throw new Error("Unknown room");

View File

@ -1003,9 +1003,8 @@ export class EventTimelineSet extends TypedEventEmitter<EmittedEvents, EventTime
if (!shouldLiveInRoom && !shouldLiveInThread) {
logger.warn(
`EventTimelineSet:canContain event encountered which cannot be added to any timeline roomId=${
this.room?.roomId
} eventId=${event.getId()} threadId=${event.threadRootId}`,
`EventTimelineSet:canContain event encountered which cannot be added to any timeline roomId=${this.room
?.roomId} eventId=${event.getId()} threadId=${event.threadRootId}`,
);
}

View File

@ -75,7 +75,11 @@ export class Poll extends TypedEventEmitter<Exclude<PollEvent, PollEvent.New>, P
*/
private undecryptableRelationEventIds = new Set<string>();
public constructor(public readonly rootEvent: MatrixEvent, private matrixClient: MatrixClient, private room: Room) {
public constructor(
public readonly rootEvent: MatrixEvent,
private matrixClient: MatrixClient,
private room: Room,
) {
super();
if (!this.rootEvent.getRoomId() || !this.rootEvent.getId()) {
throw new Error("Invalid poll start event.");

View File

@ -26,7 +26,10 @@ export class RelationsContainer {
// this.relations.get(parentEventId).get(relationType).get(relationEventType)
private relations = new Map<string, Map<RelationType | string, Map<EventType | string, Relations>>>();
public constructor(private readonly client: MatrixClient, private readonly room?: Room) {}
public constructor(
private readonly client: MatrixClient,
private readonly room?: Room,
) {}
/**
* Get a collection of child events to a given event in this timeline set.

View File

@ -140,7 +140,10 @@ export class RoomMember extends TypedEventEmitter<RoomMemberEvent, RoomMemberEve
* @param roomId - The room ID of the member.
* @param userId - The user ID of the member.
*/
public constructor(public readonly roomId: string, public readonly userId: string) {
public constructor(
public readonly roomId: string,
public readonly userId: string,
) {
super();
this.name = userId;

View File

@ -196,7 +196,11 @@ export class RoomReceipts {
* maps in RoomReceipts.
*/
class ReceiptInfo {
public constructor(public eventId: string, public receiptType: string, public ts: number) {}
public constructor(
public eventId: string,
public receiptType: string,
public ts: number,
) {}
}
/**

View File

@ -187,7 +187,10 @@ export class RoomState extends TypedEventEmitter<EmittedEvents, EventHandlerMap>
* and shared when the room state is cloned for the new timeline.
* This should only be passed from clone.
*/
public constructor(public readonly roomId: string, private oobMemberFlags = { status: OobStatus.NotStarted }) {
public constructor(
public readonly roomId: string,
private oobMemberFlags = { status: OobStatus.NotStarted },
) {
super();
this.updateModifiedTime();
}

View File

@ -40,5 +40,8 @@ interface IInfo {
* @param info - Optional. The summary info. Additional keys are supported.
*/
export class RoomSummary {
public constructor(public readonly roomId: string, info?: IInfo) {}
public constructor(
public readonly roomId: string,
info?: IInfo,
) {}
}

View File

@ -50,5 +50,8 @@ export class SearchResult {
* @param context - the matching event and its
* context
*/
public constructor(public readonly rank: number, public readonly context: EventContext) {}
public constructor(
public readonly rank: number,
public readonly context: EventContext,
) {}
}

View File

@ -140,7 +140,11 @@ export class Thread extends ReadReceipt<ThreadEmittedEvents, ThreadEventHandlerM
*/
public replayEvents: MatrixEvent[] | null = [];
public constructor(public readonly id: string, public rootEvent: MatrixEvent | undefined, opts: IThreadOpts) {
public constructor(
public readonly id: string,
public rootEvent: MatrixEvent | undefined,
opts: IThreadOpts,
) {
super();
// each Event in the thread adds a reemitter, so we could hit the listener limit.

View File

@ -44,8 +44,8 @@ type EventEmitterErrorListener = (error: Error) => void;
export type Listener<E extends string, A extends ListenerMap<E>, T extends E | EventEmitterEvents> = T extends E
? A[T]
: T extends EventEmitterEvents
? EventEmitterErrorListener
: EventEmitterEventListener;
? EventEmitterErrorListener
: EventEmitterEventListener;
/**
* Typed Event Emitter class which can act as a Base Model for all our model

View File

@ -186,7 +186,7 @@ const normalizeBearerTokenResponseTokenType = (response: SigninResponse): Bearer
refresh_token: response.refresh_token,
access_token: response.access_token,
token_type: "Bearer",
} as BearerTokenResponse);
}) as BearerTokenResponse;
/**
* @experimental

View File

@ -17,7 +17,10 @@ limitations under the License.
import { RendezvousFailureReason } from ".";
export class RendezvousError extends Error {
public constructor(message: string, public readonly code: RendezvousFailureReason) {
public constructor(
message: string,
public readonly code: RendezvousFailureReason,
) {
super(message);
}
}

View File

@ -114,7 +114,10 @@ type ExtensionToDeviceResponse = {
class ExtensionToDevice implements Extension<ExtensionToDeviceRequest, ExtensionToDeviceResponse> {
private nextBatch: string | null = null;
public constructor(private readonly client: MatrixClient, private readonly cryptoCallbacks?: SyncCryptoCallbacks) {}
public constructor(
private readonly client: MatrixClient,
private readonly cryptoCallbacks?: SyncCryptoCallbacks,
) {}
public name(): string {
return "to_device";

View File

@ -143,7 +143,10 @@ export class LocalIndexedDBStoreBackend implements IIndexedDBBackend {
* @param dbName - Optional database name. The same name must be used
* to open the same database.
*/
public constructor(private readonly indexedDB: IDBFactory, dbName = "default") {
public constructor(
private readonly indexedDB: IDBFactory,
dbName = "default",
) {
this.dbName = "matrix-js-sdk:" + dbName;
this.syncAccumulator = new SyncAccumulator();
}

View File

@ -43,7 +43,10 @@ export class RemoteIndexedDBStoreBackend implements IIndexedDBBackend {
* @param dbName - Optional database name. The same name must be used
* to open the same database.
*/
public constructor(private readonly workerFactory: () => Worker, private readonly dbName?: string) {}
public constructor(
private readonly workerFactory: () => Worker,
private readonly dbName?: string,
) {}
/**
* Attempt to connect to the database. This can fail if the user does not

View File

@ -234,7 +234,11 @@ export class SyncApi {
* @param syncOpts - sync-specific options passed by the client
* @internal
*/
public constructor(private readonly client: MatrixClient, opts?: IStoredClientOpts, syncOpts?: SyncApiOptions) {
public constructor(
private readonly client: MatrixClient,
opts?: IStoredClientOpts,
syncOpts?: SyncApiOptions,
) {
this.opts = defaultClientOpts(opts);
this.syncOpts = defaultSyncApiOpts(syncOpts);

View File

@ -441,7 +441,10 @@ export class TimelineIndex {
public pendingPaginate?: Promise<boolean>;
// index: the indexes are relative to BaseIndex, so could well be negative.
public constructor(public timeline: EventTimeline, public index: number) {}
public constructor(
public timeline: EventTimeline,
public index: number,
) {}
/**
* @returns the minimum possible value for the index in the current

View File

@ -1309,9 +1309,8 @@ export class MatrixCall extends TypedEventEmitter<CallEvent, CallEventHandlerMap
const track = stream.getTracks().find((track) => track.kind === "video");
const sender = this.transceivers.get(
getTransceiverKey(SDPStreamMetadataPurpose.Usermedia, "video"),
)?.sender;
const sender = this.transceivers.get(getTransceiverKey(SDPStreamMetadataPurpose.Usermedia, "video"))
?.sender;
sender?.replaceTrack(track ?? null);
@ -1327,9 +1326,8 @@ export class MatrixCall extends TypedEventEmitter<CallEvent, CallEventHandlerMap
}
} else {
const track = this.localUsermediaStream?.getTracks().find((track) => track.kind === "video");
const sender = this.transceivers.get(
getTransceiverKey(SDPStreamMetadataPurpose.Usermedia, "video"),
)?.sender;
const sender = this.transceivers.get(getTransceiverKey(SDPStreamMetadataPurpose.Usermedia, "video"))
?.sender;
sender?.replaceTrack(track ?? null);
this.client.getMediaHandler().stopScreensharingStream(this.localScreensharingStream!);

View File

@ -1605,17 +1605,20 @@ export class GroupCall extends TypedEventEmitter<
await this.addDeviceToMemberState();
// Resend the state event every so often so it doesn't become stale
this.resendMemberStateTimer = setInterval(async () => {
logger.log(`GroupCall ${this.groupCallId} updateMemberState() resending call member state"`);
try {
await this.addDeviceToMemberState();
} catch (e) {
logger.error(
`GroupCall ${this.groupCallId} updateMemberState() failed to resend call member state`,
e,
);
}
}, (DEVICE_TIMEOUT * 3) / 4);
this.resendMemberStateTimer = setInterval(
async () => {
logger.log(`GroupCall ${this.groupCallId} updateMemberState() resending call member state"`);
try {
await this.addDeviceToMemberState();
} catch (e) {
logger.error(
`GroupCall ${this.groupCallId} updateMemberState() failed to resend call member state`,
e,
);
}
},
(DEVICE_TIMEOUT * 3) / 4,
);
} else {
// Remove the local device
await this.updateDevices(

View File

@ -25,7 +25,11 @@ export class GroupCallStats {
public readonly reports = new StatsReportEmitter();
private readonly summaryStatsReportGatherer = new SummaryStatsReportGatherer(this.reports);
public constructor(private groupCallId: string, private userId: string, private interval: number = 10000) {}
public constructor(
private groupCallId: string,
private userId: string,
private interval: number = 10000,
) {}
public start(): void {
if (this.timer === undefined && this.interval > 0) {

View File

@ -5469,10 +5469,10 @@ prelude-ls@^1.2.1:
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396"
integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==
prettier@2.8.8:
version "2.8.8"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da"
integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==
prettier@3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.1.1.tgz#6ba9f23165d690b6cbdaa88cb0807278f7019848"
integrity sha512-22UbSzg8luF4UuZtzgiUOfcGM8s4tjBv6dJRT7j275NXsy2jb4aJa4NNveul5x4eqlF1wuhuR2RElK71RvmVaw==
pretty-format@^28.1.3:
version "28.1.3"