@heybox/hb-sdk-protocol 0.9.3-alpha.2 → 0.9.3-alpha.4
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 +4 -0
- package/dist/index.cjs.js +5 -4
- package/dist/index.esm.js +5 -4
- package/package.json +1 -1
- package/types/index.d.ts +4 -0
package/README.md
CHANGED
|
@@ -109,6 +109,10 @@ pnpm --filter @heybox/hb-sdk-protocol run build:package
|
|
|
109
109
|
|
|
110
110
|
`display_change.source` 区分变化来源:`api` 为开发者调用,`user` 为用户点击宿主退出全屏按钮。同目标并发合并时保留首次发起操作的来源;重复状态不额外发事件。旧宿主可能不含 source,不能将缺失来源推断为用户操作。仅用户退出时跳页,应判断 `source === 'user' && !fullscreen`,再按业务需要调用竖屏设置并跳转。
|
|
111
111
|
|
|
112
|
+
## 官方请求扩展
|
|
113
|
+
|
|
114
|
+
Native `system.describe` 可追加 `features.officialRequestV1?: boolean`。只有显式 true 才表示当前桥接执行器支持官方请求扩展;缺省/false 保持历史网络兼容,数字或字符串不能作为能力批准。该字段为 contract revision 1 的独立可选扩展,不改变既有 operation 集与 fixture。Native WebView 与 Flutter Dart 执行器分别声明自身能力,不能把底层平台库的声明直接作为 Dart 入口的实现证明。
|
|
115
|
+
|
|
112
116
|
## 单文件上传合同
|
|
113
117
|
|
|
114
118
|
`network.upload` 使用 `NetworkUploadPayload`,只跨 iframe 传输 File ref 和可序列化的 raw/multipart 元数据,返回标准 `NetworkResponsePayload`。`UploadProgressPayload` 只统计文件内容字节,不包含 multipart 字段与边界。该方法同时要求 network 与 filesystem;Host 是否具备真实 primitive 由 Runtime 协商。Native Host 新增独立 `network.upload` operation;原有 contract revision 1 的操作不变,旧 Host 仍可协商 Files/Download 并单独关闭上传。
|
package/dist/index.cjs.js
CHANGED
|
@@ -1821,10 +1821,11 @@ function isMiniProgramNativeHostDescription(value) {
|
|
|
1821
1821
|
!isPositiveSafeInteger(value.contractRevision) ||
|
|
1822
1822
|
!isRecord(value.operations))
|
|
1823
1823
|
return false;
|
|
1824
|
+
if (value.features !== undefined &&
|
|
1825
|
+
(!isRecord(value.features) || (value.features.officialRequestV1 !== undefined && typeof value.features.officialRequestV1 !== 'boolean')))
|
|
1826
|
+
return false;
|
|
1824
1827
|
const operations = value.operations;
|
|
1825
|
-
if (!isOperationList(operations.system) ||
|
|
1826
|
-
!isOperationList(operations.network) ||
|
|
1827
|
-
!isOperationList(operations.files))
|
|
1828
|
+
if (!isOperationList(operations.system) || !isOperationList(operations.network) || !isOperationList(operations.files))
|
|
1828
1829
|
return false;
|
|
1829
1830
|
return operations.system.includes('describe');
|
|
1830
1831
|
}
|
|
@@ -1849,7 +1850,7 @@ function isPositiveSafeInteger(value) {
|
|
|
1849
1850
|
}
|
|
1850
1851
|
function isOperationList(value) {
|
|
1851
1852
|
return (Array.isArray(value) &&
|
|
1852
|
-
value.every(operation => isNonEmptyString(operation) && operation === operation.trim()) &&
|
|
1853
|
+
value.every((operation) => isNonEmptyString(operation) && operation === operation.trim()) &&
|
|
1853
1854
|
new Set(value).size === value.length);
|
|
1854
1855
|
}
|
|
1855
1856
|
|
package/dist/index.esm.js
CHANGED
|
@@ -1819,10 +1819,11 @@ function isMiniProgramNativeHostDescription(value) {
|
|
|
1819
1819
|
!isPositiveSafeInteger(value.contractRevision) ||
|
|
1820
1820
|
!isRecord(value.operations))
|
|
1821
1821
|
return false;
|
|
1822
|
+
if (value.features !== undefined &&
|
|
1823
|
+
(!isRecord(value.features) || (value.features.officialRequestV1 !== undefined && typeof value.features.officialRequestV1 !== 'boolean')))
|
|
1824
|
+
return false;
|
|
1822
1825
|
const operations = value.operations;
|
|
1823
|
-
if (!isOperationList(operations.system) ||
|
|
1824
|
-
!isOperationList(operations.network) ||
|
|
1825
|
-
!isOperationList(operations.files))
|
|
1826
|
+
if (!isOperationList(operations.system) || !isOperationList(operations.network) || !isOperationList(operations.files))
|
|
1826
1827
|
return false;
|
|
1827
1828
|
return operations.system.includes('describe');
|
|
1828
1829
|
}
|
|
@@ -1847,7 +1848,7 @@ function isPositiveSafeInteger(value) {
|
|
|
1847
1848
|
}
|
|
1848
1849
|
function isOperationList(value) {
|
|
1849
1850
|
return (Array.isArray(value) &&
|
|
1850
|
-
value.every(operation => isNonEmptyString(operation) && operation === operation.trim()) &&
|
|
1851
|
+
value.every((operation) => isNonEmptyString(operation) && operation === operation.trim()) &&
|
|
1851
1852
|
new Set(value).size === value.length);
|
|
1852
1853
|
}
|
|
1853
1854
|
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -6304,6 +6304,10 @@ interface MiniProgramNativeHostDescription {
|
|
|
6304
6304
|
protocolVersion: number;
|
|
6305
6305
|
contractRevision: number;
|
|
6306
6306
|
operations: Readonly<Record<MiniProgramNativeHostDomain, readonly string[]>>;
|
|
6307
|
+
/** 可独立协商的宿主扩展;缺省表示只支持历史协议。 */
|
|
6308
|
+
features?: {
|
|
6309
|
+
officialRequestV1?: boolean;
|
|
6310
|
+
};
|
|
6307
6311
|
}
|
|
6308
6312
|
type MiniProgramNativeHostMessage = {
|
|
6309
6313
|
requestId: string;
|