@heybox/hb-sdk 0.5.10 → 0.5.11

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 CHANGED
@@ -250,6 +250,49 @@ const { data } = await storage.getStorage<{ theme: string }>({
250
250
 
251
251
  storage key 只允许 1-128 位字母、数字、下划线和连字符。父容器会按小程序维度隔离 key,外部小程序不能读写黑盒客户端全局 storage。
252
252
 
253
+ ### 云端排行榜
254
+
255
+ `cloud.leaderboard` 是平台托管的远端排行榜能力,不是本地 storage,也不是通用网络请求。小程序页面不能传 `userId`;宿主和服务端会按当前登录用户注入身份。
256
+
257
+ ```ts
258
+ import { cloud } from '@heybox/hb-sdk';
259
+
260
+ const entry = await cloud.leaderboard.submit({
261
+ key: 'cube_run_total',
262
+ score: 150,
263
+ extra: {
264
+ run: 2,
265
+ },
266
+ });
267
+
268
+ const list = await cloud.leaderboard.getList({
269
+ key: 'cube_run_total',
270
+ limit: 20,
271
+ });
272
+
273
+ const current = await cloud.leaderboard.getCurrentUserEntry({
274
+ key: 'cube_run_total',
275
+ });
276
+
277
+ await cloud.leaderboard.deleteCurrentUserEntry({
278
+ key: 'cube_run_total',
279
+ });
280
+
281
+ const info = await cloud.leaderboard.getInfo({
282
+ key: 'cube_run_total',
283
+ });
284
+ ```
285
+
286
+ 排行榜需要先通过管理端创建;管理端创建成功时服务端会同步准备记录集合,之后运行时可立即读写。`key` 不传时服务端会查找当前小程序已创建的 `default` 榜单,不存在时会拒绝请求,不会自动创建空榜。单个小程序最多创建 3 个排行榜,超出时服务端返回 `LEADERBOARD_LIMIT_EXCEEDED`。
287
+
288
+ `order` 在创建榜单时固定,`desc` 表示分数越大越靠前,`asc` 表示分数越小越靠前。同分时按更早更新时间优先,再按 `userId` 稳定排序。`rankLimit` 为 `0` 表示列表不限制展示名次;大于 `0` 时限制 `getList()` 展示范围。当前用户记录仍会保留,但 `submit()` 和 `getCurrentUserEntry()` 只精确计算前 5000 名,且会优先受 `rankLimit` 限制;超过 `min(rankLimit, 5000)`(`rankLimit=0` 时按 5000)时返回 `ranked: false`、`rank: 0`。
289
+
290
+ `submit()` 只在本次 `score` 更优时更新当前用户记录,并返回最终 `LeaderboardEntry`;如果分数不更优,`extra` 也不会更新。同一用户同一榜单的并发提交由服务端串行保护,锁冲突时返回 `LEADERBOARD_SUBMIT_LOCKED`,业务可稍后重试。首次提交未传 `extra` 会保存为空对象;已有记录提交更优分数但未传 `extra` 时会保留旧 `extra`,需要清空时请显式传 `{}`。`score` 必须是有限安全数字,绝对值不能超过 `Number.MAX_SAFE_INTEGER`;`extra` 必须是 JSON 对象,序列化后的 UTF-8 长度不能超过 2048 字节。
291
+
292
+ `getList()` 默认 20 条、最多 100 条;`cursor` 是服务端返回的不透明分页游标,只能把上一页返回的值原样传给下一次 `getList()`,不要解析、拼接或自行构造。非法 cursor 会按参数错误拒绝。服务端会短暂缓存榜单头部结果,当前缓存前 500 条或 `rankLimit` 范围内记录,`submit()`、`deleteCurrentUserEntry()` 和管理端删榜会触发缓存失效;业务不要依赖毫秒级实时刷新。`getInfo()` 返回 `key/order/rankLimit`,其中 `rankLimit` 不包含当前用户记录的 5000 名精确排名计算上限。
293
+
294
+ 排行榜后端错误会保留为 `HbMiniProgramSDKError.code`,常见值包括 `LEADERBOARD_DEFAULT_NOT_FOUND`、`LEADERBOARD_LIMIT_EXCEEDED`、`LEADERBOARD_SUBMIT_LOCKED`、`LEADERBOARD_TABLE_NOT_READY`、`InvalidArgument`、`NotFound`、`ResourceExhausted`、`Unauthenticated`。业务可以按 `code` 区分未建榜、并发提交、数据表配置异常、参数错误、容量限制和未登录等场景。
295
+
253
296
  ### 网络请求
254
297
 
255
298
  `network.request()` 提供窄化的 axios-like 接口。SDK 只接受公开请求字段,真实请求由父容器运行时映射到宿主网络能力。
@@ -328,32 +371,32 @@ try {
328
371
 
329
372
  `@heybox/hb-sdk` 随包提供 `hb-sdk` CLI。脚手架项目已在 npm scripts 中接好常用命令;已有项目也可以自行添加 scripts。
330
373
 
331
- | 命令 | 作用 |
332
- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
333
- | `hb-sdk create <project-name>` | 创建外部小程序模板。 |
334
- | `hb-sdk dev [--runtime-url <url>]` | 启动当前项目的 Vite dev server 和浏览器 mock 宿主环境,并默认打开调试页;`--runtime-url` 会传给真实客户端 dev shell。 |
335
- | `hb-sdk login [--login-base-url <url>] [--no-select-entity]` | 登录 Heybox,并把 CLI 自己需要的登录态和登录入口环境保存在本地缓存中;默认会引导多主体用户选择服务端 current entity。 |
336
- | `hb-sdk login status` | 查看脱敏后的 CLI 登录态。 |
337
- | `hb-sdk login clear` | 清理 CLI 登录态。 |
338
- | `hb-sdk doctor` | 检查本机 `hb-sdk` Agent Skill 是否匹配当前 SDK,并输出手动安装/刷新命令。 |
339
- | `hb-sdk remote access` | 查看当前 CLI 用户是否具备创建和管理工坊小程序的资格。 |
340
- | `hb-sdk remote entity list` | 列出当前 CLI 用户可切换的开发者主体,并标记服务端 current entity。 |
341
- | `hb-sdk remote entity current` | 查看服务端 current entity,以及该主体的小程序工坊权限状态。 |
342
- | `hb-sdk remote entity switch <entity-id>` | 切换开发者平台服务端 current entity;不会修改项目绑定的小程序 ID。 |
343
- | `hb-sdk remote list [--status <status>] [--keyword <text>]` | 列出当前 CLI 用户可管理的远端工坊小程序,用于发现并绑定当前项目。 |
344
- | `hb-sdk remote create [--yes] [--force-bind]` | 在服务端 current entity 下创建远端工坊小程序并写入当前项目的 `package.json.heybox.miniProgramId`。 |
345
- | `hb-sdk remote bind <mini-program-id> [--force]` | 校验当前 CLI 用户可管理目标小程序后,再把它绑定到当前项目。 |
346
- | `hb-sdk remote info` | 查看当前项目绑定的小程序详情。 |
347
- | `hb-sdk remote allowlist list/add/remove/set ...` | 管理绑定小程序的预览白名单。 |
374
+ | 命令 | 作用 |
375
+ | -------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
376
+ | `hb-sdk create <project-name>` | 创建外部小程序模板。 |
377
+ | `hb-sdk dev [--runtime-url <url>]` | 启动当前项目的 Vite dev server 和浏览器 mock 宿主环境,并默认打开调试页;`--runtime-url` 会传给真实客户端 dev shell。 |
378
+ | `hb-sdk login [--login-base-url <url>] [--no-select-entity]` | 登录 Heybox,并把 CLI 自己需要的登录态和登录入口环境保存在本地缓存中;默认会引导多主体用户选择服务端 current entity。 |
379
+ | `hb-sdk login status` | 查看脱敏后的 CLI 登录态。 |
380
+ | `hb-sdk login clear` | 清理 CLI 登录态。 |
381
+ | `hb-sdk doctor` | 检查本机 `hb-sdk` Agent Skill 是否匹配当前 SDK,并输出手动安装/刷新命令。 |
382
+ | `hb-sdk remote access` | 查看当前 CLI 用户是否具备创建和管理工坊小程序的资格。 |
383
+ | `hb-sdk remote entity list` | 列出当前 CLI 用户可切换的开发者主体,并标记服务端 current entity。 |
384
+ | `hb-sdk remote entity current` | 查看服务端 current entity,以及该主体的小程序工坊权限状态。 |
385
+ | `hb-sdk remote entity switch <entity-id>` | 切换开发者平台服务端 current entity;不会修改项目绑定的小程序 ID。 |
386
+ | `hb-sdk remote list [--status <status>] [--keyword <text>]` | 列出当前 CLI 用户可管理的远端工坊小程序,用于发现并绑定当前项目。 |
387
+ | `hb-sdk remote create [--yes] [--force-bind]` | 在服务端 current entity 下创建远端工坊小程序并写入当前项目的 `package.json.heybox.miniProgramId`。 |
388
+ | `hb-sdk remote bind <mini-program-id> [--force]` | 校验当前 CLI 用户可管理目标小程序后,再把它绑定到当前项目。 |
389
+ | `hb-sdk remote info` | 查看当前项目绑定的小程序详情。 |
390
+ | `hb-sdk remote allowlist list/add/remove/set ...` | 管理绑定小程序的预览白名单。 |
348
391
  | `hb-sdk remote deploy --release-note <text> [--skip-build \| --from-version <version>] [--auto-publish]` | 构建、上传并提交当前小程序版本审核;`--skip-build` 跳过 build 直接上传 `dist/`,`--from-version` 复用指定历史版本产物。 |
349
- | `hb-sdk remote versions` | 列出绑定小程序的远端版本。 |
350
- | `hb-sdk remote preview <version>` | 查看指定版本的远端预览入口。 |
351
- | `hb-sdk remote release <version> [--yes]` | 发布审核通过的版本;非 TTY 环境必须传 `--yes`。 |
352
- | `hb-sdk remote withdraw <version> [--yes] [--reason <text>]` | 撤回审核中或已通过但未发布的版本;非 TTY 环境必须传 `--yes`。 |
353
- | `hb-sdk remote take-down [--yes]` | 下架当前线上小程序;非 TTY 环境必须传 `--yes`。 |
354
- | `hb-sdk remote reopen [--yes]` | 重新上架已下架的小程序;非 TTY 环境必须传 `--yes`。 |
355
- | `hb-sdk remote square hide [--yes]` | 隐藏当前绑定小程序在普通用户侧的小程序工坊广场展示;白名单用户仍可见,直接链接不受影响;非 TTY 环境必须传 `--yes`。 |
356
- | `hb-sdk remote square show` | 恢复当前绑定小程序在普通用户侧的小程序工坊广场展示。 |
392
+ | `hb-sdk remote versions` | 列出绑定小程序的远端版本。 |
393
+ | `hb-sdk remote preview <version>` | 查看指定版本的远端预览入口。 |
394
+ | `hb-sdk remote release <version> [--yes]` | 发布审核通过的版本;非 TTY 环境必须传 `--yes`。 |
395
+ | `hb-sdk remote withdraw <version> [--yes] [--reason <text>]` | 撤回审核中或已通过但未发布的版本;非 TTY 环境必须传 `--yes`。 |
396
+ | `hb-sdk remote take-down [--yes]` | 下架当前线上小程序;非 TTY 环境必须传 `--yes`。 |
397
+ | `hb-sdk remote reopen [--yes]` | 重新上架已下架的小程序;非 TTY 环境必须传 `--yes`。 |
398
+ | `hb-sdk remote square hide [--yes]` | 隐藏当前绑定小程序在普通用户侧的小程序工坊广场展示;白名单用户仍可见,直接链接不受影响;非 TTY 环境必须传 `--yes`。 |
399
+ | `hb-sdk remote square show` | 恢复当前绑定小程序在普通用户侧的小程序工坊广场展示。 |
357
400
 
358
401
  远端平台操作统一放在 `hb-sdk remote` 命令组下;顶层 `hb-sdk deploy` 已硬切删除,不再作为兼容别名保留。`hb-sdk login` 仍是顶层命令,因为它管理 CLI 登录态,不绑定到某个具体小程序。开发者主体的事实源是服务端 current entity;CLI 登录缓存中的 `selectedEntity` 只是上次选择时的提示快照,用于 `login status` 展示和漂移排障,不能作为权限或归属判断依据。
359
402
 
@@ -378,8 +421,8 @@ try {
378
421
  4. 如果需要以公司的名义发布小程序,需先找 @秦浩东 申请小程序开发权限。
379
422
  5. 每次部署都要在 `package.json` 里配置 `heybox.miniProgramProfile.name`、`iconUrl` 和至少一张 `coverImageUrls`,这些资料会随版本提交审核。
380
423
  6. 每次部署都要准备发布日志:`hb-sdk remote deploy --release-note "..."`。发布日志 trim 后不能为空,最多 500 个字符,允许换行;CI / 非 TTY 环境缺失时会直接失败,TTY 环境会提示输入。
381
- 6. 项目根有 `scripts.build`,会被 CLI 通过 lockfile 自动选用的 `pnpm`、`yarn` 或 `npm` 触发;无 lockfile 时回退 `npm`。
382
- 7. 构建产物落在 `dist/`,包含 `index.html` 和 `manifest.json`。
424
+ 7. 项目根有 `scripts.build`,会被 CLI 通过 lockfile 自动选用的 `pnpm`、`yarn` 或 `npm` 触发;无 lockfile 时回退 `npm`。
425
+ 8. 构建产物落在 `dist/`,包含 `index.html` 和 `manifest.json`。
383
426
 
384
427
  执行流程:
385
428
 
@@ -437,29 +480,29 @@ HB_SDK_ALLOW_UNSAFE_API_BASE_URL=1 hb-sdk remote deploy --api-base-url http://12
437
480
 
438
481
  `hb-sdk remote` 默认作用于当前项目绑定的小程序,即 `package.json.heybox.miniProgramId`。`remote list` 只展示服务端 current entity 下可管理的小程序,用于发现和绑定;会改变远端状态的命令仍然只操作当前绑定的小程序,不接受临时 `mini_program_id` 参数。需要查看或切换开发者主体时,使用 `hb-sdk remote entity ...`;CLI 不会根据本地绑定自动切换主体。
439
482
 
440
- | 命令 | 说明 |
441
- | --------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
442
- | `hb-sdk remote access` | 查询当前 CLI 用户是否具备管理工坊小程序的资格。 |
443
- | `hb-sdk remote entity list` | 列出可切换开发者主体,并标记服务端 current entity。 |
444
- | `hb-sdk remote entity current` | 查看服务端 current entity 和该主体的小程序工坊权限状态。 |
445
- | `hb-sdk remote entity switch <entity-id>` | 切换服务端 current entity;只允许切到 `entity list` 返回的主体。 |
446
- | `hb-sdk remote list [--status <status>] [--keyword <text>]` | 列出 current entity 下当前 CLI 用户可管理的小程序,并标出当前绑定项。 |
447
- | `hb-sdk remote create [--yes] [--force-bind]` | 在 current entity 下创建远端小程序并绑定当前项目;多主体非 TTY 环境必须传 `--yes` 确认使用当前主体;已有绑定时必须显式传 `--force-bind` 才能覆盖。 |
448
- | `hb-sdk remote bind <mini-program-id> [--force]` | 先校验 current entity 可管理目标小程序,再写入当前项目绑定;`--force` 只允许覆盖本地绑定,不跳过远端校验或主体一致性校验。 |
449
- | `hb-sdk remote info` | 查看当前绑定小程序的远端详情。 |
450
- | `hb-sdk remote allowlist list` | 查看预览白名单。 |
451
- | `hb-sdk remote allowlist add <heybox-id...>` | 添加十进制 Heybox ID 到预览白名单。 |
452
- | `hb-sdk remote allowlist remove <heybox-id...>` | 从预览白名单移除非 owner 条目。 |
453
- | `hb-sdk remote allowlist set <heybox-id...>` | 替换非 owner 白名单条目,并保留平台返回的 owner 语义。 |
483
+ | 命令 | 说明 |
484
+ | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
485
+ | `hb-sdk remote access` | 查询当前 CLI 用户是否具备管理工坊小程序的资格。 |
486
+ | `hb-sdk remote entity list` | 列出可切换开发者主体,并标记服务端 current entity。 |
487
+ | `hb-sdk remote entity current` | 查看服务端 current entity 和该主体的小程序工坊权限状态。 |
488
+ | `hb-sdk remote entity switch <entity-id>` | 切换服务端 current entity;只允许切到 `entity list` 返回的主体。 |
489
+ | `hb-sdk remote list [--status <status>] [--keyword <text>]` | 列出 current entity 下当前 CLI 用户可管理的小程序,并标出当前绑定项。 |
490
+ | `hb-sdk remote create [--yes] [--force-bind]` | 在 current entity 下创建远端小程序并绑定当前项目;多主体非 TTY 环境必须传 `--yes` 确认使用当前主体;已有绑定时必须显式传 `--force-bind` 才能覆盖。 |
491
+ | `hb-sdk remote bind <mini-program-id> [--force]` | 先校验 current entity 可管理目标小程序,再写入当前项目绑定;`--force` 只允许覆盖本地绑定,不跳过远端校验或主体一致性校验。 |
492
+ | `hb-sdk remote info` | 查看当前绑定小程序的远端详情。 |
493
+ | `hb-sdk remote allowlist list` | 查看预览白名单。 |
494
+ | `hb-sdk remote allowlist add <heybox-id...>` | 添加十进制 Heybox ID 到预览白名单。 |
495
+ | `hb-sdk remote allowlist remove <heybox-id...>` | 从预览白名单移除非 owner 条目。 |
496
+ | `hb-sdk remote allowlist set <heybox-id...>` | 替换非 owner 白名单条目,并保留平台返回的 owner 语义。 |
454
497
  | `hb-sdk remote deploy --release-note <text> [--skip-build \| --from-version <version>] [--auto-publish]` | 构建、上传或复用历史产物并提交当前版本审核。 |
455
- | `hb-sdk remote versions` | 列出当前绑定小程序的远端版本。 |
456
- | `hb-sdk remote preview <version>` | 查看指定版本的远端预览入口。 |
457
- | `hb-sdk remote release <version> [--yes]` | 发布审核通过的版本;交互式终端会确认,非 TTY 必须传 `--yes`。 |
458
- | `hb-sdk remote withdraw <version> [--yes] [--reason <text>]` | 撤回审核中或已通过但未发布的版本;交互式终端会确认,非 TTY 必须传 `--yes`。 |
459
- | `hb-sdk remote take-down [--yes]` | 下架当前线上小程序;交互式终端会确认,非 TTY 必须传 `--yes`。 |
460
- | `hb-sdk remote reopen [--yes]` | 重新上架已下架的小程序;交互式终端会确认,非 TTY 必须传 `--yes`。 |
461
- | `hb-sdk remote square hide [--yes]` | 隐藏当前绑定小程序在普通用户侧的小程序工坊广场展示;白名单用户仍可见,直接链接不受影响;交互式终端会确认,非 TTY 必须传 `--yes`。 |
462
- | `hb-sdk remote square show` | 恢复当前绑定小程序在普通用户侧的小程序工坊广场展示。 |
498
+ | `hb-sdk remote versions` | 列出当前绑定小程序的远端版本。 |
499
+ | `hb-sdk remote preview <version>` | 查看指定版本的远端预览入口。 |
500
+ | `hb-sdk remote release <version> [--yes]` | 发布审核通过的版本;交互式终端会确认,非 TTY 必须传 `--yes`。 |
501
+ | `hb-sdk remote withdraw <version> [--yes] [--reason <text>]` | 撤回审核中或已通过但未发布的版本;交互式终端会确认,非 TTY 必须传 `--yes`。 |
502
+ | `hb-sdk remote take-down [--yes]` | 下架当前线上小程序;交互式终端会确认,非 TTY 必须传 `--yes`。 |
503
+ | `hb-sdk remote reopen [--yes]` | 重新上架已下架的小程序;交互式终端会确认,非 TTY 必须传 `--yes`。 |
504
+ | `hb-sdk remote square hide [--yes]` | 隐藏当前绑定小程序在普通用户侧的小程序工坊广场展示;白名单用户仍可见,直接链接不受影响;交互式终端会确认,非 TTY 必须传 `--yes`。 |
505
+ | `hb-sdk remote square show` | 恢复当前绑定小程序在普通用户侧的小程序工坊广场展示。 |
463
506
 
464
507
  CLI 登录态只供 CLI 命令访问黑盒接口时复用,不会注入 iframe SDK,也不会改变 `auth.login()`、`user.getInfo()`、`network.request()` 或 mock 宿主中的用户状态。`hb-sdk login` 成功后会尝试读取开发者主体列表:单主体自动确认或切换为 current entity,多主体交互式环境要求选择主体,多主体非 TTY 环境只提示后续运行 `hb-sdk remote entity switch <entity-id>`;显式传 `--no-select-entity` 时只写登录态,不修改服务端 current entity。`hb-sdk login status` 默认展示脱敏状态、`heyboxId`、`loginBaseUrl`、登录时间和本地 `selectedEntity` 提示快照;`--verbose` 额外展示 cache 路径。不输出 `pkey`、cookie 或完整请求头。`selectedEntity` 不是权限事实源,每次 remote 命令仍以服务端 current entity 为准。
465
508
 
@@ -517,12 +560,12 @@ export default defineConfig({
517
560
 
518
561
  ## 导出
519
562
 
520
- 默认导出 `hbSDK`,包含 `ready`、`on`、`off`、`auth`、`user`、`share`、`viewport`、`storage`、`network`、`ui`、`device`、`navigation`。
563
+ 默认导出 `hbSDK`,包含 `ready`、`on`、`off`、`auth`、`user`、`share`、`viewport`、`storage`、`cloud`、`network`、`ui`、`device`、`navigation`。
521
564
 
522
565
  常用命名导出:
523
566
 
524
567
  - `ready`、`on`、`off`
525
- - `auth`、`user`、`share`、`viewport`、`storage`、`network`、`ui`、`device`、`navigation`
568
+ - `auth`、`user`、`share`、`viewport`、`storage`、`cloud`、`network`、`ui`、`device`、`navigation`
526
569
  - `createMiniProgramSDK`、`MiniProgramSDK`
527
570
  - `HbMiniProgramSDKError`、`HbMiniProgramNetworkError`
528
571
  - 各模块公开类型,例如 `MiniProgramNetworkRequestConfig`、`MiniProgramNetworkResponse`、`MiniProgramUserInfoResult`
@@ -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-BBatNb1l.cjs');
8
+ var index = require('./index-BROIiSNN.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-BBatNb1l.cjs');
12
+ var index = require('./index-BROIiSNN.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-BBatNb1l.cjs');
7
+ var index = require('./index-BROIiSNN.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-BBatNb1l.cjs');
3
+ var index$2 = require('./index-BROIiSNN.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-YDmSxyYi.cjs');
10
+ var remote = require('./remote-ChGmIJC1.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-BBatNb1l.cjs', document.baseURI).href)));
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-BROIiSNN.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-BBatNb1l.cjs', document.baseURI).href)));
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-BROIiSNN.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-BBatNb1l.cjs', document.baseURI).href)));
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-BROIiSNN.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-BBatNb1l.cjs', document.baseURI).href)));
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-BROIiSNN.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-BBatNb1l.cjs', document.baseURI).href)));
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-BROIiSNN.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.5.10';
13097
+ const BUILT_CLI_VERSION = '0.5.11';
13098
13098
  const PACKAGE_JSON_CANDIDATES = [
13099
13099
  path.resolve(__dirname, '..', '..', 'package.json'),
13100
13100
  path.resolve(__dirname, '..', 'package.json'),
@@ -13259,6 +13259,43 @@ function installRemoteCommands(program, handlers, resolveLogger) {
13259
13259
  addRemotePublicOptions(allowlist.command('set').description('替换预览白名单 Heybox ID').argument('<heybox-id...>', 'Heybox ID')).action(createRemoteAction(handlers, resolveLogger, 'allowlist:set', (_command, heyboxIds) => ({
13260
13260
  heyboxIds: readStringArrayArgument(heyboxIds, 'heybox-id'),
13261
13261
  })));
13262
+ const cloud = addRemotePublicOptions(remote.command('cloud').description('管理当前绑定小程序的云端能力'));
13263
+ const leaderboard = addRemotePublicOptions(cloud.command('leaderboard').description('管理当前绑定小程序的云端排行榜'));
13264
+ addRemotePublicOptions(leaderboard
13265
+ .command('create')
13266
+ .description('创建云端排行榜')
13267
+ .argument('[key]', '排行榜 key;不传时创建 default')
13268
+ .requiredOption('--order <order>', '排序方向:asc 或 desc')
13269
+ .option('--rank-limit <count>', '榜单展示记录上限;0 表示不限制', parseNonNegativeInteger)).action(createRemoteAction(handlers, resolveLogger, 'cloud:leaderboard:create', (command, key) => {
13270
+ const options = readCommandOptionsWithAncestors(command);
13271
+ return {
13272
+ key: typeof key === 'string' ? key : undefined,
13273
+ order: readStringOption(options.order),
13274
+ rankLimit: typeof options.rankLimit === 'number' ? options.rankLimit : undefined,
13275
+ };
13276
+ }));
13277
+ addRemotePublicOptions(leaderboard.command('get').description('查看云端排行榜配置').argument('<key>', '排行榜 key')).action(createRemoteAction(handlers, resolveLogger, 'cloud:leaderboard:get', (_command, key) => ({
13278
+ key: readStringArgument(key, 'key'),
13279
+ })));
13280
+ addRemotePublicOptions(leaderboard
13281
+ .command('list')
13282
+ .description('列出当前绑定小程序的云端排行榜')
13283
+ .option('--created-at-start <timestamp>', '创建时间区间开始秒级时间戳', parseNonNegativeInteger)
13284
+ .option('--created-at-end <timestamp>', '创建时间区间结束秒级时间戳', parseNonNegativeInteger)).action(createRemoteAction(handlers, resolveLogger, 'cloud:leaderboard:list', (command) => {
13285
+ const options = readCommandOptionsWithAncestors(command);
13286
+ return {
13287
+ createdAtStart: typeof options.createdAtStart === 'number' ? options.createdAtStart : undefined,
13288
+ createdAtEnd: typeof options.createdAtEnd === 'number' ? options.createdAtEnd : undefined,
13289
+ };
13290
+ }));
13291
+ addRemotePublicOptions(leaderboard
13292
+ .command('delete')
13293
+ .description('硬删除云端排行榜及其全部记录')
13294
+ .argument('<key>', '排行榜 key')
13295
+ .requiredOption('--confirm <key>', '必须与排行榜 key 完全一致')).action(createRemoteAction(handlers, resolveLogger, 'cloud:leaderboard:delete', (command, key) => ({
13296
+ key: readStringArgument(key, 'key'),
13297
+ confirm: readStringOption(readCommandOptionsWithAncestors(command).confirm),
13298
+ })));
13262
13299
  addRemotePublicOptions(remote
13263
13300
  .command('deploy')
13264
13301
  .description('构建并提交当前小程序版本审核')
@@ -13374,31 +13411,31 @@ function createCommandLoggerResolver(options) {
13374
13411
  };
13375
13412
  }
13376
13413
  const defaultClearLoginStatus = async (...args) => {
13377
- const { clearLoginStatus } = await Promise.resolve().then(function () { return require('./login-BX0YmVyi.cjs'); });
13414
+ const { clearLoginStatus } = await Promise.resolve().then(function () { return require('./login-BejyA1mX.cjs'); });
13378
13415
  return clearLoginStatus(...args);
13379
13416
  };
13380
13417
  const defaultLoginToHeybox = async (...args) => {
13381
- const { loginToHeybox } = await Promise.resolve().then(function () { return require('./login-BX0YmVyi.cjs'); });
13418
+ const { loginToHeybox } = await Promise.resolve().then(function () { return require('./login-BejyA1mX.cjs'); });
13382
13419
  return loginToHeybox(...args);
13383
13420
  };
13384
13421
  const defaultPrintLoginStatus = async (...args) => {
13385
- const { printLoginStatus } = await Promise.resolve().then(function () { return require('./login-BX0YmVyi.cjs'); });
13422
+ const { printLoginStatus } = await Promise.resolve().then(function () { return require('./login-BejyA1mX.cjs'); });
13386
13423
  return printLoginStatus(...args);
13387
13424
  };
13388
13425
  const defaultRunCreateCommand = async (...args) => {
13389
- const { runCreateCommand } = await Promise.resolve().then(function () { return require('./create-D1W2pkHZ.cjs'); });
13426
+ const { runCreateCommand } = await Promise.resolve().then(function () { return require('./create-BaqN3jeW.cjs'); });
13390
13427
  return runCreateCommand(...args);
13391
13428
  };
13392
13429
  const defaultRunDevCommand = async (...args) => {
13393
- const { runDevCommand } = await Promise.resolve().then(function () { return require('./dev-DwbE-c1x.cjs'); });
13430
+ const { runDevCommand } = await Promise.resolve().then(function () { return require('./dev-DUZgcgYE.cjs'); });
13394
13431
  return runDevCommand(...args);
13395
13432
  };
13396
13433
  const defaultRunDoctorCommand = async (...args) => {
13397
- const { runDoctorCommand } = await Promise.resolve().then(function () { return require('./doctor-Bx71WFjM.cjs'); });
13434
+ const { runDoctorCommand } = await Promise.resolve().then(function () { return require('./doctor-DUjQij7b.cjs'); });
13398
13435
  return runDoctorCommand(...args);
13399
13436
  };
13400
13437
  const defaultRunRemoteCommand = async (...args) => {
13401
- const { runRemoteCommand } = await Promise.resolve().then(function () { return require('./remote-YDmSxyYi.cjs'); }).then(function (n) { return n.remote; });
13438
+ const { runRemoteCommand } = await Promise.resolve().then(function () { return require('./remote-ChGmIJC1.cjs'); }).then(function (n) { return n.remote; });
13402
13439
  return runRemoteCommand(...args);
13403
13440
  };
13404
13441
  function resolveStandaloneLogger(options, verbose) {
@@ -13463,6 +13500,13 @@ function parsePositivePort(value) {
13463
13500
  }
13464
13501
  return parsed;
13465
13502
  }
13503
+ function parseNonNegativeInteger(value) {
13504
+ const parsed = Number(value);
13505
+ if (!Number.isInteger(parsed) || parsed < 0) {
13506
+ throw new InvalidArgumentError('必须是非负整数');
13507
+ }
13508
+ return parsed;
13509
+ }
13466
13510
 
13467
13511
  exports.CliError = CliError;
13468
13512
  exports.HB_SDK_PACKAGE_NAME = HB_SDK_PACKAGE_NAME;
@@ -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-BxZBXDZ-.cjs');
6
+ var session = require('./session-jHF9KWBo.cjs');
7
7
  var browser = require('./browser-RAy8e8cV.cjs');
8
- var index = require('./index-BBatNb1l.cjs');
8
+ var index = require('./index-BROIiSNN.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-BxZBXDZ-.cjs');
4
+ var session = require('./session-jHF9KWBo.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-BBatNb1l.cjs');
9
+ var index = require('./index-BROIiSNN.cjs');
10
10
 
11
11
  var re = {exports: {}};
12
12
 
@@ -2866,6 +2866,10 @@ const CREATE_USER_MINIPROGRAM_API_PATH = '/mall/developer/user_miniprogram/creat
2866
2866
  const DETAIL_USER_MINIPROGRAM_API_PATH = '/mall/developer/user_miniprogram/detail';
2867
2867
  const USER_MINIPROGRAM_PREVIEW_ALLOWLIST_API_PATH = '/mall/developer/user_miniprogram/preview_allowlist';
2868
2868
  const UPDATE_USER_MINIPROGRAM_PREVIEW_ALLOWLIST_API_PATH = '/mall/developer/user_miniprogram/preview_allowlist/update';
2869
+ const CREATE_USER_MINIPROGRAM_LEADERBOARD_API_PATH = '/mall/developer/user_miniprogram/leaderboard/create';
2870
+ const DETAIL_USER_MINIPROGRAM_LEADERBOARD_API_PATH = '/mall/developer/user_miniprogram/leaderboard/detail';
2871
+ const LIST_USER_MINIPROGRAM_LEADERBOARD_API_PATH = '/mall/developer/user_miniprogram/leaderboard/list';
2872
+ const DELETE_USER_MINIPROGRAM_LEADERBOARD_API_PATH = '/mall/developer/user_miniprogram/leaderboard/delete';
2869
2873
  const PRECHECK_USER_MINIPROGRAM_VERSION_API_PATH = '/mall/developer/user_miniprogram/version/precheck';
2870
2874
  const SUBMIT_USER_MINIPROGRAM_AUDIT_API_PATH = '/mall/developer/user_miniprogram/version/submit_audit';
2871
2875
  const USER_MINIPROGRAM_VERSION_PREVIEW_INFO_API_PATH = '/mall/developer/user_miniprogram/version/preview_info';
@@ -3111,7 +3115,7 @@ async function createDefaultCosClient(uploadToken) {
3111
3115
  };
3112
3116
  }
3113
3117
  async function loadCosConstructor() {
3114
- const cosModule = await Promise.resolve().then(function () { return require('./index-D5bZjpH9.cjs'); }).then(function (n) { return n.index; });
3118
+ const cosModule = await Promise.resolve().then(function () { return require('./index-6W5M4MLF.cjs'); }).then(function (n) { return n.index; });
3115
3119
  return cosModule.default;
3116
3120
  }
3117
3121
  function formatSize(bytes) {
@@ -3627,6 +3631,10 @@ function createRemoteApiClient(options) {
3627
3631
  getUserMiniprogramDetail: (requestOptions) => getUserMiniprogramDetail(requestOptions, options),
3628
3632
  getPreviewAllowlist: (requestOptions) => getPreviewAllowlist(requestOptions, options),
3629
3633
  updatePreviewAllowlist: (requestOptions) => updatePreviewAllowlist(requestOptions, options),
3634
+ createUserMiniprogramLeaderboard: (requestOptions) => createUserMiniprogramLeaderboard(requestOptions, options),
3635
+ getUserMiniprogramLeaderboard: (requestOptions) => getUserMiniprogramLeaderboard(requestOptions, options),
3636
+ listUserMiniprogramLeaderboards: (requestOptions) => listUserMiniprogramLeaderboards(requestOptions, options),
3637
+ deleteUserMiniprogramLeaderboard: (requestOptions) => deleteUserMiniprogramLeaderboard(requestOptions, options),
3630
3638
  precheckUserMiniprogramVersion: (requestOptions) => precheckUserMiniprogramVersion(requestOptions, options),
3631
3639
  submitUserMiniprogramAudit: (requestOptions) => submitUserMiniprogramAudit(requestOptions, options),
3632
3640
  getVersionPreviewInfo: (requestOptions) => getVersionPreviewInfo(requestOptions, options),
@@ -3662,6 +3670,18 @@ async function getPreviewAllowlist(options, runtime) {
3662
3670
  async function updatePreviewAllowlist(options, runtime) {
3663
3671
  return remotePostForm(UPDATE_USER_MINIPROGRAM_PREVIEW_ALLOWLIST_API_PATH, options, runtime);
3664
3672
  }
3673
+ async function createUserMiniprogramLeaderboard(options, runtime) {
3674
+ return remotePostForm(CREATE_USER_MINIPROGRAM_LEADERBOARD_API_PATH, options, runtime);
3675
+ }
3676
+ async function getUserMiniprogramLeaderboard(options, runtime) {
3677
+ return remoteGet(DETAIL_USER_MINIPROGRAM_LEADERBOARD_API_PATH, options, runtime);
3678
+ }
3679
+ async function listUserMiniprogramLeaderboards(options, runtime) {
3680
+ return remoteGet(LIST_USER_MINIPROGRAM_LEADERBOARD_API_PATH, options, runtime);
3681
+ }
3682
+ async function deleteUserMiniprogramLeaderboard(options, runtime) {
3683
+ return (await remotePostForm(DELETE_USER_MINIPROGRAM_LEADERBOARD_API_PATH, options, runtime, { requireResult: false })) ?? {};
3684
+ }
3665
3685
  async function precheckUserMiniprogramVersion(options, runtime) {
3666
3686
  return remotePostForm(PRECHECK_USER_MINIPROGRAM_VERSION_API_PATH, options, runtime);
3667
3687
  }
@@ -3897,6 +3917,14 @@ async function runRemoteCommand(options, runtime = {}) {
3897
3917
  case 'allowlist:remove':
3898
3918
  case 'allowlist:set':
3899
3919
  return remoteAllowlistWrite(options, context, runtime);
3920
+ case 'cloud:leaderboard:create':
3921
+ return remoteLeaderboardCreate(options, context, runtime);
3922
+ case 'cloud:leaderboard:get':
3923
+ return remoteLeaderboardGet(options, context, runtime);
3924
+ case 'cloud:leaderboard:list':
3925
+ return remoteLeaderboardList(options, context, runtime);
3926
+ case 'cloud:leaderboard:delete':
3927
+ return remoteLeaderboardDelete(options, context, runtime);
3900
3928
  case 'versions':
3901
3929
  return remoteVersions(options, context, runtime);
3902
3930
  case 'preview':
@@ -3980,6 +4008,19 @@ function adaptRemoteApiClient(api) {
3980
4008
  getMiniProgramDetail: (miniProgramId) => api.getUserMiniprogramDetail({ mini_program_id: miniProgramId }),
3981
4009
  getAllowlist: (miniProgramId) => api.getPreviewAllowlist({ mini_program_id: miniProgramId }),
3982
4010
  updateAllowlist: ({ miniProgramId, heyboxIds }) => api.updatePreviewAllowlist({ mini_program_id: miniProgramId, heybox_ids: heyboxIds }),
4011
+ createLeaderboard: ({ miniProgramId, key, order, rankLimit }) => api.createUserMiniprogramLeaderboard({
4012
+ mini_program_id: miniProgramId,
4013
+ key,
4014
+ order,
4015
+ rank_limit: rankLimit,
4016
+ }),
4017
+ getLeaderboard: ({ miniProgramId, key }) => api.getUserMiniprogramLeaderboard({ mini_program_id: miniProgramId, key }),
4018
+ listLeaderboards: ({ miniProgramId, createdAtStart, createdAtEnd }) => api.listUserMiniprogramLeaderboards({
4019
+ mini_program_id: miniProgramId,
4020
+ created_at_start: createdAtStart,
4021
+ created_at_end: createdAtEnd,
4022
+ }),
4023
+ deleteLeaderboard: ({ miniProgramId, key, confirm }) => api.deleteUserMiniprogramLeaderboard({ mini_program_id: miniProgramId, key, confirm }),
3983
4024
  listVersions: (miniProgramId) => api.listUserMiniprogramVersions({ mini_program_id: miniProgramId, offset: 0, limit: 50 }),
3984
4025
  getPreviewInfo: ({ miniProgramId, version }) => api.getVersionPreviewInfo({ mini_program_id: miniProgramId, version }),
3985
4026
  listDeveloperEntities: () => api.listDeveloperEntities(),
@@ -4163,6 +4204,65 @@ async function remoteAllowlistWrite(options, context, runtime) {
4163
4204
  }
4164
4205
  return finishRemoteCommand(options, runtime, output);
4165
4206
  }
4207
+ async function remoteLeaderboardCreate(options, context, runtime) {
4208
+ const miniProgramId = requireBinding(context);
4209
+ const order = requireNonEmpty(options.order, 'remote cloud leaderboard create 必须传 --order asc|desc');
4210
+ if (order !== 'asc' && order !== 'desc') {
4211
+ throw new Error(`排行榜排序方向只支持 asc 或 desc:${order}`);
4212
+ }
4213
+ const key = options.key === undefined ? undefined : requireNonEmpty(options.key, '排行榜 key 不能为空');
4214
+ await assertBoundMiniProgramEntityMatchesCurrent(context, miniProgramId);
4215
+ const result = await context.api.createLeaderboard({
4216
+ miniProgramId,
4217
+ key,
4218
+ order,
4219
+ rankLimit: options.rankLimit,
4220
+ });
4221
+ const output = { changed: true, miniProgramId, leaderboard: toCamelCaseDeep(result) };
4222
+ if (!options.json) {
4223
+ context.logger.success(`排行榜创建成功:${String(result.key || key || 'default')}`);
4224
+ }
4225
+ return finishRemoteCommand(options, runtime, output);
4226
+ }
4227
+ async function remoteLeaderboardGet(options, context, runtime) {
4228
+ const miniProgramId = requireBinding(context);
4229
+ const key = requireNonEmpty(options.key, 'remote cloud leaderboard get 必须传 <key>');
4230
+ const result = await context.api.getLeaderboard({ miniProgramId, key });
4231
+ const output = { changed: false, miniProgramId, leaderboard: toCamelCaseDeep(result) };
4232
+ if (!options.json) {
4233
+ printLeaderboardDetail(context.logger, result);
4234
+ }
4235
+ return finishRemoteCommand(options, runtime, output);
4236
+ }
4237
+ async function remoteLeaderboardList(options, context, runtime) {
4238
+ const miniProgramId = requireBinding(context);
4239
+ const result = await context.api.listLeaderboards({
4240
+ miniProgramId,
4241
+ createdAtStart: options.createdAtStart,
4242
+ createdAtEnd: options.createdAtEnd,
4243
+ });
4244
+ const leaderboards = Array.isArray(result.leaderboards) ? result.leaderboards : [];
4245
+ const output = { changed: false, miniProgramId, leaderboards: toCamelCaseDeep(leaderboards) };
4246
+ if (!options.json) {
4247
+ printLeaderboards(context.logger, leaderboards);
4248
+ }
4249
+ return finishRemoteCommand(options, runtime, output);
4250
+ }
4251
+ async function remoteLeaderboardDelete(options, context, runtime) {
4252
+ const miniProgramId = requireBinding(context);
4253
+ const key = requireNonEmpty(options.key, 'remote cloud leaderboard delete 必须传 <key>');
4254
+ const confirm = requireNonEmpty(options.confirm, 'remote cloud leaderboard delete 必须传 --confirm <key>');
4255
+ if (confirm !== key) {
4256
+ throw new Error('--confirm 必须与要删除的排行榜 key 完全一致');
4257
+ }
4258
+ await assertBoundMiniProgramEntityMatchesCurrent(context, miniProgramId);
4259
+ await context.api.deleteLeaderboard({ miniProgramId, key, confirm });
4260
+ const output = { changed: true, miniProgramId, key };
4261
+ if (!options.json) {
4262
+ context.logger.success(`排行榜已删除:${key}`);
4263
+ }
4264
+ return finishRemoteCommand(options, runtime, output);
4265
+ }
4166
4266
  async function remoteVersions(options, context, runtime) {
4167
4267
  const miniProgramId = requireBinding(context);
4168
4268
  const result = await context.api.listVersions(miniProgramId);
@@ -4590,6 +4690,20 @@ function printAllowlist(logger, result) {
4590
4690
  logger.info(`${item.heybox_id ?? '--'}${item.is_owner ? ' (owner)' : ''}${item.nickname ? ` ${item.nickname}` : ''}`);
4591
4691
  }
4592
4692
  }
4693
+ function printLeaderboards(logger, leaderboards) {
4694
+ if (leaderboards.length === 0) {
4695
+ logger.info('暂无云端排行榜');
4696
+ return;
4697
+ }
4698
+ for (const item of leaderboards) {
4699
+ logger.info(`${item.key ?? '--'} order=${item.order ?? '--'} rankLimit=${readNumber(item.rank_limit, 0)}`);
4700
+ }
4701
+ }
4702
+ function printLeaderboardDetail(logger, detail) {
4703
+ logger.info(`Leaderboard: ${detail.key ?? '--'}`);
4704
+ logger.info(`Order: ${detail.order ?? '--'}`);
4705
+ logger.info(`Rank limit: ${readNumber(detail.rank_limit, 0)}`);
4706
+ }
4593
4707
  function readNumber(value, fallback) {
4594
4708
  return typeof value === 'number' && Number.isFinite(value) ? value : fallback;
4595
4709
  }
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-BBatNb1l.cjs');
3
+ var index = require('./index-BROIiSNN.cjs');
4
4
  var node_crypto = require('node:crypto');
5
5
  var path = require('node:path');
6
6
  var require$$0$2 = require('fs');
package/dist/cli.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./cli-chunks/index-BBatNb1l.cjs');
3
+ var index = require('./cli-chunks/index-BROIiSNN.cjs');
4
4
  require('node:module');
5
5
  require('node:fs');
6
6
  require('node:fs/promises');