@xylink/xy-rtc-sdk 3.9.1-beta.6 → 3.10.0-beta.4
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/lib/action/index.d.ts +103 -20
- package/lib/enum/client.d.ts +1 -1
- package/lib/enum/{contraints.d.ts → constraints.d.ts} +6 -0
- package/lib/enum/device.d.ts +34 -0
- package/lib/enum/errorCode.d.ts +7 -1
- package/lib/enum/i18n.d.ts +6 -0
- package/lib/enum/index.d.ts +70 -12
- package/lib/enum/meeting.d.ts +4 -0
- package/lib/feature/index.d.ts +1 -0
- package/lib/feature/speaker.d.ts +61 -0
- package/lib/index.d.ts +13 -10
- package/lib/main/ability/const.d.ts +2 -0
- package/lib/main/ability/index.d.ts +31 -0
- package/lib/main/{iauth.d.ts → auth.d.ts} +8 -8
- package/lib/main/client.d.ts +203 -97
- package/lib/main/clientImplements.d.ts +99 -0
- package/lib/main/deviceManager.d.ts +150 -93
- package/lib/main/helper.d.ts +62 -9
- package/lib/main/layout/index.d.ts +377 -0
- package/lib/main/layout/template.d.ts +64 -0
- package/lib/main/meeting.d.ts +32 -26
- package/lib/main/peer.d.ts +3 -1
- package/lib/main/stream.d.ts +47 -21
- package/lib/main/videoManager.d.ts +95 -12
- package/lib/tools/{audioLevel.d.ts → analyser.d.ts} +11 -4
- package/lib/tools/browser.d.ts +60 -49
- package/lib/tools/httpClient.d.ts +27 -6
- package/lib/tools/index.d.ts +12 -5
- package/lib/tools/{logger.d.ts → log/logger.d.ts} +18 -7
- package/lib/tools/log/loggerManager.d.ts +69 -0
- package/lib/tools/promiseQueue.d.ts +45 -0
- package/lib/tools/queue.d.ts +12 -15
- package/lib/tools/resize.d.ts +62 -0
- package/lib/tools/snapshot.d.ts +31 -0
- package/lib/tools/socket.d.ts +99 -32
- package/lib/tools/template/index.d.ts +324 -0
- package/lib/tools/template/mobile.d.ts +9 -0
- package/lib/tools/utils.d.ts +13 -5
- package/lib/type/ability.d.ts +25 -0
- package/lib/type/analyser.d.ts +18 -0
- package/lib/type/{iauth.d.ts → auth.d.ts} +0 -7
- package/lib/type/base.d.ts +16 -0
- package/lib/type/client.d.ts +164 -150
- package/lib/type/device.d.ts +103 -31
- package/lib/type/index.d.ts +3 -1
- package/lib/type/layout.d.ts +198 -13
- package/lib/type/logger.d.ts +19 -1
- package/lib/type/meeting.d.ts +294 -10
- package/lib/type/socket.d.ts +60 -0
- package/lib/type/stream.d.ts +21 -13
- package/lib/xyrtc.cjs.js +1 -1
- package/lib/xyrtc.umd.js +1 -1
- package/package.json +7 -5
- package/lib/main/layoutManager.d.ts +0 -244
- package/lib/tools/template.d.ts +0 -21
- /package/lib/tools/{logger.worker.d.ts → log/logger.worker.d.ts} +0 -0
package/lib/main/stream.d.ts
CHANGED
|
@@ -4,38 +4,36 @@
|
|
|
4
4
|
* @authors Luo-jinghui (luojinghui424@gmail.com)
|
|
5
5
|
* @date 2019-10-27 23:12:45
|
|
6
6
|
*/
|
|
7
|
-
import
|
|
7
|
+
import { AudioAnalyser } from '../tools/analyser';
|
|
8
|
+
import Logger from '../tools/log/logger';
|
|
8
9
|
import Emitter from '../tools/emitter';
|
|
9
|
-
import { IStreamChangeType, IStreamConfig, IGetMediaStreams, ISource, IStreamInitConfig, IStreamCurrent, IStreamChange, IStreamInitParams, StreamKind, CaptureStatus, OperateType, ICreateContentConfig,
|
|
10
|
+
import { IStreamChangeType, IStreamConfig, IGetMediaStreams, ISource, IStreamInitConfig, IStreamCurrent, IStreamChange, IStreamInitParams, StreamKind, CaptureStatus, OperateType, ICreateContentConfig, DEVICE_KIND, SwitchDeviceConfig } from '../type';
|
|
10
11
|
import Peer from './peer';
|
|
11
12
|
import Client from './client';
|
|
12
13
|
export default class Stream extends Emitter {
|
|
13
14
|
streams: IStreamConfig[];
|
|
14
15
|
initConfig: IStreamInitConfig;
|
|
15
|
-
initParams: IStreamInitParams;
|
|
16
16
|
currentMode: IStreamCurrent;
|
|
17
17
|
private client;
|
|
18
|
-
private
|
|
18
|
+
private audioAnalyser;
|
|
19
19
|
private logger;
|
|
20
20
|
private previewStreams;
|
|
21
21
|
private pipelineStreams;
|
|
22
22
|
private contentStreams;
|
|
23
23
|
private streamStatus;
|
|
24
24
|
private isShareContent;
|
|
25
|
-
private audioDeviceId;
|
|
26
|
-
private audioOutputDeviceId;
|
|
27
|
-
private videoDeviceId;
|
|
28
25
|
private isFirefox;
|
|
29
26
|
private enabledCapture;
|
|
30
27
|
private screenAudio;
|
|
28
|
+
private deviceManager;
|
|
31
29
|
constructor(params: {
|
|
32
30
|
logger: Logger;
|
|
33
|
-
client
|
|
31
|
+
client: Client;
|
|
34
32
|
});
|
|
35
33
|
static instance: Stream;
|
|
36
34
|
static getStreamInstance(params: {
|
|
37
35
|
logger: Logger;
|
|
38
|
-
client
|
|
36
|
+
client: Client;
|
|
39
37
|
}): Stream;
|
|
40
38
|
/**
|
|
41
39
|
* 获取基础的约束配置
|
|
@@ -57,7 +55,7 @@ export default class Stream extends Emitter {
|
|
|
57
55
|
* @param { MediaTrackConstraints } baseConstraint - 通过分辨率匹配的默认约束设置
|
|
58
56
|
* @returns { MediaTrackConstraints | boolean }
|
|
59
57
|
*/
|
|
60
|
-
static getCompatibleConstraints(enable: CaptureStatus, supportConstraints: any, baseConstraint
|
|
58
|
+
static getCompatibleConstraints(enable: CaptureStatus, supportConstraints: any, baseConstraint?: any): any;
|
|
61
59
|
/**
|
|
62
60
|
* 获取浏览器支持的约束配置字段
|
|
63
61
|
*
|
|
@@ -70,6 +68,12 @@ export default class Stream extends Emitter {
|
|
|
70
68
|
* @returns { IStreamConfig[] } 本地预览流
|
|
71
69
|
*/
|
|
72
70
|
getLocalStream(): IStreamConfig[];
|
|
71
|
+
/**
|
|
72
|
+
* 获取音量Analyser分析器
|
|
73
|
+
*
|
|
74
|
+
* @returns { AudioAnalyser } - 分析器实例
|
|
75
|
+
*/
|
|
76
|
+
getLocalAudioAnalyser(): AudioAnalyser | null;
|
|
73
77
|
getIndexFromStreamChange(stream: MediaStream, streamChangeInfo: IStreamChange[]): number;
|
|
74
78
|
/**
|
|
75
79
|
* stream 取消监听事件
|
|
@@ -92,17 +96,17 @@ export default class Stream extends Emitter {
|
|
|
92
96
|
*
|
|
93
97
|
* @param { string } deviceId - 设备id
|
|
94
98
|
*/
|
|
95
|
-
setAudioOutput(deviceId: string): Promise<{
|
|
99
|
+
setAudioOutput(deviceId: string, config?: SwitchDeviceConfig): Promise<{
|
|
96
100
|
deviceId: string;
|
|
97
101
|
}>;
|
|
98
102
|
/**
|
|
99
103
|
* 设备麦克风/摄像头切换
|
|
100
104
|
*
|
|
101
|
-
* @param {
|
|
105
|
+
* @param { DEVICE_KIND } type - 设备类型,可选:VIDEOINPUT,AUDIOINPUT,分别代表麦克风、摄像头设备
|
|
102
106
|
* @param { string } deviceId - 设备ID
|
|
103
107
|
* @returns { Promise<boolean> }
|
|
104
108
|
*/
|
|
105
|
-
switchDevice(type:
|
|
109
|
+
switchDevice(type: DEVICE_KIND, deviceId: string, config?: SwitchDeviceConfig): Promise<boolean>;
|
|
106
110
|
/**
|
|
107
111
|
* 重置StreamConfig状态为默认状态
|
|
108
112
|
*
|
|
@@ -142,12 +146,18 @@ export default class Stream extends Emitter {
|
|
|
142
146
|
close(): void;
|
|
143
147
|
private closeStreams;
|
|
144
148
|
getMediaStreams(): IGetMediaStreams;
|
|
149
|
+
/**
|
|
150
|
+
* 获取本地音频StreamConfig配置
|
|
151
|
+
*
|
|
152
|
+
* @returns { IStreamConfig } - 音频StreamConfig
|
|
153
|
+
*/
|
|
154
|
+
getAudioStreamConfig(): IStreamConfig | undefined;
|
|
145
155
|
/**
|
|
146
156
|
* 初始化视频流-v2
|
|
147
157
|
*
|
|
148
158
|
* @public
|
|
149
159
|
* @param { IStreamInitConfig } config 输入输出设备相关配置,默认是{}
|
|
150
|
-
* @param {
|
|
160
|
+
* @param { IStreamInitParams } params 可选参数
|
|
151
161
|
* @returns { IResult } 返回结果
|
|
152
162
|
*/
|
|
153
163
|
init(config?: IStreamInitConfig, params?: IStreamInitParams): Promise<any>;
|
|
@@ -245,10 +255,9 @@ export default class Stream extends Emitter {
|
|
|
245
255
|
* 获取约束设置
|
|
246
256
|
*
|
|
247
257
|
* @private
|
|
248
|
-
* @param { CaptureStatus } video 采集视频流状态
|
|
249
|
-
* @param { CaptureStatus } audio 采集音频流状态
|
|
250
|
-
* @param {
|
|
251
|
-
* @param { string } audioDeviceId 麦克风设备ID
|
|
258
|
+
* @param { CaptureStatus } video - 采集视频流状态
|
|
259
|
+
* @param { CaptureStatus } audio - 采集音频流状态
|
|
260
|
+
* @param { IStreamConfig | undefined } enableStreamConfig - Stream配置
|
|
252
261
|
* @returns
|
|
253
262
|
*/
|
|
254
263
|
private getInitConstraints;
|
|
@@ -284,7 +293,12 @@ export default class Stream extends Emitter {
|
|
|
284
293
|
* @param { StreamKind } kind - 流的类型
|
|
285
294
|
*/
|
|
286
295
|
private removeTracks;
|
|
287
|
-
|
|
296
|
+
/**
|
|
297
|
+
* 绑定Client实例
|
|
298
|
+
*
|
|
299
|
+
* @param { Client } client - Client实例模块
|
|
300
|
+
*/
|
|
301
|
+
bindClientInstance(client: Client): void;
|
|
288
302
|
/**
|
|
289
303
|
* 获取对应类型的StreamConfig
|
|
290
304
|
*
|
|
@@ -295,11 +309,23 @@ export default class Stream extends Emitter {
|
|
|
295
309
|
/**
|
|
296
310
|
* 通过采集到的stream更新对应的设备信息
|
|
297
311
|
*/
|
|
298
|
-
|
|
312
|
+
updateDeviceIdByStream(mediaStream: MediaStream | null): Promise<void>;
|
|
313
|
+
/**
|
|
314
|
+
* 切换低性能模式,重新采集&发送People和Content的能力
|
|
315
|
+
*/
|
|
316
|
+
processLowPerformance(): Promise<void>;
|
|
317
|
+
/**
|
|
318
|
+
* 根据MediaConfig动态调整StreamConfig能力
|
|
319
|
+
*/
|
|
320
|
+
private processStreamsLowPerformance;
|
|
321
|
+
/**
|
|
322
|
+
* 关闭视频流采集,重新启用采集流程采集最新的配置流
|
|
323
|
+
*/
|
|
324
|
+
private processPeopleLowPerformance;
|
|
299
325
|
/**
|
|
300
326
|
* 获取当前时刻音量大小,范围:0-100
|
|
301
327
|
*/
|
|
302
|
-
getAudioLevel(
|
|
328
|
+
getAudioLevel(): Promise<number>;
|
|
303
329
|
/**
|
|
304
330
|
* clear audio object
|
|
305
331
|
*/
|
|
@@ -5,41 +5,124 @@
|
|
|
5
5
|
* @author jinghui-Luo
|
|
6
6
|
*
|
|
7
7
|
* Created at : 2020-12-18 16:54:15
|
|
8
|
-
* Last modified : 2023-
|
|
8
|
+
* Last modified : 2023-09-12 17:23:20
|
|
9
9
|
*/
|
|
10
|
-
import Logger from '../tools/logger';
|
|
10
|
+
import Logger from '../tools/log/logger';
|
|
11
|
+
import { IRotationInfoTotalItem } from '../type';
|
|
11
12
|
declare class VideoManager {
|
|
12
13
|
videoEle: HTMLVideoElement | null;
|
|
13
14
|
state: '' | 'CANPLAY' | 'ENDED' | 'REQUEST';
|
|
14
|
-
private
|
|
15
|
-
private
|
|
15
|
+
private rosterId;
|
|
16
|
+
private viewId;
|
|
16
17
|
private cb;
|
|
17
18
|
private stream;
|
|
18
19
|
private streamId;
|
|
19
20
|
private loadStatus;
|
|
20
21
|
private streamStatus;
|
|
21
|
-
private
|
|
22
|
-
private
|
|
22
|
+
private streamStatusTimer;
|
|
23
|
+
private streamTimerCountDown;
|
|
23
24
|
private logger;
|
|
24
25
|
private isContent;
|
|
25
26
|
constructor(logger?: Logger, isContent?: boolean);
|
|
27
|
+
/**
|
|
28
|
+
* 获取rosterId信息
|
|
29
|
+
*/
|
|
30
|
+
getRosterId(): string;
|
|
26
31
|
/**
|
|
27
32
|
* client set video stream data
|
|
28
33
|
*
|
|
29
|
-
* @param
|
|
30
|
-
* @param stream MediaStream or null
|
|
34
|
+
* @param { string } rosterId - 参会者唯一ID,由roster中的id得到
|
|
35
|
+
* @param { MediaStream | null } stream - MediaStream or null
|
|
36
|
+
*/
|
|
37
|
+
setVideoStream(rosterId: string, stream: MediaStream | null): void;
|
|
38
|
+
/**
|
|
39
|
+
* 【副流渲染】绑定Stream数据
|
|
40
|
+
*
|
|
41
|
+
* @param { MediaStream | null } stream - MediaStream or null
|
|
42
|
+
*/
|
|
43
|
+
setSlaveVideoStream(stream: MediaStream | null): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* 获取MediaStream流上的所有Track数据
|
|
46
|
+
*
|
|
47
|
+
* @returns { MediaStreamTrack[] } - 轨道数据
|
|
31
48
|
*/
|
|
32
|
-
initVideoStreamById(key: string, stream: MediaStream | null): void;
|
|
33
49
|
getVideoTracks(): MediaStreamTrack[];
|
|
50
|
+
/**
|
|
51
|
+
* 重新绑定Track Event事件监听,发送最新的视频状态
|
|
52
|
+
*/
|
|
34
53
|
updateLocalTrack(): void;
|
|
54
|
+
/**
|
|
55
|
+
* 【副流渲染】计算新容器Video的旋转角度和宽高信息
|
|
56
|
+
*
|
|
57
|
+
* @param { IRotationInfoTotalItem | undefined } rotateInfo - RotationInfo信息
|
|
58
|
+
* @param { boolean } isLocal - 是否是Local设备
|
|
59
|
+
* @param { boolean | undefined } localMirror - 是否是本地镜像设置
|
|
60
|
+
*/
|
|
61
|
+
setVideoRotationStyle(rotateInfo: IRotationInfoTotalItem | undefined, isLocal: boolean, localMirror: boolean | undefined): void;
|
|
62
|
+
/**
|
|
63
|
+
* 绑定视频渲染容器,增加事件监听,并通过Video元素播放最新的MediaStream数据
|
|
64
|
+
*
|
|
65
|
+
* @param { string } viewId 包裹video组件的元素id,此元素一定要提供宽高信息,内部会基于此宽高信息计算video的旋转信息
|
|
66
|
+
*/
|
|
35
67
|
private initVideoSource;
|
|
68
|
+
/**
|
|
69
|
+
* 创建Video元素
|
|
70
|
+
*
|
|
71
|
+
* @param { HTMLElement } container - 容器节点信息
|
|
72
|
+
* @returns { HTMLVideoElement }
|
|
73
|
+
*/
|
|
74
|
+
private createVideoElement;
|
|
75
|
+
/**
|
|
76
|
+
* 绑定Video元素的视频流数据,并播放
|
|
77
|
+
*
|
|
78
|
+
* @param { string } streamId - MediaStream Id数据
|
|
79
|
+
*/
|
|
36
80
|
private setSrcObject;
|
|
81
|
+
/**
|
|
82
|
+
* 绑定Video事件
|
|
83
|
+
*
|
|
84
|
+
* @param { HTMLVideoElement } videoEle - Video元素
|
|
85
|
+
*/
|
|
37
86
|
private initEventListener;
|
|
87
|
+
/**
|
|
88
|
+
* 移除绑定Video事件
|
|
89
|
+
*
|
|
90
|
+
* @param { HTMLVideoElement } videoEle - Video元素
|
|
91
|
+
*/
|
|
38
92
|
private removeEventListener;
|
|
93
|
+
/**
|
|
94
|
+
* 绑定Track事件
|
|
95
|
+
*
|
|
96
|
+
* @param { MediaStream | null } stream - 流数据
|
|
97
|
+
*/
|
|
39
98
|
private initStreamTrackEventListener;
|
|
99
|
+
/**
|
|
100
|
+
* 移除绑定Track事件
|
|
101
|
+
*/
|
|
40
102
|
private removeStreamTrackEventListener;
|
|
41
|
-
|
|
42
|
-
|
|
103
|
+
/**
|
|
104
|
+
* Video元素是否绑定Stream数据
|
|
105
|
+
*
|
|
106
|
+
* @returns { boolean }
|
|
107
|
+
*/
|
|
108
|
+
private isHaveSrcObject;
|
|
109
|
+
/**
|
|
110
|
+
* 设置用户信息和渲染画面的视图信息,创建Video元素用于渲染画面
|
|
111
|
+
*
|
|
112
|
+
* @param { string } rosterId - 用户唯一ID,通过layout事件获取;
|
|
113
|
+
* @param { string } viewId - 渲染画面的视图容器ID
|
|
114
|
+
*/
|
|
115
|
+
setSource(rosterId: string, viewId: string): void;
|
|
116
|
+
/**
|
|
117
|
+
* 【副流渲染】设置用户信息和渲染画面的视图信息,创建Video元素用于渲染画面
|
|
118
|
+
*
|
|
119
|
+
* @param { string } rosterId - 用户唯一ID,通过layout事件获取;
|
|
120
|
+
* @param { string } viewId - 渲染画面的视图容器ID
|
|
121
|
+
*/
|
|
122
|
+
setSlaveSource(rosterId: string, viewId: string): void;
|
|
123
|
+
/**
|
|
124
|
+
* 销毁当前实例数据
|
|
125
|
+
*/
|
|
43
126
|
destroy(): void;
|
|
44
127
|
setVideoStatusChange(cb: any): void;
|
|
45
128
|
private onEnded;
|
|
@@ -50,7 +133,7 @@ declare class VideoManager {
|
|
|
50
133
|
private onUnmute;
|
|
51
134
|
private onWaiting;
|
|
52
135
|
private onCanPlay;
|
|
53
|
-
private
|
|
136
|
+
private clearTrackStatusTimer;
|
|
54
137
|
private sendVideoStatus;
|
|
55
138
|
private emmit;
|
|
56
139
|
}
|
|
@@ -1,23 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Audio
|
|
2
|
+
* Audio Analyser Class
|
|
3
3
|
*
|
|
4
4
|
* get audio level
|
|
5
5
|
*
|
|
6
6
|
* @authors Luo-jinghui (luojinghui424@gmail.com)
|
|
7
7
|
* @date 2019-11-08 16:03:15
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
import { AnalyserConfig } from '../type';
|
|
10
|
+
export declare class AudioAnalyser {
|
|
10
11
|
level: number;
|
|
11
12
|
private stream;
|
|
12
13
|
private audioContext;
|
|
13
14
|
private analyser;
|
|
14
15
|
private sourceNode;
|
|
15
16
|
private timeDomainData;
|
|
16
|
-
|
|
17
|
+
private fftSize;
|
|
18
|
+
private cardinalNumber;
|
|
19
|
+
constructor(stream: MediaStream, config?: AnalyserConfig);
|
|
20
|
+
init(): void;
|
|
21
|
+
/**
|
|
22
|
+
* 更新MediaStream数据,重新获取音量分析器
|
|
23
|
+
*/
|
|
24
|
+
updateMediaStream(stream: MediaStream): void;
|
|
17
25
|
/**
|
|
18
26
|
* 获取声音level数据。
|
|
19
27
|
* rang: 0-100
|
|
20
28
|
*/
|
|
21
29
|
getAudioLevel(): number;
|
|
22
|
-
init(): void;
|
|
23
30
|
}
|
package/lib/tools/browser.d.ts
CHANGED
|
@@ -1,55 +1,66 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Browser version tools
|
|
3
|
+
* platform/browser/version
|
|
3
4
|
*
|
|
4
5
|
* @authors Luo-jinghui (luojinghui424@gmail.com)
|
|
5
6
|
* @date 2020-02-21 16:29:12
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
} | undefined;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
8
|
+
declare class BrowserDetector {
|
|
9
|
+
static getPlatform(): {
|
|
10
|
+
isTablet: boolean;
|
|
11
|
+
isPhone: boolean;
|
|
12
|
+
isAndroid: boolean;
|
|
13
|
+
isPc: boolean;
|
|
14
|
+
isMac: boolean;
|
|
15
|
+
isWindows: boolean;
|
|
16
|
+
isIPad: boolean;
|
|
17
|
+
isChrome: boolean;
|
|
18
|
+
isLinux: boolean;
|
|
19
|
+
isFirefox: boolean;
|
|
20
|
+
isBaidu: boolean;
|
|
21
|
+
isQQ: boolean;
|
|
22
|
+
isOpera: boolean;
|
|
23
|
+
isZhazha: boolean;
|
|
24
|
+
isEdge: boolean;
|
|
25
|
+
isSafari: boolean;
|
|
26
|
+
isHuaweiBrowser: boolean;
|
|
27
|
+
isWeixin: boolean;
|
|
28
|
+
iswxwork: boolean;
|
|
29
|
+
isMiniProgram: boolean;
|
|
30
|
+
isWindowsWxWechat: boolean;
|
|
31
|
+
isWindowsWechat: boolean;
|
|
32
|
+
isTrident: boolean;
|
|
33
|
+
};
|
|
34
|
+
static getOperationSystem(): "" | "Windows WXWechat" | "Windows Wechat" | "Windows" | "iPhone" | "Android" | "iPad" | "Mac" | "Linux" | "MiniProgram";
|
|
35
|
+
static getBrowserName: () => "Firefox" | "Chrome" | "Safari" | "Edge" | "Opera" | "Internet Explorer" | "WindowsWechat" | "WindowsWxWechat" | "Weixin" | "WXWeixin" | "Tencent" | "Huawei" | "Other" | "Unknown";
|
|
36
|
+
static getChromeVersion(): {
|
|
37
|
+
major: any;
|
|
38
|
+
minor: any;
|
|
39
|
+
build: any;
|
|
40
|
+
patch: any;
|
|
41
|
+
} | undefined;
|
|
42
|
+
static getEdgeVersion(): {
|
|
43
|
+
major: any;
|
|
44
|
+
minor: any;
|
|
45
|
+
build: any;
|
|
46
|
+
} | undefined;
|
|
47
|
+
static getSafariVersion(): {
|
|
48
|
+
major: any;
|
|
49
|
+
minor: any;
|
|
50
|
+
} | undefined;
|
|
51
|
+
static getFirefoxVersion(): {
|
|
52
|
+
major: any;
|
|
53
|
+
minor: any;
|
|
54
|
+
} | undefined;
|
|
55
|
+
static getAndroidVersion(): {
|
|
56
|
+
major: any;
|
|
57
|
+
minor: any;
|
|
58
|
+
} | undefined;
|
|
59
|
+
static getIOSVersion(): {
|
|
60
|
+
major: any;
|
|
61
|
+
minor: any;
|
|
62
|
+
} | undefined;
|
|
63
|
+
static getWeixinVersion(): string | undefined;
|
|
64
|
+
static getWXWeixinVersion(): string | undefined;
|
|
65
|
+
}
|
|
66
|
+
export default BrowserDetector;
|
|
@@ -4,10 +4,9 @@
|
|
|
4
4
|
* @authors Luo-jinghui (luojinghui424@gmail.com)
|
|
5
5
|
* @date 2019-11-01 14:14:45
|
|
6
6
|
*/
|
|
7
|
-
import { AxiosRequestConfig, AxiosInstance } from 'axios';
|
|
8
|
-
import Logger from './logger';
|
|
7
|
+
import { AxiosRequestConfig, AxiosInstance, AxiosError } from 'axios';
|
|
8
|
+
import Logger from './log/logger';
|
|
9
9
|
import { IToken } from '../type';
|
|
10
|
-
import XyApiGatewaySDK from '@xylink/xy_api_gateway';
|
|
11
10
|
export interface IResponseSuccess {
|
|
12
11
|
code: number;
|
|
13
12
|
data: any;
|
|
@@ -29,8 +28,16 @@ declare class HttpClient {
|
|
|
29
28
|
private clientId;
|
|
30
29
|
private clientSecret;
|
|
31
30
|
private retryCount;
|
|
32
|
-
|
|
31
|
+
private nua;
|
|
32
|
+
private xyApiGatewaySDK;
|
|
33
33
|
constructor(commonOption: IAxiosRequestConfig);
|
|
34
|
+
/**
|
|
35
|
+
* 获取SDK n-ua 信息
|
|
36
|
+
*
|
|
37
|
+
* @param { string } version - SDK版本号
|
|
38
|
+
* @returns { string } n-ua
|
|
39
|
+
*/
|
|
40
|
+
private getNuaInfo;
|
|
34
41
|
getTokenInfo(): any;
|
|
35
42
|
setTokenInfo(tokenInfo: IToken | null): void;
|
|
36
43
|
setLogger(logger: Logger): void;
|
|
@@ -39,12 +46,26 @@ declare class HttpClient {
|
|
|
39
46
|
clientId: string;
|
|
40
47
|
clientSecret: string;
|
|
41
48
|
}): void;
|
|
42
|
-
initXyApiGatewaySDK
|
|
43
|
-
setSignHeader
|
|
49
|
+
private initXyApiGatewaySDK;
|
|
50
|
+
private setSignHeader;
|
|
44
51
|
refreshToken({ baseURL, refresh_token }: {
|
|
45
52
|
baseURL?: string | undefined;
|
|
46
53
|
refresh_token?: string | undefined;
|
|
47
54
|
}): Promise<any>;
|
|
55
|
+
/**
|
|
56
|
+
* 处理网关时间戳过期
|
|
57
|
+
*
|
|
58
|
+
* @param { AxiosError } error - response
|
|
59
|
+
* @returns { AxiosRequestConfig | null }
|
|
60
|
+
*/
|
|
61
|
+
handleGatewayTimestampExpired(error: AxiosError): Promise<AxiosRequestConfig | null>;
|
|
62
|
+
/**
|
|
63
|
+
* token失效,刷新token
|
|
64
|
+
*
|
|
65
|
+
* @param { AxiosError } error - response
|
|
66
|
+
* @returns
|
|
67
|
+
*/
|
|
68
|
+
handleTokenExpired(error: AxiosError): Promise<AxiosRequestConfig>;
|
|
48
69
|
assignOptions: (option?: AxiosRequestConfig) => IAxiosRequestConfig & AxiosRequestConfig & {
|
|
49
70
|
params: any;
|
|
50
71
|
};
|
package/lib/tools/index.d.ts
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* 辅助工具函数:设置Audio元素的输出设备
|
|
3
3
|
*
|
|
4
|
-
* @param {
|
|
4
|
+
* @param { HTMLAudioElement } element - Audio元素节点
|
|
5
|
+
* @param { string } deviceId - 指定设备ID,如果指定错误,则使用系统默认设备
|
|
5
6
|
*/
|
|
6
|
-
declare const
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
declare const setOutputAudioDevice: (element: any, deviceId: string) => Promise<void>;
|
|
8
|
+
/**
|
|
9
|
+
* 转换HideId隐身入会字段
|
|
10
|
+
*
|
|
11
|
+
* @param { string } hideId - HiedId隐藏入会配置
|
|
12
|
+
* @returns { string } hideId
|
|
13
|
+
*/
|
|
14
|
+
declare const getHideId: (hideId: string | number) => string;
|
|
15
|
+
export { setOutputAudioDevice, getHideId };
|
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
* @authors Luo-jinghui (luojinghui424@gmail.com)
|
|
6
6
|
* @date 2019-10-22 20:08:33
|
|
7
7
|
*/
|
|
8
|
-
import { LogLevel, ILoggerConfig, TLogLevel } from '
|
|
8
|
+
import { LogLevel, ILoggerConfig, TLogLevel, UploadLogParams } from '../../type';
|
|
9
9
|
declare class Logger {
|
|
10
|
+
private action;
|
|
10
11
|
private worker;
|
|
11
12
|
private isArrowUpload;
|
|
12
13
|
currentLevel: LogLevel;
|
|
@@ -17,14 +18,19 @@ declare class Logger {
|
|
|
17
18
|
[key: string]: any;
|
|
18
19
|
};
|
|
19
20
|
constructor(config: ILoggerConfig);
|
|
21
|
+
/**
|
|
22
|
+
* 获取日志模块配置
|
|
23
|
+
*
|
|
24
|
+
* @returns { ILoggerConfig } - 日志模块配置
|
|
25
|
+
*/
|
|
26
|
+
getConfig(): ILoggerConfig;
|
|
20
27
|
/**
|
|
21
28
|
* 启动日志模块
|
|
22
29
|
*
|
|
23
|
-
* @param { ILoggerConfig? } config - Logger配置
|
|
24
30
|
* @param { boolean } enableClearTable - 是否清理表
|
|
25
31
|
* @returns { boolean }
|
|
26
32
|
*/
|
|
27
|
-
start(enableClearTable?: boolean): true | "The log module is already enabled, please stop it first";
|
|
33
|
+
start(enableClearTable?: boolean | undefined): true | "The log module is already enabled, please stop it first";
|
|
28
34
|
/**
|
|
29
35
|
* 接收WebWorker线程消息
|
|
30
36
|
*
|
|
@@ -134,12 +140,11 @@ declare class Logger {
|
|
|
134
140
|
/**
|
|
135
141
|
* 上传日志到小鱼Devops平台
|
|
136
142
|
*
|
|
137
|
-
* @param {
|
|
138
|
-
* @param {
|
|
139
|
-
* @param { string } comments 上传时备注信息
|
|
143
|
+
* @param { UploadLogParams } config - 日志上传参数
|
|
144
|
+
* @param { Blob } blob - 日志Blob数据
|
|
140
145
|
* @returns { boolean } 上传结果
|
|
141
146
|
*/
|
|
142
|
-
uploadLogProcess(config:
|
|
147
|
+
uploadLogProcess(config: UploadLogParams, blob: Blob): Promise<any>;
|
|
143
148
|
/**
|
|
144
149
|
* 允许日志上传
|
|
145
150
|
*/
|
|
@@ -148,5 +153,11 @@ declare class Logger {
|
|
|
148
153
|
* 禁用日志上传
|
|
149
154
|
*/
|
|
150
155
|
disableLogUpload(): void;
|
|
156
|
+
/**
|
|
157
|
+
* 获取日志数据
|
|
158
|
+
*
|
|
159
|
+
* @returns
|
|
160
|
+
*/
|
|
161
|
+
getLogData(): Promise<unknown>;
|
|
151
162
|
}
|
|
152
163
|
export default Logger;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import Logger from './logger';
|
|
2
|
+
import { ILoggerConfig, UploadLogParams } from '../../type';
|
|
3
|
+
declare class LogManager {
|
|
4
|
+
private logMap;
|
|
5
|
+
private static instance;
|
|
6
|
+
private action;
|
|
7
|
+
constructor();
|
|
8
|
+
static getInstance(): LogManager;
|
|
9
|
+
/**
|
|
10
|
+
* 根据数据库名称获取对应的日志库
|
|
11
|
+
*
|
|
12
|
+
* @param { string } dbName - 日志库名称
|
|
13
|
+
* @returns { Logger } - 对应的日质库
|
|
14
|
+
*/
|
|
15
|
+
getLogger(dbName: string): Logger | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* 销毁日志模块
|
|
18
|
+
*
|
|
19
|
+
* @param { string } dbName - 日志库名称,默认不传,销毁所有日志模块
|
|
20
|
+
*/
|
|
21
|
+
destroy(dbName?: string): void;
|
|
22
|
+
/**
|
|
23
|
+
* 停止日志模块
|
|
24
|
+
*
|
|
25
|
+
* @param { string } dbName - 日志库名称,默认不传,停止所有日志模块
|
|
26
|
+
*/
|
|
27
|
+
stop(dbName?: string): void;
|
|
28
|
+
/**
|
|
29
|
+
* 创建单个日志库
|
|
30
|
+
*
|
|
31
|
+
* @param { ILoggerConfig } config - 日志模块配置
|
|
32
|
+
* @returns { Logger } - 日志库
|
|
33
|
+
*/
|
|
34
|
+
createLogger(config: ILoggerConfig): Logger;
|
|
35
|
+
/**
|
|
36
|
+
* 设置日志上传地址
|
|
37
|
+
*
|
|
38
|
+
* @param { string } logServer - 日志上传服务器地址
|
|
39
|
+
* @param { string } dbName - 日志库名称
|
|
40
|
+
*/
|
|
41
|
+
setLogServer(logServer?: string, dbName?: string): void;
|
|
42
|
+
/**
|
|
43
|
+
* 下载日志
|
|
44
|
+
*
|
|
45
|
+
* @param { string } dbName - 日志库名称,默认不传,下载所有日志
|
|
46
|
+
* @returns { boolean } - 上传结果
|
|
47
|
+
*/
|
|
48
|
+
downloadLog(dbName?: string): Promise<boolean>;
|
|
49
|
+
/**
|
|
50
|
+
* 上传日志
|
|
51
|
+
*
|
|
52
|
+
* @param { UploadLogParams } params - 参数
|
|
53
|
+
* @property { string } params.name - 上传文件名
|
|
54
|
+
* @property { string } params.account - 上传账号
|
|
55
|
+
* @property { string } params.comments - 上传时备注信息
|
|
56
|
+
* @property { string } params.dbName - 日志库名称,默认不传,上传所有日志
|
|
57
|
+
* @returns { boolean } - 上传结果
|
|
58
|
+
*/
|
|
59
|
+
uploadLog({ name, account, comments, dbName }: UploadLogParams): Promise<any>;
|
|
60
|
+
/**
|
|
61
|
+
* 导出所有日志库Blob数据
|
|
62
|
+
*
|
|
63
|
+
* @returns { Promise<Blob> } - 多个日志库合并后的blob数据
|
|
64
|
+
*/
|
|
65
|
+
private exportAllBlob;
|
|
66
|
+
}
|
|
67
|
+
declare const logManager: LogManager;
|
|
68
|
+
export default LogManager;
|
|
69
|
+
export { logManager };
|