@unwanted/matrix-sdk-mini 34.12.0-1 → 34.12.0-2
Sign up to get free protection for your applications and to get access to all the features.
- package/git-revision.txt +1 -1
- package/lib/@types/event.d.ts +0 -19
- package/lib/@types/event.d.ts.map +1 -1
- package/lib/@types/event.js.map +1 -1
- package/lib/client.d.ts +2 -50
- package/lib/client.d.ts.map +1 -1
- package/lib/client.js +391 -501
- package/lib/client.js.map +1 -1
- package/lib/embedded.d.ts.map +1 -1
- package/lib/embedded.js +0 -1
- package/lib/embedded.js.map +1 -1
- package/lib/matrix.d.ts +0 -6
- package/lib/matrix.d.ts.map +1 -1
- package/lib/matrix.js +1 -5
- package/lib/matrix.js.map +1 -1
- package/package.json +1 -1
- package/src/@types/event.ts +2 -36
- package/src/client.ts +1 -150
- package/src/embedded.ts +0 -2
- package/src/matrix.ts +0 -13
- package/lib/matrixrtc/CallMembership.d.ts +0 -66
- package/lib/matrixrtc/CallMembership.d.ts.map +0 -1
- package/lib/matrixrtc/CallMembership.js +0 -197
- package/lib/matrixrtc/CallMembership.js.map +0 -1
- package/lib/matrixrtc/LivekitFocus.d.ts +0 -16
- package/lib/matrixrtc/LivekitFocus.d.ts.map +0 -1
- package/lib/matrixrtc/LivekitFocus.js +0 -20
- package/lib/matrixrtc/LivekitFocus.js.map +0 -1
- package/lib/matrixrtc/MatrixRTCSession.d.ts +0 -295
- package/lib/matrixrtc/MatrixRTCSession.d.ts.map +0 -1
- package/lib/matrixrtc/MatrixRTCSession.js +0 -1043
- package/lib/matrixrtc/MatrixRTCSession.js.map +0 -1
- package/lib/matrixrtc/MatrixRTCSessionManager.d.ts +0 -40
- package/lib/matrixrtc/MatrixRTCSessionManager.d.ts.map +0 -1
- package/lib/matrixrtc/MatrixRTCSessionManager.js +0 -146
- package/lib/matrixrtc/MatrixRTCSessionManager.js.map +0 -1
- package/lib/matrixrtc/focus.d.ts +0 -10
- package/lib/matrixrtc/focus.d.ts.map +0 -1
- package/lib/matrixrtc/focus.js +0 -1
- package/lib/matrixrtc/focus.js.map +0 -1
- package/lib/matrixrtc/index.d.ts +0 -7
- package/lib/matrixrtc/index.d.ts.map +0 -1
- package/lib/matrixrtc/index.js +0 -21
- package/lib/matrixrtc/index.js.map +0 -1
- package/lib/matrixrtc/types.d.ts +0 -19
- package/lib/matrixrtc/types.d.ts.map +0 -1
- package/lib/matrixrtc/types.js +0 -1
- package/lib/matrixrtc/types.js.map +0 -1
- package/lib/webrtc/audioContext.d.ts +0 -15
- package/lib/webrtc/audioContext.d.ts.map +0 -1
- package/lib/webrtc/audioContext.js +0 -46
- package/lib/webrtc/audioContext.js.map +0 -1
- package/lib/webrtc/call.d.ts +0 -560
- package/lib/webrtc/call.d.ts.map +0 -1
- package/lib/webrtc/call.js +0 -2541
- package/lib/webrtc/call.js.map +0 -1
- package/lib/webrtc/callEventHandler.d.ts +0 -37
- package/lib/webrtc/callEventHandler.d.ts.map +0 -1
- package/lib/webrtc/callEventHandler.js +0 -344
- package/lib/webrtc/callEventHandler.js.map +0 -1
- package/lib/webrtc/callEventTypes.d.ts +0 -73
- package/lib/webrtc/callEventTypes.d.ts.map +0 -1
- package/lib/webrtc/callEventTypes.js +0 -13
- package/lib/webrtc/callEventTypes.js.map +0 -1
- package/lib/webrtc/callFeed.d.ts +0 -128
- package/lib/webrtc/callFeed.d.ts.map +0 -1
- package/lib/webrtc/callFeed.js +0 -289
- package/lib/webrtc/callFeed.js.map +0 -1
- package/lib/webrtc/groupCall.d.ts +0 -323
- package/lib/webrtc/groupCall.d.ts.map +0 -1
- package/lib/webrtc/groupCall.js +0 -1337
- package/lib/webrtc/groupCall.js.map +0 -1
- package/lib/webrtc/groupCallEventHandler.d.ts +0 -31
- package/lib/webrtc/groupCallEventHandler.d.ts.map +0 -1
- package/lib/webrtc/groupCallEventHandler.js +0 -178
- package/lib/webrtc/groupCallEventHandler.js.map +0 -1
- package/lib/webrtc/mediaHandler.d.ts +0 -89
- package/lib/webrtc/mediaHandler.d.ts.map +0 -1
- package/lib/webrtc/mediaHandler.js +0 -437
- package/lib/webrtc/mediaHandler.js.map +0 -1
- package/lib/webrtc/stats/callFeedStatsReporter.d.ts +0 -8
- package/lib/webrtc/stats/callFeedStatsReporter.d.ts.map +0 -1
- package/lib/webrtc/stats/callFeedStatsReporter.js +0 -82
- package/lib/webrtc/stats/callFeedStatsReporter.js.map +0 -1
- package/lib/webrtc/stats/callStatsReportGatherer.d.ts +0 -25
- package/lib/webrtc/stats/callStatsReportGatherer.d.ts.map +0 -1
- package/lib/webrtc/stats/callStatsReportGatherer.js +0 -199
- package/lib/webrtc/stats/callStatsReportGatherer.js.map +0 -1
- package/lib/webrtc/stats/callStatsReportSummary.d.ts +0 -17
- package/lib/webrtc/stats/callStatsReportSummary.d.ts.map +0 -1
- package/lib/webrtc/stats/callStatsReportSummary.js +0 -1
- package/lib/webrtc/stats/callStatsReportSummary.js.map +0 -1
- package/lib/webrtc/stats/connectionStats.d.ts +0 -28
- package/lib/webrtc/stats/connectionStats.d.ts.map +0 -1
- package/lib/webrtc/stats/connectionStats.js +0 -26
- package/lib/webrtc/stats/connectionStats.js.map +0 -1
- package/lib/webrtc/stats/connectionStatsBuilder.d.ts +0 -5
- package/lib/webrtc/stats/connectionStatsBuilder.d.ts.map +0 -1
- package/lib/webrtc/stats/connectionStatsBuilder.js +0 -27
- package/lib/webrtc/stats/connectionStatsBuilder.js.map +0 -1
- package/lib/webrtc/stats/connectionStatsReportBuilder.d.ts +0 -7
- package/lib/webrtc/stats/connectionStatsReportBuilder.d.ts.map +0 -1
- package/lib/webrtc/stats/connectionStatsReportBuilder.js +0 -121
- package/lib/webrtc/stats/connectionStatsReportBuilder.js.map +0 -1
- package/lib/webrtc/stats/groupCallStats.d.ts +0 -22
- package/lib/webrtc/stats/groupCallStats.d.ts.map +0 -1
- package/lib/webrtc/stats/groupCallStats.js +0 -78
- package/lib/webrtc/stats/groupCallStats.js.map +0 -1
- package/lib/webrtc/stats/media/mediaSsrcHandler.d.ts +0 -10
- package/lib/webrtc/stats/media/mediaSsrcHandler.d.ts.map +0 -1
- package/lib/webrtc/stats/media/mediaSsrcHandler.js +0 -57
- package/lib/webrtc/stats/media/mediaSsrcHandler.js.map +0 -1
- package/lib/webrtc/stats/media/mediaTrackHandler.d.ts +0 -12
- package/lib/webrtc/stats/media/mediaTrackHandler.d.ts.map +0 -1
- package/lib/webrtc/stats/media/mediaTrackHandler.js +0 -62
- package/lib/webrtc/stats/media/mediaTrackHandler.js.map +0 -1
- package/lib/webrtc/stats/media/mediaTrackStats.d.ts +0 -86
- package/lib/webrtc/stats/media/mediaTrackStats.d.ts.map +0 -1
- package/lib/webrtc/stats/media/mediaTrackStats.js +0 -142
- package/lib/webrtc/stats/media/mediaTrackStats.js.map +0 -1
- package/lib/webrtc/stats/media/mediaTrackStatsHandler.d.ts +0 -22
- package/lib/webrtc/stats/media/mediaTrackStatsHandler.d.ts.map +0 -1
- package/lib/webrtc/stats/media/mediaTrackStatsHandler.js +0 -76
- package/lib/webrtc/stats/media/mediaTrackStatsHandler.js.map +0 -1
- package/lib/webrtc/stats/statsReport.d.ts +0 -99
- package/lib/webrtc/stats/statsReport.d.ts.map +0 -1
- package/lib/webrtc/stats/statsReport.js +0 -32
- package/lib/webrtc/stats/statsReport.js.map +0 -1
- package/lib/webrtc/stats/statsReportEmitter.d.ts +0 -15
- package/lib/webrtc/stats/statsReportEmitter.d.ts.map +0 -1
- package/lib/webrtc/stats/statsReportEmitter.js +0 -33
- package/lib/webrtc/stats/statsReportEmitter.js.map +0 -1
- package/lib/webrtc/stats/summaryStatsReportGatherer.d.ts +0 -16
- package/lib/webrtc/stats/summaryStatsReportGatherer.d.ts.map +0 -1
- package/lib/webrtc/stats/summaryStatsReportGatherer.js +0 -116
- package/lib/webrtc/stats/summaryStatsReportGatherer.js.map +0 -1
- package/lib/webrtc/stats/trackStatsBuilder.d.ts +0 -19
- package/lib/webrtc/stats/trackStatsBuilder.d.ts.map +0 -1
- package/lib/webrtc/stats/trackStatsBuilder.js +0 -168
- package/lib/webrtc/stats/trackStatsBuilder.js.map +0 -1
- package/lib/webrtc/stats/transportStats.d.ts +0 -11
- package/lib/webrtc/stats/transportStats.d.ts.map +0 -1
- package/lib/webrtc/stats/transportStats.js +0 -1
- package/lib/webrtc/stats/transportStats.js.map +0 -1
- package/lib/webrtc/stats/transportStatsBuilder.d.ts +0 -5
- package/lib/webrtc/stats/transportStatsBuilder.d.ts.map +0 -1
- package/lib/webrtc/stats/transportStatsBuilder.js +0 -34
- package/lib/webrtc/stats/transportStatsBuilder.js.map +0 -1
- package/lib/webrtc/stats/valueFormatter.d.ts +0 -4
- package/lib/webrtc/stats/valueFormatter.d.ts.map +0 -1
- package/lib/webrtc/stats/valueFormatter.js +0 -25
- package/lib/webrtc/stats/valueFormatter.js.map +0 -1
- package/src/matrixrtc/CallMembership.ts +0 -247
- package/src/matrixrtc/LivekitFocus.ts +0 -39
- package/src/matrixrtc/MatrixRTCSession.ts +0 -1319
- package/src/matrixrtc/MatrixRTCSessionManager.ts +0 -166
- package/src/matrixrtc/focus.ts +0 -25
- package/src/matrixrtc/index.ts +0 -22
- package/src/matrixrtc/types.ts +0 -36
- package/src/webrtc/audioContext.ts +0 -44
- package/src/webrtc/call.ts +0 -3074
- package/src/webrtc/callEventHandler.ts +0 -425
- package/src/webrtc/callEventTypes.ts +0 -93
- package/src/webrtc/callFeed.ts +0 -364
- package/src/webrtc/groupCall.ts +0 -1735
- package/src/webrtc/groupCallEventHandler.ts +0 -234
- package/src/webrtc/mediaHandler.ts +0 -484
- package/src/webrtc/stats/callFeedStatsReporter.ts +0 -94
- package/src/webrtc/stats/callStatsReportGatherer.ts +0 -219
- package/src/webrtc/stats/callStatsReportSummary.ts +0 -30
- package/src/webrtc/stats/connectionStats.ts +0 -47
- package/src/webrtc/stats/connectionStatsBuilder.ts +0 -28
- package/src/webrtc/stats/connectionStatsReportBuilder.ts +0 -140
- package/src/webrtc/stats/groupCallStats.ts +0 -93
- package/src/webrtc/stats/media/mediaSsrcHandler.ts +0 -57
- package/src/webrtc/stats/media/mediaTrackHandler.ts +0 -76
- package/src/webrtc/stats/media/mediaTrackStats.ts +0 -176
- package/src/webrtc/stats/media/mediaTrackStatsHandler.ts +0 -90
- package/src/webrtc/stats/statsReport.ts +0 -133
- package/src/webrtc/stats/statsReportEmitter.ts +0 -49
- package/src/webrtc/stats/summaryStatsReportGatherer.ts +0 -148
- package/src/webrtc/stats/trackStatsBuilder.ts +0 -207
- package/src/webrtc/stats/transportStats.ts +0 -26
- package/src/webrtc/stats/transportStatsBuilder.ts +0 -48
- package/src/webrtc/stats/valueFormatter.ts +0 -27
package/src/client.ts
CHANGED
@@ -33,14 +33,8 @@ import {
|
|
33
33
|
PushDetails,
|
34
34
|
} from "./models/event.ts";
|
35
35
|
import { StubStore } from "./store/stub.ts";
|
36
|
-
import { CallEvent, CallEventHandlerMap, createNewMatrixCall, MatrixCall, supportsMatrixCall } from "./webrtc/call.ts";
|
37
36
|
import { Filter, IFilterDefinition, IRoomEventFilter } from "./filter.ts";
|
38
|
-
|
39
|
-
import {
|
40
|
-
GroupCallEventHandler,
|
41
|
-
GroupCallEventHandlerEvent,
|
42
|
-
GroupCallEventHandlerEventHandlerMap,
|
43
|
-
} from "./webrtc/groupCallEventHandler.ts";
|
37
|
+
|
44
38
|
import * as utils from "./utils.ts";
|
45
39
|
import { noUnsafeEventProps, QueryDict, replaceParam, safeSet, sleep } from "./utils.ts";
|
46
40
|
import { Direction, EventTimeline } from "./models/event-timeline.ts";
|
@@ -187,8 +181,6 @@ import {
|
|
187
181
|
} from "./@types/PushRules.ts";
|
188
182
|
import { IThreepid } from "./@types/threepids.ts";
|
189
183
|
import { CryptoStore, OutgoingRoomKeyRequest } from "./crypto/store/base.ts";
|
190
|
-
import { GroupCall, GroupCallIntent, GroupCallType, IGroupCallDataChannelOptions } from "./webrtc/groupCall.ts";
|
191
|
-
import { MediaHandler } from "./webrtc/mediaHandler.ts";
|
192
184
|
import {
|
193
185
|
ILoginFlowsResponse,
|
194
186
|
IRefreshTokenResponse,
|
@@ -237,7 +229,6 @@ import {
|
|
237
229
|
ServerSideSecretStorageImpl,
|
238
230
|
} from "./secret-storage.ts";
|
239
231
|
import { RegisterRequest, RegisterResponse } from "./@types/registration.ts";
|
240
|
-
import { MatrixRTCSessionManager } from "./matrixrtc/MatrixRTCSessionManager.ts";
|
241
232
|
import { getRelationsThreadFilter } from "./thread-utils.ts";
|
242
233
|
import { KnownMembership, Membership } from "./@types/membership.ts";
|
243
234
|
import { RoomMessageEventContent, StickerEventContent } from "./@types/events.ts";
|
@@ -987,12 +978,6 @@ export type EmittedEvents =
|
|
987
978
|
| MatrixEventEvents
|
988
979
|
| RoomMemberEvents
|
989
980
|
| UserEvents
|
990
|
-
| CallEvent // re-emitted by call.ts using Object.values
|
991
|
-
| CallEventHandlerEvent.Incoming
|
992
|
-
| GroupCallEventHandlerEvent.Incoming
|
993
|
-
| GroupCallEventHandlerEvent.Outgoing
|
994
|
-
| GroupCallEventHandlerEvent.Ended
|
995
|
-
| GroupCallEventHandlerEvent.Participants
|
996
981
|
| HttpApiEvent.SessionLoggedOut
|
997
982
|
| HttpApiEvent.NoConsent
|
998
983
|
| BeaconEvent;
|
@@ -1199,9 +1184,6 @@ export type ClientEventHandlerMap = {
|
|
1199
1184
|
MatrixEventHandlerMap &
|
1200
1185
|
RoomMemberEventHandlerMap &
|
1201
1186
|
UserEventHandlerMap &
|
1202
|
-
CallEventHandlerEventHandlerMap &
|
1203
|
-
GroupCallEventHandlerEventHandlerMap &
|
1204
|
-
CallEventHandlerMap &
|
1205
1187
|
HttpApiEventHandlerMap &
|
1206
1188
|
BeaconEventHandlerMap;
|
1207
1189
|
|
@@ -1252,8 +1234,6 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
|
|
1252
1234
|
|
1253
1235
|
private cryptoBackend?: CryptoBackend; // one of crypto or rustCrypto
|
1254
1236
|
public cryptoCallbacks: CryptoCallbacks; // XXX: Intended private, used in code.
|
1255
|
-
public callEventHandler?: CallEventHandler; // XXX: Intended private, used in code.
|
1256
|
-
public groupCallEventHandler?: GroupCallEventHandler;
|
1257
1237
|
public supportsCallTransfer = false; // XXX: Intended private, used in code.
|
1258
1238
|
public forceTURN = false; // XXX: Intended private, used in code.
|
1259
1239
|
public iceCandidatePoolSize = 0; // XXX: Intended private, used in code.
|
@@ -1300,7 +1280,6 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
|
|
1300
1280
|
protected checkTurnServersIntervalID?: ReturnType<typeof setInterval>;
|
1301
1281
|
protected exportedOlmDeviceToImport?: IExportedOlmDevice;
|
1302
1282
|
protected txnCtr = 0;
|
1303
|
-
protected mediaHandler = new MediaHandler(this);
|
1304
1283
|
protected sessionId: string;
|
1305
1284
|
|
1306
1285
|
/** IDs of events which are currently being encrypted.
|
@@ -1319,8 +1298,6 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
|
|
1319
1298
|
// A manager for determining which invites should be ignored.
|
1320
1299
|
public readonly ignoredInvites: IgnoredInvites;
|
1321
1300
|
|
1322
|
-
public readonly matrixRTC: MatrixRTCSessionManager;
|
1323
|
-
|
1324
1301
|
private serverCapabilitiesService: ServerCapabilities;
|
1325
1302
|
|
1326
1303
|
public constructor(opts: IMatrixClientCreateOpts) {
|
@@ -1402,20 +1379,6 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
|
|
1402
1379
|
});
|
1403
1380
|
}
|
1404
1381
|
|
1405
|
-
if (supportsMatrixCall()) {
|
1406
|
-
this.callEventHandler = new CallEventHandler(this);
|
1407
|
-
this.groupCallEventHandler = new GroupCallEventHandler(this);
|
1408
|
-
this.canSupportVoip = true;
|
1409
|
-
// Start listening for calls after the initial sync is done
|
1410
|
-
// We do not need to backfill the call event buffer
|
1411
|
-
// with encrypted events that might never get decrypted
|
1412
|
-
this.on(ClientEvent.Sync, this.startCallEventHandler);
|
1413
|
-
}
|
1414
|
-
|
1415
|
-
// NB. We initialise MatrixRTC whether we have call support or not: this is just
|
1416
|
-
// the underlying session management and doesn't use any actual media capabilities
|
1417
|
-
this.matrixRTC = new MatrixRTCSessionManager(this);
|
1418
|
-
|
1419
1382
|
this.serverCapabilitiesService = new ServerCapabilities(this.http);
|
1420
1383
|
|
1421
1384
|
this.on(ClientEvent.Sync, this.fixupRoomNotifications);
|
@@ -1478,8 +1441,6 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
|
|
1478
1441
|
}
|
1479
1442
|
this.clientRunning = true;
|
1480
1443
|
|
1481
|
-
this.on(ClientEvent.Sync, this.startMatrixRTC);
|
1482
|
-
|
1483
1444
|
// Create our own user object artificially (instead of waiting for sync)
|
1484
1445
|
// so it's always available, even if the user is not in any rooms etc.
|
1485
1446
|
const userId = this.getUserId();
|
@@ -1566,8 +1527,6 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
|
|
1566
1527
|
public stopClient(): void {
|
1567
1528
|
this.cryptoBackend?.stop(); // crypto might have been initialised even if the client wasn't fully started
|
1568
1529
|
|
1569
|
-
this.off(ClientEvent.Sync, this.startMatrixRTC);
|
1570
|
-
|
1571
1530
|
if (!this.clientRunning) return; // already stopped
|
1572
1531
|
|
1573
1532
|
this.logger.debug("stopping MatrixClient");
|
@@ -1579,11 +1538,6 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
|
|
1579
1538
|
|
1580
1539
|
this.peekSync?.stopPeeking();
|
1581
1540
|
|
1582
|
-
this.callEventHandler?.stop();
|
1583
|
-
this.groupCallEventHandler?.stop();
|
1584
|
-
this.callEventHandler = undefined;
|
1585
|
-
this.groupCallEventHandler = undefined;
|
1586
|
-
|
1587
1541
|
globalThis.clearInterval(this.checkTurnServersIntervalID);
|
1588
1542
|
this.checkTurnServersIntervalID = undefined;
|
1589
1543
|
|
@@ -1593,8 +1547,6 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
|
|
1593
1547
|
|
1594
1548
|
this.toDeviceMessageQueue.stop();
|
1595
1549
|
|
1596
|
-
this.matrixRTC.stop();
|
1597
|
-
|
1598
1550
|
this.serverCapabilitiesService.stop();
|
1599
1551
|
}
|
1600
1552
|
|
@@ -1894,13 +1846,6 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
|
|
1894
1846
|
return this.canSupportVoip;
|
1895
1847
|
}
|
1896
1848
|
|
1897
|
-
/**
|
1898
|
-
* @returns
|
1899
|
-
*/
|
1900
|
-
public getMediaHandler(): MediaHandler {
|
1901
|
-
return this.mediaHandler;
|
1902
|
-
}
|
1903
|
-
|
1904
1849
|
/**
|
1905
1850
|
* Set whether VoIP calls are forced to use only TURN
|
1906
1851
|
* candidates. This is the same as the forceTURN option
|
@@ -1928,58 +1873,6 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
|
|
1928
1873
|
return this.useE2eForGroupCall;
|
1929
1874
|
}
|
1930
1875
|
|
1931
|
-
/**
|
1932
|
-
* Creates a new call.
|
1933
|
-
* The place*Call methods on the returned call can be used to actually place a call
|
1934
|
-
*
|
1935
|
-
* @param roomId - The room the call is to be placed in.
|
1936
|
-
* @returns the call or null if the browser doesn't support calling.
|
1937
|
-
*/
|
1938
|
-
public createCall(roomId: string): MatrixCall | null {
|
1939
|
-
return createNewMatrixCall(this, roomId);
|
1940
|
-
}
|
1941
|
-
|
1942
|
-
/**
|
1943
|
-
* Creates a new group call and sends the associated state event
|
1944
|
-
* to alert other members that the room now has a group call.
|
1945
|
-
*
|
1946
|
-
* @param roomId - The room the call is to be placed in.
|
1947
|
-
*/
|
1948
|
-
public async createGroupCall(
|
1949
|
-
roomId: string,
|
1950
|
-
type: GroupCallType,
|
1951
|
-
isPtt: boolean,
|
1952
|
-
intent: GroupCallIntent,
|
1953
|
-
dataChannelsEnabled?: boolean,
|
1954
|
-
dataChannelOptions?: IGroupCallDataChannelOptions,
|
1955
|
-
): Promise<GroupCall> {
|
1956
|
-
if (this.getGroupCallForRoom(roomId)) {
|
1957
|
-
throw new Error(`${roomId} already has an existing group call`);
|
1958
|
-
}
|
1959
|
-
|
1960
|
-
const room = this.getRoom(roomId);
|
1961
|
-
|
1962
|
-
if (!room) {
|
1963
|
-
throw new Error(`Cannot find room ${roomId}`);
|
1964
|
-
}
|
1965
|
-
|
1966
|
-
// Because without Media section a WebRTC connection is not possible, so need a RTCDataChannel to set up a
|
1967
|
-
// no media WebRTC connection anyway.
|
1968
|
-
return new GroupCall(
|
1969
|
-
this,
|
1970
|
-
room,
|
1971
|
-
type,
|
1972
|
-
isPtt,
|
1973
|
-
intent,
|
1974
|
-
undefined,
|
1975
|
-
dataChannelsEnabled || this.isVoipWithNoMediaAllowed,
|
1976
|
-
dataChannelOptions,
|
1977
|
-
this.isVoipWithNoMediaAllowed,
|
1978
|
-
this.useLivekitForGroupCalls,
|
1979
|
-
this.livekitServiceURL,
|
1980
|
-
).create();
|
1981
|
-
}
|
1982
|
-
|
1983
1876
|
public getLivekitServiceURL(): string | undefined {
|
1984
1877
|
return this.livekitServiceURL;
|
1985
1878
|
}
|
@@ -1990,29 +1883,6 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
|
|
1990
1883
|
this.livekitServiceURL = newURL;
|
1991
1884
|
}
|
1992
1885
|
|
1993
|
-
/**
|
1994
|
-
* Wait until an initial state for the given room has been processed by the
|
1995
|
-
* client and the client is aware of any ongoing group calls. Awaiting on
|
1996
|
-
* the promise returned by this method before calling getGroupCallForRoom()
|
1997
|
-
* avoids races where getGroupCallForRoom is called before the state for that
|
1998
|
-
* room has been processed. It does not, however, fix other races, eg. two
|
1999
|
-
* clients both creating a group call at the same time.
|
2000
|
-
* @param roomId - The room ID to wait for
|
2001
|
-
* @returns A promise that resolves once existing group calls in the room
|
2002
|
-
* have been processed.
|
2003
|
-
*/
|
2004
|
-
public waitUntilRoomReadyForGroupCalls(roomId: string): Promise<void> {
|
2005
|
-
return this.groupCallEventHandler!.waitUntilRoomReadyForGroupCalls(roomId);
|
2006
|
-
}
|
2007
|
-
|
2008
|
-
/**
|
2009
|
-
* Get an existing group call for the provided room.
|
2010
|
-
* @returns The group call or null if it doesn't already exist.
|
2011
|
-
*/
|
2012
|
-
public getGroupCallForRoom(roomId: string): GroupCall | null {
|
2013
|
-
return this.groupCallEventHandler!.groupCalls.get(roomId) || null;
|
2014
|
-
}
|
2015
|
-
|
2016
1886
|
/**
|
2017
1887
|
* Get the current sync state.
|
2018
1888
|
* @returns the sync state, which may be null.
|
@@ -7484,25 +7354,6 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
|
|
7484
7354
|
return this.http.authedRequest(Method.Post, path, undefined, {});
|
7485
7355
|
}
|
7486
7356
|
|
7487
|
-
private startCallEventHandler = (): void => {
|
7488
|
-
if (this.isInitialSyncComplete()) {
|
7489
|
-
if (supportsMatrixCall()) {
|
7490
|
-
this.callEventHandler!.start();
|
7491
|
-
this.groupCallEventHandler!.start();
|
7492
|
-
}
|
7493
|
-
|
7494
|
-
this.off(ClientEvent.Sync, this.startCallEventHandler);
|
7495
|
-
}
|
7496
|
-
};
|
7497
|
-
|
7498
|
-
private startMatrixRTC = (): void => {
|
7499
|
-
if (this.isInitialSyncComplete()) {
|
7500
|
-
this.matrixRTC.start();
|
7501
|
-
|
7502
|
-
this.off(ClientEvent.Sync, this.startMatrixRTC);
|
7503
|
-
}
|
7504
|
-
};
|
7505
|
-
|
7506
7357
|
/**
|
7507
7358
|
* Once the client has been initialised, we want to clear notifications we
|
7508
7359
|
* know for a fact should be here.
|
package/src/embedded.ts
CHANGED
@@ -302,8 +302,6 @@ export class RoomWidgetClient extends MatrixClient {
|
|
302
302
|
this.setSyncState(SyncState.Syncing);
|
303
303
|
logger.info("Finished backfilling events");
|
304
304
|
|
305
|
-
this.matrixRTC.start();
|
306
|
-
|
307
305
|
// Watch for TURN servers, if requested
|
308
306
|
if (this.capabilities.turnServers) this.watchTurnServers();
|
309
307
|
}
|
package/src/matrix.ts
CHANGED
@@ -83,16 +83,6 @@ export type { RoomSummary } from "./client.ts";
|
|
83
83
|
export * as ContentHelpers from "./content-helpers.ts";
|
84
84
|
export * as SecretStorage from "./secret-storage.ts";
|
85
85
|
export type { ICryptoCallbacks } from "./crypto/index.ts"; // used to be located here
|
86
|
-
export { createNewMatrixCall, CallEvent } from "./webrtc/call.ts";
|
87
|
-
export type { MatrixCall } from "./webrtc/call.ts";
|
88
|
-
export {
|
89
|
-
GroupCall,
|
90
|
-
GroupCallEvent,
|
91
|
-
GroupCallIntent,
|
92
|
-
GroupCallState,
|
93
|
-
GroupCallType,
|
94
|
-
GroupCallStatsReportEvent,
|
95
|
-
} from "./webrtc/groupCall.ts";
|
96
86
|
|
97
87
|
export {
|
98
88
|
/** @deprecated Use {@link Crypto.CryptoEvent} instead */
|
@@ -101,9 +91,6 @@ export {
|
|
101
91
|
export { SyncState, SetPresence } from "./sync.ts";
|
102
92
|
export type { ISyncStateData as SyncStateData } from "./sync.ts";
|
103
93
|
export { SlidingSyncEvent } from "./sliding-sync.ts";
|
104
|
-
export { MediaHandlerEvent } from "./webrtc/mediaHandler.ts";
|
105
|
-
export { CallFeedEvent } from "./webrtc/callFeed.ts";
|
106
|
-
export { StatsReport } from "./webrtc/stats/statsReport.ts";
|
107
94
|
export { Relations, RelationsEvent } from "./models/relations.ts";
|
108
95
|
export { TypedEventEmitter } from "./models/typed-event-emitter.ts";
|
109
96
|
export { LocalStorageErrors } from "./store/local-storage-events-emitter.ts";
|
@@ -1,66 +0,0 @@
|
|
1
|
-
import { EitherAnd } from "matrix-events-sdk/lib/types";
|
2
|
-
import { MatrixEvent } from "../matrix.ts";
|
3
|
-
import { Focus } from "./focus.ts";
|
4
|
-
type CallScope = "m.room" | "m.user";
|
5
|
-
export type SessionMembershipData = {
|
6
|
-
application: string;
|
7
|
-
call_id: string;
|
8
|
-
device_id: string;
|
9
|
-
focus_active: Focus;
|
10
|
-
foci_preferred: Focus[];
|
11
|
-
created_ts?: number;
|
12
|
-
scope?: CallScope;
|
13
|
-
};
|
14
|
-
export declare const isSessionMembershipData: (data: CallMembershipData) => data is SessionMembershipData;
|
15
|
-
export type CallMembershipDataLegacy = {
|
16
|
-
application: string;
|
17
|
-
call_id: string;
|
18
|
-
scope: CallScope;
|
19
|
-
device_id: string;
|
20
|
-
membershipID: string;
|
21
|
-
created_ts?: number;
|
22
|
-
foci_active?: Focus[];
|
23
|
-
} & EitherAnd<{
|
24
|
-
expires: number;
|
25
|
-
}, {
|
26
|
-
expires_ts: number;
|
27
|
-
}>;
|
28
|
-
export declare const isLegacyCallMembershipData: (data: CallMembershipData) => data is CallMembershipDataLegacy;
|
29
|
-
export type CallMembershipData = CallMembershipDataLegacy | SessionMembershipData;
|
30
|
-
export declare class CallMembership {
|
31
|
-
private parentEvent;
|
32
|
-
static equal(a: CallMembership, b: CallMembership): boolean;
|
33
|
-
private membershipData;
|
34
|
-
constructor(parentEvent: MatrixEvent, data: any);
|
35
|
-
get sender(): string | undefined;
|
36
|
-
get eventId(): string | undefined;
|
37
|
-
get callId(): string;
|
38
|
-
get deviceId(): string;
|
39
|
-
get application(): string | undefined;
|
40
|
-
get scope(): CallScope | undefined;
|
41
|
-
get membershipID(): string;
|
42
|
-
createdTs(): number;
|
43
|
-
/**
|
44
|
-
* Gets the absolute expiry time of the membership if applicable to this membership type.
|
45
|
-
* @returns The absolute expiry time of the membership as a unix timestamp in milliseconds or undefined if not applicable
|
46
|
-
*/
|
47
|
-
getAbsoluteExpiry(): number | undefined;
|
48
|
-
/**
|
49
|
-
* Gets the expiry time of the event, converted into the device's local time.
|
50
|
-
* @deprecated This function has been observed returning bad data and is no longer used by MatrixRTC.
|
51
|
-
* @returns The local expiry time of the membership as a unix timestamp in milliseconds or undefined if not applicable
|
52
|
-
*/
|
53
|
-
getLocalExpiry(): number | undefined;
|
54
|
-
/**
|
55
|
-
* @returns The number of milliseconds until the membership expires or undefined if applicable
|
56
|
-
*/
|
57
|
-
getMsUntilExpiry(): number | undefined;
|
58
|
-
/**
|
59
|
-
* @returns true if the membership has expired, otherwise false
|
60
|
-
*/
|
61
|
-
isExpired(): boolean;
|
62
|
-
getPreferredFoci(): Focus[];
|
63
|
-
getFocusSelection(): string | undefined;
|
64
|
-
}
|
65
|
-
export {};
|
66
|
-
//# sourceMappingURL=CallMembership.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"CallMembership.d.ts","sourceRoot":"","sources":["../../src/matrixrtc/CallMembership.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAExD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAGnC,KAAK,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAOrC,MAAM,MAAM,qBAAqB,GAAG;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAElB,YAAY,EAAE,KAAK,CAAC;IACpB,cAAc,EAAE,KAAK,EAAE,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,KAAK,CAAC,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,uBAAuB,SAAU,kBAAkB,KAAG,IAAI,IAAI,qBACjD,CAAC;AAmB3B,MAAM,MAAM,wBAAwB,GAAG;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,SAAS,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,KAAK,EAAE,CAAC;CACzB,GAAG,SAAS,CAAC;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,EAAE;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE3D,eAAO,MAAM,0BAA0B,SAAU,kBAAkB,KAAG,IAAI,IAAI,wBACpD,CAAC;AA6B3B,MAAM,MAAM,kBAAkB,GAAG,wBAAwB,GAAG,qBAAqB,CAAC;AAElF,qBAAa,cAAc;IAOnB,OAAO,CAAC,WAAW;WANT,KAAK,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,cAAc,GAAG,OAAO;IAGlE,OAAO,CAAC,cAAc,CAAqB;gBAG/B,WAAW,EAAE,WAAW,EAChC,IAAI,EAAE,GAAG;IAab,IAAW,MAAM,IAAI,MAAM,GAAG,SAAS,CAEtC;IAED,IAAW,OAAO,IAAI,MAAM,GAAG,SAAS,CAEvC;IAED,IAAW,MAAM,IAAI,MAAM,CAE1B;IAED,IAAW,QAAQ,IAAI,MAAM,CAE5B;IAED,IAAW,WAAW,IAAI,MAAM,GAAG,SAAS,CAE3C;IAED,IAAW,KAAK,IAAI,SAAS,GAAG,SAAS,CAExC;IAED,IAAW,YAAY,IAAI,MAAM,CAMhC;IAEM,SAAS,IAAI,MAAM;IAI1B;;;OAGG;IACI,iBAAiB,IAAI,MAAM,GAAG,SAAS;IAa9C;;;;OAIG;IACI,cAAc,IAAI,MAAM,GAAG,SAAS;IAkB3C;;OAEG;IACI,gBAAgB,IAAI,MAAM,GAAG,SAAS;IAY7C;;OAEG;IACI,SAAS,IAAI,OAAO;IAOpB,gBAAgB,IAAI,KAAK,EAAE;IAS3B,iBAAiB,IAAI,MAAM,GAAG,SAAS;CAUjD"}
|
@@ -1,197 +0,0 @@
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
2
|
-
/*
|
3
|
-
Copyright 2023 The Matrix.org Foundation C.I.C.
|
4
|
-
|
5
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
you may not use this file except in compliance with the License.
|
7
|
-
You may obtain a copy of the License at
|
8
|
-
|
9
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
|
11
|
-
Unless required by applicable law or agreed to in writing, software
|
12
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
See the License for the specific language governing permissions and
|
15
|
-
limitations under the License.
|
16
|
-
*/
|
17
|
-
|
18
|
-
import { deepCompare } from "../utils.js";
|
19
|
-
import { isLivekitFocusActive } from "./LivekitFocus.js";
|
20
|
-
|
21
|
-
// Represents an entry in the memberships section of an m.call.member event as it is on the wire
|
22
|
-
|
23
|
-
// There are two different data interfaces. One for the Legacy types and one compliant with MSC4143
|
24
|
-
|
25
|
-
// MSC4143 (MatrixRTC) session membership data
|
26
|
-
|
27
|
-
export var isSessionMembershipData = data => "focus_active" in data;
|
28
|
-
var checkSessionsMembershipData = (data, errors) => {
|
29
|
-
var _data$focus_active;
|
30
|
-
var prefix = "Malformed session membership event: ";
|
31
|
-
if (typeof data.device_id !== "string") errors.push(prefix + "device_id must be string");
|
32
|
-
if (typeof data.call_id !== "string") errors.push(prefix + "call_id must be string");
|
33
|
-
if (typeof data.application !== "string") errors.push(prefix + "application must be a string");
|
34
|
-
if (typeof ((_data$focus_active = data.focus_active) === null || _data$focus_active === void 0 ? void 0 : _data$focus_active.type) !== "string") errors.push(prefix + "focus_active.type must be a string");
|
35
|
-
if (!Array.isArray(data.foci_preferred)) errors.push(prefix + "foci_preferred must be an array");
|
36
|
-
// optional parameters
|
37
|
-
if (data.created_ts && typeof data.created_ts !== "number") errors.push(prefix + "created_ts must be number");
|
38
|
-
|
39
|
-
// application specific data (we first need to check if they exist)
|
40
|
-
if (data.scope && typeof data.scope !== "string") errors.push(prefix + "scope must be string");
|
41
|
-
return errors.length === 0;
|
42
|
-
};
|
43
|
-
|
44
|
-
// Legacy session membership data
|
45
|
-
|
46
|
-
export var isLegacyCallMembershipData = data => "membershipID" in data;
|
47
|
-
var checkCallMembershipDataLegacy = (data, errors) => {
|
48
|
-
var prefix = "Malformed legacy rtc membership event: ";
|
49
|
-
if (!("expires" in data || "expires_ts" in data)) {
|
50
|
-
errors.push(prefix + "expires_ts or expires must be present");
|
51
|
-
}
|
52
|
-
if ("expires" in data) {
|
53
|
-
if (typeof data.expires !== "number") {
|
54
|
-
errors.push(prefix + "expires must be numeric");
|
55
|
-
}
|
56
|
-
}
|
57
|
-
if ("expires_ts" in data) {
|
58
|
-
if (typeof data.expires_ts !== "number") {
|
59
|
-
errors.push(prefix + "expires_ts must be numeric");
|
60
|
-
}
|
61
|
-
}
|
62
|
-
if (typeof data.device_id !== "string") errors.push(prefix + "device_id must be string");
|
63
|
-
if (typeof data.call_id !== "string") errors.push(prefix + "call_id must be string");
|
64
|
-
if (typeof data.application !== "string") errors.push(prefix + "application must be a string");
|
65
|
-
if (typeof data.membershipID !== "string") errors.push(prefix + "membershipID must be a string");
|
66
|
-
// optional elements
|
67
|
-
if (data.created_ts && typeof data.created_ts !== "number") errors.push(prefix + "created_ts must be number");
|
68
|
-
// application specific data (we first need to check if they exist)
|
69
|
-
if (data.scope && typeof data.scope !== "string") errors.push(prefix + "scope must be string");
|
70
|
-
return errors.length === 0;
|
71
|
-
};
|
72
|
-
export class CallMembership {
|
73
|
-
static equal(a, b) {
|
74
|
-
return deepCompare(a.membershipData, b.membershipData);
|
75
|
-
}
|
76
|
-
constructor(parentEvent, data) {
|
77
|
-
this.parentEvent = parentEvent;
|
78
|
-
_defineProperty(this, "membershipData", void 0);
|
79
|
-
var sessionErrors = [];
|
80
|
-
var legacyErrors = [];
|
81
|
-
if (!checkSessionsMembershipData(data, sessionErrors) && !checkCallMembershipDataLegacy(data, legacyErrors)) {
|
82
|
-
throw Error("unknown CallMembership data. Does not match legacy call.member (".concat(legacyErrors.join(" & "), ") events nor MSC4143 (").concat(sessionErrors.join(" & "), ")"));
|
83
|
-
} else {
|
84
|
-
this.membershipData = data;
|
85
|
-
}
|
86
|
-
}
|
87
|
-
get sender() {
|
88
|
-
return this.parentEvent.getSender();
|
89
|
-
}
|
90
|
-
get eventId() {
|
91
|
-
return this.parentEvent.getId();
|
92
|
-
}
|
93
|
-
get callId() {
|
94
|
-
return this.membershipData.call_id;
|
95
|
-
}
|
96
|
-
get deviceId() {
|
97
|
-
return this.membershipData.device_id;
|
98
|
-
}
|
99
|
-
get application() {
|
100
|
-
return this.membershipData.application;
|
101
|
-
}
|
102
|
-
get scope() {
|
103
|
-
return this.membershipData.scope;
|
104
|
-
}
|
105
|
-
get membershipID() {
|
106
|
-
if (isLegacyCallMembershipData(this.membershipData)) return this.membershipData.membershipID;
|
107
|
-
// the createdTs behaves equivalent to the membershipID.
|
108
|
-
// we only need the field for the legacy member envents where we needed to update them
|
109
|
-
// synapse ignores sending state events if they have the same content.
|
110
|
-
else return this.createdTs().toString();
|
111
|
-
}
|
112
|
-
createdTs() {
|
113
|
-
var _this$membershipData$;
|
114
|
-
return (_this$membershipData$ = this.membershipData.created_ts) !== null && _this$membershipData$ !== void 0 ? _this$membershipData$ : this.parentEvent.getTs();
|
115
|
-
}
|
116
|
-
|
117
|
-
/**
|
118
|
-
* Gets the absolute expiry time of the membership if applicable to this membership type.
|
119
|
-
* @returns The absolute expiry time of the membership as a unix timestamp in milliseconds or undefined if not applicable
|
120
|
-
*/
|
121
|
-
getAbsoluteExpiry() {
|
122
|
-
// if the membership is not a legacy membership, we assume it is MSC4143
|
123
|
-
if (!isLegacyCallMembershipData(this.membershipData)) return undefined;
|
124
|
-
if ("expires" in this.membershipData) {
|
125
|
-
// we know createdTs exists since we already do the isLegacyCallMembershipData check
|
126
|
-
return this.createdTs() + this.membershipData.expires;
|
127
|
-
} else {
|
128
|
-
// We know it exists because we checked for this in the constructor.
|
129
|
-
return this.membershipData.expires_ts;
|
130
|
-
}
|
131
|
-
}
|
132
|
-
|
133
|
-
/**
|
134
|
-
* Gets the expiry time of the event, converted into the device's local time.
|
135
|
-
* @deprecated This function has been observed returning bad data and is no longer used by MatrixRTC.
|
136
|
-
* @returns The local expiry time of the membership as a unix timestamp in milliseconds or undefined if not applicable
|
137
|
-
*/
|
138
|
-
getLocalExpiry() {
|
139
|
-
// if the membership is not a legacy membership, we assume it is MSC4143
|
140
|
-
if (!isLegacyCallMembershipData(this.membershipData)) return undefined;
|
141
|
-
if ("expires" in this.membershipData) {
|
142
|
-
// we know createdTs exists since we already do the isLegacyCallMembershipData check
|
143
|
-
var relativeCreationTime = this.parentEvent.getTs() - this.createdTs();
|
144
|
-
var localCreationTs = this.parentEvent.localTimestamp - relativeCreationTime;
|
145
|
-
return localCreationTs + this.membershipData.expires;
|
146
|
-
} else {
|
147
|
-
// With expires_ts we cannot convert to local time.
|
148
|
-
// TODO: Check the server timestamp and compute a diff to local time.
|
149
|
-
return this.membershipData.expires_ts;
|
150
|
-
}
|
151
|
-
}
|
152
|
-
|
153
|
-
/**
|
154
|
-
* @returns The number of milliseconds until the membership expires or undefined if applicable
|
155
|
-
*/
|
156
|
-
getMsUntilExpiry() {
|
157
|
-
if (isLegacyCallMembershipData(this.membershipData)) {
|
158
|
-
// Assume that local clock is sufficiently in sync with other clocks in the distributed system.
|
159
|
-
// We used to try and adjust for the local clock being skewed, but there are cases where this is not accurate.
|
160
|
-
// The current implementation allows for the local clock to be -infinity to +MatrixRTCSession.MEMBERSHIP_EXPIRY_TIME/2
|
161
|
-
return this.getAbsoluteExpiry() - Date.now();
|
162
|
-
}
|
163
|
-
|
164
|
-
// Assumed to be MSC4143
|
165
|
-
return undefined;
|
166
|
-
}
|
167
|
-
|
168
|
-
/**
|
169
|
-
* @returns true if the membership has expired, otherwise false
|
170
|
-
*/
|
171
|
-
isExpired() {
|
172
|
-
if (isLegacyCallMembershipData(this.membershipData)) return this.getMsUntilExpiry() <= 0;
|
173
|
-
|
174
|
-
// MSC4143 events expire by being updated. So if the event exists, its not expired.
|
175
|
-
return false;
|
176
|
-
}
|
177
|
-
getPreferredFoci() {
|
178
|
-
var _this$membershipData$2;
|
179
|
-
// To support both, the new and the old MatrixRTC memberships have two cases based
|
180
|
-
// on the availablitiy of `foci_preferred`
|
181
|
-
if (isLegacyCallMembershipData(this.membershipData)) return (_this$membershipData$2 = this.membershipData.foci_active) !== null && _this$membershipData$2 !== void 0 ? _this$membershipData$2 : [];
|
182
|
-
|
183
|
-
// MSC4143 style membership
|
184
|
-
return this.membershipData.foci_preferred;
|
185
|
-
}
|
186
|
-
getFocusSelection() {
|
187
|
-
if (isLegacyCallMembershipData(this.membershipData)) {
|
188
|
-
return "oldest_membership";
|
189
|
-
} else {
|
190
|
-
var focusActive = this.membershipData.focus_active;
|
191
|
-
if (isLivekitFocusActive(focusActive)) {
|
192
|
-
return focusActive.focus_selection;
|
193
|
-
}
|
194
|
-
}
|
195
|
-
}
|
196
|
-
}
|
197
|
-
//# sourceMappingURL=CallMembership.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"CallMembership.js","names":["deepCompare","isLivekitFocusActive","isSessionMembershipData","data","checkSessionsMembershipData","errors","_data$focus_active","prefix","device_id","push","call_id","application","focus_active","type","Array","isArray","foci_preferred","created_ts","scope","length","isLegacyCallMembershipData","checkCallMembershipDataLegacy","expires","expires_ts","membershipID","CallMembership","equal","a","b","membershipData","constructor","parentEvent","_defineProperty","sessionErrors","legacyErrors","Error","concat","join","sender","getSender","eventId","getId","callId","deviceId","createdTs","toString","_this$membershipData$","getTs","getAbsoluteExpiry","undefined","getLocalExpiry","relativeCreationTime","localCreationTs","localTimestamp","getMsUntilExpiry","Date","now","isExpired","getPreferredFoci","_this$membershipData$2","foci_active","getFocusSelection","focusActive","focus_selection"],"sources":["../../src/matrixrtc/CallMembership.ts"],"sourcesContent":["/*\nCopyright 2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { EitherAnd } from \"matrix-events-sdk/lib/types\";\n\nimport { MatrixEvent } from \"../matrix.ts\";\nimport { deepCompare } from \"../utils.ts\";\nimport { Focus } from \"./focus.ts\";\nimport { isLivekitFocusActive } from \"./LivekitFocus.ts\";\n\ntype CallScope = \"m.room\" | \"m.user\";\n// Represents an entry in the memberships section of an m.call.member event as it is on the wire\n\n// There are two different data interfaces. One for the Legacy types and one compliant with MSC4143\n\n// MSC4143 (MatrixRTC) session membership data\n\nexport type SessionMembershipData = {\n application: string;\n call_id: string;\n device_id: string;\n\n focus_active: Focus;\n foci_preferred: Focus[];\n created_ts?: number;\n\n // Application specific data\n scope?: CallScope;\n};\n\nexport const isSessionMembershipData = (data: CallMembershipData): data is SessionMembershipData =>\n \"focus_active\" in data;\n\nconst checkSessionsMembershipData = (data: any, errors: string[]): data is SessionMembershipData => {\n const prefix = \"Malformed session membership event: \";\n if (typeof data.device_id !== \"string\") errors.push(prefix + \"device_id must be string\");\n if (typeof data.call_id !== \"string\") errors.push(prefix + \"call_id must be string\");\n if (typeof data.application !== \"string\") errors.push(prefix + \"application must be a string\");\n if (typeof data.focus_active?.type !== \"string\") errors.push(prefix + \"focus_active.type must be a string\");\n if (!Array.isArray(data.foci_preferred)) errors.push(prefix + \"foci_preferred must be an array\");\n // optional parameters\n if (data.created_ts && typeof data.created_ts !== \"number\") errors.push(prefix + \"created_ts must be number\");\n\n // application specific data (we first need to check if they exist)\n if (data.scope && typeof data.scope !== \"string\") errors.push(prefix + \"scope must be string\");\n return errors.length === 0;\n};\n\n// Legacy session membership data\n\nexport type CallMembershipDataLegacy = {\n application: string;\n call_id: string;\n scope: CallScope;\n device_id: string;\n membershipID: string;\n created_ts?: number;\n foci_active?: Focus[];\n} & EitherAnd<{ expires: number }, { expires_ts: number }>;\n\nexport const isLegacyCallMembershipData = (data: CallMembershipData): data is CallMembershipDataLegacy =>\n \"membershipID\" in data;\n\nconst checkCallMembershipDataLegacy = (data: any, errors: string[]): data is CallMembershipDataLegacy => {\n const prefix = \"Malformed legacy rtc membership event: \";\n if (!(\"expires\" in data || \"expires_ts\" in data)) {\n errors.push(prefix + \"expires_ts or expires must be present\");\n }\n if (\"expires\" in data) {\n if (typeof data.expires !== \"number\") {\n errors.push(prefix + \"expires must be numeric\");\n }\n }\n if (\"expires_ts\" in data) {\n if (typeof data.expires_ts !== \"number\") {\n errors.push(prefix + \"expires_ts must be numeric\");\n }\n }\n\n if (typeof data.device_id !== \"string\") errors.push(prefix + \"device_id must be string\");\n if (typeof data.call_id !== \"string\") errors.push(prefix + \"call_id must be string\");\n if (typeof data.application !== \"string\") errors.push(prefix + \"application must be a string\");\n if (typeof data.membershipID !== \"string\") errors.push(prefix + \"membershipID must be a string\");\n // optional elements\n if (data.created_ts && typeof data.created_ts !== \"number\") errors.push(prefix + \"created_ts must be number\");\n // application specific data (we first need to check if they exist)\n if (data.scope && typeof data.scope !== \"string\") errors.push(prefix + \"scope must be string\");\n return errors.length === 0;\n};\n\nexport type CallMembershipData = CallMembershipDataLegacy | SessionMembershipData;\n\nexport class CallMembership {\n public static equal(a: CallMembership, b: CallMembership): boolean {\n return deepCompare(a.membershipData, b.membershipData);\n }\n private membershipData: CallMembershipData;\n\n public constructor(\n private parentEvent: MatrixEvent,\n data: any,\n ) {\n const sessionErrors: string[] = [];\n const legacyErrors: string[] = [];\n if (!checkSessionsMembershipData(data, sessionErrors) && !checkCallMembershipDataLegacy(data, legacyErrors)) {\n throw Error(\n `unknown CallMembership data. Does not match legacy call.member (${legacyErrors.join(\" & \")}) events nor MSC4143 (${sessionErrors.join(\" & \")})`,\n );\n } else {\n this.membershipData = data;\n }\n }\n\n public get sender(): string | undefined {\n return this.parentEvent.getSender();\n }\n\n public get eventId(): string | undefined {\n return this.parentEvent.getId();\n }\n\n public get callId(): string {\n return this.membershipData.call_id;\n }\n\n public get deviceId(): string {\n return this.membershipData.device_id;\n }\n\n public get application(): string | undefined {\n return this.membershipData.application;\n }\n\n public get scope(): CallScope | undefined {\n return this.membershipData.scope;\n }\n\n public get membershipID(): string {\n if (isLegacyCallMembershipData(this.membershipData)) return this.membershipData.membershipID;\n // the createdTs behaves equivalent to the membershipID.\n // we only need the field for the legacy member envents where we needed to update them\n // synapse ignores sending state events if they have the same content.\n else return this.createdTs().toString();\n }\n\n public createdTs(): number {\n return this.membershipData.created_ts ?? this.parentEvent.getTs();\n }\n\n /**\n * Gets the absolute expiry time of the membership if applicable to this membership type.\n * @returns The absolute expiry time of the membership as a unix timestamp in milliseconds or undefined if not applicable\n */\n public getAbsoluteExpiry(): number | undefined {\n // if the membership is not a legacy membership, we assume it is MSC4143\n if (!isLegacyCallMembershipData(this.membershipData)) return undefined;\n\n if (\"expires\" in this.membershipData) {\n // we know createdTs exists since we already do the isLegacyCallMembershipData check\n return this.createdTs() + this.membershipData.expires;\n } else {\n // We know it exists because we checked for this in the constructor.\n return this.membershipData.expires_ts;\n }\n }\n\n /**\n * Gets the expiry time of the event, converted into the device's local time.\n * @deprecated This function has been observed returning bad data and is no longer used by MatrixRTC.\n * @returns The local expiry time of the membership as a unix timestamp in milliseconds or undefined if not applicable\n */\n public getLocalExpiry(): number | undefined {\n // if the membership is not a legacy membership, we assume it is MSC4143\n if (!isLegacyCallMembershipData(this.membershipData)) return undefined;\n\n if (\"expires\" in this.membershipData) {\n // we know createdTs exists since we already do the isLegacyCallMembershipData check\n const relativeCreationTime = this.parentEvent.getTs() - this.createdTs();\n\n const localCreationTs = this.parentEvent.localTimestamp - relativeCreationTime;\n\n return localCreationTs + this.membershipData.expires;\n } else {\n // With expires_ts we cannot convert to local time.\n // TODO: Check the server timestamp and compute a diff to local time.\n return this.membershipData.expires_ts;\n }\n }\n\n /**\n * @returns The number of milliseconds until the membership expires or undefined if applicable\n */\n public getMsUntilExpiry(): number | undefined {\n if (isLegacyCallMembershipData(this.membershipData)) {\n // Assume that local clock is sufficiently in sync with other clocks in the distributed system.\n // We used to try and adjust for the local clock being skewed, but there are cases where this is not accurate.\n // The current implementation allows for the local clock to be -infinity to +MatrixRTCSession.MEMBERSHIP_EXPIRY_TIME/2\n return this.getAbsoluteExpiry()! - Date.now();\n }\n\n // Assumed to be MSC4143\n return undefined;\n }\n\n /**\n * @returns true if the membership has expired, otherwise false\n */\n public isExpired(): boolean {\n if (isLegacyCallMembershipData(this.membershipData)) return this.getMsUntilExpiry()! <= 0;\n\n // MSC4143 events expire by being updated. So if the event exists, its not expired.\n return false;\n }\n\n public getPreferredFoci(): Focus[] {\n // To support both, the new and the old MatrixRTC memberships have two cases based\n // on the availablitiy of `foci_preferred`\n if (isLegacyCallMembershipData(this.membershipData)) return this.membershipData.foci_active ?? [];\n\n // MSC4143 style membership\n return this.membershipData.foci_preferred;\n }\n\n public getFocusSelection(): string | undefined {\n if (isLegacyCallMembershipData(this.membershipData)) {\n return \"oldest_membership\";\n } else {\n const focusActive = this.membershipData.focus_active;\n if (isLivekitFocusActive(focusActive)) {\n return focusActive.focus_selection;\n }\n }\n }\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA,SAASA,WAAW,QAAQ,aAAa;AAEzC,SAASC,oBAAoB,QAAQ,mBAAmB;;AAGxD;;AAEA;;AAEA;;AAeA,OAAO,IAAMC,uBAAuB,GAAIC,IAAwB,IAC5D,cAAc,IAAIA,IAAI;AAE1B,IAAMC,2BAA2B,GAAGA,CAACD,IAAS,EAAEE,MAAgB,KAAoC;EAAA,IAAAC,kBAAA;EAChG,IAAMC,MAAM,GAAG,sCAAsC;EACrD,IAAI,OAAOJ,IAAI,CAACK,SAAS,KAAK,QAAQ,EAAEH,MAAM,CAACI,IAAI,CAACF,MAAM,GAAG,0BAA0B,CAAC;EACxF,IAAI,OAAOJ,IAAI,CAACO,OAAO,KAAK,QAAQ,EAAEL,MAAM,CAACI,IAAI,CAACF,MAAM,GAAG,wBAAwB,CAAC;EACpF,IAAI,OAAOJ,I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rC,0BAA0B,CAAC,IAAI,CAACS,cAAc,CAAC,EAAE,OAAO,IAAI,CAACyB,gBAAgB,CAAC,CAAC,IAAK,CAAC;;IAEzF;IACA,OAAO,KAAK;EAChB;EAEOI,gBAAgBA,CAAA,EAAY;IAAA,IAAAC,sBAAA;IAC/B;IACA;IACA,IAAIvC,0BAA0B,CAAC,IAAI,CAACS,cAAc,CAAC,EAAE,QAAA8B,sBAAA,GAAO,IAAI,CAAC9B,cAAc,CAAC+B,WAAW,cAAAD,sBAAA,cAAAA,sBAAA,GAAI,EAAE;;IAEjG;IACA,OAAO,IAAI,CAAC9B,cAAc,CAACb,cAAc;EAC7C;EAEO6C,iBAAiBA,CAAA,EAAuB;IAC3C,IAAIzC,0BAA0B,CAAC,IAAI,CAACS,cAAc,CAAC,EAAE;MACjD,OAAO,mBAAmB;IAC9B,CAAC,MAAM;MACH,IAAMiC,WAAW,GAAG,IAAI,CAACjC,cAAc,CAACjB,YAAY;MACpD,IAAIX,oBAAoB,CAAC6D,WAAW,CAAC,EAAE;QACnC,OAAOA,WAAW,CAACC,eAAe;MACtC;IACJ;EACJ;AACJ","ignoreList":[]}
|
@@ -1,16 +0,0 @@
|
|
1
|
-
import { Focus } from "./focus.ts";
|
2
|
-
export interface LivekitFocusConfig extends Focus {
|
3
|
-
type: "livekit";
|
4
|
-
livekit_service_url: string;
|
5
|
-
}
|
6
|
-
export declare const isLivekitFocusConfig: (object: any) => object is LivekitFocusConfig;
|
7
|
-
export interface LivekitFocus extends LivekitFocusConfig {
|
8
|
-
livekit_alias: string;
|
9
|
-
}
|
10
|
-
export declare const isLivekitFocus: (object: any) => object is LivekitFocus;
|
11
|
-
export interface LivekitFocusActive extends Focus {
|
12
|
-
type: "livekit";
|
13
|
-
focus_selection: "oldest_membership";
|
14
|
-
}
|
15
|
-
export declare const isLivekitFocusActive: (object: any) => object is LivekitFocusActive;
|
16
|
-
//# sourceMappingURL=LivekitFocus.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"LivekitFocus.d.ts","sourceRoot":"","sources":["../../src/matrixrtc/LivekitFocus.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,MAAM,WAAW,kBAAmB,SAAQ,KAAK;IAC7C,IAAI,EAAE,SAAS,CAAC;IAChB,mBAAmB,EAAE,MAAM,CAAC;CAC/B;AAED,eAAO,MAAM,oBAAoB,WAAY,GAAG,KAAG,MAAM,IAAI,kBACG,CAAC;AAEjE,MAAM,WAAW,YAAa,SAAQ,kBAAkB;IACpD,aAAa,EAAE,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,cAAc,WAAY,GAAG,KAAG,MAAM,IAAI,YACM,CAAC;AAE9D,MAAM,WAAW,kBAAmB,SAAQ,KAAK;IAC7C,IAAI,EAAE,SAAS,CAAC;IAChB,eAAe,EAAE,mBAAmB,CAAC;CACxC;AACD,eAAO,MAAM,oBAAoB,WAAY,GAAG,KAAG,MAAM,IAAI,kBACD,CAAC"}
|
@@ -1,20 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Copyright 2023 New Vector Ltd
|
3
|
-
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
you may not use this file except in compliance with the License.
|
6
|
-
You may obtain a copy of the License at
|
7
|
-
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
See the License for the specific language governing permissions and
|
14
|
-
limitations under the License.
|
15
|
-
*/
|
16
|
-
|
17
|
-
export var isLivekitFocusConfig = object => object.type === "livekit" && "livekit_service_url" in object;
|
18
|
-
export var isLivekitFocus = object => isLivekitFocusConfig(object) && "livekit_alias" in object;
|
19
|
-
export var isLivekitFocusActive = object => object.type === "livekit" && "focus_selection" in object;
|
20
|
-
//# sourceMappingURL=LivekitFocus.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"LivekitFocus.js","names":["isLivekitFocusConfig","object","type","isLivekitFocus","isLivekitFocusActive"],"sources":["../../src/matrixrtc/LivekitFocus.ts"],"sourcesContent":["/*\nCopyright 2023 New Vector Ltd\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { Focus } from \"./focus.ts\";\n\nexport interface LivekitFocusConfig extends Focus {\n type: \"livekit\";\n livekit_service_url: string;\n}\n\nexport const isLivekitFocusConfig = (object: any): object is LivekitFocusConfig =>\n object.type === \"livekit\" && \"livekit_service_url\" in object;\n\nexport interface LivekitFocus extends LivekitFocusConfig {\n livekit_alias: string;\n}\n\nexport const isLivekitFocus = (object: any): object is LivekitFocus =>\n isLivekitFocusConfig(object) && \"livekit_alias\" in object;\n\nexport interface LivekitFocusActive extends Focus {\n type: \"livekit\";\n focus_selection: \"oldest_membership\";\n}\nexport const isLivekitFocusActive = (object: any): object is LivekitFocusActive =>\n object.type === \"livekit\" && \"focus_selection\" in object;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,OAAO,IAAMA,oBAAoB,GAAIC,MAAW,IAC5CA,MAAM,CAACC,IAAI,KAAK,SAAS,IAAI,qBAAqB,IAAID,MAAM;AAMhE,OAAO,IAAME,cAAc,GAAIF,MAAW,IACtCD,oBAAoB,CAACC,MAAM,CAAC,IAAI,eAAe,IAAIA,MAAM;AAM7D,OAAO,IAAMG,oBAAoB,GAAIH,MAAW,IAC5CA,MAAM,CAACC,IAAI,KAAK,SAAS,IAAI,iBAAiB,IAAID,MAAM","ignoreList":[]}
|