@wevu/api 0.2.10 → 0.2.12
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/dist/index.d.mts +3 -3
- package/dist/index.mjs +4 -2
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -8145,20 +8145,20 @@ type PromisifyOptionMethod<Prefix extends any[], Option extends object, Result,
|
|
|
8145
8145
|
<TOption extends Option>(...args: [...Prefix, TOption]): HasCallbackOption<TOption> extends true ? Result : Promise<ExtractSuccessResult<Option>>;
|
|
8146
8146
|
};
|
|
8147
8147
|
type NormalizePromisifyReturn<T> = T extends Promise<any> ? T : Promise<T>;
|
|
8148
|
-
type NormalizeTupleArgs<Args extends any[]> = { [Key in keyof Args]-?: Args[Key] };
|
|
8148
|
+
type NormalizeTupleArgs<Args extends any[]> = { [Key in keyof Args]-?: Args[Key]; };
|
|
8149
8149
|
type DecomposeTrailingArg<Args extends any[]> = NormalizeTupleArgs<Args> extends [...infer Prefix, infer Last] ? {
|
|
8150
8150
|
prefix: Prefix;
|
|
8151
8151
|
last: Last;
|
|
8152
8152
|
} : never;
|
|
8153
8153
|
type IsOptionalTrailingArg<Args extends any[], Prefix extends any[]> = Record<never, never> extends Pick<Args, Prefix['length']> ? true : false;
|
|
8154
|
-
type RequiredObjectKeys<T extends object> = { [Key in keyof T]-?: Pick<T, Key> extends Required<Pick<T, Key>> ? Key : never }[keyof T];
|
|
8154
|
+
type RequiredObjectKeys<T extends object> = { [Key in keyof T]-?: Pick<T, Key> extends Required<Pick<T, Key>> ? Key : never; }[keyof T];
|
|
8155
8155
|
type IsStructurallyOmittableObject<T> = T extends object ? (RequiredObjectKeys<T> extends never ? true : false) : false;
|
|
8156
8156
|
type IsOmittableTrailingArg<Args extends any[], Prefix extends any[], Last> = IsOptionalTrailingArg<Args, Prefix> extends true ? true : IsStructurallyOmittableObject<NonNullable<Last>>;
|
|
8157
8157
|
type PromisifyMethod<TMethod> = TMethod extends ((...args: infer Args) => infer Result) ? Args extends [] ? (...args: Args) => NormalizePromisifyReturn<Result> : DecomposeTrailingArg<Args> extends {
|
|
8158
8158
|
prefix: infer Prefix extends any[];
|
|
8159
8159
|
last: infer Last;
|
|
8160
8160
|
} ? true extends HasCallbackKey<NonNullable<Last>> ? PromisifyOptionMethod<Prefix, NonNullable<Last>, Result, IsOmittableTrailingArg<Args, Prefix, Last>> : (...args: Args) => NormalizePromisifyReturn<Result> : (...args: Args) => NormalizePromisifyReturn<Result> : TMethod;
|
|
8161
|
-
type WeapiPromisify<TAdapter extends WeapiAdapter> = { [Key in keyof TAdapter]: Key extends string ? Key extends `${string}Sync` ? TAdapter[Key] : Key extends WeapiNonPromisifiedMethodName ? TAdapter[Key] : Key extends `on${Capitalize<string>}` | `off${Capitalize<string>}` ? TAdapter[Key] : PromisifyMethod<TAdapter[Key]> : TAdapter[Key] };
|
|
8161
|
+
type WeapiPromisify<TAdapter extends WeapiAdapter> = { [Key in keyof TAdapter]: Key extends string ? Key extends `${string}Sync` ? TAdapter[Key] : Key extends WeapiNonPromisifiedMethodName ? TAdapter[Key] : Key extends `on${Capitalize<string>}` | `off${Capitalize<string>}` ? TAdapter[Key] : PromisifyMethod<TAdapter[Key]> : TAdapter[Key]; };
|
|
8162
8162
|
/**
|
|
8163
8163
|
* @description 微信小程序 API 适配器类型
|
|
8164
8164
|
*/
|
package/dist/index.mjs
CHANGED
|
@@ -2566,7 +2566,8 @@ function createWeapi(options = {}) {
|
|
|
2566
2566
|
return (...args) => callMissingApi(prop, getPlatform(), args);
|
|
2567
2567
|
}
|
|
2568
2568
|
const platform = getPlatform();
|
|
2569
|
-
const
|
|
2569
|
+
const methodName = (typeof prop === "string" ? resolveMethodMappingWithMeta(platform, prop, { allowFallback }) : void 0)?.target ?? prop;
|
|
2570
|
+
const value = resolveRuntimeMethod(currentAdapter, platform, methodName);
|
|
2570
2571
|
if (typeof value !== "function") {
|
|
2571
2572
|
if (value === void 0 && typeof prop === "string") {
|
|
2572
2573
|
const missing = (...args) => callMissingApi(prop, getPlatform(), args);
|
|
@@ -2581,7 +2582,8 @@ function createWeapi(options = {}) {
|
|
|
2581
2582
|
const platform = getPlatform();
|
|
2582
2583
|
const mappingInfo = resolveMethodMappingWithMeta(platform, prop, { allowFallback });
|
|
2583
2584
|
const mappingRule = mappingInfo?.rule;
|
|
2584
|
-
const
|
|
2585
|
+
const methodName = mappingInfo?.target ?? prop;
|
|
2586
|
+
const runtimeMethod = resolveRuntimeMethod(runtimeAdapter, platform, methodName);
|
|
2585
2587
|
let runtimeArgs = args;
|
|
2586
2588
|
try {
|
|
2587
2589
|
runtimeArgs = mappingRule?.mapArgs ? mappingRule.mapArgs(args) : args;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wevu/api",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.12",
|
|
5
5
|
"description": "tsdown bundler template",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@douyin-microapp/typings": "^1.3.1",
|
|
36
36
|
"@mini-types/alipay": "^3.0.14",
|
|
37
37
|
"miniprogram-api-typings": "^5.2.1",
|
|
38
|
-
"@weapp-core/shared": "3.0.
|
|
38
|
+
"@weapp-core/shared": "3.0.6"
|
|
39
39
|
},
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|