@vkontakte/calls-sdk 2.8.6-dev.3c52c9a0.0 → 2.8.6-dev.40d6f2d9.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.
@@ -19,7 +19,7 @@ import MediaModifiers from '../types/MediaModifiers';
19
19
  import { IVideoDimentions } from '../types/MediaSettings';
20
20
  import { IAddMovieParams, IUpdateMovieData } from '../types/MovieShare';
21
21
  import MuteStates from '../types/MuteStates';
22
- import { CompositeUserId, IGetParticipantsParameters, OkUserId, ParticipantId } from '../types/Participant';
22
+ import { CompositeUserId, IGetParticipantsParameters, OkUserId, ParticipantId, ParticipantStateData } from '../types/Participant';
23
23
  import { ParticipantLayout } from '../types/ParticipantLayout';
24
24
  import { ParticipantListChunkParameters } from '../types/ParticipantListChunk';
25
25
  import ParticipantPriority from '../types/ParticipantPriority';
@@ -88,7 +88,8 @@ export default class Conversation extends EventEmitter {
88
88
  accept(mediaOptions: MediaOption[]): Promise<ConversationData>;
89
89
  decline(): Promise<void>;
90
90
  hangup(): Promise<void>;
91
- addParticipant(participantIds: CompositeUserId[], params?: AddParticipantParams): Promise<void>;
91
+ addParticipant(participantIds: ExternalId[], params?: AddParticipantParams): Promise<void>;
92
+ addParticipantLegacy(participantIds: CompositeUserId[], params?: AddParticipantParams): Promise<void>;
92
93
  removeParticipant(participantId: CompositeUserId, ban?: boolean): Promise<void>;
93
94
  setVolume(volume: number): void;
94
95
  updateStatisticsInterval(): void;
@@ -189,7 +190,7 @@ export default class Conversation extends EventEmitter {
189
190
  * @deprecated Use updateDisplayLayout instead
190
191
  */
191
192
  changePriorities(priorities: ParticipantPriority[]): Promise<void>;
192
- changeParticipantState(state: Record<string, string>, compositeUserId?: CompositeUserId): Promise<void>;
193
+ changeParticipantState(state: ParticipantStateData, compositeUserId?: CompositeUserId): Promise<void>;
193
194
  putHandsDown(): Promise<void>;
194
195
  requestKeyFrame(participantStreamDescription: ParticipantStreamDescription): Promise<void | SignalingMessage>;
195
196
  requestTestMode(consumerCommand: string, producerCommand: string): Promise<void>;
@@ -249,7 +250,7 @@ export default class Conversation extends EventEmitter {
249
250
  customData(data: JSONObject, participantId?: ParticipantId | null): Promise<void>;
250
251
  createJoinLink(): Promise<string>;
251
252
  removeJoinLink(): Promise<undefined>;
252
- addMovie({ movieId, gain, metadata }: IAddMovieParams): Promise<{
253
+ addMovie({ movieId, gain, metadata, lang }: IAddMovieParams): Promise<{
253
254
  movieId: number;
254
255
  streamType: string;
255
256
  }>;
@@ -5,6 +5,7 @@ import MediaSettings, { IVideoDimentions } from '../types/MediaSettings';
5
5
  import { ScreenCaptureSettings } from '../types/ScreenCaptureSettings';
6
6
  export declare const enum MediaSourceEvent {
7
7
  SOURCE_CHANGED = "SOURCE_CHANGED",
8
+ SOURCE_READY = "SOURCE_READY",
8
9
  TRACK_REPLACED = "TRACK_REPLACED",
9
10
  SCREEN_STATUS = "SCREEN_STATUS",
10
11
  ANIMOJI_STATUS = "ANIMOJI_STATUS"
@@ -0,0 +1,19 @@
1
+ import { StatItem } from '../../types/Statistics';
2
+ import { TransportTopology } from '../transport/Transport';
3
+ export type CodecKind = 'audio' | 'video';
4
+ /**
5
+ * Собирает стату по использованию кодеков в webrtc
6
+ * Каждый раз когда обновляется кодек или завершается звонок,
7
+ * отправляется репорт об использовании кодеков
8
+ */
9
+ export declare class CodecStatsAggregator {
10
+ private static _instance;
11
+ private readonly _codecUsages;
12
+ private getCurrentTransportTopology;
13
+ static create(getCurrentTransportTopology: () => TransportTopology | undefined): void;
14
+ static reportUsage(stat: StatItem): void;
15
+ private saveUsage;
16
+ private report;
17
+ static destroy(): void;
18
+ private _destroy;
19
+ }
@@ -0,0 +1,9 @@
1
+ import HangupReason from '../HangupReason';
2
+ import { TransportTopology } from '../transport/Transport';
3
+ /**
4
+ * Класс для работы с событийными метриками, обертка для правильной отправки событий
5
+ */
6
+ export declare class EventMetricsService {
7
+ private static correctHangupReason;
8
+ static sendHangupEvent(reason: HangupReason, topology?: TransportTopology): void;
9
+ }
@@ -1,11 +1,12 @@
1
- import { IApiEnv } from '../types/Params';
1
+ import { IAPIBaseUrl, IApiEnv } from '../types/Params';
2
2
  export declare class ApiExternal {
3
3
  private readonly _uuid;
4
4
  private readonly _apiKey;
5
5
  private readonly _callToken;
6
6
  private readonly _apiEnv;
7
+ private readonly _baseApiUrl;
7
8
  private _sessionKey;
8
- constructor(apiEvn: IApiEnv, apiKey: string, callToken: string);
9
+ constructor(apiEvn: IApiEnv, apiKey: string, callToken: string, baseApiUrl?: IAPIBaseUrl);
9
10
  authorize(): Promise<boolean>;
10
11
  hangupConversation(conversationId: string): Promise<void>;
11
12
  }
@@ -15,7 +15,7 @@ import MediaModifiers from '../types/MediaModifiers';
15
15
  import MediaSettings from '../types/MediaSettings';
16
16
  import { IAddMovieParams, IUpdateMovieData } from '../types/MovieShare';
17
17
  import MuteStates from '../types/MuteStates';
18
- import { CompositeUserId, ParticipantId } from '../types/Participant';
18
+ import { CompositeUserId, ParticipantId, ParticipantStateData } from '../types/Participant';
19
19
  import ParticipantLayout, { RequestKeyFrame, StopStream } from '../types/ParticipantLayout';
20
20
  import { ParticipantListChunkParameters } from '../types/ParticipantListChunk';
21
21
  import { StreamDescriptionString } from '../types/ParticipantStreamDescription';
@@ -33,6 +33,7 @@ export default class Signaling extends BaseSignaling {
33
33
  private responseHandlers;
34
34
  private reconnectCount;
35
35
  private endpoint;
36
+ private wtEndpoint;
36
37
  protected conversationResolve: Function | null;
37
38
  protected conversationReject: Function | null;
38
39
  private connected;
@@ -57,6 +58,7 @@ export default class Signaling extends BaseSignaling {
57
58
  private static _getCapabilityFlags;
58
59
  get ready(): boolean;
59
60
  setEndpoint(endpoint: string): void;
61
+ setWebTransportEndpoint(endpoint: string | null): void;
60
62
  setConversationId(conversationId: string): void;
61
63
  setParticipantIdRegistry(participantIdRegistry: ParticipantIdRegistry): void;
62
64
  setProducerNotificationDataChannel(dataChannel: RTCDataChannel): void;
@@ -86,9 +88,10 @@ export default class Signaling extends BaseSignaling {
86
88
  sendSdp(participantId: ParticipantId, sdp: RTCSessionDescriptionInit, extraPayload?: Record<string, any>): Promise<SignalingMessage>;
87
89
  acceptCall(mediaSettings: MediaSettings): Promise<SignalingMessage>;
88
90
  changeMediaSettings(mediaSettings: MediaSettings): Promise<SignalingMessage>;
89
- changeParticipantState(state: Record<string, string>, compositeUserId?: CompositeUserId): Promise<SignalingMessage>;
91
+ changeParticipantState(state: ParticipantStateData, compositeUserId?: CompositeUserId): Promise<SignalingMessage>;
90
92
  putHandsDown(): Promise<SignalingMessage>;
91
- addParticipant(participantIds: CompositeUserId[], params?: AddParticipantParams): Promise<SignalingMessage>;
93
+ addParticipant(externalIds: CompositeUserId[], params?: AddParticipantParams): Promise<SignalingMessage>;
94
+ addParticipantLegacy(participantIds: CompositeUserId[], params?: AddParticipantParams): Promise<SignalingMessage>;
92
95
  removeParticipant(participantId: CompositeUserId, ban?: boolean): Promise<SignalingMessage>;
93
96
  allocateConsumer(description: RTCSessionDescription | null, capabilities: {
94
97
  [key: string]: number | boolean | string;
@@ -160,7 +163,7 @@ export default class Signaling extends BaseSignaling {
160
163
  startAsr(params: IAsrStartParams): Promise<SignalingMessage>;
161
164
  stopAsr(params?: IAsrStopParams): Promise<SignalingMessage>;
162
165
  requestAsr(request: boolean): Promise<SignalingMessage>;
163
- protected _connect(connectionType: SignalingConnectionType): void;
166
+ protected _connect(connectionType: SignalingConnectionType, useWebTransport: boolean): void;
164
167
  protected _disconnect(code?: number): void;
165
168
  private _onOpen;
166
169
  private _onMessage;
package/enums/Stat.d.ts CHANGED
@@ -7,6 +7,7 @@ declare const enum Stat {
7
7
  ICE_RESTART = "callIceRestart",
8
8
  PUSH = "callPush",
9
9
  OUTGOING_CALL = "callStart",
10
+ CALL_FINISH = "call_finish",
10
11
  OUTGOING_MULTIPARTY_CALL = "callStartMultiparty",
11
12
  JOIN_CONVERSATION = "callJoinConversation",
12
13
  ACCEPTED_OUTGOING = "callAcceptedOutgoing",
@@ -14,6 +15,7 @@ declare const enum Stat {
14
15
  DECLINE_INCOMING = "callDeclineIncoming",
15
16
  ACCEPT_CONCURRENT = "callAcceptConcurrent",
16
17
  HANGUP = "callHangup",
18
+ CODEC_USAGE = "codec_usage",
17
19
  MEDIA_STATUS = "callMediaStatus",
18
20
  DEVICE_CHANGED = "callDeviceChanged",
19
21
  SOCKET_ACTION = "callSocketAction",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/calls-sdk",
3
- "version": "2.8.6-dev.3c52c9a0.0",
3
+ "version": "2.8.6-dev.40d6f2d9.0",
4
4
  "author": "vk.com",
5
5
  "description": "Library for video calls based on the vk.com platform",
6
6
  "homepage": "https://vk.com",
@@ -14,13 +14,19 @@
14
14
  "**/*.d.ts"
15
15
  ],
16
16
  "dependencies": {
17
+ "@fails-components/webtransport": "^1.3.0",
18
+ "@fails-components/webtransport-transport-http3-quiche": "^1.3.0",
17
19
  "@vkontakte/calls-audio-effects": "1.2.8",
18
20
  "@vkontakte/calls-video-effects": "2.2.3-beta.5",
19
- "@vkontakte/calls-vmoji": "1.0.10-beta.16",
21
+ "@vkontakte/calls-vmoji": "1.0.10-beta.17",
20
22
  "@vkontakte/libvpx": "2.0.9",
21
23
  "bit-buffer": "0.2.5",
24
+ "fflate": "^0.8.2",
22
25
  "messagepack": "1.1.12",
23
26
  "simple-ebml-builder": "0.2.2",
24
27
  "webrtc-adapter": "7.7.0"
25
- }
28
+ },
29
+ "workspaces": [
30
+ "workspaces/sandbox"
31
+ ]
26
32
  }
@@ -1,5 +1,6 @@
1
- import { IApiEnv } from '../types/Params';
2
- export declare function _resolveApiEndpoint(apiEnv?: IApiEnv): Promise<string>;
1
+ import { IAPIBaseUrl, IApiEnv } from '../types/Params';
2
+ export declare function resetApiEndpoint(): void;
3
+ export declare function _resolveApiEndpoint(apiBaseUrl?: IAPIBaseUrl, apiEnv?: IApiEnv): Promise<string>;
3
4
  export declare function sendBeakon(method: string, params?: {
4
5
  [key: string]: any;
5
6
  }, noSession?: boolean): Promise<void>;
@@ -22,7 +22,7 @@ import MuteStates from '../types/MuteStates';
22
22
  import { ParticipantsStateList, ParticipantStateMapped } from '../types/Participant';
23
23
  import { MediaType } from '../types/ParticipantStreamDescription';
24
24
  import { IRoomId, Room, RoomParticipantUpdate, Rooms, RoomsUpdate } from '../types/Room';
25
- import { IApiEnv } from '../types/Params';
25
+ import { IAPIBaseUrl, IApiEnv } from '../types/Params';
26
26
  import { VmojiError } from '../types/Vmoji';
27
27
  import { DebugMessageType } from './Debug';
28
28
  import { ParticipantStatus } from './External';
@@ -48,6 +48,12 @@ export type ParamsObject = {
48
48
  apiKey: string;
49
49
  /** @hidden */
50
50
  apiEnv: IApiEnv;
51
+ /**
52
+ * Базовый урл для запросов к API одноклассников
53
+ * Позволяет задать значение независимо от apiEnv
54
+ * @hidden
55
+ */
56
+ apiBaseUrl: IAPIBaseUrl;
51
57
  /** @hidden */
52
58
  apiAuth?: {
53
59
  sessionKey?: string;
@@ -866,6 +872,8 @@ export default abstract class Params {
866
872
  static get device(): string;
867
873
  static get apiKey(): string;
868
874
  static get apiEnv(): IApiEnv;
875
+ static get apiBaseUrl(): IAPIBaseUrl;
876
+ static set apiBaseUrl(apiBaseUrl: IAPIBaseUrl);
869
877
  static apiEndpoint(apiEnv?: IApiEnv): string;
870
878
  static get authToken(): string;
871
879
  static set authToken(value: string);
@@ -5,8 +5,8 @@ export declare const SIMULCAST_DEFAULT: {
5
5
  WIDTH: number;
6
6
  BITRATE: number;
7
7
  };
8
+ export declare const SIMULCAST_SCALABILITY_MODE = "L1T2";
8
9
  export declare const MAP_RID_TO_SCALE_RESOLUTION_DOWN_BY: Record<string, number>;
9
- export declare function getSimulcastInfo(stats?: RTCOutboundRtpStreamStats[], bitrates?: VideoBitrateSettings[]): ISimulcastInfo;
10
10
  export declare function isEqualSimulcastInfo(si1: ISimulcastInfo | null, si2: ISimulcastInfo | null): boolean;
11
11
  export declare function findBitrateAsc(maxDimension: number, bitrates: VideoBitrateSettings[]): number;
12
12
  export declare function calculateSimulcastInfo(width?: number, height?: number, bitrates?: VideoBitrateSettings[]): ISimulcastInfo;
@@ -143,6 +143,10 @@ declare namespace WebRTCUtils {
143
143
  * Может ли браузер делать H264 приоритетным
144
144
  */
145
145
  function canPreferH264(): boolean;
146
+ /**
147
+ * Некоторые браузеры (Firefox, Safari) некорректно поддерживают симулкаст
148
+ */
149
+ function isSimulcastSupportedByBrowser(): boolean;
146
150
  /**
147
151
  * Имя операционной системы
148
152
  */
@@ -12,6 +12,10 @@ type ConversationResponse = {
12
12
  * URL для подключения
13
13
  */
14
14
  endpoint: string;
15
+ /**
16
+ * URL для подключения по WebTransport
17
+ */
18
+ wt_endpoint?: string;
15
19
  /**
16
20
  * Токен комнаты для подключения к звонку по ссылке
17
21
  */
@@ -19,6 +19,7 @@ export declare namespace ExternalIdUtils {
19
19
  function fromId(id: ExternalUserId, type?: ExternalIdType, deviceIdx?: number): ExternalParticipantId;
20
20
  function fromSignalingParticipant(participant: SignalingMessage.Participant, useDecorative?: boolean): ExternalParticipantId | undefined;
21
21
  function fromSignaling(signalingId: SignalingMessage.ExternalId, deviceIdx?: number): ExternalParticipantId;
22
+ function toSignaling(externalId: ExternalId): string;
22
23
  function toString(externalId: ExternalId): ExternalIdString;
23
24
  function fromIdToString(id: ExternalUserId, type?: ExternalIdType, deviceIdx?: number): ExternalIdString;
24
25
  function fromString(stringId: ExternalIdString): ExternalParticipantId;
@@ -47,6 +47,10 @@ export interface IAddMovieParams {
47
47
  * MetaData ролика
48
48
  */
49
49
  metadata?: IMovieMetaData;
50
+ /**
51
+ * Локаль пользователя, необходимо для корректного перевода, если ролик с дефолтным названием
52
+ */
53
+ lang?: string;
50
54
  }
51
55
  export type ISharedMovieStateResponse = [
52
56
  number,
package/types/Params.d.ts CHANGED
@@ -1 +1,2 @@
1
1
  export type IApiEnv = 'AUTO' | 'PROD' | 'CALLS' | 'PROD_OK' | 'TEST' | 'VIDEOTEST' | 'CALLSTEST' | string;
2
+ export type IAPIBaseUrl = string | null;
@@ -86,3 +86,12 @@ export interface Participant {
86
86
  export interface IGetParticipantsParameters {
87
87
  externalIds: ExternalId[];
88
88
  }
89
+ export type ParticipantStateDataKey = 'hand' | 'drat';
90
+ export declare enum ParticipantStateDataValue {
91
+ OFF = "0",
92
+ ON = "1"
93
+ }
94
+ /**
95
+ * Список состояний в виде ключ-значение. Максимальная длина ключей и значений - 5 символов. Пустые значения будут пропущены
96
+ */
97
+ export type ParticipantStateData = Partial<Record<ParticipantStateDataKey, ParticipantStateDataValue>>;
@@ -45,5 +45,6 @@ export interface ICallStatLog extends Pick<CallStatReport, 'call_topology' | 'na
45
45
  concealment_audio_avg_size?: number;
46
46
  video_loss?: number;
47
47
  audio_loss?: number;
48
+ cpu_hardware_concurrency?: number;
48
49
  [k: string]: string | number | undefined;
49
50
  }
@@ -27,47 +27,194 @@ export interface ILocalIceCandidateStat extends IRemoteIceCandidateStat {
27
27
  interface StatRtpOutboundVideo {
28
28
  frameHeight?: number;
29
29
  frameWidth?: number;
30
+ /**
31
+ * Идентификатор потока RTP (RID).
32
+ *
33
+ * Используется для идентификации различных потоков видео (например, simulcast) в сессиях WebRTC.
34
+ */
30
35
  rid?: string;
31
36
  framesSent?: number;
32
37
  framesPerSecond?: number;
33
38
  targetBitrate?: number;
34
39
  }
35
40
  export interface StatRtp extends StatRtpOutboundVideo {
41
+ /**
42
+ * Уникальный идентификатор источника синхронизации RTP
43
+ */
36
44
  ssrc: number;
45
+ /**
46
+ * Идентификатор медиалинии (MID)
47
+ *
48
+ * Используется для уникальной идентификации медиалинии в рамках WebRTC-сессии.
49
+ * MID помогает сопоставлять медиапотоки с их соответствующими трансиверами.
50
+ */
51
+ mid?: string;
52
+ /**
53
+ * Тип статистики (например, inbound-rtp, outbound-rtp)
54
+ */
37
55
  type: string;
56
+ /**
57
+ * Тип медиа (например, audio, video)
58
+ */
38
59
  kind: string;
60
+ /**
61
+ * Общее количество байтов, полученных по этому потоку
62
+ */
39
63
  bytesReceived: number;
64
+ /**
65
+ * Общее количество байтов, отправленных по этому потоку
66
+ */
40
67
  bytesSent: number;
68
+ /**
69
+ * Общее количество байтов заголовков, полученных по этому потоку
70
+ */
41
71
  headerBytesReceived: number;
72
+ /**
73
+ * Общее количество байтов заголовков, отправленных по этому потоку
74
+ */
42
75
  headerBytesSent: number;
76
+ /**
77
+ * Среднее значение джиттера в секундах
78
+ * Джиттер — это вариация задержки в получении пакетов данных.
79
+ */
43
80
  jitter: number;
81
+ /**
82
+ * Общее количество потерянных пакетов
83
+ */
44
84
  packetsLost: number;
85
+ /**
86
+ * Общее количество полученных пакетов
87
+ */
45
88
  packetsReceived: number;
89
+ /**
90
+ * Общее количество отправленных пакетов
91
+ */
46
92
  packetsSent: number;
93
+ /**
94
+ * Доля потерянных пакетов
95
+ */
47
96
  fractionLost: number;
97
+ /**
98
+ * Количество Picture Loss Indication (PLI) сообщений
99
+ * PLI — это сообщения, указывающие на потерю кадров изображения.
100
+ */
48
101
  pliCount: number;
102
+ /**
103
+ * Количество Full Intra Request (FIR) сообщений
104
+ * FIR — это запросы на отправку полного внутрикодированного кадра.
105
+ */
49
106
  firCount: number;
107
+ /**
108
+ * Количество Negative ACKnowledgement (NACK) сообщений
109
+ * NACK — это сообщения, указывающие на потерю пакетов данных.
110
+ */
50
111
  nackCount: number;
112
+ /**
113
+ * Идентификатор пользователя, связанный с этим потоком
114
+ */
51
115
  userId?: string;
116
+ /**
117
+ * Пропускная способность в битах в секунду
118
+ */
52
119
  bandwidth?: number;
120
+ /**
121
+ * Процент потерянных пакетов
122
+ */
53
123
  packetLoss?: number;
124
+ /**
125
+ * Частота дискретизации в герцах
126
+ * Частота дискретизации определяет качество звука.
127
+ */
54
128
  clockRate?: number;
129
+ /**
130
+ * Название кодека
131
+ * @example audio/opus, video/vp8
132
+ */
55
133
  mimeType?: string;
134
+ /**
135
+ * Библиотека, которая используется для кодека
136
+ */
137
+ encoderImplementation?: string;
138
+ /**
139
+ * Библиотека, которая используется для декодера
140
+ */
141
+ decoderImplementation?: string;
142
+ /**
143
+ * Параметры кодека, есть только у audio кодеков
144
+ */
145
+ sdpFmtpLine?: string;
146
+ /**
147
+ * Общее количество декодированных кадров
148
+ */
56
149
  framesDecoded?: number;
150
+ /**
151
+ * Общее количество полученных кадров
152
+ */
57
153
  framesReceived?: number;
154
+ /**
155
+ * Общее количество отброшенных кадров
156
+ */
58
157
  framesDropped?: number;
158
+ /**
159
+ * Изменение количества отброшенных кадров
160
+ */
59
161
  framesDroppedDelta?: number;
162
+ /**
163
+ * Изменение задержки между кадрами
164
+ */
60
165
  interframeDelayVariance?: number;
166
+ /**
167
+ * Общее количество полученных аудиосэмплов
168
+ */
61
169
  totalSamplesReceived?: number;
170
+ /**
171
+ * Общее время кодирования видео в секундах.
172
+ *
173
+ * Показывает, сколько времени было потрачено на кодирование видео кадров.
174
+ * Не применяется для аудио.
175
+ */
176
+ totalEncodeTime?: number;
177
+ /**
178
+ * Общее количество замаскированных сэмплов
179
+ */
62
180
  concealedSamples?: number;
181
+ /**
182
+ * Количество вставленных сэмплов для замедления
183
+ */
63
184
  insertedSamplesForDeceleration?: number;
185
+ /**
186
+ * Количество удаленных сэмплов для ускорения
187
+ */
64
188
  removedSamplesForAcceleration?: number;
189
+ /**
190
+ * Количество замаскированных беззвучных сэмплов
191
+ */
65
192
  silentConcealedSamples?: number;
193
+ /**
194
+ * Количество событий маскировки
195
+ */
66
196
  concealmentEvents?: number;
197
+ /**
198
+ * Общее количество аудиоэнергии
199
+ * Аудиоэнергия — это мера мощности аудиосигнала.
200
+ */
67
201
  totalAudioEnergy?: number;
202
+ /**
203
+ * Общее время замерзания в секундах
204
+ */
68
205
  totalFreezesDuration: number;
206
+ /**
207
+ * Изменение общего времени замерзания
208
+ * Время замерзания — это период, в течение которого поток временно останавливается.
209
+ */
69
210
  totalFreezesDurationDelta?: number;
211
+ /**
212
+ * Количество событий замерзания
213
+ */
70
214
  freezeCount: number;
215
+ /**
216
+ * Изменение количества событий замерзания
217
+ */
71
218
  freezeCountDelta?: number;
72
219
  }
73
220
  export type StatItem = {
@@ -0,0 +1,34 @@
1
+ interface WebTransportHash {
2
+ algorithm?: string;
3
+ value?: BufferSource;
4
+ }
5
+ interface WebTransportOptions {
6
+ allowPooling?: boolean;
7
+ congestionControl?: CongestionControlType;
8
+ requireUnreliable?: boolean;
9
+ serverCertificateHashes?: WebTransportHash[];
10
+ }
11
+ type CongestionControlType = 'default' | 'low-latency' | 'throughput';
12
+ declare class WebTransportEventual {
13
+ private webTransport;
14
+ private stream;
15
+ private writer;
16
+ private reader;
17
+ private readonly url;
18
+ private readonly options;
19
+ private readonly compression;
20
+ private encoder;
21
+ private decoder;
22
+ onopen: ((this: WebTransportEventual, ev: Event) => any) | null;
23
+ onmessage: ((this: WebTransportEventual, ev: MessageEvent) => any) | null;
24
+ onerror: ((this: WebTransportEventual, ev: Event) => any) | null;
25
+ onclose: ((this: WebTransportEventual, ev: CloseEvent) => any) | null;
26
+ readyState: number;
27
+ constructor(url: string, options?: WebTransportOptions);
28
+ private getCompressionTypeFromUrl;
29
+ private connect;
30
+ private readLoop;
31
+ send(data: string): Promise<void>;
32
+ close(code?: number, reason?: string): void;
33
+ }
34
+ export { WebTransportEventual as WebTransport };
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Encodes a string into a Uint8Array, prepending the length of the string as a variable-length integer and optionally compressing it.
3
+ */
4
+ declare class LengthPrefixedTextEncoder {
5
+ private readonly encoder;
6
+ private readonly compression;
7
+ private readonly lengthEncoder;
8
+ constructor(compression?: 'gzip' | 'deflate' | 'deflate-raw' | null);
9
+ /**
10
+ * Encodes the given string into a Uint8Array.
11
+ *
12
+ * @param data The string to encode.
13
+ * @returns A Uint8Array containing the length-prefixed and optionally compressed encoded string.
14
+ * @throws {RangeError} If the string length exceeds the maximum representable value.
15
+ */
16
+ encode(data: string): Uint8Array;
17
+ private compress;
18
+ }
19
+ /**
20
+ * Decodes a stream of Uint8Arrays into strings, where each string
21
+ * is prefixed by its length as a variable-length integer and optionally decompressed.
22
+ */
23
+ declare class LengthPrefixedTextDecoder {
24
+ private readonly decoder;
25
+ private readonly compression;
26
+ private readonly lengthDecoder;
27
+ private buffer;
28
+ private expectedLength;
29
+ private offset;
30
+ private lengthPrefixLength;
31
+ constructor(compression?: 'gzip' | 'deflate' | 'deflate-raw' | null);
32
+ /**
33
+ * Decodes a Uint8Array into a list of strings.
34
+ *
35
+ * @param data The Uint8Array to decode.
36
+ * @returns An array of decoded strings.
37
+ */
38
+ decode(data: Uint8Array): string[];
39
+ /**
40
+ * Reads the length prefix from the beginning of the data.
41
+ *
42
+ * @param data The Uint8Array containing the length prefix.
43
+ * @returns The length of the message, or null if there's not enough data to read the length.
44
+ */
45
+ private readLength;
46
+ private decompress;
47
+ }
48
+ export { LengthPrefixedTextEncoder, LengthPrefixedTextDecoder };
@@ -0,0 +1,18 @@
1
+ declare class VariableLengthIntegerEncoder {
2
+ /**
3
+ * Encodes an integer using a variable-length integer encoding.
4
+ * @param num The number to encode.
5
+ * @returns A Uint8Array representing the encoded integer.
6
+ */
7
+ encode(num: number | bigint): Uint8Array;
8
+ }
9
+ declare class VariableLengthIntegerDecoder {
10
+ /**
11
+ * Decodes an integer from a Uint8Array using variable-length integer encoding.
12
+ * @param data The Uint8Array to decode.
13
+ * @returns The decoded integer.
14
+ */
15
+ decode(data: Uint8Array): bigint;
16
+ getNumBytesForLengthInteger(data: Uint8Array): number;
17
+ }
18
+ export { VariableLengthIntegerEncoder, VariableLengthIntegerDecoder };