@polyv/socket 2.0.0-rc-20250925.1 → 2.1.0-rc-20251023.1
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/index.cjs.js +6 -6
- package/index.es.d.ts +26 -9
- package/index.es.js +2002 -1939
- package/index.umd.js +6 -6
- package/package.json +10 -10
package/index.es.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AppSignSecretKey } from '@polyv/request-plugin-authorize-app-sign';
|
|
2
|
+
import { AuthorizeAppSignRequestOptions } from '@polyv/request-plugin-authorize-app-sign';
|
|
2
3
|
import { EventEmitter } from '@polyv/utils/es/event';
|
|
3
4
|
import { GetAppSignFn } from '@polyv/request-plugin-authorize-app-sign';
|
|
4
5
|
import { PickDomainInfo } from '@polyv/request-plugin-polyv-business';
|
|
@@ -7,6 +8,8 @@ import { RequestOptions } from '@polyv/request-core';
|
|
|
7
8
|
import { SignatureMethod } from '@polyv/request-plugin-authorize-app-sign';
|
|
8
9
|
import { SM2Key } from '@polyv/request-plugin-sm2';
|
|
9
10
|
|
|
11
|
+
export { AuthorizeAppSignRequestOptions }
|
|
12
|
+
|
|
10
13
|
/**
|
|
11
14
|
* 频道信息
|
|
12
15
|
*/
|
|
@@ -36,9 +39,10 @@ declare class ChatApiRequest extends PolyvRequest<ChatApiRequestOptions> {
|
|
|
36
39
|
private _plvSocket;
|
|
37
40
|
constructor(_plvSocket: PolyvSocket);
|
|
38
41
|
/**
|
|
39
|
-
*
|
|
42
|
+
* 获取房间号签名
|
|
40
43
|
*/
|
|
41
|
-
|
|
44
|
+
getRoomSign(): Promise<string | undefined>;
|
|
45
|
+
getChatSign(params: Record<string, unknown>): Promise<string | undefined>;
|
|
42
46
|
}
|
|
43
47
|
|
|
44
48
|
declare interface ChatApiRequestOptions extends RequestOptions {
|
|
@@ -62,6 +66,11 @@ declare interface ChatApiRequestOptions extends RequestOptions {
|
|
|
62
66
|
* @default false
|
|
63
67
|
*/
|
|
64
68
|
appendSign?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* 插入聊天室签名
|
|
71
|
+
* @default false
|
|
72
|
+
*/
|
|
73
|
+
appendChatSign?: boolean;
|
|
65
74
|
}
|
|
66
75
|
|
|
67
76
|
/**
|
|
@@ -91,10 +100,15 @@ export declare type EventHandler = (msg: any) => unknown;
|
|
|
91
100
|
/** 事件 key */
|
|
92
101
|
export declare type EventKey = string;
|
|
93
102
|
|
|
94
|
-
export declare type
|
|
103
|
+
export declare type MaybePromiseFn<R> = () => Promise<R> | R;
|
|
95
104
|
|
|
96
105
|
declare class PolyvApiRequest extends PolyvRequest<PolyvApiRequestOptions> {
|
|
106
|
+
private _plvSocket;
|
|
97
107
|
constructor(_plvSocket: PolyvSocket);
|
|
108
|
+
/**
|
|
109
|
+
* 根据用户类型获取 token 字段
|
|
110
|
+
*/
|
|
111
|
+
getTokenFieldByUserType(): Promise<string>;
|
|
98
112
|
}
|
|
99
113
|
|
|
100
114
|
declare interface PolyvApiRequestOptions extends RequestOptions {
|
|
@@ -103,6 +117,7 @@ declare interface PolyvApiRequestOptions extends RequestOptions {
|
|
|
103
117
|
export declare class PolyvSocket extends PolyvSocketBase {
|
|
104
118
|
ConnectFailReason: typeof ConnectFailReason;
|
|
105
119
|
SocketUserType: typeof SocketUserType;
|
|
120
|
+
PolyvSocketEvent: typeof PolyvSocketEvent;
|
|
106
121
|
/**
|
|
107
122
|
* 聊天室 api 请求器
|
|
108
123
|
*/
|
|
@@ -159,7 +174,7 @@ declare class PolyvSocketBase {
|
|
|
159
174
|
/**
|
|
160
175
|
* 获取连接令牌
|
|
161
176
|
*/
|
|
162
|
-
getToken(): Promise<string>;
|
|
177
|
+
getToken(): Promise<string | undefined>;
|
|
163
178
|
/**
|
|
164
179
|
* 获取频道信息
|
|
165
180
|
*/
|
|
@@ -167,7 +182,7 @@ declare class PolyvSocketBase {
|
|
|
167
182
|
/**
|
|
168
183
|
* 获取用户信息
|
|
169
184
|
*/
|
|
170
|
-
getUserInfo():
|
|
185
|
+
getUserInfo(): UserInfo;
|
|
171
186
|
getSocket(check?: true): SocketInstance;
|
|
172
187
|
getSocket(check: false): SocketInstance | undefined;
|
|
173
188
|
/**
|
|
@@ -213,7 +228,7 @@ export declare interface PolyvSocketConfig {
|
|
|
213
228
|
/**
|
|
214
229
|
* 连接令牌
|
|
215
230
|
*/
|
|
216
|
-
token
|
|
231
|
+
token?: string;
|
|
217
232
|
/**
|
|
218
233
|
* 频道信息
|
|
219
234
|
*/
|
|
@@ -221,7 +236,7 @@ export declare interface PolyvSocketConfig {
|
|
|
221
236
|
/**
|
|
222
237
|
* 用户信息
|
|
223
238
|
*/
|
|
224
|
-
userInfo: UserInfo;
|
|
239
|
+
userInfo: UserInfo | (() => UserInfo);
|
|
225
240
|
/**
|
|
226
241
|
* 域名信息
|
|
227
242
|
*/
|
|
@@ -248,11 +263,11 @@ export declare interface PolyvSocketConfig {
|
|
|
248
263
|
/**
|
|
249
264
|
* 获取用户令牌信息
|
|
250
265
|
*/
|
|
251
|
-
getViewerToken?:
|
|
266
|
+
getViewerToken?: MaybePromiseFn<ViewerTokenData>;
|
|
252
267
|
/**
|
|
253
268
|
* 获取频道令牌信息
|
|
254
269
|
*/
|
|
255
|
-
getChannelToken?:
|
|
270
|
+
getChannelToken?: MaybePromiseFn<ChannelTokenData>;
|
|
256
271
|
/**
|
|
257
272
|
* 授权方式
|
|
258
273
|
* @default RequestAuthorizeMethod.Token
|
|
@@ -356,6 +371,8 @@ export declare enum SecurityMode {
|
|
|
356
371
|
SM2 = "sm2"
|
|
357
372
|
}
|
|
358
373
|
|
|
374
|
+
export { SignatureMethod }
|
|
375
|
+
|
|
359
376
|
/**
|
|
360
377
|
* socket 的事件处理集合
|
|
361
378
|
*/
|