@weapp-core/api 0.1.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/LICENSE +21 -0
- package/README.md +353 -0
- package/dist/index.d.mts +8500 -0
- package/dist/index.mjs +2819 -0
- package/package.json +89 -0
- package/types/index.d.ts +189 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,2819 @@
|
|
|
1
|
+
//#region src/core/platformRegistry.ts
|
|
2
|
+
/**
|
|
3
|
+
* @description 内置小程序宿主注册表;未知宿主仍可通过显式 adapter 接入。
|
|
4
|
+
*/
|
|
5
|
+
const MINI_PROGRAM_API_PLATFORM_DESCRIPTORS = [
|
|
6
|
+
{
|
|
7
|
+
id: "weapp",
|
|
8
|
+
displayName: "微信小程序",
|
|
9
|
+
globalObjectKey: "wx",
|
|
10
|
+
aliases: [
|
|
11
|
+
"weapp",
|
|
12
|
+
"wechat",
|
|
13
|
+
"weixin",
|
|
14
|
+
"wx"
|
|
15
|
+
],
|
|
16
|
+
hostConfigKey: "__wxConfig",
|
|
17
|
+
typeSource: "`miniprogram-api-typings`"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
id: "alipay",
|
|
21
|
+
displayName: "支付宝 / 淘宝小程序",
|
|
22
|
+
globalObjectKey: "my",
|
|
23
|
+
aliases: [
|
|
24
|
+
"alipay",
|
|
25
|
+
"ali",
|
|
26
|
+
"my",
|
|
27
|
+
"taobao"
|
|
28
|
+
],
|
|
29
|
+
hostConfigKey: "__wxConfig",
|
|
30
|
+
typeSource: "`@mini-types/alipay`"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
id: "swan",
|
|
34
|
+
displayName: "百度智能小程序",
|
|
35
|
+
globalObjectKey: "swan",
|
|
36
|
+
aliases: [
|
|
37
|
+
"swan",
|
|
38
|
+
"baidu",
|
|
39
|
+
"bd"
|
|
40
|
+
],
|
|
41
|
+
hostConfigKey: "__wxConfig"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: "tt",
|
|
45
|
+
displayName: "抖音小程序",
|
|
46
|
+
globalObjectKey: "tt",
|
|
47
|
+
aliases: [
|
|
48
|
+
"tt",
|
|
49
|
+
"toutiao",
|
|
50
|
+
"bytedance",
|
|
51
|
+
"douyin"
|
|
52
|
+
],
|
|
53
|
+
hostConfigKey: "__wxConfig",
|
|
54
|
+
typeSource: "`@douyin-microapp/typings`"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: "qq",
|
|
58
|
+
displayName: "QQ 小程序",
|
|
59
|
+
globalObjectKey: "qq",
|
|
60
|
+
aliases: ["qq"]
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: "ks",
|
|
64
|
+
displayName: "快手小程序",
|
|
65
|
+
globalObjectKey: "ks",
|
|
66
|
+
aliases: ["ks", "kuaishou"]
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: "jd",
|
|
70
|
+
displayName: "京东小程序",
|
|
71
|
+
globalObjectKey: "jd",
|
|
72
|
+
aliases: ["jd", "jingdong"],
|
|
73
|
+
hostConfigKey: "__wxConfig"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
id: "xhs",
|
|
77
|
+
displayName: "小红书小程序",
|
|
78
|
+
globalObjectKey: "xhs",
|
|
79
|
+
aliases: [
|
|
80
|
+
"xhs",
|
|
81
|
+
"xiaohongshu",
|
|
82
|
+
"red"
|
|
83
|
+
],
|
|
84
|
+
hostConfigKey: "__wxConfig"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
id: "dd",
|
|
88
|
+
displayName: "钉钉小程序",
|
|
89
|
+
globalObjectKey: "dd",
|
|
90
|
+
aliases: [
|
|
91
|
+
"dd",
|
|
92
|
+
"dingtalk",
|
|
93
|
+
"dingding"
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
id: "quickapp",
|
|
98
|
+
displayName: "快应用",
|
|
99
|
+
globalObjectKey: "qa",
|
|
100
|
+
aliases: ["qa", "quickapp"]
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
id: "quickapp-webview",
|
|
104
|
+
displayName: "快应用 WebView",
|
|
105
|
+
globalObjectKey: "qapp",
|
|
106
|
+
aliases: ["qapp", "quickapp-webview"]
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
id: "uni",
|
|
110
|
+
displayName: "uni-app 运行时",
|
|
111
|
+
globalObjectKey: "uni",
|
|
112
|
+
aliases: [
|
|
113
|
+
"uni",
|
|
114
|
+
"uniapp",
|
|
115
|
+
"uni-app"
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
];
|
|
119
|
+
const descriptorById = /* @__PURE__ */ new Map();
|
|
120
|
+
const descriptorByAlias = /* @__PURE__ */ new Map();
|
|
121
|
+
const descriptorByGlobalObjectKey = /* @__PURE__ */ new Map();
|
|
122
|
+
for (const descriptor of MINI_PROGRAM_API_PLATFORM_DESCRIPTORS) {
|
|
123
|
+
descriptorById.set(descriptor.id, descriptor);
|
|
124
|
+
descriptorByGlobalObjectKey.set(descriptor.globalObjectKey, descriptor);
|
|
125
|
+
descriptorByAlias.set(descriptor.id, descriptor);
|
|
126
|
+
for (const alias of descriptor.aliases) descriptorByAlias.set(alias, descriptor);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* @description 标准化外部传入的平台名称。
|
|
130
|
+
*/
|
|
131
|
+
function normalizeMiniProgramPlatform(value) {
|
|
132
|
+
return value?.trim().toLowerCase() || void 0;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* @description 根据平台标识、别名或宿主全局键解析平台描述。
|
|
136
|
+
*/
|
|
137
|
+
function resolveMiniProgramPlatform(value) {
|
|
138
|
+
const normalized = normalizeMiniProgramPlatform(value);
|
|
139
|
+
if (!normalized) return;
|
|
140
|
+
return descriptorByAlias.get(normalized) ?? descriptorByGlobalObjectKey.get(normalized);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* @description 返回内置平台的宿主全局键。
|
|
144
|
+
*/
|
|
145
|
+
function getMiniProgramRuntimeGlobalKeys() {
|
|
146
|
+
return MINI_PROGRAM_API_PLATFORM_DESCRIPTORS.map((descriptor) => descriptor.globalObjectKey);
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* @description 根据宿主全局键解析平台标识。
|
|
150
|
+
*/
|
|
151
|
+
function getMiniProgramPlatformByRuntimeGlobalKey(globalObjectKey) {
|
|
152
|
+
return globalObjectKey ? descriptorByGlobalObjectKey.get(globalObjectKey)?.id : void 0;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* @description 获取小程序宿主配置对象的全局键。
|
|
156
|
+
*/
|
|
157
|
+
function getMiniProgramRuntimeHostConfigKey(platform) {
|
|
158
|
+
return (platform ? descriptorById.get(platform)?.hostConfigKey : void 0) ?? "__wxConfig";
|
|
159
|
+
}
|
|
160
|
+
//#endregion
|
|
161
|
+
//#region src/core/runtimeGlobal.ts
|
|
162
|
+
/**
|
|
163
|
+
* @description 静态解析当前运行环境的全局根对象,兼容不提供 globalThis 的小程序 worker。
|
|
164
|
+
*/
|
|
165
|
+
function resolveRuntimeRoots() {
|
|
166
|
+
const roots = [];
|
|
167
|
+
const appendRoot = (root) => {
|
|
168
|
+
if (root && !roots.includes(root)) roots.push(root);
|
|
169
|
+
};
|
|
170
|
+
if (typeof globalThis !== "undefined") appendRoot(globalThis);
|
|
171
|
+
if (typeof self !== "undefined") appendRoot(self);
|
|
172
|
+
if (typeof window !== "undefined") appendRoot(window);
|
|
173
|
+
if (typeof global !== "undefined") appendRoot(global);
|
|
174
|
+
return roots;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* @description 静态解析当前运行环境的首个全局根对象。
|
|
178
|
+
*/
|
|
179
|
+
function resolveRuntimeRoot() {
|
|
180
|
+
return resolveRuntimeRoots()[0];
|
|
181
|
+
}
|
|
182
|
+
function resolveTopLevelRuntimeValue(key) {
|
|
183
|
+
switch (key) {
|
|
184
|
+
case "wx": return typeof wx !== "undefined" ? wx : void 0;
|
|
185
|
+
case "my": return typeof my !== "undefined" ? my : void 0;
|
|
186
|
+
case "tt": return typeof tt !== "undefined" ? tt : void 0;
|
|
187
|
+
case "swan": return typeof swan !== "undefined" ? swan : void 0;
|
|
188
|
+
case "jd": return typeof jd !== "undefined" ? jd : void 0;
|
|
189
|
+
case "xhs": return typeof xhs !== "undefined" ? xhs : void 0;
|
|
190
|
+
case "qq": return typeof qq !== "undefined" ? qq : void 0;
|
|
191
|
+
case "ks": return typeof ks !== "undefined" ? ks : void 0;
|
|
192
|
+
case "dd": return typeof dd !== "undefined" ? dd : void 0;
|
|
193
|
+
case "qa": return typeof qa !== "undefined" ? qa : void 0;
|
|
194
|
+
case "qapp": return typeof qapp !== "undefined" ? qapp : void 0;
|
|
195
|
+
case "uni": return typeof uni !== "undefined" ? uni : void 0;
|
|
196
|
+
case "__wxConfig": return typeof __wxConfig !== "undefined" ? __wxConfig : void 0;
|
|
197
|
+
default: return;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* @description 从全局根对象或小程序顶层全局变量读取运行时值。
|
|
202
|
+
*/
|
|
203
|
+
function resolveRuntimeGlobalValue(key, root = resolveRuntimeRoot()) {
|
|
204
|
+
const roots = root ? [root, ...resolveRuntimeRoots().filter((item) => item !== root)] : resolveRuntimeRoots();
|
|
205
|
+
for (const item of roots) {
|
|
206
|
+
const value = item[key];
|
|
207
|
+
if (value !== void 0) return value;
|
|
208
|
+
}
|
|
209
|
+
return resolveTopLevelRuntimeValue(key);
|
|
210
|
+
}
|
|
211
|
+
//#endregion
|
|
212
|
+
//#region src/core/adapter.ts
|
|
213
|
+
const GLOBAL_ADAPTER_KEYS = [...getMiniProgramRuntimeGlobalKeys().map((key) => ({
|
|
214
|
+
platform: key,
|
|
215
|
+
key
|
|
216
|
+
}))];
|
|
217
|
+
function isAdapterCandidate(value) {
|
|
218
|
+
return typeof value === "object" || typeof value === "function";
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* @description 侦测当前运行环境的全局 API 对象
|
|
222
|
+
*/
|
|
223
|
+
function detectGlobalAdapter() {
|
|
224
|
+
const root = resolveRuntimeRoot();
|
|
225
|
+
for (const item of GLOBAL_ADAPTER_KEYS) {
|
|
226
|
+
const candidate = resolveRuntimeGlobalValue(item.key, root);
|
|
227
|
+
if (isAdapterCandidate(candidate)) return {
|
|
228
|
+
adapter: candidate,
|
|
229
|
+
platform: item.platform
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
return {};
|
|
233
|
+
}
|
|
234
|
+
const WEAPI_NON_PROMISIFIED_METHOD_NAME_SET = /* @__PURE__ */ new Set([
|
|
235
|
+
"arrayBufferToBase64",
|
|
236
|
+
"base64ToArrayBuffer",
|
|
237
|
+
"canIUse",
|
|
238
|
+
"cancelIdleCallback",
|
|
239
|
+
"createAnimation",
|
|
240
|
+
"createAudioContext",
|
|
241
|
+
"createCameraContext",
|
|
242
|
+
"createCanvasContext",
|
|
243
|
+
"createEditorContext",
|
|
244
|
+
"createInnerAudioContext",
|
|
245
|
+
"createIntersectionObserver",
|
|
246
|
+
"createInterstitialAd",
|
|
247
|
+
"createLivePlayerContext",
|
|
248
|
+
"createLivePusherContext",
|
|
249
|
+
"createMapContext",
|
|
250
|
+
"createMediaAudioPlayer",
|
|
251
|
+
"createMediaContainer",
|
|
252
|
+
"createMediaRecorder",
|
|
253
|
+
"createOffscreenCanvas",
|
|
254
|
+
"createRewardedVideoAd",
|
|
255
|
+
"createSelectorQuery",
|
|
256
|
+
"createTCPSocket",
|
|
257
|
+
"createUDPSocket",
|
|
258
|
+
"createVKSession",
|
|
259
|
+
"createVideoContext",
|
|
260
|
+
"createWebAudioContext",
|
|
261
|
+
"createWorker",
|
|
262
|
+
"getBackgroundAudioManager",
|
|
263
|
+
"getFileSystemManager",
|
|
264
|
+
"getLogManager",
|
|
265
|
+
"getMenuButtonBoundingClientRect",
|
|
266
|
+
"getNFCAdapter",
|
|
267
|
+
"getOpenDataContext",
|
|
268
|
+
"getPerformance",
|
|
269
|
+
"getRealtimeLogManager",
|
|
270
|
+
"getRecorderManager",
|
|
271
|
+
"getUpdateManager",
|
|
272
|
+
"getUserCryptoManager",
|
|
273
|
+
"getXrFrameSystem",
|
|
274
|
+
"nextTick",
|
|
275
|
+
"reportAnalytics",
|
|
276
|
+
"requestIdleCallback"
|
|
277
|
+
]);
|
|
278
|
+
/**
|
|
279
|
+
* @description 判断方法是否应保留原始同步返回值,而不是包装为 Promise。
|
|
280
|
+
*/
|
|
281
|
+
function isNonPromisifiedMethod(name) {
|
|
282
|
+
return WEAPI_NON_PROMISIFIED_METHOD_NAME_SET.has(name);
|
|
283
|
+
}
|
|
284
|
+
//#endregion
|
|
285
|
+
//#region src/core/utils.ts
|
|
286
|
+
function isPlainObject(value) {
|
|
287
|
+
return Object.prototype.toString.call(value) === "[object Object]";
|
|
288
|
+
}
|
|
289
|
+
function hasOwn(source, key) {
|
|
290
|
+
return Object.prototype.hasOwnProperty.call(source, key);
|
|
291
|
+
}
|
|
292
|
+
function hasCallbacks(value) {
|
|
293
|
+
if (!isPlainObject(value)) return false;
|
|
294
|
+
return typeof value.success === "function" || typeof value.fail === "function" || typeof value.complete === "function";
|
|
295
|
+
}
|
|
296
|
+
function isSyncMethod(name) {
|
|
297
|
+
return name.endsWith("Sync");
|
|
298
|
+
}
|
|
299
|
+
const ON_EVENT_RE = /^on[A-Z]/;
|
|
300
|
+
const OFF_EVENT_RE = /^off[A-Z]/;
|
|
301
|
+
function isEventMethod(name) {
|
|
302
|
+
return ON_EVENT_RE.test(name) || OFF_EVENT_RE.test(name);
|
|
303
|
+
}
|
|
304
|
+
function shouldSkipPromise(name) {
|
|
305
|
+
return isSyncMethod(name) || isEventMethod(name) || isNonPromisifiedMethod(name);
|
|
306
|
+
}
|
|
307
|
+
function createNotSupportedError(methodName, platform) {
|
|
308
|
+
return { errMsg: `${platform ? `${platform}.${methodName}` : methodName}:fail method not supported` };
|
|
309
|
+
}
|
|
310
|
+
//#endregion
|
|
311
|
+
//#region src/core/callBridge.ts
|
|
312
|
+
function resolveOptionsArg$1(args) {
|
|
313
|
+
const nextArgs = args.slice();
|
|
314
|
+
const lastArg = nextArgs.length > 0 ? nextArgs[nextArgs.length - 1] : void 0;
|
|
315
|
+
if (isPlainObject(lastArg)) {
|
|
316
|
+
const options = { ...lastArg };
|
|
317
|
+
nextArgs[nextArgs.length - 1] = options;
|
|
318
|
+
return {
|
|
319
|
+
args: nextArgs,
|
|
320
|
+
options
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
const options = {};
|
|
324
|
+
nextArgs.push(options);
|
|
325
|
+
return {
|
|
326
|
+
args: nextArgs,
|
|
327
|
+
options
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* @description 将错误按小程序回调风格分发;若无回调则返回 reject Promise。
|
|
332
|
+
*/
|
|
333
|
+
function callWithError(error, args) {
|
|
334
|
+
const lastArg = args.length > 0 ? args[args.length - 1] : void 0;
|
|
335
|
+
if (hasCallbacks(lastArg)) {
|
|
336
|
+
lastArg.fail?.(error);
|
|
337
|
+
lastArg.complete?.(error);
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
return Promise.reject(error);
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* @description 统一 Promise 调用桥接,支持在 options/runtime result 阶段注入 hook。
|
|
344
|
+
*/
|
|
345
|
+
function callWithPromise(context, method, args, mapResult, hooks) {
|
|
346
|
+
return new Promise((resolve, reject) => {
|
|
347
|
+
const { args: nextArgs, options } = resolveOptionsArg$1(args);
|
|
348
|
+
let settled = false;
|
|
349
|
+
options.success = (res) => {
|
|
350
|
+
settled = true;
|
|
351
|
+
resolve(mapResult ? mapResult(res, args) : res);
|
|
352
|
+
};
|
|
353
|
+
options.fail = (err) => {
|
|
354
|
+
settled = true;
|
|
355
|
+
reject(err);
|
|
356
|
+
};
|
|
357
|
+
options.complete = (res) => {
|
|
358
|
+
if (!settled) resolve(mapResult ? mapResult(res, args) : res);
|
|
359
|
+
};
|
|
360
|
+
try {
|
|
361
|
+
hooks?.onOptions?.(options, nextArgs);
|
|
362
|
+
const invoke = () => {
|
|
363
|
+
try {
|
|
364
|
+
const invokeResult = method.apply(context, nextArgs);
|
|
365
|
+
hooks?.onInvokeResult?.(invokeResult);
|
|
366
|
+
return invokeResult;
|
|
367
|
+
} catch (err) {
|
|
368
|
+
hooks?.onInvokeError?.(err);
|
|
369
|
+
reject(err);
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
};
|
|
373
|
+
if (hooks?.invoke) hooks.invoke(invoke);
|
|
374
|
+
else invoke();
|
|
375
|
+
} catch (err) {
|
|
376
|
+
hooks?.onInvokeError?.(err);
|
|
377
|
+
reject(err);
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* @description 处理方法缺失时的回调/Promise 行为。
|
|
383
|
+
*/
|
|
384
|
+
function callMissingApi(methodName, platform, args) {
|
|
385
|
+
return callWithError(createNotSupportedError(methodName, platform), args);
|
|
386
|
+
}
|
|
387
|
+
//#endregion
|
|
388
|
+
//#region src/core/apiCatalog/myMethodsAddPhoneContactToOnGyroscopeChange.ts
|
|
389
|
+
/**
|
|
390
|
+
* @description 三端 API 名单(由 typings 自动提取,请勿手工修改)
|
|
391
|
+
* @generated by scripts/sync-api-catalog.mjs
|
|
392
|
+
*/
|
|
393
|
+
const WEAPI_MY_METHODS_ADD_PHONE_CONTACT_TO_ON_GYROSCOPE_CHANGE = [
|
|
394
|
+
"addPhoneContact",
|
|
395
|
+
"alert",
|
|
396
|
+
"arrayBufferToBase64",
|
|
397
|
+
"base64ToArrayBuffer",
|
|
398
|
+
"calculateRoute",
|
|
399
|
+
"call",
|
|
400
|
+
"cancelBluetoothPair",
|
|
401
|
+
"canIUse",
|
|
402
|
+
"canvasToTempFilePath",
|
|
403
|
+
"checkBeforeAddOrder",
|
|
404
|
+
"checkIsIfaaEnrolledInDevice",
|
|
405
|
+
"checkIsSupportIfaaAuthentication",
|
|
406
|
+
"chooseAlipayContact",
|
|
407
|
+
"chooseCity",
|
|
408
|
+
"chooseContact",
|
|
409
|
+
"chooseDistrict",
|
|
410
|
+
"chooseImage",
|
|
411
|
+
"chooseLocation",
|
|
412
|
+
"choosePhoneContact",
|
|
413
|
+
"chooseVideo",
|
|
414
|
+
"clearStorage",
|
|
415
|
+
"clearStorageSync",
|
|
416
|
+
"closeBluetoothAdapter",
|
|
417
|
+
"closeSocket",
|
|
418
|
+
"compressImage",
|
|
419
|
+
"confirm",
|
|
420
|
+
"connectBLEDevice",
|
|
421
|
+
"connectSocket",
|
|
422
|
+
"connectWifi",
|
|
423
|
+
"createAnimation",
|
|
424
|
+
"createCanvasContext",
|
|
425
|
+
"createInnerAudioContext",
|
|
426
|
+
"createIntersectionObserver",
|
|
427
|
+
"createLottieContext",
|
|
428
|
+
"createMapContext",
|
|
429
|
+
"createOffscreenCanvas",
|
|
430
|
+
"createRewardedAd",
|
|
431
|
+
"createSelectorQuery",
|
|
432
|
+
"createVideoContext",
|
|
433
|
+
"createWebViewContext",
|
|
434
|
+
"createWorker",
|
|
435
|
+
"datePicker",
|
|
436
|
+
"detectFileType",
|
|
437
|
+
"disableAlertBeforeUnload",
|
|
438
|
+
"disconnectBLEDevice",
|
|
439
|
+
"downloadFile",
|
|
440
|
+
"enableAlertBeforeUnload",
|
|
441
|
+
"exitMiniProgram",
|
|
442
|
+
"generateImageFromCode",
|
|
443
|
+
"getAccessibilityManager",
|
|
444
|
+
"getAccountInfoSync",
|
|
445
|
+
"getAddress",
|
|
446
|
+
"getAppAuthorizeSetting",
|
|
447
|
+
"getAppBaseInfo",
|
|
448
|
+
"getAppIdSync",
|
|
449
|
+
"getAuthCode",
|
|
450
|
+
"getAvailableAudioSources",
|
|
451
|
+
"getBackgroundAudioManager",
|
|
452
|
+
"getBackgroundFetchData",
|
|
453
|
+
"getBatteryInfo",
|
|
454
|
+
"getBatteryInfoSync",
|
|
455
|
+
"getBeacons",
|
|
456
|
+
"getBLEDeviceCharacteristics",
|
|
457
|
+
"getBLEDeviceRSSI",
|
|
458
|
+
"getBLEDeviceServices",
|
|
459
|
+
"getBLEDeviceStatus",
|
|
460
|
+
"getBLEMTU",
|
|
461
|
+
"getBluetoothAdapterState",
|
|
462
|
+
"getBluetoothDevices",
|
|
463
|
+
"getBluetoothPairs",
|
|
464
|
+
"getClipboard",
|
|
465
|
+
"getConnectedBluetoothDevices",
|
|
466
|
+
"getConnectedWifi",
|
|
467
|
+
"getEnterOptionsSync",
|
|
468
|
+
"getExtConfig",
|
|
469
|
+
"getExtConfigSync",
|
|
470
|
+
"getFileInfo",
|
|
471
|
+
"getFileSystemManager",
|
|
472
|
+
"getGeocoder",
|
|
473
|
+
"getImageInfo",
|
|
474
|
+
"getLaunchOptionsSync",
|
|
475
|
+
"getLeftButtonsBoundingClientRect",
|
|
476
|
+
"getLocalIPAddress",
|
|
477
|
+
"getLocation",
|
|
478
|
+
"getMapInfo",
|
|
479
|
+
"getMenuButtonBoundingClientRect",
|
|
480
|
+
"getNetworkType",
|
|
481
|
+
"getOpenUserInfo",
|
|
482
|
+
"getParentAppId",
|
|
483
|
+
"getParentAppIdSync",
|
|
484
|
+
"getPhoneNumber",
|
|
485
|
+
"getPluginIdSync",
|
|
486
|
+
"getRecorderManager",
|
|
487
|
+
"getRunData",
|
|
488
|
+
"getRunScene",
|
|
489
|
+
"getSavedFileInfo",
|
|
490
|
+
"getSavedFileList",
|
|
491
|
+
"getScreenBrightness",
|
|
492
|
+
"getServerTime",
|
|
493
|
+
"getSetting",
|
|
494
|
+
"getStorage",
|
|
495
|
+
"getStorageInfo",
|
|
496
|
+
"getStorageInfoSync",
|
|
497
|
+
"getStorageSync",
|
|
498
|
+
"getSystemInfo",
|
|
499
|
+
"getSystemInfoSync",
|
|
500
|
+
"getSystemSetting",
|
|
501
|
+
"getTitleColor",
|
|
502
|
+
"getUpdateManager",
|
|
503
|
+
"getVideoInfo",
|
|
504
|
+
"getWifiList",
|
|
505
|
+
"getWindowInfo",
|
|
506
|
+
"hideAddToDesktopMenu",
|
|
507
|
+
"hideAllAddToDesktopMenu",
|
|
508
|
+
"hideBackHome",
|
|
509
|
+
"hideKeyboard",
|
|
510
|
+
"hideLoading",
|
|
511
|
+
"hideNavigationBarLoading",
|
|
512
|
+
"hideShareMenu",
|
|
513
|
+
"hideTabBar",
|
|
514
|
+
"hideTabBarRedDot",
|
|
515
|
+
"hideToast",
|
|
516
|
+
"isScreenReaderEnabled",
|
|
517
|
+
"loadFontFace",
|
|
518
|
+
"loadPlugin",
|
|
519
|
+
"makeBluetoothPair",
|
|
520
|
+
"makePhoneCall",
|
|
521
|
+
"multiLevelSelect",
|
|
522
|
+
"navigateBack",
|
|
523
|
+
"navigateBackMiniProgram",
|
|
524
|
+
"navigateTo",
|
|
525
|
+
"navigateToMiniProgram",
|
|
526
|
+
"notifyBLECharacteristicValueChange",
|
|
527
|
+
"off",
|
|
528
|
+
"offAccelerometerChange",
|
|
529
|
+
"offAppHide",
|
|
530
|
+
"offAppShow",
|
|
531
|
+
"offAudioInterruptionBegin",
|
|
532
|
+
"offAudioInterruptionEnd",
|
|
533
|
+
"offBeaconServiceChange",
|
|
534
|
+
"offBeaconUpdate",
|
|
535
|
+
"offBLECharacteristicValueChange",
|
|
536
|
+
"offBLEConnectionStateChanged",
|
|
537
|
+
"offBluetoothAdapterStateChange",
|
|
538
|
+
"offBluetoothDeviceFound",
|
|
539
|
+
"offCompassChange",
|
|
540
|
+
"offComponentError",
|
|
541
|
+
"offDeviceMotionChange",
|
|
542
|
+
"offError",
|
|
543
|
+
"offGetWifiList",
|
|
544
|
+
"offGyroscopeChange",
|
|
545
|
+
"offLocatedComplete",
|
|
546
|
+
"offMemoryWarning",
|
|
547
|
+
"offNetworkStatusChange",
|
|
548
|
+
"offPageNotFound",
|
|
549
|
+
"offSocketClose",
|
|
550
|
+
"offSocketError",
|
|
551
|
+
"offSocketMessage",
|
|
552
|
+
"offSocketOpen",
|
|
553
|
+
"offUnhandledRejection",
|
|
554
|
+
"offUserCaptureScreen",
|
|
555
|
+
"offWifiConnected",
|
|
556
|
+
"on",
|
|
557
|
+
"onAccelerometerChange",
|
|
558
|
+
"onAppHide",
|
|
559
|
+
"onAppShow",
|
|
560
|
+
"onAudioInterruptionBegin",
|
|
561
|
+
"onAudioInterruptionEnd",
|
|
562
|
+
"onBeaconServiceChange",
|
|
563
|
+
"onBeaconUpdate",
|
|
564
|
+
"onBLECharacteristicValueChange",
|
|
565
|
+
"onBLEConnectionStateChanged",
|
|
566
|
+
"onBluetoothAdapterStateChange",
|
|
567
|
+
"onBluetoothDeviceFound",
|
|
568
|
+
"onCompassChange",
|
|
569
|
+
"onComponentError",
|
|
570
|
+
"onDeviceMotionChange",
|
|
571
|
+
"onError",
|
|
572
|
+
"onGetWifiList",
|
|
573
|
+
"onGyroscopeChange"
|
|
574
|
+
];
|
|
575
|
+
//#endregion
|
|
576
|
+
//#region src/core/apiCatalog/myMethodsOnLocatedCompleteToWriteBLECharacteristicValue.ts
|
|
577
|
+
/**
|
|
578
|
+
* @description 三端 API 名单(由 typings 自动提取,请勿手工修改)
|
|
579
|
+
* @generated by scripts/sync-api-catalog.mjs
|
|
580
|
+
*/
|
|
581
|
+
const WEAPI_MY_METHODS_ON_LOCATED_COMPLETE_TO_WRITE_BLECHARACTERISTIC_VALUE = [
|
|
582
|
+
"onLocatedComplete",
|
|
583
|
+
"onMemoryWarning",
|
|
584
|
+
"onNetworkStatusChange",
|
|
585
|
+
"onPageNotFound",
|
|
586
|
+
"onSocketClose",
|
|
587
|
+
"onSocketError",
|
|
588
|
+
"onSocketMessage",
|
|
589
|
+
"onSocketOpen",
|
|
590
|
+
"onUnhandledRejection",
|
|
591
|
+
"onUserCaptureScreen",
|
|
592
|
+
"onWifiConnected",
|
|
593
|
+
"openBluetoothAdapter",
|
|
594
|
+
"openDocument",
|
|
595
|
+
"openKBVoucherDetail",
|
|
596
|
+
"openLocation",
|
|
597
|
+
"openMerchantTicketList",
|
|
598
|
+
"openMerchantVoucherList",
|
|
599
|
+
"openOtherApp",
|
|
600
|
+
"openSetting",
|
|
601
|
+
"openTicketDetail",
|
|
602
|
+
"openTicketList",
|
|
603
|
+
"openVoucherDetail",
|
|
604
|
+
"openVoucherList",
|
|
605
|
+
"optionsSelect",
|
|
606
|
+
"pageScrollTo",
|
|
607
|
+
"paySignCenter",
|
|
608
|
+
"previewImage",
|
|
609
|
+
"prompt",
|
|
610
|
+
"readBLECharacteristicValue",
|
|
611
|
+
"redirectTo",
|
|
612
|
+
"regionPicker",
|
|
613
|
+
"registerSSID",
|
|
614
|
+
"reLaunch",
|
|
615
|
+
"removeSavedFile",
|
|
616
|
+
"removeStorage",
|
|
617
|
+
"removeStorageSync",
|
|
618
|
+
"removeTabBarBadge",
|
|
619
|
+
"request",
|
|
620
|
+
"requestSubscribeMessage",
|
|
621
|
+
"rsa",
|
|
622
|
+
"saveFile",
|
|
623
|
+
"saveFileToDisk",
|
|
624
|
+
"saveImage",
|
|
625
|
+
"saveImageToPhotosAlbum",
|
|
626
|
+
"saveVideoToPhotosAlbum",
|
|
627
|
+
"scan",
|
|
628
|
+
"sendSocketMessage",
|
|
629
|
+
"setBackgroundColor",
|
|
630
|
+
"setBackgroundTextStyle",
|
|
631
|
+
"setBLEMTU",
|
|
632
|
+
"setCanPullDown",
|
|
633
|
+
"setClipboard",
|
|
634
|
+
"setKeepScreenOn",
|
|
635
|
+
"setLocatedCity",
|
|
636
|
+
"setNavigationBar",
|
|
637
|
+
"setNavigationBarBottomLineColor",
|
|
638
|
+
"setNavigationBarColor",
|
|
639
|
+
"setNavigationBarTitle",
|
|
640
|
+
"setScreenBrightness",
|
|
641
|
+
"setStorage",
|
|
642
|
+
"setStorageSync",
|
|
643
|
+
"setTabBarBadge",
|
|
644
|
+
"setTabBarItem",
|
|
645
|
+
"setTabBarStyle",
|
|
646
|
+
"setVisualEffectOnCapture",
|
|
647
|
+
"setWifiList",
|
|
648
|
+
"showActionSheet",
|
|
649
|
+
"showAuthGuide",
|
|
650
|
+
"showBLEPermissionGuide",
|
|
651
|
+
"showLoading",
|
|
652
|
+
"showModal",
|
|
653
|
+
"showNavigationBarLoading",
|
|
654
|
+
"showShareMenu",
|
|
655
|
+
"showSharePanel",
|
|
656
|
+
"showTabBar",
|
|
657
|
+
"showTabBarRedDot",
|
|
658
|
+
"showToast",
|
|
659
|
+
"startAccelerometer",
|
|
660
|
+
"startAPVerify",
|
|
661
|
+
"startBeaconDiscovery",
|
|
662
|
+
"startBluetoothDevicesDiscovery",
|
|
663
|
+
"startCompass",
|
|
664
|
+
"startGyroscope",
|
|
665
|
+
"startIfaaAuthentication",
|
|
666
|
+
"startPullDownRefresh",
|
|
667
|
+
"startWifi",
|
|
668
|
+
"stopAccelerometer",
|
|
669
|
+
"stopBeaconDiscovery",
|
|
670
|
+
"stopBluetoothDevicesDiscovery",
|
|
671
|
+
"stopCompass",
|
|
672
|
+
"stopGyroscope",
|
|
673
|
+
"stopPullDownRefresh",
|
|
674
|
+
"stopWifi",
|
|
675
|
+
"switchTab",
|
|
676
|
+
"tradePay",
|
|
677
|
+
"unregisterSSID",
|
|
678
|
+
"unsubscribeMessage",
|
|
679
|
+
"uploadFile",
|
|
680
|
+
"vibrate",
|
|
681
|
+
"vibrateLong",
|
|
682
|
+
"vibrateShort",
|
|
683
|
+
"watchShake",
|
|
684
|
+
"writeBLECharacteristicValue"
|
|
685
|
+
];
|
|
686
|
+
//#endregion
|
|
687
|
+
//#region src/core/apiCatalog/myMethods.ts
|
|
688
|
+
/**
|
|
689
|
+
* @description 三端 API 名单(由 typings 自动提取,请勿手工修改)
|
|
690
|
+
* @generated by scripts/sync-api-catalog.mjs
|
|
691
|
+
*/
|
|
692
|
+
const WEAPI_MY_METHODS = [...WEAPI_MY_METHODS_ADD_PHONE_CONTACT_TO_ON_GYROSCOPE_CHANGE, ...WEAPI_MY_METHODS_ON_LOCATED_COMPLETE_TO_WRITE_BLECHARACTERISTIC_VALUE];
|
|
693
|
+
//#endregion
|
|
694
|
+
//#region src/core/apiCatalog/ttMethodsApplyEcCouponToUnsubscribeAllSpecifiedUserComment.ts
|
|
695
|
+
/**
|
|
696
|
+
* @description 三端 API 名单(由 typings 自动提取,请勿手工修改)
|
|
697
|
+
* @generated by scripts/sync-api-catalog.mjs
|
|
698
|
+
*/
|
|
699
|
+
const WEAPI_TT_METHODS_APPLY_EC_COUPON_TO_UNSUBSCRIBE_ALL_SPECIFIED_USER_COMMENT = [
|
|
700
|
+
"applyEcCoupon",
|
|
701
|
+
"applyRefund",
|
|
702
|
+
"arrayBufferToBase64",
|
|
703
|
+
"authorize",
|
|
704
|
+
"base64ToArrayBuffer",
|
|
705
|
+
"canIPutStuffOverComponent",
|
|
706
|
+
"canIUse",
|
|
707
|
+
"canvasToTempFilePath",
|
|
708
|
+
"checkFollowAwemeState",
|
|
709
|
+
"checkFollowState",
|
|
710
|
+
"checkSession",
|
|
711
|
+
"chooseAddress",
|
|
712
|
+
"chooseImage",
|
|
713
|
+
"chooseLocation",
|
|
714
|
+
"chooseMedia",
|
|
715
|
+
"clearStorage",
|
|
716
|
+
"clearStorageSync",
|
|
717
|
+
"completePaySync",
|
|
718
|
+
"completeRefundSync",
|
|
719
|
+
"compressImage",
|
|
720
|
+
"connectSocket",
|
|
721
|
+
"continueToPay",
|
|
722
|
+
"createAnimation",
|
|
723
|
+
"createBytennEngineContext",
|
|
724
|
+
"createCanvasContext",
|
|
725
|
+
"createCloud",
|
|
726
|
+
"createInnerAudioContext",
|
|
727
|
+
"createIntersectionObserver",
|
|
728
|
+
"createInterstitialAd",
|
|
729
|
+
"createLivePlayerContext",
|
|
730
|
+
"createMapContext",
|
|
731
|
+
"createMediaRecorder",
|
|
732
|
+
"createMerchantOrder",
|
|
733
|
+
"createOffscreenCanvas",
|
|
734
|
+
"createOrder",
|
|
735
|
+
"createRefundOrder",
|
|
736
|
+
"createRewardedVideoAd",
|
|
737
|
+
"createRtcRoomContext",
|
|
738
|
+
"createSelectorQuery",
|
|
739
|
+
"createStickerManager",
|
|
740
|
+
"createVideoContext",
|
|
741
|
+
"createWorker",
|
|
742
|
+
"downloadFile",
|
|
743
|
+
"exitMiniProgram",
|
|
744
|
+
"followAwemeUser",
|
|
745
|
+
"followOfficialAccount",
|
|
746
|
+
"getAnalysisInfo",
|
|
747
|
+
"getBackgroundAudioManager",
|
|
748
|
+
"getClipboardData",
|
|
749
|
+
"getConnectedWifi",
|
|
750
|
+
"getCustomButtonBoundingClientRect",
|
|
751
|
+
"getEnvInfoSync",
|
|
752
|
+
"getExtConfig",
|
|
753
|
+
"getExtConfigSync",
|
|
754
|
+
"getFileInfo",
|
|
755
|
+
"getFileSystemManager",
|
|
756
|
+
"getImageInfo",
|
|
757
|
+
"getLaunchOptionsSync",
|
|
758
|
+
"getLiveUserInfo",
|
|
759
|
+
"getLocation",
|
|
760
|
+
"getMenuButtonBoundingClientRect",
|
|
761
|
+
"getMenuButtonLayout",
|
|
762
|
+
"getMicroappInfo",
|
|
763
|
+
"getRecorderManager",
|
|
764
|
+
"getRefundOrder",
|
|
765
|
+
"getRoomInfo",
|
|
766
|
+
"getSavedFileList",
|
|
767
|
+
"getScreenBrightness",
|
|
768
|
+
"getSelfCommentCountDuringPluginRunning",
|
|
769
|
+
"getSetting",
|
|
770
|
+
"getShopRecordToken",
|
|
771
|
+
"getSidebarActivity",
|
|
772
|
+
"getStorage",
|
|
773
|
+
"getStorageInfo",
|
|
774
|
+
"getStorageInfoSync",
|
|
775
|
+
"getStorageSync",
|
|
776
|
+
"getSystemInfo",
|
|
777
|
+
"getSystemInfoSync",
|
|
778
|
+
"getUpdateManager",
|
|
779
|
+
"getUserInfo",
|
|
780
|
+
"getUserProfile",
|
|
781
|
+
"getWifiList",
|
|
782
|
+
"hideHomeButton",
|
|
783
|
+
"hideInteractionBar",
|
|
784
|
+
"hideKeyboard",
|
|
785
|
+
"hideLoading",
|
|
786
|
+
"hideNavigationBarLoading",
|
|
787
|
+
"hideShareMenu",
|
|
788
|
+
"hideTabBar",
|
|
789
|
+
"hideTabBarRedDot",
|
|
790
|
+
"hideToast",
|
|
791
|
+
"isFollowingAnchor",
|
|
792
|
+
"login",
|
|
793
|
+
"makePhoneCall",
|
|
794
|
+
"navigateBack",
|
|
795
|
+
"navigateBackMiniProgram",
|
|
796
|
+
"navigateTo",
|
|
797
|
+
"navigateToMiniProgram",
|
|
798
|
+
"navigateToScene",
|
|
799
|
+
"navigateToVideoView",
|
|
800
|
+
"offAppHide",
|
|
801
|
+
"offAppShow",
|
|
802
|
+
"offCompassChange",
|
|
803
|
+
"offError",
|
|
804
|
+
"offGetWifiList",
|
|
805
|
+
"offLazyLoadError",
|
|
806
|
+
"offNetworkStatusChange",
|
|
807
|
+
"offPageNotFound",
|
|
808
|
+
"offUnhandledRejection",
|
|
809
|
+
"offUserCaptureScreen",
|
|
810
|
+
"offWindowResize",
|
|
811
|
+
"onAccelerometerChange",
|
|
812
|
+
"onAppHide",
|
|
813
|
+
"onAppShow",
|
|
814
|
+
"onCompassChange",
|
|
815
|
+
"onError",
|
|
816
|
+
"onGetWifiList",
|
|
817
|
+
"onLazyLoadError",
|
|
818
|
+
"onMemoryWarning",
|
|
819
|
+
"onNetworkStatusChange",
|
|
820
|
+
"onPageNotFound",
|
|
821
|
+
"onReceiveAudiencesFollowAction",
|
|
822
|
+
"onReceiveSpecifiedComment",
|
|
823
|
+
"onUnhandledRejection",
|
|
824
|
+
"onUserCaptureScreen",
|
|
825
|
+
"onWindowResize",
|
|
826
|
+
"openAwemeUserProfile",
|
|
827
|
+
"openLocation",
|
|
828
|
+
"openSetting",
|
|
829
|
+
"pageScrollTo",
|
|
830
|
+
"pay",
|
|
831
|
+
"preloadDrawAd",
|
|
832
|
+
"prerenderVideo",
|
|
833
|
+
"previewImage",
|
|
834
|
+
"redirectTo",
|
|
835
|
+
"reLaunch",
|
|
836
|
+
"removeSavedFile",
|
|
837
|
+
"removeStorage",
|
|
838
|
+
"removeStorageSync",
|
|
839
|
+
"removeTabBarBadge",
|
|
840
|
+
"reportAnalytics",
|
|
841
|
+
"request",
|
|
842
|
+
"requestSubscribeMessage",
|
|
843
|
+
"saveFile",
|
|
844
|
+
"saveImageToPhotosAlbum",
|
|
845
|
+
"scanCode",
|
|
846
|
+
"setClipboardData",
|
|
847
|
+
"setKeepScreenOn",
|
|
848
|
+
"setNavigationBarColor",
|
|
849
|
+
"setNavigationBarTitle",
|
|
850
|
+
"setScreenBrightness",
|
|
851
|
+
"setStorage",
|
|
852
|
+
"setStorageSync",
|
|
853
|
+
"setTabBarBadge",
|
|
854
|
+
"setTabBarItem",
|
|
855
|
+
"setTabBarStyle",
|
|
856
|
+
"showActionSheet",
|
|
857
|
+
"showDouyinOpenAuth",
|
|
858
|
+
"showFavoriteGuide",
|
|
859
|
+
"showInteractionBar",
|
|
860
|
+
"showLoading",
|
|
861
|
+
"showModal",
|
|
862
|
+
"showNavigationBarLoading",
|
|
863
|
+
"showShareMenu",
|
|
864
|
+
"showTabBar",
|
|
865
|
+
"showTabBarRedDot",
|
|
866
|
+
"showToast",
|
|
867
|
+
"startAccelerometer",
|
|
868
|
+
"startCompass",
|
|
869
|
+
"startPullDownRefresh",
|
|
870
|
+
"stopAccelerometer",
|
|
871
|
+
"stopCompass",
|
|
872
|
+
"stopPullDownRefresh",
|
|
873
|
+
"submitEcCustomGoods",
|
|
874
|
+
"subscribeAudiencesFollowAction",
|
|
875
|
+
"subscribeSpecifiedContentComment",
|
|
876
|
+
"subscribeSpecifiedUserComment",
|
|
877
|
+
"switchTab",
|
|
878
|
+
"unsubscribeAllSpecifiedContentComment",
|
|
879
|
+
"unsubscribeAllSpecifiedUserComment"
|
|
880
|
+
];
|
|
881
|
+
//#endregion
|
|
882
|
+
//#region src/core/apiCatalog/ttMethodsUnsubscribeAudiencesFollowActionToVibrateShort.ts
|
|
883
|
+
/**
|
|
884
|
+
* @description 三端 API 名单(由 typings 自动提取,请勿手工修改)
|
|
885
|
+
* @generated by scripts/sync-api-catalog.mjs
|
|
886
|
+
*/
|
|
887
|
+
const WEAPI_TT_METHODS_UNSUBSCRIBE_AUDIENCES_FOLLOW_ACTION_TO_VIBRATE_SHORT = [
|
|
888
|
+
"unsubscribeAudiencesFollowAction",
|
|
889
|
+
"updateExitGuideWindowInfo",
|
|
890
|
+
"updateShopMemberPoints",
|
|
891
|
+
"updateSidebarActivity",
|
|
892
|
+
"uploadFile",
|
|
893
|
+
"vibrateLong",
|
|
894
|
+
"vibrateShort"
|
|
895
|
+
];
|
|
896
|
+
//#endregion
|
|
897
|
+
//#region src/core/apiCatalog/ttMethods.ts
|
|
898
|
+
/**
|
|
899
|
+
* @description 三端 API 名单(由 typings 自动提取,请勿手工修改)
|
|
900
|
+
* @generated by scripts/sync-api-catalog.mjs
|
|
901
|
+
*/
|
|
902
|
+
const WEAPI_TT_METHODS = [...WEAPI_TT_METHODS_APPLY_EC_COUPON_TO_UNSUBSCRIBE_ALL_SPECIFIED_USER_COMMENT, ...WEAPI_TT_METHODS_UNSUBSCRIBE_AUDIENCES_FOLLOW_ACTION_TO_VIBRATE_SHORT];
|
|
903
|
+
//#endregion
|
|
904
|
+
//#region src/core/apiCatalog/typeSources.ts
|
|
905
|
+
/**
|
|
906
|
+
* @description 三端 API 名单(由 typings 自动提取,请勿手工修改)
|
|
907
|
+
* @generated by scripts/sync-api-catalog.mjs
|
|
908
|
+
*/
|
|
909
|
+
const WEAPI_TYPE_SOURCES = {
|
|
910
|
+
default: {
|
|
911
|
+
package: "miniprogram-api-typings",
|
|
912
|
+
version: "5.2.3"
|
|
913
|
+
},
|
|
914
|
+
wechat: {
|
|
915
|
+
package: "miniprogram-api-typings",
|
|
916
|
+
version: "5.2.3"
|
|
917
|
+
},
|
|
918
|
+
alipay: {
|
|
919
|
+
package: "@mini-types/alipay",
|
|
920
|
+
version: "3.0.14"
|
|
921
|
+
},
|
|
922
|
+
douyin: {
|
|
923
|
+
package: "@douyin-microapp/typings",
|
|
924
|
+
version: "1.3.1"
|
|
925
|
+
},
|
|
926
|
+
wx: {
|
|
927
|
+
package: "miniprogram-api-typings",
|
|
928
|
+
version: "5.2.3"
|
|
929
|
+
},
|
|
930
|
+
my: {
|
|
931
|
+
package: "@mini-types/alipay",
|
|
932
|
+
version: "3.0.14"
|
|
933
|
+
},
|
|
934
|
+
tt: {
|
|
935
|
+
package: "@douyin-microapp/typings",
|
|
936
|
+
version: "1.3.1"
|
|
937
|
+
}
|
|
938
|
+
};
|
|
939
|
+
const WEAPI_PLATFORM_TYPE_SOURCES = {
|
|
940
|
+
default: WEAPI_TYPE_SOURCES.default,
|
|
941
|
+
wechat: WEAPI_TYPE_SOURCES.wechat,
|
|
942
|
+
alipay: WEAPI_TYPE_SOURCES.alipay,
|
|
943
|
+
douyin: WEAPI_TYPE_SOURCES.douyin
|
|
944
|
+
};
|
|
945
|
+
const WEAPI_RUNTIME_TYPE_SOURCES = {
|
|
946
|
+
wx: WEAPI_TYPE_SOURCES.wx,
|
|
947
|
+
my: WEAPI_TYPE_SOURCES.my,
|
|
948
|
+
tt: WEAPI_TYPE_SOURCES.tt
|
|
949
|
+
};
|
|
950
|
+
//#endregion
|
|
951
|
+
//#region src/core/apiCatalog/wxMethodsAddCardToHideShareMenu.ts
|
|
952
|
+
/**
|
|
953
|
+
* @description 三端 API 名单(由 typings 自动提取,请勿手工修改)
|
|
954
|
+
* @generated by scripts/sync-api-catalog.mjs
|
|
955
|
+
*/
|
|
956
|
+
const WEAPI_WX_METHODS_ADD_CARD_TO_HIDE_SHARE_MENU = [
|
|
957
|
+
"addCard",
|
|
958
|
+
"addFileToFavorites",
|
|
959
|
+
"addPaymentPassFinish",
|
|
960
|
+
"addPaymentPassGetCertificateData",
|
|
961
|
+
"addPhoneCalendar",
|
|
962
|
+
"addPhoneContact",
|
|
963
|
+
"addPhoneRepeatCalendar",
|
|
964
|
+
"addVideoToFavorites",
|
|
965
|
+
"arrayBufferToBase64",
|
|
966
|
+
"authorize",
|
|
967
|
+
"authorizeForMiniProgram",
|
|
968
|
+
"authPrivateMessage",
|
|
969
|
+
"base64ToArrayBuffer",
|
|
970
|
+
"batchGetStorage",
|
|
971
|
+
"batchGetStorageSync",
|
|
972
|
+
"batchSetStorage",
|
|
973
|
+
"batchSetStorageSync",
|
|
974
|
+
"bindEmployeeRelation",
|
|
975
|
+
"canAddSecureElementPass",
|
|
976
|
+
"cancelIdleCallback",
|
|
977
|
+
"canIUse",
|
|
978
|
+
"canvasGetImageData",
|
|
979
|
+
"canvasPutImageData",
|
|
980
|
+
"canvasToTempFilePath",
|
|
981
|
+
"checkDeviceSupportHevc",
|
|
982
|
+
"checkEmployeeRelation",
|
|
983
|
+
"checkIsAddedToMyMiniProgram",
|
|
984
|
+
"checkIsOpenAccessibility",
|
|
985
|
+
"checkIsPictureInPictureActive",
|
|
986
|
+
"checkIsSoterEnrolledInDevice",
|
|
987
|
+
"checkIsSupportFacialRecognition",
|
|
988
|
+
"checkIsSupportSoterAuthentication",
|
|
989
|
+
"checkSession",
|
|
990
|
+
"checkTransitCardSupport",
|
|
991
|
+
"chooseAddress",
|
|
992
|
+
"chooseContact",
|
|
993
|
+
"chooseImage",
|
|
994
|
+
"chooseInvoice",
|
|
995
|
+
"chooseInvoiceTitle",
|
|
996
|
+
"chooseLicensePlate",
|
|
997
|
+
"chooseLocation",
|
|
998
|
+
"chooseMedia",
|
|
999
|
+
"chooseMessageFile",
|
|
1000
|
+
"choosePoi",
|
|
1001
|
+
"chooseVideo",
|
|
1002
|
+
"clearStorage",
|
|
1003
|
+
"clearStorageSync",
|
|
1004
|
+
"closeBLEConnection",
|
|
1005
|
+
"closeBluetoothAdapter",
|
|
1006
|
+
"closeSocket",
|
|
1007
|
+
"compressImage",
|
|
1008
|
+
"compressVideo",
|
|
1009
|
+
"connectSocket",
|
|
1010
|
+
"connectWifi",
|
|
1011
|
+
"createAnimation",
|
|
1012
|
+
"createAudioContext",
|
|
1013
|
+
"createBLEConnection",
|
|
1014
|
+
"createBLEPeripheralServer",
|
|
1015
|
+
"createBufferURL",
|
|
1016
|
+
"createCacheManager",
|
|
1017
|
+
"createCameraContext",
|
|
1018
|
+
"createCanvasContext",
|
|
1019
|
+
"createGlobalPayment",
|
|
1020
|
+
"createInferenceSession",
|
|
1021
|
+
"createInnerAudioContext",
|
|
1022
|
+
"createIntersectionObserver",
|
|
1023
|
+
"createInterstitialAd",
|
|
1024
|
+
"createLivePlayerContext",
|
|
1025
|
+
"createLivePusherContext",
|
|
1026
|
+
"createMapContext",
|
|
1027
|
+
"createMediaAudioPlayer",
|
|
1028
|
+
"createMediaContainer",
|
|
1029
|
+
"createMediaRecorder",
|
|
1030
|
+
"createOffscreenCanvas",
|
|
1031
|
+
"createRewardedVideoAd",
|
|
1032
|
+
"createSelectorQuery",
|
|
1033
|
+
"createTCPSocket",
|
|
1034
|
+
"createUDPSocket",
|
|
1035
|
+
"createVideoContext",
|
|
1036
|
+
"createVideoDecoder",
|
|
1037
|
+
"createVKSession",
|
|
1038
|
+
"createWebAudioContext",
|
|
1039
|
+
"createWorker",
|
|
1040
|
+
"cropImage",
|
|
1041
|
+
"deleteTransitCard",
|
|
1042
|
+
"disableAlertBeforeUnload",
|
|
1043
|
+
"downloadFile",
|
|
1044
|
+
"editImage",
|
|
1045
|
+
"enableAlertBeforeUnload",
|
|
1046
|
+
"enterChatToolMode",
|
|
1047
|
+
"exitMiniProgram",
|
|
1048
|
+
"exitVoIPChat",
|
|
1049
|
+
"faceDetect",
|
|
1050
|
+
"getAccountInfoSync",
|
|
1051
|
+
"getApiCategory",
|
|
1052
|
+
"getAppAuthorizeSetting",
|
|
1053
|
+
"getAppBaseInfo",
|
|
1054
|
+
"getAvailableAudioSources",
|
|
1055
|
+
"getBackgroundAudioManager",
|
|
1056
|
+
"getBackgroundAudioPlayerState",
|
|
1057
|
+
"getBackgroundFetchData",
|
|
1058
|
+
"getBackgroundFetchToken",
|
|
1059
|
+
"getBatteryInfo",
|
|
1060
|
+
"getBatteryInfoSync",
|
|
1061
|
+
"getBeacons",
|
|
1062
|
+
"getBLEDeviceCharacteristics",
|
|
1063
|
+
"getBLEDeviceRSSI",
|
|
1064
|
+
"getBLEDeviceServices",
|
|
1065
|
+
"getBLEMTU",
|
|
1066
|
+
"getBluetoothAdapterState",
|
|
1067
|
+
"getBluetoothDevices",
|
|
1068
|
+
"getChannelsLiveInfo",
|
|
1069
|
+
"getChannelsLiveNoticeInfo",
|
|
1070
|
+
"getChannelsShareKey",
|
|
1071
|
+
"getChatToolInfo",
|
|
1072
|
+
"getClipboardData",
|
|
1073
|
+
"getCommonConfig",
|
|
1074
|
+
"getConnectedBluetoothDevices",
|
|
1075
|
+
"getConnectedWifi",
|
|
1076
|
+
"getDeviceBenchmarkInfo",
|
|
1077
|
+
"getDeviceInfo",
|
|
1078
|
+
"getDeviceVoIPList",
|
|
1079
|
+
"getEnterOptionsSync",
|
|
1080
|
+
"getExptInfoSync",
|
|
1081
|
+
"getExtConfig",
|
|
1082
|
+
"getExtConfigSync",
|
|
1083
|
+
"getFileSystemManager",
|
|
1084
|
+
"getFuzzyLocation",
|
|
1085
|
+
"getGroupEnterInfo",
|
|
1086
|
+
"getHCEState",
|
|
1087
|
+
"getImageInfo",
|
|
1088
|
+
"getInferenceEnvInfo",
|
|
1089
|
+
"getLaunchOptionsSync",
|
|
1090
|
+
"getLocalIPAddress",
|
|
1091
|
+
"getLocation",
|
|
1092
|
+
"getLogManager",
|
|
1093
|
+
"getMenuButtonBoundingClientRect",
|
|
1094
|
+
"getNetworkType",
|
|
1095
|
+
"getNFCAdapter",
|
|
1096
|
+
"getPerformance",
|
|
1097
|
+
"getPluginUpdateManager",
|
|
1098
|
+
"getPrivacySetting",
|
|
1099
|
+
"getRandomValues",
|
|
1100
|
+
"getRealtimeLogManager",
|
|
1101
|
+
"getRecorderManager",
|
|
1102
|
+
"getRendererUserAgent",
|
|
1103
|
+
"getScreenBrightness",
|
|
1104
|
+
"getScreenRecordingState",
|
|
1105
|
+
"getSecureElementPasses",
|
|
1106
|
+
"getSelectedTextRange",
|
|
1107
|
+
"getSetting",
|
|
1108
|
+
"getShareInfo",
|
|
1109
|
+
"getShowSplashAdStatus",
|
|
1110
|
+
"getSkylineInfo",
|
|
1111
|
+
"getSkylineInfoSync",
|
|
1112
|
+
"getStorage",
|
|
1113
|
+
"getStorageInfo",
|
|
1114
|
+
"getStorageInfoSync",
|
|
1115
|
+
"getStorageSync",
|
|
1116
|
+
"getSystemInfo",
|
|
1117
|
+
"getSystemInfoAsync",
|
|
1118
|
+
"getSystemInfoSync",
|
|
1119
|
+
"getSystemSetting",
|
|
1120
|
+
"getTransitCardCPLC",
|
|
1121
|
+
"getTransitCardInfo",
|
|
1122
|
+
"getTransitCardList",
|
|
1123
|
+
"getUpdateManager",
|
|
1124
|
+
"getUserCryptoManager",
|
|
1125
|
+
"getUserInfo",
|
|
1126
|
+
"getUserProfile",
|
|
1127
|
+
"getVideoInfo",
|
|
1128
|
+
"getWeRunData",
|
|
1129
|
+
"getWifiList",
|
|
1130
|
+
"getWindowInfo",
|
|
1131
|
+
"getXrFrameSystem",
|
|
1132
|
+
"hideHomeButton",
|
|
1133
|
+
"hideKeyboard",
|
|
1134
|
+
"hideLoading",
|
|
1135
|
+
"hideNavigationBarLoading",
|
|
1136
|
+
"hideShareMenu"
|
|
1137
|
+
];
|
|
1138
|
+
//#endregion
|
|
1139
|
+
//#region src/core/apiCatalog/wxMethodsHideTabBarToOpenStoreCouponDetail.ts
|
|
1140
|
+
/**
|
|
1141
|
+
* @description 三端 API 名单(由 typings 自动提取,请勿手工修改)
|
|
1142
|
+
* @generated by scripts/sync-api-catalog.mjs
|
|
1143
|
+
*/
|
|
1144
|
+
const WEAPI_WX_METHODS_HIDE_TAB_BAR_TO_OPEN_STORE_COUPON_DETAIL = [
|
|
1145
|
+
"hideTabBar",
|
|
1146
|
+
"hideTabBarRedDot",
|
|
1147
|
+
"hideToast",
|
|
1148
|
+
"initFaceDetect",
|
|
1149
|
+
"isBluetoothDevicePaired",
|
|
1150
|
+
"issueTransitCard",
|
|
1151
|
+
"isVKSupport",
|
|
1152
|
+
"join1v1Chat",
|
|
1153
|
+
"joinVoIPChat",
|
|
1154
|
+
"jumpToOfflinePay",
|
|
1155
|
+
"loadBuiltInFontFace",
|
|
1156
|
+
"loadFontFace",
|
|
1157
|
+
"login",
|
|
1158
|
+
"makeBluetoothPair",
|
|
1159
|
+
"makePhoneCall",
|
|
1160
|
+
"navigateBack",
|
|
1161
|
+
"navigateBackMiniProgram",
|
|
1162
|
+
"navigateTo",
|
|
1163
|
+
"navigateToMiniProgram",
|
|
1164
|
+
"nextTick",
|
|
1165
|
+
"notifyBLECharacteristicValueChange",
|
|
1166
|
+
"notifyGroupMembers",
|
|
1167
|
+
"offAccelerometerChange",
|
|
1168
|
+
"offAfterPageLoad",
|
|
1169
|
+
"offAfterPageUnload",
|
|
1170
|
+
"offApiCategoryChange",
|
|
1171
|
+
"offAppHide",
|
|
1172
|
+
"offAppRoute",
|
|
1173
|
+
"offAppRouteDone",
|
|
1174
|
+
"offAppShow",
|
|
1175
|
+
"offAudioInterruptionBegin",
|
|
1176
|
+
"offAudioInterruptionEnd",
|
|
1177
|
+
"offBatteryInfoChange",
|
|
1178
|
+
"offBeaconServiceChange",
|
|
1179
|
+
"offBeaconUpdate",
|
|
1180
|
+
"offBeforeAppRoute",
|
|
1181
|
+
"offBeforePageLoad",
|
|
1182
|
+
"offBeforePageUnload",
|
|
1183
|
+
"offBLECharacteristicValueChange",
|
|
1184
|
+
"offBLEConnectionStateChange",
|
|
1185
|
+
"offBLEMTUChange",
|
|
1186
|
+
"offBLEPeripheralConnectionStateChanged",
|
|
1187
|
+
"offBluetoothAdapterStateChange",
|
|
1188
|
+
"offBluetoothDeviceFound",
|
|
1189
|
+
"offCompassChange",
|
|
1190
|
+
"offCopyUrl",
|
|
1191
|
+
"offDeviceMotionChange",
|
|
1192
|
+
"offEmbeddedMiniProgramHeightChange",
|
|
1193
|
+
"offError",
|
|
1194
|
+
"offGeneratePoster",
|
|
1195
|
+
"offGetWifiList",
|
|
1196
|
+
"offGyroscopeChange",
|
|
1197
|
+
"offHCEMessage",
|
|
1198
|
+
"offKeyboardHeightChange",
|
|
1199
|
+
"offKeyDown",
|
|
1200
|
+
"offKeyUp",
|
|
1201
|
+
"offLazyLoadError",
|
|
1202
|
+
"offLocalServiceDiscoveryStop",
|
|
1203
|
+
"offLocalServiceFound",
|
|
1204
|
+
"offLocalServiceLost",
|
|
1205
|
+
"offLocalServiceResolveFail",
|
|
1206
|
+
"offLocationChange",
|
|
1207
|
+
"offLocationChangeError",
|
|
1208
|
+
"offMemoryWarning",
|
|
1209
|
+
"offMenuButtonBoundingClientRectWeightChange",
|
|
1210
|
+
"offNetworkStatusChange",
|
|
1211
|
+
"offNetworkWeakChange",
|
|
1212
|
+
"offPageNotFound",
|
|
1213
|
+
"offParallelStateChange",
|
|
1214
|
+
"offScreenRecordingStateChanged",
|
|
1215
|
+
"offThemeChange",
|
|
1216
|
+
"offUnhandledRejection",
|
|
1217
|
+
"offUserCaptureScreen",
|
|
1218
|
+
"offUserOffTranslation",
|
|
1219
|
+
"offUserTriggerTranslation",
|
|
1220
|
+
"offVoIPChatInterrupted",
|
|
1221
|
+
"offVoIPChatMembersChanged",
|
|
1222
|
+
"offVoIPChatSpeakersChanged",
|
|
1223
|
+
"offVoIPChatStateChanged",
|
|
1224
|
+
"offVoIPVideoMembersChanged",
|
|
1225
|
+
"offWifiConnected",
|
|
1226
|
+
"offWifiConnectedWithPartialInfo",
|
|
1227
|
+
"offWindowResize",
|
|
1228
|
+
"offWindowStateChange",
|
|
1229
|
+
"onAccelerometerChange",
|
|
1230
|
+
"onAfterPageLoad",
|
|
1231
|
+
"onAfterPageUnload",
|
|
1232
|
+
"onApiCategoryChange",
|
|
1233
|
+
"onAppHide",
|
|
1234
|
+
"onAppRoute",
|
|
1235
|
+
"onAppRouteDone",
|
|
1236
|
+
"onAppShow",
|
|
1237
|
+
"onAudioInterruptionBegin",
|
|
1238
|
+
"onAudioInterruptionEnd",
|
|
1239
|
+
"onBackgroundAudioPause",
|
|
1240
|
+
"onBackgroundAudioPlay",
|
|
1241
|
+
"onBackgroundAudioStop",
|
|
1242
|
+
"onBackgroundFetchData",
|
|
1243
|
+
"onBatteryInfoChange",
|
|
1244
|
+
"onBeaconServiceChange",
|
|
1245
|
+
"onBeaconUpdate",
|
|
1246
|
+
"onBeforeAppRoute",
|
|
1247
|
+
"onBeforePageLoad",
|
|
1248
|
+
"onBeforePageUnload",
|
|
1249
|
+
"onBLECharacteristicValueChange",
|
|
1250
|
+
"onBLEConnectionStateChange",
|
|
1251
|
+
"onBLEMTUChange",
|
|
1252
|
+
"onBLEPeripheralConnectionStateChanged",
|
|
1253
|
+
"onBluetoothAdapterStateChange",
|
|
1254
|
+
"onBluetoothDeviceFound",
|
|
1255
|
+
"onCompassChange",
|
|
1256
|
+
"onCopyUrl",
|
|
1257
|
+
"onDeviceMotionChange",
|
|
1258
|
+
"onEmbeddedMiniProgramHeightChange",
|
|
1259
|
+
"onError",
|
|
1260
|
+
"onGeneratePoster",
|
|
1261
|
+
"onGetWifiList",
|
|
1262
|
+
"onGyroscopeChange",
|
|
1263
|
+
"onHCEMessage",
|
|
1264
|
+
"onKeyboardHeightChange",
|
|
1265
|
+
"onKeyDown",
|
|
1266
|
+
"onKeyUp",
|
|
1267
|
+
"onLazyLoadError",
|
|
1268
|
+
"onLocalServiceDiscoveryStop",
|
|
1269
|
+
"onLocalServiceFound",
|
|
1270
|
+
"onLocalServiceLost",
|
|
1271
|
+
"onLocalServiceResolveFail",
|
|
1272
|
+
"onLocationChange",
|
|
1273
|
+
"onLocationChangeError",
|
|
1274
|
+
"onMemoryWarning",
|
|
1275
|
+
"onMenuButtonBoundingClientRectWeightChange",
|
|
1276
|
+
"onNeedPrivacyAuthorization",
|
|
1277
|
+
"onNetworkStatusChange",
|
|
1278
|
+
"onNetworkWeakChange",
|
|
1279
|
+
"onPageNotFound",
|
|
1280
|
+
"onParallelStateChange",
|
|
1281
|
+
"onScreenRecordingStateChanged",
|
|
1282
|
+
"onSocketClose",
|
|
1283
|
+
"onSocketError",
|
|
1284
|
+
"onSocketMessage",
|
|
1285
|
+
"onSocketOpen",
|
|
1286
|
+
"onThemeChange",
|
|
1287
|
+
"onUnhandledRejection",
|
|
1288
|
+
"onUserCaptureScreen",
|
|
1289
|
+
"onUserOffTranslation",
|
|
1290
|
+
"onUserTriggerTranslation",
|
|
1291
|
+
"onVoIPChatInterrupted",
|
|
1292
|
+
"onVoIPChatMembersChanged",
|
|
1293
|
+
"onVoIPChatSpeakersChanged",
|
|
1294
|
+
"onVoIPChatStateChanged",
|
|
1295
|
+
"onVoIPVideoMembersChanged",
|
|
1296
|
+
"onWifiConnected",
|
|
1297
|
+
"onWifiConnectedWithPartialInfo",
|
|
1298
|
+
"onWindowResize",
|
|
1299
|
+
"onWindowStateChange",
|
|
1300
|
+
"openAppAuthorizeSetting",
|
|
1301
|
+
"openBluetoothAdapter",
|
|
1302
|
+
"openCard",
|
|
1303
|
+
"openChannelsActivity",
|
|
1304
|
+
"openChannelsEvent",
|
|
1305
|
+
"openChannelsLive",
|
|
1306
|
+
"openChannelsLiveNoticeInfo",
|
|
1307
|
+
"openChannelsUserProfile",
|
|
1308
|
+
"openChatTool",
|
|
1309
|
+
"openCustomerServiceChat",
|
|
1310
|
+
"openDesignerProfile",
|
|
1311
|
+
"openDocument",
|
|
1312
|
+
"openEmbeddedMiniProgram",
|
|
1313
|
+
"openHKOfflinePayView",
|
|
1314
|
+
"openInquiriesTopic",
|
|
1315
|
+
"openLocation",
|
|
1316
|
+
"openOfficialAccountArticle",
|
|
1317
|
+
"openOfficialAccountChat",
|
|
1318
|
+
"openOfficialAccountProfile",
|
|
1319
|
+
"openPrivacyContract",
|
|
1320
|
+
"openSetting",
|
|
1321
|
+
"openSingleStickerView",
|
|
1322
|
+
"openStickerIPView",
|
|
1323
|
+
"openStickerSetView",
|
|
1324
|
+
"openStoreCouponDetail"
|
|
1325
|
+
];
|
|
1326
|
+
//#endregion
|
|
1327
|
+
//#region src/core/apiCatalog/wxMethodsOpenStoreOrderDetailToWriteBLECharacteristicValue.ts
|
|
1328
|
+
/**
|
|
1329
|
+
* @description 三端 API 名单(由 typings 自动提取,请勿手工修改)
|
|
1330
|
+
* @generated by scripts/sync-api-catalog.mjs
|
|
1331
|
+
*/
|
|
1332
|
+
const WEAPI_WX_METHODS_OPEN_STORE_ORDER_DETAIL_TO_WRITE_BLECHARACTERISTIC_VALUE = [
|
|
1333
|
+
"openStoreOrderDetail",
|
|
1334
|
+
"openSystemBluetoothSetting",
|
|
1335
|
+
"openVideoEditor",
|
|
1336
|
+
"pageScrollTo",
|
|
1337
|
+
"pauseBackgroundAudio",
|
|
1338
|
+
"pauseVoice",
|
|
1339
|
+
"playBackgroundAudio",
|
|
1340
|
+
"playVoice",
|
|
1341
|
+
"pluginLogin",
|
|
1342
|
+
"postMessageToReferrerMiniProgram",
|
|
1343
|
+
"postMessageToReferrerPage",
|
|
1344
|
+
"preDownloadSubpackage",
|
|
1345
|
+
"preloadAssets",
|
|
1346
|
+
"preloadSkylineView",
|
|
1347
|
+
"preloadWebview",
|
|
1348
|
+
"previewImage",
|
|
1349
|
+
"previewMedia",
|
|
1350
|
+
"readBLECharacteristicValue",
|
|
1351
|
+
"rechargeTransitCard",
|
|
1352
|
+
"redirectTo",
|
|
1353
|
+
"reLaunch",
|
|
1354
|
+
"removeSecureElementPass",
|
|
1355
|
+
"removeStorage",
|
|
1356
|
+
"removeStorageSync",
|
|
1357
|
+
"removeTabBarBadge",
|
|
1358
|
+
"reportAnalytics",
|
|
1359
|
+
"reportEvent",
|
|
1360
|
+
"reportMonitor",
|
|
1361
|
+
"reportPerformance",
|
|
1362
|
+
"request",
|
|
1363
|
+
"requestAppleSubscribeSign",
|
|
1364
|
+
"requestCommonPayment",
|
|
1365
|
+
"requestDeviceVoIP",
|
|
1366
|
+
"requestFacialVerify",
|
|
1367
|
+
"requestIdleCallback",
|
|
1368
|
+
"requestMerchantTransfer",
|
|
1369
|
+
"requestOrderPayment",
|
|
1370
|
+
"requestPayment",
|
|
1371
|
+
"requestPluginPayment",
|
|
1372
|
+
"requestSubscribeDeviceMessage",
|
|
1373
|
+
"requestSubscribeEmployeeMessage",
|
|
1374
|
+
"requestSubscribeMessage",
|
|
1375
|
+
"requestVirtualPayment",
|
|
1376
|
+
"requirePrivacyAuthorize",
|
|
1377
|
+
"reserveChannelsLive",
|
|
1378
|
+
"restartMiniProgram",
|
|
1379
|
+
"revokeBufferURL",
|
|
1380
|
+
"rewriteRoute",
|
|
1381
|
+
"saveFileToDisk",
|
|
1382
|
+
"saveImageToPhotosAlbum",
|
|
1383
|
+
"saveVideoToPhotosAlbum",
|
|
1384
|
+
"scanCode",
|
|
1385
|
+
"seekBackgroundAudio",
|
|
1386
|
+
"selectGroupMembers",
|
|
1387
|
+
"sendHCEMessage",
|
|
1388
|
+
"sendSms",
|
|
1389
|
+
"sendSocketMessage",
|
|
1390
|
+
"setBackgroundColor",
|
|
1391
|
+
"setBackgroundFetchToken",
|
|
1392
|
+
"setBackgroundTextStyle",
|
|
1393
|
+
"setBLEMTU",
|
|
1394
|
+
"setClipboardData",
|
|
1395
|
+
"setEnable1v1Chat",
|
|
1396
|
+
"setEnableDebug",
|
|
1397
|
+
"setInnerAudioOption",
|
|
1398
|
+
"setKeepScreenOn",
|
|
1399
|
+
"setNavigationBarColor",
|
|
1400
|
+
"setNavigationBarTitle",
|
|
1401
|
+
"setScreenBrightness",
|
|
1402
|
+
"setStorage",
|
|
1403
|
+
"setStorageSync",
|
|
1404
|
+
"setTabBarBadge",
|
|
1405
|
+
"setTabBarItem",
|
|
1406
|
+
"setTabBarStyle",
|
|
1407
|
+
"setTopBarText",
|
|
1408
|
+
"setVisualEffectOnCapture",
|
|
1409
|
+
"setWifiList",
|
|
1410
|
+
"setWindowSize",
|
|
1411
|
+
"shareAppMessageToGroup",
|
|
1412
|
+
"shareEmojiToGroup",
|
|
1413
|
+
"shareFileMessage",
|
|
1414
|
+
"shareFileToGroup",
|
|
1415
|
+
"shareImageToGroup",
|
|
1416
|
+
"shareToOfficialAccount",
|
|
1417
|
+
"shareToWeRun",
|
|
1418
|
+
"shareVideoMessage",
|
|
1419
|
+
"shareVideoToGroup",
|
|
1420
|
+
"showActionSheet",
|
|
1421
|
+
"showLoading",
|
|
1422
|
+
"showModal",
|
|
1423
|
+
"showNavigationBarLoading",
|
|
1424
|
+
"showRedPackage",
|
|
1425
|
+
"showShareImageMenu",
|
|
1426
|
+
"showShareMenu",
|
|
1427
|
+
"showTabBar",
|
|
1428
|
+
"showTabBarRedDot",
|
|
1429
|
+
"showToast",
|
|
1430
|
+
"startAccelerometer",
|
|
1431
|
+
"startBeaconDiscovery",
|
|
1432
|
+
"startBluetoothDevicesDiscovery",
|
|
1433
|
+
"startCompass",
|
|
1434
|
+
"startDeviceMotionListening",
|
|
1435
|
+
"startGyroscope",
|
|
1436
|
+
"startHCE",
|
|
1437
|
+
"startLocalServiceDiscovery",
|
|
1438
|
+
"startLocationUpdate",
|
|
1439
|
+
"startLocationUpdateBackground",
|
|
1440
|
+
"startPullDownRefresh",
|
|
1441
|
+
"startRecord",
|
|
1442
|
+
"startSoterAuthentication",
|
|
1443
|
+
"startWifi",
|
|
1444
|
+
"stopAccelerometer",
|
|
1445
|
+
"stopBackgroundAudio",
|
|
1446
|
+
"stopBeaconDiscovery",
|
|
1447
|
+
"stopBluetoothDevicesDiscovery",
|
|
1448
|
+
"stopCompass",
|
|
1449
|
+
"stopDeviceMotionListening",
|
|
1450
|
+
"stopFaceDetect",
|
|
1451
|
+
"stopGyroscope",
|
|
1452
|
+
"stopHCE",
|
|
1453
|
+
"stopLocalServiceDiscovery",
|
|
1454
|
+
"stopLocationUpdate",
|
|
1455
|
+
"stopPullDownRefresh",
|
|
1456
|
+
"stopRecord",
|
|
1457
|
+
"stopVoice",
|
|
1458
|
+
"stopWifi",
|
|
1459
|
+
"subscribeVoIPVideoMembers",
|
|
1460
|
+
"switchTab",
|
|
1461
|
+
"updateShareMenu",
|
|
1462
|
+
"updateVoIPChatMuteConfig",
|
|
1463
|
+
"updateWeChatApp",
|
|
1464
|
+
"uploadFile",
|
|
1465
|
+
"vibrateLong",
|
|
1466
|
+
"vibrateShort",
|
|
1467
|
+
"writeBLECharacteristicValue"
|
|
1468
|
+
];
|
|
1469
|
+
//#endregion
|
|
1470
|
+
//#region src/core/apiCatalog/index.ts
|
|
1471
|
+
const WEAPI_WECHAT_METHODS = [
|
|
1472
|
+
...WEAPI_WX_METHODS_ADD_CARD_TO_HIDE_SHARE_MENU,
|
|
1473
|
+
...WEAPI_WX_METHODS_HIDE_TAB_BAR_TO_OPEN_STORE_COUPON_DETAIL,
|
|
1474
|
+
...WEAPI_WX_METHODS_OPEN_STORE_ORDER_DETAIL_TO_WRITE_BLECHARACTERISTIC_VALUE
|
|
1475
|
+
];
|
|
1476
|
+
const WEAPI_ALIPAY_METHODS = WEAPI_MY_METHODS;
|
|
1477
|
+
const WEAPI_DOUYIN_METHODS = WEAPI_TT_METHODS;
|
|
1478
|
+
const WEAPI_MINIPROGRAM_METHODS = WEAPI_WECHAT_METHODS;
|
|
1479
|
+
//#endregion
|
|
1480
|
+
//#region src/core/methodMapping/rules/helpersDeviceAndStorage.ts
|
|
1481
|
+
const PLATFORM_ALIASES$1 = { kuaishou: "ks" };
|
|
1482
|
+
function mapSaveFileArgs(args) {
|
|
1483
|
+
if (args.length === 0) return args;
|
|
1484
|
+
const nextArgs = [...args];
|
|
1485
|
+
const lastIndex = nextArgs.length - 1;
|
|
1486
|
+
const lastArg = nextArgs[lastIndex];
|
|
1487
|
+
if (!isPlainObject(lastArg)) return nextArgs;
|
|
1488
|
+
const nextOptions = { ...lastArg };
|
|
1489
|
+
if (!hasOwn(nextOptions, "apFilePath") && hasOwn(nextOptions, "tempFilePath")) nextOptions.apFilePath = nextOptions.tempFilePath;
|
|
1490
|
+
nextArgs[lastIndex] = nextOptions;
|
|
1491
|
+
return nextArgs;
|
|
1492
|
+
}
|
|
1493
|
+
function mapCreateRewardedVideoAdArgs(args) {
|
|
1494
|
+
if (args.length === 0) return args;
|
|
1495
|
+
const nextArgs = [...args];
|
|
1496
|
+
const lastIndex = nextArgs.length - 1;
|
|
1497
|
+
const lastArg = nextArgs[lastIndex];
|
|
1498
|
+
if (!isPlainObject(lastArg)) return nextArgs;
|
|
1499
|
+
if (hasOwn(lastArg, "multiton") && lastArg.multiton === true) throw createNotSupportedError("createRewardedVideoAd", "my");
|
|
1500
|
+
if (hasOwn(lastArg, "disableFallbackSharePage") && lastArg.disableFallbackSharePage === true) throw createNotSupportedError("createRewardedVideoAd", "my");
|
|
1501
|
+
const adUnitId = lastArg.adUnitId;
|
|
1502
|
+
if (typeof adUnitId === "string" && adUnitId.length > 0) nextArgs[lastIndex] = adUnitId;
|
|
1503
|
+
return nextArgs;
|
|
1504
|
+
}
|
|
1505
|
+
function mapRewardedAdInstance(result, args = []) {
|
|
1506
|
+
if (typeof result !== "object" || result === null) return result;
|
|
1507
|
+
const adUnitIdArg = args.length > 0 ? args[args.length - 1] : void 0;
|
|
1508
|
+
const adUnitId = typeof adUnitIdArg === "string" ? adUnitIdArg : void 0;
|
|
1509
|
+
if (!adUnitId) return result;
|
|
1510
|
+
const rewardedAd = result;
|
|
1511
|
+
const wrapMethod = (name) => {
|
|
1512
|
+
const method = rewardedAd[name];
|
|
1513
|
+
if (typeof method !== "function") return method;
|
|
1514
|
+
return (options) => {
|
|
1515
|
+
if (isPlainObject(options)) return method.call(rewardedAd, {
|
|
1516
|
+
...options,
|
|
1517
|
+
adUnitId
|
|
1518
|
+
});
|
|
1519
|
+
if (options === void 0) return method.call(rewardedAd, { adUnitId });
|
|
1520
|
+
return method.call(rewardedAd, options);
|
|
1521
|
+
};
|
|
1522
|
+
};
|
|
1523
|
+
const nextRewardedAd = Object.create(rewardedAd);
|
|
1524
|
+
nextRewardedAd.destroy = wrapMethod("destroy");
|
|
1525
|
+
nextRewardedAd.load = wrapMethod("load");
|
|
1526
|
+
nextRewardedAd.show = wrapMethod("show");
|
|
1527
|
+
return nextRewardedAd;
|
|
1528
|
+
}
|
|
1529
|
+
function mapCheckIsSoterEnrolledInDeviceArgs(args) {
|
|
1530
|
+
if (args.length === 0) return args;
|
|
1531
|
+
const nextArgs = [...args];
|
|
1532
|
+
const lastArg = nextArgs[nextArgs.length - 1];
|
|
1533
|
+
if (!isPlainObject(lastArg)) return nextArgs;
|
|
1534
|
+
if (lastArg.checkAuthMode === "speech") throw createNotSupportedError("checkIsSoterEnrolledInDevice", "my");
|
|
1535
|
+
return nextArgs;
|
|
1536
|
+
}
|
|
1537
|
+
function mapSoterCheckResult(methodName, result) {
|
|
1538
|
+
if (!isPlainObject(result)) return result;
|
|
1539
|
+
if (hasOwn(result, "errMsg")) return result;
|
|
1540
|
+
return {
|
|
1541
|
+
...result,
|
|
1542
|
+
errMsg: `${methodName}:ok`
|
|
1543
|
+
};
|
|
1544
|
+
}
|
|
1545
|
+
function toNumberCode(value) {
|
|
1546
|
+
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
1547
|
+
if (typeof value === "string") {
|
|
1548
|
+
const parsed = Number(value);
|
|
1549
|
+
if (Number.isFinite(parsed)) return parsed;
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
function mapBleConnectionResult(methodName, codeKey, result) {
|
|
1553
|
+
if (!isPlainObject(result)) return result;
|
|
1554
|
+
const nextResult = { ...result };
|
|
1555
|
+
if (!hasOwn(nextResult, "errCode")) {
|
|
1556
|
+
const code = toNumberCode(nextResult[codeKey]);
|
|
1557
|
+
if (typeof code === "number") nextResult.errCode = code;
|
|
1558
|
+
}
|
|
1559
|
+
if (!hasOwn(nextResult, "errMsg")) {
|
|
1560
|
+
if (typeof nextResult.errorMessage === "string" && nextResult.errorMessage.length > 0) nextResult.errMsg = nextResult.errorMessage;
|
|
1561
|
+
else if (nextResult.errCode === 0) nextResult.errMsg = `${methodName}:ok`;
|
|
1562
|
+
}
|
|
1563
|
+
return nextResult;
|
|
1564
|
+
}
|
|
1565
|
+
function mapCreateBleConnectionResult(result) {
|
|
1566
|
+
return mapBleConnectionResult("createBLEConnection", "error", result);
|
|
1567
|
+
}
|
|
1568
|
+
function mapCloseBleConnectionResult(result) {
|
|
1569
|
+
return mapBleConnectionResult("closeBLEConnection", "errorCode", result);
|
|
1570
|
+
}
|
|
1571
|
+
function mapSaveFileResult(result) {
|
|
1572
|
+
if (!isPlainObject(result)) return result;
|
|
1573
|
+
if (!hasOwn(result, "savedFilePath") && hasOwn(result, "apFilePath")) return {
|
|
1574
|
+
...result,
|
|
1575
|
+
savedFilePath: result.apFilePath
|
|
1576
|
+
};
|
|
1577
|
+
return result;
|
|
1578
|
+
}
|
|
1579
|
+
function mapDouyinSaveFileResult(result) {
|
|
1580
|
+
if (!isPlainObject(result)) return result;
|
|
1581
|
+
if (!hasOwn(result, "savedFilePath") && hasOwn(result, "filePath")) return {
|
|
1582
|
+
...result,
|
|
1583
|
+
savedFilePath: result.filePath
|
|
1584
|
+
};
|
|
1585
|
+
return result;
|
|
1586
|
+
}
|
|
1587
|
+
function normalizePlatformName$1(value) {
|
|
1588
|
+
const normalized = normalizeMiniProgramPlatform(value);
|
|
1589
|
+
if (!normalized) return;
|
|
1590
|
+
const miniProgramPlatform = resolveMiniProgramPlatform(normalized);
|
|
1591
|
+
if (miniProgramPlatform) return miniProgramPlatform.globalObjectKey;
|
|
1592
|
+
return PLATFORM_ALIASES$1[normalized] ?? normalized;
|
|
1593
|
+
}
|
|
1594
|
+
//#endregion
|
|
1595
|
+
//#region src/core/methodMapping/rules/helpersUi.ts
|
|
1596
|
+
function mapToastType(type) {
|
|
1597
|
+
if (type === "error") return "fail";
|
|
1598
|
+
if (type === "loading") return "none";
|
|
1599
|
+
return type;
|
|
1600
|
+
}
|
|
1601
|
+
function mapToastArgs(args) {
|
|
1602
|
+
if (args.length === 0) return args;
|
|
1603
|
+
const nextArgs = [...args];
|
|
1604
|
+
const lastIndex = nextArgs.length - 1;
|
|
1605
|
+
const lastArg = nextArgs[lastIndex];
|
|
1606
|
+
if (!isPlainObject(lastArg)) return nextArgs;
|
|
1607
|
+
const nextOptions = { ...lastArg };
|
|
1608
|
+
if (!hasOwn(nextOptions, "content") && hasOwn(nextOptions, "title")) nextOptions.content = nextOptions.title;
|
|
1609
|
+
if (hasOwn(nextOptions, "icon")) nextOptions.type = mapToastType(nextOptions.icon);
|
|
1610
|
+
nextArgs[lastIndex] = nextOptions;
|
|
1611
|
+
return nextArgs;
|
|
1612
|
+
}
|
|
1613
|
+
function mapDouyinToastArgs(args) {
|
|
1614
|
+
if (args.length === 0) return args;
|
|
1615
|
+
const nextArgs = [...args];
|
|
1616
|
+
const lastIndex = nextArgs.length - 1;
|
|
1617
|
+
const lastArg = nextArgs[lastIndex];
|
|
1618
|
+
if (!isPlainObject(lastArg)) return nextArgs;
|
|
1619
|
+
const nextOptions = { ...lastArg };
|
|
1620
|
+
if (nextOptions.icon === "error") nextOptions.icon = "fail";
|
|
1621
|
+
nextArgs[lastIndex] = nextOptions;
|
|
1622
|
+
return nextArgs;
|
|
1623
|
+
}
|
|
1624
|
+
function mapLoadingArgs(args) {
|
|
1625
|
+
if (args.length === 0) return args;
|
|
1626
|
+
const nextArgs = [...args];
|
|
1627
|
+
const lastIndex = nextArgs.length - 1;
|
|
1628
|
+
const lastArg = nextArgs[lastIndex];
|
|
1629
|
+
if (!isPlainObject(lastArg)) return nextArgs;
|
|
1630
|
+
const nextOptions = { ...lastArg };
|
|
1631
|
+
if (!hasOwn(nextOptions, "content") && hasOwn(nextOptions, "title")) nextOptions.content = nextOptions.title;
|
|
1632
|
+
nextArgs[lastIndex] = nextOptions;
|
|
1633
|
+
return nextArgs;
|
|
1634
|
+
}
|
|
1635
|
+
function mapActionSheetArgs(args) {
|
|
1636
|
+
if (args.length === 0) return args;
|
|
1637
|
+
const nextArgs = [...args];
|
|
1638
|
+
const lastIndex = nextArgs.length - 1;
|
|
1639
|
+
const lastArg = nextArgs[lastIndex];
|
|
1640
|
+
if (!isPlainObject(lastArg)) return nextArgs;
|
|
1641
|
+
const nextOptions = { ...lastArg };
|
|
1642
|
+
if (!hasOwn(nextOptions, "items") && Array.isArray(nextOptions.itemList)) nextOptions.items = nextOptions.itemList;
|
|
1643
|
+
nextArgs[lastIndex] = nextOptions;
|
|
1644
|
+
return nextArgs;
|
|
1645
|
+
}
|
|
1646
|
+
function mapActionSheetResult(result) {
|
|
1647
|
+
if (!isPlainObject(result)) return result;
|
|
1648
|
+
if (!hasOwn(result, "tapIndex") && hasOwn(result, "index")) return {
|
|
1649
|
+
...result,
|
|
1650
|
+
tapIndex: result.index
|
|
1651
|
+
};
|
|
1652
|
+
return result;
|
|
1653
|
+
}
|
|
1654
|
+
function mapModalArgs(args) {
|
|
1655
|
+
if (args.length === 0) return args;
|
|
1656
|
+
const nextArgs = [...args];
|
|
1657
|
+
const lastIndex = nextArgs.length - 1;
|
|
1658
|
+
const lastArg = nextArgs[lastIndex];
|
|
1659
|
+
if (!isPlainObject(lastArg)) return nextArgs;
|
|
1660
|
+
const nextOptions = { ...lastArg };
|
|
1661
|
+
if (hasOwn(nextOptions, "showCancel") && nextOptions.showCancel === false) throw createNotSupportedError("showModal", "my");
|
|
1662
|
+
if (hasOwn(nextOptions, "editable") && nextOptions.editable === true) throw createNotSupportedError("showModal", "my");
|
|
1663
|
+
if (hasOwn(nextOptions, "placeholderText")) throw createNotSupportedError("showModal", "my");
|
|
1664
|
+
if (!hasOwn(nextOptions, "confirmButtonText") && hasOwn(nextOptions, "confirmText")) nextOptions.confirmButtonText = nextOptions.confirmText;
|
|
1665
|
+
if (!hasOwn(nextOptions, "cancelButtonText") && hasOwn(nextOptions, "cancelText")) nextOptions.cancelButtonText = nextOptions.cancelText;
|
|
1666
|
+
nextArgs[lastIndex] = nextOptions;
|
|
1667
|
+
return nextArgs;
|
|
1668
|
+
}
|
|
1669
|
+
function mapModalResult(result) {
|
|
1670
|
+
if (!isPlainObject(result)) return result;
|
|
1671
|
+
let changed = false;
|
|
1672
|
+
const nextResult = { ...result };
|
|
1673
|
+
if (!hasOwn(nextResult, "cancel") && hasOwn(nextResult, "confirm")) {
|
|
1674
|
+
nextResult.cancel = !nextResult.confirm;
|
|
1675
|
+
changed = true;
|
|
1676
|
+
}
|
|
1677
|
+
if (!hasOwn(nextResult, "content")) {
|
|
1678
|
+
nextResult.content = "";
|
|
1679
|
+
changed = true;
|
|
1680
|
+
}
|
|
1681
|
+
return changed ? nextResult : result;
|
|
1682
|
+
}
|
|
1683
|
+
function mapChooseImageResult(result) {
|
|
1684
|
+
if (!isPlainObject(result)) return result;
|
|
1685
|
+
if (!hasOwn(result, "tempFilePaths") && Array.isArray(result.apFilePaths)) return {
|
|
1686
|
+
...result,
|
|
1687
|
+
tempFilePaths: result.apFilePaths
|
|
1688
|
+
};
|
|
1689
|
+
return result;
|
|
1690
|
+
}
|
|
1691
|
+
function mapDouyinChooseImageResult(result) {
|
|
1692
|
+
if (!isPlainObject(result)) return result;
|
|
1693
|
+
if (typeof result.tempFilePaths === "string") return {
|
|
1694
|
+
...result,
|
|
1695
|
+
tempFilePaths: [result.tempFilePaths]
|
|
1696
|
+
};
|
|
1697
|
+
if (!Array.isArray(result.tempFilePaths) && Array.isArray(result.tempFiles)) {
|
|
1698
|
+
const fallbackPaths = result.tempFiles.map((item) => {
|
|
1699
|
+
if (!isPlainObject(item)) return;
|
|
1700
|
+
const path = item.path;
|
|
1701
|
+
if (typeof path === "string" && path) return path;
|
|
1702
|
+
const filePath = item.filePath;
|
|
1703
|
+
if (typeof filePath === "string" && filePath) return filePath;
|
|
1704
|
+
}).filter((item) => typeof item === "string");
|
|
1705
|
+
if (fallbackPaths.length > 0) return {
|
|
1706
|
+
...result,
|
|
1707
|
+
tempFilePaths: fallbackPaths
|
|
1708
|
+
};
|
|
1709
|
+
}
|
|
1710
|
+
return result;
|
|
1711
|
+
}
|
|
1712
|
+
//#endregion
|
|
1713
|
+
//#region src/core/methodMapping/rules/helpersMediaClipboard.ts
|
|
1714
|
+
function mapSetClipboardArgs(args) {
|
|
1715
|
+
if (args.length === 0) return args;
|
|
1716
|
+
const nextArgs = [...args];
|
|
1717
|
+
const lastIndex = nextArgs.length - 1;
|
|
1718
|
+
const lastArg = nextArgs[lastIndex];
|
|
1719
|
+
if (!isPlainObject(lastArg)) return nextArgs;
|
|
1720
|
+
const nextOptions = { ...lastArg };
|
|
1721
|
+
if (!hasOwn(nextOptions, "text") && hasOwn(nextOptions, "data")) nextOptions.text = nextOptions.data;
|
|
1722
|
+
nextArgs[lastIndex] = nextOptions;
|
|
1723
|
+
return nextArgs;
|
|
1724
|
+
}
|
|
1725
|
+
function mapClipboardResult(result) {
|
|
1726
|
+
if (!isPlainObject(result)) return result;
|
|
1727
|
+
if (!hasOwn(result, "data") && hasOwn(result, "text")) return {
|
|
1728
|
+
...result,
|
|
1729
|
+
data: result.text
|
|
1730
|
+
};
|
|
1731
|
+
return result;
|
|
1732
|
+
}
|
|
1733
|
+
function resolveFilePaths(result) {
|
|
1734
|
+
if (!isPlainObject(result)) return [];
|
|
1735
|
+
if (typeof result.tempFilePaths === "string" && result.tempFilePaths) return [result.tempFilePaths];
|
|
1736
|
+
if (Array.isArray(result.tempFilePaths)) return result.tempFilePaths.filter((item) => typeof item === "string" && item.length > 0);
|
|
1737
|
+
if (Array.isArray(result.apFilePaths)) return result.apFilePaths.filter((item) => typeof item === "string" && item.length > 0);
|
|
1738
|
+
if (Array.isArray(result.tempFiles)) return result.tempFiles.map((item) => {
|
|
1739
|
+
if (!isPlainObject(item)) return;
|
|
1740
|
+
if (typeof item.tempFilePath === "string" && item.tempFilePath) return item.tempFilePath;
|
|
1741
|
+
if (typeof item.path === "string" && item.path) return item.path;
|
|
1742
|
+
if (typeof item.filePath === "string" && item.filePath) return item.filePath;
|
|
1743
|
+
}).filter((item) => typeof item === "string");
|
|
1744
|
+
return [];
|
|
1745
|
+
}
|
|
1746
|
+
function mapChooseMediaResultFromImage(result) {
|
|
1747
|
+
const normalized = mapChooseImageResult(result);
|
|
1748
|
+
if (!isPlainObject(normalized)) return normalized;
|
|
1749
|
+
if (Array.isArray(normalized.tempFiles) && normalized.tempFiles.length > 0) return normalized;
|
|
1750
|
+
const tempFilePaths = resolveFilePaths(normalized);
|
|
1751
|
+
if (tempFilePaths.length === 0) return normalized;
|
|
1752
|
+
return {
|
|
1753
|
+
...normalized,
|
|
1754
|
+
tempFilePaths,
|
|
1755
|
+
tempFiles: tempFilePaths.map((tempFilePath) => ({
|
|
1756
|
+
tempFilePath,
|
|
1757
|
+
fileType: "image"
|
|
1758
|
+
})),
|
|
1759
|
+
type: "image"
|
|
1760
|
+
};
|
|
1761
|
+
}
|
|
1762
|
+
//#endregion
|
|
1763
|
+
//#region src/core/methodMapping/rules/myBindEmployeeRelationToSendHCEMessage.ts
|
|
1764
|
+
const MY_METHOD_MAPPINGS_BIND_EMPLOYEE_RELATION_TO_SEND_HCEMESSAGE = {
|
|
1765
|
+
bindEmployeeRelation: { target: "bindEmployeeRelation" },
|
|
1766
|
+
canAddSecureElementPass: { target: "canAddSecureElementPass" },
|
|
1767
|
+
canvasGetImageData: { target: "canvasGetImageData" },
|
|
1768
|
+
canvasPutImageData: { target: "canvasPutImageData" },
|
|
1769
|
+
checkDeviceSupportHevc: { target: "checkDeviceSupportHevc" },
|
|
1770
|
+
checkEmployeeRelation: { target: "checkEmployeeRelation" },
|
|
1771
|
+
checkIsAddedToMyMiniProgram: { target: "checkIsAddedToMyMiniProgram" },
|
|
1772
|
+
checkIsOpenAccessibility: { target: "checkIsOpenAccessibility" },
|
|
1773
|
+
checkIsPictureInPictureActive: { target: "checkIsPictureInPictureActive" },
|
|
1774
|
+
checkIsSoterEnrolledInDevice: {
|
|
1775
|
+
target: "checkIsIfaaEnrolledInDevice",
|
|
1776
|
+
mapArgs: mapCheckIsSoterEnrolledInDeviceArgs,
|
|
1777
|
+
mapResult: (result) => mapSoterCheckResult("checkIsSoterEnrolledInDevice", result)
|
|
1778
|
+
},
|
|
1779
|
+
checkIsSupportSoterAuthentication: {
|
|
1780
|
+
target: "checkIsSupportIfaaAuthentication",
|
|
1781
|
+
mapResult: (result) => mapSoterCheckResult("checkIsSupportSoterAuthentication", result)
|
|
1782
|
+
},
|
|
1783
|
+
openCard: { target: "openCard" },
|
|
1784
|
+
openChannelsActivity: { target: "openChannelsActivity" },
|
|
1785
|
+
openChannelsEvent: { target: "openChannelsEvent" },
|
|
1786
|
+
openChannelsLive: { target: "openChannelsLive" },
|
|
1787
|
+
openChannelsLiveNoticeInfo: { target: "openChannelsLiveNoticeInfo" },
|
|
1788
|
+
openChannelsUserProfile: { target: "openChannelsUserProfile" },
|
|
1789
|
+
openChatTool: { target: "openChatTool" },
|
|
1790
|
+
openHKOfflinePayView: { target: "openHKOfflinePayView" },
|
|
1791
|
+
openInquiriesTopic: { target: "openInquiriesTopic" },
|
|
1792
|
+
openOfficialAccountArticle: { target: "openOfficialAccountArticle" },
|
|
1793
|
+
openOfficialAccountChat: { target: "openOfficialAccountChat" },
|
|
1794
|
+
openOfficialAccountProfile: { target: "openOfficialAccountProfile" },
|
|
1795
|
+
openPrivacyContract: { target: "openPrivacyContract" },
|
|
1796
|
+
openSystemBluetoothSetting: { target: "openSystemBluetoothSetting" },
|
|
1797
|
+
reportEvent: { target: "reportEvent" },
|
|
1798
|
+
reportMonitor: { target: "reportMonitor" },
|
|
1799
|
+
reportPerformance: { target: "reportPerformance" },
|
|
1800
|
+
openSingleStickerView: { target: "openSingleStickerView" },
|
|
1801
|
+
openStickerIPView: { target: "openStickerIPView" },
|
|
1802
|
+
openStickerSetView: { target: "openStickerSetView" },
|
|
1803
|
+
openStoreCouponDetail: { target: "openStoreCouponDetail" },
|
|
1804
|
+
openStoreOrderDetail: { target: "openStoreOrderDetail" },
|
|
1805
|
+
pauseBackgroundAudio: { target: "pauseBackgroundAudio" },
|
|
1806
|
+
pauseVoice: { target: "pauseVoice" },
|
|
1807
|
+
playBackgroundAudio: { target: "playBackgroundAudio" },
|
|
1808
|
+
playVoice: { target: "playVoice" },
|
|
1809
|
+
postMessageToReferrerMiniProgram: { target: "postMessageToReferrerMiniProgram" },
|
|
1810
|
+
postMessageToReferrerPage: { target: "postMessageToReferrerPage" },
|
|
1811
|
+
preDownloadSubpackage: { target: "preDownloadSubpackage" },
|
|
1812
|
+
preloadAssets: { target: "preloadAssets" },
|
|
1813
|
+
preloadSkylineView: { target: "preloadSkylineView" },
|
|
1814
|
+
preloadWebview: { target: "preloadWebview" },
|
|
1815
|
+
removeSecureElementPass: { target: "removeSecureElementPass" },
|
|
1816
|
+
chooseInvoiceTitle: { target: "chooseInvoiceTitle" },
|
|
1817
|
+
chooseLicensePlate: { target: "chooseLicensePlate" },
|
|
1818
|
+
choosePoi: { target: "choosePoi" },
|
|
1819
|
+
closeBLEConnection: {
|
|
1820
|
+
target: "disconnectBLEDevice",
|
|
1821
|
+
mapResult: mapCloseBleConnectionResult
|
|
1822
|
+
},
|
|
1823
|
+
createBLEConnection: {
|
|
1824
|
+
target: "connectBLEDevice",
|
|
1825
|
+
mapResult: mapCreateBleConnectionResult
|
|
1826
|
+
},
|
|
1827
|
+
cropImage: { target: "cropImage" },
|
|
1828
|
+
editImage: { target: "editImage" },
|
|
1829
|
+
exitVoIPChat: { target: "exitVoIPChat" },
|
|
1830
|
+
faceDetect: { target: "faceDetect" },
|
|
1831
|
+
getApiCategory: { target: "getApiCategory" },
|
|
1832
|
+
getBackgroundFetchToken: { target: "getBackgroundFetchToken" },
|
|
1833
|
+
getChannelsLiveInfo: { target: "getChannelsLiveInfo" },
|
|
1834
|
+
getChannelsLiveNoticeInfo: { target: "getChannelsLiveNoticeInfo" },
|
|
1835
|
+
getChannelsShareKey: { target: "getChannelsShareKey" },
|
|
1836
|
+
getChatToolInfo: { target: "getChatToolInfo" },
|
|
1837
|
+
getCommonConfig: { target: "getCommonConfig" },
|
|
1838
|
+
getGroupEnterInfo: { target: "getGroupEnterInfo" },
|
|
1839
|
+
getPrivacySetting: { target: "getPrivacySetting" },
|
|
1840
|
+
initFaceDetect: { target: "initFaceDetect" },
|
|
1841
|
+
join1v1Chat: { target: "join1v1Chat" },
|
|
1842
|
+
requestCommonPayment: { target: "requestCommonPayment" },
|
|
1843
|
+
requestDeviceVoIP: { target: "requestDeviceVoIP" },
|
|
1844
|
+
requestMerchantTransfer: { target: "requestMerchantTransfer" },
|
|
1845
|
+
requirePrivacyAuthorize: { target: "requirePrivacyAuthorize" },
|
|
1846
|
+
reserveChannelsLive: { target: "reserveChannelsLive" },
|
|
1847
|
+
selectGroupMembers: { target: "selectGroupMembers" },
|
|
1848
|
+
sendHCEMessage: { target: "sendHCEMessage" }
|
|
1849
|
+
};
|
|
1850
|
+
//#endregion
|
|
1851
|
+
//#region src/core/methodMapping/rules/myCreateVKSessionToOffBLEConnectionStateChange.ts
|
|
1852
|
+
const MY_METHOD_MAPPINGS_CREATE_VKSESSION_TO_OFF_BLECONNECTION_STATE_CHANGE = {
|
|
1853
|
+
createVKSession: { target: "createVKSession" },
|
|
1854
|
+
compressVideo: { target: "compressVideo" },
|
|
1855
|
+
openVideoEditor: { target: "openVideoEditor" },
|
|
1856
|
+
getShareInfo: { target: "getShareInfo" },
|
|
1857
|
+
joinVoIPChat: { target: "joinVoIPChat" },
|
|
1858
|
+
openDocument: { target: "openDocument" },
|
|
1859
|
+
saveVideoToPhotosAlbum: { target: "saveVideoToPhotosAlbum" },
|
|
1860
|
+
batchSetStorage: { target: "batchSetStorage" },
|
|
1861
|
+
batchGetStorage: { target: "batchGetStorage" },
|
|
1862
|
+
batchSetStorageSync: { target: "batchSetStorageSync" },
|
|
1863
|
+
batchGetStorageSync: { target: "batchGetStorageSync" },
|
|
1864
|
+
createCameraContext: { target: "createCameraContext" },
|
|
1865
|
+
offMemoryWarning: { target: "offMemoryWarning" },
|
|
1866
|
+
cancelIdleCallback: { target: "cancelIdleCallback" },
|
|
1867
|
+
onBLEConnectionStateChange: { target: "onBLEConnectionStateChanged" },
|
|
1868
|
+
offBLEConnectionStateChange: { target: "offBLEConnectionStateChanged" }
|
|
1869
|
+
};
|
|
1870
|
+
//#endregion
|
|
1871
|
+
//#region src/core/methodMapping/rules/mySendSmsToOpenCustomerServiceChat.ts
|
|
1872
|
+
const MY_METHOD_MAPPINGS_SEND_SMS_TO_OPEN_CUSTOMER_SERVICE_CHAT = {
|
|
1873
|
+
sendSms: { target: "sendSms" },
|
|
1874
|
+
setBackgroundFetchToken: { target: "setBackgroundFetchToken" },
|
|
1875
|
+
setEnable1v1Chat: { target: "setEnable1v1Chat" },
|
|
1876
|
+
setTopBarText: { target: "setTopBarText" },
|
|
1877
|
+
setWindowSize: { target: "setWindowSize" },
|
|
1878
|
+
stopHCE: { target: "stopHCE" },
|
|
1879
|
+
stopLocalServiceDiscovery: { target: "stopLocalServiceDiscovery" },
|
|
1880
|
+
stopLocationUpdate: { target: "stopLocationUpdate" },
|
|
1881
|
+
stopRecord: { target: "stopRecord" },
|
|
1882
|
+
stopVoice: { target: "stopVoice" },
|
|
1883
|
+
subscribeVoIPVideoMembers: { target: "subscribeVoIPVideoMembers" },
|
|
1884
|
+
updateVoIPChatMuteConfig: { target: "updateVoIPChatMuteConfig" },
|
|
1885
|
+
updateWeChatApp: { target: "updateWeChatApp" },
|
|
1886
|
+
getBackgroundAudioPlayerState: { target: "getBackgroundAudioPlayerState" },
|
|
1887
|
+
getDeviceBenchmarkInfo: { target: "getDeviceBenchmarkInfo" },
|
|
1888
|
+
getDeviceVoIPList: { target: "getDeviceVoIPList" },
|
|
1889
|
+
getHCEState: { target: "getHCEState" },
|
|
1890
|
+
getInferenceEnvInfo: { target: "getInferenceEnvInfo" },
|
|
1891
|
+
getNFCAdapter: { target: "getNFCAdapter" },
|
|
1892
|
+
getPerformance: { target: "getPerformance" },
|
|
1893
|
+
getRandomValues: { target: "getRandomValues" },
|
|
1894
|
+
getRealtimeLogManager: { target: "getRealtimeLogManager" },
|
|
1895
|
+
getRendererUserAgent: { target: "getRendererUserAgent" },
|
|
1896
|
+
getScreenRecordingState: { target: "getScreenRecordingState" },
|
|
1897
|
+
getSecureElementPasses: { target: "getSecureElementPasses" },
|
|
1898
|
+
getSelectedTextRange: { target: "getSelectedTextRange" },
|
|
1899
|
+
getShowSplashAdStatus: { target: "getShowSplashAdStatus" },
|
|
1900
|
+
getSkylineInfo: { target: "getSkylineInfo" },
|
|
1901
|
+
getUserCryptoManager: { target: "getUserCryptoManager" },
|
|
1902
|
+
getWeRunData: { target: "getWeRunData" },
|
|
1903
|
+
getXrFrameSystem: { target: "getXrFrameSystem" },
|
|
1904
|
+
isBluetoothDevicePaired: { target: "isBluetoothDevicePaired" },
|
|
1905
|
+
isVKSupport: { target: "isVKSupport" },
|
|
1906
|
+
createBLEPeripheralServer: { target: "createBLEPeripheralServer" },
|
|
1907
|
+
createBufferURL: { target: "createBufferURL" },
|
|
1908
|
+
createCacheManager: { target: "createCacheManager" },
|
|
1909
|
+
createGlobalPayment: { target: "createGlobalPayment" },
|
|
1910
|
+
createInferenceSession: { target: "createInferenceSession" },
|
|
1911
|
+
createMediaAudioPlayer: { target: "createMediaAudioPlayer" },
|
|
1912
|
+
createMediaContainer: { target: "createMediaContainer" },
|
|
1913
|
+
createMediaRecorder: { target: "createMediaRecorder" },
|
|
1914
|
+
createTCPSocket: { target: "createTCPSocket" },
|
|
1915
|
+
createUDPSocket: { target: "createUDPSocket" },
|
|
1916
|
+
createVideoDecoder: { target: "createVideoDecoder" },
|
|
1917
|
+
loadBuiltInFontFace: { target: "loadBuiltInFontFace" },
|
|
1918
|
+
notifyGroupMembers: { target: "notifyGroupMembers" },
|
|
1919
|
+
requestIdleCallback: { target: "requestIdleCallback" },
|
|
1920
|
+
revokeBufferURL: { target: "revokeBufferURL" },
|
|
1921
|
+
rewriteRoute: { target: "rewriteRoute" },
|
|
1922
|
+
seekBackgroundAudio: { target: "seekBackgroundAudio" },
|
|
1923
|
+
setEnableDebug: { target: "setEnableDebug" },
|
|
1924
|
+
setInnerAudioOption: { target: "setInnerAudioOption" },
|
|
1925
|
+
shareAppMessageToGroup: { target: "shareAppMessageToGroup" },
|
|
1926
|
+
shareEmojiToGroup: { target: "shareEmojiToGroup" },
|
|
1927
|
+
shareFileMessage: { target: "shareFileMessage" },
|
|
1928
|
+
shareFileToGroup: { target: "shareFileToGroup" },
|
|
1929
|
+
shareImageToGroup: { target: "shareImageToGroup" },
|
|
1930
|
+
shareToOfficialAccount: { target: "shareToOfficialAccount" },
|
|
1931
|
+
shareToWeRun: { target: "shareToWeRun" },
|
|
1932
|
+
shareVideoMessage: { target: "shareVideoMessage" },
|
|
1933
|
+
shareVideoToGroup: { target: "shareVideoToGroup" },
|
|
1934
|
+
showRedPackage: { target: "showRedPackage" },
|
|
1935
|
+
startDeviceMotionListening: { target: "startDeviceMotionListening" },
|
|
1936
|
+
startHCE: { target: "startHCE" },
|
|
1937
|
+
startLocalServiceDiscovery: { target: "startLocalServiceDiscovery" },
|
|
1938
|
+
startLocationUpdate: { target: "startLocationUpdate" },
|
|
1939
|
+
startLocationUpdateBackground: { target: "startLocationUpdateBackground" },
|
|
1940
|
+
startRecord: { target: "startRecord" },
|
|
1941
|
+
startSoterAuthentication: { target: "startSoterAuthentication" },
|
|
1942
|
+
stopBackgroundAudio: { target: "stopBackgroundAudio" },
|
|
1943
|
+
stopDeviceMotionListening: { target: "stopDeviceMotionListening" },
|
|
1944
|
+
stopFaceDetect: { target: "stopFaceDetect" },
|
|
1945
|
+
openCustomerServiceChat: { target: "openCustomerServiceChat" }
|
|
1946
|
+
};
|
|
1947
|
+
//#endregion
|
|
1948
|
+
//#region src/core/methodMapping/rules/my.ts
|
|
1949
|
+
const MY_METHOD_MAPPINGS = {
|
|
1950
|
+
showToast: {
|
|
1951
|
+
target: "showToast",
|
|
1952
|
+
mapArgs: mapToastArgs
|
|
1953
|
+
},
|
|
1954
|
+
showLoading: {
|
|
1955
|
+
target: "showLoading",
|
|
1956
|
+
mapArgs: mapLoadingArgs
|
|
1957
|
+
},
|
|
1958
|
+
showActionSheet: {
|
|
1959
|
+
target: "showActionSheet",
|
|
1960
|
+
mapArgs: mapActionSheetArgs,
|
|
1961
|
+
mapResult: mapActionSheetResult
|
|
1962
|
+
},
|
|
1963
|
+
showModal: {
|
|
1964
|
+
target: "confirm",
|
|
1965
|
+
mapArgs: mapModalArgs,
|
|
1966
|
+
mapResult: mapModalResult
|
|
1967
|
+
},
|
|
1968
|
+
chooseImage: {
|
|
1969
|
+
target: "chooseImage",
|
|
1970
|
+
mapResult: mapChooseImageResult
|
|
1971
|
+
},
|
|
1972
|
+
chooseMedia: { target: "chooseMedia" },
|
|
1973
|
+
chooseMessageFile: { target: "chooseMessageFile" },
|
|
1974
|
+
getFuzzyLocation: { target: "getFuzzyLocation" },
|
|
1975
|
+
previewMedia: { target: "previewMedia" },
|
|
1976
|
+
createInterstitialAd: { target: "createInterstitialAd" },
|
|
1977
|
+
createRewardedVideoAd: {
|
|
1978
|
+
target: "createRewardedAd",
|
|
1979
|
+
mapArgs: mapCreateRewardedVideoAdArgs,
|
|
1980
|
+
mapResult: mapRewardedAdInstance
|
|
1981
|
+
},
|
|
1982
|
+
createLivePlayerContext: { target: "createLivePlayerContext" },
|
|
1983
|
+
createLivePusherContext: { target: "createLivePusherContext" },
|
|
1984
|
+
getVideoInfo: { target: "getVideoInfo" },
|
|
1985
|
+
saveFile: {
|
|
1986
|
+
target: "saveFile",
|
|
1987
|
+
mapArgs: mapSaveFileArgs,
|
|
1988
|
+
mapResult: mapSaveFileResult
|
|
1989
|
+
},
|
|
1990
|
+
setClipboardData: {
|
|
1991
|
+
target: "setClipboard",
|
|
1992
|
+
mapArgs: mapSetClipboardArgs
|
|
1993
|
+
},
|
|
1994
|
+
getClipboardData: {
|
|
1995
|
+
target: "getClipboard",
|
|
1996
|
+
mapResult: mapClipboardResult
|
|
1997
|
+
},
|
|
1998
|
+
chooseAddress: { target: "chooseAddress" },
|
|
1999
|
+
createAudioContext: { target: "createAudioContext" },
|
|
2000
|
+
createWebAudioContext: { target: "createWebAudioContext" },
|
|
2001
|
+
getSystemInfoAsync: { target: "getSystemInfo" },
|
|
2002
|
+
openAppAuthorizeSetting: { target: "openAppAuthorizeSetting" },
|
|
2003
|
+
pluginLogin: { target: "pluginLogin" },
|
|
2004
|
+
login: { target: "login" },
|
|
2005
|
+
authorize: { target: "authorize" },
|
|
2006
|
+
checkSession: { target: "checkSession" },
|
|
2007
|
+
requestSubscribeDeviceMessage: { target: "requestSubscribeDeviceMessage" },
|
|
2008
|
+
requestSubscribeEmployeeMessage: { target: "requestSubscribeEmployeeMessage" },
|
|
2009
|
+
restartMiniProgram: { target: "restartMiniProgram" },
|
|
2010
|
+
scanCode: { target: "scanCode" },
|
|
2011
|
+
requestPayment: { target: "requestPayment" },
|
|
2012
|
+
requestOrderPayment: { target: "requestOrderPayment" },
|
|
2013
|
+
requestPluginPayment: { target: "requestPluginPayment" },
|
|
2014
|
+
requestVirtualPayment: { target: "requestVirtualPayment" },
|
|
2015
|
+
showShareImageMenu: { target: "showShareImageMenu" },
|
|
2016
|
+
updateShareMenu: { target: "updateShareMenu" },
|
|
2017
|
+
openEmbeddedMiniProgram: { target: "openEmbeddedMiniProgram" },
|
|
2018
|
+
saveFileToDisk: { target: "saveFileToDisk" },
|
|
2019
|
+
getEnterOptionsSync: { target: "getEnterOptionsSync" },
|
|
2020
|
+
getSystemSetting: { target: "getSystemSetting" },
|
|
2021
|
+
getUserProfile: { target: "getUserProfile" },
|
|
2022
|
+
getUserInfo: { target: "getUserInfo" },
|
|
2023
|
+
getAppAuthorizeSetting: { target: "getAppAuthorizeSetting" },
|
|
2024
|
+
getAppBaseInfo: { target: "getAppBaseInfo" },
|
|
2025
|
+
chooseVideo: { target: "chooseVideo" },
|
|
2026
|
+
hideHomeButton: { target: "hideBackHome" },
|
|
2027
|
+
getWindowInfo: { target: "getWindowInfo" },
|
|
2028
|
+
getDeviceInfo: { target: "getDeviceInfo" },
|
|
2029
|
+
getAccountInfoSync: { target: "getAccountInfoSync" },
|
|
2030
|
+
setBackgroundColor: { target: "setBackgroundColor" },
|
|
2031
|
+
setBackgroundTextStyle: { target: "setBackgroundTextStyle" },
|
|
2032
|
+
getNetworkType: { target: "getNetworkType" },
|
|
2033
|
+
getBatteryInfo: { target: "getBatteryInfo" },
|
|
2034
|
+
getBatteryInfoSync: { target: "getBatteryInfoSync" },
|
|
2035
|
+
getLogManager: { target: "getLogManager" },
|
|
2036
|
+
nextTick: { target: "nextTick" },
|
|
2037
|
+
onWindowResize: { target: "onWindowResize" },
|
|
2038
|
+
offWindowResize: { target: "offWindowResize" },
|
|
2039
|
+
reportAnalytics: { target: "reportAnalytics" },
|
|
2040
|
+
addCard: { target: "addCard" },
|
|
2041
|
+
addFileToFavorites: { target: "addFileToFavorites" },
|
|
2042
|
+
addPaymentPassFinish: { target: "addPaymentPassFinish" },
|
|
2043
|
+
addPaymentPassGetCertificateData: { target: "addPaymentPassGetCertificateData" },
|
|
2044
|
+
addPhoneCalendar: { target: "addPhoneCalendar" },
|
|
2045
|
+
addPhoneContact: { target: "addPhoneContact" },
|
|
2046
|
+
addPhoneRepeatCalendar: { target: "addPhoneRepeatCalendar" },
|
|
2047
|
+
addVideoToFavorites: { target: "addVideoToFavorites" },
|
|
2048
|
+
authorizeForMiniProgram: { target: "authorizeForMiniProgram" },
|
|
2049
|
+
authPrivateMessage: { target: "authPrivateMessage" },
|
|
2050
|
+
...MY_METHOD_MAPPINGS_BIND_EMPLOYEE_RELATION_TO_SEND_HCEMESSAGE,
|
|
2051
|
+
...MY_METHOD_MAPPINGS_SEND_SMS_TO_OPEN_CUSTOMER_SERVICE_CHAT,
|
|
2052
|
+
...MY_METHOD_MAPPINGS_CREATE_VKSESSION_TO_OFF_BLECONNECTION_STATE_CHANGE
|
|
2053
|
+
};
|
|
2054
|
+
//#endregion
|
|
2055
|
+
//#region src/core/methodMapping/rules/ttCanvasGetImageDataToSetTopBarText.ts
|
|
2056
|
+
const TT_METHOD_MAPPINGS_CANVAS_GET_IMAGE_DATA_TO_SET_TOP_BAR_TEXT = {
|
|
2057
|
+
canvasGetImageData: { target: "canvasGetImageData" },
|
|
2058
|
+
canvasPutImageData: { target: "canvasPutImageData" },
|
|
2059
|
+
checkDeviceSupportHevc: { target: "checkDeviceSupportHevc" },
|
|
2060
|
+
checkEmployeeRelation: { target: "checkEmployeeRelation" },
|
|
2061
|
+
checkIsAddedToMyMiniProgram: { target: "checkIsAddedToMyMiniProgram" },
|
|
2062
|
+
checkIsOpenAccessibility: { target: "checkIsOpenAccessibility" },
|
|
2063
|
+
checkIsPictureInPictureActive: { target: "checkIsPictureInPictureActive" },
|
|
2064
|
+
checkIsSoterEnrolledInDevice: { target: "checkIsSoterEnrolledInDevice" },
|
|
2065
|
+
checkIsSupportSoterAuthentication: { target: "checkIsSupportSoterAuthentication" },
|
|
2066
|
+
openCard: { target: "openCard" },
|
|
2067
|
+
openChannelsActivity: { target: "openChannelsActivity" },
|
|
2068
|
+
openChannelsEvent: { target: "openChannelsEvent" },
|
|
2069
|
+
openChannelsLive: { target: "openChannelsLive" },
|
|
2070
|
+
openChannelsLiveNoticeInfo: { target: "openChannelsLiveNoticeInfo" },
|
|
2071
|
+
openChannelsUserProfile: { target: "openChannelsUserProfile" },
|
|
2072
|
+
openChatTool: { target: "openChatTool" },
|
|
2073
|
+
openHKOfflinePayView: { target: "openHKOfflinePayView" },
|
|
2074
|
+
openInquiriesTopic: { target: "openInquiriesTopic" },
|
|
2075
|
+
openOfficialAccountArticle: { target: "openOfficialAccountArticle" },
|
|
2076
|
+
openOfficialAccountChat: { target: "openOfficialAccountChat" },
|
|
2077
|
+
openOfficialAccountProfile: { target: "openOfficialAccountProfile" },
|
|
2078
|
+
openPrivacyContract: { target: "openPrivacyContract" },
|
|
2079
|
+
openSystemBluetoothSetting: { target: "openSystemBluetoothSetting" },
|
|
2080
|
+
reportEvent: { target: "reportEvent" },
|
|
2081
|
+
reportMonitor: { target: "reportMonitor" },
|
|
2082
|
+
reportPerformance: { target: "reportPerformance" },
|
|
2083
|
+
openSingleStickerView: { target: "openSingleStickerView" },
|
|
2084
|
+
openStickerIPView: { target: "openStickerIPView" },
|
|
2085
|
+
openStickerSetView: { target: "openStickerSetView" },
|
|
2086
|
+
openStoreCouponDetail: { target: "openStoreCouponDetail" },
|
|
2087
|
+
openStoreOrderDetail: { target: "openStoreOrderDetail" },
|
|
2088
|
+
pauseBackgroundAudio: { target: "pauseBackgroundAudio" },
|
|
2089
|
+
pauseVoice: { target: "pauseVoice" },
|
|
2090
|
+
playBackgroundAudio: { target: "playBackgroundAudio" },
|
|
2091
|
+
playVoice: { target: "playVoice" },
|
|
2092
|
+
postMessageToReferrerMiniProgram: { target: "postMessageToReferrerMiniProgram" },
|
|
2093
|
+
postMessageToReferrerPage: { target: "postMessageToReferrerPage" },
|
|
2094
|
+
preDownloadSubpackage: { target: "preDownloadSubpackage" },
|
|
2095
|
+
preloadAssets: { target: "preloadAssets" },
|
|
2096
|
+
preloadSkylineView: { target: "preloadSkylineView" },
|
|
2097
|
+
preloadWebview: { target: "preloadWebview" },
|
|
2098
|
+
removeSecureElementPass: { target: "removeSecureElementPass" },
|
|
2099
|
+
chooseInvoiceTitle: { target: "chooseInvoiceTitle" },
|
|
2100
|
+
chooseLicensePlate: { target: "chooseLicensePlate" },
|
|
2101
|
+
choosePoi: { target: "choosePoi" },
|
|
2102
|
+
closeBLEConnection: { target: "closeBLEConnection" },
|
|
2103
|
+
createBLEConnection: { target: "createBLEConnection" },
|
|
2104
|
+
cropImage: { target: "cropImage" },
|
|
2105
|
+
editImage: { target: "editImage" },
|
|
2106
|
+
exitVoIPChat: { target: "exitVoIPChat" },
|
|
2107
|
+
faceDetect: { target: "faceDetect" },
|
|
2108
|
+
getApiCategory: { target: "getApiCategory" },
|
|
2109
|
+
getBackgroundFetchToken: { target: "getBackgroundFetchToken" },
|
|
2110
|
+
getChannelsLiveInfo: { target: "getChannelsLiveInfo" },
|
|
2111
|
+
getChannelsLiveNoticeInfo: { target: "getChannelsLiveNoticeInfo" },
|
|
2112
|
+
getChannelsShareKey: { target: "getChannelsShareKey" },
|
|
2113
|
+
getChatToolInfo: { target: "getChatToolInfo" },
|
|
2114
|
+
getCommonConfig: { target: "getCommonConfig" },
|
|
2115
|
+
getGroupEnterInfo: { target: "getGroupEnterInfo" },
|
|
2116
|
+
getPrivacySetting: { target: "getPrivacySetting" },
|
|
2117
|
+
initFaceDetect: { target: "initFaceDetect" },
|
|
2118
|
+
join1v1Chat: { target: "join1v1Chat" },
|
|
2119
|
+
requestCommonPayment: { target: "requestCommonPayment" },
|
|
2120
|
+
requestDeviceVoIP: { target: "requestDeviceVoIP" },
|
|
2121
|
+
requestMerchantTransfer: { target: "requestMerchantTransfer" },
|
|
2122
|
+
requirePrivacyAuthorize: { target: "requirePrivacyAuthorize" },
|
|
2123
|
+
reserveChannelsLive: { target: "reserveChannelsLive" },
|
|
2124
|
+
selectGroupMembers: { target: "selectGroupMembers" },
|
|
2125
|
+
sendHCEMessage: { target: "sendHCEMessage" },
|
|
2126
|
+
sendSms: { target: "sendSms" },
|
|
2127
|
+
setBackgroundFetchToken: { target: "setBackgroundFetchToken" },
|
|
2128
|
+
setEnable1v1Chat: { target: "setEnable1v1Chat" },
|
|
2129
|
+
setTopBarText: { target: "setTopBarText" }
|
|
2130
|
+
};
|
|
2131
|
+
//#endregion
|
|
2132
|
+
//#region src/core/methodMapping/rules/ttJoinVoIPChatToOffBLEConnectionStateChange.ts
|
|
2133
|
+
const TT_METHOD_MAPPINGS_JOIN_VO_IPCHAT_TO_OFF_BLECONNECTION_STATE_CHANGE = {
|
|
2134
|
+
joinVoIPChat: { target: "joinVoIPChat" },
|
|
2135
|
+
openDocument: { target: "openDocument" },
|
|
2136
|
+
saveVideoToPhotosAlbum: { target: "saveVideoToPhotosAlbum" },
|
|
2137
|
+
batchSetStorage: { target: "batchSetStorage" },
|
|
2138
|
+
batchGetStorage: { target: "batchGetStorage" },
|
|
2139
|
+
batchSetStorageSync: { target: "batchSetStorageSync" },
|
|
2140
|
+
batchGetStorageSync: { target: "batchGetStorageSync" },
|
|
2141
|
+
createCameraContext: { target: "createCameraContext" },
|
|
2142
|
+
offMemoryWarning: { target: "offMemoryWarning" },
|
|
2143
|
+
cancelIdleCallback: { target: "cancelIdleCallback" },
|
|
2144
|
+
onBLEConnectionStateChange: { target: "onBLEConnectionStateChange" },
|
|
2145
|
+
offBLEConnectionStateChange: { target: "offBLEConnectionStateChange" }
|
|
2146
|
+
};
|
|
2147
|
+
//#endregion
|
|
2148
|
+
//#region src/core/methodMapping/rules/ttSetWindowSizeToGetShareInfo.ts
|
|
2149
|
+
const TT_METHOD_MAPPINGS_SET_WINDOW_SIZE_TO_GET_SHARE_INFO = {
|
|
2150
|
+
setWindowSize: { target: "setWindowSize" },
|
|
2151
|
+
stopHCE: { target: "stopHCE" },
|
|
2152
|
+
stopLocalServiceDiscovery: { target: "stopLocalServiceDiscovery" },
|
|
2153
|
+
stopLocationUpdate: { target: "stopLocationUpdate" },
|
|
2154
|
+
stopRecord: { target: "stopRecord" },
|
|
2155
|
+
stopVoice: { target: "stopVoice" },
|
|
2156
|
+
subscribeVoIPVideoMembers: { target: "subscribeVoIPVideoMembers" },
|
|
2157
|
+
updateVoIPChatMuteConfig: { target: "updateVoIPChatMuteConfig" },
|
|
2158
|
+
updateWeChatApp: { target: "updateWeChatApp" },
|
|
2159
|
+
getBackgroundAudioPlayerState: { target: "getBackgroundAudioPlayerState" },
|
|
2160
|
+
getDeviceBenchmarkInfo: { target: "getDeviceBenchmarkInfo" },
|
|
2161
|
+
getDeviceVoIPList: { target: "getDeviceVoIPList" },
|
|
2162
|
+
getHCEState: { target: "getHCEState" },
|
|
2163
|
+
getInferenceEnvInfo: { target: "getInferenceEnvInfo" },
|
|
2164
|
+
getNFCAdapter: { target: "getNFCAdapter" },
|
|
2165
|
+
getPerformance: { target: "getPerformance" },
|
|
2166
|
+
getRandomValues: { target: "getRandomValues" },
|
|
2167
|
+
getRealtimeLogManager: { target: "getRealtimeLogManager" },
|
|
2168
|
+
getRendererUserAgent: { target: "getRendererUserAgent" },
|
|
2169
|
+
getScreenRecordingState: { target: "getScreenRecordingState" },
|
|
2170
|
+
getSecureElementPasses: { target: "getSecureElementPasses" },
|
|
2171
|
+
getSelectedTextRange: { target: "getSelectedTextRange" },
|
|
2172
|
+
getShowSplashAdStatus: { target: "getShowSplashAdStatus" },
|
|
2173
|
+
getSkylineInfo: { target: "getSkylineInfo" },
|
|
2174
|
+
getUserCryptoManager: { target: "getUserCryptoManager" },
|
|
2175
|
+
getWeRunData: { target: "getWeRunData" },
|
|
2176
|
+
getXrFrameSystem: { target: "getXrFrameSystem" },
|
|
2177
|
+
isBluetoothDevicePaired: { target: "isBluetoothDevicePaired" },
|
|
2178
|
+
isVKSupport: { target: "isVKSupport" },
|
|
2179
|
+
createBLEPeripheralServer: { target: "createBLEPeripheralServer" },
|
|
2180
|
+
createBufferURL: { target: "createBufferURL" },
|
|
2181
|
+
createCacheManager: { target: "createCacheManager" },
|
|
2182
|
+
createGlobalPayment: { target: "createGlobalPayment" },
|
|
2183
|
+
createInferenceSession: { target: "createInferenceSession" },
|
|
2184
|
+
createMediaAudioPlayer: { target: "createMediaAudioPlayer" },
|
|
2185
|
+
createMediaContainer: { target: "createMediaContainer" },
|
|
2186
|
+
createMediaRecorder: { target: "createMediaRecorder" },
|
|
2187
|
+
createTCPSocket: { target: "createTCPSocket" },
|
|
2188
|
+
createUDPSocket: { target: "createUDPSocket" },
|
|
2189
|
+
createVideoDecoder: { target: "createVideoDecoder" },
|
|
2190
|
+
loadBuiltInFontFace: { target: "loadBuiltInFontFace" },
|
|
2191
|
+
notifyGroupMembers: { target: "notifyGroupMembers" },
|
|
2192
|
+
requestIdleCallback: { target: "requestIdleCallback" },
|
|
2193
|
+
revokeBufferURL: { target: "revokeBufferURL" },
|
|
2194
|
+
rewriteRoute: { target: "rewriteRoute" },
|
|
2195
|
+
seekBackgroundAudio: { target: "seekBackgroundAudio" },
|
|
2196
|
+
setEnableDebug: { target: "setEnableDebug" },
|
|
2197
|
+
setInnerAudioOption: { target: "setInnerAudioOption" },
|
|
2198
|
+
shareAppMessageToGroup: { target: "shareAppMessageToGroup" },
|
|
2199
|
+
shareEmojiToGroup: { target: "shareEmojiToGroup" },
|
|
2200
|
+
shareFileMessage: { target: "shareFileMessage" },
|
|
2201
|
+
shareFileToGroup: { target: "shareFileToGroup" },
|
|
2202
|
+
shareImageToGroup: { target: "shareImageToGroup" },
|
|
2203
|
+
shareToOfficialAccount: { target: "shareToOfficialAccount" },
|
|
2204
|
+
shareToWeRun: { target: "shareToWeRun" },
|
|
2205
|
+
shareVideoMessage: { target: "shareVideoMessage" },
|
|
2206
|
+
shareVideoToGroup: { target: "shareVideoToGroup" },
|
|
2207
|
+
showRedPackage: { target: "showRedPackage" },
|
|
2208
|
+
startDeviceMotionListening: { target: "startDeviceMotionListening" },
|
|
2209
|
+
startHCE: { target: "startHCE" },
|
|
2210
|
+
startLocalServiceDiscovery: { target: "startLocalServiceDiscovery" },
|
|
2211
|
+
startLocationUpdate: { target: "startLocationUpdate" },
|
|
2212
|
+
startLocationUpdateBackground: { target: "startLocationUpdateBackground" },
|
|
2213
|
+
startRecord: { target: "startRecord" },
|
|
2214
|
+
startSoterAuthentication: { target: "startSoterAuthentication" },
|
|
2215
|
+
stopBackgroundAudio: { target: "stopBackgroundAudio" },
|
|
2216
|
+
stopDeviceMotionListening: { target: "stopDeviceMotionListening" },
|
|
2217
|
+
stopFaceDetect: { target: "stopFaceDetect" },
|
|
2218
|
+
openCustomerServiceChat: { target: "openCustomerServiceChat" },
|
|
2219
|
+
createVKSession: { target: "createVKSession" },
|
|
2220
|
+
compressVideo: { target: "compressVideo" },
|
|
2221
|
+
openVideoEditor: { target: "openVideoEditor" },
|
|
2222
|
+
getShareInfo: { target: "getShareInfo" }
|
|
2223
|
+
};
|
|
2224
|
+
//#endregion
|
|
2225
|
+
//#region src/core/methodMapping/rules/index.ts
|
|
2226
|
+
const METHOD_MAPPINGS = {
|
|
2227
|
+
my: MY_METHOD_MAPPINGS,
|
|
2228
|
+
tt: {
|
|
2229
|
+
showToast: {
|
|
2230
|
+
target: "showToast",
|
|
2231
|
+
mapArgs: mapDouyinToastArgs
|
|
2232
|
+
},
|
|
2233
|
+
showLoading: { target: "showLoading" },
|
|
2234
|
+
showActionSheet: {
|
|
2235
|
+
target: "showActionSheet",
|
|
2236
|
+
mapResult: mapActionSheetResult
|
|
2237
|
+
},
|
|
2238
|
+
showModal: { target: "showModal" },
|
|
2239
|
+
chooseImage: {
|
|
2240
|
+
target: "chooseImage",
|
|
2241
|
+
mapResult: mapDouyinChooseImageResult
|
|
2242
|
+
},
|
|
2243
|
+
chooseMedia: {
|
|
2244
|
+
target: "chooseMedia",
|
|
2245
|
+
mapResult: mapChooseMediaResultFromImage
|
|
2246
|
+
},
|
|
2247
|
+
chooseMessageFile: { target: "chooseMessageFile" },
|
|
2248
|
+
getFuzzyLocation: { target: "getFuzzyLocation" },
|
|
2249
|
+
previewMedia: { target: "previewMedia" },
|
|
2250
|
+
createInterstitialAd: { target: "createInterstitialAd" },
|
|
2251
|
+
createRewardedVideoAd: { target: "createRewardedVideoAd" },
|
|
2252
|
+
createLivePlayerContext: { target: "createLivePlayerContext" },
|
|
2253
|
+
createLivePusherContext: { target: "createLivePusherContext" },
|
|
2254
|
+
getVideoInfo: { target: "getVideoInfo" },
|
|
2255
|
+
saveFile: {
|
|
2256
|
+
target: "saveFile",
|
|
2257
|
+
mapResult: mapDouyinSaveFileResult
|
|
2258
|
+
},
|
|
2259
|
+
setClipboardData: { target: "setClipboardData" },
|
|
2260
|
+
getClipboardData: { target: "getClipboardData" },
|
|
2261
|
+
chooseAddress: { target: "chooseAddress" },
|
|
2262
|
+
createAudioContext: { target: "createAudioContext" },
|
|
2263
|
+
createWebAudioContext: { target: "createWebAudioContext" },
|
|
2264
|
+
getSystemInfoAsync: { target: "getSystemInfo" },
|
|
2265
|
+
openAppAuthorizeSetting: { target: "openAppAuthorizeSetting" },
|
|
2266
|
+
pluginLogin: { target: "pluginLogin" },
|
|
2267
|
+
login: { target: "login" },
|
|
2268
|
+
authorize: { target: "authorize" },
|
|
2269
|
+
checkSession: { target: "checkSession" },
|
|
2270
|
+
requestSubscribeDeviceMessage: { target: "requestSubscribeDeviceMessage" },
|
|
2271
|
+
requestSubscribeEmployeeMessage: { target: "requestSubscribeEmployeeMessage" },
|
|
2272
|
+
restartMiniProgram: { target: "restartMiniProgram" },
|
|
2273
|
+
scanCode: { target: "scanCode" },
|
|
2274
|
+
requestPayment: { target: "requestPayment" },
|
|
2275
|
+
requestOrderPayment: { target: "requestOrderPayment" },
|
|
2276
|
+
requestPluginPayment: { target: "requestPluginPayment" },
|
|
2277
|
+
requestVirtualPayment: { target: "requestVirtualPayment" },
|
|
2278
|
+
showShareImageMenu: { target: "showShareImageMenu" },
|
|
2279
|
+
updateShareMenu: { target: "updateShareMenu" },
|
|
2280
|
+
openEmbeddedMiniProgram: { target: "openEmbeddedMiniProgram" },
|
|
2281
|
+
saveFileToDisk: { target: "saveFileToDisk" },
|
|
2282
|
+
getEnterOptionsSync: { target: "getEnterOptionsSync" },
|
|
2283
|
+
getSystemSetting: { target: "getSystemSetting" },
|
|
2284
|
+
getUserProfile: { target: "getUserProfile" },
|
|
2285
|
+
getUserInfo: { target: "getUserInfo" },
|
|
2286
|
+
getAppAuthorizeSetting: { target: "getAppAuthorizeSetting" },
|
|
2287
|
+
getAppBaseInfo: { target: "getAppBaseInfo" },
|
|
2288
|
+
chooseVideo: { target: "chooseVideo" },
|
|
2289
|
+
hideHomeButton: { target: "hideHomeButton" },
|
|
2290
|
+
getWindowInfo: { target: "getWindowInfo" },
|
|
2291
|
+
getDeviceInfo: { target: "getDeviceInfo" },
|
|
2292
|
+
getAccountInfoSync: { target: "getAccountInfoSync" },
|
|
2293
|
+
setBackgroundColor: { target: "setBackgroundColor" },
|
|
2294
|
+
setBackgroundTextStyle: { target: "setBackgroundTextStyle" },
|
|
2295
|
+
getNetworkType: { target: "getNetworkType" },
|
|
2296
|
+
getBatteryInfo: { target: "getBatteryInfo" },
|
|
2297
|
+
getBatteryInfoSync: { target: "getBatteryInfoSync" },
|
|
2298
|
+
getLogManager: { target: "getLogManager" },
|
|
2299
|
+
nextTick: { target: "nextTick" },
|
|
2300
|
+
onWindowResize: { target: "onWindowResize" },
|
|
2301
|
+
offWindowResize: { target: "offWindowResize" },
|
|
2302
|
+
reportAnalytics: { target: "reportAnalytics" },
|
|
2303
|
+
addCard: { target: "addCard" },
|
|
2304
|
+
addFileToFavorites: { target: "addFileToFavorites" },
|
|
2305
|
+
addPaymentPassFinish: { target: "addPaymentPassFinish" },
|
|
2306
|
+
addPaymentPassGetCertificateData: { target: "addPaymentPassGetCertificateData" },
|
|
2307
|
+
addPhoneCalendar: { target: "addPhoneCalendar" },
|
|
2308
|
+
addPhoneContact: { target: "addPhoneContact" },
|
|
2309
|
+
addPhoneRepeatCalendar: { target: "addPhoneRepeatCalendar" },
|
|
2310
|
+
addVideoToFavorites: { target: "addVideoToFavorites" },
|
|
2311
|
+
authorizeForMiniProgram: { target: "authorizeForMiniProgram" },
|
|
2312
|
+
authPrivateMessage: { target: "authPrivateMessage" },
|
|
2313
|
+
bindEmployeeRelation: { target: "bindEmployeeRelation" },
|
|
2314
|
+
canAddSecureElementPass: { target: "canAddSecureElementPass" },
|
|
2315
|
+
...TT_METHOD_MAPPINGS_CANVAS_GET_IMAGE_DATA_TO_SET_TOP_BAR_TEXT,
|
|
2316
|
+
...TT_METHOD_MAPPINGS_SET_WINDOW_SIZE_TO_GET_SHARE_INFO,
|
|
2317
|
+
...TT_METHOD_MAPPINGS_JOIN_VO_IPCHAT_TO_OFF_BLECONNECTION_STATE_CHANGE
|
|
2318
|
+
}
|
|
2319
|
+
};
|
|
2320
|
+
new Set(WEAPI_MINIPROGRAM_METHODS);
|
|
2321
|
+
const PLATFORM_METHOD_SET = {
|
|
2322
|
+
my: new Set(WEAPI_ALIPAY_METHODS),
|
|
2323
|
+
tt: new Set(WEAPI_DOUYIN_METHODS)
|
|
2324
|
+
};
|
|
2325
|
+
function resolveMappingRule(platform, methodName, options = {}) {
|
|
2326
|
+
const methodSet = PLATFORM_METHOD_SET[platform];
|
|
2327
|
+
const explicitRule = METHOD_MAPPINGS[platform]?.[methodName];
|
|
2328
|
+
if (explicitRule) return {
|
|
2329
|
+
target: explicitRule.target,
|
|
2330
|
+
source: "explicit",
|
|
2331
|
+
rule: explicitRule
|
|
2332
|
+
};
|
|
2333
|
+
if (methodSet.has(methodName)) return {
|
|
2334
|
+
target: methodName,
|
|
2335
|
+
source: "identity"
|
|
2336
|
+
};
|
|
2337
|
+
if (options.allowFallback === false) return {
|
|
2338
|
+
target: methodName,
|
|
2339
|
+
source: "identity"
|
|
2340
|
+
};
|
|
2341
|
+
return {
|
|
2342
|
+
target: methodName,
|
|
2343
|
+
source: "identity"
|
|
2344
|
+
};
|
|
2345
|
+
}
|
|
2346
|
+
/**
|
|
2347
|
+
* @description 解析平台 API 映射规则及映射来源
|
|
2348
|
+
*/
|
|
2349
|
+
function resolveMethodMappingWithMeta(platform, methodName, options = {}) {
|
|
2350
|
+
const normalizedPlatform = normalizePlatformName$1(platform);
|
|
2351
|
+
if (!normalizedPlatform) return;
|
|
2352
|
+
if (normalizedPlatform !== "my" && normalizedPlatform !== "tt") return;
|
|
2353
|
+
return resolveMappingRule(normalizedPlatform, methodName, options);
|
|
2354
|
+
}
|
|
2355
|
+
//#endregion
|
|
2356
|
+
//#region src/core/networkRequestPolicy/types.ts
|
|
2357
|
+
const NETWORK_METHODS = /* @__PURE__ */ new Set([
|
|
2358
|
+
"request",
|
|
2359
|
+
"uploadFile",
|
|
2360
|
+
"downloadFile",
|
|
2361
|
+
"connectSocket"
|
|
2362
|
+
]);
|
|
2363
|
+
const HTTP_METHODS = /* @__PURE__ */ new Set([
|
|
2364
|
+
"request",
|
|
2365
|
+
"uploadFile",
|
|
2366
|
+
"downloadFile"
|
|
2367
|
+
]);
|
|
2368
|
+
const DEFAULT_TIMEOUT_CONFIG = {
|
|
2369
|
+
request: 6e4,
|
|
2370
|
+
uploadFile: 6e4,
|
|
2371
|
+
downloadFile: 6e4,
|
|
2372
|
+
connectSocket: 6e4
|
|
2373
|
+
};
|
|
2374
|
+
const NETWORK_BUCKET_LIMIT = {
|
|
2375
|
+
http: 10,
|
|
2376
|
+
socket: 5
|
|
2377
|
+
};
|
|
2378
|
+
const BACKGROUND_INTERRUPT_DELAY = 5e3;
|
|
2379
|
+
//#endregion
|
|
2380
|
+
//#region src/core/networkRequestPolicy/helpers.ts
|
|
2381
|
+
function isFinitePositiveNumber(value) {
|
|
2382
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0;
|
|
2383
|
+
}
|
|
2384
|
+
function resolveQueueSize(value) {
|
|
2385
|
+
if (!isFinitePositiveNumber(value)) return 100;
|
|
2386
|
+
return Math.max(1, Math.floor(value));
|
|
2387
|
+
}
|
|
2388
|
+
function resolveCurrentMiniProgramHostConfig() {
|
|
2389
|
+
const runtimeRoot = resolveRuntimeRoot();
|
|
2390
|
+
for (const globalKey of getMiniProgramRuntimeGlobalKeys()) {
|
|
2391
|
+
if (!resolveRuntimeGlobalValue(globalKey, runtimeRoot)) continue;
|
|
2392
|
+
const hostConfig = resolveRuntimeGlobalValue(getMiniProgramRuntimeHostConfigKey(getMiniProgramPlatformByRuntimeGlobalKey(globalKey)), runtimeRoot);
|
|
2393
|
+
return isPlainObject(hostConfig) ? hostConfig : void 0;
|
|
2394
|
+
}
|
|
2395
|
+
const defaultHostConfig = resolveRuntimeGlobalValue(getMiniProgramRuntimeHostConfigKey(void 0), runtimeRoot);
|
|
2396
|
+
return isPlainObject(defaultHostConfig) ? defaultHostConfig : void 0;
|
|
2397
|
+
}
|
|
2398
|
+
function resolveHostTimeoutConfig() {
|
|
2399
|
+
const networkTimeout = resolveCurrentMiniProgramHostConfig()?.networkTimeout;
|
|
2400
|
+
if (!isPlainObject(networkTimeout)) return {};
|
|
2401
|
+
const result = {};
|
|
2402
|
+
if (isFinitePositiveNumber(networkTimeout.request)) result.request = networkTimeout.request;
|
|
2403
|
+
if (isFinitePositiveNumber(networkTimeout.uploadFile)) result.uploadFile = networkTimeout.uploadFile;
|
|
2404
|
+
if (isFinitePositiveNumber(networkTimeout.downloadFile)) result.downloadFile = networkTimeout.downloadFile;
|
|
2405
|
+
if (isFinitePositiveNumber(networkTimeout.connectSocket)) result.connectSocket = networkTimeout.connectSocket;
|
|
2406
|
+
return result;
|
|
2407
|
+
}
|
|
2408
|
+
function createNetworkError(methodName, platform, reason) {
|
|
2409
|
+
return { errMsg: `${platform ? `${platform}.${methodName}` : methodName}:fail ${reason}` };
|
|
2410
|
+
}
|
|
2411
|
+
function resolveBucket(methodName) {
|
|
2412
|
+
return HTTP_METHODS.has(methodName) ? "http" : "socket";
|
|
2413
|
+
}
|
|
2414
|
+
function clearTimer(timer) {
|
|
2415
|
+
if (timer) clearTimeout(timer);
|
|
2416
|
+
}
|
|
2417
|
+
function resolveOptionsArg(args) {
|
|
2418
|
+
const nextArgs = args.slice();
|
|
2419
|
+
const lastArg = nextArgs.length > 0 ? nextArgs[nextArgs.length - 1] : void 0;
|
|
2420
|
+
if (isPlainObject(lastArg)) {
|
|
2421
|
+
const options = { ...lastArg };
|
|
2422
|
+
nextArgs[nextArgs.length - 1] = options;
|
|
2423
|
+
return {
|
|
2424
|
+
args: nextArgs,
|
|
2425
|
+
options
|
|
2426
|
+
};
|
|
2427
|
+
}
|
|
2428
|
+
const options = {};
|
|
2429
|
+
nextArgs.push(options);
|
|
2430
|
+
return {
|
|
2431
|
+
args: nextArgs,
|
|
2432
|
+
options
|
|
2433
|
+
};
|
|
2434
|
+
}
|
|
2435
|
+
function stripRefererHeader(options) {
|
|
2436
|
+
if (!isPlainObject(options.header)) return;
|
|
2437
|
+
const nextHeader = {};
|
|
2438
|
+
for (const [key, value] of Object.entries(options.header)) {
|
|
2439
|
+
if (key.toLowerCase() === "referer") continue;
|
|
2440
|
+
nextHeader[key] = value;
|
|
2441
|
+
}
|
|
2442
|
+
options.header = nextHeader;
|
|
2443
|
+
}
|
|
2444
|
+
function resolveTimeoutValue(timeout, method, timeoutConfig) {
|
|
2445
|
+
return isFinitePositiveNumber(timeout) ? timeout : timeoutConfig[method];
|
|
2446
|
+
}
|
|
2447
|
+
function toNetworkMethod(name) {
|
|
2448
|
+
return NETWORK_METHODS.has(name) ? name : void 0;
|
|
2449
|
+
}
|
|
2450
|
+
//#endregion
|
|
2451
|
+
//#region src/core/networkRequestPolicy/index.ts
|
|
2452
|
+
/**
|
|
2453
|
+
* @description 创建微信网络请求语义策略(超时、并发、前后台中断、referer 过滤)。
|
|
2454
|
+
*/
|
|
2455
|
+
function createNetworkRequestPolicy(getPlatform, options = void 0) {
|
|
2456
|
+
const boundAdapters = /* @__PURE__ */ new WeakSet();
|
|
2457
|
+
const activeCalls = /* @__PURE__ */ new Set();
|
|
2458
|
+
const queueByBucket = {
|
|
2459
|
+
http: [],
|
|
2460
|
+
socket: []
|
|
2461
|
+
};
|
|
2462
|
+
const activeCountByBucket = {
|
|
2463
|
+
http: 0,
|
|
2464
|
+
socket: 0
|
|
2465
|
+
};
|
|
2466
|
+
const timeoutConfig = {
|
|
2467
|
+
...DEFAULT_TIMEOUT_CONFIG,
|
|
2468
|
+
...resolveHostTimeoutConfig()
|
|
2469
|
+
};
|
|
2470
|
+
const overflowPolicy = options?.overflowPolicy ?? "queue";
|
|
2471
|
+
const maxQueueSize = resolveQueueSize(options?.maxQueueSize);
|
|
2472
|
+
let isBackground = false;
|
|
2473
|
+
const cleanupCall = (call) => {
|
|
2474
|
+
if (call.settled) return;
|
|
2475
|
+
call.settled = true;
|
|
2476
|
+
activeCalls.delete(call);
|
|
2477
|
+
activeCountByBucket[call.bucket] = Math.max(0, activeCountByBucket[call.bucket] - 1);
|
|
2478
|
+
clearTimer(call.timeoutTimer);
|
|
2479
|
+
clearTimer(call.backgroundTimer);
|
|
2480
|
+
};
|
|
2481
|
+
const drainQueue = (bucket) => {
|
|
2482
|
+
if (isBackground) return;
|
|
2483
|
+
const limit = NETWORK_BUCKET_LIMIT[bucket];
|
|
2484
|
+
const queue = queueByBucket[bucket];
|
|
2485
|
+
while (activeCountByBucket[bucket] < limit && queue.length > 0) queue.shift()?.start();
|
|
2486
|
+
};
|
|
2487
|
+
const scheduleBackgroundInterrupt = (call) => {
|
|
2488
|
+
clearTimer(call.backgroundTimer);
|
|
2489
|
+
call.backgroundTimer = setTimeout(() => {
|
|
2490
|
+
call.abort?.();
|
|
2491
|
+
call.failWith(createNetworkError(call.method, call.platform, "interrupted"));
|
|
2492
|
+
}, BACKGROUND_INTERRUPT_DELAY);
|
|
2493
|
+
};
|
|
2494
|
+
const clearBackgroundInterrupt = (call) => {
|
|
2495
|
+
clearTimer(call.backgroundTimer);
|
|
2496
|
+
call.backgroundTimer = void 0;
|
|
2497
|
+
};
|
|
2498
|
+
const setBackgroundState = (nextBackground) => {
|
|
2499
|
+
isBackground = nextBackground;
|
|
2500
|
+
for (const call of activeCalls) if (nextBackground) scheduleBackgroundInterrupt(call);
|
|
2501
|
+
else clearBackgroundInterrupt(call);
|
|
2502
|
+
if (!nextBackground) {
|
|
2503
|
+
drainQueue("http");
|
|
2504
|
+
drainQueue("socket");
|
|
2505
|
+
}
|
|
2506
|
+
};
|
|
2507
|
+
const bindAdapter = (adapter) => {
|
|
2508
|
+
if (!adapter || typeof adapter !== "object") return;
|
|
2509
|
+
if (boundAdapters.has(adapter)) return;
|
|
2510
|
+
boundAdapters.add(adapter);
|
|
2511
|
+
const onAppHide = adapter.onAppHide;
|
|
2512
|
+
if (typeof onAppHide === "function") onAppHide(() => {
|
|
2513
|
+
setBackgroundState(true);
|
|
2514
|
+
});
|
|
2515
|
+
const onAppShow = adapter.onAppShow;
|
|
2516
|
+
if (typeof onAppShow === "function") onAppShow(() => {
|
|
2517
|
+
setBackgroundState(false);
|
|
2518
|
+
});
|
|
2519
|
+
};
|
|
2520
|
+
const prepareCall = (methodName, args) => {
|
|
2521
|
+
const networkMethod = toNetworkMethod(methodName);
|
|
2522
|
+
if (!networkMethod) return;
|
|
2523
|
+
const platform = getPlatform();
|
|
2524
|
+
if (isBackground) return {
|
|
2525
|
+
args,
|
|
2526
|
+
blockedError: createNetworkError(methodName, platform, "interrupted"),
|
|
2527
|
+
invoke() {}
|
|
2528
|
+
};
|
|
2529
|
+
const { args: nextArgs, options } = resolveOptionsArg(args);
|
|
2530
|
+
if (networkMethod !== "connectSocket") stripRefererHeader(options);
|
|
2531
|
+
const timeout = resolveTimeoutValue(options.timeout, networkMethod, timeoutConfig);
|
|
2532
|
+
options.timeout = timeout;
|
|
2533
|
+
const bucket = resolveBucket(networkMethod);
|
|
2534
|
+
const limit = NETWORK_BUCKET_LIMIT[bucket];
|
|
2535
|
+
const queue = queueByBucket[bucket];
|
|
2536
|
+
if (activeCountByBucket[bucket] >= limit && overflowPolicy === "strict") return {
|
|
2537
|
+
args: nextArgs,
|
|
2538
|
+
blockedError: createNetworkError(methodName, platform, `exceed max concurrency limit ${limit}`),
|
|
2539
|
+
invoke() {}
|
|
2540
|
+
};
|
|
2541
|
+
if (activeCountByBucket[bucket] >= limit && queue.length >= maxQueueSize) return {
|
|
2542
|
+
args: nextArgs,
|
|
2543
|
+
blockedError: createNetworkError(methodName, platform, `exceed max queue size ${maxQueueSize}`),
|
|
2544
|
+
invoke() {}
|
|
2545
|
+
};
|
|
2546
|
+
const originalSuccess = options.success;
|
|
2547
|
+
const originalFail = options.fail;
|
|
2548
|
+
const originalComplete = options.complete;
|
|
2549
|
+
const call = {
|
|
2550
|
+
bucket,
|
|
2551
|
+
method: networkMethod,
|
|
2552
|
+
platform,
|
|
2553
|
+
settled: false,
|
|
2554
|
+
failWith: (error) => {
|
|
2555
|
+
if (call.settled) return;
|
|
2556
|
+
cleanupCall(call);
|
|
2557
|
+
originalFail?.(error);
|
|
2558
|
+
originalComplete?.(error);
|
|
2559
|
+
drainQueue(bucket);
|
|
2560
|
+
}
|
|
2561
|
+
};
|
|
2562
|
+
options.success = (res) => {
|
|
2563
|
+
if (call.settled) return;
|
|
2564
|
+
cleanupCall(call);
|
|
2565
|
+
originalSuccess?.(res);
|
|
2566
|
+
drainQueue(bucket);
|
|
2567
|
+
};
|
|
2568
|
+
options.fail = (error) => {
|
|
2569
|
+
if (call.settled) return;
|
|
2570
|
+
cleanupCall(call);
|
|
2571
|
+
originalFail?.(error);
|
|
2572
|
+
drainQueue(bucket);
|
|
2573
|
+
};
|
|
2574
|
+
options.complete = (res) => {
|
|
2575
|
+
if (call.settled) return;
|
|
2576
|
+
cleanupCall(call);
|
|
2577
|
+
originalComplete?.(res);
|
|
2578
|
+
drainQueue(bucket);
|
|
2579
|
+
};
|
|
2580
|
+
const startInvoke = (invokeRuntime) => {
|
|
2581
|
+
if (call.settled) return;
|
|
2582
|
+
activeCountByBucket[bucket] += 1;
|
|
2583
|
+
activeCalls.add(call);
|
|
2584
|
+
call.timeoutTimer = setTimeout(() => {
|
|
2585
|
+
call.abort?.();
|
|
2586
|
+
call.failWith(createNetworkError(methodName, platform, "timeout"));
|
|
2587
|
+
}, timeout);
|
|
2588
|
+
if (isBackground) scheduleBackgroundInterrupt(call);
|
|
2589
|
+
try {
|
|
2590
|
+
const result = invokeRuntime();
|
|
2591
|
+
if (isPlainObject(result) && typeof result.abort === "function") call.abort = result.abort.bind(result);
|
|
2592
|
+
return result;
|
|
2593
|
+
} catch (error) {
|
|
2594
|
+
call.failWith(error);
|
|
2595
|
+
return;
|
|
2596
|
+
}
|
|
2597
|
+
};
|
|
2598
|
+
return {
|
|
2599
|
+
args: nextArgs,
|
|
2600
|
+
invoke(invokeRuntime) {
|
|
2601
|
+
if (activeCountByBucket[bucket] < limit) return startInvoke(invokeRuntime);
|
|
2602
|
+
if (overflowPolicy !== "queue") return;
|
|
2603
|
+
queue.push({ start: () => startInvoke(invokeRuntime) });
|
|
2604
|
+
}
|
|
2605
|
+
};
|
|
2606
|
+
};
|
|
2607
|
+
return {
|
|
2608
|
+
bindAdapter,
|
|
2609
|
+
prepareCall
|
|
2610
|
+
};
|
|
2611
|
+
}
|
|
2612
|
+
//#endregion
|
|
2613
|
+
//#region src/core/createWeapi.ts
|
|
2614
|
+
const INTERNAL_KEYS = /* @__PURE__ */ new Set([
|
|
2615
|
+
"setAdapter",
|
|
2616
|
+
"getAdapter",
|
|
2617
|
+
"platform",
|
|
2618
|
+
"raw",
|
|
2619
|
+
"resolveTarget",
|
|
2620
|
+
"supports"
|
|
2621
|
+
]);
|
|
2622
|
+
const PLATFORM_ALIASES = { kuaishou: "ks" };
|
|
2623
|
+
const WECHAT_FILE_SYSTEM_MANAGER_METHODS = /* @__PURE__ */ new Set(["saveFile", "removeSavedFile"]);
|
|
2624
|
+
function normalizePlatformName(value) {
|
|
2625
|
+
const normalized = normalizeMiniProgramPlatform(value);
|
|
2626
|
+
if (!normalized) return;
|
|
2627
|
+
const miniProgramPlatform = resolveMiniProgramPlatform(normalized);
|
|
2628
|
+
if (miniProgramPlatform) return miniProgramPlatform.globalObjectKey;
|
|
2629
|
+
return PLATFORM_ALIASES[normalized] ?? normalized;
|
|
2630
|
+
}
|
|
2631
|
+
/**
|
|
2632
|
+
* @description 创建跨平台 API 实例
|
|
2633
|
+
*/
|
|
2634
|
+
function createWeapi(options = {}) {
|
|
2635
|
+
let adapter = options.adapter;
|
|
2636
|
+
let platformName = normalizePlatformName(options.platform);
|
|
2637
|
+
const allowFallback = false;
|
|
2638
|
+
const cache = /* @__PURE__ */ new Map();
|
|
2639
|
+
const networkPolicy = createNetworkRequestPolicy(() => platformName, options.network);
|
|
2640
|
+
const resolveAdapter = () => {
|
|
2641
|
+
if (adapter) return adapter;
|
|
2642
|
+
const detected = detectGlobalAdapter();
|
|
2643
|
+
if (detected.adapter) {
|
|
2644
|
+
adapter = detected.adapter;
|
|
2645
|
+
platformName = platformName ?? normalizePlatformName(detected.platform);
|
|
2646
|
+
}
|
|
2647
|
+
return adapter;
|
|
2648
|
+
};
|
|
2649
|
+
const setAdapter = (nextAdapter, nextPlatform) => {
|
|
2650
|
+
adapter = nextAdapter;
|
|
2651
|
+
platformName = normalizePlatformName(nextPlatform);
|
|
2652
|
+
cache.clear();
|
|
2653
|
+
};
|
|
2654
|
+
const getAdapter = () => {
|
|
2655
|
+
if (!adapter) resolveAdapter();
|
|
2656
|
+
return adapter;
|
|
2657
|
+
};
|
|
2658
|
+
const getPlatform = () => {
|
|
2659
|
+
if (!platformName) resolveAdapter();
|
|
2660
|
+
return platformName;
|
|
2661
|
+
};
|
|
2662
|
+
const resolveRuntimeMethod = (runtimeAdapter, platform, methodName) => {
|
|
2663
|
+
if (!runtimeAdapter) return;
|
|
2664
|
+
if (platform === "wx" && WECHAT_FILE_SYSTEM_MANAGER_METHODS.has(methodName)) {
|
|
2665
|
+
const getFileSystemManager = runtimeAdapter.getFileSystemManager;
|
|
2666
|
+
if (typeof getFileSystemManager !== "function") return;
|
|
2667
|
+
const fileSystemManager = getFileSystemManager.call(runtimeAdapter);
|
|
2668
|
+
const fileSystemMethod = fileSystemManager?.[methodName];
|
|
2669
|
+
return typeof fileSystemMethod === "function" ? fileSystemMethod.bind(fileSystemManager) : void 0;
|
|
2670
|
+
}
|
|
2671
|
+
return runtimeAdapter[methodName];
|
|
2672
|
+
};
|
|
2673
|
+
const resolveTarget = (methodName) => {
|
|
2674
|
+
const runtimeAdapter = resolveAdapter();
|
|
2675
|
+
const platform = getPlatform();
|
|
2676
|
+
const mappingInfo = resolveMethodMappingWithMeta(platform, methodName, { allowFallback });
|
|
2677
|
+
const target = mappingInfo?.target ?? methodName;
|
|
2678
|
+
const supported = typeof resolveRuntimeMethod(runtimeAdapter, platform, target) === "function";
|
|
2679
|
+
const supportLevel = !supported ? "unsupported" : mappingInfo?.source === "fallback" ? "fallback" : mappingInfo?.source === "explicit" ? "mapped" : "native";
|
|
2680
|
+
return {
|
|
2681
|
+
method: methodName,
|
|
2682
|
+
target,
|
|
2683
|
+
platform,
|
|
2684
|
+
mapped: target !== methodName,
|
|
2685
|
+
supported,
|
|
2686
|
+
supportLevel,
|
|
2687
|
+
semanticAligned: supportLevel === "native" || supportLevel === "mapped"
|
|
2688
|
+
};
|
|
2689
|
+
};
|
|
2690
|
+
const supports = (methodName, queryOptions = {}) => {
|
|
2691
|
+
const resolved = resolveTarget(methodName);
|
|
2692
|
+
if (queryOptions.semantic === true) return resolved.semanticAligned;
|
|
2693
|
+
return resolved.supported;
|
|
2694
|
+
};
|
|
2695
|
+
return new Proxy({}, { get(_target, prop) {
|
|
2696
|
+
if (prop === Symbol.toStringTag) return "Weapi";
|
|
2697
|
+
if (prop === "then") return;
|
|
2698
|
+
if (INTERNAL_KEYS.has(prop)) {
|
|
2699
|
+
if (prop === "setAdapter") return setAdapter;
|
|
2700
|
+
if (prop === "getAdapter") return getAdapter;
|
|
2701
|
+
if (prop === "platform") return getPlatform();
|
|
2702
|
+
if (prop === "raw") return getAdapter();
|
|
2703
|
+
if (prop === "resolveTarget") return resolveTarget;
|
|
2704
|
+
if (prop === "supports") return supports;
|
|
2705
|
+
}
|
|
2706
|
+
if (cache.has(prop)) return cache.get(prop);
|
|
2707
|
+
const currentAdapter = resolveAdapter();
|
|
2708
|
+
if (!currentAdapter) {
|
|
2709
|
+
if (typeof prop !== "string") return;
|
|
2710
|
+
return (...args) => callMissingApi(prop, getPlatform(), args);
|
|
2711
|
+
}
|
|
2712
|
+
const platform = getPlatform();
|
|
2713
|
+
const methodName = (typeof prop === "string" ? resolveMethodMappingWithMeta(platform, prop, { allowFallback }) : void 0)?.target ?? prop;
|
|
2714
|
+
const value = resolveRuntimeMethod(currentAdapter, platform, methodName);
|
|
2715
|
+
if (typeof value !== "function") {
|
|
2716
|
+
if (value === void 0 && typeof prop === "string") {
|
|
2717
|
+
const missing = (...args) => callMissingApi(prop, getPlatform(), args);
|
|
2718
|
+
cache.set(prop, missing);
|
|
2719
|
+
return missing;
|
|
2720
|
+
}
|
|
2721
|
+
cache.set(prop, value);
|
|
2722
|
+
return value;
|
|
2723
|
+
}
|
|
2724
|
+
const wrapped = (...args) => {
|
|
2725
|
+
const runtimeAdapter = resolveAdapter();
|
|
2726
|
+
const platform = getPlatform();
|
|
2727
|
+
const mappingInfo = resolveMethodMappingWithMeta(platform, prop, { allowFallback });
|
|
2728
|
+
const mappingRule = mappingInfo?.rule;
|
|
2729
|
+
const methodName = mappingInfo?.target ?? prop;
|
|
2730
|
+
const runtimeMethod = resolveRuntimeMethod(runtimeAdapter, platform, methodName);
|
|
2731
|
+
let runtimeArgs = args;
|
|
2732
|
+
try {
|
|
2733
|
+
runtimeArgs = mappingRule?.mapArgs ? mappingRule.mapArgs(args) : args;
|
|
2734
|
+
} catch (error) {
|
|
2735
|
+
const lastArg = args.length > 0 ? args[args.length - 1] : void 0;
|
|
2736
|
+
if (hasCallbacks(lastArg)) {
|
|
2737
|
+
lastArg.fail?.(error);
|
|
2738
|
+
lastArg.complete?.(error);
|
|
2739
|
+
return;
|
|
2740
|
+
}
|
|
2741
|
+
return Promise.reject(error);
|
|
2742
|
+
}
|
|
2743
|
+
if (typeof runtimeMethod !== "function") return callMissingApi(prop, getPlatform(), args);
|
|
2744
|
+
if (shouldSkipPromise(prop)) {
|
|
2745
|
+
const result = runtimeMethod.apply(runtimeAdapter, runtimeArgs);
|
|
2746
|
+
return mappingRule?.mapResult ? mappingRule.mapResult(result, runtimeArgs) : result;
|
|
2747
|
+
}
|
|
2748
|
+
const lastArg = runtimeArgs.length > 0 ? runtimeArgs[runtimeArgs.length - 1] : void 0;
|
|
2749
|
+
if (hasCallbacks(lastArg)) {
|
|
2750
|
+
if (mappingRule?.mapResult && isPlainObject(lastArg)) {
|
|
2751
|
+
const options = lastArg;
|
|
2752
|
+
const originalSuccess = options.success;
|
|
2753
|
+
const originalComplete = options.complete;
|
|
2754
|
+
options.success = (res) => {
|
|
2755
|
+
originalSuccess?.(mappingRule.mapResult(res, runtimeArgs));
|
|
2756
|
+
};
|
|
2757
|
+
options.complete = (res) => {
|
|
2758
|
+
originalComplete?.(mappingRule.mapResult(res, runtimeArgs));
|
|
2759
|
+
};
|
|
2760
|
+
}
|
|
2761
|
+
networkPolicy.bindAdapter(runtimeAdapter);
|
|
2762
|
+
const networkCall = networkPolicy.prepareCall(prop, runtimeArgs);
|
|
2763
|
+
if (networkCall?.blockedError) return callWithError(networkCall.blockedError, runtimeArgs);
|
|
2764
|
+
const nextRuntimeArgs = networkCall?.args ?? runtimeArgs;
|
|
2765
|
+
const invokeRuntime = () => runtimeMethod.apply(runtimeAdapter, nextRuntimeArgs);
|
|
2766
|
+
const result = networkCall ? networkCall.invoke(invokeRuntime) : invokeRuntime();
|
|
2767
|
+
return mappingRule?.mapResult ? mappingRule.mapResult(result, nextRuntimeArgs) : result;
|
|
2768
|
+
}
|
|
2769
|
+
let networkCall;
|
|
2770
|
+
return callWithPromise(runtimeAdapter, runtimeMethod, runtimeArgs, mappingRule?.mapResult, {
|
|
2771
|
+
onOptions: (_options, nextArgs) => {
|
|
2772
|
+
networkPolicy.bindAdapter(runtimeAdapter);
|
|
2773
|
+
networkCall = networkPolicy.prepareCall(prop, nextArgs);
|
|
2774
|
+
if (networkCall?.blockedError) throw networkCall.blockedError;
|
|
2775
|
+
if (!networkCall) return;
|
|
2776
|
+
nextArgs.splice(0, nextArgs.length, ...networkCall.args);
|
|
2777
|
+
},
|
|
2778
|
+
invoke: (invoke) => {
|
|
2779
|
+
if (networkCall) {
|
|
2780
|
+
networkCall.invoke(invoke);
|
|
2781
|
+
return;
|
|
2782
|
+
}
|
|
2783
|
+
invoke();
|
|
2784
|
+
}
|
|
2785
|
+
});
|
|
2786
|
+
};
|
|
2787
|
+
cache.set(prop, wrapped);
|
|
2788
|
+
return wrapped;
|
|
2789
|
+
} });
|
|
2790
|
+
}
|
|
2791
|
+
//#endregion
|
|
2792
|
+
//#region src/index.ts
|
|
2793
|
+
/**
|
|
2794
|
+
* @description 默认跨平台 API 实例(推荐使用)
|
|
2795
|
+
*
|
|
2796
|
+
* @generated weapi-platform-matrix:start
|
|
2797
|
+
* | 平台 | 类型来源 | 支持度 |
|
|
2798
|
+
* | --- | --- | --- |
|
|
2799
|
+
* | 微信小程序 (`wx`) | `miniprogram-api-typings` | ✅ 全量 |
|
|
2800
|
+
* | 支付宝小程序 (`my`) | `@mini-types/alipay` | ✅ 全量 |
|
|
2801
|
+
* | 百度智能小程序 (`swan`) | 运行时透传 | ⚠️ 按宿主能力支持 |
|
|
2802
|
+
* | 抖音小程序 (`tt`) | `@douyin-microapp/typings` | ✅ 全量 |
|
|
2803
|
+
* | QQ 小程序 (`qq`) | 运行时透传 | ⚠️ 按宿主能力支持 |
|
|
2804
|
+
* | 快手小程序 (`ks`) | 运行时透传 | ⚠️ 按宿主能力支持 |
|
|
2805
|
+
* | 京东小程序 (`jd`) | 运行时透传 | ⚠️ 按宿主能力支持 |
|
|
2806
|
+
* | 小红书小程序 (`xhs`) | 运行时透传 | ⚠️ 按宿主能力支持 |
|
|
2807
|
+
* | 钉钉小程序 (`dd`) | 运行时透传 | ⚠️ 按宿主能力支持 |
|
|
2808
|
+
* | 快应用 (`qa`) | 运行时透传 | ⚠️ 按宿主能力支持 |
|
|
2809
|
+
* | 快应用 WebView (`qapp`) | 运行时透传 | ⚠️ 按宿主能力支持 |
|
|
2810
|
+
* | uni-app 运行时 (`uni`) | 运行时透传 | ⚠️ 按宿主能力支持 |
|
|
2811
|
+
* @generated weapi-platform-matrix:end
|
|
2812
|
+
*/
|
|
2813
|
+
const api = createWeapi();
|
|
2814
|
+
/**
|
|
2815
|
+
* @description 默认跨平台 API 实例的兼容名称。
|
|
2816
|
+
*/
|
|
2817
|
+
const wpi = api;
|
|
2818
|
+
//#endregion
|
|
2819
|
+
export { MINI_PROGRAM_API_PLATFORM_DESCRIPTORS, WEAPI_PLATFORM_TYPE_SOURCES, WEAPI_RUNTIME_TYPE_SOURCES, WEAPI_TYPE_SOURCES, api, createWeapi as createApi, createWeapi, normalizeMiniProgramPlatform, resolveMiniProgramPlatform, wpi };
|