@vkontakte/calls-sdk 2.8.12-dev.8c2bbcbf.0 → 2.8.12-dev.a796d948.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CallsSDK.d.ts +0 -3
- package/abstract/BaseApi.d.ts +1 -1
- package/abstract/BaseSignaling.d.ts +5 -4
- package/calls-sdk.cjs.js +9 -9
- package/calls-sdk.esm.js +3256 -2735
- package/classes/CallRegistry.d.ts +1 -1
- package/classes/ExternalIdCache.d.ts +1 -0
- package/classes/{Conversation.d.ts → conversation/Conversation.d.ts} +37 -34
- package/classes/conversation/Conversation.testUtils.d.ts +148 -0
- package/classes/{ConversationResponseValidator.d.ts → conversation/ConversationResponseValidator.d.ts} +1 -1
- package/classes/{DisplayLayoutRequester.d.ts → conversation/DisplayLayoutRequester.d.ts} +5 -5
- package/classes/conversation/index.d.ts +1 -0
- package/classes/stat/CallFinishClassifier.d.ts +11 -0
- package/classes/stat/CallLifecycleStats.d.ts +1 -2
- package/default/Api.d.ts +2 -2
- package/default/Signaling.d.ts +11 -14
- package/default/SignalingTransport.d.ts +7 -1
- package/enums/HangupType.d.ts +0 -1
- package/package.json +1 -1
- package/static/External.d.ts +1 -1
- package/static/Params.d.ts +1 -1
- package/static/WebRTCUtils.d.ts +4 -0
- package/types/SignalingMessage.d.ts +4 -1
- package/types/WebTransport.d.ts +14 -15
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ExternalId, ExternalParticipantId } from '../types/ExternalId';
|
|
2
2
|
import { CompositeUserId, OkUserId, ParticipantId } from '../types/Participant';
|
|
3
3
|
export declare class ExternalIdCache {
|
|
4
|
+
private static _normalizeType;
|
|
4
5
|
private _okIdToExternalId;
|
|
5
6
|
private _externalIdToOkId;
|
|
6
7
|
private _decorativeIdToInitialId;
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import type { IEffect } from '@vkontakte/calls-video-effects';
|
|
2
2
|
import type { RGBTuple } from '@vkontakte/calls-vmoji';
|
|
3
|
-
import BaseApi from '
|
|
4
|
-
import BaseLogger from '
|
|
5
|
-
import { AddParticipantParams } from '
|
|
6
|
-
import ConversationFeature from '
|
|
7
|
-
import ConversationOption from '
|
|
8
|
-
import MediaOption from '
|
|
9
|
-
import UpdateDisplayLayoutErrorReason from '
|
|
10
|
-
import UserRole from '
|
|
11
|
-
import UserType from '
|
|
12
|
-
import { DebugMessageType } from '
|
|
13
|
-
import { JSONObject } from '
|
|
14
|
-
import { IAsrStartParams, IAsrStopParams } from '
|
|
15
|
-
import { AudienceModeHandsResponse } from '
|
|
16
|
-
import { ConversationData, ConversationOnJoinParams, ConversationOnStartParams } from '
|
|
17
|
-
import { ExternalId, ExternalParticipant, ExternalParticipantId, ExternalParticipantListChunk } from '
|
|
18
|
-
import MediaModifiers from '
|
|
19
|
-
import MediaSettings, { IVideoDimentions } from '
|
|
20
|
-
import { IAddMovieParams, IUpdateMovieData } from '
|
|
21
|
-
import MuteStates from '
|
|
22
|
-
import { CompositeUserId, IGetParticipantsParameters, OkUserId, ParticipantId, ParticipantStateData } from '
|
|
23
|
-
import { DisplayLayoutRequest, ParticipantLayout } from '
|
|
24
|
-
import { ParticipantListChunkParameters } from '
|
|
25
|
-
import ParticipantPriority from '
|
|
26
|
-
import { ParticipantStreamDescription } from '
|
|
27
|
-
import { ScreenCaptureSettings } from '
|
|
28
|
-
import SignalingMessage from '
|
|
29
|
-
import { WaitingHallResponse } from '
|
|
30
|
-
import EventEmitter from '
|
|
3
|
+
import BaseApi from '../../abstract/BaseApi';
|
|
4
|
+
import BaseLogger from '../../abstract/BaseLogger';
|
|
5
|
+
import { AddParticipantParams } from '../../abstract/BaseSignaling';
|
|
6
|
+
import ConversationFeature from '../../enums/ConversationFeature';
|
|
7
|
+
import ConversationOption from '../../enums/ConversationOption';
|
|
8
|
+
import MediaOption from '../../enums/MediaOption';
|
|
9
|
+
import UpdateDisplayLayoutErrorReason from '../../enums/UpdateDisplayLayoutErrorReason';
|
|
10
|
+
import UserRole from '../../enums/UserRole';
|
|
11
|
+
import UserType from '../../enums/UserType';
|
|
12
|
+
import { DebugMessageType } from '../../static/Debug';
|
|
13
|
+
import { JSONObject } from '../../static/Json';
|
|
14
|
+
import { IAsrStartParams, IAsrStopParams } from '../../types/Asr';
|
|
15
|
+
import { AudienceModeHandsResponse } from '../../types/AudienceMode';
|
|
16
|
+
import { ConversationData, ConversationOnJoinParams, ConversationOnStartParams } from '../../types/Conversation';
|
|
17
|
+
import { ExternalId, ExternalParticipant, ExternalParticipantId, ExternalParticipantListChunk } from '../../types/ExternalId';
|
|
18
|
+
import MediaModifiers from '../../types/MediaModifiers';
|
|
19
|
+
import MediaSettings, { IVideoDimentions } from '../../types/MediaSettings';
|
|
20
|
+
import { IAddMovieParams, IUpdateMovieData } from '../../types/MovieShare';
|
|
21
|
+
import MuteStates from '../../types/MuteStates';
|
|
22
|
+
import { CompositeUserId, IGetParticipantsParameters, OkUserId, ParticipantId, ParticipantStateData } from '../../types/Participant';
|
|
23
|
+
import { DisplayLayoutRequest, ParticipantLayout } from '../../types/ParticipantLayout';
|
|
24
|
+
import { ParticipantListChunkParameters } from '../../types/ParticipantListChunk';
|
|
25
|
+
import ParticipantPriority from '../../types/ParticipantPriority';
|
|
26
|
+
import { ParticipantStreamDescription } from '../../types/ParticipantStreamDescription';
|
|
27
|
+
import { ScreenCaptureSettings } from '../../types/ScreenCaptureSettings';
|
|
28
|
+
import SignalingMessage from '../../types/SignalingMessage';
|
|
29
|
+
import { WaitingHallResponse } from '../../types/WaitingHall';
|
|
30
|
+
import EventEmitter from '../EventEmitter';
|
|
31
31
|
export default class Conversation extends EventEmitter {
|
|
32
32
|
private readonly _api;
|
|
33
33
|
private readonly _signaling;
|
|
@@ -42,7 +42,6 @@ export default class Conversation extends EventEmitter {
|
|
|
42
42
|
private _waitingHallHoldPending;
|
|
43
43
|
private _participantState;
|
|
44
44
|
private _participants;
|
|
45
|
-
private _pendingParticipants;
|
|
46
45
|
private _directTransportIsMaster?;
|
|
47
46
|
private _transport;
|
|
48
47
|
private _debugInfo;
|
|
@@ -57,6 +56,8 @@ export default class Conversation extends EventEmitter {
|
|
|
57
56
|
private _serverSettings;
|
|
58
57
|
private _serverTimeOffset;
|
|
59
58
|
private _delayedHangup;
|
|
59
|
+
private _hangupEmitted;
|
|
60
|
+
private _hangupPromise;
|
|
60
61
|
private _abortController;
|
|
61
62
|
private _registeredPeerReceived;
|
|
62
63
|
private _calleeUnavailableTimer;
|
|
@@ -113,8 +114,10 @@ export default class Conversation extends EventEmitter {
|
|
|
113
114
|
private _openTransport;
|
|
114
115
|
private _allocateParticipantTransport;
|
|
115
116
|
private _cleanupRegistry;
|
|
117
|
+
private _emitHangupOnce;
|
|
116
118
|
private _close;
|
|
117
|
-
destroy():
|
|
119
|
+
destroy(): void;
|
|
120
|
+
private _destroy;
|
|
118
121
|
private _getConversationParams;
|
|
119
122
|
private _setConversationParams;
|
|
120
123
|
private _buildSignalingEndpoint;
|
|
@@ -156,6 +159,7 @@ export default class Conversation extends EventEmitter {
|
|
|
156
159
|
private _getExistedParticipantByIdOrCreate;
|
|
157
160
|
private _getExternalIdByParticipantId;
|
|
158
161
|
private _getExternalIdsByOkIdsFromCache;
|
|
162
|
+
private _getOrCacheExternalIdByCompositeId;
|
|
159
163
|
private _registerParticipantAndSetMarkersIfChunkEnabled;
|
|
160
164
|
private _warnParticipantNotInConversation;
|
|
161
165
|
private _denormalizeMarkers;
|
|
@@ -198,7 +202,7 @@ export default class Conversation extends EventEmitter {
|
|
|
198
202
|
private _cleanupTransportForHold;
|
|
199
203
|
private _cleanupSpeakerDetector;
|
|
200
204
|
private _cleanupSpecListener;
|
|
201
|
-
private
|
|
205
|
+
private _disposeSignaling;
|
|
202
206
|
private _onAddParticipant;
|
|
203
207
|
private _onRemoveParticipant;
|
|
204
208
|
changeDevice(kind: MediaDeviceKind): Promise<void>;
|
|
@@ -231,7 +235,7 @@ export default class Conversation extends EventEmitter {
|
|
|
231
235
|
private _getWaitingForPromotionStatus;
|
|
232
236
|
putHandsDown(): Promise<void>;
|
|
233
237
|
requestKeyFrame(participantStreamDescription: ParticipantStreamDescription): Promise<void | SignalingMessage>;
|
|
234
|
-
requestTestMode(consumerCommand: string, producerCommand: string): Promise<void>;
|
|
238
|
+
requestTestMode(consumerCommand: string, producerCommand: string): Promise<void | SignalingMessage>;
|
|
235
239
|
updateDisplayLayout(layouts: ParticipantLayout[]): Promise<void>;
|
|
236
240
|
requestDisplayLayout(requests: DisplayLayoutRequest[]): Promise<void>;
|
|
237
241
|
feedback(key: string): Promise<SignalingMessage>;
|
|
@@ -360,7 +364,7 @@ export default class Conversation extends EventEmitter {
|
|
|
360
364
|
private _onRecordInfo;
|
|
361
365
|
private _onStopRecordInfo;
|
|
362
366
|
private _changePinnedParticipantForRoom;
|
|
363
|
-
_changeRecordInfoForRoom():
|
|
367
|
+
_changeRecordInfoForRoom(): void;
|
|
364
368
|
private _changeAsrInfoForRoom;
|
|
365
369
|
private _changeUrlSharingInfoForRoom;
|
|
366
370
|
private _onParticipantAnimojiChanged;
|
|
@@ -435,7 +439,6 @@ export default class Conversation extends EventEmitter {
|
|
|
435
439
|
private _setMuteStatesForRoomId;
|
|
436
440
|
private _forceOpenTransportForAloneInCall;
|
|
437
441
|
private _registerParticipant;
|
|
438
|
-
private _getParticipants;
|
|
439
442
|
private _getParticipant;
|
|
440
443
|
}
|
|
441
444
|
declare function _resetPendingInstance(): void;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { FetchMock } from 'vitest-fetch-mock';
|
|
2
|
+
import { Mock } from 'vitest';
|
|
3
|
+
import { Client, Server } from 'mock-socket';
|
|
4
|
+
import { ISharedMovieInfo, OkUserId } from '../../CallsSDK';
|
|
5
|
+
import Api from '../../default/Api';
|
|
6
|
+
import CallDirection from '../../enums/CallDirection';
|
|
7
|
+
import ConversationOption from '../../enums/ConversationOption';
|
|
8
|
+
import TransportState from '../../enums/TransportState';
|
|
9
|
+
import TransportTopology from '../../enums/TransportTopology';
|
|
10
|
+
import { ParticipantStatus } from '../../static/External';
|
|
11
|
+
import { ExternalParticipantId } from '../../types/ExternalId';
|
|
12
|
+
import { ParticipantListMarkers } from '../../types/Participant';
|
|
13
|
+
import SignalingMessage from '../../types/SignalingMessage';
|
|
14
|
+
import Conversation from './Conversation';
|
|
15
|
+
declare function createParams(): {
|
|
16
|
+
apiKey: string;
|
|
17
|
+
apiEnv: string;
|
|
18
|
+
onLocalStream: Mock<import("@vitest/spy").Procedure>;
|
|
19
|
+
onLocalStatus: Mock<import("@vitest/spy").Procedure>;
|
|
20
|
+
onConversation: Mock<import("@vitest/spy").Procedure>;
|
|
21
|
+
onLocalSharedMovieInfo: Mock<import("@vitest/spy").Procedure>;
|
|
22
|
+
onRemoteSharedMovieInfo: Mock<import("@vitest/spy").Procedure>;
|
|
23
|
+
onRemoteSharedUrl: Mock<import("@vitest/spy").Procedure>;
|
|
24
|
+
onCallState: Mock<import("@vitest/spy").Procedure>;
|
|
25
|
+
onOptionsChanged: Mock<import("@vitest/spy").Procedure>;
|
|
26
|
+
onPinnedParticipant: Mock<import("@vitest/spy").Procedure>;
|
|
27
|
+
onRemoteMediaSettings: Mock<import("@vitest/spy").Procedure>;
|
|
28
|
+
onRemoteParticipantState: Mock<import("@vitest/spy").Procedure>;
|
|
29
|
+
onLocalPin: Mock<import("@vitest/spy").Procedure>;
|
|
30
|
+
onDebugMessage: Mock<import("@vitest/spy").Procedure>;
|
|
31
|
+
onHangup: Mock<import("@vitest/spy").Procedure>;
|
|
32
|
+
onRemoteRemoved: Mock<import("@vitest/spy").Procedure>;
|
|
33
|
+
onConversationParticipantListChunk: Mock<import("@vitest/spy").Procedure>;
|
|
34
|
+
onRoomParticipantsUpdated: Mock<import("@vitest/spy").Procedure>;
|
|
35
|
+
onChatRoomUpdated: Mock<import("@vitest/spy").Procedure>;
|
|
36
|
+
onRemoteStatus: Mock<import("@vitest/spy").Procedure>;
|
|
37
|
+
onSpeakerChanged: Mock<import("@vitest/spy").Procedure>;
|
|
38
|
+
};
|
|
39
|
+
export type ConversationTestParams = ReturnType<typeof createParams>;
|
|
40
|
+
export type ConversationTestTools = {
|
|
41
|
+
readonly endpointURL: string;
|
|
42
|
+
readonly fetchMocker: FetchMock;
|
|
43
|
+
readonly params: ConversationTestParams;
|
|
44
|
+
readonly server: Server;
|
|
45
|
+
readonly wsBaseURL: string;
|
|
46
|
+
createConnectionMessage(data?: Partial<SignalingMessage.Connection>): SignalingMessage.Connection;
|
|
47
|
+
createConversation(options?: {
|
|
48
|
+
api?: Api;
|
|
49
|
+
}): Conversation;
|
|
50
|
+
createExternalIdMock(id: string, data?: Partial<ExternalParticipantId>): ExternalParticipantId;
|
|
51
|
+
createMarkers(data?: Partial<ParticipantListMarkers>): ParticipantListMarkers;
|
|
52
|
+
createMovieShareInfo(initiatorId: string, data?: Partial<ISharedMovieInfo> | null): ISharedMovieInfo;
|
|
53
|
+
createParticipant(id: number, data?: Partial<SignalingMessage.Participant>): SignalingMessage.Participant & Required<Pick<SignalingMessage.Participant, 'markers'>>;
|
|
54
|
+
createParticipantWithMarkers(id: number, data?: Partial<SignalingMessage.Participant>): SignalingMessage.Participant & Required<Pick<SignalingMessage.Participant, 'markers'>>;
|
|
55
|
+
createPromoteParticipantMessage(): SignalingMessage.PromoteParticipant;
|
|
56
|
+
createSignallingConversation(okUserId: OkUserId, peerId: SignalingMessage.PeerId, data?: Partial<SignalingMessage.Conversation>): SignalingMessage.Conversation;
|
|
57
|
+
createWaitingHallConversationData(): ReturnType<typeof createWaitingHallConversationData>;
|
|
58
|
+
emitMessageOnConnection(wsServer: Server, message?: SignalingMessage.Connection): void;
|
|
59
|
+
enableParticipantListChunk(): void;
|
|
60
|
+
expectRemoteStatus(status: ParticipantStatus, participantId?: string): Promise<void>;
|
|
61
|
+
expectRemoteStatusCall(status: ParticipantStatus, participantId?: string): void;
|
|
62
|
+
forgetConversation(conversation: Conversation): void;
|
|
63
|
+
getActiveSocket(wsServer: Server): Client;
|
|
64
|
+
hasRemoteStatusCall(status: ParticipantStatus, participantId?: string): boolean;
|
|
65
|
+
isCapabilityEnabled(predicateIndex: number, wsServer: Server): boolean;
|
|
66
|
+
parseUrlSearch(search: string): Record<string, string>;
|
|
67
|
+
resetRemoteStatusCallbacks(): void;
|
|
68
|
+
respondOnGetParticipantListChunkWith(data: Partial<SignalingMessage.ParticipantListChunk>): void;
|
|
69
|
+
sendAcceptedCall(participant: SignalingMessage.Participant): void;
|
|
70
|
+
sendHungup(participant: SignalingMessage.Participant): void;
|
|
71
|
+
sendSessionState(participant: SignalingMessage.Participant | number, connected: boolean, data?: Partial<SignalingMessage.SessionState>): void;
|
|
72
|
+
setApiAuth(data?: {
|
|
73
|
+
sessionKey?: string;
|
|
74
|
+
sessionSecretKey?: string;
|
|
75
|
+
}): void;
|
|
76
|
+
setTransportState(conversation: Conversation, state: TransportState): void;
|
|
77
|
+
socketRespondWith(socket: Client, command: string, response: SignalingMessage): void;
|
|
78
|
+
socketSendNotification(socket: Client, notification: string, response?: SignalingMessage): void;
|
|
79
|
+
startConversation(message?: SignalingMessage.Connection): Promise<Conversation>;
|
|
80
|
+
startConversationWithParticipants(participants: SignalingMessage.Participant[], peerId?: SignalingMessage.PeerId): Promise<Conversation>;
|
|
81
|
+
startConversationWithRemoteParticipant(remoteParticipantData?: Partial<SignalingMessage.Participant>): Promise<{
|
|
82
|
+
conversation: Conversation;
|
|
83
|
+
meParticipant: SignalingMessage.Participant;
|
|
84
|
+
remoteParticipant: SignalingMessage.Participant;
|
|
85
|
+
}>;
|
|
86
|
+
stubApiRequest(endpoint: string, method: string, data: object): void;
|
|
87
|
+
waitFor(fn: () => Promise<boolean> | boolean, message?: string, timeout?: number): Promise<true>;
|
|
88
|
+
flushSdkCallbacks(): Promise<null>;
|
|
89
|
+
};
|
|
90
|
+
export declare function defineConversationTests(name: string, defineTests: (tools: ConversationTestTools) => void): void;
|
|
91
|
+
export declare function createExternalIdMock(id: string, data?: Partial<ExternalParticipantId>): ExternalParticipantId;
|
|
92
|
+
export declare function enableParticipantListChunk(): void;
|
|
93
|
+
export declare function setApiAuth(data?: {
|
|
94
|
+
sessionKey?: string;
|
|
95
|
+
sessionSecretKey?: string;
|
|
96
|
+
}): void;
|
|
97
|
+
export declare function setTransportState(conversation: Conversation, state: TransportState): void;
|
|
98
|
+
export declare function socketRespondWith(socket: Client, command: string, response: SignalingMessage): void;
|
|
99
|
+
export declare function socketSendNotification(socket: Client, notification: string, response?: SignalingMessage): void;
|
|
100
|
+
export declare function createWaitingHallConversationData(): {
|
|
101
|
+
acceptTime: null;
|
|
102
|
+
asrInfo: null;
|
|
103
|
+
asrInfoByRoom: Map<any, any>;
|
|
104
|
+
audienceMode: boolean;
|
|
105
|
+
chatId: null;
|
|
106
|
+
compositeUserId: string;
|
|
107
|
+
concurrent: boolean;
|
|
108
|
+
direction: CallDirection;
|
|
109
|
+
externalId: ExternalParticipantId;
|
|
110
|
+
features: never[];
|
|
111
|
+
featuresPerRole: null;
|
|
112
|
+
id: string;
|
|
113
|
+
mediaModifiers: {
|
|
114
|
+
denoise: boolean;
|
|
115
|
+
denoiseAnn: boolean;
|
|
116
|
+
};
|
|
117
|
+
muteStates: Map<any, any>;
|
|
118
|
+
muteStatesPersonal: {};
|
|
119
|
+
needRate: boolean;
|
|
120
|
+
networkRating: number;
|
|
121
|
+
observer: boolean;
|
|
122
|
+
options: ConversationOption[];
|
|
123
|
+
participantsLimit: number;
|
|
124
|
+
pinnedParticipantIdByRoom: Map<any, any>;
|
|
125
|
+
recordsInfoByRoom: Map<any, any>;
|
|
126
|
+
restricted: boolean;
|
|
127
|
+
roles: never[];
|
|
128
|
+
roomId: number | null;
|
|
129
|
+
topology: TransportTopology;
|
|
130
|
+
urlSharingInfoByRoom: Map<any, any>;
|
|
131
|
+
userId: number;
|
|
132
|
+
waitForAdmin: boolean;
|
|
133
|
+
waitingHall: boolean;
|
|
134
|
+
};
|
|
135
|
+
export declare function createPromoteParticipantMessage(): SignalingMessage.PromoteParticipant;
|
|
136
|
+
export declare function emitMessageOnConnection(wsServer: Server, message?: SignalingMessage.Connection): void;
|
|
137
|
+
export declare function getActiveSocket(wsServer: Server): Client;
|
|
138
|
+
export declare function isCapabilityEnabled(predicateIndex: number, wsServer: Server): boolean;
|
|
139
|
+
export declare function parseUrlSearch(search: string): Record<string, string>;
|
|
140
|
+
export declare function flushSdkCallbacks(): Promise<null>;
|
|
141
|
+
export declare function waitFor(fn: () => Promise<boolean> | boolean, message?: string, timeout?: number): Promise<true>;
|
|
142
|
+
export declare function createSignallingConversation(okUserId: OkUserId, peerId: SignalingMessage.PeerId, data?: Partial<SignalingMessage.Conversation>): SignalingMessage.Conversation;
|
|
143
|
+
export declare function createConnectionMessage(data?: Partial<SignalingMessage.Connection>): SignalingMessage.Connection;
|
|
144
|
+
export declare function createParticipant(id: number, data?: Partial<SignalingMessage.Participant>): SignalingMessage.Participant & Required<Pick<SignalingMessage.Participant, 'markers'>>;
|
|
145
|
+
export declare function createParticipantWithMarkers(id: number, data?: Partial<SignalingMessage.Participant>): SignalingMessage.Participant & Required<Pick<SignalingMessage.Participant, 'markers'>>;
|
|
146
|
+
export declare function createMarkers(data?: Partial<ParticipantListMarkers>): ParticipantListMarkers;
|
|
147
|
+
export declare function createMovieShareInfo(initiatorId: string, data?: Partial<ISharedMovieInfo> | null): ISharedMovieInfo;
|
|
148
|
+
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import ConversationResponse from '
|
|
1
|
+
import ConversationResponse from '../../types/ConversationResponse';
|
|
2
2
|
export type ConversationResponseSource = 'startConversation' | 'joinConversation' | 'joinConversationByLink' | 'fastStart' | 'fastJoin';
|
|
3
3
|
export declare function assertValidConversationResponse(response: ConversationResponse | null | undefined, source: ConversationResponseSource): void;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import BaseApi from '
|
|
2
|
-
import type { DebugLogger } from '
|
|
3
|
-
import { DisplayLayoutRequest, ParticipantLayout } from '
|
|
4
|
-
import { Participant, ParticipantId } from '
|
|
1
|
+
import BaseApi from '../../abstract/BaseApi';
|
|
2
|
+
import type { DebugLogger } from '../../static/Debug';
|
|
3
|
+
import { DisplayLayoutRequest, ParticipantLayout } from '../../types/ParticipantLayout';
|
|
4
|
+
import { Participant, ParticipantId } from '../../types/Participant';
|
|
5
5
|
type DisplayLayoutRequesterParams = {
|
|
6
6
|
api: BaseApi;
|
|
7
7
|
debug: DebugLogger;
|
|
8
|
-
getParticipants: () =>
|
|
8
|
+
getParticipants: () => Record<ParticipantId, Participant>;
|
|
9
9
|
isMe: (participantId: ParticipantId) => boolean;
|
|
10
10
|
updateDisplayLayout: (layouts: ParticipantLayout[]) => Promise<void>;
|
|
11
11
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Conversation';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type SemanticCallFinishReason = 'hangup' | 'canceled' | 'rejected' | 'busy' | 'missed' | 'timeout' | 'another_device' | 'removed' | 'banned' | 'initially_closed' | 'call_timeout' | 'socket_closed' | 'killed' | 'killed_without_delete' | 'obsolete_client' | 'unavailable';
|
|
2
|
+
export type ClassifiedCallFinish = {
|
|
3
|
+
reason: SemanticCallFinishReason;
|
|
4
|
+
string_value?: string;
|
|
5
|
+
} | {
|
|
6
|
+
reason: 'error';
|
|
7
|
+
string_value: string;
|
|
8
|
+
} | {
|
|
9
|
+
reason: 'failed';
|
|
10
|
+
};
|
|
11
|
+
export declare function classifyCallFinish(error: unknown): ClassifiedCallFinish;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import HangupReason from '../HangupReason';
|
|
2
1
|
import StatsLogger from '../StatsLogger';
|
|
3
2
|
export type CallLifecycleSource = 'outgoing' | 'incoming' | 'join' | 'anonym_join';
|
|
4
3
|
export interface CallLifecycleInitializationParams {
|
|
@@ -34,7 +33,7 @@ export declare class CallLifecycleStats {
|
|
|
34
33
|
markOutgoingAccepted(): void;
|
|
35
34
|
markIncomingAccepted(concurrent: boolean): void;
|
|
36
35
|
markFirstMediaSent(): void;
|
|
37
|
-
markFinished(reason:
|
|
36
|
+
markFinished(reason: unknown): void;
|
|
38
37
|
markTerminated(): void;
|
|
39
38
|
destroy(): void;
|
|
40
39
|
private _canRecord;
|
package/default/Api.d.ts
CHANGED
|
@@ -10,8 +10,8 @@ export default class Api extends BaseApi {
|
|
|
10
10
|
private _uuid;
|
|
11
11
|
private _idCache;
|
|
12
12
|
private _callUnsafe;
|
|
13
|
-
protected _call(method: string, data?: any, noSession?: boolean): Promise<any>;
|
|
14
|
-
userId(participantId: ParticipantId):
|
|
13
|
+
protected _call(method: string, data?: any, noSession?: boolean, allowReauthorize?: boolean): Promise<any>;
|
|
14
|
+
userId(participantId: ParticipantId): ExternalParticipantId;
|
|
15
15
|
authorize(): Promise<void>;
|
|
16
16
|
private _getAnonymLoginCacheKey;
|
|
17
17
|
private _getCachedAnonymLogin;
|
package/default/Signaling.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import BaseSignaling, { AddParticipantParams } from '../abstract/BaseSignaling';
|
|
2
|
-
import StatsLogger from '../classes/StatsLogger';
|
|
3
2
|
import { ParticipantIdRegistry } from '../classes/ParticipantIdRegistry';
|
|
4
3
|
import { SharingStatReport } from '../classes/screenshare/SharingStatReport';
|
|
5
4
|
import { StatAggregator } from '../classes/stat/StatAggregator';
|
|
6
5
|
import { StatPings } from '../classes/stat/StatPings';
|
|
7
6
|
import { StatSignalingCommands } from '../classes/stat/StatSignalingCommands';
|
|
8
|
-
import
|
|
7
|
+
import StatsLogger from '../classes/StatsLogger';
|
|
9
8
|
import ConversationFeature from '../enums/ConversationFeature';
|
|
10
9
|
import ConversationOption from '../enums/ConversationOption';
|
|
11
10
|
import MediaOption from '../enums/MediaOption';
|
|
12
11
|
import SignalingConnectionType from '../enums/SignalingConnectionType';
|
|
12
|
+
import TransportTopology from '../enums/TransportTopology';
|
|
13
13
|
import UserRole from '../enums/UserRole';
|
|
14
14
|
import { type DebugLogger } from '../static/Debug';
|
|
15
15
|
import { JSONObject } from '../static/Json';
|
|
@@ -35,13 +35,13 @@ export default class Signaling extends BaseSignaling {
|
|
|
35
35
|
private datachannelCommandsQueue;
|
|
36
36
|
private incomingCache;
|
|
37
37
|
private responseHandlers;
|
|
38
|
+
private disposed;
|
|
38
39
|
private connectionType;
|
|
39
40
|
private conversationResolve;
|
|
40
41
|
private conversationReject;
|
|
41
42
|
private connected;
|
|
42
43
|
private listenersReady;
|
|
43
44
|
private peerId;
|
|
44
|
-
private conversationId;
|
|
45
45
|
private connectionMessageWaitTimer;
|
|
46
46
|
private participantIdRegistry;
|
|
47
47
|
private producerNotificationDataChannel;
|
|
@@ -60,21 +60,16 @@ export default class Signaling extends BaseSignaling {
|
|
|
60
60
|
setAbortSignal(signal: AbortSignal | undefined): void;
|
|
61
61
|
setEndpoint(endpoint: string): void;
|
|
62
62
|
setWebTransportEndpoint(endpoint: string | null): void;
|
|
63
|
-
setConversationId(conversationId: string): void;
|
|
64
63
|
setParticipantIdRegistry(participantIdRegistry: ParticipantIdRegistry): void;
|
|
65
64
|
setProducerNotificationDataChannel(dataChannel: RTCDataChannel): void;
|
|
66
65
|
setProducerCommandDataChannel(dataChannel: RTCDataChannel): void;
|
|
67
66
|
useCommandDataChannel(status: boolean): void;
|
|
68
|
-
/**
|
|
69
|
-
* Free used resources
|
|
70
|
-
*/
|
|
71
|
-
cleanup(): void;
|
|
72
67
|
/**
|
|
73
68
|
* Open a connection with a signaling server
|
|
74
69
|
*/
|
|
75
70
|
connect(connectionType: SignalingConnectionType): Promise<SignalingMessage.Connection>;
|
|
76
71
|
getNextCommandSequenceNumber(): number;
|
|
77
|
-
hangup(reason: string): Promise<SignalingMessage
|
|
72
|
+
hangup(reason: string): Promise<SignalingMessage>;
|
|
78
73
|
sendCandidate(participantId: ParticipantId, candidate: RTCIceCandidate): Promise<SignalingMessage>;
|
|
79
74
|
requestTestMode(consumerCommand: string, producerCommand: string | null): Promise<SignalingMessage>;
|
|
80
75
|
sendSdp(participantId: ParticipantId, sdp: RTCSessionDescriptionInit, extraPayload?: Record<string, any>): Promise<SignalingMessage>;
|
|
@@ -138,10 +133,7 @@ export default class Signaling extends BaseSignaling {
|
|
|
138
133
|
acceptPromotion(reject?: boolean): Promise<SignalingMessage>;
|
|
139
134
|
feedback(key: string): Promise<SignalingMessage>;
|
|
140
135
|
getHandQueue(): Promise<SignalingMessage>;
|
|
141
|
-
|
|
142
|
-
* Close a connection with a signaling server
|
|
143
|
-
*/
|
|
144
|
-
close(): void;
|
|
136
|
+
dispose(cause?: Error): void;
|
|
145
137
|
/**
|
|
146
138
|
* Этот метод нужен т.к. после получения сообщения "connected" устанавливается транспорт
|
|
147
139
|
* и подписывается на сигналинг. Данные приходят очень быстро и транспорт пропускает
|
|
@@ -173,20 +165,25 @@ export default class Signaling extends BaseSignaling {
|
|
|
173
165
|
private _onError;
|
|
174
166
|
private _serializeErrorEvent;
|
|
175
167
|
private _onClose;
|
|
176
|
-
private
|
|
168
|
+
private _terminate;
|
|
169
|
+
private _fail;
|
|
177
170
|
private _isRecordCommand;
|
|
178
171
|
private _resolvePendingRecordCommands;
|
|
179
172
|
private _handleCommandResponse;
|
|
180
173
|
private _handleCommandsQueue;
|
|
181
174
|
private _startResponseTimer;
|
|
175
|
+
private _resolveCommandWithoutResponse;
|
|
182
176
|
private _serializeBinary;
|
|
183
177
|
private _serializeJson;
|
|
184
178
|
private _convertDisplayLayout;
|
|
185
179
|
private _waitConnectionMessage;
|
|
186
180
|
private _stopWaitConnectionMessage;
|
|
181
|
+
private _onTransportConnecting;
|
|
187
182
|
private _onTransportFailed;
|
|
188
183
|
private _onTransportReconnectScheduled;
|
|
189
184
|
private _onTransportConnectionDead;
|
|
185
|
+
private _attachNotificationCallError;
|
|
186
|
+
private _createSignalingCallError;
|
|
190
187
|
private _getSocketType;
|
|
191
188
|
private _markTransportStat;
|
|
192
189
|
private _logTransportStat;
|
|
@@ -9,13 +9,19 @@ export declare enum SignalingTransportFailure {
|
|
|
9
9
|
export type SignalingTransportFailedEvent = {
|
|
10
10
|
failure: SignalingTransportFailure;
|
|
11
11
|
message: string;
|
|
12
|
+
source: SignalingTransportType;
|
|
12
13
|
remote?: boolean;
|
|
13
14
|
};
|
|
14
15
|
export type SignalingTransportReconnectEvent = {
|
|
15
16
|
count: number;
|
|
16
17
|
delay: number;
|
|
17
18
|
};
|
|
19
|
+
export type SignalingTransportConnectingEvent = {
|
|
20
|
+
connectionType: SignalingConnectionType;
|
|
21
|
+
source: SignalingTransportType;
|
|
22
|
+
};
|
|
18
23
|
export type SignalingTransportHandlers = {
|
|
24
|
+
onConnecting: (event: SignalingTransportConnectingEvent) => void;
|
|
19
25
|
onOpen: () => void;
|
|
20
26
|
onMessage: (event: MessageEvent) => void;
|
|
21
27
|
onError: (event: Event) => void;
|
|
@@ -51,7 +57,7 @@ export default class SignalingTransport {
|
|
|
51
57
|
resetReconnectCount(): void;
|
|
52
58
|
connect(connectionType: SignalingConnectionType): void;
|
|
53
59
|
close(code?: number): void;
|
|
54
|
-
send(data: string | ArrayBuffer): void
|
|
60
|
+
send(data: string | ArrayBuffer): Promise<void>;
|
|
55
61
|
private _connect;
|
|
56
62
|
private _connectWebTransport;
|
|
57
63
|
private _connectWebSocket;
|
package/enums/HangupType.d.ts
CHANGED
|
@@ -20,7 +20,6 @@ declare enum HangupType {
|
|
|
20
20
|
CALLER_IS_REJECTED = "CALLER_IS_REJECTED",
|
|
21
21
|
UNKNOWN_ERROR = "UNKNOWN_ERROR",
|
|
22
22
|
UNSUPPORTED = "UNSUPPORTED",
|
|
23
|
-
OLD_VERSION = "OLD_VERSION",
|
|
24
23
|
SERVICE_DISABLED = "SERVICE_DISABLED",
|
|
25
24
|
SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE",
|
|
26
25
|
EXTERNAL_API_ERROR = "EXTERNAL_API_ERROR",
|
package/package.json
CHANGED
package/static/External.d.ts
CHANGED
|
@@ -637,6 +637,6 @@ declare namespace External {
|
|
|
637
637
|
/**
|
|
638
638
|
* Собеседник подключился к сигналлингу
|
|
639
639
|
*/
|
|
640
|
-
function onPeerRegistered(conversationId?: string): void;
|
|
640
|
+
function onPeerRegistered(conversationId?: string, externalIds?: ExternalId[]): void;
|
|
641
641
|
}
|
|
642
642
|
export default External;
|
package/static/Params.d.ts
CHANGED
|
@@ -892,7 +892,7 @@ export type ParamsObject = {
|
|
|
892
892
|
/**
|
|
893
893
|
* Собеседник подключился к сигналлингу
|
|
894
894
|
*/
|
|
895
|
-
onPeerRegistered?: (conversationId?: string) => void;
|
|
895
|
+
onPeerRegistered?: (conversationId?: string, externalIds?: ExternalId[]) => void;
|
|
896
896
|
};
|
|
897
897
|
export default abstract class Params {
|
|
898
898
|
private static _params;
|
package/static/WebRTCUtils.d.ts
CHANGED
|
@@ -122,6 +122,10 @@ declare namespace WebRTCUtils {
|
|
|
122
122
|
* Проверяет поддержку WebRTC браузером
|
|
123
123
|
*/
|
|
124
124
|
function isBrowserSupported(): boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Возвращает первую отсутствующую capability в стабильном порядке.
|
|
127
|
+
*/
|
|
128
|
+
function getBrowserSupportFailure(): BrowserSupportFailure | null;
|
|
125
129
|
/**
|
|
126
130
|
* Проверяет поддержку шаринга экрана браузером
|
|
127
131
|
*/
|
|
@@ -34,8 +34,11 @@ export type RecordInfo = {
|
|
|
34
34
|
recordExternalOwnerId?: string;
|
|
35
35
|
};
|
|
36
36
|
export interface SignalingResponse extends SignalingMessage {
|
|
37
|
-
response?: SignalingCommandType;
|
|
38
37
|
error?: string;
|
|
38
|
+
errorCode?: string;
|
|
39
|
+
errorMessage?: string;
|
|
40
|
+
message?: string;
|
|
41
|
+
response?: SignalingCommandType;
|
|
39
42
|
reason?: HangupType | FatalError;
|
|
40
43
|
sequence?: number;
|
|
41
44
|
type: 'response' | 'error' | 'timeout';
|
package/types/WebTransport.d.ts
CHANGED
|
@@ -1,33 +1,32 @@
|
|
|
1
1
|
import { WebTransportOptions } from '@fails-components/webtransport';
|
|
2
2
|
import { DebugLogger } from '../static/Debug';
|
|
3
3
|
declare class WebTransportEventual {
|
|
4
|
+
static isBrowserSupported(): boolean;
|
|
5
|
+
onopen: ((this: WebTransportEventual, ev: Event) => any) | null;
|
|
6
|
+
onmessage: ((this: WebTransportEventual, ev: MessageEvent) => any) | null;
|
|
7
|
+
onerror: ((this: WebTransportEventual, ev: Event) => any) | null;
|
|
8
|
+
onclose: ((this: WebTransportEventual, ev: CloseEvent) => any) | null;
|
|
9
|
+
readyState: number;
|
|
4
10
|
private webTransport;
|
|
5
|
-
private stream;
|
|
6
11
|
private writer;
|
|
7
|
-
private reader;
|
|
8
12
|
private readonly url;
|
|
9
13
|
private readonly options;
|
|
10
14
|
private readonly compression;
|
|
11
|
-
private closeRequested;
|
|
12
|
-
private closeEventEmitted;
|
|
13
15
|
private encoder;
|
|
14
16
|
private decoder;
|
|
15
17
|
private readonly _debug;
|
|
16
|
-
onopen: ((this: WebTransportEventual, ev: Event) => any) | null;
|
|
17
|
-
onmessage: ((this: WebTransportEventual, ev: MessageEvent) => any) | null;
|
|
18
|
-
onerror: ((this: WebTransportEventual, ev: Event) => any) | null;
|
|
19
|
-
onclose: ((this: WebTransportEventual, ev: CloseEvent) => any) | null;
|
|
20
|
-
readyState: number;
|
|
21
18
|
constructor(url: string, options?: WebTransportOptions, debug?: DebugLogger);
|
|
19
|
+
send(data: string): Promise<void>;
|
|
20
|
+
close(code?: number, reason?: string): void;
|
|
22
21
|
private getCompressionTypeFromUrl;
|
|
23
22
|
private connect;
|
|
24
|
-
private
|
|
23
|
+
private observeClosed;
|
|
25
24
|
private readLoop;
|
|
26
|
-
|
|
25
|
+
private fail;
|
|
26
|
+
private handleStreamError;
|
|
27
|
+
private requestNativeClose;
|
|
28
|
+
private finishClose;
|
|
29
|
+
private emitEvent;
|
|
27
30
|
private createErrorEvent;
|
|
28
|
-
close(code?: number, reason?: string): void;
|
|
29
|
-
private closeConnectedTransport;
|
|
30
|
-
private emitClose;
|
|
31
|
-
static isBrowserSupported(): boolean;
|
|
32
31
|
}
|
|
33
32
|
export { WebTransportEventual as WebTransport };
|