@fgz/wxmini-sdk 1.0.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/README.md +84 -0
- package/dist/index.cjs +1813 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +887 -0
- package/dist/index.d.ts +887 -0
- package/dist/index.js +1767 -0
- package/dist/index.js.map +1 -0
- package/package.json +40 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,887 @@
|
|
|
1
|
+
import { ClassConstructor } from 'class-transformer';
|
|
2
|
+
|
|
3
|
+
declare class CsonBean {
|
|
4
|
+
static OBJECT_TYPE_FIELD_NAME: string;
|
|
5
|
+
getJavaType(): string;
|
|
6
|
+
getSimpleTypeName(removeDtoSuffix?: boolean): string;
|
|
7
|
+
_OBJECT_TYPE_: string;
|
|
8
|
+
getObjectType(): string;
|
|
9
|
+
setObjectType(type: string): CsonBean;
|
|
10
|
+
_extJsonMap: {
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
} | undefined;
|
|
13
|
+
getExtJsonMap(): {
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
} | undefined;
|
|
16
|
+
setExtJsonMap(extMap: {
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
} | undefined): void;
|
|
19
|
+
constructor();
|
|
20
|
+
}
|
|
21
|
+
declare class CsonPojo extends CsonBean {
|
|
22
|
+
}
|
|
23
|
+
declare class FeException extends CsonPojo {
|
|
24
|
+
static JAVA_TYPE: string;
|
|
25
|
+
getJavaType(): string;
|
|
26
|
+
constructor(err?: string, detail?: string);
|
|
27
|
+
err: string | undefined;
|
|
28
|
+
detail: string | undefined;
|
|
29
|
+
toString(): string;
|
|
30
|
+
}
|
|
31
|
+
declare class FeJavaException extends FeException {
|
|
32
|
+
static JAVA_TYPE: string;
|
|
33
|
+
getJavaType(): string;
|
|
34
|
+
constructor(err?: string, detail?: string);
|
|
35
|
+
}
|
|
36
|
+
declare class CRpcFeCmd extends CsonPojo {
|
|
37
|
+
static JAVA_TYPE: string;
|
|
38
|
+
getJavaType(): string;
|
|
39
|
+
reqId: number | undefined;
|
|
40
|
+
service: string | undefined;
|
|
41
|
+
func: string | undefined;
|
|
42
|
+
params: any[] | undefined;
|
|
43
|
+
}
|
|
44
|
+
declare class CRpcFeRsp extends CsonPojo {
|
|
45
|
+
static JAVA_TYPE: string;
|
|
46
|
+
getJavaType(): string;
|
|
47
|
+
resultJson: string | undefined;
|
|
48
|
+
error: any | undefined;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
declare class SystemCallback extends CsonPojo {
|
|
52
|
+
static JAVA_TYPE: string;
|
|
53
|
+
getJavaType(): string;
|
|
54
|
+
timeout: number | undefined;
|
|
55
|
+
static readonly FIELD_timeout: string;
|
|
56
|
+
static debugChannel: Boolean;
|
|
57
|
+
static readonly DECLARED_FIELDS: string[];
|
|
58
|
+
}
|
|
59
|
+
declare class FePojo extends CsonPojo {
|
|
60
|
+
static JAVA_TYPE: string;
|
|
61
|
+
getJavaType(): string;
|
|
62
|
+
userObject: Object | undefined;
|
|
63
|
+
static readonly FIELD_userObject: string;
|
|
64
|
+
userPojo: CsonPojo | undefined;
|
|
65
|
+
static readonly FIELD_userPojo: string;
|
|
66
|
+
binaryData: Uint8Array | undefined;
|
|
67
|
+
static readonly FIELD_binaryData: string;
|
|
68
|
+
static readonly DECLARED_FIELDS: string[];
|
|
69
|
+
}
|
|
70
|
+
declare class NullPojo extends FePojo {
|
|
71
|
+
static JAVA_TYPE: string;
|
|
72
|
+
getJavaType(): string;
|
|
73
|
+
static readonly DECLARED_FIELDS: string[];
|
|
74
|
+
}
|
|
75
|
+
declare class ValuePojo extends FePojo {
|
|
76
|
+
static JAVA_TYPE: string;
|
|
77
|
+
getJavaType(): string;
|
|
78
|
+
value: Object | undefined;
|
|
79
|
+
static readonly FIELD_value: string;
|
|
80
|
+
static readonly DECLARED_FIELDS: string[];
|
|
81
|
+
}
|
|
82
|
+
declare class BinBlock extends CsonPojo {
|
|
83
|
+
static JAVA_TYPE: string;
|
|
84
|
+
getJavaType(): string;
|
|
85
|
+
id: number | undefined;
|
|
86
|
+
static readonly FIELD_id: string;
|
|
87
|
+
start: number | undefined;
|
|
88
|
+
static readonly FIELD_start: string;
|
|
89
|
+
end: number | undefined;
|
|
90
|
+
static readonly FIELD_end: string;
|
|
91
|
+
extByteArray: Uint8Array | undefined;
|
|
92
|
+
static readonly FIELD_extByteArray: string;
|
|
93
|
+
static readonly DECLARED_FIELDS: string[];
|
|
94
|
+
}
|
|
95
|
+
declare class PartitionTable extends CsonPojo {
|
|
96
|
+
static JAVA_TYPE: string;
|
|
97
|
+
getJavaType(): string;
|
|
98
|
+
callbackBridgeChannel: number | undefined;
|
|
99
|
+
static readonly FIELD_callbackBridgeChannel: string;
|
|
100
|
+
bodyLength: number | undefined;
|
|
101
|
+
static readonly FIELD_bodyLength: string;
|
|
102
|
+
lstBin: Array<BinBlock> | undefined;
|
|
103
|
+
static readonly FIELD_lstBin: string;
|
|
104
|
+
static readonly DECLARED_FIELDS: string[];
|
|
105
|
+
}
|
|
106
|
+
declare class FeAbilityExecuteException extends FeException {
|
|
107
|
+
static JAVA_TYPE: string;
|
|
108
|
+
getJavaType(): string;
|
|
109
|
+
ability: CsonPojo | undefined;
|
|
110
|
+
static readonly FIELD_ability: string;
|
|
111
|
+
static readonly DECLARED_FIELDS: string[];
|
|
112
|
+
}
|
|
113
|
+
declare class FeWxMiniCmdException extends FeAbilityExecuteException {
|
|
114
|
+
static JAVA_TYPE: string;
|
|
115
|
+
getJavaType(): string;
|
|
116
|
+
wxMiniServerUrl: string | undefined;
|
|
117
|
+
static readonly FIELD_wxMiniServerUrl: string;
|
|
118
|
+
wxMiniAppUuid: string | undefined;
|
|
119
|
+
static readonly FIELD_wxMiniAppUuid: string;
|
|
120
|
+
static readonly DECLARED_FIELDS: string[];
|
|
121
|
+
}
|
|
122
|
+
declare class WxMiniBridgeCommand extends CsonPojo {
|
|
123
|
+
static JAVA_TYPE: string;
|
|
124
|
+
getJavaType(): string;
|
|
125
|
+
debugAppUuid: string | undefined;
|
|
126
|
+
static readonly FIELD_debugAppUuid: string;
|
|
127
|
+
appId: string | undefined;
|
|
128
|
+
static readonly FIELD_appId: string;
|
|
129
|
+
cmd: string | undefined;
|
|
130
|
+
static readonly FIELD_cmd: string;
|
|
131
|
+
params: Map<string, string | null> | undefined;
|
|
132
|
+
static readonly FIELD_params: string;
|
|
133
|
+
extHeaders: Map<string, string | null> | undefined;
|
|
134
|
+
static readonly FIELD_extHeaders: string;
|
|
135
|
+
waitOnlineTimeoutS: number | undefined;
|
|
136
|
+
static readonly FIELD_waitOnlineTimeoutS: string;
|
|
137
|
+
timeoutS: number | undefined;
|
|
138
|
+
static readonly FIELD_timeoutS: string;
|
|
139
|
+
static readonly DECLARED_FIELDS: string[];
|
|
140
|
+
}
|
|
141
|
+
declare class WxMiniCommand extends SystemCallback {
|
|
142
|
+
static JAVA_TYPE: string;
|
|
143
|
+
getJavaType(): string;
|
|
144
|
+
debugHttpUrl: string | undefined;
|
|
145
|
+
static readonly FIELD_debugHttpUrl: string;
|
|
146
|
+
debugAppUuid: string | undefined;
|
|
147
|
+
static readonly FIELD_debugAppUuid: string;
|
|
148
|
+
cmd: string | undefined;
|
|
149
|
+
static readonly FIELD_cmd: string;
|
|
150
|
+
params: Map<string, string | null> | undefined;
|
|
151
|
+
static readonly FIELD_params: string;
|
|
152
|
+
extHeaders: Map<string, string | null> | undefined;
|
|
153
|
+
static readonly FIELD_extHeaders: string;
|
|
154
|
+
waitOnlineTimeoutS: number | undefined;
|
|
155
|
+
static readonly FIELD_waitOnlineTimeoutS: string;
|
|
156
|
+
static readonly PARAM_URL: string;
|
|
157
|
+
static readonly PARAM_TITLE: string;
|
|
158
|
+
static readonly PARAM_ICON_TYPE: string;
|
|
159
|
+
static readonly PARAM_MESSAGE: string;
|
|
160
|
+
static readonly PARAM_BUTTON: string;
|
|
161
|
+
static readonly PARAM_REJECT_BUTTON: string;
|
|
162
|
+
static readonly PARAM_FILE_PATH: string;
|
|
163
|
+
static readonly DATA_FIELD_IN_MAP: string;
|
|
164
|
+
static readonly getUserProfile_TITLE: string;
|
|
165
|
+
static readonly getUserProfile_ICON_TYPE: string;
|
|
166
|
+
static readonly getUserProfile_MESSAGE: string;
|
|
167
|
+
static readonly getUserProfile_BUTTON: string;
|
|
168
|
+
static readonly getUserProfile_QUERY_TYPE: string;
|
|
169
|
+
static readonly getUserProfile_ORG_AVATAR_URL64: string;
|
|
170
|
+
static readonly getUserProfile_ORG_NICK: string;
|
|
171
|
+
static readonly getPhoneNum_TITLE: string;
|
|
172
|
+
static readonly getPhoneNum_ICON_TYPE: string;
|
|
173
|
+
static readonly getPhoneNum_MESSAGE: string;
|
|
174
|
+
static readonly getPhoneNum_BUTTON: string;
|
|
175
|
+
static readonly getPhoneNum_REJECT_BUTTON: string;
|
|
176
|
+
static readonly makePhoneCall_phoneNum: string;
|
|
177
|
+
static readonly PARAM_count: string;
|
|
178
|
+
static readonly PARAM_mediaType: string;
|
|
179
|
+
static readonly PARAM_sourceType: string;
|
|
180
|
+
static readonly PARAM_maxDuration: string;
|
|
181
|
+
static readonly PARAM_sizeType: string;
|
|
182
|
+
static readonly PARAM_camera: string;
|
|
183
|
+
static readonly MEDIATYPE_image: string;
|
|
184
|
+
static readonly MEDIATYPE_video: string;
|
|
185
|
+
static readonly MEDIATYPE_mix: string;
|
|
186
|
+
static readonly SOURCETYPE_album: string;
|
|
187
|
+
static readonly SOURCETYPE_camera: string;
|
|
188
|
+
static readonly SIZETYPE_original: string;
|
|
189
|
+
static readonly SIZETYPE_compressed: string;
|
|
190
|
+
static readonly CAMERA_back: string;
|
|
191
|
+
static readonly CAMERA_front: string;
|
|
192
|
+
static readonly PARAM_delta: string;
|
|
193
|
+
static readonly PARAM_UPLOAD_FILE_NAME: string;
|
|
194
|
+
static readonly PARAM_UPLOAD_FORM_DATA: string;
|
|
195
|
+
static readonly PARAM_SHARE_FILE_NAME: string;
|
|
196
|
+
static readonly PARAM_MAP_JSON: string;
|
|
197
|
+
static readonly PARAM_APPEND: string;
|
|
198
|
+
static readonly PARAM_OPENIT: string;
|
|
199
|
+
static readonly PARAM_LOCATION: string;
|
|
200
|
+
static readonly PARAM_COUNT: string;
|
|
201
|
+
static readonly PARAM_TYPE: string;
|
|
202
|
+
static readonly PARAM_EXTENSION: string;
|
|
203
|
+
static readonly PARAM_sharePage: string;
|
|
204
|
+
static readonly PARAM_path: string;
|
|
205
|
+
static readonly PARAM_style: string;
|
|
206
|
+
static readonly PARAM_needShowEntrance: string;
|
|
207
|
+
static readonly PARAM_entrancePath: string;
|
|
208
|
+
static readonly CLIP_BOARD_DATA: string;
|
|
209
|
+
static readonly DECLARED_FIELDS: string[];
|
|
210
|
+
}
|
|
211
|
+
declare class WxMiniConfigDto extends CsonPojo {
|
|
212
|
+
static JAVA_TYPE: string;
|
|
213
|
+
getJavaType(): string;
|
|
214
|
+
wxMiniServerUrl: string | undefined;
|
|
215
|
+
static readonly FIELD_wxMiniServerUrl: string;
|
|
216
|
+
wxMiniAppUuid: string | undefined;
|
|
217
|
+
static readonly FIELD_wxMiniAppUuid: string;
|
|
218
|
+
sceneFromWxMiniParams: string | undefined;
|
|
219
|
+
static readonly FIELD_sceneFromWxMiniParams: string;
|
|
220
|
+
initalQueryParameters: Map<string, any> | undefined;
|
|
221
|
+
static readonly FIELD_initalQueryParameters: string;
|
|
222
|
+
static readonly DECLARED_FIELDS: string[];
|
|
223
|
+
}
|
|
224
|
+
declare class QueryWxMiniParam extends SystemCallback {
|
|
225
|
+
static JAVA_TYPE: string;
|
|
226
|
+
getJavaType(): string;
|
|
227
|
+
static readonly DECLARED_FIELDS: string[];
|
|
228
|
+
}
|
|
229
|
+
declare class QuerySceneFromWxMiniParams extends SystemCallback {
|
|
230
|
+
static JAVA_TYPE: string;
|
|
231
|
+
getJavaType(): string;
|
|
232
|
+
static readonly DECLARED_FIELDS: string[];
|
|
233
|
+
}
|
|
234
|
+
declare class CRpcCallbackCmd extends CsonPojo {
|
|
235
|
+
static JAVA_TYPE: string;
|
|
236
|
+
getJavaType(): string;
|
|
237
|
+
reqId: number | undefined;
|
|
238
|
+
static readonly FIELD_reqId: string;
|
|
239
|
+
data: CsonPojo | undefined;
|
|
240
|
+
static readonly FIELD_data: string;
|
|
241
|
+
static readonly DECLARED_FIELDS: string[];
|
|
242
|
+
}
|
|
243
|
+
declare class CRpcCallbackRsp extends CsonPojo {
|
|
244
|
+
static JAVA_TYPE: string;
|
|
245
|
+
getJavaType(): string;
|
|
246
|
+
reqId: number | undefined;
|
|
247
|
+
static readonly FIELD_reqId: string;
|
|
248
|
+
result: CsonPojo | undefined;
|
|
249
|
+
static readonly FIELD_result: string;
|
|
250
|
+
static readonly DECLARED_FIELDS: string[];
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
declare enum PingStatus {
|
|
254
|
+
success = 0,
|
|
255
|
+
failed = 1,
|
|
256
|
+
timeout = 2,
|
|
257
|
+
none = 3
|
|
258
|
+
}
|
|
259
|
+
declare class PingResult {
|
|
260
|
+
constructor(status?: PingStatus, error?: any);
|
|
261
|
+
status: PingStatus;
|
|
262
|
+
error?: any;
|
|
263
|
+
}
|
|
264
|
+
type RpcResponseFuncType = (data: Uint8Array, isCompressed: boolean) => void;
|
|
265
|
+
declare class WebSocketError extends Error {
|
|
266
|
+
constructor(msg: string);
|
|
267
|
+
}
|
|
268
|
+
declare class WebSocketConnectError extends Error {
|
|
269
|
+
name: string;
|
|
270
|
+
cause?: unknown;
|
|
271
|
+
constructor(msg: string, options?: {
|
|
272
|
+
cause?: unknown;
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
interface ConnectOptions {
|
|
276
|
+
loopRetry: boolean;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* 服务端回调处理器接口
|
|
280
|
+
*
|
|
281
|
+
* 用于处理来自服务端的回调请求。使用方需要实现此接口来处理
|
|
282
|
+
* SystemCallback 和 PanelCallback 等回调。
|
|
283
|
+
*/
|
|
284
|
+
interface ServerCallbackHandler {
|
|
285
|
+
handleCallback(data: CsonPojo): Promise<any>;
|
|
286
|
+
}
|
|
287
|
+
declare const clients: Set<WsClient>;
|
|
288
|
+
declare class WsClient {
|
|
289
|
+
private socket;
|
|
290
|
+
private url;
|
|
291
|
+
private _callbackHandler;
|
|
292
|
+
getSocket(): WebSocket | null;
|
|
293
|
+
getUrl(): string;
|
|
294
|
+
/**
|
|
295
|
+
* 设置服务端回调处理器
|
|
296
|
+
*/
|
|
297
|
+
setCallbackHandler(handler: ServerCallbackHandler): void;
|
|
298
|
+
static _maskZipFlag: number;
|
|
299
|
+
static _typeBinRpcRSP: number;
|
|
300
|
+
static _typeBinRpcCallbackReq: number;
|
|
301
|
+
static _typeBinRpcCallbackRsp: number;
|
|
302
|
+
static _reqLength: number;
|
|
303
|
+
static _rspLength: number;
|
|
304
|
+
static _rspZipFlagOffset: number;
|
|
305
|
+
static _rspReqIdOffset: number;
|
|
306
|
+
static _rspTypeFlagOffset: number;
|
|
307
|
+
static _int32Length: number;
|
|
308
|
+
static _wsFlagSingle: number;
|
|
309
|
+
static _wsFlagStart: number;
|
|
310
|
+
static _wsFlagContinue: number;
|
|
311
|
+
static _wsFlagEnd: number;
|
|
312
|
+
static _wsMaxFrame: number;
|
|
313
|
+
static _wsBinHeader: Uint8Array;
|
|
314
|
+
static _wsBinHeaderZip: Uint8Array;
|
|
315
|
+
static _wsBinHeaderCallbackRSP: Uint8Array;
|
|
316
|
+
constructor(url: string);
|
|
317
|
+
connect(options?: ConnectOptions): void;
|
|
318
|
+
blockConnect(options?: ConnectOptions): Promise<void>;
|
|
319
|
+
pingInterval: number;
|
|
320
|
+
intervalId: ReturnType<typeof setInterval> | undefined;
|
|
321
|
+
tryStartLoop(): void;
|
|
322
|
+
close(): void;
|
|
323
|
+
loopRetryConnect(): void;
|
|
324
|
+
onSocketConnected(event: Event): void;
|
|
325
|
+
onSocketClose(event: CloseEvent): void;
|
|
326
|
+
isSocketValid(): boolean;
|
|
327
|
+
onSocketMessage(event: MessageEvent): void;
|
|
328
|
+
static SIM_SERVER_CON_ERROR_HEADER: Uint8Array;
|
|
329
|
+
static checkConnectionError(bytes: Uint8Array | null): void;
|
|
330
|
+
wrapSocketErrorBytes(error: any): Uint8Array;
|
|
331
|
+
onSocketError(error: Event): void;
|
|
332
|
+
_reqId: number;
|
|
333
|
+
_mapRpc: Map<number, RpcResponseFuncType>;
|
|
334
|
+
_rpcCodec: RpcCodec;
|
|
335
|
+
ping(timeout?: number): Promise<PingResult>;
|
|
336
|
+
rpc(cmd: any, onAct: RpcResponseFuncType): number;
|
|
337
|
+
rpcAsync<T>(cmd: any, returnType: any): Promise<T>;
|
|
338
|
+
handleReceivedData(buffer: ArrayBuffer): Promise<void>;
|
|
339
|
+
callbackFromServer(reqId: number, cmdByte: Uint8Array): Promise<null | undefined>;
|
|
340
|
+
sendMessage(message: string): void;
|
|
341
|
+
static getWebSocketStateName(state: number | undefined): string;
|
|
342
|
+
sendBinary(data: ArrayBuffer | Blob): Promise<void>;
|
|
343
|
+
sendRpcBytes(header: Uint8Array, bytes: Uint8Array): Promise<void>;
|
|
344
|
+
static buildRpcHeader(reqID: number, zip: boolean): Uint8Array;
|
|
345
|
+
static buildCallbackRspHeader(reqID: number): Uint8Array;
|
|
346
|
+
buildCallbackRspHeader(reqID: number): Uint8Array;
|
|
347
|
+
sendCallbackRsp(rsp: CRpcCallbackRsp): void;
|
|
348
|
+
}
|
|
349
|
+
declare class RpcCodec {
|
|
350
|
+
zipOut: boolean;
|
|
351
|
+
toBytes(cmd: CsonBean): Uint8Array;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
declare class WxMiniBridge {
|
|
355
|
+
serverUrl: string | undefined;
|
|
356
|
+
appUuid: string | undefined;
|
|
357
|
+
bridgeWebSocketUrl: string | undefined;
|
|
358
|
+
sceneFromWxMiniParams: string | undefined;
|
|
359
|
+
initalQueryParameters: Map<string, any> | undefined;
|
|
360
|
+
private _bridgeClient;
|
|
361
|
+
private _processOneResult;
|
|
362
|
+
isBatchExecuting(command: WxMiniCommand): boolean;
|
|
363
|
+
prepareBridgeClient(): Promise<WsClient>;
|
|
364
|
+
handleBridgeCallback(command: WxMiniCommand): Promise<Object>;
|
|
365
|
+
handleBridgeCommand(command: WxMiniBridgeCommand): Promise<Object>;
|
|
366
|
+
queryConfig(): WxMiniConfigDto;
|
|
367
|
+
querySceneFromWxMiniParams(): string | undefined;
|
|
368
|
+
/**
|
|
369
|
+
* 关闭桥接连接
|
|
370
|
+
*/
|
|
371
|
+
close(): void;
|
|
372
|
+
private _getWxMiniComdException;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* WxMini API - 微信小程序高层调用接口
|
|
377
|
+
*
|
|
378
|
+
* 对 WxMiniBridge.handleBridgeCallback 的封装,将每个小程序功能封装为可直接 await 的前端方法。
|
|
379
|
+
* 对应 Java 端:fe.cmn.weixin.ability.WxMiniCommand
|
|
380
|
+
*
|
|
381
|
+
* 所有 API 参数均采用对象形式传参,所有参数对象通过继承 BaseOptions 而统一支持 timeout 设置。
|
|
382
|
+
*/
|
|
383
|
+
/** 小程序端支持的命令字,对应 Java 枚举 WxMiniCmd */
|
|
384
|
+
declare enum WxMiniCmd {
|
|
385
|
+
getUserProfile = "getUserProfile",
|
|
386
|
+
makePhoneCall = "makePhoneCall",
|
|
387
|
+
/** 调起相机并选取照片/视频 */
|
|
388
|
+
chooseMedia = "chooseMedia",
|
|
389
|
+
readLocalFile = "readLocalFile",
|
|
390
|
+
getPhoneNum = "getPhoneNum",
|
|
391
|
+
scanCode = "scanCode",
|
|
392
|
+
/** 参数:url; 跳转到某内部页面 */
|
|
393
|
+
navigateTo = "navigateTo",
|
|
394
|
+
/** 参数:url; 关闭当前页面跳转到某内部页面 */
|
|
395
|
+
redirectTo = "redirectTo",
|
|
396
|
+
/** 参数:url; 关闭所有页面,打开到应用内的某个页面 */
|
|
397
|
+
reLaunch = "reLaunch",
|
|
398
|
+
/** 参数:delta; 关闭当前页面,返回上一页面或多级页面 */
|
|
399
|
+
navigateBack = "navigateBack",
|
|
400
|
+
/** 登录并返回登录码 code */
|
|
401
|
+
loginGetCode = "loginGetCode",
|
|
402
|
+
saveProjectConfigParam = "saveProjectConfigParam",
|
|
403
|
+
loadProjectConfigParam = "loadProjectConfigParam",
|
|
404
|
+
/** 下载文件,返回临时文件路径 */
|
|
405
|
+
downloadFile = "downloadFile",
|
|
406
|
+
/** 上传文件到服务器 */
|
|
407
|
+
uploadFile = "uploadFile",
|
|
408
|
+
saveFileToDisk = "saveFileToDisk",
|
|
409
|
+
shareFileMessage = "shareFileMessage",
|
|
410
|
+
openDocument = "openDocument",
|
|
411
|
+
getLocation = "getLocation",
|
|
412
|
+
openLocation = "openLocation",
|
|
413
|
+
chooseLocation = "chooseLocation",
|
|
414
|
+
queryAppGlobalData = "queryAppGlobalData",
|
|
415
|
+
chooseMessageFile = "chooseMessageFile",
|
|
416
|
+
setSharePageMessage = "setSharePageMessage",
|
|
417
|
+
showShareImageMenu = "showShareImageMenu",
|
|
418
|
+
saveImageToPhotosAlbum = "saveImageToPhotosAlbum",
|
|
419
|
+
saveVideoToPhotosAlbum = "saveVideoToPhotosAlbum",
|
|
420
|
+
getClipboardData = "getClipboardData",
|
|
421
|
+
setClipboardData = "setClipboardData",
|
|
422
|
+
startAudioRecord = "startAudioRecord",
|
|
423
|
+
stopAudioRecord = "stopAudioRecord",
|
|
424
|
+
pauseAudioRecord = "pauseAudioRecord",
|
|
425
|
+
resumeAudioRecord = "resumeAudioRecord"
|
|
426
|
+
}
|
|
427
|
+
/** 所有 API 参数对象的基类,统一支持 timeout 设置 */
|
|
428
|
+
interface BaseOptions {
|
|
429
|
+
/** 超时时间(毫秒),默认 60000ms */
|
|
430
|
+
timeout?: number;
|
|
431
|
+
}
|
|
432
|
+
/** WxMiniApi 初始化配置 */
|
|
433
|
+
interface WxMiniApiConfig {
|
|
434
|
+
/** 应用 UUID */
|
|
435
|
+
appUuid?: string;
|
|
436
|
+
/** 桥接 WebSocket 地址 */
|
|
437
|
+
bridgeWebSocketUrl?: string;
|
|
438
|
+
}
|
|
439
|
+
type UserProfileQueryType = 'NickName' | 'Avartar' | 'All';
|
|
440
|
+
interface GpsLocationDto {
|
|
441
|
+
latitude?: number;
|
|
442
|
+
longitude?: number;
|
|
443
|
+
altitude?: number;
|
|
444
|
+
horizontalAccuracy?: number;
|
|
445
|
+
verticalAccuracy?: number;
|
|
446
|
+
speed?: number;
|
|
447
|
+
address?: string;
|
|
448
|
+
}
|
|
449
|
+
interface WxLocalFile {
|
|
450
|
+
/** 本地临时文件路径 */
|
|
451
|
+
tempFilePath?: string;
|
|
452
|
+
/** 文件大小 */
|
|
453
|
+
size?: number;
|
|
454
|
+
/** 文件类型 */
|
|
455
|
+
fileType?: string;
|
|
456
|
+
/** 视频时长(秒),视频时有效 */
|
|
457
|
+
duration?: number;
|
|
458
|
+
/** 视频缩略图 */
|
|
459
|
+
thumbTempFilePath?: string;
|
|
460
|
+
/** 宽度,媒体文件有效 */
|
|
461
|
+
width?: number;
|
|
462
|
+
/** 高度,媒体文件有效 */
|
|
463
|
+
height?: number;
|
|
464
|
+
}
|
|
465
|
+
interface WxSharePageInfo {
|
|
466
|
+
title?: string;
|
|
467
|
+
path?: string;
|
|
468
|
+
imageUrl?: string;
|
|
469
|
+
desc?: string;
|
|
470
|
+
}
|
|
471
|
+
interface WxMiniAppInfo {
|
|
472
|
+
appId?: string;
|
|
473
|
+
appSecret?: string;
|
|
474
|
+
}
|
|
475
|
+
interface GetUserProfileOptions extends BaseOptions {
|
|
476
|
+
/** 显示在确认授权对话框里的文字信息 */
|
|
477
|
+
message: string;
|
|
478
|
+
/** 显示在确认对话框里的按钮标签 */
|
|
479
|
+
buttonLabel: string;
|
|
480
|
+
/** 获取信息的类型 */
|
|
481
|
+
type?: UserProfileQueryType;
|
|
482
|
+
}
|
|
483
|
+
interface GetPhoneNumOptions extends BaseOptions {
|
|
484
|
+
/** 显示在确认授权对话框里的文字信息 */
|
|
485
|
+
message: string;
|
|
486
|
+
/** 确认按钮标签 */
|
|
487
|
+
buttonLabel: string;
|
|
488
|
+
/** 拒绝按钮标签 */
|
|
489
|
+
rejectButtonLabel?: string;
|
|
490
|
+
}
|
|
491
|
+
interface MakePhoneCallOptions extends BaseOptions {
|
|
492
|
+
/** 电话号码 */
|
|
493
|
+
phoneNum: string;
|
|
494
|
+
}
|
|
495
|
+
interface ChooseMediaOptions extends BaseOptions {
|
|
496
|
+
/** 最多选取数量,默认 2 */
|
|
497
|
+
count?: number;
|
|
498
|
+
/** 媒体类型,如 ['image', 'video', 'mix'],默认 ['mix'] */
|
|
499
|
+
mediaTypes?: string[];
|
|
500
|
+
/** 来源类型,如 ['album', 'camera'],默认 ['album', 'camera'] */
|
|
501
|
+
sourceTypes?: string[];
|
|
502
|
+
/** 最大时长(秒),默认 30 */
|
|
503
|
+
maxDuration?: number;
|
|
504
|
+
/** 尺寸类型,如 ['original', 'compressed'],默认 ['compressed', 'original'] */
|
|
505
|
+
sizeTypes?: string[];
|
|
506
|
+
/** 摄像头方向 'back' | 'front',默认 'back' */
|
|
507
|
+
camera?: string;
|
|
508
|
+
}
|
|
509
|
+
interface ReadLocalFileOptions extends BaseOptions {
|
|
510
|
+
/** 文件路径 */
|
|
511
|
+
filePath: string;
|
|
512
|
+
}
|
|
513
|
+
interface DownloadFileOptions extends BaseOptions {
|
|
514
|
+
/** 文件 URL */
|
|
515
|
+
url: string;
|
|
516
|
+
}
|
|
517
|
+
interface UploadFileOptions extends BaseOptions {
|
|
518
|
+
/** 上传目标服务器地址 */
|
|
519
|
+
url: string;
|
|
520
|
+
/** 本地临时文件路径 */
|
|
521
|
+
filePath: string;
|
|
522
|
+
/** 上传的目标文件名 */
|
|
523
|
+
fileName: string;
|
|
524
|
+
/** 其它表单参数(如用户/授权等) */
|
|
525
|
+
formData?: Record<string, string>;
|
|
526
|
+
}
|
|
527
|
+
interface OpenDocumentOptions extends BaseOptions {
|
|
528
|
+
/** 临时文件路径 */
|
|
529
|
+
filePath: string;
|
|
530
|
+
}
|
|
531
|
+
interface SaveToAlbumOptions extends BaseOptions {
|
|
532
|
+
/** 文件路径 */
|
|
533
|
+
filePath: string;
|
|
534
|
+
}
|
|
535
|
+
interface ShareFileMessageOptions extends BaseOptions {
|
|
536
|
+
/** 要分享的临时文件路径 */
|
|
537
|
+
filePath: string;
|
|
538
|
+
/** 显示在聊天界面的文件名(注意扩展名要正确) */
|
|
539
|
+
fileName: string;
|
|
540
|
+
}
|
|
541
|
+
interface ChooseMessageFileOptions extends BaseOptions {
|
|
542
|
+
/** 最多可以选择的文件个数(0~100) */
|
|
543
|
+
count: number;
|
|
544
|
+
/** 文件类型:'all' | 'video' | 'image' | 'file',默认 'all' */
|
|
545
|
+
type?: string;
|
|
546
|
+
/** 文件扩展名过滤(仅 type=file 时有效) */
|
|
547
|
+
extensions?: string[];
|
|
548
|
+
}
|
|
549
|
+
interface NavigateToOptions extends BaseOptions {
|
|
550
|
+
/** 页面路径(如 '/pages/index/index') */
|
|
551
|
+
path: string;
|
|
552
|
+
}
|
|
553
|
+
interface RedirectToOptions extends BaseOptions {
|
|
554
|
+
/** 页面路径 */
|
|
555
|
+
path: string;
|
|
556
|
+
}
|
|
557
|
+
interface ReLaunchOptions extends BaseOptions {
|
|
558
|
+
/** 页面路径 */
|
|
559
|
+
path: string;
|
|
560
|
+
}
|
|
561
|
+
interface NavigateBackOptions extends BaseOptions {
|
|
562
|
+
/** 返回的页面数,默认 1 */
|
|
563
|
+
delta?: number;
|
|
564
|
+
}
|
|
565
|
+
interface GetLocationOptions extends BaseOptions {
|
|
566
|
+
/** 获取后是否打开地图,默认 false */
|
|
567
|
+
openIt?: boolean;
|
|
568
|
+
}
|
|
569
|
+
interface OpenLocationOptions extends BaseOptions {
|
|
570
|
+
/** 位置坐标 */
|
|
571
|
+
location: GpsLocationDto;
|
|
572
|
+
}
|
|
573
|
+
interface ChooseLocationOptions extends BaseOptions {
|
|
574
|
+
/** 初始定位(可选) */
|
|
575
|
+
initLocation?: GpsLocationDto;
|
|
576
|
+
}
|
|
577
|
+
interface SaveExtProjectConfigOptions extends BaseOptions {
|
|
578
|
+
/** 配置参数键值对 */
|
|
579
|
+
params: Record<string, string>;
|
|
580
|
+
/** true: 追加合并; false: 全量替换 */
|
|
581
|
+
append: boolean;
|
|
582
|
+
}
|
|
583
|
+
interface SetSharePageMessageOptions extends BaseOptions {
|
|
584
|
+
/** 分享页信息 */
|
|
585
|
+
sharePage: WxSharePageInfo;
|
|
586
|
+
}
|
|
587
|
+
interface ShowShareImageMenuOptions extends BaseOptions {
|
|
588
|
+
/** 图片路径 */
|
|
589
|
+
path: string;
|
|
590
|
+
/** 样式 */
|
|
591
|
+
style: string;
|
|
592
|
+
/** 是否需要显示入口 */
|
|
593
|
+
needShowEntrance: string;
|
|
594
|
+
/** 入口路径 */
|
|
595
|
+
entrancePath: string;
|
|
596
|
+
}
|
|
597
|
+
interface SetClipboardDataOptions extends BaseOptions {
|
|
598
|
+
/** 剪贴板内容 */
|
|
599
|
+
data: string;
|
|
600
|
+
}
|
|
601
|
+
interface StartAudioRecordOptions extends BaseOptions {
|
|
602
|
+
/** 录音时长(毫秒) */
|
|
603
|
+
duration?: number;
|
|
604
|
+
/** 采样率 */
|
|
605
|
+
sampleRate?: number;
|
|
606
|
+
/** 通道数 */
|
|
607
|
+
numberOfChannels?: number;
|
|
608
|
+
/** 编码码率 */
|
|
609
|
+
encodeBitRate?: number;
|
|
610
|
+
/** 音频格式 */
|
|
611
|
+
format?: string;
|
|
612
|
+
/** 帧大小 */
|
|
613
|
+
frameSize?: number;
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* 微信小程序高层 API 封装。
|
|
617
|
+
*
|
|
618
|
+
* 所有方法都是对 `WxMiniBridge.handleBridgeCallback` 的语义化包装,
|
|
619
|
+
* 不再需要手动构建 WxMiniCommand 对象。
|
|
620
|
+
* 所有方法参数都采用对象形式,并统一继承自 BaseOptions 以支持自定义 timeout。
|
|
621
|
+
*
|
|
622
|
+
* @example
|
|
623
|
+
* ```ts
|
|
624
|
+
* import { WxMiniApi } from 'wxmini-sdk'
|
|
625
|
+
*
|
|
626
|
+
* // 方式一:构造函数传配置
|
|
627
|
+
* const api = new WxMiniApi({
|
|
628
|
+
* appUuid: 'xxx',
|
|
629
|
+
* bridgeWebSocketUrl: 'wss://...',
|
|
630
|
+
* })
|
|
631
|
+
*
|
|
632
|
+
* // 方式二:后续动态设置
|
|
633
|
+
* const api2 = new WxMiniApi()
|
|
634
|
+
* api2.configure({ appUuid: 'xxx', bridgeWebSocketUrl: 'wss://...' })
|
|
635
|
+
*
|
|
636
|
+
* // 获取手机号
|
|
637
|
+
* const phoneResult = await api.getPhoneNum({ message: '请授权手机号', buttonLabel: '允许' })
|
|
638
|
+
*
|
|
639
|
+
* // 扫二维码(自定义超时 30 秒)
|
|
640
|
+
* const scanResult = await api.scanCode({ timeout: 30000 })
|
|
641
|
+
* ```
|
|
642
|
+
*/
|
|
643
|
+
declare class WxMiniApi {
|
|
644
|
+
/** @internal 底层桥接实例 */
|
|
645
|
+
private readonly _bridge;
|
|
646
|
+
constructor(config?: WxMiniApiConfig);
|
|
647
|
+
/**
|
|
648
|
+
* 设置或更新配置
|
|
649
|
+
* @param config - appUuid 和 bridgeWebSocketUrl
|
|
650
|
+
*/
|
|
651
|
+
configure(config: WxMiniApiConfig): void;
|
|
652
|
+
/**
|
|
653
|
+
* 关闭桥接连接,释放资源
|
|
654
|
+
*/
|
|
655
|
+
close(): void;
|
|
656
|
+
/** 执行一个命令并返回结果 */
|
|
657
|
+
private execute;
|
|
658
|
+
/** 执行并将结果 JSON 解析为对象 */
|
|
659
|
+
private executeAs;
|
|
660
|
+
/**
|
|
661
|
+
* 通过微信小程序接口, 获取用户信息(昵称/头像等)
|
|
662
|
+
*/
|
|
663
|
+
getUserProfile(opts: GetUserProfileOptions): Promise<string>;
|
|
664
|
+
/**
|
|
665
|
+
* 通过微信小程序接口,获取用户手机号码
|
|
666
|
+
*/
|
|
667
|
+
getPhoneNum(opts: GetPhoneNumOptions): Promise<string>;
|
|
668
|
+
/**
|
|
669
|
+
* 拨打电话
|
|
670
|
+
*/
|
|
671
|
+
makePhoneCall(opts: MakePhoneCallOptions): Promise<void>;
|
|
672
|
+
/**
|
|
673
|
+
* 调起相机并选取照片/视频
|
|
674
|
+
*/
|
|
675
|
+
chooseMedia(opts?: ChooseMediaOptions): Promise<WxLocalFile[]>;
|
|
676
|
+
/**
|
|
677
|
+
* 扫描二维码,返回二维码内容
|
|
678
|
+
*/
|
|
679
|
+
scanCode(opts?: BaseOptions): Promise<string>;
|
|
680
|
+
/**
|
|
681
|
+
* 读取本地文件内容
|
|
682
|
+
* @warning 文件超过 60K 会导致链接中断,适合小文件
|
|
683
|
+
*/
|
|
684
|
+
readLocalFile(opts: ReadLocalFileOptions): Promise<string>;
|
|
685
|
+
/**
|
|
686
|
+
* 下载文件,返回临时文件路径
|
|
687
|
+
*/
|
|
688
|
+
downloadFile(opts: DownloadFileOptions): Promise<string>;
|
|
689
|
+
/**
|
|
690
|
+
* 上传文件到服务器
|
|
691
|
+
*/
|
|
692
|
+
uploadFile(opts: UploadFileOptions): Promise<string>;
|
|
693
|
+
/**
|
|
694
|
+
* 打开预览文档(支持 txt/pdf/excel/word/ppt 等格式)
|
|
695
|
+
*/
|
|
696
|
+
openDocument(opts: OpenDocumentOptions): Promise<void>;
|
|
697
|
+
/**
|
|
698
|
+
* 保存图片到相册
|
|
699
|
+
*/
|
|
700
|
+
saveImageToPhotosAlbum(opts: SaveToAlbumOptions): Promise<void>;
|
|
701
|
+
/**
|
|
702
|
+
* 保存视频到相册
|
|
703
|
+
*/
|
|
704
|
+
saveVideoToPhotosAlbum(opts: SaveToAlbumOptions): Promise<void>;
|
|
705
|
+
/**
|
|
706
|
+
* 分享文件消息(将临时文件分享给他人)
|
|
707
|
+
*/
|
|
708
|
+
shareFileMessage(opts: ShareFileMessageOptions): Promise<void>;
|
|
709
|
+
/**
|
|
710
|
+
* 从聊天记录中选择文件
|
|
711
|
+
*/
|
|
712
|
+
chooseMessageFile(opts: ChooseMessageFileOptions): Promise<WxLocalFile[]>;
|
|
713
|
+
/**
|
|
714
|
+
* 跳转到小程序内部页面
|
|
715
|
+
*/
|
|
716
|
+
navigateTo(opts: NavigateToOptions): Promise<void>;
|
|
717
|
+
/**
|
|
718
|
+
* 关闭当前页面后跳转
|
|
719
|
+
*/
|
|
720
|
+
redirectTo(opts: RedirectToOptions): Promise<void>;
|
|
721
|
+
/**
|
|
722
|
+
* 关闭所有页面,打开应用内某页面(清空页面栈)
|
|
723
|
+
*/
|
|
724
|
+
reLaunch(opts: ReLaunchOptions): Promise<void>;
|
|
725
|
+
/**
|
|
726
|
+
* 关闭当前页面,返回上一页面或多级页面
|
|
727
|
+
*/
|
|
728
|
+
navigateBack(opts?: NavigateBackOptions): Promise<void>;
|
|
729
|
+
/**
|
|
730
|
+
* 调用微信登录,返回登录码 code
|
|
731
|
+
*/
|
|
732
|
+
loginGetCode(opts?: BaseOptions): Promise<string>;
|
|
733
|
+
/**
|
|
734
|
+
* 获取当前位置(经纬度)
|
|
735
|
+
*/
|
|
736
|
+
getLocation(opts?: GetLocationOptions): Promise<GpsLocationDto>;
|
|
737
|
+
/**
|
|
738
|
+
* 打开地图并定位到指定位置
|
|
739
|
+
*/
|
|
740
|
+
openLocation(opts: OpenLocationOptions): Promise<void>;
|
|
741
|
+
/**
|
|
742
|
+
* 打开地图让用户选择位置,返回所选位置坐标
|
|
743
|
+
*/
|
|
744
|
+
chooseLocation(opts?: ChooseLocationOptions): Promise<GpsLocationDto>;
|
|
745
|
+
/**
|
|
746
|
+
* 保存扩展的工程配置参数到小程序本地(页面启动时会自动合并传入)
|
|
747
|
+
*/
|
|
748
|
+
saveExtProjectConfig(opts: SaveExtProjectConfigOptions): Promise<void>;
|
|
749
|
+
/**
|
|
750
|
+
* 读取保存在小程序本地的扩展工程配置参数
|
|
751
|
+
*/
|
|
752
|
+
loadExtProjectConfig(opts?: BaseOptions): Promise<Record<string, string>>;
|
|
753
|
+
/**
|
|
754
|
+
* 查询小程序 App 的 GlobalData
|
|
755
|
+
*/
|
|
756
|
+
queryAppGlobalData<T = any>(opts?: BaseOptions): Promise<T>;
|
|
757
|
+
/**
|
|
758
|
+
* 设置分享页信息(用于分享转发,全局一份)
|
|
759
|
+
*/
|
|
760
|
+
setSharePageMessage(opts: SetSharePageMessageOptions): Promise<void>;
|
|
761
|
+
/**
|
|
762
|
+
* 显示图片分享菜单
|
|
763
|
+
*/
|
|
764
|
+
showShareImageMenu(opts: ShowShareImageMenuOptions): Promise<void>;
|
|
765
|
+
/**
|
|
766
|
+
* 读取剪贴板内容
|
|
767
|
+
*/
|
|
768
|
+
getClipboardData(opts?: BaseOptions): Promise<string>;
|
|
769
|
+
/**
|
|
770
|
+
* 写入剪贴板
|
|
771
|
+
*/
|
|
772
|
+
setClipboardData(opts: SetClipboardDataOptions): Promise<void>;
|
|
773
|
+
/**
|
|
774
|
+
* 开始录音
|
|
775
|
+
*/
|
|
776
|
+
startAudioRecord(opts?: StartAudioRecordOptions): Promise<void>;
|
|
777
|
+
/**
|
|
778
|
+
* 停止录音,返回录音文件临时路径
|
|
779
|
+
*/
|
|
780
|
+
stopAudioRecord(opts?: BaseOptions): Promise<string>;
|
|
781
|
+
/**
|
|
782
|
+
* 暂停录音
|
|
783
|
+
*/
|
|
784
|
+
pauseAudioRecord(opts?: BaseOptions): Promise<void>;
|
|
785
|
+
/**
|
|
786
|
+
* 继续录音
|
|
787
|
+
*/
|
|
788
|
+
resumeAudioRecord(opts?: BaseOptions): Promise<void>;
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
declare class WsService {
|
|
792
|
+
wsClient: WsClient;
|
|
793
|
+
service: string;
|
|
794
|
+
constructor(wsClient: WsClient, service: string);
|
|
795
|
+
getClient(): WsClient;
|
|
796
|
+
getServiceName(): string;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
declare class IWxMiniBridgeService extends WsService {
|
|
800
|
+
static readonly SERVICE: string;
|
|
801
|
+
constructor(wsClient: WsClient);
|
|
802
|
+
static readonly DEFAULT_TIMEOUTS: number;
|
|
803
|
+
static readonly DEFAULT_WAIT_ONLINE_TIMEOUTS: number;
|
|
804
|
+
static readonly DECLARED_FIELDS: string[];
|
|
805
|
+
handleCommand(cmd: WxMiniBridgeCommand): Promise<Object>;
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
declare class Cson {
|
|
809
|
+
static _serialNo: number;
|
|
810
|
+
static _mapBytes: Map<number, Uint8Array>;
|
|
811
|
+
static _setCache(mapBytes: Map<number, Uint8Array> | null): void;
|
|
812
|
+
static putBytes(data: Uint8Array | null): Uint8Array | null;
|
|
813
|
+
static getBytes(o: Uint8Array): Uint8Array | null;
|
|
814
|
+
static _clearCache(): void;
|
|
815
|
+
static encode(data: any, outputBytes: Map<number, Uint8Array> | null): string;
|
|
816
|
+
static decode<T>(targetClass: ClassConstructor<T>, json: string, mapBytes: Map<number, Uint8Array> | null): T | null;
|
|
817
|
+
static decodeReturn(data: Uint8Array | null, zip: boolean): any;
|
|
818
|
+
static decodeJson(json: string, mapBytes: Map<number, Uint8Array> | null): any;
|
|
819
|
+
static decodeObject(org: any): any;
|
|
820
|
+
static decodeDynamicList(org: any[] | null): any[] | null;
|
|
821
|
+
/**
|
|
822
|
+
* 返回的是成功结果里的 result json
|
|
823
|
+
* 同时,参数 mapAttach 是附件二进制包(输出)
|
|
824
|
+
* 如果返回是异常对象, 则会抛出FeJavaException
|
|
825
|
+
*/
|
|
826
|
+
static decodeReturnPayload(data: Uint8Array | null, zip: boolean, mapAttach: Map<number, Uint8Array>): string | null | undefined;
|
|
827
|
+
static decodeServerPackage(data: Uint8Array | null, zip: boolean, mapAttach: Map<number, Uint8Array>): string | null;
|
|
828
|
+
static getPojoValue(pojo: CsonPojo | null | undefined): any;
|
|
829
|
+
}
|
|
830
|
+
declare class JavaFactory {
|
|
831
|
+
static CSON_BEANS: Map<string, CsonBean>;
|
|
832
|
+
static registPojos(beans: Map<string, CsonBean>): void;
|
|
833
|
+
static registPojo(javaType: string, pojo: CsonBean): void;
|
|
834
|
+
static getPojoByName(javaType: string, create?: boolean): CsonBean | undefined | null;
|
|
835
|
+
static newBean(javaType: string, json: {
|
|
836
|
+
[key: string]: any;
|
|
837
|
+
} | null): CsonBean | null;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
declare class Utils {
|
|
841
|
+
static allocUuid(): string;
|
|
842
|
+
static now(): number;
|
|
843
|
+
static cloneWithRef<T>(obj: T | null): T | any | null;
|
|
844
|
+
static createNew<T>(obj: T | null): T | any | null;
|
|
845
|
+
static isStringNotEmpty(str: string | null | undefined): boolean;
|
|
846
|
+
static isStringEmpty(str: string | null | undefined): boolean;
|
|
847
|
+
static string2Utf8(str: string | null): Uint8Array | null;
|
|
848
|
+
static utf8ToString(bytes: Uint8Array | null): string | null;
|
|
849
|
+
static concatUint8Arrays(arrays: Uint8Array[]): Uint8Array;
|
|
850
|
+
static sleep(ms: number): Promise<void>;
|
|
851
|
+
static pollAsync(fn: () => boolean, timeout?: number, interval?: number): Promise<void>;
|
|
852
|
+
static isNumber(value: any): value is number;
|
|
853
|
+
static isInteger(value: number): boolean;
|
|
854
|
+
static isFloat(value: number): boolean;
|
|
855
|
+
static pollBlock(fn: () => boolean, timeout: number, interval: number, msg?: string): Promise<void>;
|
|
856
|
+
static error(message?: any, ...optionalParams: any[]): void;
|
|
857
|
+
static log(message?: any, ...optionalParams: any[]): void;
|
|
858
|
+
static _debug: boolean;
|
|
859
|
+
static debug(message?: any, ...optionalParams: any[]): void;
|
|
860
|
+
static isInstance<T>(obj: any, constructor: new (...args: any[]) => T): boolean;
|
|
861
|
+
static assertNotNull<T>(obj: T | undefined | null, msg?: string): T;
|
|
862
|
+
static assertTrue(value: boolean, msg?: string): void;
|
|
863
|
+
}
|
|
864
|
+
declare class Bytes {
|
|
865
|
+
static LittleEndian: boolean;
|
|
866
|
+
/**
|
|
867
|
+
* Flutter的setInt32,以及Netty等默认都是大端序存储int:[00,00,00,03]
|
|
868
|
+
*/
|
|
869
|
+
static readInt32(bytes: Uint8Array, offset: number): number;
|
|
870
|
+
static setInt32Bytes(bytes: Uint8Array, offset: number, num: number): void;
|
|
871
|
+
static int32ToBytes(v: number): Uint8Array;
|
|
872
|
+
static stringToBytes(s: string): Uint8Array;
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
/**
|
|
876
|
+
* 设备/环境检测工具
|
|
877
|
+
*/
|
|
878
|
+
/** 检测是否在微信小程序 WebView 环境中 */
|
|
879
|
+
declare function isWxMiniprogram(): boolean;
|
|
880
|
+
/** 检测触摸屏支持 */
|
|
881
|
+
declare function isTouchDevice(): boolean;
|
|
882
|
+
/** 获取平台类型 */
|
|
883
|
+
declare function getPlatform(): string;
|
|
884
|
+
/** 获取浏览器名称 */
|
|
885
|
+
declare function getBrowserName(): string;
|
|
886
|
+
|
|
887
|
+
export { type BaseOptions, BinBlock, Bytes, CRpcCallbackCmd, CRpcCallbackRsp, CRpcFeCmd, CRpcFeRsp, type ChooseLocationOptions, type ChooseMediaOptions, type ChooseMessageFileOptions, type ConnectOptions, Cson, CsonBean, CsonPojo, type DownloadFileOptions, FeAbilityExecuteException, FeException, FeJavaException, FePojo, FeWxMiniCmdException, type GetLocationOptions, type GetPhoneNumOptions, type GetUserProfileOptions, type GpsLocationDto, IWxMiniBridgeService, JavaFactory, type MakePhoneCallOptions, type NavigateBackOptions, type NavigateToOptions, NullPojo, type OpenDocumentOptions, type OpenLocationOptions, PartitionTable, PingResult, PingStatus, QuerySceneFromWxMiniParams, QueryWxMiniParam, type ReLaunchOptions, type ReadLocalFileOptions, type RedirectToOptions, RpcCodec, type SaveExtProjectConfigOptions, type SaveToAlbumOptions, type ServerCallbackHandler, type SetClipboardDataOptions, type SetSharePageMessageOptions, type ShareFileMessageOptions, type ShowShareImageMenuOptions, type StartAudioRecordOptions, SystemCallback, type UploadFileOptions, type UserProfileQueryType, Utils, ValuePojo, WebSocketConnectError, WebSocketError, WsClient, WsService, type WxLocalFile, WxMiniApi, type WxMiniApiConfig, type WxMiniAppInfo, WxMiniBridge, WxMiniBridgeCommand, WxMiniCmd, WxMiniCommand, WxMiniConfigDto, type WxSharePageInfo, clients, getBrowserName, getPlatform, isTouchDevice, isWxMiniprogram };
|