@vkontakte/calls-sdk 2.8.12-dev.26c45af4.0 → 2.8.12-dev.2e0e572e.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 +31 -7
- package/abstract/BaseApi.d.ts +10 -10
- package/abstract/BaseSignaling.d.ts +6 -5
- package/calls-sdk.cjs.js +10 -10
- package/calls-sdk.esm.js +3318 -2383
- package/classes/CallRegistry.d.ts +5 -1
- package/classes/ExternalIdCache.d.ts +11 -12
- package/classes/MediaSource.d.ts +4 -0
- package/classes/StatsLogger.d.ts +17 -2
- package/classes/{Conversation.d.ts → conversation/Conversation.d.ts} +57 -48
- package/classes/conversation/Conversation.testUtils.d.ts +150 -0
- package/classes/{ConversationResponseValidator.d.ts → conversation/ConversationResponseValidator.d.ts} +1 -1
- package/classes/{DisplayLayoutRequester.d.ts → conversation/DisplayLayoutRequester.d.ts} +7 -5
- package/classes/conversation/index.d.ts +1 -0
- package/classes/stat/CallFinishClassifier.d.ts +11 -0
- package/classes/stat/CallLifecycleStats.d.ts +42 -0
- package/classes/stat/ConversationStats.d.ts +5 -4
- package/classes/stat/FirstMediaSentProbe.d.ts +13 -0
- package/classes/stat/StatAggregator.d.ts +4 -0
- package/classes/stat/StatPings.d.ts +1 -2
- package/classes/stat/StatSignalingCommands.d.ts +1 -2
- package/classes/transport/BaseTransport.d.ts +7 -1
- package/classes/transport/DirectTransport.d.ts +2 -1
- package/classes/transport/ServerTransport.d.ts +2 -1
- package/classes/transport/Transport.d.ts +9 -1
- package/default/Api.d.ts +12 -12
- package/default/ApiExternal.d.ts +2 -1
- package/default/Signaling.d.ts +12 -15
- package/default/SignalingTransport.d.ts +10 -2
- package/enums/ClientHangupReason.d.ts +7 -0
- package/enums/HangupType.d.ts +0 -1
- package/enums/Stat.d.ts +5 -1
- package/package.json +3 -3
- package/static/ApiTransport.d.ts +3 -0
- package/static/AuthData.d.ts +10 -0
- package/static/Debug.d.ts +1 -0
- package/static/External.d.ts +11 -1
- package/static/Params.d.ts +35 -11
- package/static/Utils.d.ts +1 -1
- package/static/WebRTCUtils.d.ts +8 -7
- package/types/Api.d.ts +9 -0
- package/types/Conversation.d.ts +12 -2
- package/types/FastHangup.d.ts +66 -0
- package/types/SignalingMessage.d.ts +5 -1
- package/types/WebTransport.d.ts +17 -16
- package/utils/IceServers.d.ts +2 -0
- package/utils/NavigatorPermissions.d.ts +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Conversation from './
|
|
1
|
+
import type Conversation from './conversation';
|
|
2
2
|
import MediaSettings from '../types/MediaSettings';
|
|
3
3
|
export interface HoldableConversation extends Conversation {
|
|
4
4
|
id: string;
|
|
@@ -6,8 +6,11 @@ export interface HoldableConversation extends Conversation {
|
|
|
6
6
|
}
|
|
7
7
|
export declare class CallRegistry {
|
|
8
8
|
private _conversations;
|
|
9
|
+
private _reserved;
|
|
9
10
|
private _activeId;
|
|
10
11
|
private _mutex;
|
|
12
|
+
private _pendingRemovals;
|
|
13
|
+
reserve(id: string): void;
|
|
11
14
|
add(conversation: HoldableConversation): void;
|
|
12
15
|
remove(id: string | null): void;
|
|
13
16
|
get(id: string): HoldableConversation | undefined;
|
|
@@ -21,6 +24,7 @@ export declare class CallRegistry {
|
|
|
21
24
|
setHold(id: string): Promise<void>;
|
|
22
25
|
switchCall(id: string): Promise<void>;
|
|
23
26
|
clear(): void;
|
|
27
|
+
private _flushPendingRemovals;
|
|
24
28
|
}
|
|
25
29
|
declare const callRegistry: CallRegistry;
|
|
26
30
|
export { callRegistry };
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import { ExternalId, ExternalParticipantId } from '../types/ExternalId';
|
|
2
|
-
import {
|
|
2
|
+
import { ParticipantId } from '../types/Participant';
|
|
3
3
|
export declare class ExternalIdCache {
|
|
4
|
-
private
|
|
5
|
-
private
|
|
4
|
+
private static _normalizeType;
|
|
5
|
+
private _participantIdToExternalId;
|
|
6
|
+
private _externalIdToParticipantId;
|
|
6
7
|
private _decorativeIdToInitialId;
|
|
7
8
|
private _initialIdToDecorativeId;
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
getExternalId(participantId: ParticipantId): ExternalParticipantId | null;
|
|
10
|
+
getParticipantId(externalId: ExternalId): ParticipantId | null;
|
|
10
11
|
hasByExternalId(externalId: ExternalId): boolean;
|
|
11
|
-
|
|
12
|
-
cache(participantId:
|
|
13
|
-
mapDecorativeId(decorativeId:
|
|
14
|
-
unmapDecorativeId(initialId:
|
|
15
|
-
getDecorativeIdByInitialId(initialId:
|
|
16
|
-
replaceByInitialIdIdIfExists(id: OkUserId | CompositeUserId | ParticipantId): OkUserId;
|
|
17
|
-
getParticipantIdByExternalId(externalId: ExternalId): ParticipantId | null;
|
|
12
|
+
hasByParticipantId(participantId: ParticipantId): boolean;
|
|
13
|
+
cache(participantId: ParticipantId, externalId: ExternalParticipantId): void;
|
|
14
|
+
mapDecorativeId(decorativeId: ParticipantId, initialId: ParticipantId): void;
|
|
15
|
+
unmapDecorativeId(initialId: ParticipantId): void;
|
|
16
|
+
getDecorativeIdByInitialId(initialId: ParticipantId): ParticipantId | undefined;
|
|
18
17
|
clear(): void;
|
|
19
18
|
}
|
package/classes/MediaSource.d.ts
CHANGED
|
@@ -58,6 +58,8 @@ export declare class MediaSource extends EventEmitter {
|
|
|
58
58
|
private readonly _videoEffectsFpsLimiter?;
|
|
59
59
|
private readonly _debug;
|
|
60
60
|
private readonly _logger;
|
|
61
|
+
private _cameraTrackSetAt;
|
|
62
|
+
private _cameraMuteRecoveredAt;
|
|
61
63
|
constructor(debug?: DebugLogger, logger?: StatsLogger | null);
|
|
62
64
|
get cameraVideoTrack(): MediaStreamTrack | null;
|
|
63
65
|
set cameraVideoTrack(track: MediaStreamTrack | null);
|
|
@@ -97,6 +99,8 @@ export declare class MediaSource extends EventEmitter {
|
|
|
97
99
|
protected getSilentAudioShareTrack(): MediaStreamTrack;
|
|
98
100
|
protected getBlackScreenShareTrack(): MediaStreamTrack;
|
|
99
101
|
protected _replaceLocalTrack(newTrack: MediaStreamTrack, sendTrack?: MediaStreamTrack): Promise<void>;
|
|
102
|
+
protected _replaceTrack(oldTrack: MediaStreamTrack, newTrack: MediaStreamTrack, sendTrack?: MediaStreamTrack): Promise<void>;
|
|
103
|
+
protected _addLocalTrack(newTrack: MediaStreamTrack, sendTrack?: MediaStreamTrack): Promise<void>;
|
|
100
104
|
private _setEffect;
|
|
101
105
|
private _stopEffect;
|
|
102
106
|
destroy(): void;
|
package/classes/StatsLogger.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import BaseApi from '../abstract/BaseApi';
|
|
2
2
|
import BaseLogger from '../abstract/BaseLogger';
|
|
3
3
|
import StatLog from '../enums/StatLog';
|
|
4
|
+
import TransportTopology from '../enums/TransportTopology';
|
|
5
|
+
type ClientStatsPayload = Record<string, string | number | boolean | undefined | null>;
|
|
6
|
+
export type LogClientStatsOptions = {
|
|
7
|
+
immediately?: boolean;
|
|
8
|
+
occurredAt?: number;
|
|
9
|
+
conversationId?: string | null;
|
|
10
|
+
deferUntilServerTime?: boolean;
|
|
11
|
+
};
|
|
4
12
|
/**
|
|
5
13
|
* Класс отвечает за отправку различной информации в сервис статистики (события, статистика и подобное)
|
|
6
14
|
*/
|
|
@@ -8,19 +16,26 @@ export default class StatsLogger extends BaseLogger {
|
|
|
8
16
|
private readonly _externalLogger;
|
|
9
17
|
private readonly _api;
|
|
10
18
|
private readonly _conversationIdProvider;
|
|
19
|
+
private readonly _topologyProvider;
|
|
11
20
|
private readonly _batchInterval;
|
|
12
21
|
private _batchedClientStats;
|
|
13
22
|
private _batchTimeout;
|
|
14
23
|
private _serverTimeDelta;
|
|
15
|
-
|
|
24
|
+
private _waitingForServerTime;
|
|
25
|
+
private _deferredClientStats;
|
|
26
|
+
constructor(api: BaseApi, externalLogger: BaseLogger | null, conversationIdProvider: () => string | null, topologyProvider?: () => TransportTopology | undefined);
|
|
16
27
|
log(name: StatLog, value?: string, immediately?: boolean): void;
|
|
17
|
-
logClientStats(data:
|
|
28
|
+
logClientStats(data: ClientStatsPayload, immediatelyOrOptions?: boolean | LogClientStatsOptions): void;
|
|
18
29
|
destroy(): void;
|
|
30
|
+
private _logClientStats;
|
|
19
31
|
private _getConversationId;
|
|
32
|
+
private _getCallTopology;
|
|
20
33
|
private _sendBatch;
|
|
21
34
|
private _startTimeout;
|
|
22
35
|
private _stopTimeout;
|
|
23
36
|
private _sendClientStats;
|
|
24
37
|
private _calculateServerTimeDelta;
|
|
38
|
+
private _flushDeferredClientStats;
|
|
25
39
|
private _now;
|
|
26
40
|
}
|
|
41
|
+
export {};
|
|
@@ -1,33 +1,34 @@
|
|
|
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 {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import {
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import {
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
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 type { FastHangupHandler, HangupParams } from '../../types/FastHangup';
|
|
19
|
+
import MediaModifiers from '../../types/MediaModifiers';
|
|
20
|
+
import MediaSettings, { IVideoDimentions } from '../../types/MediaSettings';
|
|
21
|
+
import { IAddMovieParams, IUpdateMovieData } from '../../types/MovieShare';
|
|
22
|
+
import MuteStates from '../../types/MuteStates';
|
|
23
|
+
import { CompositeUserId, IGetParticipantsParameters, ParticipantId, ParticipantStateData } from '../../types/Participant';
|
|
24
|
+
import { DisplayLayoutRequest, ParticipantLayout } from '../../types/ParticipantLayout';
|
|
25
|
+
import { ParticipantListChunkParameters } from '../../types/ParticipantListChunk';
|
|
26
|
+
import ParticipantPriority from '../../types/ParticipantPriority';
|
|
27
|
+
import { ParticipantStreamDescription } from '../../types/ParticipantStreamDescription';
|
|
28
|
+
import { ScreenCaptureSettings } from '../../types/ScreenCaptureSettings';
|
|
29
|
+
import SignalingMessage from '../../types/SignalingMessage';
|
|
30
|
+
import { WaitingHallResponse } from '../../types/WaitingHall';
|
|
31
|
+
import EventEmitter from '../EventEmitter';
|
|
31
32
|
export default class Conversation extends EventEmitter {
|
|
32
33
|
private readonly _api;
|
|
33
34
|
private readonly _signaling;
|
|
@@ -42,7 +43,6 @@ export default class Conversation extends EventEmitter {
|
|
|
42
43
|
private _waitingHallHoldPending;
|
|
43
44
|
private _participantState;
|
|
44
45
|
private _participants;
|
|
45
|
-
private _pendingParticipants;
|
|
46
46
|
private _directTransportIsMaster?;
|
|
47
47
|
private _transport;
|
|
48
48
|
private _debugInfo;
|
|
@@ -57,9 +57,13 @@ export default class Conversation extends EventEmitter {
|
|
|
57
57
|
private _serverSettings;
|
|
58
58
|
private _serverTimeOffset;
|
|
59
59
|
private _delayedHangup;
|
|
60
|
+
private _onFastHangup?;
|
|
61
|
+
private _hangupEmitted;
|
|
62
|
+
private _hangupPromise;
|
|
60
63
|
private _abortController;
|
|
61
64
|
private _registeredPeerReceived;
|
|
62
65
|
private _calleeUnavailableTimer;
|
|
66
|
+
private _reservedId;
|
|
63
67
|
private readonly _onUnload;
|
|
64
68
|
private readonly _audioOutput;
|
|
65
69
|
private readonly _stats;
|
|
@@ -75,29 +79,26 @@ export default class Conversation extends EventEmitter {
|
|
|
75
79
|
private readonly _statFirstMediaReceived;
|
|
76
80
|
constructor(api: BaseApi, externalLogger: BaseLogger | null);
|
|
77
81
|
static current(): Conversation | null;
|
|
78
|
-
static hangupAfterInit(): void;
|
|
82
|
+
static hangupAfterInit(onFastHangup?: FastHangupHandler): void;
|
|
79
83
|
static id(): string | null;
|
|
80
84
|
get id(): string;
|
|
81
85
|
get externalId(): ExternalParticipantId | undefined;
|
|
82
86
|
get mediaSettings(): MediaSettings | undefined;
|
|
83
87
|
get isCallHeld(): boolean;
|
|
84
88
|
static debugSessionId(): string | null;
|
|
89
|
+
static debugMessage(type: DebugMessageType, ...args: any[]): boolean;
|
|
90
|
+
static debugMessageWithContext(type: DebugMessageType, conversationId: string, ...args: any[]): boolean;
|
|
85
91
|
static getSyncedTime(): number;
|
|
86
92
|
get debugSessionId(): string | null;
|
|
93
|
+
getCachedParticipantIdByExternalId(externalId: ExternalId): ParticipantId | null;
|
|
94
|
+
private _onNonFatalError;
|
|
95
|
+
private _buildInternalParams;
|
|
87
96
|
onStart({ opponentIds, opponentType, mediaOptions, payload, joiningAllowed, requireAuthToJoin, onlyAdminCanShareMovie, externalIds, onFastStart, conversationId, }: ConversationOnStartParams): Promise<ConversationData>;
|
|
88
|
-
onJoin(joinArgs:
|
|
89
|
-
conversationId?: string;
|
|
90
|
-
mediaOptions: MediaOption[];
|
|
91
|
-
chatId?: string;
|
|
92
|
-
joinLink?: string;
|
|
93
|
-
observedIds?: ExternalUserId[];
|
|
94
|
-
payload?: string;
|
|
95
|
-
onFastJoin?: FastJoinHandler;
|
|
96
|
-
}): Promise<ConversationData>;
|
|
97
|
+
onJoin(joinArgs: ConversationOnJoinParams): Promise<ConversationData>;
|
|
97
98
|
private _onJoinPart2;
|
|
98
99
|
private _extractExternalRooms;
|
|
99
100
|
private _extractExternalRoomsData;
|
|
100
|
-
onPush(conversationId: string, type?: UserType, peerId?: number, conversationParams?: string, wsEndpoint?: string): Promise<void>;
|
|
101
|
+
onPush(conversationId: string, type?: UserType, peerId?: number, conversationParams?: string, wsEndpoint?: string, userId?: number): Promise<void>;
|
|
101
102
|
private _isInWaitingHall;
|
|
102
103
|
private _isWaitForAdmin;
|
|
103
104
|
private _isRestricted;
|
|
@@ -106,10 +107,9 @@ export default class Conversation extends EventEmitter {
|
|
|
106
107
|
private _acceptConcurrent;
|
|
107
108
|
private _getMainRoomParticipants;
|
|
108
109
|
private _decodeExternalConversationParams;
|
|
109
|
-
private _logCallStartEvent;
|
|
110
110
|
accept(mediaOptions: MediaOption[]): Promise<ConversationData>;
|
|
111
|
-
decline(): Promise<void>;
|
|
112
|
-
hangup(): Promise<void>;
|
|
111
|
+
decline(params?: HangupParams): Promise<void>;
|
|
112
|
+
hangup(params?: HangupParams): Promise<void>;
|
|
113
113
|
addParticipant(participantIds: ExternalId[], params?: AddParticipantParams): Promise<void>;
|
|
114
114
|
addParticipantLegacy(participantIds: CompositeUserId[], params?: AddParticipantParams): Promise<void>;
|
|
115
115
|
removeParticipant(participantId: CompositeUserId, ban?: boolean): Promise<void>;
|
|
@@ -117,8 +117,14 @@ export default class Conversation extends EventEmitter {
|
|
|
117
117
|
updateStatisticsInterval(): void;
|
|
118
118
|
private _openTransport;
|
|
119
119
|
private _allocateParticipantTransport;
|
|
120
|
+
private _closeParticipantTransport;
|
|
121
|
+
private _cleanupRegistry;
|
|
122
|
+
private _emitHangupOnce;
|
|
123
|
+
private _sendHangupApi;
|
|
120
124
|
private _close;
|
|
125
|
+
private _sendHangup;
|
|
121
126
|
destroy(): void;
|
|
127
|
+
private _destroy;
|
|
122
128
|
private _getConversationParams;
|
|
123
129
|
private _setConversationParams;
|
|
124
130
|
private _buildSignalingEndpoint;
|
|
@@ -159,8 +165,9 @@ export default class Conversation extends EventEmitter {
|
|
|
159
165
|
private _registerParticipantInCache;
|
|
160
166
|
private _getExistedParticipantByIdOrCreate;
|
|
161
167
|
private _getExternalIdByParticipantId;
|
|
162
|
-
private
|
|
163
|
-
private
|
|
168
|
+
private _getExternalIdsByParticipantIds;
|
|
169
|
+
private _reportMissingExternalIds;
|
|
170
|
+
private _reportMissingExternalIdsById;
|
|
164
171
|
private _registerParticipantAndSetMarkersIfChunkEnabled;
|
|
165
172
|
private _warnParticipantNotInConversation;
|
|
166
173
|
private _denormalizeMarkers;
|
|
@@ -197,10 +204,13 @@ export default class Conversation extends EventEmitter {
|
|
|
197
204
|
private _cleanupParticipants;
|
|
198
205
|
private _cleanupParticipantAgnosticStreams;
|
|
199
206
|
private _cleanupTransport;
|
|
207
|
+
private _finishLifecycle;
|
|
208
|
+
private _getFirstMediaSentCallback;
|
|
209
|
+
private _stopFirstMediaSentProbe;
|
|
200
210
|
private _cleanupTransportForHold;
|
|
201
211
|
private _cleanupSpeakerDetector;
|
|
202
212
|
private _cleanupSpecListener;
|
|
203
|
-
private
|
|
213
|
+
private _disposeSignaling;
|
|
204
214
|
private _onAddParticipant;
|
|
205
215
|
private _onRemoveParticipant;
|
|
206
216
|
changeDevice(kind: MediaDeviceKind): Promise<void>;
|
|
@@ -233,7 +243,7 @@ export default class Conversation extends EventEmitter {
|
|
|
233
243
|
private _getWaitingForPromotionStatus;
|
|
234
244
|
putHandsDown(): Promise<void>;
|
|
235
245
|
requestKeyFrame(participantStreamDescription: ParticipantStreamDescription): Promise<void | SignalingMessage>;
|
|
236
|
-
requestTestMode(consumerCommand: string, producerCommand: string): Promise<void>;
|
|
246
|
+
requestTestMode(consumerCommand: string, producerCommand: string): Promise<void | SignalingMessage>;
|
|
237
247
|
updateDisplayLayout(layouts: ParticipantLayout[]): Promise<void>;
|
|
238
248
|
requestDisplayLayout(requests: DisplayLayoutRequest[]): Promise<void>;
|
|
239
249
|
feedback(key: string): Promise<SignalingMessage>;
|
|
@@ -437,7 +447,6 @@ export default class Conversation extends EventEmitter {
|
|
|
437
447
|
private _setMuteStatesForRoomId;
|
|
438
448
|
private _forceOpenTransportForAloneInCall;
|
|
439
449
|
private _registerParticipant;
|
|
440
|
-
private _getParticipants;
|
|
441
450
|
private _getParticipant;
|
|
442
451
|
}
|
|
443
452
|
declare function _resetPendingInstance(): void;
|
|
@@ -0,0 +1,150 @@
|
|
|
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
|
+
onAcceptedCall: Mock<import("@vitest/spy").Procedure>;
|
|
39
|
+
onNonFatalError: Mock<import("@vitest/spy").Procedure>;
|
|
40
|
+
};
|
|
41
|
+
export type ConversationTestParams = ReturnType<typeof createParams>;
|
|
42
|
+
export type ConversationTestTools = {
|
|
43
|
+
readonly endpointURL: string;
|
|
44
|
+
readonly fetchMocker: FetchMock;
|
|
45
|
+
readonly params: ConversationTestParams;
|
|
46
|
+
readonly server: Server;
|
|
47
|
+
readonly wsBaseURL: string;
|
|
48
|
+
createConnectionMessage(data?: Partial<SignalingMessage.Connection>): SignalingMessage.Connection;
|
|
49
|
+
createConversation(options?: {
|
|
50
|
+
api?: Api;
|
|
51
|
+
}): Conversation;
|
|
52
|
+
createExternalIdMock(id: string, data?: Partial<ExternalParticipantId>): ExternalParticipantId;
|
|
53
|
+
createMarkers(data?: Partial<ParticipantListMarkers>): ParticipantListMarkers;
|
|
54
|
+
createMovieShareInfo(initiatorId: string, data?: Partial<ISharedMovieInfo> | null): ISharedMovieInfo;
|
|
55
|
+
createParticipant(id: number, data?: Partial<SignalingMessage.Participant>): SignalingMessage.Participant & Required<Pick<SignalingMessage.Participant, 'markers'>>;
|
|
56
|
+
createParticipantWithMarkers(id: number, data?: Partial<SignalingMessage.Participant>): SignalingMessage.Participant & Required<Pick<SignalingMessage.Participant, 'markers'>>;
|
|
57
|
+
createPromoteParticipantMessage(): SignalingMessage.PromoteParticipant;
|
|
58
|
+
createSignallingConversation(okUserId: OkUserId, peerId: SignalingMessage.PeerId, data?: Partial<SignalingMessage.Conversation>): SignalingMessage.Conversation;
|
|
59
|
+
createWaitingHallConversationData(): ReturnType<typeof createWaitingHallConversationData>;
|
|
60
|
+
emitMessageOnConnection(wsServer: Server, message?: SignalingMessage.Connection): void;
|
|
61
|
+
enableParticipantListChunk(): void;
|
|
62
|
+
expectRemoteStatus(status: ParticipantStatus, participantId?: string): Promise<void>;
|
|
63
|
+
expectRemoteStatusCall(status: ParticipantStatus, participantId?: string): void;
|
|
64
|
+
forgetConversation(conversation: Conversation): void;
|
|
65
|
+
getActiveSocket(wsServer: Server): Client;
|
|
66
|
+
hasRemoteStatusCall(status: ParticipantStatus, participantId?: string): boolean;
|
|
67
|
+
isCapabilityEnabled(predicateIndex: number, wsServer: Server): boolean;
|
|
68
|
+
parseUrlSearch(search: string): Record<string, string>;
|
|
69
|
+
resetRemoteStatusCallbacks(): void;
|
|
70
|
+
respondOnGetParticipantListChunkWith(data: Partial<SignalingMessage.ParticipantListChunk>): void;
|
|
71
|
+
sendAcceptedCall(participant: SignalingMessage.Participant): void;
|
|
72
|
+
sendHungup(participant: SignalingMessage.Participant): void;
|
|
73
|
+
sendSessionState(participant: SignalingMessage.Participant | number, connected: boolean, data?: Partial<SignalingMessage.SessionState>): void;
|
|
74
|
+
setApiAuth(data?: {
|
|
75
|
+
sessionKey?: string;
|
|
76
|
+
sessionSecretKey?: string;
|
|
77
|
+
}): void;
|
|
78
|
+
setTransportState(conversation: Conversation, state: TransportState): void;
|
|
79
|
+
socketRespondWith(socket: Client, command: string, response: SignalingMessage): void;
|
|
80
|
+
socketSendNotification(socket: Client, notification: string, response?: SignalingMessage): void;
|
|
81
|
+
startConversation(message?: SignalingMessage.Connection): Promise<Conversation>;
|
|
82
|
+
startConversationWithParticipants(participants: SignalingMessage.Participant[], peerId?: SignalingMessage.PeerId): Promise<Conversation>;
|
|
83
|
+
startConversationWithRemoteParticipant(remoteParticipantData?: Partial<SignalingMessage.Participant>): Promise<{
|
|
84
|
+
conversation: Conversation;
|
|
85
|
+
meParticipant: SignalingMessage.Participant;
|
|
86
|
+
remoteParticipant: SignalingMessage.Participant;
|
|
87
|
+
}>;
|
|
88
|
+
stubApiRequest(endpoint: string, method: string, data: object): void;
|
|
89
|
+
waitFor(fn: () => Promise<boolean> | boolean, message?: string, timeout?: number): Promise<true>;
|
|
90
|
+
flushSdkCallbacks(): Promise<null>;
|
|
91
|
+
};
|
|
92
|
+
export declare function defineConversationTests(name: string, defineTests: (tools: ConversationTestTools) => void): void;
|
|
93
|
+
export declare function createExternalIdMock(id: string, data?: Partial<ExternalParticipantId>): ExternalParticipantId;
|
|
94
|
+
export declare function enableParticipantListChunk(): void;
|
|
95
|
+
export declare function setApiAuth(data?: {
|
|
96
|
+
sessionKey?: string;
|
|
97
|
+
sessionSecretKey?: string;
|
|
98
|
+
}): void;
|
|
99
|
+
export declare function setTransportState(conversation: Conversation, state: TransportState): void;
|
|
100
|
+
export declare function socketRespondWith(socket: Client, command: string, response: SignalingMessage): void;
|
|
101
|
+
export declare function socketSendNotification(socket: Client, notification: string, response?: SignalingMessage): void;
|
|
102
|
+
export declare function createWaitingHallConversationData(): {
|
|
103
|
+
acceptTime: null;
|
|
104
|
+
asrInfo: null;
|
|
105
|
+
asrInfoByRoom: Map<any, any>;
|
|
106
|
+
audienceMode: boolean;
|
|
107
|
+
chatId: null;
|
|
108
|
+
compositeUserId: string;
|
|
109
|
+
concurrent: boolean;
|
|
110
|
+
direction: CallDirection;
|
|
111
|
+
externalId: ExternalParticipantId;
|
|
112
|
+
features: never[];
|
|
113
|
+
featuresPerRole: null;
|
|
114
|
+
id: string;
|
|
115
|
+
mediaModifiers: {
|
|
116
|
+
denoise: boolean;
|
|
117
|
+
denoiseAnn: boolean;
|
|
118
|
+
};
|
|
119
|
+
muteStates: Map<any, any>;
|
|
120
|
+
muteStatesPersonal: {};
|
|
121
|
+
needRate: boolean;
|
|
122
|
+
networkRating: number;
|
|
123
|
+
observer: boolean;
|
|
124
|
+
options: ConversationOption[];
|
|
125
|
+
participantsLimit: number;
|
|
126
|
+
pinnedParticipantIdByRoom: Map<any, any>;
|
|
127
|
+
recordsInfoByRoom: Map<any, any>;
|
|
128
|
+
restricted: boolean;
|
|
129
|
+
roles: never[];
|
|
130
|
+
roomId: number | null;
|
|
131
|
+
topology: TransportTopology;
|
|
132
|
+
urlSharingInfoByRoom: Map<any, any>;
|
|
133
|
+
userId: number;
|
|
134
|
+
waitForAdmin: boolean;
|
|
135
|
+
waitingHall: boolean;
|
|
136
|
+
};
|
|
137
|
+
export declare function createPromoteParticipantMessage(): SignalingMessage.PromoteParticipant;
|
|
138
|
+
export declare function emitMessageOnConnection(wsServer: Server, message?: SignalingMessage.Connection): void;
|
|
139
|
+
export declare function getActiveSocket(wsServer: Server): Client;
|
|
140
|
+
export declare function isCapabilityEnabled(predicateIndex: number, wsServer: Server): boolean;
|
|
141
|
+
export declare function parseUrlSearch(search: string): Record<string, string>;
|
|
142
|
+
export declare function flushSdkCallbacks(): Promise<null>;
|
|
143
|
+
export declare function waitFor(fn: () => Promise<boolean> | boolean, message?: string, timeout?: number): Promise<true>;
|
|
144
|
+
export declare function createSignallingConversation(okUserId: OkUserId, peerId: SignalingMessage.PeerId, data?: Partial<SignalingMessage.Conversation>): SignalingMessage.Conversation;
|
|
145
|
+
export declare function createConnectionMessage(data?: Partial<SignalingMessage.Connection>): SignalingMessage.Connection;
|
|
146
|
+
export declare function createParticipant(id: number, data?: Partial<SignalingMessage.Participant>): SignalingMessage.Participant & Required<Pick<SignalingMessage.Participant, 'markers'>>;
|
|
147
|
+
export declare function createParticipantWithMarkers(id: number, data?: Partial<SignalingMessage.Participant>): SignalingMessage.Participant & Required<Pick<SignalingMessage.Participant, 'markers'>>;
|
|
148
|
+
export declare function createMarkers(data?: Partial<ParticipantListMarkers>): ParticipantListMarkers;
|
|
149
|
+
export declare function createMovieShareInfo(initiatorId: string, data?: Partial<ISharedMovieInfo> | null): ISharedMovieInfo;
|
|
150
|
+
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,13 +1,14 @@
|
|
|
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
8
|
getParticipants: () => Record<ParticipantId, Participant>;
|
|
9
9
|
isMe: (participantId: ParticipantId) => boolean;
|
|
10
10
|
updateDisplayLayout: (layouts: ParticipantLayout[]) => Promise<void>;
|
|
11
|
+
onNonFatalError: (message: string) => void;
|
|
11
12
|
};
|
|
12
13
|
export default class DisplayLayoutRequester {
|
|
13
14
|
private readonly _api;
|
|
@@ -15,6 +16,7 @@ export default class DisplayLayoutRequester {
|
|
|
15
16
|
private readonly _getParticipants;
|
|
16
17
|
private readonly _isMe;
|
|
17
18
|
private readonly _updateDisplayLayout;
|
|
19
|
+
private readonly _onNonFatalError;
|
|
18
20
|
private _requestedLayouts;
|
|
19
21
|
private _uncertainLayouts;
|
|
20
22
|
private _pendingRequests;
|
|
@@ -25,7 +27,7 @@ export default class DisplayLayoutRequester {
|
|
|
25
27
|
private _lastFlushAt;
|
|
26
28
|
private _generation;
|
|
27
29
|
private _forceNextFlush;
|
|
28
|
-
constructor({ api, debug, getParticipants, isMe, updateDisplayLayout }: DisplayLayoutRequesterParams);
|
|
30
|
+
constructor({ api, debug, getParticipants, isMe, updateDisplayLayout, onNonFatalError }: DisplayLayoutRequesterParams);
|
|
29
31
|
request(requests: DisplayLayoutRequest[]): Promise<void>;
|
|
30
32
|
resend(): void;
|
|
31
33
|
cleanupParticipant(participantId: ParticipantId): void;
|
|
@@ -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;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import StatsLogger from '../StatsLogger';
|
|
2
|
+
export type CallLifecycleSource = 'outgoing' | 'incoming' | 'join' | 'anonym_join';
|
|
3
|
+
export interface CallLifecycleInitializationParams {
|
|
4
|
+
source: CallLifecycleSource;
|
|
5
|
+
conversationId?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface CallLifecycleClock {
|
|
8
|
+
wallNow(): number;
|
|
9
|
+
monotonicNow(): number;
|
|
10
|
+
}
|
|
11
|
+
export declare class CallLifecycleStats {
|
|
12
|
+
private readonly _logger;
|
|
13
|
+
private readonly _clock;
|
|
14
|
+
private _conversationId;
|
|
15
|
+
private _callStartLabel;
|
|
16
|
+
private _lifecycleStartedAtMonotonic;
|
|
17
|
+
private _pendingEvents;
|
|
18
|
+
private _callStarted;
|
|
19
|
+
private _accepted;
|
|
20
|
+
private _firstMediaSent;
|
|
21
|
+
private _finished;
|
|
22
|
+
private _destroyed;
|
|
23
|
+
constructor(logger: StatsLogger, clock?: CallLifecycleClock);
|
|
24
|
+
get firstMediaSentReported(): boolean;
|
|
25
|
+
get terminated(): boolean;
|
|
26
|
+
markInitializationStarted({ source, conversationId }: CallLifecycleInitializationParams): void;
|
|
27
|
+
bindConversationId(conversationId: string): void;
|
|
28
|
+
markCallStarted(): void;
|
|
29
|
+
markOutgoingAccepted(): void;
|
|
30
|
+
markIncomingAccepted(concurrent: boolean): void;
|
|
31
|
+
markFirstMediaSent(): void;
|
|
32
|
+
markFinished(reason: unknown): void;
|
|
33
|
+
markTerminated(): void;
|
|
34
|
+
destroy(): void;
|
|
35
|
+
private _canRecord;
|
|
36
|
+
private _durationSince;
|
|
37
|
+
private _finish;
|
|
38
|
+
private _ensureConversationId;
|
|
39
|
+
private _record;
|
|
40
|
+
private _flushPendingEvents;
|
|
41
|
+
private _logEvent;
|
|
42
|
+
}
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import BaseApi from '../../abstract/BaseApi';
|
|
2
2
|
import BaseLogger from '../../abstract/BaseLogger';
|
|
3
|
+
import TransportTopology from '../../enums/TransportTopology';
|
|
3
4
|
import HangupReason from '../HangupReason';
|
|
4
5
|
import StatsLogger from '../StatsLogger';
|
|
5
|
-
import
|
|
6
|
+
import { CallLifecycleStats } from './CallLifecycleStats';
|
|
6
7
|
import { CodecStatsAggregator } from './CodecStatsAggregator';
|
|
7
8
|
import { StatAggregator } from './StatAggregator';
|
|
8
9
|
import { StatPings } from './StatPings';
|
|
9
10
|
import { StatSignalingCommands } from './StatSignalingCommands';
|
|
10
11
|
export declare class ConversationStats {
|
|
11
12
|
readonly logger: StatsLogger;
|
|
13
|
+
readonly lifecycle: CallLifecycleStats;
|
|
12
14
|
readonly statAggregator: StatAggregator;
|
|
13
15
|
readonly codecStatsAggregator: CodecStatsAggregator;
|
|
14
16
|
readonly pings: StatPings;
|
|
15
17
|
readonly signalingCommands: StatSignalingCommands;
|
|
16
18
|
constructor(api: BaseApi, externalLogger: BaseLogger | null, getConversationId: () => string | null, getTopology: () => TransportTopology | undefined);
|
|
17
|
-
logHangup(reason: HangupReason
|
|
18
|
-
flushCallMetrics(
|
|
19
|
+
logHangup(reason: HangupReason): void;
|
|
20
|
+
flushCallMetrics(): void;
|
|
19
21
|
destroy(): void;
|
|
20
|
-
private static correctHangupReason;
|
|
21
22
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare class FirstMediaSentProbe {
|
|
2
|
+
private readonly _peerConnection;
|
|
3
|
+
private readonly _onFirstMediaSent;
|
|
4
|
+
private readonly _pollIntervalMs;
|
|
5
|
+
private _timer;
|
|
6
|
+
private _state;
|
|
7
|
+
constructor(peerConnection: RTCPeerConnection, onFirstMediaSent: () => void, pollIntervalMs?: number);
|
|
8
|
+
start(): void;
|
|
9
|
+
destroy(): void;
|
|
10
|
+
private _getStatsReports;
|
|
11
|
+
private _poll;
|
|
12
|
+
private _scheduleNextPoll;
|
|
13
|
+
}
|
|
@@ -4,9 +4,13 @@ import StatsLogger from '../StatsLogger';
|
|
|
4
4
|
export declare class StatAggregator {
|
|
5
5
|
private readonly _logger;
|
|
6
6
|
private readonly _eventualLogs;
|
|
7
|
+
private _lastCallStatContext;
|
|
7
8
|
constructor(logger: StatsLogger);
|
|
8
9
|
logCallStat(params: ICallStatLog): void;
|
|
9
10
|
/** @link https://wiki.odkl.ru/pages/viewpage.action?pageId=100892588 */
|
|
10
11
|
logEventualStat(params: IEventualStatLog): void;
|
|
11
12
|
destroy(): void;
|
|
13
|
+
private _getCallStatContext;
|
|
14
|
+
private _flushEventualStats;
|
|
15
|
+
private _logEventualStat;
|
|
12
16
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { SignalingTransportType } from '../../enums/SignalingTransportStat';
|
|
2
2
|
import StatsLogger from '../StatsLogger';
|
|
3
|
-
import TransportTopology from '../../enums/TransportTopology';
|
|
4
3
|
export declare class StatPings {
|
|
5
4
|
private readonly _logger;
|
|
6
5
|
private trackerByTransport;
|
|
@@ -12,6 +11,6 @@ export declare class StatPings {
|
|
|
12
11
|
*/
|
|
13
12
|
mark(transport: SignalingTransportType): void;
|
|
14
13
|
/** Отправляем данные в стату */
|
|
15
|
-
logMetrics(
|
|
14
|
+
logMetrics(): void;
|
|
16
15
|
destroy(): void;
|
|
17
16
|
}
|