@heybox/hb-sdk-protocol 0.8.0-alpha → 0.8.0-alpha.12
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 +3 -6
- package/dist/index.cjs.js +512 -37
- package/dist/index.esm.js +482 -38
- package/package.json +4 -1
- package/src/bridge.ts +21 -3
- package/src/capabilities.ts +294 -28
- package/src/constants.ts +1 -0
- package/src/guards.ts +161 -7
- package/src/index.ts +1 -0
- package/src/payloads.ts +174 -1
- package/src/permission-catalog.ts +168 -0
- package/src/permissions.ts +28 -10
- package/types/bridge.d.ts +19 -3
- package/types/capabilities.d.ts +291 -30
- package/types/constants.d.ts +1 -0
- package/types/guards.d.ts +11 -0
- package/types/index.d.ts +1 -0
- package/types/payloads.d.ts +144 -1
- package/types/permission-catalog.d.ts +108 -0
- package/types/permissions.d.ts +4 -3
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
`@heybox/hb-sdk-protocol` 拥有:
|
|
8
8
|
|
|
9
9
|
- bridge namespace、协议版本、method 常量和事件名称;
|
|
10
|
-
- capability metadata(module、capability、
|
|
10
|
+
- capability metadata(module、capability、requirement、risk)和权限机器目录;
|
|
11
11
|
- method payload/result 与错误的 wire 类型;
|
|
12
12
|
- `runtime_permissions` schema 解析器和相关类型。
|
|
13
13
|
|
|
@@ -32,17 +32,14 @@
|
|
|
32
32
|
宿主/Runtime 维护代码直接使用协议包:
|
|
33
33
|
|
|
34
34
|
```ts
|
|
35
|
-
import {
|
|
36
|
-
MINI_PROGRAM_PROTOCOL_CAPABILITIES,
|
|
37
|
-
type MiniProgramBridgeMessage,
|
|
38
|
-
} from '@heybox/hb-sdk-protocol';
|
|
35
|
+
import { MINI_PROGRAM_PROTOCOL_CAPABILITIES, type MiniProgramBridgeMessage } from '@heybox/hb-sdk-protocol';
|
|
39
36
|
```
|
|
40
37
|
|
|
41
38
|
小程序业务代码不应导入该包;业务只使用 `@heybox/hb-sdk`。为了兼容已有 Host/Runtime 消费者,`@heybox/hb-sdk/protocol` 继续 re-export 本包的公开值和类型,但协议 owner 是本包。
|
|
42
39
|
|
|
43
40
|
## 权限快照
|
|
44
41
|
|
|
45
|
-
`parseMiniProgramRuntimePermissions()`
|
|
42
|
+
`MINI_PROGRAM_PERMISSION_CATALOG` 定义 8 个公开权限,`MINI_PROGRAM_PROTOCOL_CAPABILITIES[].requirement` 将每个 bridge method 显式分类为无需声明或要求全部列出的权限。`parseMiniProgramRuntimePermissions()` 是 schema v1 的 fail-closed 解析器;旧 `network.request` entry 仅在解析边界归一为 `network`,不得进入新配置。跨语言目录由 `generated/permission-catalog.json` 提供。
|
|
46
43
|
|
|
47
44
|
协议包不决定业务授权。`auth.login()` 的 UI、账号会话、授权码签发和 OpenAPI 都由 Host/服务端负责;协议层只传递经过约束的 request/response 数据。
|
|
48
45
|
|