@tbox.cn/app-toolkit 0.4.0 → 0.5.0
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/dist/chunk-WUULQDOV.js +1 -0
- package/dist/contracts-resolver-PS2UH2G6.js +1 -0
- package/dist/index.d.ts +315 -144
- package/dist/index.js +9 -9
- package/package.json +2 -2
- package/src/assembly/provider-catalog.ts +1 -1
- package/src/assembly/resolve-key.ts +75 -0
- package/src/assembly/walk-manifests.ts +138 -85
- package/src/core/contracts-expected.ts +2 -2
- package/src/core/contracts-resolver.ts +12 -1
- package/src/core/module-schema.ts +87 -14
- package/src/dto.ts +48 -33
- package/src/factory.ts +62 -18
- package/src/index.ts +14 -7
- package/src/integrations/mock-bindings.ts +1 -1
- package/src/integrations/module-binding.ts +60 -0
- package/src/integrations/predicate-io.ts +26 -5
- package/src/integrations/predicate.ts +97 -57
- package/src/integrations/prune-bindings.ts +33 -14
- package/src/integrations/write.ts +43 -27
- package/src/views/app.ts +4 -4
- package/src/views/context.ts +11 -12
- package/src/views/integration-schemas.ts +61 -17
- package/src/views/modules.ts +29 -23
- package/src/views/providers.ts +5 -5
- package/src/views/service-detail.ts +1 -1
- package/src/views/service-resolutions.ts +14 -13
- package/tests/credentials-view.test.ts +2 -2
- package/tests/demo-app.ts +11 -6
- package/tests/dev-manifest-catalog.test.ts +14 -14
- package/tests/file-cache.test.ts +5 -5
- package/tests/module-schema.test.ts +106 -20
- package/tests/resolve-key.test.ts +154 -0
- package/tests/vendor-schema-keywords.test.ts +74 -0
- package/tests/views.test.ts +296 -166
- package/tests/write-core.test.ts +83 -0
- package/dist/chunk-KPD3LUH4.js +0 -1
- package/dist/contracts-resolver-E4SECBOG.js +0 -1
- package/src/integrations/domain-binding.ts +0 -81
package/src/dto.ts
CHANGED
|
@@ -3,6 +3,11 @@
|
|
|
3
3
|
* agtcodingbox / tbox-ai-coding 经 `import type` 消费(L2 DTO 单源——API 层零类型镜像)。
|
|
4
4
|
* 词汇七概念:app / module / service / instance / provider / integration / resolution。
|
|
5
5
|
* 弃用词汇清单见 api.md §3 尾(component/slot/scope/configMode/…——防复活)。
|
|
6
|
+
*
|
|
7
|
+
* **v7 词汇统一破例声明(一次性收敛,此后恢复 additive-only)**:标识/展示名分轴
|
|
8
|
+
* (id = 标识、name = 展示名、description = 描述——对齐实例轴 {id, name}),
|
|
9
|
+
* title 键全量退役(与 manifest name→id/title→name 同一变更);`.title` 消费方
|
|
10
|
+
* (外部仓 import type / 运行时读)需同窗迁移。
|
|
6
11
|
*/
|
|
7
12
|
|
|
8
13
|
// ===== 词汇基线 =====
|
|
@@ -30,17 +35,16 @@ export interface ModulesView {
|
|
|
30
35
|
export interface ModuleDeclaration {
|
|
31
36
|
/** install id(packages/ 目录名 / .tbox/app.json entry.id)——恒业务模块(provider 家族不在本清单) */
|
|
32
37
|
id: string;
|
|
33
|
-
/**
|
|
38
|
+
/** 展示名(v7 词汇统一:manifest name ?? id——恒有值) */
|
|
34
39
|
name: string;
|
|
35
|
-
title: string;
|
|
36
40
|
description: string;
|
|
37
41
|
}
|
|
38
42
|
|
|
39
43
|
/** 服务需求声明(模块 demand 单元 / 平台服务条目——v4.4 D29 双端点同型;defaults 唯一落位 ServiceDetail) */
|
|
40
44
|
export interface ServiceDemand {
|
|
41
45
|
service: string;
|
|
42
|
-
/** manifest demand meta
|
|
43
|
-
|
|
46
|
+
/** manifest demand meta(v7 title→name);缺席 UI 回退 service id */
|
|
47
|
+
name?: string;
|
|
44
48
|
description?: string;
|
|
45
49
|
/** demand optional === false(多模块 OR 聚合见 resolution echo;平台服务条目恒 false) */
|
|
46
50
|
required: boolean;
|
|
@@ -50,44 +54,44 @@ export interface ServiceDemand {
|
|
|
50
54
|
|
|
51
55
|
/** GET /modules/:module(模块静态一站式 · PUT 读对偶) */
|
|
52
56
|
export interface ModuleDetailView {
|
|
53
|
-
/**
|
|
54
|
-
|
|
57
|
+
/** 模块展示名(v7 词汇统一:manifest name ?? id——恒有值) */
|
|
58
|
+
name: string;
|
|
55
59
|
/** B1 additive:模块 meta 描述(manifest description;兜底 '') */
|
|
56
60
|
description: string;
|
|
57
|
-
/**
|
|
58
|
-
domainKeys
|
|
59
|
-
|
|
61
|
+
/** v6 所有权模型:模块归属服务(declare.owns 展平,排序;零归属 = [])——
|
|
62
|
+
* v5 domainKeys 退役(破坏性更名;面板 presence-detection 双读义务见 api.md §3) */
|
|
63
|
+
ownedServices: string[];
|
|
64
|
+
/** modules[install id] 集成位原值(provider/config;resources 不投影);未配置 = null */
|
|
60
65
|
integration: ModuleIntegrationNode | null;
|
|
61
|
-
/**
|
|
62
|
-
|
|
63
|
-
|
|
66
|
+
/** v6 单数化(v5 providerBindings[] 退役):模块级厂商绑定解析(resolveModuleBinding 单源;
|
|
67
|
+
* 单值作用于全部 ownedServices) */
|
|
68
|
+
binding: ModuleBinding | null;
|
|
69
|
+
/** v6:owns.length > 0(moduleOwnershipWritable 单源——读标志与写守卫共用) */
|
|
64
70
|
configEditable: boolean;
|
|
65
|
-
/** 本模块 demand
|
|
71
|
+
/** 本模块 demand(declare.consumes;卡片展开 + 编辑器静态上下文自足) */
|
|
66
72
|
services: ServiceDemand[];
|
|
67
73
|
/** v4.4 D31:include=serviceResolutions 内嵌(demand 服务过滤 ≡ 批量 ?service= 语义;<0.9/形态异常 → null——永不 503) */
|
|
68
74
|
serviceResolutions?: ServiceResolutionsView | null;
|
|
69
|
-
/** v4.4 D32:include=integrationSchemas
|
|
75
|
+
/** v4.4 D32:include=integrationSchemas 层级富化(零归属/未绑定 → null) */
|
|
70
76
|
integrationSchemas?: LayerIntegrationSchemas | null;
|
|
71
77
|
/** v4.6 D36:include=integrationFieldRegistry 集成字段注册表(null 语义镜像 integrationSchemas;
|
|
72
78
|
* 未知厂商/零足迹 → 非 null 空集 + unsupplied 回填——D37 轴参假想计算同此) */
|
|
73
79
|
integrationFieldRegistry?: IntegrationFieldRegistryView | null;
|
|
74
80
|
}
|
|
75
81
|
|
|
76
|
-
/**
|
|
77
|
-
export interface
|
|
78
|
-
/**
|
|
79
|
-
|
|
80
|
-
/** domains[domain].provider ?? root.provider(双缺 = null) */
|
|
81
|
-
effective: string | null;
|
|
82
|
+
/** 模块级厂商绑定解析(v6——静态文件事实;规则 ≡ 谓词 #7 模块层,resolveModuleBinding 单源) */
|
|
83
|
+
export interface ModuleBinding {
|
|
84
|
+
/** modules[install id].provider ?? root.provider(双缺 = null) */
|
|
85
|
+
provider: string | null;
|
|
82
86
|
/** 生效来源层(双缺 = null) */
|
|
83
87
|
layer: 'module' | 'app' | null;
|
|
84
88
|
}
|
|
85
89
|
|
|
86
90
|
/** 层级 config schema 计算(v4.4 D32——静态轴富化,零 contracts) */
|
|
87
91
|
export interface LayerIntegrationSchemas {
|
|
88
|
-
/** 层生效厂商(
|
|
92
|
+
/** 层生效厂商(resolveModuleBinding 单源) */
|
|
89
93
|
provider: string;
|
|
90
|
-
/** 模块级 = 本模块
|
|
94
|
+
/** 模块级 = 本模块 ownedServices ∩ 该厂商供给;应用级 = 供给足迹全量(configSchema = raw draft 2020-12 原文;供给在场未声明 = null) */
|
|
91
95
|
services: Record<string, { configSchema: object | null }>;
|
|
92
96
|
}
|
|
93
97
|
|
|
@@ -102,13 +106,16 @@ export interface IntegrationFieldRegistryView {
|
|
|
102
106
|
unsupplied: string[];
|
|
103
107
|
/** 作用域内全部非 null schema 的 additionalProperties 均 ≠ false(聚合;空真) */
|
|
104
108
|
additionalPropertiesAllowed: boolean;
|
|
105
|
-
/** 逐 key 合并产物(首声明插入序 = scope 遍历序:app 字母序 / module
|
|
109
|
+
/** 逐 key 合并产物(首声明插入序 = scope 遍历序:app 字母序 / module ownedServices 序) */
|
|
106
110
|
fields: Array<{
|
|
107
111
|
key: string;
|
|
108
112
|
/** null = 类型不可调和(R3/R2 异构/R1 enum 不等——冲突折叠,客户端 RawJson 保真) */
|
|
109
113
|
schema: object | null;
|
|
110
114
|
/** required 聚合 = sources.some(s => s.required);conflict 字段照常聚合 */
|
|
111
115
|
sources: Array<{ service: string; required: boolean }>;
|
|
116
|
+
/** G 批:x-tbox-global 聚合旗标(sources.some——任一来源声明即 true;app/module 轴表单
|
|
117
|
+
* 仅渲染 true 字段,非全局键落 ExtraFields;service 轴全量透传) */
|
|
118
|
+
global: boolean;
|
|
112
119
|
}>;
|
|
113
120
|
}
|
|
114
121
|
|
|
@@ -139,12 +146,15 @@ export interface ServiceDetail extends ServiceDemand {
|
|
|
139
146
|
/** v4.7 D38:include=integrationSchemas 生效绑定富化(三态:null 全链未绑定 /
|
|
140
147
|
* 绑定无可计算 schema / 含 schema;malformed 节点 → null——不放行域级联) */
|
|
141
148
|
integrationSchemas?: ServiceIntegrationSchemas | null;
|
|
149
|
+
/** G 批:include=integrationFieldRegistry 服务轴注册表(loadServiceFieldRegistry——
|
|
150
|
+
* 四分支链推导复用 D38;fields = 该 schema 全部字段带 global 旗标;null 语义镜像 D38) */
|
|
151
|
+
integrationFieldRegistry?: IntegrationFieldRegistryView | null;
|
|
142
152
|
}
|
|
143
153
|
|
|
144
154
|
/** 服务级生效绑定 schema(v4.7 D38 静态轴富化——零 contracts,永不 503;实例层无条件排除:
|
|
145
155
|
* node 级口径 ≠ resolution 默认实例口径,api.md §4.4 注) */
|
|
146
156
|
export interface ServiceIntegrationSchemas {
|
|
147
|
-
/** 生效厂商:显式(含内联声明名)??
|
|
157
|
+
/** 生效厂商:显式(含内联声明名)?? modules[ownerOf].provider ?? root.provider */
|
|
148
158
|
provider: string;
|
|
149
159
|
/** catalog 复合键(多 impl 声明序首个)> 内联 ref;miss(未知厂商/未供给/内联缺 ref)→ null(富化非门控) */
|
|
150
160
|
configSchema: object | null;
|
|
@@ -211,8 +221,8 @@ export interface AppIntegrationNode {
|
|
|
211
221
|
}
|
|
212
222
|
|
|
213
223
|
/** AppIntegrationNode 键集单源(runtime const——write applyApp 全量替换白名单
|
|
214
|
-
* (缺席根键删除;services/
|
|
215
|
-
* D21/L1——文件含 services/
|
|
224
|
+
* (缺席根键删除;services/modules 域不在其中;v6 domains 键退役)+ views/app 投影
|
|
225
|
+
* (GET 预填 ≡ PUT body,D21/L1——文件含 services/modules 但 root 节点投影只含本键集)) */
|
|
216
226
|
export const APP_INTEGRATION_NODE_KEYS = [
|
|
217
227
|
'provider',
|
|
218
228
|
'config',
|
|
@@ -223,12 +233,17 @@ export const APP_INTEGRATION_NODE_KEYS = [
|
|
|
223
233
|
'defaultInstanceId',
|
|
224
234
|
] as const;
|
|
225
235
|
|
|
226
|
-
/**
|
|
236
|
+
/** 模块集成位节点(v6——provider 绑定默认 + config 级联层;resources 不投影不写——
|
|
237
|
+
* 集成位编辑恒保全资源节,N2) */
|
|
227
238
|
export interface ModuleIntegrationNode {
|
|
228
239
|
provider?: string;
|
|
229
240
|
config?: Record<string, unknown>;
|
|
230
241
|
}
|
|
231
242
|
|
|
243
|
+
/** ModuleIntegrationNode 可写键集单源(v6——write applyModule 全量替换白名单
|
|
244
|
+
* (键集外 400;resources 恒随既有节点保全)+ views/modules 投影(GET ≡ PUT,三同构)) */
|
|
245
|
+
export const MODULE_INTEGRATION_NODE_KEYS = ['provider', 'config'] as const;
|
|
246
|
+
|
|
232
247
|
/** services[s] 整节点 */
|
|
233
248
|
export interface ServiceIntegrationNode {
|
|
234
249
|
/** 对象 = 自定义 API(仅槽级,P2) */
|
|
@@ -291,8 +306,8 @@ export interface ProviderEntry {
|
|
|
291
306
|
local: boolean;
|
|
292
307
|
/** 供给声明来源包名 */
|
|
293
308
|
owner: string;
|
|
294
|
-
/**
|
|
295
|
-
|
|
309
|
+
/** 厂商展示名(v7 title→name:manifest name——多包首声明;缺席 = undefined) */
|
|
310
|
+
name?: string;
|
|
296
311
|
description?: string;
|
|
297
312
|
}
|
|
298
313
|
|
|
@@ -301,8 +316,8 @@ export interface ProviderDetail {
|
|
|
301
316
|
provider: string;
|
|
302
317
|
local: boolean;
|
|
303
318
|
owner: string;
|
|
304
|
-
/**
|
|
305
|
-
|
|
319
|
+
/** 厂商展示名(同 ProviderEntry——首声明透传) */
|
|
320
|
+
name?: string;
|
|
306
321
|
description?: string;
|
|
307
322
|
/** per (provider, service) 保真,同厂商异构合法;★ implementations 恒数组(H1——
|
|
308
323
|
* 多元素 = 升级窗口,UI 出 impl 选择器,PUT 显式钉版) */
|
|
@@ -310,8 +325,8 @@ export interface ProviderDetail {
|
|
|
310
325
|
string,
|
|
311
326
|
{
|
|
312
327
|
implementations: Array<{ implementation: string; credentialType: string }>;
|
|
313
|
-
/**
|
|
314
|
-
|
|
328
|
+
/** 服务展示名(resolveServiceDisplay——词汇 > demand > id;恒发) */
|
|
329
|
+
name?: string;
|
|
315
330
|
description?: string;
|
|
316
331
|
/** v4.4 F5:include=integrationSchemas 切换态批量(纯 config——凭据结构归 /credential-types) */
|
|
317
332
|
integrationSchemas?: { configSchema: object | null };
|
package/src/factory.ts
CHANGED
|
@@ -19,9 +19,10 @@ import { loadModulesView, loadModuleDetailView } from './views/modules.js';
|
|
|
19
19
|
import { loadAppView } from './views/app.js';
|
|
20
20
|
import { loadServiceDetailView } from './views/service-detail.js';
|
|
21
21
|
import { loadServiceResolutionsView, loadServiceResolutionDetail } from './views/service-resolutions.js';
|
|
22
|
-
import { loadAppFormViews, loadModuleFormViews, loadServiceIntegrationSchemas } from './views/integration-schemas.js';
|
|
22
|
+
import { loadAppFormViews, loadModuleFormViews, loadServiceIntegrationSchemas, loadServiceFieldRegistry } from './views/integration-schemas.js';
|
|
23
23
|
import { loadCredentialsView } from './views/credentials.js';
|
|
24
24
|
import { loadCredentialTypesView } from './views/credential-types.js';
|
|
25
|
+
import { resolveModuleKey, resolveServiceKey } from './assembly/resolve-key.js';
|
|
25
26
|
import type { WalkManifestsResult } from './assembly/walk-manifests.js';
|
|
26
27
|
import type {
|
|
27
28
|
AppIntegrationNode,
|
|
@@ -67,12 +68,13 @@ export interface AppToolkitOptions {
|
|
|
67
68
|
|
|
68
69
|
/** include 协议白名单(v4.4 D30/P15——键名 = 产出字段名 1:1;per 端点;注册表 additive-only;
|
|
69
70
|
* v4.6 D36 += integrationFieldRegistry:app/module 三键,provider 轴不加——YAGNI;
|
|
70
|
-
* v4.7 D38 += service 键——服务级生效绑定 schema
|
|
71
|
+
* v4.7 D38 += service 键——服务级生效绑定 schema;
|
|
72
|
+
* G 批 += service 轴 integrationFieldRegistry——服务轴注册表(x-tbox-global 旗标全量透传)) */
|
|
71
73
|
const INCLUDE_WHITELIST = {
|
|
72
74
|
app: ['serviceResolutions', 'integrationSchemas', 'integrationFieldRegistry'],
|
|
73
75
|
module: ['serviceResolutions', 'integrationSchemas', 'integrationFieldRegistry'],
|
|
74
76
|
provider: ['integrationSchemas'],
|
|
75
|
-
service: ['integrationSchemas'],
|
|
77
|
+
service: ['integrationSchemas', 'integrationFieldRegistry'],
|
|
76
78
|
} as const;
|
|
77
79
|
|
|
78
80
|
/** include 校验(P15 单点在 toolkit 方法内——壳层仅解析可重复参数,零校验纪律不变):
|
|
@@ -113,10 +115,13 @@ function assertAxisProviderUsable(
|
|
|
113
115
|
}
|
|
114
116
|
}
|
|
115
117
|
|
|
116
|
-
/** ── HTTP 直通面(11 读;L1 镜像律:方法名 = load + URL 资源段;query → 选项字段 L4)──
|
|
118
|
+
/** ── HTTP 直通面(11 读;L1 镜像律:方法名 = load + URL 资源段;query → 选项字段 L4)──
|
|
119
|
+
* **双键契约(v7 词汇统一)**:资源路径参数双键寻址(id 优先、唯一展示名兜底——resolve-key
|
|
120
|
+
* 单点;多命中 404 带候选);query 过滤参数(loadServiceResolutions services?)恒 id-only。 */
|
|
117
121
|
export interface AppToolkitRead {
|
|
118
122
|
loadModules(): Promise<ModulesView>;
|
|
119
|
-
/** v4.6 D37:moduleProvider = 轴向假想绑定(缺席/空串 ≡ 按实际配置解析;需与表单 include
|
|
123
|
+
/** v4.6 D37:moduleProvider = 轴向假想绑定(缺席/空串 ≡ 按实际配置解析;需与表单 include 键同现)。
|
|
124
|
+
* moduleId = 双键(id 优先、唯一展示名兜底)。 */
|
|
120
125
|
loadModule(moduleId: string, o?: { include?: string[]; moduleProvider?: string }): Promise<ModuleDetailView>;
|
|
121
126
|
/** v4.6 D37:appProvider = 轴向假想绑定(缺席/空串 ≡ 按实际配置解析;需与表单 include 键同现) */
|
|
122
127
|
loadApp(o?: { include?: string[]; appProvider?: string }): Promise<AppView>;
|
|
@@ -132,7 +137,8 @@ export interface AppToolkitRead {
|
|
|
132
137
|
loadCredentialTypes(provider?: string): Promise<CredentialTypesView>;
|
|
133
138
|
}
|
|
134
139
|
|
|
135
|
-
/** ── HTTP 直通面(4 写;body ≡ 文件节点全量替换;DELETE 无 dryRun/无 options)──
|
|
140
|
+
/** ── HTTP 直通面(4 写;body ≡ 文件节点全量替换;DELETE 无 dryRun/无 options)──
|
|
141
|
+
* 双键契约(v7):路径键双键寻址(写侧 enqueue 闭包内解析——落盘键恒真实 id)。 */
|
|
136
142
|
export interface AppToolkitWrite {
|
|
137
143
|
writeAppIntegration(
|
|
138
144
|
node: AppIntegrationNode,
|
|
@@ -174,11 +180,20 @@ export function createAppToolkit(appDir: string, options: AppToolkitOptions = {}
|
|
|
174
180
|
|
|
175
181
|
const viewCtx = { appDir, cache };
|
|
176
182
|
|
|
177
|
-
/** 门控断言(policy at edge)——strictValidation false → 503(message 三分支 N1
|
|
183
|
+
/** 门控断言(policy at edge)——strictValidation false → 503(message 三分支 N1);
|
|
184
|
+
* v6 标记门(P1):ownershipBindingV6 false → 503 第四分支(v5 contracts + v6 toolkit 偏斜
|
|
185
|
+
* ——防静默忽略 ownerOf;门控范围 = 求值 + 写 + migrate 全体,本函数为唯一调用点)。 */
|
|
178
186
|
function assertContractsUsable(contracts: ResolvedContracts): void {
|
|
179
187
|
if (!contracts.strictValidation) {
|
|
180
188
|
throw new AppToolkitError('CONTRACTS_NOT_RESOLVED', 503, contractsNotResolvedMessage(contracts));
|
|
181
189
|
}
|
|
190
|
+
if (!contracts.ownershipBindingV6) {
|
|
191
|
+
throw new AppToolkitError(
|
|
192
|
+
'CONTRACTS_NOT_RESOLVED',
|
|
193
|
+
503,
|
|
194
|
+
`contracts ${contracts.version ?? '(版本未知)'} 不支持 v6 modules 绑定形状(OWNERSHIP_BINDING_V6 标记缺席)——升级应用 @tbox.cn/app-contracts 依赖后可用`,
|
|
195
|
+
);
|
|
196
|
+
}
|
|
182
197
|
}
|
|
183
198
|
|
|
184
199
|
/** 快照(同步——调用方已 await resolveContracts) */
|
|
@@ -186,6 +201,12 @@ export function createAppToolkit(appDir: string, options: AppToolkitOptions = {}
|
|
|
186
201
|
return loadViewSnapshotSync(viewCtx, contracts);
|
|
187
202
|
}
|
|
188
203
|
|
|
204
|
+
/** 服务双键解析的已配置键集(integrations services 节键——宽松形态防御式提取) */
|
|
205
|
+
function configuredServiceKeys(snap: ReturnType<typeof snapshot>): string[] {
|
|
206
|
+
const services = (snap.integrations as { services?: Record<string, unknown> } | null)?.services;
|
|
207
|
+
return services && typeof services === 'object' ? Object.keys(services) : [];
|
|
208
|
+
}
|
|
209
|
+
|
|
189
210
|
/** 谓词全量 issues(求值轴/写后复查共用——contracts 注入 + buildPredicateAssembly 单源装配,FX-2b:
|
|
190
211
|
* 与 CLI doctor 规则同装配面——「面板 issues ≡ doctor issues」机制保证) */
|
|
191
212
|
async function predicateIssues(): Promise<IntegrationServiceIssue[]> {
|
|
@@ -196,7 +217,6 @@ export function createAppToolkit(appDir: string, options: AppToolkitOptions = {}
|
|
|
196
217
|
const predicateContracts: PredicateContracts = {
|
|
197
218
|
resolveEffectiveService: assertFn(contracts.module.resolveEffectiveService, 'resolveEffectiveService'),
|
|
198
219
|
buildSupplyLookup: assertFn(contracts.module.buildSupplyLookup, 'buildSupplyLookup'),
|
|
199
|
-
moduleDomainOf: assertFn(contracts.module.moduleDomainOf, 'moduleDomainOf'),
|
|
200
220
|
normalizeInstances: assertFn(contracts.module.normalizeInstances, 'normalizeInstances'),
|
|
201
221
|
RESOURCE_TYPE_IDS: (contracts.module.RESOURCE_TYPE_IDS ?? []) as readonly string[],
|
|
202
222
|
};
|
|
@@ -234,7 +254,9 @@ export function createAppToolkit(appDir: string, options: AppToolkitOptions = {}
|
|
|
234
254
|
assertAxisProviderUsable('moduleProvider', o?.moduleProvider, include); // ①' D37 轴参严检(先于 404)
|
|
235
255
|
const contracts = await resolveContractsForApp(appDir);
|
|
236
256
|
const snap = snapshot(contracts);
|
|
237
|
-
|
|
257
|
+
// ② 双键寻址(v7 词汇统一):路径参数 id 优先、唯一展示名兜底 → 真实 id(404 面)
|
|
258
|
+
const mod = resolveModuleKey(snap.walk, moduleId);
|
|
259
|
+
const view = loadModuleDetailView(snap, mod.id);
|
|
238
260
|
if (include.has('serviceResolutions')) {
|
|
239
261
|
view.serviceResolutions = contracts.evaluation && contracts.strictValidation
|
|
240
262
|
? await predicateIssues().then((issues) =>
|
|
@@ -243,7 +265,7 @@ export function createAppToolkit(appDir: string, options: AppToolkitOptions = {}
|
|
|
243
265
|
}
|
|
244
266
|
if (include.has('integrationSchemas') || include.has('integrationFieldRegistry')) {
|
|
245
267
|
// v4.6 D37:表单层双投影同源一次计算(双取单算 + I1——假想重定向天然同步)
|
|
246
|
-
const form = loadModuleFormViews(snap,
|
|
268
|
+
const form = loadModuleFormViews(snap, mod.id, o?.moduleProvider);
|
|
247
269
|
if (include.has('integrationSchemas')) view.integrationSchemas = form.integrationSchemas;
|
|
248
270
|
if (include.has('integrationFieldRegistry')) view.integrationFieldRegistry = form.integrationFieldRegistry;
|
|
249
271
|
}
|
|
@@ -268,13 +290,19 @@ export function createAppToolkit(appDir: string, options: AppToolkitOptions = {}
|
|
|
268
290
|
return view;
|
|
269
291
|
},
|
|
270
292
|
// v4.7 D38:include 镜像 loadModule 三段式——① 输入校验 400 先于 404 ② 视图 ③ 静态富化(永不 503)
|
|
293
|
+
// G 批:service 轴 += integrationFieldRegistry(loadServiceFieldRegistry——D38 四分支链复用)
|
|
271
294
|
async loadService(service: string, o?: { include?: string[] }): Promise<ServiceDetail> {
|
|
272
295
|
const include = validateInclude('service', o?.include);
|
|
273
296
|
const contracts = await resolveContractsForApp(appDir);
|
|
274
297
|
const snap = snapshot(contracts); // 单快照——detail 与 include 装配共享
|
|
275
|
-
|
|
298
|
+
// 双键寻址(v7):id 优先、唯一展示名兜底 → 真实 service id(404 面)
|
|
299
|
+
const serviceId = resolveServiceKey(snap.walk, configuredServiceKeys(snap), service);
|
|
300
|
+
const view = loadServiceDetailView(snap, serviceId);
|
|
276
301
|
if (include.has('integrationSchemas')) {
|
|
277
|
-
view.integrationSchemas = loadServiceIntegrationSchemas(snap,
|
|
302
|
+
view.integrationSchemas = loadServiceIntegrationSchemas(snap, serviceId);
|
|
303
|
+
}
|
|
304
|
+
if (include.has('integrationFieldRegistry')) {
|
|
305
|
+
view.integrationFieldRegistry = loadServiceFieldRegistry(snap, serviceId);
|
|
278
306
|
}
|
|
279
307
|
return view;
|
|
280
308
|
},
|
|
@@ -287,8 +315,10 @@ export function createAppToolkit(appDir: string, options: AppToolkitOptions = {}
|
|
|
287
315
|
async loadServiceResolution(service: string) {
|
|
288
316
|
const contracts = await resolveContractsForApp(appDir);
|
|
289
317
|
assertContractsUsable(contracts);
|
|
318
|
+
const snap = snapshot(contracts);
|
|
319
|
+
const serviceId = resolveServiceKey(snap.walk, configuredServiceKeys(snap), service);
|
|
290
320
|
const issues = await predicateIssues();
|
|
291
|
-
return loadServiceResolutionDetail(
|
|
321
|
+
return loadServiceResolutionDetail(serviceId, snap, issues);
|
|
292
322
|
},
|
|
293
323
|
async loadProviders() {
|
|
294
324
|
const contracts = await resolveContractsForApp(appDir);
|
|
@@ -301,7 +331,10 @@ export function createAppToolkit(appDir: string, options: AppToolkitOptions = {}
|
|
|
301
331
|
},
|
|
302
332
|
async loadProviderService(provider: string, service: string) {
|
|
303
333
|
const contracts = await resolveContractsForApp(appDir);
|
|
304
|
-
|
|
334
|
+
const snap = snapshot(contracts);
|
|
335
|
+
// 服务轴双键寻址(provider 轴不兜底——厂商键即词汇)
|
|
336
|
+
const serviceId = resolveServiceKey(snap.walk, configuredServiceKeys(snap), service);
|
|
337
|
+
return loadProviderServiceDetailView(snap, provider, serviceId);
|
|
305
338
|
},
|
|
306
339
|
// v4.4 D33:凭据域双端点(应用状态轴 / 供给轴静态——零门控零求值,永不 503)
|
|
307
340
|
async loadCredentials(): Promise<CredentialsView> {
|
|
@@ -330,19 +363,31 @@ export function createAppToolkit(appDir: string, options: AppToolkitOptions = {}
|
|
|
330
363
|
await core.warmup();
|
|
331
364
|
const contracts = await resolveContractsForApp(appDir);
|
|
332
365
|
assertContractsUsable(contracts);
|
|
333
|
-
|
|
366
|
+
// enqueue 闭包内双键解析(写时新鲜度)——落盘键恒真实 id
|
|
367
|
+
return enqueue(() => {
|
|
368
|
+
const mod = resolveModuleKey(snapshot(contracts).walk, moduleId);
|
|
369
|
+
return core.applyModule(mod.id, node as Record<string, unknown>, o);
|
|
370
|
+
});
|
|
334
371
|
},
|
|
335
372
|
async writeServiceIntegration(service: string, node: ServiceIntegrationNode, o?: WriteOptions) {
|
|
336
373
|
await core.warmup();
|
|
337
374
|
const contracts = await resolveContractsForApp(appDir);
|
|
338
375
|
assertContractsUsable(contracts);
|
|
339
|
-
return enqueue(() =>
|
|
376
|
+
return enqueue(() => {
|
|
377
|
+
const snap = snapshot(contracts);
|
|
378
|
+
const serviceId = resolveServiceKey(snap.walk, configuredServiceKeys(snap), service);
|
|
379
|
+
return core.applyService(serviceId, node as Record<string, unknown>, o);
|
|
380
|
+
});
|
|
340
381
|
},
|
|
341
382
|
async deleteServiceIntegration(service: string) {
|
|
342
383
|
await core.warmup();
|
|
343
384
|
const contracts = await resolveContractsForApp(appDir);
|
|
344
385
|
assertContractsUsable(contracts);
|
|
345
|
-
return enqueue(() =>
|
|
386
|
+
return enqueue(() => {
|
|
387
|
+
const snap = snapshot(contracts);
|
|
388
|
+
const serviceId = resolveServiceKey(snap.walk, configuredServiceKeys(snap), service);
|
|
389
|
+
return core.deleteService(serviceId);
|
|
390
|
+
});
|
|
346
391
|
},
|
|
347
392
|
};
|
|
348
393
|
|
|
@@ -385,7 +430,6 @@ export function createAppToolkit(appDir: string, options: AppToolkitOptions = {}
|
|
|
385
430
|
const predicateContracts: PredicateContracts = {
|
|
386
431
|
resolveEffectiveService: assertFn(contracts.module.resolveEffectiveService, 'resolveEffectiveService'),
|
|
387
432
|
buildSupplyLookup: assertFn(contracts.module.buildSupplyLookup, 'buildSupplyLookup'),
|
|
388
|
-
moduleDomainOf: assertFn(contracts.module.moduleDomainOf, 'moduleDomainOf'),
|
|
389
433
|
normalizeInstances: assertFn(contracts.module.normalizeInstances, 'normalizeInstances'),
|
|
390
434
|
RESOURCE_TYPE_IDS: (contracts.module.RESOURCE_TYPE_IDS ?? []) as readonly string[],
|
|
391
435
|
};
|
package/src/index.ts
CHANGED
|
@@ -10,14 +10,16 @@ export {
|
|
|
10
10
|
tabContribSchema,
|
|
11
11
|
moduleDependencySchema,
|
|
12
12
|
providerSlotContribSchema,
|
|
13
|
-
|
|
13
|
+
serviceConsumeContribSchema,
|
|
14
|
+
serviceOwnContribSchema,
|
|
14
15
|
resourceNeedContribSchema,
|
|
15
16
|
} from './core/module-schema.js';
|
|
16
17
|
export type {
|
|
17
18
|
ModuleDescriptor,
|
|
18
19
|
CardContrib,
|
|
19
20
|
ProviderSlotContrib,
|
|
20
|
-
|
|
21
|
+
ServiceConsumeContrib,
|
|
22
|
+
ServiceOwnContrib,
|
|
21
23
|
ResourceNeedContrib,
|
|
22
24
|
ParseModuleResult,
|
|
23
25
|
} from './core/module-schema.js';
|
|
@@ -63,13 +65,15 @@ export type { PruneResult } from './integrations/prune-bindings.js';
|
|
|
63
65
|
|
|
64
66
|
// ── assembly 层(目录知识——walkManifests 四产物 + catalog 双形态 + 组合单体装配)──
|
|
65
67
|
export { walkManifests } from './assembly/walk-manifests.js';
|
|
66
|
-
|
|
68
|
+
// 双键寻址(v7 词汇统一——factory 七方法入口单点消费的解析 helper;纯参数式零 IO)
|
|
69
|
+
export { resolveModuleKey, resolveServiceKey } from './assembly/resolve-key.js';
|
|
70
|
+
export type { WalkManifestsResult, WalkModuleInfo, WalkCatalog, WalkProviderEntry, DeclarationIssue, SlotMeta } from './assembly/walk-manifests.js';
|
|
67
71
|
export { readAppManifest, writeAppManifest, manifestPath } from './assembly/app-manifest.js';
|
|
68
72
|
export type { AppManifest, NpmModuleEntry, ModuleMode } from './assembly/app-manifest.js';
|
|
69
73
|
export { loadProviderCatalog, loadProviderCatalogRaw } from './assembly/provider-catalog.js';
|
|
70
74
|
export type { BridgeProviderCatalog, ProviderServiceSchemas, ProviderServiceSchemasResult } from './assembly/provider-catalog.js';
|
|
71
75
|
|
|
72
|
-
// ── integrations 层(领域——读/写核心/凭据双工件/mock
|
|
76
|
+
// ── integrations 层(领域——读/写核心/凭据双工件/mock 绑定;v6 模块绑定单源)──
|
|
73
77
|
export { readIntegrationsConfig, readIntegrationsStrict } from './integrations/read.js';
|
|
74
78
|
export type { ReadIntegrationsResult } from './integrations/read.js';
|
|
75
79
|
export { createWriteCore, deepEqual } from './integrations/write.js';
|
|
@@ -78,6 +82,9 @@ export { ensureMockBindings } from './integrations/mock-bindings.js';
|
|
|
78
82
|
export type { MockBindingsResult } from './integrations/mock-bindings.js';
|
|
79
83
|
export { reconcileOrphanCredentials, credentialArtifactExists } from './integrations/credentials.js';
|
|
80
84
|
export type { AppliedCredential, CredentialInput, OrphanIssue, PlannedCredential } from './integrations/credentials.js';
|
|
85
|
+
// v6 所有权模型单源(module-binding——resolveModuleBinding/写守卫/归属表直通)
|
|
86
|
+
export { buildOwnershipMap, moduleOwnershipWritable, resolveModuleBinding, providerFootprint } from './integrations/module-binding.js';
|
|
87
|
+
export type { ModuleOwnershipWritability } from './integrations/module-binding.js';
|
|
81
88
|
|
|
82
89
|
// ── 错误面(领域 6 码——AppToolkitError;name 字面量约定见 errors.ts)──
|
|
83
90
|
export { AppToolkitError, contractsNotResolvedMessage } from './core/errors.js';
|
|
@@ -89,7 +96,7 @@ export { loadAppView } from './views/app.js';
|
|
|
89
96
|
export { loadServiceDetailView } from './views/service-detail.js';
|
|
90
97
|
export { loadProvidersView, loadProviderDetailView, loadProviderServiceDetailView } from './views/providers.js';
|
|
91
98
|
export { loadServiceResolutionsView, loadServiceResolutionDetail, resolveServiceSummary } from './views/service-resolutions.js';
|
|
92
|
-
export { loadAppIntegrationSchemas, loadModuleIntegrationSchemas, loadServiceIntegrationSchemas, resolveLayerIntegrationSchemas } from './views/integration-schemas.js';
|
|
99
|
+
export { loadAppIntegrationSchemas, loadModuleIntegrationSchemas, loadServiceIntegrationSchemas, loadServiceFieldRegistry, resolveLayerIntegrationSchemas, formProviderOf, buildIntegrationFieldRegistry } from './views/integration-schemas.js';
|
|
93
100
|
export { echoForRef, loadCredentialsView } from './views/credentials.js';
|
|
94
101
|
export { loadCredentialTypesView } from './views/credential-types.js';
|
|
95
102
|
export type { ViewContext, ViewSnapshot } from './views/context.js';
|
|
@@ -106,10 +113,10 @@ export type {
|
|
|
106
113
|
ModuleDeclaration,
|
|
107
114
|
ServiceDemand,
|
|
108
115
|
ModuleDetailView,
|
|
116
|
+
ModuleBinding,
|
|
109
117
|
AppView,
|
|
110
118
|
ServiceDetail,
|
|
111
119
|
ServiceIntegrationSchemas,
|
|
112
|
-
ProviderBinding,
|
|
113
120
|
LayerIntegrationSchemas,
|
|
114
121
|
IntegrationFieldRegistryView,
|
|
115
122
|
CredentialsView,
|
|
@@ -136,7 +143,7 @@ export type {
|
|
|
136
143
|
ContractsResolution,
|
|
137
144
|
IntegrationIssue,
|
|
138
145
|
} from './dto.js';
|
|
139
|
-
export { APP_INTEGRATION_NODE_KEYS } from './dto.js';
|
|
146
|
+
export { APP_INTEGRATION_NODE_KEYS, MODULE_INTEGRATION_NODE_KEYS } from './dto.js';
|
|
140
147
|
export {
|
|
141
148
|
readAppManifestFull,
|
|
142
149
|
upsertNpmModule,
|
|
@@ -29,7 +29,7 @@ export function ensureMockBindings(appDir: string): MockBindingsResult {
|
|
|
29
29
|
}
|
|
30
30
|
const slots: Array<{ service: string; provider: string; implementation: string }> = [];
|
|
31
31
|
for (const mod of walkManifests(appDir).modules) {
|
|
32
|
-
for (const slot of mod.descriptor.
|
|
32
|
+
for (const slot of mod.descriptor.declare.providers?.slots ?? []) {
|
|
33
33
|
if (slot.local !== true) continue;
|
|
34
34
|
slots.push({ service: slot.service, provider: slot.provider, implementation: slot.implementation });
|
|
35
35
|
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { walkManifests, type WalkCatalog, type WalkManifestsResult, type WalkModuleInfo } from '../assembly/walk-manifests.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 模块级联绑定单源(integrations v6 所有权模型——原 domain-binding.ts v4.4 F1/F3 重写)。
|
|
5
|
+
* integrations 层落位依据:谓词(同层)/ 写核(同层)/ views(下层可向上 import)三向消费
|
|
6
|
+
* 的唯一公共下层;import 前缀 guard 覆盖。
|
|
7
|
+
*
|
|
8
|
+
* 知识锚(module-tab note 单源锚表,v6 形态):
|
|
9
|
+
* 模块级联(值 + 层) = resolveModuleBinding —— 谓词 #7(per-module 生效厂商 ≡
|
|
10
|
+
* `modules[m].provider ?? root.provider`)/ deriveBindingLayer 模块级段 /
|
|
11
|
+
* buildInheritance module 段 / binding(单数)
|
|
12
|
+
* 归属表 = walk.ownership(单源聚合产物;buildOwnershipMap 桥直通——
|
|
13
|
+
* registry 显式参 / 谓词 / 写守卫 / views 四消费方零第二实现)
|
|
14
|
+
* 来源层四层推导 = deriveBindingLayer(views/service-resolutions,模块级段改调本文件)
|
|
15
|
+
* 写通道可用性 = moduleOwnershipWritable —— configEditable 读标志 / applyModule 400 守卫
|
|
16
|
+
* 共用(owns>0 唯一判据——多域归属合法化、共享键/多域判据随 D34 退役)
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/** 归属表构建(walk 单源直通——sdk 桥 re-export 消费;appDir 直入对齐 loadProviderCatalog
|
|
20
|
+
* 桥工效——模板装配第六行:`ownerOf: buildOwnershipMap(appDir)`)。 */
|
|
21
|
+
export function buildOwnershipMap(appDir: string): Record<string, string> {
|
|
22
|
+
return walkManifests(appDir).ownership;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** 模块级联绑定解析(值 + 来源层):provider 取非空字符串(模块级优先 → root 兜底;空串 = 缺席)。
|
|
26
|
+
* layer:modules[moduleId].provider 声明 → 'module';root 兜底 → 'app';双缺 → null(binding 双缺诚实态)。 */
|
|
27
|
+
export function resolveModuleBinding(
|
|
28
|
+
config: Record<string, unknown> | null,
|
|
29
|
+
moduleId: string,
|
|
30
|
+
): { provider: string | null; layer: 'module' | 'app' | null } {
|
|
31
|
+
const moduleProvider = (config?.modules as Record<string, { provider?: unknown }> | undefined)?.[moduleId]?.provider;
|
|
32
|
+
if (typeof moduleProvider === 'string' && moduleProvider.length > 0) {
|
|
33
|
+
return { provider: moduleProvider, layer: 'module' };
|
|
34
|
+
}
|
|
35
|
+
const rootProvider = config?.provider;
|
|
36
|
+
if (typeof rootProvider === 'string' && rootProvider.length > 0) {
|
|
37
|
+
return { provider: rootProvider, layer: 'app' };
|
|
38
|
+
}
|
|
39
|
+
return { provider: null, layer: null };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** 模块集成位可写性(v6 判别联合——configEditable 读标志与 applyModule 写守卫共用单源):
|
|
43
|
+
* owns>0 唯一判据(D34 多域/shared-key 判据随 v6 退役——服务归属唯一真源 = declare.owns)。 */
|
|
44
|
+
export type ModuleOwnershipWritability =
|
|
45
|
+
| { writable: true; ownedServices: string[] }
|
|
46
|
+
| { writable: false; reason: 'zero-ownership'; ownedServices: [] };
|
|
47
|
+
|
|
48
|
+
export function moduleOwnershipWritable(
|
|
49
|
+
_walk: Pick<WalkManifestsResult, 'modules' | 'catalog' | 'ownership'>,
|
|
50
|
+
mod: WalkModuleInfo,
|
|
51
|
+
): ModuleOwnershipWritability {
|
|
52
|
+
const ownedServices = (mod.descriptor.declare.owns ?? []).map((o) => o.service).sort();
|
|
53
|
+
if (ownedServices.length === 0) return { writable: false, reason: 'zero-ownership', ownedServices: [] };
|
|
54
|
+
return { writable: true, ownedServices };
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** 供给足迹(该厂商全部供给服务并集——应用级 integrationSchemas 作用域,D32) */
|
|
58
|
+
export function providerFootprint(catalog: WalkCatalog, provider: string): string[] {
|
|
59
|
+
return [...new Set(Object.values(catalog.providers[provider] ?? {}).flatMap((e) => e.services))].sort();
|
|
60
|
+
}
|
|
@@ -27,21 +27,26 @@ export interface PredicateIoInputs {
|
|
|
27
27
|
credentialSchemaMissing: Record<string, boolean>;
|
|
28
28
|
/** #7:厂商 → configSchema properties 键集并集 */
|
|
29
29
|
vendorConfigKeys: Record<string, Set<string>>;
|
|
30
|
+
/** #17(G 批):厂商 → x-tbox-global 标记键集(与 vendorConfigKeys 同循环收集——零新增 IO) */
|
|
31
|
+
vendorGlobalConfigKeys: Record<string, Set<string>>;
|
|
30
32
|
/** #7:厂商 → configSchema 引用缺失(跳过该厂商死配置判定) */
|
|
31
33
|
vendorConfigSchemaMissing: Record<string, boolean>;
|
|
32
34
|
/** #9:实现覆盖跨厂商提示文案(已成形——谓词直投) */
|
|
33
35
|
realmSwitchHints: string[];
|
|
34
36
|
/** #8:root instances 注册表 ids(在场才传;缺席 → 键检查跳过) */
|
|
35
37
|
malls?: string[];
|
|
36
|
-
/** #15-#16:已装模块 id → manifest
|
|
38
|
+
/** #15-#16:已装模块 id → manifest declare.resources 声明 id 集 */
|
|
37
39
|
moduleResourceNeeds: Record<string, ReadonlySet<string>>;
|
|
38
40
|
}
|
|
39
41
|
|
|
40
|
-
/** 装配全产物(= PredicateIoInputs +
|
|
42
|
+
/** 装配全产物(= PredicateIoInputs + 供给/需求/归属聚合——喂 evaluateIntegrationServices 的
|
|
41
43
|
* 非 contracts/integrations 入参全集,两消费方 spread 直投,零各自组装) */
|
|
42
44
|
export interface PredicateAssembly extends PredicateIoInputs {
|
|
43
45
|
suppliedProviders: Record<string, { services: string[]; owner: string; credentialType?: string }>;
|
|
44
46
|
demandedServices: Record<string, { optional: boolean; owners: string[] }>;
|
|
47
|
+
/** v6:服务归属表 + 已装模块 id 集(MODULE_CONFIG_DEAD / #12 ownerOf 透传) */
|
|
48
|
+
ownership?: Record<string, string>;
|
|
49
|
+
installedModuleIds?: ReadonlySet<string>;
|
|
45
50
|
}
|
|
46
51
|
|
|
47
52
|
/** stem → env 键(kebab → UPPER_SNAKE;与 SDK/provider-secret env 兜底同公式) */
|
|
@@ -95,19 +100,30 @@ export function buildPredicateAssembly(
|
|
|
95
100
|
demandedServices[service] = { optional: entry.optional, owners: [...entry.owners] };
|
|
96
101
|
}
|
|
97
102
|
|
|
98
|
-
// ── #6/#7 schema 档案 + #15/#16 需求面(manifest 引用 → 存在性 + 键集;双通道)──
|
|
103
|
+
// ── #6/#7/#17 schema 档案 + #15/#16 需求面(manifest 引用 → 存在性 + 键集;双通道)──
|
|
99
104
|
const vendorConfigKeys: Record<string, Set<string>> = {};
|
|
105
|
+
const vendorGlobalConfigKeys: Record<string, Set<string>> = {};
|
|
100
106
|
const vendorConfigSchemaMissing: Record<string, boolean> = {};
|
|
101
107
|
const credentialSchemaMissing: Record<string, boolean> = {};
|
|
102
108
|
const moduleResourceNeeds: Record<string, ReadonlySet<string>> = {};
|
|
103
109
|
for (const mod of walk.modules) {
|
|
104
|
-
moduleResourceNeeds[mod.id] = new Set((mod.descriptor.
|
|
105
|
-
for (const slot of mod.descriptor.
|
|
110
|
+
moduleResourceNeeds[mod.id] = new Set((mod.descriptor.declare.resources ?? []).map((r) => r.id));
|
|
111
|
+
for (const slot of mod.descriptor.declare.providers?.slots ?? []) {
|
|
106
112
|
if (slot.configSchema) {
|
|
107
113
|
const schema = readJsonOrNull(join(mod.dir, slot.configSchema));
|
|
108
114
|
if (schema) {
|
|
109
115
|
const bucket = (vendorConfigKeys[slot.provider] ??= new Set<string>());
|
|
116
|
+
const globalBucket = (vendorGlobalConfigKeys[slot.provider] ??= new Set<string>());
|
|
110
117
|
for (const k of collectPropertyKeys(schema)) bucket.add(k);
|
|
118
|
+
// G 批:x-tbox-global 标记键同循环收集(properties[k]['x-tbox-global'] === true)
|
|
119
|
+
const props = schema.properties;
|
|
120
|
+
if (props && typeof props === 'object' && !Array.isArray(props)) {
|
|
121
|
+
for (const [k, v] of Object.entries(props as Record<string, unknown>)) {
|
|
122
|
+
if (v && typeof v === 'object' && (v as Record<string, unknown>)['x-tbox-global'] === true) {
|
|
123
|
+
globalBucket.add(k);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
111
127
|
} else {
|
|
112
128
|
vendorConfigSchemaMissing[slot.provider] = true;
|
|
113
129
|
}
|
|
@@ -191,9 +207,14 @@ export function buildPredicateAssembly(
|
|
|
191
207
|
credentialFileType,
|
|
192
208
|
credentialSchemaMissing,
|
|
193
209
|
vendorConfigKeys,
|
|
210
|
+
vendorGlobalConfigKeys,
|
|
194
211
|
vendorConfigSchemaMissing,
|
|
195
212
|
realmSwitchHints,
|
|
196
213
|
moduleResourceNeeds,
|
|
197
214
|
...(mallIds.length > 0 ? { malls: mallIds } : {}),
|
|
215
|
+
// v6:归属面(MODULE_CONFIG_DEAD 判据 + #12 ownerOf 透传——walk 单源直取;
|
|
216
|
+
// installed 并入归属方——dev 通道模块 manifest id ∉ walk.modules,聚合宽/声明窄 N3)
|
|
217
|
+
ownership: walk.ownership,
|
|
218
|
+
installedModuleIds: new Set([...walk.modules.map((m) => m.id), ...new Set(Object.values(walk.ownership))]),
|
|
198
219
|
};
|
|
199
220
|
}
|