@heybox/hb-sdk 0.10.0-alpha.2 → 0.10.0-alpha.3
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/CHANGELOG.md +7 -0
- package/README.md +13 -0
- package/dist/cli-chunks/{build-Be8QI9ma.cjs → build-DJvUpgCG.cjs} +8 -6
- package/dist/cli-chunks/{create-CaAGgJXF.cjs → create-CKFbAKsd.cjs} +2 -2
- package/dist/cli-chunks/{dev-BS8uwRH2.cjs → dev-DkQ3XT4g.cjs} +19 -11
- package/dist/cli-chunks/{doctor-CgdrOrS5.cjs → doctor-CrDV0t0X.cjs} +1 -1
- package/dist/cli-chunks/{game-binding-guide-DX8uXx0V.cjs → game-binding-guide-Du9jYSv0.cjs} +3 -3
- package/dist/cli-chunks/{game-bindings-CjI0oA1t.cjs → game-bindings-DyUsgTvm.cjs} +4 -4
- package/dist/cli-chunks/{games-C8A0PCo-.cjs → games-60o0JlU1.cjs} +1 -1
- package/dist/cli-chunks/{index-BTOX41Vr.cjs → index-B3bDDBnX.cjs} +1 -1
- package/dist/cli-chunks/{index-CMbVUUpA.cjs → index-oQnW71g6.cjs} +24 -22
- package/dist/cli-chunks/{index.esm-D7A_j5MA.cjs → index.esm-B8H9EwB1.cjs} +67 -0
- package/dist/cli-chunks/{index.esm-CIBT3Na1.cjs → index.esm-C5mTEO5-.cjs} +9 -9
- package/dist/cli-chunks/{login-BWuLgJWT.cjs → login-81EUI3Tp.cjs} +1 -1
- package/dist/cli-chunks/{project-vite-FWtHl3XL.cjs → project-vite-BL7txpEs.cjs} +1 -1
- package/dist/cli-chunks/{remote-R1jgvh-Z.cjs → remote-BaistJfP.cjs} +13 -9
- package/dist/cli-chunks/{runtime-permission-env-BuXOApO4.cjs → runtime-permission-env-ChCGtenG.cjs} +392 -113
- package/dist/cli-chunks/{skill-EM-Uv3Rj.cjs → skill-BQUjMV7k.cjs} +2 -2
- package/dist/cli-chunks/{version-BXh-cltM.cjs → version-CUuM16X6.cjs} +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/devtools/browser-dev-host/assets/browser-dev-host-Dho-QHhS.js +224 -0
- package/dist/devtools/browser-dev-host/assets/{desktop-app-launch-BXVw6d6N.js → desktop-app-launch-CIC_pBdX.js} +1 -1
- package/dist/devtools/browser-dev-host/assets/{index-CABlopeJ.js → index-D1Iqs-0N.js} +3 -3
- package/dist/devtools/browser-dev-host/index.html +2 -2
- package/dist/index.cjs.js +284 -1
- package/dist/index.esm.js +284 -1
- package/dist/miniapp-publish.cjs.js +215 -116
- package/dist/miniapp-publish.esm.js +214 -117
- package/dist/protocol.cjs.js +57 -0
- package/dist/protocol.esm.js +57 -0
- package/dist/vite.cjs.js +238 -96
- package/dist/vite.esm.js +238 -96
- package/package.json +7 -7
- package/skill/skill.json +4 -4
- package/types/index.d.ts +76 -3
- package/types/miniapp-publish/index.d.ts +30 -15
- package/types/vite/index.d.ts +7 -0
- package/dist/devtools/browser-dev-host/assets/browser-dev-host-CpphzCg4.js +0 -224
package/dist/vite.esm.js
CHANGED
|
@@ -66,6 +66,13 @@ const POST_WRITE_METHODS = [
|
|
|
66
66
|
'post.comments.delete',
|
|
67
67
|
'post.comments.setLiked',
|
|
68
68
|
];
|
|
69
|
+
const CLOUD_ROOMS_LIST_METHOD = 'cloud.rooms.list';
|
|
70
|
+
const CLOUD_ROOMS_CREATE_METHOD = 'cloud.rooms.create';
|
|
71
|
+
const CLOUD_ROOMS_JOIN_METHOD = 'cloud.rooms.join';
|
|
72
|
+
const CLOUD_ROOMS_SEND_METHOD = 'cloud.rooms.send';
|
|
73
|
+
const CLOUD_ROOMS_LEAVE_METHOD = 'cloud.rooms.leave';
|
|
74
|
+
const CLOUD_ROOMS_DISPOSE_METHOD = 'cloud.rooms.dispose';
|
|
75
|
+
const CLOUD_ROOMS_LIFECYCLE_METHOD = 'cloud.rooms.lifecycle';
|
|
69
76
|
|
|
70
77
|
/** 游戏资料内部 wire:业务方法由 SDK 映射为精确资源请求。 */
|
|
71
78
|
const USER_GAMES_GET_OVERVIEW_METHOD = 'user.games.getOverview';
|
|
@@ -479,6 +486,55 @@ const COMPANION_SHOW_NOTIFICATION_METHOD = 'companion.showNotification';
|
|
|
479
486
|
requirement: { kind: 'none' },
|
|
480
487
|
risk: 'medium',
|
|
481
488
|
},
|
|
489
|
+
{
|
|
490
|
+
method: CLOUD_ROOMS_LIST_METHOD,
|
|
491
|
+
module: 'cloud',
|
|
492
|
+
capability: CLOUD_ROOMS_LIST_METHOD,
|
|
493
|
+
requirement: { kind: 'all', permissions: ['cloud_rooms'] },
|
|
494
|
+
risk: 'medium',
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
method: CLOUD_ROOMS_CREATE_METHOD,
|
|
498
|
+
module: 'cloud',
|
|
499
|
+
capability: CLOUD_ROOMS_CREATE_METHOD,
|
|
500
|
+
requirement: { kind: 'all', permissions: ['cloud_rooms'] },
|
|
501
|
+
risk: 'medium',
|
|
502
|
+
},
|
|
503
|
+
{
|
|
504
|
+
method: CLOUD_ROOMS_JOIN_METHOD,
|
|
505
|
+
module: 'cloud',
|
|
506
|
+
capability: CLOUD_ROOMS_JOIN_METHOD,
|
|
507
|
+
requirement: { kind: 'all', permissions: ['cloud_rooms'] },
|
|
508
|
+
risk: 'medium',
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
method: CLOUD_ROOMS_SEND_METHOD,
|
|
512
|
+
module: 'cloud',
|
|
513
|
+
capability: CLOUD_ROOMS_SEND_METHOD,
|
|
514
|
+
requirement: { kind: 'all', permissions: ['cloud_rooms'] },
|
|
515
|
+
risk: 'medium',
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
method: CLOUD_ROOMS_LEAVE_METHOD,
|
|
519
|
+
module: 'cloud',
|
|
520
|
+
capability: CLOUD_ROOMS_LEAVE_METHOD,
|
|
521
|
+
requirement: { kind: 'all', permissions: ['cloud_rooms'] },
|
|
522
|
+
risk: 'medium',
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
method: CLOUD_ROOMS_DISPOSE_METHOD,
|
|
526
|
+
module: 'cloud',
|
|
527
|
+
capability: CLOUD_ROOMS_DISPOSE_METHOD,
|
|
528
|
+
requirement: { kind: 'all', permissions: ['cloud_rooms'] },
|
|
529
|
+
risk: 'medium',
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
method: CLOUD_ROOMS_LIFECYCLE_METHOD,
|
|
533
|
+
module: 'cloud',
|
|
534
|
+
capability: CLOUD_ROOMS_LIFECYCLE_METHOD,
|
|
535
|
+
requirement: { kind: 'all', permissions: ['cloud_rooms'] },
|
|
536
|
+
risk: 'medium',
|
|
537
|
+
},
|
|
482
538
|
{
|
|
483
539
|
method: CLOUD_LEADERBOARD_SUBMIT_METHOD,
|
|
484
540
|
module: 'cloud',
|
|
@@ -801,6 +857,7 @@ const MINI_PROGRAM_PERMISSION_KEYS = [
|
|
|
801
857
|
'share',
|
|
802
858
|
'storage',
|
|
803
859
|
'cloud_storage',
|
|
860
|
+
'cloud_rooms',
|
|
804
861
|
'gameSaves',
|
|
805
862
|
'filesystem',
|
|
806
863
|
'media',
|
|
@@ -998,6 +1055,16 @@ const MINI_PROGRAM_PERMISSION_CATALOG = [
|
|
|
998
1055
|
methods: ['workspaceCards.requestRefresh'],
|
|
999
1056
|
conditions: ['需平台批准、Host 支持与有效执行租约;不隐式授予网络或存储权限。'],
|
|
1000
1057
|
},
|
|
1058
|
+
{
|
|
1059
|
+
key: 'cloud_rooms',
|
|
1060
|
+
name: '实时动作房间',
|
|
1061
|
+
description: '在少人数房间内交换随包声明的结构化动作。',
|
|
1062
|
+
access: 'platform-approval',
|
|
1063
|
+
risk: 'medium',
|
|
1064
|
+
config: {},
|
|
1065
|
+
methods: ['cloud.rooms.list', 'cloud.rooms.create', 'cloud.rooms.join', 'cloud.rooms.send', 'cloud.rooms.leave', 'cloud.rooms.dispose', 'cloud.rooms.lifecycle'],
|
|
1066
|
+
conditions: ['仅允许当前版本房间协议中的动作和受限参数,不提供自由文字、文件或媒体传输。'],
|
|
1067
|
+
},
|
|
1001
1068
|
{
|
|
1002
1069
|
key: 'user_game_data',
|
|
1003
1070
|
name: '游戏资料',
|
|
@@ -1062,12 +1129,12 @@ function parseUserGameDataResourceDeclarations(value) {
|
|
|
1062
1129
|
return parseDeclarations(value);
|
|
1063
1130
|
}
|
|
1064
1131
|
function parseDeclarations(value, runtimeSnapshot) {
|
|
1065
|
-
if (!isRecord$4(value))
|
|
1132
|
+
if (!isRecord$4$1(value))
|
|
1066
1133
|
throw new Error('resources 必须是资源声明对象;每项资源必须填写 purpose');
|
|
1067
1134
|
const known = {};
|
|
1068
1135
|
for (const key of Object.keys(value).sort()) {
|
|
1069
1136
|
const entry = value[key];
|
|
1070
|
-
if (!isRecord$4(entry) || Object.keys(entry).length !== 1 || !Object.prototype.hasOwnProperty.call(entry, 'purpose'))
|
|
1137
|
+
if (!isRecord$4$1(entry) || Object.keys(entry).length !== 1 || !Object.prototype.hasOwnProperty.call(entry, 'purpose'))
|
|
1071
1138
|
throw new Error(`resources.${key} 必须且只能包含 purpose`);
|
|
1072
1139
|
let purpose;
|
|
1073
1140
|
try {
|
|
@@ -1083,7 +1150,7 @@ function parseDeclarations(value, runtimeSnapshot) {
|
|
|
1083
1150
|
}
|
|
1084
1151
|
return known;
|
|
1085
1152
|
}
|
|
1086
|
-
function isRecord$4(value) {
|
|
1153
|
+
function isRecord$4$1(value) {
|
|
1087
1154
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
1088
1155
|
}
|
|
1089
1156
|
|
|
@@ -11343,7 +11410,7 @@ async function ensureBasicInfoDirectory(rootPath, relative) {
|
|
|
11343
11410
|
/** 构建时替换为当前发布包的实际版本。 */
|
|
11344
11411
|
const HB_SDK_VERSION = typeof undefined === 'string'
|
|
11345
11412
|
? undefined
|
|
11346
|
-
: '0.10.0-alpha.
|
|
11413
|
+
: '0.10.0-alpha.3';
|
|
11347
11414
|
|
|
11348
11415
|
/**
|
|
11349
11416
|
* network.request 诊断日志的纯脱敏工具。
|
|
@@ -12429,6 +12496,122 @@ flush()})();
|
|
|
12429
12496
|
</script>`;
|
|
12430
12497
|
}
|
|
12431
12498
|
|
|
12499
|
+
const MINIAPP_PERMISSION_KEYS = MINI_PROGRAM_PERMISSION_KEYS;
|
|
12500
|
+
function parseMiniappPermissions(value, options) {
|
|
12501
|
+
const sourceLabel = options.sourceLabel ?? 'package.json#heybox.permissions';
|
|
12502
|
+
if (!options.present) {
|
|
12503
|
+
if (requiresExplicitPermissions(options.sdkVersion)) {
|
|
12504
|
+
throw new Error(`${sourceLabel} 在 @heybox/hb-sdk ${options.sdkVersion} 中必须声明;无权限需求时请配置空对象 {}`);
|
|
12505
|
+
}
|
|
12506
|
+
return { declared: false };
|
|
12507
|
+
}
|
|
12508
|
+
if (!isRecord$4(value)) {
|
|
12509
|
+
throw new Error(`${sourceLabel} 必须是 JSON 对象`);
|
|
12510
|
+
}
|
|
12511
|
+
const knownKeys = new Set(MINIAPP_PERMISSION_KEYS);
|
|
12512
|
+
for (const key of Object.keys(value)) {
|
|
12513
|
+
if (!knownKeys.has(key))
|
|
12514
|
+
throw new Error(`${sourceLabel} 包含未知权限:${key}`);
|
|
12515
|
+
}
|
|
12516
|
+
const permissions = {};
|
|
12517
|
+
for (const key of MINIAPP_PERMISSION_KEYS) {
|
|
12518
|
+
if (!Object.prototype.hasOwnProperty.call(value, key))
|
|
12519
|
+
continue;
|
|
12520
|
+
const declaration = value[key];
|
|
12521
|
+
const itemLabel = `${sourceLabel}.${key}`;
|
|
12522
|
+
if (!isRecord$4(declaration))
|
|
12523
|
+
throw new Error(`${itemLabel} 必须是 JSON 对象`);
|
|
12524
|
+
const definition = MINI_PROGRAM_PERMISSION_CATALOG.find((item) => item.key === key);
|
|
12525
|
+
if (!definition)
|
|
12526
|
+
throw new Error(`权限目录缺少定义:${key}`);
|
|
12527
|
+
const allowedFields = new Set(['enabled', ...Object.keys(definition.config)]);
|
|
12528
|
+
for (const field of Object.keys(declaration)) {
|
|
12529
|
+
if (!allowedFields.has(field))
|
|
12530
|
+
throw new Error(`${itemLabel} 包含未知字段:${field}`);
|
|
12531
|
+
}
|
|
12532
|
+
if (typeof declaration.enabled !== 'boolean')
|
|
12533
|
+
throw new Error(`${itemLabel}.enabled 必须是 boolean`);
|
|
12534
|
+
let useOfficialDomain = false;
|
|
12535
|
+
if (key === 'network') {
|
|
12536
|
+
if (declaration.useOfficialDomain !== undefined && typeof declaration.useOfficialDomain !== 'boolean') {
|
|
12537
|
+
throw new Error(`${itemLabel}.useOfficialDomain 必须是 boolean`);
|
|
12538
|
+
}
|
|
12539
|
+
useOfficialDomain = declaration.useOfficialDomain === true;
|
|
12540
|
+
}
|
|
12541
|
+
if (key === 'post') {
|
|
12542
|
+
for (const field of ['read', 'write']) {
|
|
12543
|
+
if (declaration[field] !== undefined && typeof declaration[field] !== 'boolean') {
|
|
12544
|
+
throw new Error(`${itemLabel}.${field} 必须是 boolean`);
|
|
12545
|
+
}
|
|
12546
|
+
}
|
|
12547
|
+
if (declaration.enabled)
|
|
12548
|
+
permissions.post = { enabled: true, read: declaration.read === true, write: declaration.write === true };
|
|
12549
|
+
continue;
|
|
12550
|
+
}
|
|
12551
|
+
if (key === 'user_game_data') {
|
|
12552
|
+
// 即使声明关闭也校验资源清单:enabled:false 不能隐藏非法字段。
|
|
12553
|
+
const resources = parseUserGameDataResources(declaration.resources, itemLabel);
|
|
12554
|
+
if (!declaration.enabled)
|
|
12555
|
+
continue;
|
|
12556
|
+
permissions.user_game_data = { enabled: true, resources };
|
|
12557
|
+
continue;
|
|
12558
|
+
}
|
|
12559
|
+
if (!declaration.enabled)
|
|
12560
|
+
continue;
|
|
12561
|
+
permissions[key] = key === 'network' ? { enabled: true, useOfficialDomain } : { enabled: true };
|
|
12562
|
+
}
|
|
12563
|
+
return { declared: true, permissions: permissions };
|
|
12564
|
+
}
|
|
12565
|
+
/**
|
|
12566
|
+
* 校验 Manifest 中的精确资源清单。
|
|
12567
|
+
*
|
|
12568
|
+
* @param value - `user_game_data.resources`;必须显式提供对象,空对象表示不请求任何资源。
|
|
12569
|
+
* @param itemLabel - 报错时使用的字段路径。
|
|
12570
|
+
* @returns 按固定顺序输出的已发布资源与规范化用途。
|
|
12571
|
+
* @throws 非对象、未开放 key 或非法用途直接报错。
|
|
12572
|
+
*/
|
|
12573
|
+
function parseUserGameDataResources(value, itemLabel) {
|
|
12574
|
+
try {
|
|
12575
|
+
return parseUserGameDataResourceDeclarations(value);
|
|
12576
|
+
}
|
|
12577
|
+
catch (error) {
|
|
12578
|
+
throw new Error(`${itemLabel}.${error.message}`);
|
|
12579
|
+
}
|
|
12580
|
+
}
|
|
12581
|
+
function requiresExplicitPermissions(sdkVersion) {
|
|
12582
|
+
const parsed = semverExports.parse(sdkVersion);
|
|
12583
|
+
if (!parsed)
|
|
12584
|
+
throw new Error(`sdkVersion 必须是合法 SemVer:${sdkVersion}`);
|
|
12585
|
+
return parsed.major > 0 || parsed.minor >= 9;
|
|
12586
|
+
}
|
|
12587
|
+
function isRecord$4(value) {
|
|
12588
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
12589
|
+
}
|
|
12590
|
+
/** Whether this manifest opts into the reviewed cloud room capability. */
|
|
12591
|
+
function declaresCloudRooms(manifest) {
|
|
12592
|
+
const permissions = manifest.permissions;
|
|
12593
|
+
return permissions?.cloud_rooms?.enabled === true;
|
|
12594
|
+
}
|
|
12595
|
+
|
|
12596
|
+
function isRecord$3(value) {
|
|
12597
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
12598
|
+
}
|
|
12599
|
+
function assertRoomReferences(refs) {
|
|
12600
|
+
if (!isRecord$3(refs) || Object.keys(refs).length > 4)
|
|
12601
|
+
throw new Error('roomDefinitions 无效');
|
|
12602
|
+
for (const [name, ref] of Object.entries(refs)) {
|
|
12603
|
+
if (!/^[A-Za-z][A-Za-z0-9_]{0,47}$/.test(name) ||
|
|
12604
|
+
['constructor', 'prototype', '__proto__'].includes(name) ||
|
|
12605
|
+
!isRecord$3(ref) ||
|
|
12606
|
+
Object.keys(ref).some((key) => key !== 'name' && key !== 'hash') ||
|
|
12607
|
+
ref.name !== name ||
|
|
12608
|
+
typeof ref.hash !== 'string' ||
|
|
12609
|
+
!/^[a-f0-9]{64}$/.test(ref.hash)) {
|
|
12610
|
+
throw new Error('Room 公开引用无效');
|
|
12611
|
+
}
|
|
12612
|
+
}
|
|
12613
|
+
}
|
|
12614
|
+
|
|
12432
12615
|
/** 单个小程序版本最多声明的关联游戏数量。 */
|
|
12433
12616
|
const MINIAPP_BIND_APP_IDS_MAX_COUNT = 20;
|
|
12434
12617
|
/**
|
|
@@ -12552,98 +12735,6 @@ function parseMiniappDesc(value, sourceLabel = 'package.json#heybox.desc') {
|
|
|
12552
12735
|
return desc;
|
|
12553
12736
|
}
|
|
12554
12737
|
|
|
12555
|
-
const MINIAPP_PERMISSION_KEYS = MINI_PROGRAM_PERMISSION_KEYS;
|
|
12556
|
-
function parseMiniappPermissions(value, options) {
|
|
12557
|
-
const sourceLabel = options.sourceLabel ?? 'package.json#heybox.permissions';
|
|
12558
|
-
if (!options.present) {
|
|
12559
|
-
if (requiresExplicitPermissions(options.sdkVersion)) {
|
|
12560
|
-
throw new Error(`${sourceLabel} 在 @heybox/hb-sdk ${options.sdkVersion} 中必须声明;无权限需求时请配置空对象 {}`);
|
|
12561
|
-
}
|
|
12562
|
-
return { declared: false };
|
|
12563
|
-
}
|
|
12564
|
-
if (!isRecord$3(value)) {
|
|
12565
|
-
throw new Error(`${sourceLabel} 必须是 JSON 对象`);
|
|
12566
|
-
}
|
|
12567
|
-
const knownKeys = new Set(MINIAPP_PERMISSION_KEYS);
|
|
12568
|
-
for (const key of Object.keys(value)) {
|
|
12569
|
-
if (!knownKeys.has(key))
|
|
12570
|
-
throw new Error(`${sourceLabel} 包含未知权限:${key}`);
|
|
12571
|
-
}
|
|
12572
|
-
const permissions = {};
|
|
12573
|
-
for (const key of MINIAPP_PERMISSION_KEYS) {
|
|
12574
|
-
if (!Object.prototype.hasOwnProperty.call(value, key))
|
|
12575
|
-
continue;
|
|
12576
|
-
const declaration = value[key];
|
|
12577
|
-
const itemLabel = `${sourceLabel}.${key}`;
|
|
12578
|
-
if (!isRecord$3(declaration))
|
|
12579
|
-
throw new Error(`${itemLabel} 必须是 JSON 对象`);
|
|
12580
|
-
const definition = MINI_PROGRAM_PERMISSION_CATALOG.find((item) => item.key === key);
|
|
12581
|
-
if (!definition)
|
|
12582
|
-
throw new Error(`权限目录缺少定义:${key}`);
|
|
12583
|
-
const allowedFields = new Set(['enabled', ...Object.keys(definition.config)]);
|
|
12584
|
-
for (const field of Object.keys(declaration)) {
|
|
12585
|
-
if (!allowedFields.has(field))
|
|
12586
|
-
throw new Error(`${itemLabel} 包含未知字段:${field}`);
|
|
12587
|
-
}
|
|
12588
|
-
if (typeof declaration.enabled !== 'boolean')
|
|
12589
|
-
throw new Error(`${itemLabel}.enabled 必须是 boolean`);
|
|
12590
|
-
let useOfficialDomain = false;
|
|
12591
|
-
if (key === 'network') {
|
|
12592
|
-
if (declaration.useOfficialDomain !== undefined && typeof declaration.useOfficialDomain !== 'boolean') {
|
|
12593
|
-
throw new Error(`${itemLabel}.useOfficialDomain 必须是 boolean`);
|
|
12594
|
-
}
|
|
12595
|
-
useOfficialDomain = declaration.useOfficialDomain === true;
|
|
12596
|
-
}
|
|
12597
|
-
if (key === 'post') {
|
|
12598
|
-
for (const field of ['read', 'write']) {
|
|
12599
|
-
if (declaration[field] !== undefined && typeof declaration[field] !== 'boolean') {
|
|
12600
|
-
throw new Error(`${itemLabel}.${field} 必须是 boolean`);
|
|
12601
|
-
}
|
|
12602
|
-
}
|
|
12603
|
-
if (declaration.enabled)
|
|
12604
|
-
permissions.post = { enabled: true, read: declaration.read === true, write: declaration.write === true };
|
|
12605
|
-
continue;
|
|
12606
|
-
}
|
|
12607
|
-
if (key === 'user_game_data') {
|
|
12608
|
-
// 即使声明关闭也校验资源清单:enabled:false 不能隐藏非法字段。
|
|
12609
|
-
const resources = parseUserGameDataResources(declaration.resources, itemLabel);
|
|
12610
|
-
if (!declaration.enabled)
|
|
12611
|
-
continue;
|
|
12612
|
-
permissions.user_game_data = { enabled: true, resources };
|
|
12613
|
-
continue;
|
|
12614
|
-
}
|
|
12615
|
-
if (!declaration.enabled)
|
|
12616
|
-
continue;
|
|
12617
|
-
permissions[key] = key === 'network' ? { enabled: true, useOfficialDomain } : { enabled: true };
|
|
12618
|
-
}
|
|
12619
|
-
return { declared: true, permissions: permissions };
|
|
12620
|
-
}
|
|
12621
|
-
/**
|
|
12622
|
-
* 校验 Manifest 中的精确资源清单。
|
|
12623
|
-
*
|
|
12624
|
-
* @param value - `user_game_data.resources`;必须显式提供对象,空对象表示不请求任何资源。
|
|
12625
|
-
* @param itemLabel - 报错时使用的字段路径。
|
|
12626
|
-
* @returns 按固定顺序输出的已发布资源与规范化用途。
|
|
12627
|
-
* @throws 非对象、未开放 key 或非法用途直接报错。
|
|
12628
|
-
*/
|
|
12629
|
-
function parseUserGameDataResources(value, itemLabel) {
|
|
12630
|
-
try {
|
|
12631
|
-
return parseUserGameDataResourceDeclarations(value);
|
|
12632
|
-
}
|
|
12633
|
-
catch (error) {
|
|
12634
|
-
throw new Error(`${itemLabel}.${error.message}`);
|
|
12635
|
-
}
|
|
12636
|
-
}
|
|
12637
|
-
function requiresExplicitPermissions(sdkVersion) {
|
|
12638
|
-
const parsed = semverExports.parse(sdkVersion);
|
|
12639
|
-
if (!parsed)
|
|
12640
|
-
throw new Error(`sdkVersion 必须是合法 SemVer:${sdkVersion}`);
|
|
12641
|
-
return parsed.major > 0 || parsed.minor >= 9;
|
|
12642
|
-
}
|
|
12643
|
-
function isRecord$3(value) {
|
|
12644
|
-
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
12645
|
-
}
|
|
12646
|
-
|
|
12647
12738
|
/**
|
|
12648
12739
|
* `package.json#heybox.platforms` 接受的平台值,顺序同时是 Manifest 的规范化输出顺序。
|
|
12649
12740
|
*
|
|
@@ -12698,6 +12789,7 @@ function renderMiniappManifest(manifest) {
|
|
|
12698
12789
|
const category = parseMiniappCategory(manifest.category, 'manifest.category');
|
|
12699
12790
|
const bindAppIds = parseMiniappBindAppIds(manifest.bindAppIds, { sourceLabel: 'manifest.bindAppIds' });
|
|
12700
12791
|
const desc = parseMiniappDesc(manifest.desc, 'manifest.desc');
|
|
12792
|
+
validateManifestRooms(manifest);
|
|
12701
12793
|
const output = {
|
|
12702
12794
|
version: manifest.version,
|
|
12703
12795
|
sdkVersion: manifest.sdkVersion,
|
|
@@ -12705,6 +12797,7 @@ function renderMiniappManifest(manifest) {
|
|
|
12705
12797
|
platforms,
|
|
12706
12798
|
...(manifest.permissions === undefined ? {} : { permissions: manifest.permissions }),
|
|
12707
12799
|
...(manifest.companions === undefined ? {} : { companions: manifest.companions }),
|
|
12800
|
+
...(manifest.roomDefinitions === undefined ? {} : { roomDefinitions: manifest.roomDefinitions }),
|
|
12708
12801
|
...(manifest.workspaceCards === undefined ? {} : { workspaceCards: manifest.workspaceCards }),
|
|
12709
12802
|
...(window === undefined ? {} : { window }),
|
|
12710
12803
|
...(bindAppIds.length === 0 ? {} : { bindAppIds }),
|
|
@@ -12814,6 +12907,14 @@ function getMiniappManifestVersionError(version) {
|
|
|
12814
12907
|
}
|
|
12815
12908
|
return undefined;
|
|
12816
12909
|
}
|
|
12910
|
+
function validateManifestRooms(manifest) {
|
|
12911
|
+
const refs = manifest.roomDefinitions;
|
|
12912
|
+
if (refs === undefined)
|
|
12913
|
+
return;
|
|
12914
|
+
assertRoomReferences(refs);
|
|
12915
|
+
if (Object.keys(refs).length && !manifest.permissions?.cloud_rooms?.enabled)
|
|
12916
|
+
throw new Error('Room 需要声明 cloud_rooms 权限');
|
|
12917
|
+
}
|
|
12817
12918
|
|
|
12818
12919
|
function findNearestPackageJsonPath(startDir) {
|
|
12819
12920
|
let current = path.resolve(startDir);
|
|
@@ -12928,6 +13029,22 @@ function readMiniappWorkspaceCardsFromPackageJson(root) {
|
|
|
12928
13029
|
const { packageJson, packageJsonPath } = readMiniappPackageJson(root, false);
|
|
12929
13030
|
return { declaration: readMiniappHeyboxConfig(packageJson)?.workspaceCards, projectRoot: path.dirname(packageJsonPath) };
|
|
12930
13031
|
}
|
|
13032
|
+
function readMiniappRoomDefinitionsFromBuild(root) {
|
|
13033
|
+
const filename = path.join(root, '.hb-sdk/rooms/references.json');
|
|
13034
|
+
if (!existsSync(filename))
|
|
13035
|
+
return undefined;
|
|
13036
|
+
try {
|
|
13037
|
+
const raw = readFileSync(filename);
|
|
13038
|
+
if (raw.length > 4096)
|
|
13039
|
+
throw new Error('Room 引用文件过大');
|
|
13040
|
+
const refs = JSON.parse(raw.toString('utf8'));
|
|
13041
|
+
assertRoomReferences(refs);
|
|
13042
|
+
return refs;
|
|
13043
|
+
}
|
|
13044
|
+
catch (cause) {
|
|
13045
|
+
throw new Error(`无法读取 Room 引用文件 ${filename},请重新运行 hb-sdk build:${formatReason(cause)}`, { cause });
|
|
13046
|
+
}
|
|
13047
|
+
}
|
|
12931
13048
|
|
|
12932
13049
|
/** 检查原生入口的文件格式与目标架构;文件后缀和执行位不能代替此门禁。 */
|
|
12933
13050
|
function assertCompanionExecutable(bytes, target) {
|
|
@@ -22655,6 +22772,11 @@ function miniappManifest() {
|
|
|
22655
22772
|
let companionArtifactAccessToken = parseDevAccessToken(process.env[HB_SDK_COMPANION_ARTIFACT_ACCESS_TOKEN_ENV]);
|
|
22656
22773
|
let miniProgramManifestAccessToken = parseDevAccessToken(process.env[HB_SDK_MINI_PROGRAM_MANIFEST_ACCESS_TOKEN_ENV]);
|
|
22657
22774
|
let root = process.cwd();
|
|
22775
|
+
let cloudRooms;
|
|
22776
|
+
function hasCloudRooms() {
|
|
22777
|
+
return cloudRooms ??= declaresCloudRooms(readMiniappPermissionsFromPackageJson(root, resolveSdkVersion()));
|
|
22778
|
+
}
|
|
22779
|
+
const privateRoomsDirectory = /(?:^|[\\/])\.hb-sdk[\\/]rooms[\\/]/;
|
|
22658
22780
|
let outDir = 'dist';
|
|
22659
22781
|
let command = 'build';
|
|
22660
22782
|
let resolvedConfig;
|
|
@@ -22665,6 +22787,21 @@ function miniappManifest() {
|
|
|
22665
22787
|
let priorBuildError;
|
|
22666
22788
|
return {
|
|
22667
22789
|
name: 'heybox-miniapp-manifest',
|
|
22790
|
+
resolveId(source) {
|
|
22791
|
+
if (privateRoomsDirectory.test(source) || (/\.room\.json(?:\?|$)/i.test(source) && hasCloudRooms()))
|
|
22792
|
+
throw new Error('私有 Room 规则不能导入客户端,请导入 generated/rooms/*.contract');
|
|
22793
|
+
return null;
|
|
22794
|
+
},
|
|
22795
|
+
generateBundle(_options, bundle) {
|
|
22796
|
+
for (const [name, file] of Object.entries(bundle)) {
|
|
22797
|
+
const source = file.code ?? (typeof file.source === 'string' ? file.source : file.source ? new TextDecoder().decode(file.source) : '');
|
|
22798
|
+
if (privateRoomsDirectory.test(name) || ((/\.room\.json$/i.test(name) || source.includes('hb-room-relay/1')) && hasCloudRooms())) {
|
|
22799
|
+
// generateBundle 发生在 buildEnd 之后,需保存此错误,防止 closeBundle 用缺文件覆盖它。
|
|
22800
|
+
priorBuildError = new Error('构建产物包含私有 Room 规则');
|
|
22801
|
+
throw priorBuildError;
|
|
22802
|
+
}
|
|
22803
|
+
}
|
|
22804
|
+
},
|
|
22668
22805
|
config(config, env) {
|
|
22669
22806
|
assertMiniappViteBase(config.base);
|
|
22670
22807
|
// command 在本钩子时序早于 configResolved,必须取自 env 命令而非闭包;
|
|
@@ -22697,6 +22834,7 @@ function miniappManifest() {
|
|
|
22697
22834
|
}
|
|
22698
22835
|
}
|
|
22699
22836
|
root = resolved.root;
|
|
22837
|
+
cloudRooms = undefined;
|
|
22700
22838
|
outDir = resolved.build.outDir;
|
|
22701
22839
|
command = resolved.command;
|
|
22702
22840
|
if (command === 'serve') {
|
|
@@ -23094,6 +23232,7 @@ function miniappManifest() {
|
|
|
23094
23232
|
const manifestPath = path.join(outputRoot, 'manifest.json');
|
|
23095
23233
|
const companions = prepareMiniappCompanions(companionDeclarations, { root: companionConfig.projectRoot, outputRoot, platforms });
|
|
23096
23234
|
mkdirSync(path.dirname(manifestPath), { recursive: true });
|
|
23235
|
+
const roomDefinitions = declaresCloudRooms(parsedPermissions) ? readMiniappRoomDefinitionsFromBuild(root) : undefined;
|
|
23097
23236
|
const manifestText = renderMiniappManifest({
|
|
23098
23237
|
...(desc === undefined ? {} : { desc }),
|
|
23099
23238
|
version,
|
|
@@ -23102,6 +23241,7 @@ function miniappManifest() {
|
|
|
23102
23241
|
...(category === undefined ? {} : { category }),
|
|
23103
23242
|
...(basicInfo === undefined ? {} : basicInfo),
|
|
23104
23243
|
...(parsedPermissions.permissions === undefined ? {} : { permissions: parsedPermissions.permissions }),
|
|
23244
|
+
...(roomDefinitions === undefined ? {} : { roomDefinitions }),
|
|
23105
23245
|
...(companions === undefined ? {} : { companions }),
|
|
23106
23246
|
...(workspaceCards === undefined ? {} : { workspaceCards }),
|
|
23107
23247
|
...(windowDeclaration === undefined ? {} : { window: windowDeclaration }),
|
|
@@ -23172,11 +23312,13 @@ async function prepareDevSnapshot(root, outDir, platforms, declarations, workspa
|
|
|
23172
23312
|
const sourcePath = path.join(snapshotRoot, ...artifactPath.split('/'));
|
|
23173
23313
|
artifacts.set(artifactPath, { path: artifactPath, size: lstatSync(sourcePath).size, sourcePath });
|
|
23174
23314
|
}
|
|
23315
|
+
const roomDefinitions = declaresCloudRooms({ permissions }) ? readMiniappRoomDefinitionsFromBuild(root) : undefined;
|
|
23175
23316
|
const manifest = {
|
|
23176
23317
|
version,
|
|
23177
23318
|
sdkVersion,
|
|
23178
23319
|
platforms,
|
|
23179
23320
|
...(permissions === undefined ? {} : { permissions }),
|
|
23321
|
+
...(roomDefinitions === undefined ? {} : { roomDefinitions }),
|
|
23180
23322
|
...(companions === undefined ? {} : { companions }),
|
|
23181
23323
|
...(workspaceCardsManifest === undefined ? {} : { workspaceCards: workspaceCardsManifest }),
|
|
23182
23324
|
...(windowDeclaration === undefined ? {} : { window: windowDeclaration }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heybox/hb-sdk",
|
|
3
|
-
"version": "0.10.0-alpha.
|
|
3
|
+
"version": "0.10.0-alpha.3",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"./src/index.ts",
|
|
6
6
|
"./src/core/singleton.ts",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"undici": "^7.28.0",
|
|
89
89
|
"ws": "^8.18.0",
|
|
90
90
|
"sharp": "^0.34.5",
|
|
91
|
-
"@heybox/hb-sdk-protocol": "0.10.0-alpha.
|
|
91
|
+
"@heybox/hb-sdk-protocol": "0.10.0-alpha.3"
|
|
92
92
|
},
|
|
93
93
|
"peerDependencies": {
|
|
94
94
|
"vite": ">=5"
|
|
@@ -140,14 +140,14 @@
|
|
|
140
140
|
"@ai-desktop/view-contract": "file:../hb-sdk-protocol/vendor/view-contract-2.2.2-6ac49bbf6410.tgz",
|
|
141
141
|
"rollup-plugin-dts": "6.4.0",
|
|
142
142
|
"playwright-core": "1.64.1",
|
|
143
|
-
"@heybox/hb-
|
|
144
|
-
"@heybox
|
|
143
|
+
"@heybox/hb-api": "~1.28.32",
|
|
144
|
+
"@heybox/hb-sdk-runtime": "~0.10.0-alpha.3",
|
|
145
145
|
"@heybox-domain/heybox-vue3-ui": "~0.1.0",
|
|
146
|
-
"@heybox/
|
|
146
|
+
"@heybox-domain/heybox-theme": "~0.1.0",
|
|
147
147
|
"@heybox/runtime": "~0.2.2",
|
|
148
148
|
"@heybox/runtime-security": "~0.2.2",
|
|
149
|
-
"@heybox/runtime-
|
|
150
|
-
"@heybox/runtime-
|
|
149
|
+
"@heybox/runtime-policy": "~0.2.2",
|
|
150
|
+
"@heybox/runtime-transport-fetch": "~0.2.2"
|
|
151
151
|
},
|
|
152
152
|
"publishConfig": {
|
|
153
153
|
"registry": "https://registry.npmjs.org/",
|
package/skill/skill.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hb-sdk",
|
|
3
|
-
"skillVersion": "0.10.0-alpha.
|
|
3
|
+
"skillVersion": "0.10.0-alpha.3+skill.9c416dfff7f4",
|
|
4
4
|
"sdk": {
|
|
5
5
|
"package": "@heybox/hb-sdk",
|
|
6
|
-
"version": "0.10.0-alpha.
|
|
7
|
-
"compatibility": "0.10.0-alpha.
|
|
6
|
+
"version": "0.10.0-alpha.3",
|
|
7
|
+
"compatibility": "0.10.0-alpha.3"
|
|
8
8
|
},
|
|
9
9
|
"distribution": {
|
|
10
10
|
"type": "npm",
|
|
11
11
|
"package": "@heybox/hb-sdk",
|
|
12
|
-
"version": "0.10.0-alpha.
|
|
12
|
+
"version": "0.10.0-alpha.3",
|
|
13
13
|
"path": "skill"
|
|
14
14
|
},
|
|
15
15
|
"integrity": "sha256-9c416dfff7f4a6fe4435d6a9e94a62be150a26b64b23cdcd06931c73e7afc94c"
|
package/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _heybox_hb_sdk_protocol from '@heybox/hb-sdk-protocol';
|
|
2
|
-
import { MiniProgramEventName, MiniProgramEventPayloadMap, MiniProgramBridgeError, MiniProgramRuntimeMode, MiniProgramOperatingSystemName, LoginScope as LoginScope$1, AccountState, MiniProgramUserInfoResult, ReadResult, ArkProfile, ArkGachaAnalysis, Page, GachaRecord, UserGameDataGameId, GameOverview, UserGameDataSavesOptions, UserGameDataSaveInfo, UserGameDataSaveFileInfo, SyncResult, BlackMythWukongSave, TaskBarHeroSave, PhantomBladeZeroSave, UserGameDataResourceKey, UserGameDataCancellationSignal, UserDataPermissionRequestResult, DataPermissionSnapshot, PcHardwareInfo, RequestFollowAuthorResult, GetFollowStatusResult, SetDisplayPayload, SetDisplayResult, WorkspaceCardsRefreshOptions, WorkspaceCardLaunchContext, GameSaveFileInfo as GameSaveFileInfo$1, GameSaveInfo as GameSaveInfo$1, GameSaveStructuredData, PostCommentListOptions, PostCommentPage, PostCommentEditorOptions, LinkedPost, PostChangeEvent, CompanionExit, CompanionNotificationCategory, CompanionPrepareProgress, CompanionTarget, CompanionCapability, CompanionInfo, CompanionPreparationStatus, ExecuteProtocolInput } from '@heybox/hb-sdk-protocol';
|
|
3
|
-
export { AccountState, ArkGachaAnalysis, ArkProfile, AuthorFollowStatus, AuthorizedUserInfo, BlackMythWukongSave, CompanionCapability, CompanionExit, CompanionInfo, CompanionNotificationCategory, CompanionPreparationStatus, CompanionPrepareProgress, CompanionTarget, ExecuteProtocolInput, ExecuteProtocolObject, ExecuteProtocolResult, GachaRecord, GameOverview, GameSaveStructuredData, GetFollowStatusResult, LinkedPost, MiniProgramDisplayState, MiniProgramEventName, MiniProgramEventPayloadMap, MiniProgramOperatingSystemName, MiniProgramOrientationMode, MiniProgramRuntimeMode, MiniProgramUserInfoResult, Page, PcHardwareInfo, PhantomBladeZeroSave, PostAuthor, PostChangeEvent, PostComment, PostCommentEditorOptions, PostCommentListOptions, PostCommentPage, PostContentBlock, PostImage, ReadMeta, ReadResult, RequestFollowAuthorResult, RequiredAction, RequiredActionDescriptor, ResourceOverview, SetDisplayPayload, SetDisplayResult, SyncResult, TaskBarHeroSave, USER_INFO_AUTHORIZATION_SCOPES, UserGameDataGameId, UserGameDataResourceKey, UserGameDataSaveFileInfo, UserGameDataSaveInfo, UserGameDataSavesOptions, UserInfoAuthorization, UserInfoAuthorizationScope, UserInfoAuthorizationStatus, WorkspaceCardLaunchContext, WorkspaceCardsRefreshOptions } from '@heybox/hb-sdk-protocol';
|
|
2
|
+
import { MiniProgramEventName, MiniProgramEventPayloadMap, MiniProgramBridgeError, MiniProgramRuntimeMode, MiniProgramOperatingSystemName, LoginScope as LoginScope$1, AccountState, MiniProgramUserInfoResult, ReadResult, ArkProfile, ArkGachaAnalysis, Page, GachaRecord, UserGameDataGameId, GameOverview, UserGameDataSavesOptions, UserGameDataSaveInfo, UserGameDataSaveFileInfo, SyncResult, BlackMythWukongSave, TaskBarHeroSave, PhantomBladeZeroSave, UserGameDataResourceKey, UserGameDataCancellationSignal, UserDataPermissionRequestResult, DataPermissionSnapshot, PcHardwareInfo, RequestFollowAuthorResult, GetFollowStatusResult, SetDisplayPayload, SetDisplayResult, RoomValue, RoomSendOptions, RoomSendResult, RoomEvent, RoomDefinition, RoomDirectoryPage, WorkspaceCardsRefreshOptions, WorkspaceCardLaunchContext, GameSaveFileInfo as GameSaveFileInfo$1, GameSaveInfo as GameSaveInfo$1, GameSaveStructuredData, PostCommentListOptions, PostCommentPage, PostCommentEditorOptions, LinkedPost, PostChangeEvent, CompanionExit, CompanionNotificationCategory, CompanionPrepareProgress, CompanionTarget, CompanionCapability, CompanionInfo, CompanionPreparationStatus, ExecuteProtocolInput } from '@heybox/hb-sdk-protocol';
|
|
3
|
+
export { AccountState, ArkGachaAnalysis, ArkProfile, AuthorFollowStatus, AuthorizedUserInfo, BlackMythWukongSave, CompanionCapability, CompanionExit, CompanionInfo, CompanionNotificationCategory, CompanionPreparationStatus, CompanionPrepareProgress, CompanionTarget, ExecuteProtocolInput, ExecuteProtocolObject, ExecuteProtocolResult, GachaRecord, GameOverview, GameSaveStructuredData, GetFollowStatusResult, LinkedPost, MiniProgramDisplayState, MiniProgramEventName, MiniProgramEventPayloadMap, MiniProgramOperatingSystemName, MiniProgramOrientationMode, MiniProgramRuntimeMode, MiniProgramUserInfoResult, Page, PcHardwareInfo, PhantomBladeZeroSave, PostAuthor, PostChangeEvent, PostComment, PostCommentEditorOptions, PostCommentListOptions, PostCommentPage, PostContentBlock, PostImage, ReadMeta, ReadResult, RequestFollowAuthorResult, RequiredAction, RequiredActionDescriptor, ResourceOverview, RoomActionDefinition, RoomActionEvent, RoomDefinition, RoomDirectoryPage, RoomEvent, RoomInfo, RoomListOptions, RoomMember, RoomProtocol, RoomReceipt, RoomSchema, RoomSendOptions, RoomSendResult, RoomSnapshot, RoomStatus, RoomTransportEvent, RoomValue, SetDisplayPayload, SetDisplayResult, SyncResult, TaskBarHeroSave, USER_INFO_AUTHORIZATION_SCOPES, UserGameDataGameId, UserGameDataResourceKey, UserGameDataSaveFileInfo, UserGameDataSaveInfo, UserGameDataSavesOptions, UserInfoAuthorization, UserInfoAuthorizationScope, UserInfoAuthorizationStatus, WorkspaceCardLaunchContext, WorkspaceCardsRefreshOptions } from '@heybox/hb-sdk-protocol';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* 小程序生命周期或业务事件监听函数。
|
|
@@ -4470,6 +4470,78 @@ interface MiniProgramViewportModule {
|
|
|
4470
4470
|
setNavigationBarStyle(options: MiniProgramSetNavigationBarStyleOptions): Promise<SetNavigationBarStyleResult>;
|
|
4471
4471
|
}
|
|
4472
4472
|
|
|
4473
|
+
type RoomActions = Record<string, unknown>;
|
|
4474
|
+
interface CloudRoom<A extends RoomActions = Record<string, Record<string, RoomValue>>> {
|
|
4475
|
+
readonly id: string;
|
|
4476
|
+
readonly code: string;
|
|
4477
|
+
readonly memberId: string;
|
|
4478
|
+
/** 服务端提交动作后返回消息 ID。 */
|
|
4479
|
+
send<K extends keyof A & string>(action: K, params: A[K], options?: RoomSendOptions): Promise<RoomSendResult>;
|
|
4480
|
+
/** 默认接收全部事件。只监听成员或状态时,待交付动作继续留给动作监听者。 */
|
|
4481
|
+
on(handler: (event: RoomEvent<A>) => void, type?: RoomEvent['type']): () => void;
|
|
4482
|
+
/** 当前成员退出,释放其全部连接。 */
|
|
4483
|
+
leave(): Promise<void>;
|
|
4484
|
+
}
|
|
4485
|
+
interface MiniProgramCloudRoomsModule {
|
|
4486
|
+
/**
|
|
4487
|
+
* 分页发现同一房间协议的公开房间。
|
|
4488
|
+
* @since 0.10.0
|
|
4489
|
+
* @hbPlatform android
|
|
4490
|
+
* @hbPlatform ios
|
|
4491
|
+
* @hbPlatform ohos
|
|
4492
|
+
* @hbPlatform windows
|
|
4493
|
+
* @hbPlatform macos
|
|
4494
|
+
* @hbClient android none
|
|
4495
|
+
* @hbClient ios none
|
|
4496
|
+
* @hbClient ohos none
|
|
4497
|
+
* @hbClient windows none
|
|
4498
|
+
* @hbClient macos none
|
|
4499
|
+
* @experimental
|
|
4500
|
+
*/
|
|
4501
|
+
list(options: {
|
|
4502
|
+
definition: RoomDefinition;
|
|
4503
|
+
cursor?: string;
|
|
4504
|
+
}): Promise<RoomDirectoryPage>;
|
|
4505
|
+
/**
|
|
4506
|
+
* 创建并加入房间。
|
|
4507
|
+
* @since 0.10.0
|
|
4508
|
+
* @hbPlatform android
|
|
4509
|
+
* @hbPlatform ios
|
|
4510
|
+
* @hbPlatform ohos
|
|
4511
|
+
* @hbPlatform windows
|
|
4512
|
+
* @hbPlatform macos
|
|
4513
|
+
* @hbClient android none
|
|
4514
|
+
* @hbClient ios none
|
|
4515
|
+
* @hbClient ohos none
|
|
4516
|
+
* @hbClient windows none
|
|
4517
|
+
* @hbClient macos none
|
|
4518
|
+
* @experimental
|
|
4519
|
+
*/
|
|
4520
|
+
create<A extends RoomActions>(options: {
|
|
4521
|
+
definition: RoomDefinition<A>;
|
|
4522
|
+
visibility?: 'invite' | 'public';
|
|
4523
|
+
}): Promise<CloudRoom<A>>;
|
|
4524
|
+
/**
|
|
4525
|
+
* 加入同一房间协议的房间。
|
|
4526
|
+
* @since 0.10.0
|
|
4527
|
+
* @hbPlatform android
|
|
4528
|
+
* @hbPlatform ios
|
|
4529
|
+
* @hbPlatform ohos
|
|
4530
|
+
* @hbPlatform windows
|
|
4531
|
+
* @hbPlatform macos
|
|
4532
|
+
* @hbClient android none
|
|
4533
|
+
* @hbClient ios none
|
|
4534
|
+
* @hbClient ohos none
|
|
4535
|
+
* @hbClient windows none
|
|
4536
|
+
* @hbClient macos none
|
|
4537
|
+
* @experimental
|
|
4538
|
+
*/
|
|
4539
|
+
join<A extends RoomActions>(options: {
|
|
4540
|
+
definition: RoomDefinition<A>;
|
|
4541
|
+
code: string;
|
|
4542
|
+
}): Promise<CloudRoom<A>>;
|
|
4543
|
+
}
|
|
4544
|
+
|
|
4473
4545
|
/** 工作区卡片前台模块;调用不会创建新的工作区。 */
|
|
4474
4546
|
interface WorkspaceCardsModule {
|
|
4475
4547
|
/**
|
|
@@ -5483,6 +5555,7 @@ interface MiniProgramCloudStorageModule {
|
|
|
5483
5555
|
}
|
|
5484
5556
|
/** 外部小程序可调用的云端能力模块。 */
|
|
5485
5557
|
interface MiniProgramCloudModule {
|
|
5558
|
+
rooms: MiniProgramCloudRoomsModule;
|
|
5486
5559
|
leaderboard: MiniProgramCloudLeaderboardModule;
|
|
5487
5560
|
storage: MiniProgramCloudStorageModule;
|
|
5488
5561
|
}
|
|
@@ -8607,4 +8680,4 @@ declare const hbSDK: {
|
|
|
8607
8680
|
};
|
|
8608
8681
|
|
|
8609
8682
|
export { HbMiniProgramNetworkError, HbMiniProgramSDKError, auth, cloud, companion, hbSDK as default, device, environment, files, gameSaves, getHandshakeState, media, navigation, network, off, on, onHandshakeStateChange, post, share, storage, ui, user, viewport, workspaceCards };
|
|
8610
|
-
export type { ArkGameModule, ClosePayload, CloseResult, CompanionAttachments, CompanionExitHandler, CompanionNotification, CompanionNotifications, CompanionOutputHandler, CompanionOwnershipLostHandler, CompanionPrepareOptions, CompanionSession, CompanionState, CompanionStateChangeHandler, CompanionStdio, CopyLinkPayload, CopyLinkResult, CreateOptions, DeleteCurrentUserLeaderboardEntryPayload, DeleteCurrentUserLeaderboardEntryResult, DirectoryHandle, DownloadBaseOptions, DownloadOptions, DownloadProgress, FileHandle, FileMode, FileStat, FileSystem, FileSystemEntity, FilesModule, GameSaveFileInfo, GameSaveInfo, GameSavesFileOptions, GameSavesModule, GameSavesSyncOptions, GetCurrentUserLeaderboardEntryPayload, GetCurrentUserLeaderboardEntryResult, GetLeaderboardInfoPayload, GetLeaderboardInfoResult, GetLeaderboardListPayload, GetLeaderboardListResult, GetSteamGameListOptions, GetSteamGameListPayload, GetSteamGameListResult, GetStoragePayload, GetStorageResult, GetUserInfoPayload, GetUserInfoResult, GetWindowInfoPayload, GetWindowInfoResult, HideLoadingPayload, HideLoadingResult, LeaderboardEntry, LeaderboardOrder, ListOptions, LoginOptions, LoginPayload, LoginResult, LoginScope, MediaImageItem, MediaItem, MediaModule, MediaSelectionType, MediaType, MediaVideoItem, MiniProgramAppPageTarget, MiniProgramAuthModule, MiniProgramCloudLeaderboardModule, MiniProgramCloudModule, MiniProgramCloudStorageModule, MiniProgramCompanionModule, MiniProgramCopyLinkOptions, MiniProgramDeviceModule, MiniProgramEnvironmentInfo, MiniProgramEnvironmentModule, MiniProgramEventHandler, MiniProgramGameDetailGameType, MiniProgramGameDetailPage, MiniProgramNavigationBarForegroundStyle, MiniProgramNavigationModule, MiniProgramNetworkHeaders, MiniProgramNetworkModule, MiniProgramNetworkParams, MiniProgramNetworkRequestConfig, MiniProgramNetworkRequestMethod, MiniProgramNetworkResponse, MiniProgramNetworkValidateStatus, MiniProgramSDKHandshakeState, MiniProgramSDKHandshakeStateHandler, MiniProgramSafeArea, MiniProgramScreenshotElementOptions, MiniProgramScreenshotOptions, MiniProgramScreenshotRect, MiniProgramSetNavigationBarStyleOptions, MiniProgramShareChannel, MiniProgramShareExtraValue, MiniProgramShareModule, MiniProgramSharePostOptions, MiniProgramShowShareMenuOptions, MiniProgramStorageModule, MiniProgramToastStatus, MiniProgramUiModule, MiniProgramUserModule, MiniProgramVibrateIntensity, MiniProgramViewportModule, MiniProgramWindowInfoResult, NetworkRequestPayload, NetworkResponsePayload, OpenAppPageOptions, OpenAppPagePayload, OpenAppPageResult, OpenGameDetailAppPageOptions, OpenGameDetailAppPagePayload, OpenMiniProgramAppPageOptions, OpenMiniProgramAppPagePayload, OpenPostDetailAppPageOptions, OpenPostDetailAppPagePayload, OpenUserDetailAppPageOptions, OpenUserDetailAppPagePayload, PathRoot, PickDirectoryOptions, PickFilesOptions, PickMediaOptions, PostCommentsModule, PostModule, ReloadPayload, ReloadResult, RemoveOptions, RevokeAuthorizationPayload, RevokeAuthorizationResult, SaveFileOptions, ScreenshotPayload, ScreenshotResult, SetClipboardPayload, SetClipboardResult, SetNavigationBarStylePayload, SetNavigationBarStyleResult, SetStoragePayload, ShowLoadingPayload, ShowLoadingResult, ShowShareMenuPayload, ShowShareMenuResult, ShowToastPayload, ShowToastResult, SteamGameListData, SteamGameListItem, SteamGameListSort, SubmitLeaderboardEntryPayload, SubmitLeaderboardEntryResult, UploadBaseOptions, UploadOptions, UploadProgress, UploadResponse, UserDataPermissionModule, UserGameSaveFileInfo, UserGameSaveFileOptions, UserGameSaveInfo, UserGameSavesModule, UserGamesGachaRecordsOptions, UserGamesModule, UserGamesOverviewOptions, UserGamesProfileOptions, UserSaveGameModule, VibratePayload, VibrateResult, WorkspaceCardsModule };
|
|
8683
|
+
export type { ArkGameModule, ClosePayload, CloseResult, CloudRoom, CompanionAttachments, CompanionExitHandler, CompanionNotification, CompanionNotifications, CompanionOutputHandler, CompanionOwnershipLostHandler, CompanionPrepareOptions, CompanionSession, CompanionState, CompanionStateChangeHandler, CompanionStdio, CopyLinkPayload, CopyLinkResult, CreateOptions, DeleteCurrentUserLeaderboardEntryPayload, DeleteCurrentUserLeaderboardEntryResult, DirectoryHandle, DownloadBaseOptions, DownloadOptions, DownloadProgress, FileHandle, FileMode, FileStat, FileSystem, FileSystemEntity, FilesModule, GameSaveFileInfo, GameSaveInfo, GameSavesFileOptions, GameSavesModule, GameSavesSyncOptions, GetCurrentUserLeaderboardEntryPayload, GetCurrentUserLeaderboardEntryResult, GetLeaderboardInfoPayload, GetLeaderboardInfoResult, GetLeaderboardListPayload, GetLeaderboardListResult, GetSteamGameListOptions, GetSteamGameListPayload, GetSteamGameListResult, GetStoragePayload, GetStorageResult, GetUserInfoPayload, GetUserInfoResult, GetWindowInfoPayload, GetWindowInfoResult, HideLoadingPayload, HideLoadingResult, LeaderboardEntry, LeaderboardOrder, ListOptions, LoginOptions, LoginPayload, LoginResult, LoginScope, MediaImageItem, MediaItem, MediaModule, MediaSelectionType, MediaType, MediaVideoItem, MiniProgramAppPageTarget, MiniProgramAuthModule, MiniProgramCloudLeaderboardModule, MiniProgramCloudModule, MiniProgramCloudRoomsModule, MiniProgramCloudStorageModule, MiniProgramCompanionModule, MiniProgramCopyLinkOptions, MiniProgramDeviceModule, MiniProgramEnvironmentInfo, MiniProgramEnvironmentModule, MiniProgramEventHandler, MiniProgramGameDetailGameType, MiniProgramGameDetailPage, MiniProgramNavigationBarForegroundStyle, MiniProgramNavigationModule, MiniProgramNetworkHeaders, MiniProgramNetworkModule, MiniProgramNetworkParams, MiniProgramNetworkRequestConfig, MiniProgramNetworkRequestMethod, MiniProgramNetworkResponse, MiniProgramNetworkValidateStatus, MiniProgramSDKHandshakeState, MiniProgramSDKHandshakeStateHandler, MiniProgramSafeArea, MiniProgramScreenshotElementOptions, MiniProgramScreenshotOptions, MiniProgramScreenshotRect, MiniProgramSetNavigationBarStyleOptions, MiniProgramShareChannel, MiniProgramShareExtraValue, MiniProgramShareModule, MiniProgramSharePostOptions, MiniProgramShowShareMenuOptions, MiniProgramStorageModule, MiniProgramToastStatus, MiniProgramUiModule, MiniProgramUserModule, MiniProgramVibrateIntensity, MiniProgramViewportModule, MiniProgramWindowInfoResult, NetworkRequestPayload, NetworkResponsePayload, OpenAppPageOptions, OpenAppPagePayload, OpenAppPageResult, OpenGameDetailAppPageOptions, OpenGameDetailAppPagePayload, OpenMiniProgramAppPageOptions, OpenMiniProgramAppPagePayload, OpenPostDetailAppPageOptions, OpenPostDetailAppPagePayload, OpenUserDetailAppPageOptions, OpenUserDetailAppPagePayload, PathRoot, PickDirectoryOptions, PickFilesOptions, PickMediaOptions, PostCommentsModule, PostModule, ReloadPayload, ReloadResult, RemoveOptions, RevokeAuthorizationPayload, RevokeAuthorizationResult, RoomActions, SaveFileOptions, ScreenshotPayload, ScreenshotResult, SetClipboardPayload, SetClipboardResult, SetNavigationBarStylePayload, SetNavigationBarStyleResult, SetStoragePayload, ShowLoadingPayload, ShowLoadingResult, ShowShareMenuPayload, ShowShareMenuResult, ShowToastPayload, ShowToastResult, SteamGameListData, SteamGameListItem, SteamGameListSort, SubmitLeaderboardEntryPayload, SubmitLeaderboardEntryResult, UploadBaseOptions, UploadOptions, UploadProgress, UploadResponse, UserDataPermissionModule, UserGameSaveFileInfo, UserGameSaveFileOptions, UserGameSaveInfo, UserGameSavesModule, UserGamesGachaRecordsOptions, UserGamesModule, UserGamesOverviewOptions, UserGamesProfileOptions, UserSaveGameModule, VibratePayload, VibrateResult, WorkspaceCardsModule };
|