@vkontakte/calls-sdk 2.8.6-dev.a5d3a18a.0 → 2.8.6-dev.a76637b5.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 +11 -8
- package/abstract/BaseApi.d.ts +1 -0
- package/abstract/BaseSignaling.d.ts +1 -0
- package/calls-sdk.cjs.js +8 -8
- package/calls-sdk.esm.js +8 -8
- package/classes/Conversation.d.ts +12 -5
- package/classes/Logger.d.ts +24 -18
- package/classes/MediaSource.d.ts +3 -0
- package/classes/SignalingActor.d.ts +9 -0
- package/classes/codec/IDecoder.d.ts +1 -1
- package/classes/codec/IEncoder.d.ts +0 -1
- package/classes/codec/LibVPxDecoder.d.ts +1 -1
- package/classes/codec/WebCodecsDecoder.d.ts +1 -1
- package/classes/screenshare/BaseStreamBuilder.d.ts +3 -2
- package/classes/screenshare/ScreenCaptureReceiver.d.ts +4 -0
- package/classes/screenshare/StreamBuilder.d.ts +16 -4
- package/classes/screenshare/Utils.d.ts +1 -0
- package/classes/stat/StatPings.d.ts +17 -0
- package/classes/stat/StatSignalingCommands.d.ts +12 -0
- package/classes/transport/Statistics.d.ts +23 -10
- package/default/Api.d.ts +1 -0
- package/default/Signaling.d.ts +16 -9
- package/enums/ChatRoomEventType.d.ts +1 -1
- package/enums/ConversationOption.d.ts +3 -3
- package/enums/HangupType.d.ts +2 -1
- package/enums/RecordRole.d.ts +1 -1
- package/enums/SignalingTransportStat.d.ts +17 -0
- package/enums/Stat.d.ts +19 -36
- package/enums/StatLog.d.ts +32 -0
- package/package.json +2 -1
- package/static/ApiTransport.d.ts +1 -1
- package/static/External.d.ts +2 -2
- package/static/Params.d.ts +66 -24
- package/static/SimulcastInfo.d.ts +1 -1
- package/static/Utils.d.ts +1 -1
- package/static/WebRTCUtils.d.ts +7 -1
- package/types/Conversation.d.ts +3 -0
- package/types/ConversationParams.d.ts +2 -0
- package/types/ConversationResponse.d.ts +4 -0
- package/types/ExternalId.d.ts +2 -0
- package/types/FastStart.d.ts +46 -0
- package/types/SignalingCommand.d.ts +1 -0
- package/types/SignalingMessage.d.ts +1 -1
- package/types/Streams.d.ts +1 -0
- package/types/WebTransport.d.ts +26 -0
- package/utils/LengthPrefixed.d.ts +48 -0
- package/utils/Lz4.d.ts +1 -1
- package/utils/MsgPackerBufferUtils.d.ts +1 -1
- package/utils/P2Quantile.d.ts +14 -0
- package/utils/StatTracker.d.ts +18 -0
- package/utils/VariableLengthInteger.d.ts +18 -0
- package/utils/Welford.d.ts +9 -0
- package/worker/LibVPxDecoderWorker.d.ts +0 -1
- package/worker/LibVPxEncoderWorker.d.ts +0 -1
- package/worker/WebCodecsDecoderWorker.d.ts +0 -1
- package/worker/WebCodecsEncoderWorker.d.ts +0 -1
package/static/External.d.ts
CHANGED
|
@@ -226,7 +226,7 @@ declare namespace External {
|
|
|
226
226
|
* @param markers
|
|
227
227
|
*/
|
|
228
228
|
function onParticipantJoined(userId: ExternalId, markers: ExternalParticipantListMarkers | null): void;
|
|
229
|
-
function onLocalParticipantState(participantState: ParticipantStateMapped): void;
|
|
229
|
+
function onLocalParticipantState(participantState: ParticipantStateMapped, global?: boolean): void;
|
|
230
230
|
/**
|
|
231
231
|
* Изменились данные состояний собеседника
|
|
232
232
|
*
|
|
@@ -420,7 +420,7 @@ declare namespace External {
|
|
|
420
420
|
* Закончена запись звонка
|
|
421
421
|
* @param roomId ID зала в котором остановлена запись
|
|
422
422
|
*/
|
|
423
|
-
function onRecordStopped(roomId
|
|
423
|
+
function onRecordStopped(roomId: number | null | undefined, stopBy: ExternalParticipantId | null): void;
|
|
424
424
|
/**
|
|
425
425
|
* Состояние своей сети
|
|
426
426
|
*
|
package/static/Params.d.ts
CHANGED
|
@@ -82,6 +82,8 @@ export type ParamsObject = {
|
|
|
82
82
|
/** @hidden */
|
|
83
83
|
wssBase: string;
|
|
84
84
|
/** @hidden */
|
|
85
|
+
wtsBase: string;
|
|
86
|
+
/** @hidden */
|
|
85
87
|
wssToken: string;
|
|
86
88
|
/** @hidden */
|
|
87
89
|
signalingReconnectDelay: number;
|
|
@@ -461,6 +463,50 @@ export type ParamsObject = {
|
|
|
461
463
|
* _По умолчанию: `false`_
|
|
462
464
|
*/
|
|
463
465
|
enableLogPerfStatReport: boolean;
|
|
466
|
+
/**
|
|
467
|
+
* Поддержка переключения качества видео в зависимости от сети
|
|
468
|
+
* Только для режима p2p
|
|
469
|
+
*
|
|
470
|
+
* _По умолчанию: `false`_
|
|
471
|
+
*/
|
|
472
|
+
switchVideoAtBadNetwork: boolean;
|
|
473
|
+
/**
|
|
474
|
+
* Включает деградацию фпс для видео с камеры при низком фпс с включенными вирт фонами
|
|
475
|
+
*
|
|
476
|
+
* _По умолчанию: `false`_
|
|
477
|
+
*/
|
|
478
|
+
enableVideoEffectsFpsDegradation: boolean;
|
|
479
|
+
/**
|
|
480
|
+
* Включить поддержку simulcast на отправке
|
|
481
|
+
*
|
|
482
|
+
* _По умолчанию: `false`_
|
|
483
|
+
*/
|
|
484
|
+
simulcast: boolean;
|
|
485
|
+
/**
|
|
486
|
+
* Включить поддержку webtransport для сигналинга
|
|
487
|
+
*
|
|
488
|
+
* _По умолчанию: `false`_
|
|
489
|
+
*/
|
|
490
|
+
webtransport: boolean;
|
|
491
|
+
/**
|
|
492
|
+
* Включить поддержку webtransport для сигналинга в FireFox
|
|
493
|
+
* Отдельная ручка, так как есть проблемы сейчас с FF
|
|
494
|
+
*
|
|
495
|
+
* _По умолчанию: `false`_
|
|
496
|
+
*/
|
|
497
|
+
webtransportFF: boolean;
|
|
498
|
+
/**
|
|
499
|
+
* Скриншара
|
|
500
|
+
* Включить возможность запрашивать ключевой кадр декодером
|
|
501
|
+
* @hidden
|
|
502
|
+
*/
|
|
503
|
+
streamBuilderKeyFrameRequest: boolean;
|
|
504
|
+
/**
|
|
505
|
+
* Скриншара
|
|
506
|
+
* Включить переключение на LibVPX при проблемах с WebCodecsDecoder
|
|
507
|
+
* @hidden
|
|
508
|
+
*/
|
|
509
|
+
streamBuilderAutoSwitchToLibVPX: boolean;
|
|
464
510
|
/**
|
|
465
511
|
* Получен локальный стрим с камеры/микрофона
|
|
466
512
|
*/
|
|
@@ -565,8 +611,11 @@ export type ParamsObject = {
|
|
|
565
611
|
/**
|
|
566
612
|
* Получены данные по изменению локальных состояний со стороны админа
|
|
567
613
|
* Например, принудительно опущена рука
|
|
614
|
+
*
|
|
615
|
+
* @param participantState Полный объект состояния участника, полученный от SDK/сервера.
|
|
616
|
+
* @param global `true` – действие глобальное (для всех участников), `false` – действие локальное (только у текущего пользователя).
|
|
568
617
|
*/
|
|
569
|
-
onLocalParticipantState?: (participantState: ParticipantStateMapped) => void;
|
|
618
|
+
onLocalParticipantState?: (participantState: ParticipantStateMapped, global: boolean) => void;
|
|
570
619
|
/**
|
|
571
620
|
* Изменились данные состояний собеседника
|
|
572
621
|
*/
|
|
@@ -681,7 +730,7 @@ export type ParamsObject = {
|
|
|
681
730
|
/**
|
|
682
731
|
* Закончена трансляция/запись звонка
|
|
683
732
|
*/
|
|
684
|
-
onRecordStopped?: (roomId: number | null) => void;
|
|
733
|
+
onRecordStopped?: (roomId: number | null, stopBy: ExternalParticipantId | null) => void;
|
|
685
734
|
/**
|
|
686
735
|
* Состояние своей сети
|
|
687
736
|
*
|
|
@@ -834,27 +883,6 @@ export type ParamsObject = {
|
|
|
834
883
|
* Собеседник подключился к сигналлингу
|
|
835
884
|
*/
|
|
836
885
|
onPeerRegistered?: () => void;
|
|
837
|
-
/**
|
|
838
|
-
* Поддержка переключения качества видео в зависимости от сети
|
|
839
|
-
* Только для режима p2p
|
|
840
|
-
*
|
|
841
|
-
* _По умолчанию: `false`_
|
|
842
|
-
*/
|
|
843
|
-
switchVideoAtBadNetwork: boolean;
|
|
844
|
-
/** включает деградацию фпс для видео с камеры при низком фпс с включенными вирт фонами */
|
|
845
|
-
enableVideoEffectsFpsDegradation: boolean;
|
|
846
|
-
/**
|
|
847
|
-
* Включить поддержку simulcast на отправке
|
|
848
|
-
*
|
|
849
|
-
* _По умолчанию: `false`_
|
|
850
|
-
*/
|
|
851
|
-
simulcast: boolean;
|
|
852
|
-
/**
|
|
853
|
-
* Не запрашивать conversation params при входе в звонок
|
|
854
|
-
*
|
|
855
|
-
* _По умолчанию: `false`_
|
|
856
|
-
*/
|
|
857
|
-
skipConversationParams?: boolean;
|
|
858
886
|
};
|
|
859
887
|
export default abstract class Params {
|
|
860
888
|
private static _params;
|
|
@@ -891,6 +919,8 @@ export default abstract class Params {
|
|
|
891
919
|
static set iceServers(value: IceServer[]);
|
|
892
920
|
static get wssBase(): string;
|
|
893
921
|
static set wssBase(value: string);
|
|
922
|
+
static get wtsBase(): string;
|
|
923
|
+
static set wtsBase(value: string);
|
|
894
924
|
static get wssToken(): string;
|
|
895
925
|
static set wssToken(value: string);
|
|
896
926
|
static get signalingReconnectDelay(): number;
|
|
@@ -984,7 +1014,14 @@ export default abstract class Params {
|
|
|
984
1014
|
static get enableVideoEffectsFpsDegradation(): boolean;
|
|
985
1015
|
static get simulcast(): boolean;
|
|
986
1016
|
static set simulcast(value: boolean);
|
|
987
|
-
static get
|
|
1017
|
+
static get webtransport(): boolean;
|
|
1018
|
+
static set webtransport(value: boolean);
|
|
1019
|
+
static get webtransportFF(): boolean;
|
|
1020
|
+
static set webtransportFF(value: boolean);
|
|
1021
|
+
static set streamBuilderKeyFrameRequest(value: boolean);
|
|
1022
|
+
static get streamBuilderKeyFrameRequest(): boolean;
|
|
1023
|
+
static set streamBuilderAutoSwitchToLibVPX(value: boolean);
|
|
1024
|
+
static get streamBuilderAutoSwitchToLibVPX(): boolean;
|
|
988
1025
|
static toJSON(): {
|
|
989
1026
|
apiKey: string;
|
|
990
1027
|
apiEnv: string;
|
|
@@ -1013,5 +1050,10 @@ export default abstract class Params {
|
|
|
1013
1050
|
clientStatsPlatform: string;
|
|
1014
1051
|
consumerScreenDataChannelPacketSize: number;
|
|
1015
1052
|
switchVideoAtBadNetwork: boolean;
|
|
1053
|
+
simulcast: boolean;
|
|
1054
|
+
webtransport: boolean;
|
|
1055
|
+
webtransportFF: boolean;
|
|
1056
|
+
streamBuilderKeyFrameRequest: boolean;
|
|
1057
|
+
streamBuilderAutoSwitchToLibVPX: boolean;
|
|
1016
1058
|
};
|
|
1017
1059
|
}
|
|
@@ -10,4 +10,4 @@ export declare const MAP_RID_TO_SCALE_RESOLUTION_DOWN_BY: Record<string, number>
|
|
|
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;
|
|
13
|
-
export declare function findScaleResolutionDownBy(rid
|
|
13
|
+
export declare function findScaleResolutionDownBy(rid?: string): number;
|
package/static/Utils.d.ts
CHANGED
|
@@ -71,7 +71,7 @@ declare namespace Utils {
|
|
|
71
71
|
function participantMarkerCompare(marker1: ExternalParticipantListMarker | undefined, marker2: ExternalParticipantListMarker | undefined): number;
|
|
72
72
|
/** убирает все ключи со значением `V` на 1 уровне */
|
|
73
73
|
function objectFilterOutValues<T extends Record<string, V>, V = unknown>(obj: T, value?: unknown | unknown[]): Partial<T>;
|
|
74
|
-
function objectReduce<R, T extends
|
|
74
|
+
function objectReduce<R, T extends object>(obj: T, callback: (acc: R, value: T[keyof T], key: keyof T) => R, initialValue: R): R;
|
|
75
75
|
const setImmediate: (fn: VoidFunction) => VoidFunction;
|
|
76
76
|
function isObject(obj: unknown): obj is object;
|
|
77
77
|
function patchSimulcastAnswerSdp(sdp: string, trans: RTCRtpTransceiver, width: number, height: number): string;
|
package/static/WebRTCUtils.d.ts
CHANGED
|
@@ -21,7 +21,9 @@ export declare enum FacingMode {
|
|
|
21
21
|
export type BrowserName = 'IE' | 'Edge' | 'Chrome' | 'Firefox' | 'Yandex' | 'Opera' | 'Sferum';
|
|
22
22
|
declare namespace WebRTCUtils {
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* До вызова этого метода бесполезно опрашивать другие публичные методы.
|
|
25
|
+
* - Инициализирует устройства.
|
|
26
|
+
* - Получает версию ОС
|
|
25
27
|
*/
|
|
26
28
|
function init(): Promise<void>;
|
|
27
29
|
/**
|
|
@@ -151,6 +153,10 @@ declare namespace WebRTCUtils {
|
|
|
151
153
|
* Имя операционной системы
|
|
152
154
|
*/
|
|
153
155
|
function os(): string;
|
|
156
|
+
/**
|
|
157
|
+
* Версия операционной системы
|
|
158
|
+
*/
|
|
159
|
+
function osVersion(): number | null | undefined;
|
|
154
160
|
/**
|
|
155
161
|
* Мобильный браузер или нет
|
|
156
162
|
*/
|
package/types/Conversation.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import UserRole from '../enums/UserRole';
|
|
|
8
8
|
import { AsrInfo } from './Asr';
|
|
9
9
|
import { IFeaturesPerRole } from './ConversationFeature';
|
|
10
10
|
import { ExternalId, ExternalParticipantId } from './ExternalId';
|
|
11
|
+
import { FastStartHandler } from './FastStart';
|
|
11
12
|
import MediaModifiers from './MediaModifiers';
|
|
12
13
|
import MuteStates from './MuteStates';
|
|
13
14
|
import { OkUserId, ParticipantId } from './Participant';
|
|
@@ -79,6 +80,7 @@ export type ConversationOnStartParams = {
|
|
|
79
80
|
requireAuthToJoin?: boolean;
|
|
80
81
|
onlyAdminCanShareMovie?: boolean;
|
|
81
82
|
externalIds?: ExternalId[];
|
|
83
|
+
onFastStart?: FastStartHandler;
|
|
82
84
|
};
|
|
83
85
|
export type StartConversationParams = {
|
|
84
86
|
opponentIds?: OkUserId[];
|
|
@@ -91,4 +93,5 @@ export type StartConversationParams = {
|
|
|
91
93
|
onlyAdminCanShareMovie?: boolean;
|
|
92
94
|
externalIds?: ExternalId[];
|
|
93
95
|
startedTime: number;
|
|
96
|
+
onFastStart?: FastStartHandler;
|
|
94
97
|
};
|
|
@@ -2,6 +2,7 @@ import IceServer from './IceServer';
|
|
|
2
2
|
type ConversationParams = {
|
|
3
3
|
token: string;
|
|
4
4
|
endpoint: string;
|
|
5
|
+
wt_endpoint?: string;
|
|
5
6
|
turn_server?: IceServer;
|
|
6
7
|
stun_server?: IceServer;
|
|
7
8
|
client_type?: string;
|
|
@@ -22,5 +23,6 @@ export type ExternalConversationParams = {
|
|
|
22
23
|
trnp: string;
|
|
23
24
|
trnu: string;
|
|
24
25
|
wse: string;
|
|
26
|
+
wte: string;
|
|
25
27
|
};
|
|
26
28
|
export default ConversationParams;
|
package/types/ExternalId.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import MediaOption from '../enums/MediaOption';
|
|
2
|
+
import UserRole from '../enums/UserRole';
|
|
2
3
|
import { ParticipantStatus } from '../static/External';
|
|
3
4
|
import MediaSettings from './MediaSettings';
|
|
4
5
|
import { ISharedMovieInfo } from './MovieShare';
|
|
@@ -96,6 +97,7 @@ export interface ExternalParticipant {
|
|
|
96
97
|
unmuteOptions: MediaOption[];
|
|
97
98
|
markers: ExternalParticipantListMarkers | null;
|
|
98
99
|
movieShareInfos?: ISharedMovieInfo[];
|
|
100
|
+
roles: UserRole[];
|
|
99
101
|
}
|
|
100
102
|
/**
|
|
101
103
|
* Позиция в чанке
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { HangupType, IceServer } from '../CallsSDK';
|
|
2
|
+
import CallType from '../enums/CallType';
|
|
3
|
+
import MediaOption from '../enums/MediaOption';
|
|
4
|
+
import { ExternalId } from './ExternalId';
|
|
5
|
+
/**
|
|
6
|
+
* Параметры, которые нужно вернуть для создания fastStart
|
|
7
|
+
*/
|
|
8
|
+
export interface InternalParams {
|
|
9
|
+
platform: string;
|
|
10
|
+
sdkVersion: string;
|
|
11
|
+
clientAppKey: string;
|
|
12
|
+
deviceId: string;
|
|
13
|
+
protocolVersion: number;
|
|
14
|
+
domainId?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface InternalCallerParams {
|
|
17
|
+
id: ID;
|
|
18
|
+
isConcurrent: boolean;
|
|
19
|
+
endpoint: string;
|
|
20
|
+
wtEndpoint: string;
|
|
21
|
+
clientType: string;
|
|
22
|
+
turn: IceServer;
|
|
23
|
+
stun: IceServer;
|
|
24
|
+
}
|
|
25
|
+
export interface ID {
|
|
26
|
+
internal: number;
|
|
27
|
+
external: string;
|
|
28
|
+
}
|
|
29
|
+
export interface FastStartParams {
|
|
30
|
+
conversationId: string;
|
|
31
|
+
internalParams: string;
|
|
32
|
+
externalIds?: ExternalId[];
|
|
33
|
+
opponentType: CallType;
|
|
34
|
+
mediaOptions: MediaOption[];
|
|
35
|
+
joiningAllowed?: boolean;
|
|
36
|
+
requireAuthToJoin?: boolean;
|
|
37
|
+
isVideo?: boolean;
|
|
38
|
+
}
|
|
39
|
+
export interface FastStartResponse {
|
|
40
|
+
internalCallerParams: string;
|
|
41
|
+
rejectedParticipants: {
|
|
42
|
+
id: string;
|
|
43
|
+
status: HangupType;
|
|
44
|
+
}[];
|
|
45
|
+
}
|
|
46
|
+
export type FastStartHandler = (params: FastStartParams) => Promise<FastStartResponse>;
|
|
@@ -3,6 +3,7 @@ import { SignalingResponse, SignalingSuccessResponse } from './SignalingMessage'
|
|
|
3
3
|
interface SignalingCommand<T extends SignalingResponse = SignalingSuccessResponse> {
|
|
4
4
|
sequence: number;
|
|
5
5
|
name: SignalingCommandType;
|
|
6
|
+
statMarkName: string;
|
|
6
7
|
params: object;
|
|
7
8
|
responseTimer: number;
|
|
8
9
|
needResponse: boolean;
|
|
@@ -276,7 +276,6 @@ declare namespace SignalingMessage {
|
|
|
276
276
|
}
|
|
277
277
|
export interface FeatureSetChanged extends Notification {
|
|
278
278
|
features: ConversationFeature[];
|
|
279
|
-
featuresPerRole?: IFeaturesPerRole | null;
|
|
280
279
|
}
|
|
281
280
|
export interface MultipartyChatCreated extends Notification {
|
|
282
281
|
chatId: string;
|
|
@@ -289,6 +288,7 @@ declare namespace SignalingMessage {
|
|
|
289
288
|
recordInfo: RecordInfo;
|
|
290
289
|
}
|
|
291
290
|
export interface RecordStopped extends Notification {
|
|
291
|
+
/** кто остановил запись или если в комнатах, то это админ */
|
|
292
292
|
participant: ParticipantId;
|
|
293
293
|
recordMovieId: number;
|
|
294
294
|
}
|
package/types/Streams.d.ts
CHANGED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { WebTransportOptions } from '@fails-components/webtransport';
|
|
2
|
+
declare class WebTransportEventual {
|
|
3
|
+
private webTransport;
|
|
4
|
+
private stream;
|
|
5
|
+
private writer;
|
|
6
|
+
private reader;
|
|
7
|
+
private readonly url;
|
|
8
|
+
private readonly options;
|
|
9
|
+
private readonly compression;
|
|
10
|
+
private encoder;
|
|
11
|
+
private decoder;
|
|
12
|
+
onopen: ((this: WebTransportEventual, ev: Event) => any) | null;
|
|
13
|
+
onmessage: ((this: WebTransportEventual, ev: MessageEvent) => any) | null;
|
|
14
|
+
onerror: ((this: WebTransportEventual, ev: Event) => any) | null;
|
|
15
|
+
onclose: ((this: WebTransportEventual, ev: CloseEvent) => any) | null;
|
|
16
|
+
readyState: number;
|
|
17
|
+
constructor(url: string, options?: WebTransportOptions);
|
|
18
|
+
private getCompressionTypeFromUrl;
|
|
19
|
+
private connect;
|
|
20
|
+
private readChunks;
|
|
21
|
+
private readLoop;
|
|
22
|
+
send(data: string): Promise<void>;
|
|
23
|
+
close(code?: number, reason?: string): void;
|
|
24
|
+
static isBrowserSupported(): boolean;
|
|
25
|
+
}
|
|
26
|
+
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 };
|
package/utils/Lz4.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function lz4Decompress(input: Uint8Array, outputLength: number): Uint8Array
|
|
1
|
+
export declare function lz4Decompress(input: Uint8Array, outputLength: number): Uint8Array<ArrayBuffer>;
|
|
@@ -13,7 +13,7 @@ export declare function createWriteBuffer(): {
|
|
|
13
13
|
putUi32(v: number): void;
|
|
14
14
|
putUi64(v: number): void;
|
|
15
15
|
putF(v: number): void;
|
|
16
|
-
ui8array(): Uint8Array
|
|
16
|
+
ui8array(): Uint8Array<ArrayBuffer>;
|
|
17
17
|
};
|
|
18
18
|
export declare function createReadBuffer(buf: BufferSource): {
|
|
19
19
|
peek(): number;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Класс, реализующий возможность найти медиану или другой персентиль не храня весь поток данных для расчета
|
|
3
|
+
*/
|
|
4
|
+
export declare class P2Quantile {
|
|
5
|
+
private readonly q;
|
|
6
|
+
private inits;
|
|
7
|
+
private n;
|
|
8
|
+
private np;
|
|
9
|
+
private qv;
|
|
10
|
+
constructor(q: number);
|
|
11
|
+
add(x: number): void;
|
|
12
|
+
value(): number;
|
|
13
|
+
private bootstrap;
|
|
14
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare class StatTracker {
|
|
2
|
+
private count;
|
|
3
|
+
private minVal;
|
|
4
|
+
private maxVal;
|
|
5
|
+
private mean;
|
|
6
|
+
private p50;
|
|
7
|
+
private p95;
|
|
8
|
+
add(x: number): void;
|
|
9
|
+
snapshot(): {
|
|
10
|
+
min: number;
|
|
11
|
+
max: number;
|
|
12
|
+
avg: number;
|
|
13
|
+
median: number;
|
|
14
|
+
p95: number;
|
|
15
|
+
count: number;
|
|
16
|
+
};
|
|
17
|
+
get hasData(): boolean;
|
|
18
|
+
}
|
|
@@ -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 | null;
|
|
16
|
+
getNumBytesForLengthInteger(data: Uint8Array): number;
|
|
17
|
+
}
|
|
18
|
+
export { VariableLengthIntegerEncoder, VariableLengthIntegerDecoder };
|