@heybox/hb-sdk 0.4.7 → 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 +31 -1
- package/dist/cli-chunks/{create-IOxksfE3.cjs → create-BiCyOEAv.cjs} +1 -1
- package/dist/cli-chunks/{dev-zMT1BxGs.cjs → dev-D4XRqzz1.cjs} +1 -1
- package/dist/cli-chunks/{doctor-ZOfNccof.cjs → doctor-CmHZYQ2I.cjs} +1 -1
- package/dist/cli-chunks/{index-2nlBRew_.cjs → index-DXS0s9d7.cjs} +2 -2
- package/dist/cli-chunks/{index-13_8m0Pw.cjs → index-kv8oOmFw.cjs} +13 -13
- package/dist/cli-chunks/{login-CoBqr1Bm.cjs → login-F9AEL3cF.cjs} +2 -2
- package/dist/cli-chunks/{remote-Cc5j-m2I.cjs → remote-BRktlraB.cjs} +3 -3
- package/dist/cli-chunks/{session-BSi5YfqO.cjs → session-DItg0094.cjs} +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/devtools/mock-host/main.js +957 -4
- package/dist/index.cjs.js +51 -0
- package/dist/index.esm.js +51 -0
- package/dist/protocol.cjs.js +50 -0
- package/dist/protocol.esm.js +46 -1
- package/package.json +1 -1
- package/skill/references/api-protocol.md +22 -2
- package/skill/references/api-root.md +66 -1
- package/skill/references/safety-boundaries.md +2 -1
- package/skill/skill.json +4 -4
- package/types/index.d.ts +1 -1
- 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/README.md
CHANGED
|
@@ -88,6 +88,35 @@ if (!result.isLogin) {
|
|
|
88
88
|
|
|
89
89
|
SDK 只返回允许暴露给外部小程序的公开资料,不会返回 token、cookie、手机号或其他私有凭据。
|
|
90
90
|
|
|
91
|
+
需要当前用户更完整资料时,可以使用 current-user scoped API。这些 API 与 `user.getInfo()` 一样不会主动唤起登录;未登录时返回普通未登录结果,业务应只在用户操作后调用 `auth.login()`。
|
|
92
|
+
|
|
93
|
+
```ts
|
|
94
|
+
const detail = await user.getCurrentUserDetail();
|
|
95
|
+
|
|
96
|
+
if (detail.isLogin) {
|
|
97
|
+
console.log(detail.data.nickname, detail.data.level_info);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const steam = await user.getPlatformAccountInfo('steam');
|
|
101
|
+
|
|
102
|
+
if (steam.isLogin && steam.is_bound) {
|
|
103
|
+
console.log(steam.account_info.steamid);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const games = await user.getSteamGameList({
|
|
107
|
+
limit: 20,
|
|
108
|
+
sort: 'weeks',
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
if (games.isLogin && games.isBound) {
|
|
112
|
+
console.log(games.data.gameList);
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
`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`。
|
|
117
|
+
|
|
118
|
+
这些 API 仍然只面向当前登录用户,不支持传入 `userid` 查询其他人。平台账号详情和 Steam 游戏库会过滤好友列表、客户端路由协议和页面 UI 状态字段;敏感字段按独立 permission key 管理,后续可由宿主策略按能力或平台收紧。
|
|
119
|
+
|
|
91
120
|
### 分享
|
|
92
121
|
|
|
93
122
|
```ts
|
|
@@ -406,7 +435,8 @@ CLI 登录态只供 CLI 命令访问黑盒接口时复用,不会注入 iframe
|
|
|
406
435
|
## 能力边界
|
|
407
436
|
|
|
408
437
|
- 调用模块能力前会自动等待 `ready()`,但业务仍建议在页面启动阶段显式 `await ready()`,便于集中处理握手失败。
|
|
409
|
-
- `user.getInfo()` 不会触发登录;登录必须由业务在用户操作后调用 `auth.login()`。
|
|
438
|
+
- `user.getInfo()`、`user.getCurrentUserDetail()`、`user.getCurrentUserProfile()`、`user.getPlatformAccountOverview()`、`user.getPlatformAccountInfo(platform)` 和 `user.getSteamGameList(options)` 不会触发登录;登录必须由业务在用户操作后调用 `auth.login()`。
|
|
439
|
+
- 当前用户详情和平台账号 API 只允许读取当前登录用户,不支持传入 `userid` 查询其他人,也不透传 `/account/home_v2/` 原始响应。
|
|
410
440
|
- 分享、截图、UI、设备、导航、storage 和网络请求只开放稳定窄接口,不透传黑盒客户端内部协议参数。
|
|
411
441
|
- `network.request()` 的 `validateStatus` 只在 SDK 本地执行,不会被序列化给父容器。
|
|
412
442
|
- `on()` 返回取消监听函数;组件卸载或页面销毁时应主动取消监听。
|
|
@@ -5,7 +5,7 @@ var fs = require('node:fs/promises');
|
|
|
5
5
|
var path = require('node:path');
|
|
6
6
|
var require$$0 = require('fs');
|
|
7
7
|
var require$$1 = require('path');
|
|
8
|
-
var index = require('./index-
|
|
8
|
+
var index = require('./index-kv8oOmFw.cjs');
|
|
9
9
|
require('node:module');
|
|
10
10
|
require('os');
|
|
11
11
|
require('readline');
|
|
@@ -9,7 +9,7 @@ var node_url = require('node:url');
|
|
|
9
9
|
var net = require('node:net');
|
|
10
10
|
var node_http = require('node:http');
|
|
11
11
|
var browser = require('./browser-RAy8e8cV.cjs');
|
|
12
|
-
var index = require('./index-
|
|
12
|
+
var index = require('./index-kv8oOmFw.cjs');
|
|
13
13
|
require('node:process');
|
|
14
14
|
require('node:buffer');
|
|
15
15
|
require('node:util');
|
|
@@ -4,7 +4,7 @@ var fs$1 = require('node:fs');
|
|
|
4
4
|
var fs = require('node:fs/promises');
|
|
5
5
|
var os = require('node:os');
|
|
6
6
|
var path = require('node:path');
|
|
7
|
-
var index = require('./index-
|
|
7
|
+
var index = require('./index-kv8oOmFw.cjs');
|
|
8
8
|
require('node:module');
|
|
9
9
|
require('path');
|
|
10
10
|
require('os');
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index$2 = require('./index-
|
|
3
|
+
var index$2 = require('./index-kv8oOmFw.cjs');
|
|
4
4
|
var require$$0$2 = require('fs');
|
|
5
5
|
var require$$2$1 = require('crypto');
|
|
6
6
|
var require$$1$2 = require('path');
|
|
7
7
|
var require$$0$3 = require('assert');
|
|
8
8
|
var require$$4$2 = require('events');
|
|
9
9
|
var require$$1$1 = require('util');
|
|
10
|
-
var remote = require('./remote-
|
|
10
|
+
var remote = require('./remote-BRktlraB.cjs');
|
|
11
11
|
var require$$0$5 = require('net');
|
|
12
12
|
var require$$0$4 = require('url');
|
|
13
13
|
var require$$2$2 = require('http');
|
|
@@ -234,19 +234,19 @@ function requireArgument () {
|
|
|
234
234
|
|
|
235
235
|
var command = {};
|
|
236
236
|
|
|
237
|
-
const require$5 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-
|
|
237
|
+
const require$5 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-kv8oOmFw.cjs', document.baseURI).href)));
|
|
238
238
|
function __require$4() { return require$5("node:events"); }
|
|
239
239
|
|
|
240
|
-
const require$4 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-
|
|
240
|
+
const require$4 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-kv8oOmFw.cjs', document.baseURI).href)));
|
|
241
241
|
function __require$3() { return require$4("node:child_process"); }
|
|
242
242
|
|
|
243
|
-
const require$3 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-
|
|
243
|
+
const require$3 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-kv8oOmFw.cjs', document.baseURI).href)));
|
|
244
244
|
function __require$2() { return require$3("node:path"); }
|
|
245
245
|
|
|
246
|
-
const require$2 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-
|
|
246
|
+
const require$2 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-kv8oOmFw.cjs', document.baseURI).href)));
|
|
247
247
|
function __require$1() { return require$2("node:fs"); }
|
|
248
248
|
|
|
249
|
-
const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-
|
|
249
|
+
const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-kv8oOmFw.cjs', document.baseURI).href)));
|
|
250
250
|
function __require() { return require$1("node:process"); }
|
|
251
251
|
|
|
252
252
|
var help = {};
|
|
@@ -13094,7 +13094,7 @@ function readErrorMessage(error, options = {}) {
|
|
|
13094
13094
|
}
|
|
13095
13095
|
|
|
13096
13096
|
const CLI_VERSION_PLACEHOLDER = ['__HB', 'SDK', 'CLI', 'VERSION__'].join('_');
|
|
13097
|
-
const BUILT_CLI_VERSION = '0.
|
|
13097
|
+
const BUILT_CLI_VERSION = '0.5.0';
|
|
13098
13098
|
const PACKAGE_JSON_CANDIDATES = [
|
|
13099
13099
|
path.resolve(__dirname, '..', '..', 'package.json'),
|
|
13100
13100
|
path.resolve(__dirname, '..', 'package.json'),
|
|
@@ -13377,31 +13377,31 @@ function createCommandLoggerResolver(options) {
|
|
|
13377
13377
|
};
|
|
13378
13378
|
}
|
|
13379
13379
|
const defaultClearLoginStatus = async (...args) => {
|
|
13380
|
-
const { clearLoginStatus } = await Promise.resolve().then(function () { return require('./login-
|
|
13380
|
+
const { clearLoginStatus } = await Promise.resolve().then(function () { return require('./login-F9AEL3cF.cjs'); });
|
|
13381
13381
|
return clearLoginStatus(...args);
|
|
13382
13382
|
};
|
|
13383
13383
|
const defaultLoginToHeybox = async (...args) => {
|
|
13384
|
-
const { loginToHeybox } = await Promise.resolve().then(function () { return require('./login-
|
|
13384
|
+
const { loginToHeybox } = await Promise.resolve().then(function () { return require('./login-F9AEL3cF.cjs'); });
|
|
13385
13385
|
return loginToHeybox(...args);
|
|
13386
13386
|
};
|
|
13387
13387
|
const defaultPrintLoginStatus = async (...args) => {
|
|
13388
|
-
const { printLoginStatus } = await Promise.resolve().then(function () { return require('./login-
|
|
13388
|
+
const { printLoginStatus } = await Promise.resolve().then(function () { return require('./login-F9AEL3cF.cjs'); });
|
|
13389
13389
|
return printLoginStatus(...args);
|
|
13390
13390
|
};
|
|
13391
13391
|
const defaultRunCreateCommand = async (...args) => {
|
|
13392
|
-
const { runCreateCommand } = await Promise.resolve().then(function () { return require('./create-
|
|
13392
|
+
const { runCreateCommand } = await Promise.resolve().then(function () { return require('./create-BiCyOEAv.cjs'); });
|
|
13393
13393
|
return runCreateCommand(...args);
|
|
13394
13394
|
};
|
|
13395
13395
|
const defaultRunDevCommand = async (...args) => {
|
|
13396
|
-
const { runDevCommand } = await Promise.resolve().then(function () { return require('./dev-
|
|
13396
|
+
const { runDevCommand } = await Promise.resolve().then(function () { return require('./dev-D4XRqzz1.cjs'); });
|
|
13397
13397
|
return runDevCommand(...args);
|
|
13398
13398
|
};
|
|
13399
13399
|
const defaultRunDoctorCommand = async (...args) => {
|
|
13400
|
-
const { runDoctorCommand } = await Promise.resolve().then(function () { return require('./doctor-
|
|
13400
|
+
const { runDoctorCommand } = await Promise.resolve().then(function () { return require('./doctor-CmHZYQ2I.cjs'); });
|
|
13401
13401
|
return runDoctorCommand(...args);
|
|
13402
13402
|
};
|
|
13403
13403
|
const defaultRunRemoteCommand = async (...args) => {
|
|
13404
|
-
const { runRemoteCommand } = await Promise.resolve().then(function () { return require('./remote-
|
|
13404
|
+
const { runRemoteCommand } = await Promise.resolve().then(function () { return require('./remote-BRktlraB.cjs'); }).then(function (n) { return n.remote; });
|
|
13405
13405
|
return runRemoteCommand(...args);
|
|
13406
13406
|
};
|
|
13407
13407
|
function resolveStandaloneLogger(options, verbose) {
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
var promises = require('node:readline/promises');
|
|
4
4
|
var node_crypto = require('node:crypto');
|
|
5
5
|
var node_http = require('node:http');
|
|
6
|
-
var session = require('./session-
|
|
6
|
+
var session = require('./session-DItg0094.cjs');
|
|
7
7
|
var browser = require('./browser-RAy8e8cV.cjs');
|
|
8
|
-
var index = require('./index-
|
|
8
|
+
var index = require('./index-kv8oOmFw.cjs');
|
|
9
9
|
require('node:path');
|
|
10
10
|
require('fs');
|
|
11
11
|
require('constants');
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var promises = require('node:readline/promises');
|
|
4
|
-
var session = require('./session-
|
|
4
|
+
var session = require('./session-DItg0094.cjs');
|
|
5
5
|
var childProcess = require('node:child_process');
|
|
6
6
|
var fs = require('node:fs');
|
|
7
7
|
var fs$1 = require('node:fs/promises');
|
|
8
8
|
var path = require('node:path');
|
|
9
|
-
var index = require('./index-
|
|
9
|
+
var index = require('./index-kv8oOmFw.cjs');
|
|
10
10
|
|
|
11
11
|
var re = {exports: {}};
|
|
12
12
|
|
|
@@ -3113,7 +3113,7 @@ async function createDefaultCosClient(uploadToken) {
|
|
|
3113
3113
|
};
|
|
3114
3114
|
}
|
|
3115
3115
|
async function loadCosConstructor() {
|
|
3116
|
-
const cosModule = await Promise.resolve().then(function () { return require('./index-
|
|
3116
|
+
const cosModule = await Promise.resolve().then(function () { return require('./index-DXS0s9d7.cjs'); }).then(function (n) { return n.index; });
|
|
3117
3117
|
return cosModule.default;
|
|
3118
3118
|
}
|
|
3119
3119
|
function formatSize(bytes) {
|