@heybox/hb-sdk 0.9.9-alpha.0 → 0.9.9-alpha.2
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 +16 -0
- package/README.md +2 -0
- package/dist/cli-chunks/{build-Vi5Zyplz.cjs → build-BlDpuz8v.cjs} +5 -5
- package/dist/cli-chunks/{create-Cfz1IcYf.cjs → create-BQbqb-ph.cjs} +2 -2
- package/dist/cli-chunks/{dev-C2dtgF42.cjs → dev-U8fYtFNt.cjs} +15 -10
- package/dist/cli-chunks/{doctor-D-zMCLIA.cjs → doctor-CGJfat87.cjs} +1 -1
- package/dist/cli-chunks/{game-binding-guide-z3X6h8ck.cjs → game-binding-guide-C0fNljyC.cjs} +3 -3
- package/dist/cli-chunks/{game-bindings-DiVP8PdD.cjs → game-bindings-Dun_g-3H.cjs} +4 -4
- package/dist/cli-chunks/{games-THhcga6y.cjs → games-C6qjqKus.cjs} +1 -1
- package/dist/cli-chunks/{index-BuYCoach.cjs → index-D9duvEkQ.cjs} +1 -1
- package/dist/cli-chunks/{index-H9U6-mLY.cjs → index-DcyYtbXh.cjs} +40 -25
- package/dist/cli-chunks/{index.esm-XiyiK7eH.cjs → index.esm-CdNQ_kHI.cjs} +9 -9
- package/dist/cli-chunks/{index.esm-D8lqHXUQ.cjs → index.esm-CenYK5Bl.cjs} +72 -3
- package/dist/cli-chunks/{login-Bw_1UJ8i.cjs → login-P7RtNdwf.cjs} +1 -1
- package/dist/cli-chunks/{project-vite-CFfq-fV7.cjs → project-vite-BH7q_pzh.cjs} +1 -1
- package/dist/cli-chunks/{remote-CU88U8t8.cjs → remote-D39sRE7v.cjs} +142 -26
- package/dist/cli-chunks/{runtime-permission-env-BtxzR-dv.cjs → runtime-permission-env-CZNyFKnx.cjs} +24 -4
- package/dist/cli-chunks/{skill-7RZJxGDO.cjs → skill-Dm6lUW7l.cjs} +2 -2
- package/dist/cli-chunks/{version-COTSItDf.cjs → version-7t_EYjo_.cjs} +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/devtools/browser-dev-host/assets/browser-dev-host-D52x803m.js +224 -0
- package/dist/devtools/browser-dev-host/assets/{desktop-app-launch-az2quV7I.js → desktop-app-launch-BNPRuxe6.js} +1 -1
- package/dist/devtools/browser-dev-host/assets/{index-o5r5oqtq.js → index-t_066TMb.js} +3 -3
- package/dist/devtools/browser-dev-host/index.html +2 -2
- package/dist/index.cjs.js +149 -4
- package/dist/index.esm.js +149 -5
- package/dist/miniapp-publish.cjs.js +64 -1
- package/dist/miniapp-publish.esm.js +63 -2
- package/dist/protocol.cjs.js +51 -5
- package/dist/protocol.esm.js +51 -5
- package/dist/vite.cjs.js +59 -2
- package/dist/vite.esm.js +59 -2
- package/package.json +7 -7
- package/skill/skill.json +4 -4
- package/types/index.d.ts +140 -4
- package/types/miniapp-publish/index.d.ts +14 -3
- package/dist/devtools/browser-dev-host/assets/browser-dev-host-CHdD15qt.js +0 -221
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index_esm = require('./index.esm-
|
|
4
|
-
var runtimePermissionEnv = require('./runtime-permission-env-
|
|
3
|
+
var index_esm = require('./index.esm-CenYK5Bl.cjs');
|
|
4
|
+
var runtimePermissionEnv = require('./runtime-permission-env-CZNyFKnx.cjs');
|
|
5
5
|
var node_crypto = require('node:crypto');
|
|
6
6
|
var fs = require('node:fs/promises');
|
|
7
7
|
var path = require('node:path');
|
|
8
8
|
var fs$1 = require('node:fs');
|
|
9
9
|
var sharp = require('sharp');
|
|
10
|
-
var gameBindingGuide = require('./game-binding-guide-
|
|
10
|
+
var gameBindingGuide = require('./game-binding-guide-C0fNljyC.cjs');
|
|
11
11
|
var promises = require('node:readline/promises');
|
|
12
|
-
var index = require('./index-
|
|
12
|
+
var index = require('./index-DcyYtbXh.cjs');
|
|
13
13
|
var childProcess = require('node:child_process');
|
|
14
14
|
require('node:zlib');
|
|
15
15
|
|
|
@@ -509,7 +509,7 @@ function createDefaultCosClient(uploadToken, COS) {
|
|
|
509
509
|
};
|
|
510
510
|
}
|
|
511
511
|
async function loadCosConstructor() {
|
|
512
|
-
const cosModule = await Promise.resolve().then(function () { return require('./index-
|
|
512
|
+
const cosModule = await Promise.resolve().then(function () { return require('./index-D9duvEkQ.cjs'); }).then(function (n) { return n.index; });
|
|
513
513
|
return cosModule.default;
|
|
514
514
|
}
|
|
515
515
|
function formatSize(bytes) {
|
|
@@ -578,6 +578,9 @@ async function computeMiniappArtifactReceipt(files, runtime = {}) {
|
|
|
578
578
|
|
|
579
579
|
function createRemoteApiClient(options) {
|
|
580
580
|
return {
|
|
581
|
+
getPostBinding: (request) => remoteGet(runtimePermissionEnv.USER_MINIPROGRAM_POST_BINDING_API_PATH, request, options),
|
|
582
|
+
previewPostBinding: (request) => remotePostForm(runtimePermissionEnv.USER_MINIPROGRAM_POST_PREVIEW_API_PATH, request, options),
|
|
583
|
+
setPostBinding: (request) => remotePostForm(`${runtimePermissionEnv.USER_MINIPROGRAM_POST_BINDING_API_PATH}/update`, request, options),
|
|
581
584
|
listPermissionApplications: (request) => remoteGet(runtimePermissionEnv.LIST_USER_MINIPROGRAM_PERMISSION_APPLICATION_API_PATH, request, options),
|
|
582
585
|
submitPermissionApplication: (request) => remotePostForm(runtimePermissionEnv.SUBMIT_USER_MINIPROGRAM_PERMISSION_APPLICATION_API_PATH, request, options),
|
|
583
586
|
listDeveloperEntities: () => listDeveloperEntities(options),
|
|
@@ -648,7 +651,9 @@ async function precheckUserMiniprogramVersion(options, runtime) {
|
|
|
648
651
|
}
|
|
649
652
|
async function submitUserMiniprogramAudit(options, runtime) {
|
|
650
653
|
return remotePostForm(runtimePermissionEnv.SUBMIT_USER_MINIPROGRAM_AUDIT_API_PATH, {
|
|
651
|
-
mini_program_id: options.mini_program_id,
|
|
654
|
+
mini_program_id: options.mini_program_id,
|
|
655
|
+
session_id: options.session_id,
|
|
656
|
+
preflight_token: options.preflight_token,
|
|
652
657
|
}, runtime);
|
|
653
658
|
}
|
|
654
659
|
async function getVersionPreviewInfo(options, runtime) {
|
|
@@ -877,12 +882,12 @@ function createDevRuntimePermissions(snapshot, state, useOfficialDomain) {
|
|
|
877
882
|
status: state.networkRequest.status,
|
|
878
883
|
config: { useOfficialDomain },
|
|
879
884
|
}
|
|
880
|
-
: key === 'user_game_data'
|
|
885
|
+
: key === 'user_game_data' || key === 'post'
|
|
881
886
|
? {
|
|
882
887
|
key,
|
|
883
888
|
status: entry.status,
|
|
884
|
-
//
|
|
885
|
-
config: {
|
|
889
|
+
// 浏览器模拟不能丢掉资源清单或关联帖的读写声明。
|
|
890
|
+
config: { ...entry.config },
|
|
886
891
|
}
|
|
887
892
|
: {
|
|
888
893
|
key,
|
|
@@ -1433,12 +1438,48 @@ function suggestNextPatchVersion(version) {
|
|
|
1433
1438
|
return `${matched[1]}.${matched[2]}.${Number(matched[3]) + 1}`;
|
|
1434
1439
|
}
|
|
1435
1440
|
|
|
1441
|
+
const MAX_POST_ID = 9223372036854775807n;
|
|
1442
|
+
function isPostId(value) {
|
|
1443
|
+
return /^[1-9]\d{0,18}$/.test(value) && BigInt(value) <= MAX_POST_ID;
|
|
1444
|
+
}
|
|
1445
|
+
/** 只提取官方链接里的帖子标识,编码 ID 由后端解码校验。 */
|
|
1446
|
+
function parsePostReference(value) {
|
|
1447
|
+
const input = value.trim();
|
|
1448
|
+
if (isPostId(input))
|
|
1449
|
+
return input;
|
|
1450
|
+
let url;
|
|
1451
|
+
try {
|
|
1452
|
+
url = new URL(input);
|
|
1453
|
+
}
|
|
1454
|
+
catch {
|
|
1455
|
+
throw new Error('请提供有效的帖子 ID 或小黑盒帖子链接');
|
|
1456
|
+
}
|
|
1457
|
+
if (!['https:', 'http:'].includes(url.protocol) ||
|
|
1458
|
+
url.username ||
|
|
1459
|
+
url.password ||
|
|
1460
|
+
url.port ||
|
|
1461
|
+
!['api.xiaoheihe.cn', 'www.xiaoheihe.cn', 'web.xiaoheihe.cn', 'heybox.debugmode.cn', 'web.debugmode.cn'].includes(url.hostname)) {
|
|
1462
|
+
throw new Error('请提供小黑盒官方帖子链接');
|
|
1463
|
+
}
|
|
1464
|
+
const reference = url.pathname === '/v3/bbs/app/api/web/share' ? url.searchParams.get('link_id') : /^\/app\/bbs\/link\/([a-zA-Z0-9]+)\/?$/.exec(url.pathname)?.[1];
|
|
1465
|
+
if (!reference)
|
|
1466
|
+
throw new Error('帖子链接中没有有效的帖子 ID');
|
|
1467
|
+
if (isPostId(reference) || /^[0-9a-f]{5,20}$/.test(reference))
|
|
1468
|
+
return reference;
|
|
1469
|
+
throw new Error('帖子链接中的 ID 格式无效,请重新复制帖子链接');
|
|
1470
|
+
}
|
|
1471
|
+
|
|
1436
1472
|
async function runRemoteCommand(options, runtime = {}) {
|
|
1437
1473
|
if (options.command === 'deploy') {
|
|
1438
1474
|
return runRemoteDeployCommand(options, runtime);
|
|
1439
1475
|
}
|
|
1440
1476
|
const context = await createRemoteCommandContext(options, runtime);
|
|
1441
1477
|
switch (options.command) {
|
|
1478
|
+
case 'post:get':
|
|
1479
|
+
case 'post:preview':
|
|
1480
|
+
case 'post:bind':
|
|
1481
|
+
case 'post:unbind':
|
|
1482
|
+
return remotePostBinding(options, context, runtime);
|
|
1442
1483
|
case 'permission:list':
|
|
1443
1484
|
return remotePermissionList(options, context, runtime);
|
|
1444
1485
|
case 'permission:apply':
|
|
@@ -1555,6 +1596,13 @@ async function createRemoteCommandContext(options, runtime) {
|
|
|
1555
1596
|
}
|
|
1556
1597
|
function adaptRemoteApiClient(api) {
|
|
1557
1598
|
return {
|
|
1599
|
+
getPostBinding: (miniProgramId) => api.getPostBinding({ mini_program_id: miniProgramId }),
|
|
1600
|
+
previewPostBinding: ({ miniProgramId, postId }) => api.previewPostBinding({ mini_program_id: miniProgramId, post_id: postId }),
|
|
1601
|
+
setPostBinding: ({ miniProgramId, postId, expectedRevision }) => api.setPostBinding({
|
|
1602
|
+
mini_program_id: miniProgramId,
|
|
1603
|
+
post_id: postId,
|
|
1604
|
+
expected_revision: expectedRevision,
|
|
1605
|
+
}),
|
|
1558
1606
|
listPermissionApplications: (miniProgramId) => api.listPermissionApplications({ mini_program_id: miniProgramId }),
|
|
1559
1607
|
submitPermissionApplication: ({ miniProgramId, key, reason, domains }) => api.submitPermissionApplication({ mini_program_id: miniProgramId, permission_key: key, reason, domains }),
|
|
1560
1608
|
accessStatus: () => api.getDeveloperAccessStatus(),
|
|
@@ -1721,6 +1769,36 @@ async function remoteBind(options, context, runtime) {
|
|
|
1721
1769
|
}
|
|
1722
1770
|
return finishRemoteCommand(options, runtime, output);
|
|
1723
1771
|
}
|
|
1772
|
+
async function remotePostBinding(options, context, runtime) {
|
|
1773
|
+
const miniProgramId = requireBinding(context);
|
|
1774
|
+
if (options.command === 'post:get') {
|
|
1775
|
+
const result = await context.api.getPostBinding(miniProgramId);
|
|
1776
|
+
if (!options.json)
|
|
1777
|
+
context.logger.info(`关联帖子:${result.post_id || '未绑定'}`);
|
|
1778
|
+
return finishRemoteCommand(options, runtime, {
|
|
1779
|
+
changed: false,
|
|
1780
|
+
miniProgramId,
|
|
1781
|
+
binding: { postId: result.post_id },
|
|
1782
|
+
});
|
|
1783
|
+
}
|
|
1784
|
+
const postId = options.command === 'post:unbind' ? '' : parsePostReference(requireNonEmpty(options.postId, '必须传入帖子 ID 或链接'));
|
|
1785
|
+
if (options.command === 'post:preview') {
|
|
1786
|
+
const result = await context.api.previewPostBinding({ miniProgramId, postId });
|
|
1787
|
+
if (!options.json)
|
|
1788
|
+
context.logger.info(`${result.title || '无标题帖子'}(${result.post_id}),作者:${result.author_name}`);
|
|
1789
|
+
return finishRemoteCommand(options, runtime, { changed: false, miniProgramId, post: toCamelCaseDeep(result) });
|
|
1790
|
+
}
|
|
1791
|
+
await assertBoundMiniProgramEntityMatchesCurrent(context, miniProgramId);
|
|
1792
|
+
const binding = await context.api.getPostBinding(miniProgramId);
|
|
1793
|
+
const expectedRevision = binding.revision;
|
|
1794
|
+
if (typeof expectedRevision !== 'string' || !/^(0|[1-9]\d{0,18})$/.test(expectedRevision) || BigInt(expectedRevision) >= 9223372036854775807n) {
|
|
1795
|
+
throw new Error('当前关联信息无效,请稍后重试');
|
|
1796
|
+
}
|
|
1797
|
+
const result = await context.api.setPostBinding({ miniProgramId, postId, expectedRevision });
|
|
1798
|
+
if (!options.json)
|
|
1799
|
+
context.logger.success(postId ? `已关联帖子:${postId}` : '已解除关联');
|
|
1800
|
+
return finishRemoteCommand(options, runtime, { changed: true, miniProgramId, binding: { postId: result.post_id } });
|
|
1801
|
+
}
|
|
1724
1802
|
/** 工作台扫码只读取版本和协议,复用认证与项目绑定,避免图片比对和详情输出。 */
|
|
1725
1803
|
async function readRemoteMiniProgramPreview(options, runtime = {}) {
|
|
1726
1804
|
const context = await createRemoteCommandContext({ env: options.env }, runtime);
|
|
@@ -1751,7 +1829,20 @@ async function remoteInfo(options, context, runtime) {
|
|
|
1751
1829
|
const removed = currentBindApps.filter((item) => !localIDs.has(item.appid));
|
|
1752
1830
|
const bindings = { local, current: currentBindApps, added, removed };
|
|
1753
1831
|
const basicInfo = await compareBasicInfo(context.packageJson.projectRoot, detail, runtime.fetchImpl);
|
|
1754
|
-
const output = {
|
|
1832
|
+
const output = {
|
|
1833
|
+
changed: false,
|
|
1834
|
+
miniProgramId,
|
|
1835
|
+
detail: toCamelCaseDeep(detail),
|
|
1836
|
+
permissions: permissionViews,
|
|
1837
|
+
permissionSources: {
|
|
1838
|
+
localDeclaration: localPermissions.permissions ?? null,
|
|
1839
|
+
onlineManifest: detail.manifest ?? null,
|
|
1840
|
+
onlineRuntimeSnapshot: detail.effective_runtime_permissions ?? null,
|
|
1841
|
+
platformApprovals: detail.runtime_permissions ?? null,
|
|
1842
|
+
},
|
|
1843
|
+
bindings,
|
|
1844
|
+
basicInfo,
|
|
1845
|
+
};
|
|
1755
1846
|
if (!options.json)
|
|
1756
1847
|
context.logger.info(`版本资料:${basicInfo.status}`);
|
|
1757
1848
|
if (!options.json) {
|
|
@@ -1798,11 +1889,11 @@ async function remotePermissionList(options, context, runtime) {
|
|
|
1798
1889
|
const localPermissions = runtimePermissionEnv.readMiniappPermissionsFromPackageJson(context.packageJson.projectRoot, runtimePermissionEnv.resolveMiniappSdkVersion());
|
|
1799
1890
|
const { views } = runtimePermissionEnv.composeMiniappRuntimePermissions(localPermissions, result.runtime_permissions, detail.party_type);
|
|
1800
1891
|
if (!options.json) {
|
|
1801
|
-
for (const view of views.filter(entry => entry.access === 'platform-approval')) {
|
|
1802
|
-
const item = result.items.find(entry => entry.permission_key === view.key);
|
|
1892
|
+
for (const view of views.filter((entry) => entry.access === 'platform-approval')) {
|
|
1893
|
+
const item = result.items.find((entry) => entry.permission_key === view.key);
|
|
1803
1894
|
const application = item?.latest_application;
|
|
1804
|
-
const name = item?.permission_name ?? index_esm.MINI_PROGRAM_PERMISSION_CATALOG.find(entry => entry.key === view.key)?.name ?? view.key;
|
|
1805
|
-
const approval = result.runtime_permissions?.entries?.find(entry => entry.key === view.key);
|
|
1895
|
+
const name = item?.permission_name ?? index_esm.MINI_PROGRAM_PERMISSION_CATALOG.find((entry) => entry.key === view.key)?.name ?? view.key;
|
|
1896
|
+
const approval = result.runtime_permissions?.entries?.find((entry) => entry.key === view.key);
|
|
1806
1897
|
const source = view.approvalSource === 'first-party' ? ' 批准来源=第一方自动批准' : '';
|
|
1807
1898
|
context.logger.info(`${view.key} (${name}) 原始审批=${approval?.status ?? 'disabled'}${source} 本地生效=${view.effective ? 'enabled' : 'disabled'} 最近申请=${application?.status ?? '未申请'}`);
|
|
1808
1899
|
if (application?.application_id)
|
|
@@ -1811,7 +1902,13 @@ async function remotePermissionList(options, context, runtime) {
|
|
|
1811
1902
|
context.logger.info(`审核意见:${application.review_remark}`);
|
|
1812
1903
|
}
|
|
1813
1904
|
}
|
|
1814
|
-
return finishRemoteCommand(options, runtime, {
|
|
1905
|
+
return finishRemoteCommand(options, runtime, {
|
|
1906
|
+
changed: false,
|
|
1907
|
+
miniProgramId,
|
|
1908
|
+
items: toCamelCaseDeep(result.items),
|
|
1909
|
+
runtimePermissions: toCamelCaseDeep(result.runtime_permissions),
|
|
1910
|
+
permissions: views,
|
|
1911
|
+
});
|
|
1815
1912
|
}
|
|
1816
1913
|
async function remotePermissionApply(options, context, runtime) {
|
|
1817
1914
|
const miniProgramId = requireBinding(context);
|
|
@@ -1827,10 +1924,15 @@ async function remotePermissionApply(options, context, runtime) {
|
|
|
1827
1924
|
throw new Error('申请理由不能超过 500 字');
|
|
1828
1925
|
let domains;
|
|
1829
1926
|
if (key === 'network') {
|
|
1830
|
-
const values = [
|
|
1927
|
+
const values = [
|
|
1928
|
+
...new Set(requireNonEmpty(options.domains, 'network 申请必须传 --domains,多个域名用逗号分隔')
|
|
1929
|
+
.split(',')
|
|
1930
|
+
.map((value) => value.trim())
|
|
1931
|
+
.filter(Boolean)),
|
|
1932
|
+
];
|
|
1831
1933
|
if (!values.length || values.length > 20)
|
|
1832
1934
|
throw new Error('请填写 1 至 20 个访问域名');
|
|
1833
|
-
if (values.some(value => /[\s/:?#@*\\]/.test(value)))
|
|
1935
|
+
if (values.some((value) => /[\s/:?#@*\\]/.test(value)))
|
|
1834
1936
|
throw new Error('请填写域名,不含协议、端口、路径或通配符');
|
|
1835
1937
|
domains = values.join(',');
|
|
1836
1938
|
}
|
|
@@ -2296,9 +2398,7 @@ async function confirmDangerousRemoteChange(options, runtime, logger, context) {
|
|
|
2296
2398
|
throw new Error(`非交互环境执行 hb-sdk remote ${context.operation} 必须传 --yes`);
|
|
2297
2399
|
}
|
|
2298
2400
|
const confirmation = `${context.permissionWarning ? `${context.permissionWarning}\n` : ''}确认执行 ${context.operation}?`;
|
|
2299
|
-
const accepted = runtime.promptConfirm
|
|
2300
|
-
? await runtime.promptConfirm(confirmation)
|
|
2301
|
-
: await promptConfirm(`${confirmation}输入 yes 继续: `, runtime);
|
|
2401
|
+
const accepted = runtime.promptConfirm ? await runtime.promptConfirm(confirmation) : await promptConfirm(`${confirmation}输入 yes 继续: `, runtime);
|
|
2302
2402
|
if (!accepted) {
|
|
2303
2403
|
throw new Error('已取消操作');
|
|
2304
2404
|
}
|
|
@@ -2330,19 +2430,35 @@ function printMiniProgramDetail(logger, detail, permissionViews, bindings) {
|
|
|
2330
2430
|
const manifest = detail.manifest && typeof detail.manifest === 'object' ? detail.manifest : undefined;
|
|
2331
2431
|
let online;
|
|
2332
2432
|
try {
|
|
2333
|
-
online = manifest
|
|
2433
|
+
online = manifest
|
|
2434
|
+
? runtimePermissionEnv.parseMiniappPermissions(manifest.permissions, {
|
|
2435
|
+
present: Object.hasOwn(manifest, 'permissions'),
|
|
2436
|
+
sdkVersion: typeof detail.sdk_version === 'string' ? detail.sdk_version : '0.8.0',
|
|
2437
|
+
})
|
|
2438
|
+
: undefined;
|
|
2439
|
+
}
|
|
2440
|
+
catch {
|
|
2441
|
+
/* 缺失或未知声明保持未知,不能推断线上可用。 */
|
|
2334
2442
|
}
|
|
2335
|
-
catch { /* 缺失或未知声明保持未知,不能推断线上可用。 */ }
|
|
2336
2443
|
const publishedRuntime = index_esm.parseMiniProgramRuntimePermissions(detail.effective_runtime_permissions);
|
|
2337
2444
|
let differs = false;
|
|
2338
2445
|
for (const view of permissionViews) {
|
|
2339
2446
|
const published = online ? online.permissions?.[view.key]?.enabled === true : undefined;
|
|
2340
2447
|
const requested = online?.permissions?.[view.key];
|
|
2341
|
-
const changed = published !== undefined &&
|
|
2342
|
-
(
|
|
2448
|
+
const changed = published !== undefined &&
|
|
2449
|
+
(published !== view.declared ||
|
|
2450
|
+
(view.key === 'network' &&
|
|
2451
|
+
published &&
|
|
2452
|
+
view.requestedConfig?.useOfficialDomain !== (requested && 'useOfficialDomain' in requested ? requested.useOfficialDomain : undefined)));
|
|
2343
2453
|
differs ||= changed;
|
|
2344
|
-
const approval = view.access === 'platform-approval'
|
|
2345
|
-
|
|
2454
|
+
const approval = view.access === 'platform-approval'
|
|
2455
|
+
? view.approvalSource === 'first-party'
|
|
2456
|
+
? '第一方自动批准'
|
|
2457
|
+
: view.approved
|
|
2458
|
+
? '已批准'
|
|
2459
|
+
: '未批准'
|
|
2460
|
+
: '无需审批';
|
|
2461
|
+
logger.info(` ${view.key}: 本地声明=${view.declared ? '是' : '否'} 线上版本声明=${published === undefined ? '未知' : published ? '是' : '否'} 平台批准=${approval} 线上快照=${publishedRuntime.valid ? (publishedRuntime.permissions[view.key]?.status ?? '缺少条目') : '未知'}${changed ? ' [不一致]' : ''}`);
|
|
2346
2462
|
}
|
|
2347
2463
|
if (differs)
|
|
2348
2464
|
logger.warn('本地声明与线上版本不一致;本地调试结果不代表线上生效,需发布包含声明的新版本。');
|
package/dist/cli-chunks/{runtime-permission-env-BtxzR-dv.cjs → runtime-permission-env-CZNyFKnx.cjs}
RENAMED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
var fs = require('node:fs');
|
|
4
4
|
var path = require('node:path');
|
|
5
|
-
var version = require('./version-
|
|
5
|
+
var version = require('./version-7t_EYjo_.cjs');
|
|
6
6
|
var bindings = require('./bindings-B9HSKhmy.cjs');
|
|
7
7
|
var fs$1 = require('node:fs/promises');
|
|
8
|
-
var index_esm = require('./index.esm-
|
|
9
|
-
var index = require('./index-
|
|
8
|
+
var index_esm = require('./index.esm-CenYK5Bl.cjs');
|
|
9
|
+
var index = require('./index-DcyYtbXh.cjs');
|
|
10
10
|
var node_crypto = require('node:crypto');
|
|
11
11
|
require('node:zlib');
|
|
12
12
|
require('node:module');
|
|
@@ -165,6 +165,16 @@ function parseMiniappPermissions(value, options) {
|
|
|
165
165
|
}
|
|
166
166
|
useOfficialDomain = declaration.useOfficialDomain === true;
|
|
167
167
|
}
|
|
168
|
+
if (key === 'post') {
|
|
169
|
+
for (const field of ['read', 'write']) {
|
|
170
|
+
if (declaration[field] !== undefined && typeof declaration[field] !== 'boolean') {
|
|
171
|
+
throw new Error(`${itemLabel}.${field} 必须是 boolean`);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
if (declaration.enabled)
|
|
175
|
+
permissions.post = { enabled: true, read: declaration.read === true, write: declaration.write === true };
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
168
178
|
if (key === 'user_game_data') {
|
|
169
179
|
// 即使声明关闭也校验资源清单:enabled:false 不能隐藏非法字段。
|
|
170
180
|
const resources = parseUserGameDataResources(declaration.resources, itemLabel);
|
|
@@ -218,7 +228,11 @@ partyType) {
|
|
|
218
228
|
entries.push({
|
|
219
229
|
key: definition.key,
|
|
220
230
|
status: 'enabled',
|
|
221
|
-
config: definition.key === 'user_game_data'
|
|
231
|
+
config: definition.key === 'user_game_data'
|
|
232
|
+
? { resources: normalizeUserGameDataResources(local.permissions?.user_game_data) }
|
|
233
|
+
: definition.key === 'post'
|
|
234
|
+
? { read: local.permissions?.post?.read === true, write: local.permissions?.post?.write === true }
|
|
235
|
+
: {},
|
|
222
236
|
});
|
|
223
237
|
}
|
|
224
238
|
continue;
|
|
@@ -210896,6 +210910,10 @@ const LIST_USER_MINIPROGRAM_API_PATH = '/mall/developer/user_miniprogram/list';
|
|
|
210896
210910
|
const CREATE_USER_MINIPROGRAM_API_PATH = '/mall/developer/user_miniprogram/create';
|
|
210897
210911
|
/** 查询单个小程序详情的开放平台 API 路径。 */
|
|
210898
210912
|
const DETAIL_USER_MINIPROGRAM_API_PATH = '/mall/developer/user_miniprogram/detail';
|
|
210913
|
+
/** 查询和更新小程序关联帖子的开放平台 API 路径。 */
|
|
210914
|
+
const USER_MINIPROGRAM_POST_BINDING_API_PATH = '/mall/developer/user_miniprogram/post/binding';
|
|
210915
|
+
/** 校验并预览待关联的帖子。 */
|
|
210916
|
+
const USER_MINIPROGRAM_POST_PREVIEW_API_PATH = '/mall/developer/user_miniprogram/post/preview';
|
|
210899
210917
|
/** 创建本地开发启动凭据的开放平台 API 路径。 */
|
|
210900
210918
|
const CREATE_USER_MINIPROGRAM_LOCAL_DEV_LAUNCH_TOKEN_API_PATH = '/mall/developer/user_miniprogram/local_dev_launch_token';
|
|
210901
210919
|
/** 查询小程序预览白名单的开放平台 API 路径。 */
|
|
@@ -211773,6 +211791,8 @@ exports.TAKE_DOWN_USER_MINIPROGRAM_API_PATH = TAKE_DOWN_USER_MINIPROGRAM_API_PAT
|
|
|
211773
211791
|
exports.UPDATE_SQUARE_DISPLAY_API_PATH = UPDATE_SQUARE_DISPLAY_API_PATH;
|
|
211774
211792
|
exports.UPDATE_USER_MINIPROGRAM_PREVIEW_ALLOWLIST_API_PATH = UPDATE_USER_MINIPROGRAM_PREVIEW_ALLOWLIST_API_PATH;
|
|
211775
211793
|
exports.USER_MINIPROGRAM_ACCESS_STATUS_API_PATH = USER_MINIPROGRAM_ACCESS_STATUS_API_PATH;
|
|
211794
|
+
exports.USER_MINIPROGRAM_POST_BINDING_API_PATH = USER_MINIPROGRAM_POST_BINDING_API_PATH;
|
|
211795
|
+
exports.USER_MINIPROGRAM_POST_PREVIEW_API_PATH = USER_MINIPROGRAM_POST_PREVIEW_API_PATH;
|
|
211776
211796
|
exports.USER_MINIPROGRAM_PREVIEW_ALLOWLIST_API_PATH = USER_MINIPROGRAM_PREVIEW_ALLOWLIST_API_PATH;
|
|
211777
211797
|
exports.USER_MINIPROGRAM_VERSION_PREVIEW_INFO_API_PATH = USER_MINIPROGRAM_VERSION_PREVIEW_INFO_API_PATH;
|
|
211778
211798
|
exports.WITHDRAW_USER_MINIPROGRAM_VERSION_API_PATH = WITHDRAW_USER_MINIPROGRAM_VERSION_API_PATH;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var version = require('./version-
|
|
3
|
+
var version = require('./version-7t_EYjo_.cjs');
|
|
4
4
|
var fs = require('node:fs/promises');
|
|
5
5
|
var path = require('node:path');
|
|
6
6
|
var childProcess = require('node:child_process');
|
|
7
|
-
var index = require('./index-
|
|
7
|
+
var index = require('./index-DcyYtbXh.cjs');
|
|
8
8
|
require('node:module');
|
|
9
9
|
require('readline');
|
|
10
10
|
require('os');
|