@heybox/hb-sdk 0.4.6 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -5
- package/dist/cli-chunks/{create-BahMMgJH.cjs → create-BiCyOEAv.cjs} +1 -1
- package/dist/cli-chunks/{dev-CTuXVPpU.cjs → dev-D4XRqzz1.cjs} +1 -1
- package/dist/cli-chunks/{doctor-9gg3ZIvt.cjs → doctor-CmHZYQ2I.cjs} +1 -1
- package/dist/cli-chunks/{index-CLne_LW7.cjs → index-DXS0s9d7.cjs} +2 -2
- package/dist/cli-chunks/{index-DuwxUSkq.cjs → index-kv8oOmFw.cjs} +13 -13
- package/dist/cli-chunks/{login-OqaEx-Wd.cjs → login-F9AEL3cF.cjs} +2 -2
- package/dist/cli-chunks/{remote-zX17hOT4.cjs → remote-BRktlraB.cjs} +210 -91
- package/dist/cli-chunks/{session-D7lF9mpd.cjs → session-DItg0094.cjs} +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/devtools/mock-host/main.js +987 -7
- package/dist/index.cjs.js +51 -0
- package/dist/index.esm.js +51 -0
- package/dist/miniapp-publish.cjs.js +16 -0
- package/dist/miniapp-publish.esm.js +14 -1
- package/dist/protocol.cjs.js +50 -0
- package/dist/protocol.esm.js +46 -1
- package/dist/templates/vue3-vite-ts/README.md.ejs +2 -1
- package/package.json +1 -1
- package/skill/SKILL.md +1 -1
- package/skill/references/api-protocol.md +22 -2
- package/skill/references/api-root.md +70 -2
- package/skill/references/cli.md +6 -3
- package/skill/references/safety-boundaries.md +2 -1
- package/skill/skill.json +4 -4
- package/types/index.d.ts +1 -1
- package/types/miniapp-publish/index.d.ts +10 -0
- package/types/modules/share/types.d.ts +2 -2
- package/types/modules/user/get-current-user-detail.d.ts +9 -0
- package/types/modules/user/get-current-user-profile.d.ts +9 -0
- package/types/modules/user/get-platform-account-info.d.ts +12 -0
- package/types/modules/user/get-platform-account-overview.d.ts +9 -0
- package/types/modules/user/get-steam-game-list.d.ts +12 -0
- package/types/modules/user/index.d.ts +33 -1
- package/types/modules/user/types.d.ts +285 -0
- package/types/protocol/capabilities.d.ts +52 -2
- package/types/protocol.d.ts +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -424,6 +424,16 @@ const AUTH_LOGIN_METHOD = 'auth.login';
|
|
|
424
424
|
* 供 SDK 与父容器 runtime 共享同一 bridge method 标识。
|
|
425
425
|
*/
|
|
426
426
|
const USER_GET_INFO_METHOD = 'user.getInfo';
|
|
427
|
+
/** 当前用户展示详情能力方法名。 */
|
|
428
|
+
const USER_GET_CURRENT_USER_DETAIL_METHOD = 'user.getCurrentUserDetail';
|
|
429
|
+
/** 当前用户敏感资料详情能力方法名。 */
|
|
430
|
+
const USER_GET_CURRENT_USER_PROFILE_METHOD = 'user.getCurrentUserProfile';
|
|
431
|
+
/** 当前用户平台账号概览能力方法名。 */
|
|
432
|
+
const USER_GET_PLATFORM_ACCOUNT_OVERVIEW_METHOD = 'user.getPlatformAccountOverview';
|
|
433
|
+
/** 当前用户指定平台账号详情能力方法名。 */
|
|
434
|
+
const USER_GET_PLATFORM_ACCOUNT_INFO_METHOD = 'user.getPlatformAccountInfo';
|
|
435
|
+
/** 当前用户 Steam 游戏库能力方法名。 */
|
|
436
|
+
const USER_GET_STEAM_GAME_LIST_METHOD = 'user.getSteamGameList';
|
|
427
437
|
/**
|
|
428
438
|
* 展示分享面板能力方法名。
|
|
429
439
|
*
|
|
@@ -730,6 +740,37 @@ function getInfo(requester) {
|
|
|
730
740
|
return requester.request(USER_GET_INFO_METHOD);
|
|
731
741
|
}
|
|
732
742
|
|
|
743
|
+
/** 获取当前访问小程序用户的展示详情。 */
|
|
744
|
+
function getCurrentUserDetail(requester) {
|
|
745
|
+
return requester.request(USER_GET_CURRENT_USER_DETAIL_METHOD);
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
/** 获取当前访问小程序用户的敏感资料详情。 */
|
|
749
|
+
function getCurrentUserProfile(requester) {
|
|
750
|
+
return requester.request(USER_GET_CURRENT_USER_PROFILE_METHOD);
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
/** 获取当前访问小程序用户的指定平台账号详情。 */
|
|
754
|
+
function getPlatformAccountInfo(requester, platform) {
|
|
755
|
+
return requester.request(USER_GET_PLATFORM_ACCOUNT_INFO_METHOD, { platform });
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
/** 获取当前访问小程序用户的平台账号绑定/隐藏状态概览。 */
|
|
759
|
+
function getPlatformAccountOverview(requester) {
|
|
760
|
+
return requester.request(USER_GET_PLATFORM_ACCOUNT_OVERVIEW_METHOD);
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
/**
|
|
764
|
+
* 获取当前用户 Steam 游戏库。
|
|
765
|
+
*
|
|
766
|
+
* @param requester 底层 bridge 请求能力。
|
|
767
|
+
* @param options 查询与分页参数。
|
|
768
|
+
* @returns 当前用户 Steam 游戏库;未登录或未绑定 Steam 时返回状态对象。
|
|
769
|
+
*/
|
|
770
|
+
function getSteamGameList(requester, options) {
|
|
771
|
+
return requester.request(USER_GET_STEAM_GAME_LIST_METHOD, options);
|
|
772
|
+
}
|
|
773
|
+
|
|
733
774
|
/**
|
|
734
775
|
* 创建用户模块。
|
|
735
776
|
*
|
|
@@ -739,6 +780,11 @@ function getInfo(requester) {
|
|
|
739
780
|
function createUserModule(requester) {
|
|
740
781
|
return {
|
|
741
782
|
getInfo: () => getInfo(requester),
|
|
783
|
+
getCurrentUserDetail: () => getCurrentUserDetail(requester),
|
|
784
|
+
getCurrentUserProfile: () => getCurrentUserProfile(requester),
|
|
785
|
+
getPlatformAccountOverview: () => getPlatformAccountOverview(requester),
|
|
786
|
+
getPlatformAccountInfo: platform => getPlatformAccountInfo(requester, platform),
|
|
787
|
+
getSteamGameList: options => getSteamGameList(requester, options),
|
|
742
788
|
};
|
|
743
789
|
}
|
|
744
790
|
|
|
@@ -952,6 +998,11 @@ const auth = {
|
|
|
952
998
|
/** 默认 SDK 实例的用户资料模块。 */
|
|
953
999
|
const user = {
|
|
954
1000
|
getInfo: () => getDefaultSDK().user.getInfo(),
|
|
1001
|
+
getCurrentUserDetail: () => getDefaultSDK().user.getCurrentUserDetail(),
|
|
1002
|
+
getCurrentUserProfile: () => getDefaultSDK().user.getCurrentUserProfile(),
|
|
1003
|
+
getPlatformAccountOverview: () => getDefaultSDK().user.getPlatformAccountOverview(),
|
|
1004
|
+
getPlatformAccountInfo: platform => getDefaultSDK().user.getPlatformAccountInfo(platform),
|
|
1005
|
+
getSteamGameList: options => getDefaultSDK().user.getSteamGameList(options),
|
|
955
1006
|
};
|
|
956
1007
|
/** 默认 SDK 实例的分享模块。 */
|
|
957
1008
|
const share = {
|
package/dist/index.esm.js
CHANGED
|
@@ -420,6 +420,16 @@ const AUTH_LOGIN_METHOD = 'auth.login';
|
|
|
420
420
|
* 供 SDK 与父容器 runtime 共享同一 bridge method 标识。
|
|
421
421
|
*/
|
|
422
422
|
const USER_GET_INFO_METHOD = 'user.getInfo';
|
|
423
|
+
/** 当前用户展示详情能力方法名。 */
|
|
424
|
+
const USER_GET_CURRENT_USER_DETAIL_METHOD = 'user.getCurrentUserDetail';
|
|
425
|
+
/** 当前用户敏感资料详情能力方法名。 */
|
|
426
|
+
const USER_GET_CURRENT_USER_PROFILE_METHOD = 'user.getCurrentUserProfile';
|
|
427
|
+
/** 当前用户平台账号概览能力方法名。 */
|
|
428
|
+
const USER_GET_PLATFORM_ACCOUNT_OVERVIEW_METHOD = 'user.getPlatformAccountOverview';
|
|
429
|
+
/** 当前用户指定平台账号详情能力方法名。 */
|
|
430
|
+
const USER_GET_PLATFORM_ACCOUNT_INFO_METHOD = 'user.getPlatformAccountInfo';
|
|
431
|
+
/** 当前用户 Steam 游戏库能力方法名。 */
|
|
432
|
+
const USER_GET_STEAM_GAME_LIST_METHOD = 'user.getSteamGameList';
|
|
423
433
|
/**
|
|
424
434
|
* 展示分享面板能力方法名。
|
|
425
435
|
*
|
|
@@ -726,6 +736,37 @@ function getInfo(requester) {
|
|
|
726
736
|
return requester.request(USER_GET_INFO_METHOD);
|
|
727
737
|
}
|
|
728
738
|
|
|
739
|
+
/** 获取当前访问小程序用户的展示详情。 */
|
|
740
|
+
function getCurrentUserDetail(requester) {
|
|
741
|
+
return requester.request(USER_GET_CURRENT_USER_DETAIL_METHOD);
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
/** 获取当前访问小程序用户的敏感资料详情。 */
|
|
745
|
+
function getCurrentUserProfile(requester) {
|
|
746
|
+
return requester.request(USER_GET_CURRENT_USER_PROFILE_METHOD);
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
/** 获取当前访问小程序用户的指定平台账号详情。 */
|
|
750
|
+
function getPlatformAccountInfo(requester, platform) {
|
|
751
|
+
return requester.request(USER_GET_PLATFORM_ACCOUNT_INFO_METHOD, { platform });
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
/** 获取当前访问小程序用户的平台账号绑定/隐藏状态概览。 */
|
|
755
|
+
function getPlatformAccountOverview(requester) {
|
|
756
|
+
return requester.request(USER_GET_PLATFORM_ACCOUNT_OVERVIEW_METHOD);
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
/**
|
|
760
|
+
* 获取当前用户 Steam 游戏库。
|
|
761
|
+
*
|
|
762
|
+
* @param requester 底层 bridge 请求能力。
|
|
763
|
+
* @param options 查询与分页参数。
|
|
764
|
+
* @returns 当前用户 Steam 游戏库;未登录或未绑定 Steam 时返回状态对象。
|
|
765
|
+
*/
|
|
766
|
+
function getSteamGameList(requester, options) {
|
|
767
|
+
return requester.request(USER_GET_STEAM_GAME_LIST_METHOD, options);
|
|
768
|
+
}
|
|
769
|
+
|
|
729
770
|
/**
|
|
730
771
|
* 创建用户模块。
|
|
731
772
|
*
|
|
@@ -735,6 +776,11 @@ function getInfo(requester) {
|
|
|
735
776
|
function createUserModule(requester) {
|
|
736
777
|
return {
|
|
737
778
|
getInfo: () => getInfo(requester),
|
|
779
|
+
getCurrentUserDetail: () => getCurrentUserDetail(requester),
|
|
780
|
+
getCurrentUserProfile: () => getCurrentUserProfile(requester),
|
|
781
|
+
getPlatformAccountOverview: () => getPlatformAccountOverview(requester),
|
|
782
|
+
getPlatformAccountInfo: platform => getPlatformAccountInfo(requester, platform),
|
|
783
|
+
getSteamGameList: options => getSteamGameList(requester, options),
|
|
738
784
|
};
|
|
739
785
|
}
|
|
740
786
|
|
|
@@ -948,6 +994,11 @@ const auth = {
|
|
|
948
994
|
/** 默认 SDK 实例的用户资料模块。 */
|
|
949
995
|
const user = {
|
|
950
996
|
getInfo: () => getDefaultSDK().user.getInfo(),
|
|
997
|
+
getCurrentUserDetail: () => getDefaultSDK().user.getCurrentUserDetail(),
|
|
998
|
+
getCurrentUserProfile: () => getDefaultSDK().user.getCurrentUserProfile(),
|
|
999
|
+
getPlatformAccountOverview: () => getDefaultSDK().user.getPlatformAccountOverview(),
|
|
1000
|
+
getPlatformAccountInfo: platform => getDefaultSDK().user.getPlatformAccountInfo(platform),
|
|
1001
|
+
getSteamGameList: options => getDefaultSDK().user.getSteamGameList(options),
|
|
951
1002
|
};
|
|
952
1003
|
/** 默认 SDK 实例的分享模块。 */
|
|
953
1004
|
const share = {
|
|
@@ -2811,6 +2811,8 @@ function getMiniappManifestVersionError(version) {
|
|
|
2811
2811
|
|
|
2812
2812
|
const MINIAPP_UPLOAD_SCOPE = 'activity';
|
|
2813
2813
|
const ACTIVITY_UPLOAD_KEY_MAX_LENGTH = 64;
|
|
2814
|
+
const MINIAPP_UPLOAD_BATCH_SIZE = 50;
|
|
2815
|
+
const MINIAPP_UPLOAD_TOTAL_SIZE_LIMIT_BYTES = 100 * 1024 * 1024;
|
|
2814
2816
|
const USER_MINIPROGRAM_ACCESS_STATUS_API_PATH = '/mall/developer/user_miniprogram/access_status';
|
|
2815
2817
|
const DEVELOPER_ENTITY_LIST_API_PATH = '/mall/developer/entity/list';
|
|
2816
2818
|
const DEVELOPER_ENTITY_SWITCH_API_PATH = '/mall/developer/entity/switch';
|
|
@@ -2869,6 +2871,17 @@ function validateUploadPaths(items, options) {
|
|
|
2869
2871
|
}
|
|
2870
2872
|
return undefined;
|
|
2871
2873
|
}
|
|
2874
|
+
function validateUploadTotalSize(items, options = {}) {
|
|
2875
|
+
const limit = options.limitBytes ?? MINIAPP_UPLOAD_TOTAL_SIZE_LIMIT_BYTES;
|
|
2876
|
+
const total = items.reduce((sum, item) => {
|
|
2877
|
+
const size = Number(item.size);
|
|
2878
|
+
return sum + (Number.isFinite(size) && size > 0 ? size : 0);
|
|
2879
|
+
}, 0);
|
|
2880
|
+
if (total > limit) {
|
|
2881
|
+
return '构建产物总大小超过 100MB,请删除未引用资源或压缩图片后重新 deploy';
|
|
2882
|
+
}
|
|
2883
|
+
return undefined;
|
|
2884
|
+
}
|
|
2872
2885
|
function shouldUploadDistFile(relativePath) {
|
|
2873
2886
|
const normalized = normalizeRelativePath(relativePath);
|
|
2874
2887
|
if (!normalized) {
|
|
@@ -2893,7 +2906,9 @@ exports.DEVELOPER_ENTITY_LIST_API_PATH = DEVELOPER_ENTITY_LIST_API_PATH;
|
|
|
2893
2906
|
exports.DEVELOPER_ENTITY_SWITCH_API_PATH = DEVELOPER_ENTITY_SWITCH_API_PATH;
|
|
2894
2907
|
exports.LIST_USER_MINIPROGRAM_API_PATH = LIST_USER_MINIPROGRAM_API_PATH;
|
|
2895
2908
|
exports.LIST_USER_MINIPROGRAM_VERSION_API_PATH = LIST_USER_MINIPROGRAM_VERSION_API_PATH;
|
|
2909
|
+
exports.MINIAPP_UPLOAD_BATCH_SIZE = MINIAPP_UPLOAD_BATCH_SIZE;
|
|
2896
2910
|
exports.MINIAPP_UPLOAD_SCOPE = MINIAPP_UPLOAD_SCOPE;
|
|
2911
|
+
exports.MINIAPP_UPLOAD_TOTAL_SIZE_LIMIT_BYTES = MINIAPP_UPLOAD_TOTAL_SIZE_LIMIT_BYTES;
|
|
2897
2912
|
exports.PRECHECK_USER_MINIPROGRAM_VERSION_API_PATH = PRECHECK_USER_MINIPROGRAM_VERSION_API_PATH;
|
|
2898
2913
|
exports.RELEASE_USER_MINIPROGRAM_VERSION_API_PATH = RELEASE_USER_MINIPROGRAM_VERSION_API_PATH;
|
|
2899
2914
|
exports.REOPEN_USER_MINIPROGRAM_API_PATH = REOPEN_USER_MINIPROGRAM_API_PATH;
|
|
@@ -2912,3 +2927,4 @@ exports.normalizeRelativePath = normalizeRelativePath;
|
|
|
2912
2927
|
exports.relativePathContainsNodeModulesSegment = relativePathContainsNodeModulesSegment;
|
|
2913
2928
|
exports.shouldUploadDistFile = shouldUploadDistFile;
|
|
2914
2929
|
exports.validateUploadPaths = validateUploadPaths;
|
|
2930
|
+
exports.validateUploadTotalSize = validateUploadTotalSize;
|
|
@@ -2809,6 +2809,8 @@ function getMiniappManifestVersionError(version) {
|
|
|
2809
2809
|
|
|
2810
2810
|
const MINIAPP_UPLOAD_SCOPE = 'activity';
|
|
2811
2811
|
const ACTIVITY_UPLOAD_KEY_MAX_LENGTH = 64;
|
|
2812
|
+
const MINIAPP_UPLOAD_BATCH_SIZE = 50;
|
|
2813
|
+
const MINIAPP_UPLOAD_TOTAL_SIZE_LIMIT_BYTES = 100 * 1024 * 1024;
|
|
2812
2814
|
const USER_MINIPROGRAM_ACCESS_STATUS_API_PATH = '/mall/developer/user_miniprogram/access_status';
|
|
2813
2815
|
const DEVELOPER_ENTITY_LIST_API_PATH = '/mall/developer/entity/list';
|
|
2814
2816
|
const DEVELOPER_ENTITY_SWITCH_API_PATH = '/mall/developer/entity/switch';
|
|
@@ -2867,6 +2869,17 @@ function validateUploadPaths(items, options) {
|
|
|
2867
2869
|
}
|
|
2868
2870
|
return undefined;
|
|
2869
2871
|
}
|
|
2872
|
+
function validateUploadTotalSize(items, options = {}) {
|
|
2873
|
+
const limit = options.limitBytes ?? MINIAPP_UPLOAD_TOTAL_SIZE_LIMIT_BYTES;
|
|
2874
|
+
const total = items.reduce((sum, item) => {
|
|
2875
|
+
const size = Number(item.size);
|
|
2876
|
+
return sum + (Number.isFinite(size) && size > 0 ? size : 0);
|
|
2877
|
+
}, 0);
|
|
2878
|
+
if (total > limit) {
|
|
2879
|
+
return '构建产物总大小超过 100MB,请删除未引用资源或压缩图片后重新 deploy';
|
|
2880
|
+
}
|
|
2881
|
+
return undefined;
|
|
2882
|
+
}
|
|
2870
2883
|
function shouldUploadDistFile(relativePath) {
|
|
2871
2884
|
const normalized = normalizeRelativePath(relativePath);
|
|
2872
2885
|
if (!normalized) {
|
|
@@ -2884,4 +2897,4 @@ function shouldUploadDistFile(relativePath) {
|
|
|
2884
2897
|
return true;
|
|
2885
2898
|
}
|
|
2886
2899
|
|
|
2887
|
-
export { ACTIVITY_UPLOAD_KEY_MAX_LENGTH, CREATE_USER_MINIPROGRAM_API_PATH, DETAIL_USER_MINIPROGRAM_API_PATH, DEVELOPER_ENTITY_LIST_API_PATH, DEVELOPER_ENTITY_SWITCH_API_PATH, LIST_USER_MINIPROGRAM_API_PATH, LIST_USER_MINIPROGRAM_VERSION_API_PATH, MINIAPP_UPLOAD_SCOPE, PRECHECK_USER_MINIPROGRAM_VERSION_API_PATH, RELEASE_USER_MINIPROGRAM_VERSION_API_PATH, REOPEN_USER_MINIPROGRAM_API_PATH, SUBMIT_USER_MINIPROGRAM_AUDIT_API_PATH, TAKE_DOWN_USER_MINIPROGRAM_API_PATH, UPDATE_USER_MINIPROGRAM_API_PATH, UPDATE_USER_MINIPROGRAM_PREVIEW_ALLOWLIST_API_PATH, USER_MINIPROGRAM_ACCESS_STATUS_API_PATH, USER_MINIPROGRAM_PREVIEW_ALLOWLIST_API_PATH, USER_MINIPROGRAM_VERSION_PREVIEW_INFO_API_PATH, WITHDRAW_USER_MINIPROGRAM_VERSION_API_PATH, getMiniProgramUploadAlias, getMiniappUploadKey, isValidMiniappManifestVersion as isValidVersion, normalizeRelativePath, relativePathContainsNodeModulesSegment, shouldUploadDistFile, validateUploadPaths };
|
|
2900
|
+
export { ACTIVITY_UPLOAD_KEY_MAX_LENGTH, CREATE_USER_MINIPROGRAM_API_PATH, DETAIL_USER_MINIPROGRAM_API_PATH, DEVELOPER_ENTITY_LIST_API_PATH, DEVELOPER_ENTITY_SWITCH_API_PATH, LIST_USER_MINIPROGRAM_API_PATH, LIST_USER_MINIPROGRAM_VERSION_API_PATH, MINIAPP_UPLOAD_BATCH_SIZE, MINIAPP_UPLOAD_SCOPE, MINIAPP_UPLOAD_TOTAL_SIZE_LIMIT_BYTES, PRECHECK_USER_MINIPROGRAM_VERSION_API_PATH, RELEASE_USER_MINIPROGRAM_VERSION_API_PATH, REOPEN_USER_MINIPROGRAM_API_PATH, SUBMIT_USER_MINIPROGRAM_AUDIT_API_PATH, TAKE_DOWN_USER_MINIPROGRAM_API_PATH, UPDATE_USER_MINIPROGRAM_API_PATH, UPDATE_USER_MINIPROGRAM_PREVIEW_ALLOWLIST_API_PATH, USER_MINIPROGRAM_ACCESS_STATUS_API_PATH, USER_MINIPROGRAM_PREVIEW_ALLOWLIST_API_PATH, USER_MINIPROGRAM_VERSION_PREVIEW_INFO_API_PATH, WITHDRAW_USER_MINIPROGRAM_VERSION_API_PATH, getMiniProgramUploadAlias, getMiniappUploadKey, isValidMiniappManifestVersion as isValidVersion, normalizeRelativePath, relativePathContainsNodeModulesSegment, shouldUploadDistFile, validateUploadPaths, validateUploadTotalSize };
|
package/dist/protocol.cjs.js
CHANGED
|
@@ -40,6 +40,16 @@ const AUTH_LOGIN_METHOD = 'auth.login';
|
|
|
40
40
|
* 供 SDK 与父容器 runtime 共享同一 bridge method 标识。
|
|
41
41
|
*/
|
|
42
42
|
const USER_GET_INFO_METHOD = 'user.getInfo';
|
|
43
|
+
/** 当前用户展示详情能力方法名。 */
|
|
44
|
+
const USER_GET_CURRENT_USER_DETAIL_METHOD = 'user.getCurrentUserDetail';
|
|
45
|
+
/** 当前用户敏感资料详情能力方法名。 */
|
|
46
|
+
const USER_GET_CURRENT_USER_PROFILE_METHOD = 'user.getCurrentUserProfile';
|
|
47
|
+
/** 当前用户平台账号概览能力方法名。 */
|
|
48
|
+
const USER_GET_PLATFORM_ACCOUNT_OVERVIEW_METHOD = 'user.getPlatformAccountOverview';
|
|
49
|
+
/** 当前用户指定平台账号详情能力方法名。 */
|
|
50
|
+
const USER_GET_PLATFORM_ACCOUNT_INFO_METHOD = 'user.getPlatformAccountInfo';
|
|
51
|
+
/** 当前用户 Steam 游戏库能力方法名。 */
|
|
52
|
+
const USER_GET_STEAM_GAME_LIST_METHOD = 'user.getSteamGameList';
|
|
43
53
|
/**
|
|
44
54
|
* 展示分享面板能力方法名。
|
|
45
55
|
*
|
|
@@ -124,6 +134,41 @@ const MINI_PROGRAM_PROTOCOL_CAPABILITIES = [
|
|
|
124
134
|
permission: 'user.getInfo',
|
|
125
135
|
risk: 'medium',
|
|
126
136
|
},
|
|
137
|
+
{
|
|
138
|
+
method: USER_GET_CURRENT_USER_DETAIL_METHOD,
|
|
139
|
+
module: 'user',
|
|
140
|
+
capability: USER_GET_CURRENT_USER_DETAIL_METHOD,
|
|
141
|
+
permission: 'user.currentUserDetail',
|
|
142
|
+
risk: 'high',
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
method: USER_GET_CURRENT_USER_PROFILE_METHOD,
|
|
146
|
+
module: 'user',
|
|
147
|
+
capability: USER_GET_CURRENT_USER_PROFILE_METHOD,
|
|
148
|
+
permission: 'user.currentUserProfile',
|
|
149
|
+
risk: 'high',
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
method: USER_GET_PLATFORM_ACCOUNT_OVERVIEW_METHOD,
|
|
153
|
+
module: 'user',
|
|
154
|
+
capability: USER_GET_PLATFORM_ACCOUNT_OVERVIEW_METHOD,
|
|
155
|
+
permission: 'user.platformAccount.overview',
|
|
156
|
+
risk: 'medium',
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
method: USER_GET_PLATFORM_ACCOUNT_INFO_METHOD,
|
|
160
|
+
module: 'user',
|
|
161
|
+
capability: USER_GET_PLATFORM_ACCOUNT_INFO_METHOD,
|
|
162
|
+
permission: 'user.platformAccount.info',
|
|
163
|
+
risk: 'high',
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
method: USER_GET_STEAM_GAME_LIST_METHOD,
|
|
167
|
+
module: 'user',
|
|
168
|
+
capability: USER_GET_STEAM_GAME_LIST_METHOD,
|
|
169
|
+
permission: 'user.steamGameList',
|
|
170
|
+
risk: 'high',
|
|
171
|
+
},
|
|
127
172
|
{
|
|
128
173
|
method: SHARE_SHOW_SHARE_MENU_METHOD,
|
|
129
174
|
module: 'share',
|
|
@@ -242,7 +287,12 @@ exports.STORAGE_SET_STORAGE_METHOD = STORAGE_SET_STORAGE_METHOD;
|
|
|
242
287
|
exports.UI_HIDE_LOADING_METHOD = UI_HIDE_LOADING_METHOD;
|
|
243
288
|
exports.UI_SHOW_LOADING_METHOD = UI_SHOW_LOADING_METHOD;
|
|
244
289
|
exports.UI_SHOW_TOAST_METHOD = UI_SHOW_TOAST_METHOD;
|
|
290
|
+
exports.USER_GET_CURRENT_USER_DETAIL_METHOD = USER_GET_CURRENT_USER_DETAIL_METHOD;
|
|
291
|
+
exports.USER_GET_CURRENT_USER_PROFILE_METHOD = USER_GET_CURRENT_USER_PROFILE_METHOD;
|
|
245
292
|
exports.USER_GET_INFO_METHOD = USER_GET_INFO_METHOD;
|
|
293
|
+
exports.USER_GET_PLATFORM_ACCOUNT_INFO_METHOD = USER_GET_PLATFORM_ACCOUNT_INFO_METHOD;
|
|
294
|
+
exports.USER_GET_PLATFORM_ACCOUNT_OVERVIEW_METHOD = USER_GET_PLATFORM_ACCOUNT_OVERVIEW_METHOD;
|
|
295
|
+
exports.USER_GET_STEAM_GAME_LIST_METHOD = USER_GET_STEAM_GAME_LIST_METHOD;
|
|
246
296
|
exports.VIEWPORT_GET_WINDOW_INFO_METHOD = VIEWPORT_GET_WINDOW_INFO_METHOD;
|
|
247
297
|
exports.VIEWPORT_SET_NAVIGATION_BAR_STYLE_METHOD = VIEWPORT_SET_NAVIGATION_BAR_STYLE_METHOD;
|
|
248
298
|
exports.isMiniProgramBridgeMessage = isMiniProgramBridgeMessage;
|
package/dist/protocol.esm.js
CHANGED
|
@@ -38,6 +38,16 @@ const AUTH_LOGIN_METHOD = 'auth.login';
|
|
|
38
38
|
* 供 SDK 与父容器 runtime 共享同一 bridge method 标识。
|
|
39
39
|
*/
|
|
40
40
|
const USER_GET_INFO_METHOD = 'user.getInfo';
|
|
41
|
+
/** 当前用户展示详情能力方法名。 */
|
|
42
|
+
const USER_GET_CURRENT_USER_DETAIL_METHOD = 'user.getCurrentUserDetail';
|
|
43
|
+
/** 当前用户敏感资料详情能力方法名。 */
|
|
44
|
+
const USER_GET_CURRENT_USER_PROFILE_METHOD = 'user.getCurrentUserProfile';
|
|
45
|
+
/** 当前用户平台账号概览能力方法名。 */
|
|
46
|
+
const USER_GET_PLATFORM_ACCOUNT_OVERVIEW_METHOD = 'user.getPlatformAccountOverview';
|
|
47
|
+
/** 当前用户指定平台账号详情能力方法名。 */
|
|
48
|
+
const USER_GET_PLATFORM_ACCOUNT_INFO_METHOD = 'user.getPlatformAccountInfo';
|
|
49
|
+
/** 当前用户 Steam 游戏库能力方法名。 */
|
|
50
|
+
const USER_GET_STEAM_GAME_LIST_METHOD = 'user.getSteamGameList';
|
|
41
51
|
/**
|
|
42
52
|
* 展示分享面板能力方法名。
|
|
43
53
|
*
|
|
@@ -122,6 +132,41 @@ const MINI_PROGRAM_PROTOCOL_CAPABILITIES = [
|
|
|
122
132
|
permission: 'user.getInfo',
|
|
123
133
|
risk: 'medium',
|
|
124
134
|
},
|
|
135
|
+
{
|
|
136
|
+
method: USER_GET_CURRENT_USER_DETAIL_METHOD,
|
|
137
|
+
module: 'user',
|
|
138
|
+
capability: USER_GET_CURRENT_USER_DETAIL_METHOD,
|
|
139
|
+
permission: 'user.currentUserDetail',
|
|
140
|
+
risk: 'high',
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
method: USER_GET_CURRENT_USER_PROFILE_METHOD,
|
|
144
|
+
module: 'user',
|
|
145
|
+
capability: USER_GET_CURRENT_USER_PROFILE_METHOD,
|
|
146
|
+
permission: 'user.currentUserProfile',
|
|
147
|
+
risk: 'high',
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
method: USER_GET_PLATFORM_ACCOUNT_OVERVIEW_METHOD,
|
|
151
|
+
module: 'user',
|
|
152
|
+
capability: USER_GET_PLATFORM_ACCOUNT_OVERVIEW_METHOD,
|
|
153
|
+
permission: 'user.platformAccount.overview',
|
|
154
|
+
risk: 'medium',
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
method: USER_GET_PLATFORM_ACCOUNT_INFO_METHOD,
|
|
158
|
+
module: 'user',
|
|
159
|
+
capability: USER_GET_PLATFORM_ACCOUNT_INFO_METHOD,
|
|
160
|
+
permission: 'user.platformAccount.info',
|
|
161
|
+
risk: 'high',
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
method: USER_GET_STEAM_GAME_LIST_METHOD,
|
|
165
|
+
module: 'user',
|
|
166
|
+
capability: USER_GET_STEAM_GAME_LIST_METHOD,
|
|
167
|
+
permission: 'user.steamGameList',
|
|
168
|
+
risk: 'high',
|
|
169
|
+
},
|
|
125
170
|
{
|
|
126
171
|
method: SHARE_SHOW_SHARE_MENU_METHOD,
|
|
127
172
|
module: 'share',
|
|
@@ -222,4 +267,4 @@ const MINI_PROGRAM_PROTOCOL_CAPABILITIES = [
|
|
|
222
267
|
},
|
|
223
268
|
];
|
|
224
269
|
|
|
225
|
-
export { AUTH_LOGIN_METHOD, DEVICE_SET_CLIPBOARD_METHOD, DEVICE_VIBRATE_METHOD, MINI_PROGRAM_BRIDGE_NONCE_PARAM, MINI_PROGRAM_MESSAGE_NAMESPACE, MINI_PROGRAM_MESSAGE_VERSION, MINI_PROGRAM_PROTOCOL_CAPABILITIES, NAVIGATION_CLOSE_METHOD, NAVIGATION_RELOAD_METHOD, NETWORK_REQUEST_METHOD, SDK_HANDSHAKE_METHOD, SHARE_SCREENSHOT_METHOD, SHARE_SHOW_SHARE_MENU_METHOD, STORAGE_GET_STORAGE_METHOD, STORAGE_SET_STORAGE_METHOD, UI_HIDE_LOADING_METHOD, UI_SHOW_LOADING_METHOD, UI_SHOW_TOAST_METHOD, USER_GET_INFO_METHOD, VIEWPORT_GET_WINDOW_INFO_METHOD, VIEWPORT_SET_NAVIGATION_BAR_STYLE_METHOD, isMiniProgramBridgeMessage };
|
|
270
|
+
export { AUTH_LOGIN_METHOD, DEVICE_SET_CLIPBOARD_METHOD, DEVICE_VIBRATE_METHOD, MINI_PROGRAM_BRIDGE_NONCE_PARAM, MINI_PROGRAM_MESSAGE_NAMESPACE, MINI_PROGRAM_MESSAGE_VERSION, MINI_PROGRAM_PROTOCOL_CAPABILITIES, NAVIGATION_CLOSE_METHOD, NAVIGATION_RELOAD_METHOD, NETWORK_REQUEST_METHOD, SDK_HANDSHAKE_METHOD, SHARE_SCREENSHOT_METHOD, SHARE_SHOW_SHARE_MENU_METHOD, STORAGE_GET_STORAGE_METHOD, STORAGE_SET_STORAGE_METHOD, UI_HIDE_LOADING_METHOD, UI_SHOW_LOADING_METHOD, UI_SHOW_TOAST_METHOD, USER_GET_CURRENT_USER_DETAIL_METHOD, USER_GET_CURRENT_USER_PROFILE_METHOD, USER_GET_INFO_METHOD, USER_GET_PLATFORM_ACCOUNT_INFO_METHOD, USER_GET_PLATFORM_ACCOUNT_OVERVIEW_METHOD, USER_GET_STEAM_GAME_LIST_METHOD, VIEWPORT_GET_WINDOW_INFO_METHOD, VIEWPORT_SET_NAVIGATION_BAR_STYLE_METHOD, isMiniProgramBridgeMessage };
|
|
@@ -33,7 +33,6 @@ import hbSDK from '@heybox/hb-sdk';
|
|
|
33
33
|
await hbSDK.share.showShareMenu({
|
|
34
34
|
title: '<%= projectName %>',
|
|
35
35
|
desc: '分享描述',
|
|
36
|
-
url: window.location.href,
|
|
37
36
|
});
|
|
38
37
|
|
|
39
38
|
await hbSDK.storage.setStorage({
|
|
@@ -46,3 +45,5 @@ const response = await hbSDK.network.request({
|
|
|
46
45
|
url: 'https://jsonplaceholder.typicode.com/todos/1',
|
|
47
46
|
});
|
|
48
47
|
```
|
|
48
|
+
|
|
49
|
+
用户小程序通常不要传 `url`;宿主 runtime 会自动生成当前小程序的通用分享页。只有确实要分享外部 HTTP(S) 页面时才显式传 `url`。
|
package/package.json
CHANGED
package/skill/SKILL.md
CHANGED
|
@@ -52,7 +52,7 @@ Apply these instructions when writing, reviewing, or debugging code that consume
|
|
|
52
52
|
4. Use `hb-sdk remote entity list`, `hb-sdk remote entity current`, and `hb-sdk remote entity switch <entity-id>` to inspect or change the developer platform server-side current entity before remote management commands.
|
|
53
53
|
5. Use `hb-sdk remote create --name <name>` to create a remote mini-program under the server-side current entity and bind the returned id into `package.json.heybox.miniProgramId`; use `hb-sdk remote bind <mini-program-id>` to bind an existing remote mini-program after current-entity manageability is verified.
|
|
54
54
|
6. Use `hb-sdk remote info`, `hb-sdk remote update`, `hb-sdk remote list`, `hb-sdk remote access`, `hb-sdk remote versions`, `hb-sdk remote preview <version>`, and `hb-sdk remote allowlist ...` for read/basic/preview management workflows. Discovery commands show the server-side current entity scope; write commands target the current project binding rather than arbitrary ids.
|
|
55
|
-
7. Use `hb-sdk remote deploy --release-note <text>` to build, upload, and submit the current project for audit. It reads `package.json.heybox.miniProgramId`, validates that the bound mini-program belongs to the server-side current entity before precheck/build/upload, prechecks `package.json.version` before build, runs the project's `build` script via the package manager auto-detected by lockfile, uploads `dist/` to CDN (skipping `manifest.json`, `.DS_Store`, `.map`), then calls the submit-audit API.
|
|
55
|
+
7. Use `hb-sdk remote deploy --release-note <text>` to build, upload, and submit the current project for audit. It reads `package.json.heybox.miniProgramId`, validates that the bound mini-program belongs to the server-side current entity before precheck/build/upload, prechecks `package.json.version` before build, runs the project's `build` script via the package manager auto-detected by lockfile, uploads `dist/` to CDN (skipping `manifest.json`, `.DS_Store`, `.map`), then calls the submit-audit API. The deploy upload pipeline rejects actual upload artifacts over 100MiB before any upload request, processes CDN upload metadata and callback confirmation at 50 files per batch, keeps 4-way upload concurrency within each batch, and validates CDN-returned keys exactly against the local expected upload keys.
|
|
56
56
|
8. Use `hb-sdk remote deploy --skip-build --release-note <text>` only when the `dist/` directory is already prepared by an upstream CI stage. In this mode the CLI reads `dist/manifest.json.version` before precheck. Missing `dist/manifest.json` or `dist/index.html` aborts the run.
|
|
57
57
|
9. Always provide a concise release note before deploy. Non-interactive environments must pass `--release-note`; interactive terminals may prompt for it. The default is manual release after approval with `hb-sdk remote release <version>`; use `--auto-publish` when the audited version should automatically release after approval.
|
|
58
58
|
10. Use `hb-sdk remote release <version>`, `hb-sdk remote withdraw <version>`, `hb-sdk remote take-down`, and `hb-sdk remote reopen` for dangerous remote changes. Interactive terminals should confirm after showing enough context; non-interactive environments must pass `--yes`.
|
|
@@ -51,7 +51,12 @@ export {
|
|
|
51
51
|
UI_HIDE_LOADING_METHOD,
|
|
52
52
|
UI_SHOW_LOADING_METHOD,
|
|
53
53
|
UI_SHOW_TOAST_METHOD,
|
|
54
|
+
USER_GET_CURRENT_USER_DETAIL_METHOD,
|
|
55
|
+
USER_GET_CURRENT_USER_PROFILE_METHOD,
|
|
54
56
|
USER_GET_INFO_METHOD,
|
|
57
|
+
USER_GET_PLATFORM_ACCOUNT_INFO_METHOD,
|
|
58
|
+
USER_GET_PLATFORM_ACCOUNT_OVERVIEW_METHOD,
|
|
59
|
+
USER_GET_STEAM_GAME_LIST_METHOD,
|
|
55
60
|
VIEWPORT_GET_WINDOW_INFO_METHOD,
|
|
56
61
|
VIEWPORT_SET_NAVIGATION_BAR_STYLE_METHOD,
|
|
57
62
|
} from './protocol/capabilities';
|
|
@@ -76,10 +81,25 @@ export type {
|
|
|
76
81
|
} from './protocol/capabilities';
|
|
77
82
|
export type { LoginPayload, LoginResult } from './modules/auth';
|
|
78
83
|
export type {
|
|
84
|
+
GetCurrentUserDetailPayload,
|
|
85
|
+
GetCurrentUserDetailResult,
|
|
86
|
+
GetCurrentUserProfilePayload,
|
|
87
|
+
GetCurrentUserProfileResult,
|
|
88
|
+
GetPlatformAccountInfoPayload,
|
|
89
|
+
GetPlatformAccountInfoResult,
|
|
90
|
+
GetPlatformAccountOverviewPayload,
|
|
91
|
+
GetPlatformAccountOverviewResult,
|
|
92
|
+
GetSteamGameListOptions,
|
|
93
|
+
GetSteamGameListPayload,
|
|
94
|
+
GetSteamGameListResult,
|
|
79
95
|
GetUserInfoPayload,
|
|
80
96
|
GetUserInfoResult,
|
|
81
97
|
MiniProgramUserInfo,
|
|
82
98
|
MiniProgramUserInfoResult,
|
|
99
|
+
SteamGameListData,
|
|
100
|
+
SteamGameListItem,
|
|
101
|
+
SteamGameListSort,
|
|
102
|
+
SteamGamePrice,
|
|
83
103
|
} from './modules/user';
|
|
84
104
|
export type { ScreenshotPayload, ScreenshotResult } from './modules/share/screenshot';
|
|
85
105
|
export type { ShowShareMenuPayload, ShowShareMenuResult } from './modules/share/show-share-menu';
|
|
@@ -168,5 +188,5 @@ Reference 由 `packages/hb-sdk` 的公开导出与源码注释自动生成,不
|
|
|
168
188
|
|
|
169
189
|
| 导出面 | Classes | Functions | Interfaces | Types | Constants |
|
|
170
190
|
| --- | ---: | ---: | ---: | ---: | ---: |
|
|
171
|
-
| Root API | 3 | 4 |
|
|
172
|
-
| Protocol API | 0 | 1 |
|
|
191
|
+
| Root API | 3 | 4 | 53 | 45 | 3 |
|
|
192
|
+
| Protocol API | 0 | 1 | 30 | 57 | 26 |
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
## Package metadata
|
|
20
20
|
|
|
21
21
|
- Package: `@heybox/hb-sdk`
|
|
22
|
-
- Version at generation time: `0.
|
|
22
|
+
- Version at generation time: `0.5.0`
|
|
23
23
|
- Public root export: `@heybox/hb-sdk`
|
|
24
24
|
- Protocol export: `@heybox/hb-sdk/protocol`
|
|
25
25
|
- Vite plugin export: `@heybox/hb-sdk/vite`
|
|
@@ -38,11 +38,47 @@ export type {
|
|
|
38
38
|
} from './protocol/types';
|
|
39
39
|
export type { LoginPayload, LoginResult, MiniProgramAuthModule } from './modules/auth';
|
|
40
40
|
export type {
|
|
41
|
+
BasePlatformAccountInfo,
|
|
42
|
+
CurrentUserAvatarConfig,
|
|
43
|
+
CurrentUserAvatarDecoration,
|
|
44
|
+
CurrentUserBbsInfo,
|
|
45
|
+
CurrentUserDetail,
|
|
46
|
+
CurrentUserLevelInfo,
|
|
47
|
+
CurrentUserMedal,
|
|
48
|
+
CurrentUserProfile,
|
|
49
|
+
EpicPlatformAccountInfo,
|
|
50
|
+
GetCurrentUserDetailPayload,
|
|
51
|
+
GetCurrentUserDetailResult,
|
|
52
|
+
GetCurrentUserProfilePayload,
|
|
53
|
+
GetCurrentUserProfileResult,
|
|
54
|
+
GetPlatformAccountInfoPayload,
|
|
55
|
+
GetPlatformAccountInfoResult,
|
|
56
|
+
GetPlatformAccountOverviewPayload,
|
|
57
|
+
GetPlatformAccountOverviewResult,
|
|
58
|
+
GetSteamGameListOptions,
|
|
59
|
+
GetSteamGameListPayload,
|
|
60
|
+
GetSteamGameListResult,
|
|
41
61
|
GetUserInfoPayload,
|
|
42
62
|
GetUserInfoResult,
|
|
43
63
|
MiniProgramUserInfo,
|
|
44
64
|
MiniProgramUserInfoResult,
|
|
45
65
|
MiniProgramUserModule,
|
|
66
|
+
MobilePlatformAccountInfo,
|
|
67
|
+
PcHardwareAccountInfo,
|
|
68
|
+
PlatformAccountInfoMap,
|
|
69
|
+
PlatformAccountOverview,
|
|
70
|
+
PlatformAccountResult,
|
|
71
|
+
PlatformAccountType,
|
|
72
|
+
PlatformStatItem,
|
|
73
|
+
PsnPlatformAccountInfo,
|
|
74
|
+
SteamGameListData,
|
|
75
|
+
SteamGameListItem,
|
|
76
|
+
SteamGameListSort,
|
|
77
|
+
SteamGamePrice,
|
|
78
|
+
SteamPlatformAccountInfo,
|
|
79
|
+
SwitchPlatformAccountInfo,
|
|
80
|
+
UserScopedResult,
|
|
81
|
+
XboxPlatformAccountInfo,
|
|
46
82
|
} from './modules/user';
|
|
47
83
|
export type {
|
|
48
84
|
MiniProgramScreenshotOptions,
|
|
@@ -333,6 +369,35 @@ if (!result.isLogin) {
|
|
|
333
369
|
|
|
334
370
|
SDK 只返回允许暴露给外部小程序的公开资料,不会返回 token、cookie、手机号或其他私有凭据。
|
|
335
371
|
|
|
372
|
+
需要当前用户更完整资料时,可以使用 current-user scoped API。这些 API 与 `user.getInfo()` 一样不会主动唤起登录;未登录时返回普通未登录结果,业务应只在用户操作后调用 `auth.login()`。
|
|
373
|
+
|
|
374
|
+
```ts
|
|
375
|
+
const detail = await user.getCurrentUserDetail();
|
|
376
|
+
|
|
377
|
+
if (detail.isLogin) {
|
|
378
|
+
console.log(detail.data.nickname, detail.data.level_info);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
const steam = await user.getPlatformAccountInfo('steam');
|
|
382
|
+
|
|
383
|
+
if (steam.isLogin && steam.is_bound) {
|
|
384
|
+
console.log(steam.account_info.steamid);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
const games = await user.getSteamGameList({
|
|
388
|
+
limit: 20,
|
|
389
|
+
sort: 'weeks',
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
if (games.isLogin && games.isBound) {
|
|
393
|
+
console.log(games.data.gameList);
|
|
394
|
+
}
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
`user.getCurrentUserDetail()` 返回当前用户展示资料,`user.getCurrentUserProfile()` 返回更敏感的个人资料字段。`user.getPlatformAccountOverview()` 返回 `steam`、`epic`、`xbox`、`psn`、`switch`、`pc_hardware`、`mobile` 的绑定/隐藏状态;`user.getPlatformAccountInfo(platform)` 只支持这些平台字面量,未绑定平台返回 `account_info: null`,不会抛出未绑定错误。`user.getSteamGameList(options)` 返回当前用户 Steam 游戏库,未登录或未绑定 Steam 时返回状态对象;分页 `limit` 默认 20、最大 100,`sort` 支持 `weeks`、`all`、`achieved`。
|
|
398
|
+
|
|
399
|
+
这些 API 仍然只面向当前登录用户,不支持传入 `userid` 查询其他人。平台账号详情和 Steam 游戏库会过滤好友列表、客户端路由协议和页面 UI 状态字段;敏感字段按独立 permission key 管理,后续可由宿主策略按能力或平台收紧。
|
|
400
|
+
|
|
336
401
|
### 分享
|
|
337
402
|
|
|
338
403
|
```ts
|
|
@@ -341,11 +406,14 @@ import { share } from '@heybox/hb-sdk';
|
|
|
341
406
|
await share.showShareMenu({
|
|
342
407
|
title: '我的小程序页面',
|
|
343
408
|
desc: '来自黑盒小程序的分享',
|
|
344
|
-
url: window.location.href,
|
|
345
409
|
imageUrl: 'https://imgheybox.max-c.com/demo.png',
|
|
346
410
|
});
|
|
347
411
|
```
|
|
348
412
|
|
|
413
|
+
用户小程序通常不要传 `url`;宿主 runtime 会按当前小程序生成
|
|
414
|
+
`/tools/common_share?user_miniprogram_id=...` 分享落地页。只有确实要分享外部
|
|
415
|
+
HTTP(S) 页面时才显式传 `url`。
|
|
416
|
+
|
|
349
417
|
截图分享:
|
|
350
418
|
|
|
351
419
|
```ts
|
package/skill/references/cli.md
CHANGED
|
@@ -147,8 +147,10 @@ HB_SDK_ALLOW_UNSAFE_API_BASE_URL=1 hb-sdk remote deploy --api-base-url http://12
|
|
|
147
147
|
7. 解析 `dist/manifest.json`,自动剥离 BOM,并校验 `version` 是合法 SemVer:允许 prerelease,例如 `1.2.3-rc.1`;拒绝 build metadata,例如 `1.2.3+build.1`;拒绝 `0.0.0`。
|
|
148
148
|
8. 普通 remote deploy 的 `dist/manifest.json.version` 必须与预检使用的 `package.json.version` 一致,否则失败且不上传。
|
|
149
149
|
9. 遍历 `dist/` 文件,过滤掉 `manifest.json`、`.DS_Store`、`*.map`;遇到 symbolic link 或 `node_modules` 路径直接报错。
|
|
150
|
-
10.
|
|
151
|
-
11.
|
|
150
|
+
10. 校验上传路径长度不超过 64,并在任何上传请求发生前限制实际上传产物总大小不超过 100MiB。错误提示中使用 `100MB`,方便开发者理解。
|
|
151
|
+
11. 上传信息、上传凭证和上传回调按批次执行,每批最多 50 个文件;批次串行,批内保持 4 并发上传到 CDN。CLI 会校验 CDN 上传信息接口返回的 key 与本地期望 key 完全一致,异常时停止后续批次且不提交审核。
|
|
152
|
+
12. 默认只展示上传阶段和文件总数,例如 `正在上传 137/244 个文件`;`--verbose` 会展示并发数、批次数、当前批次、bucket / region 和逐文件结果,但不会输出 keys、签名、cookie、pkey、token 或临时密钥。
|
|
153
|
+
13. 全部上传成功后调用提交审核接口,CLI 输出提交审核成功、发布策略和可用的 preview URL。
|
|
152
154
|
|
|
153
155
|
`mini_program_id` 没有 CLI flag,必须落在 `package.json` 里:
|
|
154
156
|
|
|
@@ -367,7 +369,6 @@ import hbSDK from '@heybox/hb-sdk';
|
|
|
367
369
|
await hbSDK.share.showShareMenu({
|
|
368
370
|
title: '<%= projectName %>',
|
|
369
371
|
desc: '分享描述',
|
|
370
|
-
url: window.location.href,
|
|
371
372
|
});
|
|
372
373
|
|
|
373
374
|
await hbSDK.storage.setStorage({
|
|
@@ -380,4 +381,6 @@ const response = await hbSDK.network.request({
|
|
|
380
381
|
url: 'https://jsonplaceholder.typicode.com/todos/1',
|
|
381
382
|
});
|
|
382
383
|
```
|
|
384
|
+
|
|
385
|
+
用户小程序通常不要传 `url`;宿主 runtime 会自动生成当前小程序的通用分享页。只有确实要分享外部 HTTP(S) 页面时才显式传 `url`。
|
|
383
386
|
````
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
## 能力边界
|
|
12
12
|
|
|
13
13
|
- 调用模块能力前会自动等待 `ready()`,但业务仍建议在页面启动阶段显式 `await ready()`,便于集中处理握手失败。
|
|
14
|
-
- `user.getInfo()` 不会触发登录;登录必须由业务在用户操作后调用 `auth.login()`。
|
|
14
|
+
- `user.getInfo()`、`user.getCurrentUserDetail()`、`user.getCurrentUserProfile()`、`user.getPlatformAccountOverview()`、`user.getPlatformAccountInfo(platform)` 和 `user.getSteamGameList(options)` 不会触发登录;登录必须由业务在用户操作后调用 `auth.login()`。
|
|
15
|
+
- 当前用户详情和平台账号 API 只允许读取当前登录用户,不支持传入 `userid` 查询其他人,也不透传 `/account/home_v2/` 原始响应。
|
|
15
16
|
- 分享、截图、UI、设备、导航、storage 和网络请求只开放稳定窄接口,不透传黑盒客户端内部协议参数。
|
|
16
17
|
- `network.request()` 的 `validateStatus` 只在 SDK 本地执行,不会被序列化给父容器。
|
|
17
18
|
- `on()` 返回取消监听函数;组件卸载或页面销毁时应主动取消监听。
|
package/skill/skill.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hb-sdk",
|
|
3
|
-
"skillVersion": "0.
|
|
3
|
+
"skillVersion": "0.5.0+skill.a70b82c55c5b",
|
|
4
4
|
"sdk": {
|
|
5
5
|
"package": "@heybox/hb-sdk",
|
|
6
|
-
"version": "0.
|
|
7
|
-
"compatibility": "0.
|
|
6
|
+
"version": "0.5.0",
|
|
7
|
+
"compatibility": "0.5.0"
|
|
8
8
|
},
|
|
9
9
|
"source": "https://open.xiaoheihe.cn/agent-skills/hb-sdk",
|
|
10
|
-
"integrity": "sha256-
|
|
10
|
+
"integrity": "sha256-a70b82c55c5bab095c92d138f75cec352f9dce0d2cd1cd3fb897a196fa63f09d"
|
|
11
11
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export type { MiniProgramSDKOptions } from './core/client';
|
|
|
4
4
|
export { ready, on, off, auth, user, share, viewport, storage, network, ui, device, navigation } from './core/singleton';
|
|
5
5
|
export type { MiniProgramEventHandler, MiniProgramEventName, MiniProgramEventPayloadMap, } from './protocol/types';
|
|
6
6
|
export type { LoginPayload, LoginResult, MiniProgramAuthModule } from './modules/auth';
|
|
7
|
-
export type { GetUserInfoPayload, GetUserInfoResult, MiniProgramUserInfo, MiniProgramUserInfoResult, MiniProgramUserModule, } from './modules/user';
|
|
7
|
+
export type { BasePlatformAccountInfo, CurrentUserAvatarConfig, CurrentUserAvatarDecoration, CurrentUserBbsInfo, CurrentUserDetail, CurrentUserLevelInfo, CurrentUserMedal, CurrentUserProfile, EpicPlatformAccountInfo, GetCurrentUserDetailPayload, GetCurrentUserDetailResult, GetCurrentUserProfilePayload, GetCurrentUserProfileResult, GetPlatformAccountInfoPayload, GetPlatformAccountInfoResult, GetPlatformAccountOverviewPayload, GetPlatformAccountOverviewResult, GetSteamGameListOptions, GetSteamGameListPayload, GetSteamGameListResult, GetUserInfoPayload, GetUserInfoResult, MiniProgramUserInfo, MiniProgramUserInfoResult, MiniProgramUserModule, MobilePlatformAccountInfo, PcHardwareAccountInfo, PlatformAccountInfoMap, PlatformAccountOverview, PlatformAccountResult, PlatformAccountType, PlatformStatItem, PsnPlatformAccountInfo, SteamGameListData, SteamGameListItem, SteamGameListSort, SteamGamePrice, SteamPlatformAccountInfo, SwitchPlatformAccountInfo, UserScopedResult, XboxPlatformAccountInfo, } from './modules/user';
|
|
8
8
|
export type { MiniProgramScreenshotOptions, MiniProgramScreenshotRect, MiniProgramShareChannel, MiniProgramShareModule, MiniProgramShowShareMenuOptions, ScreenshotPayload, ScreenshotResult, ShowShareMenuPayload, ShowShareMenuResult, } from './modules/share';
|
|
9
9
|
export type { GetWindowInfoPayload, GetWindowInfoResult, MiniProgramNavigationBarForegroundStyle, MiniProgramSafeArea, MiniProgramSetNavigationBarStyleOptions, MiniProgramViewportModule, MiniProgramWindowInfoResult, SetNavigationBarStylePayload, SetNavigationBarStyleResult, } from './modules/viewport';
|
|
10
10
|
export type { GetStoragePayload, GetStorageResult, MiniProgramStorageModule, SetStoragePayload, } from './modules/storage';
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export declare const MINIAPP_UPLOAD_SCOPE = "activity";
|
|
2
2
|
export declare const ACTIVITY_UPLOAD_KEY_MAX_LENGTH = 64;
|
|
3
|
+
export declare const MINIAPP_UPLOAD_BATCH_SIZE = 50;
|
|
4
|
+
export declare const MINIAPP_UPLOAD_TOTAL_SIZE_LIMIT_BYTES: number;
|
|
3
5
|
export declare const USER_MINIPROGRAM_ACCESS_STATUS_API_PATH = "/mall/developer/user_miniprogram/access_status";
|
|
4
6
|
export declare const DEVELOPER_ENTITY_LIST_API_PATH = "/mall/developer/entity/list";
|
|
5
7
|
export declare const DEVELOPER_ENTITY_SWITCH_API_PATH = "/mall/developer/entity/switch";
|
|
@@ -36,4 +38,12 @@ export interface ValidateUploadPathsOptions {
|
|
|
36
38
|
maxLength?: number;
|
|
37
39
|
}
|
|
38
40
|
export declare function validateUploadPaths(items: UploadPathItem[], options: ValidateUploadPathsOptions): string | undefined;
|
|
41
|
+
export interface UploadSizeItem {
|
|
42
|
+
relativePath: string;
|
|
43
|
+
size: number;
|
|
44
|
+
}
|
|
45
|
+
export interface ValidateUploadTotalSizeOptions {
|
|
46
|
+
limitBytes?: number;
|
|
47
|
+
}
|
|
48
|
+
export declare function validateUploadTotalSize(items: UploadSizeItem[], options?: ValidateUploadTotalSizeOptions): "构建产物总大小超过 100MB,请删除未引用资源或压缩图片后重新 deploy" | undefined;
|
|
39
49
|
export declare function shouldUploadDistFile(relativePath: string): boolean;
|