@tbox.cn/app-toolkit 0.7.5 → 0.8.1
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/index.d.ts +1181 -1111
- package/dist/index.js +9 -9
- package/package.json +2 -2
- package/src/assembly/walk-manifests.ts +48 -10
- package/src/core/module-schema.ts +6 -0
- package/src/dto.ts +89 -68
- package/src/factory.ts +44 -57
- package/src/index.ts +10 -4
- package/src/integrations/predicate.ts +5 -9
- package/src/integrations/provider-binding.ts +83 -0
- package/src/views/app.ts +3 -1
- package/src/views/credential-types.ts +0 -1
- package/src/views/credentials.ts +3 -2
- package/src/views/integration-schemas.ts +17 -42
- package/src/views/modules.ts +14 -4
- package/src/views/provider-supply.ts +51 -0
- package/src/views/providers.ts +15 -49
- package/src/views/service-detail.ts +4 -5
- package/src/views/service-resolutions.ts +36 -13
- package/tests/credentials-view.test.ts +1 -3
- package/tests/demo-app.ts +31 -2
- package/tests/naming-alignment.test.ts +1 -1
- package/tests/provider-binding-supply.test.ts +508 -0
- package/tests/resolve-key.test.ts +4 -4
- package/tests/views.test.ts +83 -623
package/src/dto.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* DTO 全量(api.md §3 字段级单源落源——
|
|
2
|
+
* DTO 全量(api.md §3 字段级单源落源——39 类型(v8:+ResolvedProvider/ProviderBinding/
|
|
3
|
+
* ProviderSupplyScope/ProviderSupplyView,−ProviderDetail/dto 侧 SaveResult 死定义;
|
|
4
|
+
* 11 项弃用标记按两迭代协议 0.9.0 删);演进 additive-only,铁律 #8——v8 弃用窗口例外
|
|
5
|
+
* 声明见各 @deprecated)。
|
|
3
6
|
* agtcodingbox / tbox-ai-coding 经 `import type` 消费(L2 DTO 单源——API 层零类型镜像)。
|
|
4
7
|
* 词汇七概念:app / module / service / instance / provider / integration / resolution。
|
|
5
8
|
* 弃用词汇清单见 api.md §3 尾(component/slot/scope/configMode/…——防复活)。
|
|
@@ -27,6 +30,30 @@ export type ServiceStatus =
|
|
|
27
30
|
/** 四配置层(instance 为 map 字段层) */
|
|
28
31
|
export type BindingLayer = 'app' | 'module' | 'service' | 'instance';
|
|
29
32
|
|
|
33
|
+
/** provider + 来源层对(成对出现防漂移——「生效绑定」原子形状) */
|
|
34
|
+
export interface ResolvedProvider {
|
|
35
|
+
provider: string | null;
|
|
36
|
+
layer: BindingLayer | null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** 三轴同构 provider 绑定解析(v8——app/module/service 静态视图缺省携带;静态零 contracts,
|
|
40
|
+
* 「数据来源」状态服务端单源——派生知识不泄漏客户端)。
|
|
41
|
+
* 口径钉子:静态三视图 = node 级口径(effective.layer 恒 ≠ 'instance',实例层无条件排除);
|
|
42
|
+
* 求值轴 Entry.binding = 默认实例口径(layer 可为 'instance')。两口径文档化分立。 */
|
|
43
|
+
export interface ProviderBinding {
|
|
44
|
+
/** 本节点显式配置(文件 provider 归一:缺席/空串/malformed = null;弃用内联对象 = 其名) */
|
|
45
|
+
configured: string | null;
|
|
46
|
+
/** 实际生效(configured 非空 = 本层;否则 = 继承上级;全链未配置 = {null, null}) */
|
|
47
|
+
effective: ResolvedProvider;
|
|
48
|
+
/** 清除本级配置后的继承回落(「跟随上级」选项回显);app 轴恒 {null, null}(无上级) */
|
|
49
|
+
inherited: ResolvedProvider;
|
|
50
|
+
/** @deprecated 0.8.0 = effective.provider——仅 ModuleDetailView.binding 双写(App/Service 新
|
|
51
|
+
* 字段不发射);0.9.0 删 */
|
|
52
|
+
provider?: string | null;
|
|
53
|
+
/** @deprecated 0.8.0 = effective.layer——同上;0.9.0 删 */
|
|
54
|
+
layer?: BindingLayer | null;
|
|
55
|
+
}
|
|
56
|
+
|
|
30
57
|
// ===== 需求轴(GET /modules · 静态)=====
|
|
31
58
|
|
|
32
59
|
/** 纯模块清单(无 services——卡片展开走 /modules/:m);provider 家族包不在清单
|
|
@@ -78,9 +105,9 @@ export interface ModuleDetailView {
|
|
|
78
105
|
/** 模块资源只读镜像(N2 读半边——写侧 resources 恒保全;含 ref 台账展开态 resolvedDatasetId);
|
|
79
106
|
* 无模块键/无资源节 = null */
|
|
80
107
|
resources?: ModuleResourcesEcho | null;
|
|
81
|
-
/**
|
|
82
|
-
*
|
|
83
|
-
binding:
|
|
108
|
+
/** v8 三轴同构升级(ModuleBinding 升形):模块级绑定解析(moduleProviderBinding 单源——
|
|
109
|
+
* configured/effective/inherited;legacy provider/layer 双写仅本视图发射,0.9.0 删) */
|
|
110
|
+
binding: ProviderBinding;
|
|
84
111
|
/** v6:owns.length > 0(moduleOwnershipWritable 单源——读标志与写守卫共用) */
|
|
85
112
|
configEditable: boolean;
|
|
86
113
|
/** 本模块服务面 = demand ∪ owned 去重投影(2026-09-21 服务面投影批——通用合并无 consumes
|
|
@@ -96,7 +123,9 @@ export interface ModuleDetailView {
|
|
|
96
123
|
integrationFieldRegistry?: IntegrationFieldRegistryView | null;
|
|
97
124
|
}
|
|
98
125
|
|
|
99
|
-
/** 模块级厂商绑定解析(v6——静态文件事实;规则 ≡ 谓词 #7 模块层,resolveModuleBinding
|
|
126
|
+
/** 模块级厂商绑定解析(v6——静态文件事实;规则 ≡ 谓词 #7 模块层,resolveModuleBinding 单源)。
|
|
127
|
+
* @deprecated 0.8.0——三轴同构 ProviderBinding 取代(ModuleDetailView.binding 升形,
|
|
128
|
+
* 旧 {provider, layer} = 新 effective 子集且由 legacy 字段双写承载);0.9.0 删除类型。 */
|
|
100
129
|
export interface ModuleBinding {
|
|
101
130
|
/** modules[install id].provider ?? root.provider(双缺 = null) */
|
|
102
131
|
provider: string | null;
|
|
@@ -104,7 +133,9 @@ export interface ModuleBinding {
|
|
|
104
133
|
layer: 'module' | 'app' | null;
|
|
105
134
|
}
|
|
106
135
|
|
|
107
|
-
/** 层级 config schema 计算(v4.4——静态轴富化,零 contracts
|
|
136
|
+
/** 层级 config schema 计算(v4.4——静态轴富化,零 contracts)。
|
|
137
|
+
* @deprecated 0.8.0——表单统一走 integrationFieldRegistry(消费投影);原始投影降为
|
|
138
|
+
* registry 构造内部输入(wire include 键 integrationSchemas 标记弃用,0.9.0 删)。 */
|
|
108
139
|
export interface LayerIntegrationSchemas {
|
|
109
140
|
/** 层生效厂商(resolveModuleBinding 单源) */
|
|
110
141
|
provider: string;
|
|
@@ -119,9 +150,6 @@ export interface IntegrationFieldRegistryView {
|
|
|
119
150
|
provider: string;
|
|
120
151
|
/** 作用域内 configSchema === null 的服务(UI「未提供参数模板」提示行) */
|
|
121
152
|
schemaless: string[];
|
|
122
|
-
/** module 轴 = ownedServices − 该厂商供给(v6.1 scope 随归属——loadModuleFormViews 单源,
|
|
123
|
-
* Set 去重保序);app 轴恒 [](结构性:足迹 ⊆ 供给) */
|
|
124
|
-
unsupplied: string[];
|
|
125
153
|
/** 作用域内全部非 null schema 的 additionalProperties 均 ≠ false(聚合;空真) */
|
|
126
154
|
additionalPropertiesAllowed: boolean;
|
|
127
155
|
/** 逐 key 合并产物(首声明插入序 = scope 遍历序:app 字母序 / module ownedServices 序) */
|
|
@@ -144,6 +172,9 @@ export interface AppView {
|
|
|
144
172
|
services: ServiceDemand[];
|
|
145
173
|
/** root 节点原值;文件缺席 = null */
|
|
146
174
|
integration: AppIntegrationNode | null;
|
|
175
|
+
/** v8:app 轴绑定解析(appProviderBinding——configured ≡ effective(无上级);
|
|
176
|
+
* inherited 恒 {null, null};「数据来源」状态单源) */
|
|
177
|
+
binding: ProviderBinding;
|
|
147
178
|
/** v4.4 include=serviceResolutions 内嵌(全量键集 ≡ 批量无参;<0.9/形态异常 → null——永不 503) */
|
|
148
179
|
serviceResolutions?: ServiceResolutionsView | null;
|
|
149
180
|
/** v4.4 include=integrationSchemas 层级富化(root.provider 缺席 → null) */
|
|
@@ -155,14 +186,14 @@ export interface AppView {
|
|
|
155
186
|
|
|
156
187
|
/** GET /services/:service(服务静态单体) */
|
|
157
188
|
export interface ServiceDetail extends ServiceDemand {
|
|
158
|
-
/** manifest 预填(唯一落位) */
|
|
159
|
-
defaults: Array<{ provider: string; implementation: string }>;
|
|
160
189
|
/** 文件 services[s] 逐字原值(编辑预填源);无声明 = null */
|
|
161
190
|
integration: ServiceIntegrationNode | null;
|
|
162
|
-
/**
|
|
163
|
-
|
|
191
|
+
/** v8:service 轴绑定解析(serviceProviderBinding 单源——node 级口径,实例层排除;
|
|
192
|
+
* inherited = 上级绑定 owner 模块 ?? root——「跟随上级」选项回显) */
|
|
193
|
+
binding: ProviderBinding;
|
|
164
194
|
/** v4.7 include=integrationSchemas 生效绑定富化(三态:null 全链未绑定 /
|
|
165
|
-
* 绑定无可计算 schema / 含 schema;malformed 节点 → null——不放行域级联)
|
|
195
|
+
* 绑定无可计算 schema / 含 schema;malformed 节点 → null——不放行域级联)
|
|
196
|
+
* @deprecated 0.8.0——表单统一走 integrationFieldRegistry;生效厂商归 binding.effective。0.9.0 删 */
|
|
166
197
|
integrationSchemas?: ServiceIntegrationSchemas | null;
|
|
167
198
|
/** G 批:include=integrationFieldRegistry 服务轴注册表(loadServiceFieldRegistry——
|
|
168
199
|
* 四分支链推导复用 fields = 该 schema 全部字段带 global 旗标;null 语义镜像 。
|
|
@@ -172,10 +203,10 @@ export interface ServiceDetail extends ServiceDemand {
|
|
|
172
203
|
}
|
|
173
204
|
|
|
174
205
|
/** 服务级生效绑定 schema(v4.7 静态轴富化——零 contracts,永不 503;实例层无条件排除:
|
|
175
|
-
* node 级口径 ≠ resolution 默认实例口径,api.md §4.4
|
|
206
|
+
* node 级口径 ≠ resolution 默认实例口径,api.md §4.4 注)。
|
|
207
|
+
* @deprecated 0.8.0——表单统一走 integrationFieldRegistry;生效厂商归 binding.effective。0.9.0 删 */
|
|
176
208
|
export interface ServiceIntegrationSchemas {
|
|
177
|
-
/** 生效厂商:显式(含内联声明名)?? modules[ownerOf].provider ?? root.provider
|
|
178
|
-
* v5.1 serviceProvider 轴参在场时 = 假想短路值(非链解析产物) */
|
|
209
|
+
/** 生效厂商:显式(含内联声明名)?? modules[ownerOf].provider ?? root.provider */
|
|
179
210
|
provider: string;
|
|
180
211
|
/** catalog 复合键(多 impl 声明序首个)> 内联 ref;miss(未知厂商/未供给/内联缺 ref)→ null(富化非门控) */
|
|
181
212
|
configSchema: object | null;
|
|
@@ -198,10 +229,12 @@ export interface ServiceResolutionEntry {
|
|
|
198
229
|
/** 默认实例口径(normalizeInstances 委托) */
|
|
199
230
|
status: ServiceStatus;
|
|
200
231
|
statusMessage?: string;
|
|
201
|
-
/**
|
|
232
|
+
/** 生效绑定对(provider 在场时恒在场;默认实例口径——layer 可为 'instance';
|
|
233
|
+
* 与静态三视图 binding.effective 同概念同形状——「binding 一词到底」) */
|
|
234
|
+
binding?: ResolvedProvider;
|
|
235
|
+
/** @deprecated 0.8.0 → binding.provider(双写一个窗口);0.9.0 删 */
|
|
202
236
|
provider?: string;
|
|
203
|
-
/**
|
|
204
|
-
* (ok/binding-unresolved 取声明层;未配置双缺席);≡ 单体 inheritance 链逆序首个有 provider 的层 */
|
|
237
|
+
/** @deprecated 0.8.0 → binding.layer(同上);0.9.0 删 */
|
|
205
238
|
layer?: BindingLayer;
|
|
206
239
|
/** provider 在场时在场:(provider, service) ∈ 供给关系 */
|
|
207
240
|
supplied?: boolean;
|
|
@@ -310,6 +343,9 @@ export interface ServiceInstanceNode {
|
|
|
310
343
|
}
|
|
311
344
|
|
|
312
345
|
export interface InlineVendorDeclaration {
|
|
346
|
+
/** @deprecated 0.8.0——内联声明形态弃用:自定义 API 统一为 provider-custom 包自声明
|
|
347
|
+
* (provider 即模块——AI 实施即补槽声明;provider 恒字符串三层同构)。类型随节点
|
|
348
|
+
* wire 形状保留至 0.9.0(TIER0 zod 兼容读同窗);存量节点编辑器打开即自愈迁移。 */
|
|
313
349
|
provider: string;
|
|
314
350
|
credentialType: string;
|
|
315
351
|
configSchema?: string;
|
|
@@ -346,34 +382,8 @@ export interface ProviderEntry {
|
|
|
346
382
|
provider: string;
|
|
347
383
|
/** Mock 旗标(provider 级聚合) */
|
|
348
384
|
local: boolean;
|
|
349
|
-
/** 供给声明来源包名 */
|
|
350
|
-
owner: string;
|
|
351
385
|
/** 厂商展示名(v7 title→name:manifest name——多包首声明;缺席 = undefined) */
|
|
352
386
|
name?: string;
|
|
353
|
-
description?: string;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
/** GET /providers/:provider:供给足迹 */
|
|
357
|
-
export interface ProviderDetail {
|
|
358
|
-
provider: string;
|
|
359
|
-
local: boolean;
|
|
360
|
-
owner: string;
|
|
361
|
-
/** 厂商展示名(同 ProviderEntry——首声明透传) */
|
|
362
|
-
name?: string;
|
|
363
|
-
description?: string;
|
|
364
|
-
/** per (provider, service) 保真,同厂商异构合法;★ implementations 恒数组(H1——
|
|
365
|
-
* 多元素 = 升级窗口,UI 出 impl 选择器,PUT 显式钉版) */
|
|
366
|
-
services: Record<
|
|
367
|
-
string,
|
|
368
|
-
{
|
|
369
|
-
implementations: Array<{ implementation: string; credentialType: string }>;
|
|
370
|
-
/** 服务展示名(resolveServiceDisplay——词汇 > demand > id;恒发) */
|
|
371
|
-
name?: string;
|
|
372
|
-
description?: string;
|
|
373
|
-
/** v4.4 include=integrationSchemas 切换态批量(纯 config——凭据结构归 /credential-types) */
|
|
374
|
-
integrationSchemas?: { configSchema: object | null };
|
|
375
|
-
}
|
|
376
|
-
>;
|
|
377
387
|
}
|
|
378
388
|
|
|
379
389
|
/** GET /providers/:p/services/:s:表单 schema 唯一暴露面 */
|
|
@@ -382,13 +392,41 @@ export interface ProviderServiceDetail {
|
|
|
382
392
|
service: string;
|
|
383
393
|
/** ★ 恒数组(通常 1);credentialType 保留(/credential-types 寻址键) */
|
|
384
394
|
implementations: Array<{ implementation: string; credentialType: string }>;
|
|
385
|
-
/** 厂商集成该服务的表单 schema(integration 域专属)——
|
|
395
|
+
/** 厂商集成该服务的表单 schema(integration 域专属)——raw draft 2020-12 原文零转换;
|
|
396
|
+
* 供给在场未声明 = null(mock 合法);解析自默认 impl。v8 拍平(唯一推荐读取位) */
|
|
397
|
+
configSchema: object | null;
|
|
398
|
+
/** @deprecated 0.8.0 = { configSchema }(单键包裹 v4.4 credentialSchema 删除后的残留)——
|
|
399
|
+
* 双写一个窗口;0.9.0 删 */
|
|
386
400
|
integrationSchemas: {
|
|
387
|
-
/** raw draft 2020-12 原文零转换;供给在场未声明 = null(mock 合法);解析自默认 impl */
|
|
388
401
|
configSchema: object | null;
|
|
389
402
|
};
|
|
390
403
|
}
|
|
391
404
|
|
|
405
|
+
// ===== 供给判定(v8——切换预览唯一判定源,前端零供给关系计算)=====
|
|
406
|
+
|
|
407
|
+
/** 供给判定作用域(显式请求参数——三轴同构判定的作用域声明;wire = `?scope=` 判别值 +
|
|
408
|
+
* 伴随参数 `?module=` / `?service=`,不从其他参数推断)。
|
|
409
|
+
* scope = 该层绑定实际作用的服务集合:app = 在册服务全集(root 级联全域可达);
|
|
410
|
+
* module = 模块归属服务(declare.owns);service = 自身(任意 id 恒 200——判定非寻址)。 */
|
|
411
|
+
export type ProviderSupplyScope =
|
|
412
|
+
| { kind: 'app' }
|
|
413
|
+
| { kind: 'module'; module: string }
|
|
414
|
+
| { kind: 'service'; service: string };
|
|
415
|
+
|
|
416
|
+
/** GET /providers/:p/supply?scope=…(静态 · 零 contracts · 永不 503)——供给判定。
|
|
417
|
+
* 未保存切换预览(本端点)与已保存状态(求值轴 resolution.supplied)消费同一 catalog
|
|
418
|
+
* 供给关系,旗标同名同义。surplus(作用域外供给)不表达。边界:provider ∉ catalog →
|
|
419
|
+
* 404 PROVIDER_NOT_FOUND;scope=module 未装 → 404 MODULE_NOT_FOUND;已知厂商 + 不在
|
|
420
|
+
* 足迹的 service → 200 + supplied:false(判定非寻址,与组合单体 SUPPLY_NOT_FOUND 404
|
|
421
|
+
* 的有意分歧:combo 是表单寻址,本端点是判定查询)。 */
|
|
422
|
+
export interface ProviderSupplyView {
|
|
423
|
+
provider: string;
|
|
424
|
+
/** 作用域回显 */
|
|
425
|
+
scope: ProviderSupplyScope;
|
|
426
|
+
/** 作用域内逐服务判定(service 轴 = 单元素;name 走 resolveServiceDisplay 单源——恒有值) */
|
|
427
|
+
services: Array<{ service: string; name: string; supplied: boolean }>;
|
|
428
|
+
}
|
|
429
|
+
|
|
392
430
|
// ===== 凭据域(v4.4 独立端点)=====
|
|
393
431
|
|
|
394
432
|
/** GET /credentials:绑定位全量掩码回显(应用状态轴;GET 永无真值) */
|
|
@@ -415,8 +453,6 @@ export interface CredentialTypesView {
|
|
|
415
453
|
export interface CredentialTypeEntry {
|
|
416
454
|
/** '-' = 无凭据语义(mock/local——UI 判 '-' 不渲染凭据表单) */
|
|
417
455
|
credentialType: string;
|
|
418
|
-
/** 声明来源包名 */
|
|
419
|
-
owner: string;
|
|
420
456
|
/** raw draft 2020-12 原文;未声明 = null(ExtraFields 自由键值同轨) */
|
|
421
457
|
credentialSchema: object | null;
|
|
422
458
|
}
|
|
@@ -437,10 +473,8 @@ export interface EffectiveBinding {
|
|
|
437
473
|
export interface CredentialEcho {
|
|
438
474
|
/** credentialType(manifest 对齐) */
|
|
439
475
|
type: string;
|
|
440
|
-
/** 'secret://{stem}' */
|
|
476
|
+
/** 'secret://{stem}'(文件路径 = config/credentials/{stem}.json 确定性派生——stemToFilePath) */
|
|
441
477
|
ref: string;
|
|
442
|
-
/** 'config/credentials/{stem}.json' */
|
|
443
|
-
file: string;
|
|
444
478
|
/** 前 2 字符 + '****';≤4 字符全掩码;null = 缺字段 */
|
|
445
479
|
masked: Record<string, string | null>;
|
|
446
480
|
}
|
|
@@ -463,18 +497,5 @@ export interface IntegrationIssue {
|
|
|
463
497
|
instance?: string;
|
|
464
498
|
}
|
|
465
499
|
|
|
466
|
-
// =====
|
|
467
|
-
|
|
468
|
-
export interface SaveResult {
|
|
469
|
-
/** no-diff / dryRun → false */
|
|
470
|
-
written: boolean;
|
|
471
|
-
/** 恒 false 当 dryRun / no-diff / 应用未运行(onApplied 协作点回填) */
|
|
472
|
-
restartScheduled: boolean;
|
|
473
|
-
/** 触碰清单;dryRun = 将触碰预览(——与同 body 真实写逐字对称,含凭据工件路径;
|
|
474
|
-
* no-diff 早退 = 预览零触碰) */
|
|
475
|
-
files: string[];
|
|
476
|
-
/** 凭据工件(0..n;dryRun = 将创建的工件——确定性 stem 派生预览) */
|
|
477
|
-
credentials: Array<{ stem: string; ref: string; overwrote: boolean }>;
|
|
478
|
-
/** 写后谓词复查全量(dryRun 假想态唯一暴露面;含 ORPHANED_CREDENTIAL 等) */
|
|
479
|
-
issues: IntegrationIssue[];
|
|
480
|
-
}
|
|
500
|
+
// ===== 写响应(全族同型——唯一公开定义 = integrations/write.ts SaveResult;
|
|
501
|
+
// dto 侧死定义已删 v8 合一)=====
|
package/src/factory.ts
CHANGED
|
@@ -6,7 +6,8 @@ import { createFileCache } from './core/file-cache.js';
|
|
|
6
6
|
import { resolveContractsForApp, invalidateContractsResolver } from './core/contracts-resolver.js';
|
|
7
7
|
import type { ResolvedContracts } from './core/contracts-resolver.js';
|
|
8
8
|
import { parseModuleDescriptor } from './core/module-schema.js';
|
|
9
|
-
import {
|
|
9
|
+
import { loadProviderServiceDetailView, loadProvidersView } from './views/providers.js';
|
|
10
|
+
import { loadProviderSupplyView } from './views/provider-supply.js';
|
|
10
11
|
import { loadProviderCatalog, loadProviderCatalogRaw } from './assembly/provider-catalog.js';
|
|
11
12
|
import { readIntegrationsStrict, readIntegrationsConfig } from './integrations/read.js';
|
|
12
13
|
import { createWriteCore, type SaveResult, type WriteOptions } from './integrations/write.js';
|
|
@@ -37,8 +38,9 @@ import type {
|
|
|
37
38
|
CredentialsView,
|
|
38
39
|
ModuleDetailView,
|
|
39
40
|
ModuleIntegrationNode,
|
|
40
|
-
ProviderDetail,
|
|
41
41
|
ProviderServiceDetail,
|
|
42
|
+
ProviderSupplyScope,
|
|
43
|
+
ProviderSupplyView,
|
|
42
44
|
ProvidersView,
|
|
43
45
|
ServiceDetail,
|
|
44
46
|
ServiceIntegrationNode,
|
|
@@ -48,11 +50,10 @@ import type {
|
|
|
48
50
|
} from './dto.js';
|
|
49
51
|
|
|
50
52
|
/**
|
|
51
|
-
* createAppToolkit(C4 工厂;
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
* += serviceProvider 轴参(服务轴向假想绑定,三轴收口))。
|
|
53
|
+
* createAppToolkit(C4 工厂;v8——24 方法 = 11 读 + 4 写 + 9 Internals(−loadProvider【B 类
|
|
54
|
+
* 即删】+loadProviderSupply【供给判定端点】)。沿革:v4.4 include 选项;v4.6/v5.1 轴向假想
|
|
55
|
+
* 绑定选项(v8 退场,切换预览归 /providers/:p/supply);v7 读求值轴降级;v8 三静态
|
|
56
|
+
* 视图缺省携带 binding(「数据来源」状态单源)。
|
|
56
57
|
* AppToolkit = AppToolkitRead & AppToolkitWrite & AppToolkitInternals——
|
|
57
58
|
* Read+Write = HTTP 直通面 additive 冻结(L1 端点↔方法 1:1,L3 命名镜像:Integration=节点级 /
|
|
58
59
|
* Config=文件级);Internals = CLI/doctor/桥消费(自由演进)。
|
|
@@ -75,14 +76,13 @@ export interface AppToolkitOptions {
|
|
|
75
76
|
onApplied?: () => void;
|
|
76
77
|
}
|
|
77
78
|
|
|
78
|
-
/** include
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
79
|
+
/** include 协议白名单(键名 = 产出字段名 1:1;per 端点。
|
|
80
|
+
* v8:provider 轴随 loadProvider 即删;integrationSchemas 键 A 类弃用(平台前端表单主源
|
|
81
|
+
* 双写保护至 0.9.0 删——表单单轨 integrationFieldRegistry)。
|
|
82
|
+
* 新消费面统一走 integrationFieldRegistry(+ serviceResolutions 求值内嵌)。 */
|
|
82
83
|
const INCLUDE_WHITELIST = {
|
|
83
84
|
app: ['serviceResolutions', 'integrationSchemas', 'integrationFieldRegistry'],
|
|
84
85
|
module: ['serviceResolutions', 'integrationSchemas', 'integrationFieldRegistry'],
|
|
85
|
-
provider: ['integrationSchemas'],
|
|
86
86
|
service: ['integrationSchemas', 'integrationFieldRegistry'],
|
|
87
87
|
} as const;
|
|
88
88
|
|
|
@@ -103,25 +103,18 @@ function validateInclude(kind: keyof typeof INCLUDE_WHITELIST, include?: string[
|
|
|
103
103
|
return new Set(include);
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
/**
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
):
|
|
117
|
-
|
|
118
|
-
if (!FORM_INCLUDE_KEYS.some((k) => include.has(k))) {
|
|
119
|
-
throw new AppToolkitError(
|
|
120
|
-
'VALIDATION_FAILED',
|
|
121
|
-
400,
|
|
122
|
-
`参数 ${paramName} 需与表单 include 键(${FORM_INCLUDE_KEYS.join('、')})同现——轴参仅重定向表单层双投影`,
|
|
123
|
-
[paramName],
|
|
124
|
-
);
|
|
106
|
+
/** v8 supply scope 校验(单点在 toolkit 方法内——壳层仅解析 query 参数;400 先于 404):
|
|
107
|
+
* scope 恒显式请求参数(不从其他参数推断);未知 kind / 伴随参数缺席 → 400。 */
|
|
108
|
+
function assertSupplyScope(scope: ProviderSupplyScope): void {
|
|
109
|
+
const kind = (scope as { kind?: unknown } | null | undefined)?.kind;
|
|
110
|
+
if (kind !== 'app' && kind !== 'module' && kind !== 'service') {
|
|
111
|
+
throw new AppToolkitError('VALIDATION_FAILED', 400, 'scope 必须为 app | module | service(显式请求参数)', ['scope']);
|
|
112
|
+
}
|
|
113
|
+
if (kind === 'module' && (typeof (scope as { module?: unknown }).module !== 'string' || (scope as { module: string }).module.length === 0)) {
|
|
114
|
+
throw new AppToolkitError('VALIDATION_FAILED', 400, 'scope=module 需携带非空 module 参数', ['module']);
|
|
115
|
+
}
|
|
116
|
+
if (kind === 'service' && (typeof (scope as { service?: unknown }).service !== 'string' || (scope as { service: string }).service.length === 0)) {
|
|
117
|
+
throw new AppToolkitError('VALIDATION_FAILED', 400, 'scope=service 需携带非空 service 参数', ['service']);
|
|
125
118
|
}
|
|
126
119
|
}
|
|
127
120
|
|
|
@@ -131,18 +124,17 @@ function assertAxisProviderUsable(
|
|
|
131
124
|
export interface AppToolkitRead {
|
|
132
125
|
/** GET /modules:hidden 模块默认过滤(includeHidden = true 可见——对齐 ?dryRun 布尔参数先例) */
|
|
133
126
|
loadModules(o?: { includeHidden?: boolean }): Promise<ModulesView>;
|
|
134
|
-
/**
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
loadApp(o?: { include?: string[]; appProvider?: string }): Promise<AppView>;
|
|
139
|
-
/** v5.1 serviceProvider = 服务轴向假想绑定(缺席/空串 ≡ 按实际配置解析;需与表单 include
|
|
140
|
-
* 键同现)——假想重定向仅表单双投影,integration/suppliedBy/defaults 恒实际态(I2) */
|
|
141
|
-
loadService(service: string, o?: { include?: string[]; serviceProvider?: string }): Promise<ServiceDetail>;
|
|
127
|
+
/** moduleId = 双键(id 优先、唯一展示名兜底)。v8:binding 缺省携带(moduleProvider 轴参退场) */
|
|
128
|
+
loadModule(moduleId: string, o?: { include?: string[] }): Promise<ModuleDetailView>;
|
|
129
|
+
loadApp(o?: { include?: string[] }): Promise<AppView>;
|
|
130
|
+
loadService(service: string, o?: { include?: string[] }): Promise<ServiceDetail>;
|
|
142
131
|
loadServiceResolutions(services?: string[]): Promise<ServiceResolutionsView>;
|
|
143
132
|
loadServiceResolution(service: string): Promise<ServiceResolutionDetail>;
|
|
144
133
|
loadProviders(): Promise<ProvidersView>;
|
|
145
|
-
|
|
134
|
+
/** GET /providers/:p/supply?scope=…(v8——供给判定;切换预览唯一判定源,前端零关系计算)。
|
|
135
|
+
* scope 显式判别联合;provider ∉ catalog → 404;scope=module 未装 → 404;
|
|
136
|
+
* scope=service 任意 id 恒 200(判定非寻址)。 */
|
|
137
|
+
loadProviderSupply(provider: string, scope: ProviderSupplyScope): Promise<ProviderSupplyView>;
|
|
146
138
|
loadProviderService(provider: string, service: string): Promise<ProviderServiceDetail>;
|
|
147
139
|
/** GET /credentials(v4.4——应用状态轴;零门控,永不 503) */
|
|
148
140
|
loadCredentials(): Promise<CredentialsView>;
|
|
@@ -259,9 +251,8 @@ export function createAppToolkit(appDir: string, options: AppToolkitOptions = {}
|
|
|
259
251
|
// v4.4 门控与内嵌分离——静态方法零门控分支;include=serviceResolutions 按
|
|
260
252
|
// evaluation && strictValidation 双条件装配(<0.9/形态异常 → null,永不 503——技术方案 §2.4:
|
|
261
253
|
// 仅判 strictValidation 会被「严格面在场+求值面缺席」畸形包击穿)
|
|
262
|
-
async loadModule(moduleId: string, o?: { include?: string[]
|
|
254
|
+
async loadModule(moduleId: string, o?: { include?: string[] }): Promise<ModuleDetailView> {
|
|
263
255
|
const include = validateInclude('module', o?.include); // ① 输入校验先行(400 先于 404)
|
|
264
|
-
assertAxisProviderUsable('moduleProvider', o?.moduleProvider, include); // ①' 轴参严检(先于 404)
|
|
265
256
|
const contracts = await resolveContractsForApp(appDir);
|
|
266
257
|
const snap = snapshot(contracts);
|
|
267
258
|
// ② 双键寻址(v7 词汇统一):路径参数 id 优先、唯一展示名兜底 → 真实 id(404 面)
|
|
@@ -278,16 +269,15 @@ export function createAppToolkit(appDir: string, options: AppToolkitOptions = {}
|
|
|
278
269
|
: loadServiceResolutionsDegradeView(snap, contracts, resolutionFilter); // owned ∪ demand 服务过滤(≡ 批量 ?service= 语义)
|
|
279
270
|
}
|
|
280
271
|
if (include.has('integrationSchemas') || include.has('integrationFieldRegistry')) {
|
|
281
|
-
// v4.6
|
|
282
|
-
const form = loadModuleFormViews(snap, mod.id
|
|
272
|
+
// v4.6 表单层双投影同源一次计算(双取单算)
|
|
273
|
+
const form = loadModuleFormViews(snap, mod.id);
|
|
283
274
|
if (include.has('integrationSchemas')) view.integrationSchemas = form.integrationSchemas;
|
|
284
275
|
if (include.has('integrationFieldRegistry')) view.integrationFieldRegistry = form.integrationFieldRegistry;
|
|
285
276
|
}
|
|
286
277
|
return view;
|
|
287
278
|
},
|
|
288
|
-
async loadApp(o?: { include?: string[]
|
|
279
|
+
async loadApp(o?: { include?: string[] }): Promise<AppView> {
|
|
289
280
|
const include = validateInclude('app', o?.include);
|
|
290
|
-
assertAxisProviderUsable('appProvider', o?.appProvider, include); // 轴参严检(先于任何计算)
|
|
291
281
|
const contracts = await resolveContractsForApp(appDir);
|
|
292
282
|
const snap = snapshot(contracts);
|
|
293
283
|
const view = loadAppView(snap);
|
|
@@ -298,29 +288,25 @@ export function createAppToolkit(appDir: string, options: AppToolkitOptions = {}
|
|
|
298
288
|
: loadServiceResolutionsDegradeView(snap, contracts);
|
|
299
289
|
}
|
|
300
290
|
if (include.has('integrationSchemas') || include.has('integrationFieldRegistry')) {
|
|
301
|
-
const form = loadAppFormViews(snap
|
|
291
|
+
const form = loadAppFormViews(snap); // 双取单算(同 loadModule)
|
|
302
292
|
if (include.has('integrationSchemas')) view.integrationSchemas = form.integrationSchemas;
|
|
303
293
|
if (include.has('integrationFieldRegistry')) view.integrationFieldRegistry = form.integrationFieldRegistry;
|
|
304
294
|
}
|
|
305
295
|
return view;
|
|
306
296
|
},
|
|
307
297
|
// v4.7 include 镜像 loadModule 三段式——① 输入校验 400 先于 404 ② 视图 ③ 静态富化(永不 503)
|
|
308
|
-
|
|
309
|
-
// v5.1 loadService += serviceProvider 轴参(三段式序对齐 loadModule——①' 严检先于 resolveContracts,
|
|
310
|
-
// 即先于 404 也先于 503;I1 双投影同源一次计算经单源链透传)
|
|
311
|
-
async loadService(service: string, o?: { include?: string[]; serviceProvider?: string }): Promise<ServiceDetail> {
|
|
298
|
+
async loadService(service: string, o?: { include?: string[] }): Promise<ServiceDetail> {
|
|
312
299
|
const include = validateInclude('service', o?.include);
|
|
313
|
-
assertAxisProviderUsable('serviceProvider', o?.serviceProvider, include); // ①' 轴参严检(先于 404)
|
|
314
300
|
const contracts = await resolveContractsForApp(appDir);
|
|
315
301
|
const snap = snapshot(contracts); // 单快照——detail 与 include 装配共享
|
|
316
302
|
// 双键寻址(v7):id 优先、唯一展示名兜底 → 真实 service id(404 面)
|
|
317
303
|
const serviceId = resolveServiceKey(snap.walk, configuredServiceKeys(snap), service);
|
|
318
304
|
const view = loadServiceDetailView(snap, serviceId);
|
|
319
305
|
if (include.has('integrationSchemas')) {
|
|
320
|
-
view.integrationSchemas = loadServiceIntegrationSchemas(snap, serviceId
|
|
306
|
+
view.integrationSchemas = loadServiceIntegrationSchemas(snap, serviceId);
|
|
321
307
|
}
|
|
322
308
|
if (include.has('integrationFieldRegistry')) {
|
|
323
|
-
view.integrationFieldRegistry = loadServiceFieldRegistry(snap, serviceId
|
|
309
|
+
view.integrationFieldRegistry = loadServiceFieldRegistry(snap, serviceId);
|
|
324
310
|
}
|
|
325
311
|
return view;
|
|
326
312
|
},
|
|
@@ -346,10 +332,11 @@ export function createAppToolkit(appDir: string, options: AppToolkitOptions = {}
|
|
|
346
332
|
const contracts = await resolveContractsForApp(appDir);
|
|
347
333
|
return loadProvidersView(snapshot(contracts));
|
|
348
334
|
},
|
|
349
|
-
|
|
350
|
-
|
|
335
|
+
// v8 供给判定(静态零 contracts;scope 校验单点在本方法内——400 先于 404)
|
|
336
|
+
async loadProviderSupply(provider: string, scope: ProviderSupplyScope): Promise<ProviderSupplyView> {
|
|
337
|
+
assertSupplyScope(scope);
|
|
351
338
|
const contracts = await resolveContractsForApp(appDir);
|
|
352
|
-
return
|
|
339
|
+
return loadProviderSupplyView(snapshot(contracts), provider, scope);
|
|
353
340
|
},
|
|
354
341
|
async loadProviderService(provider: string, service: string) {
|
|
355
342
|
const contracts = await resolveContractsForApp(appDir);
|
package/src/index.ts
CHANGED
|
@@ -85,6 +85,8 @@ export type { AppliedCredential, CredentialInput, OrphanIssue, PlannedCredential
|
|
|
85
85
|
// v6 所有权模型单源(module-binding——resolveModuleBinding/写守卫/归属表直通)
|
|
86
86
|
export { buildOwnershipMap, moduleOwnershipWritable, resolveModuleBinding, providerFootprint } from './integrations/module-binding.js';
|
|
87
87
|
export type { ModuleOwnershipWritability } from './integrations/module-binding.js';
|
|
88
|
+
// v8 三轴同构绑定解析单源(provider-binding——「数据来源」状态服务端单源)
|
|
89
|
+
export { appProviderBinding, moduleProviderBinding, serviceProviderBinding } from './integrations/provider-binding.js';
|
|
88
90
|
|
|
89
91
|
// ── 错误面(领域 6 码——AppToolkitError;name 字面量约定见 errors.ts)──
|
|
90
92
|
export { AppToolkitError, contractsNotResolvedMessage } from './core/errors.js';
|
|
@@ -94,8 +96,9 @@ export type { AppToolkitErrorCode } from './core/errors.js';
|
|
|
94
96
|
export { loadModulesView, loadModuleDetailView } from './views/modules.js';
|
|
95
97
|
export { loadAppView } from './views/app.js';
|
|
96
98
|
export { loadServiceDetailView } from './views/service-detail.js';
|
|
97
|
-
export { loadProvidersView,
|
|
98
|
-
export {
|
|
99
|
+
export { loadProvidersView, loadProviderServiceDetailView } from './views/providers.js';
|
|
100
|
+
export { loadProviderSupplyView } from './views/provider-supply.js';
|
|
101
|
+
export { loadServiceResolutionsView, loadServiceResolutionDetail, resolveServiceSummary, resolutionKeys } from './views/service-resolutions.js';
|
|
99
102
|
export { loadAppIntegrationSchemas, loadModuleIntegrationSchemas, loadServiceIntegrationSchemas, loadServiceFieldRegistry, resolveLayerIntegrationSchemas, formProviderOf, buildIntegrationFieldRegistry } from './views/integration-schemas.js';
|
|
100
103
|
export { echoForRef, loadCredentialsView } from './views/credentials.js';
|
|
101
104
|
export { loadCredentialTypesView } from './views/credential-types.js';
|
|
@@ -105,7 +108,7 @@ export type { ViewContext, ViewSnapshot } from './views/context.js';
|
|
|
105
108
|
export { createAppToolkit } from './factory.js';
|
|
106
109
|
export type { AppToolkit, AppToolkitRead, AppToolkitWrite, AppToolkitInternals, AppToolkitOptions } from './factory.js';
|
|
107
110
|
|
|
108
|
-
// ── DTO(api.md §3 字段级单源——
|
|
111
|
+
// ── DTO(api.md §3 字段级单源——39 类型;agtcodingbox/tbox-ai-coding import type 消费)──
|
|
109
112
|
export type {
|
|
110
113
|
ServiceStatus,
|
|
111
114
|
BindingLayer,
|
|
@@ -138,8 +141,11 @@ export type {
|
|
|
138
141
|
ResolvedInstance,
|
|
139
142
|
ProvidersView,
|
|
140
143
|
ProviderEntry,
|
|
141
|
-
ProviderDetail,
|
|
142
144
|
ProviderServiceDetail,
|
|
145
|
+
ProviderSupplyScope,
|
|
146
|
+
ProviderSupplyView,
|
|
147
|
+
ResolvedProvider,
|
|
148
|
+
ProviderBinding,
|
|
143
149
|
EffectiveBinding,
|
|
144
150
|
CredentialEcho,
|
|
145
151
|
ContractsResolution,
|
|
@@ -137,15 +137,11 @@ export interface IntegrationServicePredicateInput {
|
|
|
137
137
|
moduleResourceNeeds?: Record<string, ReadonlySet<string>>;
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
/** 结构化 issue(H7 v4.3):code 枚举单源 = 本文件头映射表(additive-only
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
service?: string;
|
|
146
|
-
module?: string;
|
|
147
|
-
instance?: string;
|
|
148
|
-
}
|
|
140
|
+
/** 结构化 issue(H7 v4.3):code 枚举单源 = 本文件头映射表(additive-only)。
|
|
141
|
+
* v8 合一:唯一公开名 = dto `IntegrationIssue`(同形双名合一);本名保留为弃用别名
|
|
142
|
+
* (0.9.0 删——公开面消费者迁 IntegrationIssue)。 */
|
|
143
|
+
import type { IntegrationIssue } from '../dto.js';
|
|
144
|
+
export type IntegrationServiceIssue = IntegrationIssue;
|
|
149
145
|
|
|
150
146
|
/** 内联厂商声明受控形状(v2:provider/credentialType/configSchema) */
|
|
151
147
|
export function isControlledInlineProvider(raw: unknown): boolean {
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { ProviderBinding, ResolvedProvider } from '../dto.js';
|
|
2
|
+
import type { WalkManifestsResult } from '../assembly/walk-manifests.js';
|
|
3
|
+
import { resolveModuleBinding } from './module-binding.js';
|
|
4
|
+
import { isControlledInlineProvider } from './predicate.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 三轴同构 provider 绑定解析单源(v8——「数据来源」状态服务端单源;铁律 #6 派生知识
|
|
8
|
+
* 不泄漏客户端)。三静态视图缺省携带(AppView/ModuleDetailView/ServiceDetail.binding),
|
|
9
|
+
* 静态零 contracts。
|
|
10
|
+
*
|
|
11
|
+
* 知识锚(module-binding 单源锚表的 v8 扩展):
|
|
12
|
+
* app 轴 = appProviderBinding —— configured ≡ effective(无上级);inherited 恒 NONE
|
|
13
|
+
* module 轴 = moduleProviderBinding —— effective 复用 resolveModuleBinding 单源
|
|
14
|
+
* (modules[m].provider ?? root.provider);inherited = root 回落
|
|
15
|
+
* service 轴 = serviceProviderBinding —— 继承链 = 链推导四分支的 provider 维:
|
|
16
|
+
* ① 缺席/空串 → 级联 ② 非空 string → 本层 ③ 受控内联 → 其名(内联 0.8.0 弃用)
|
|
17
|
+
* ④ malformed → configured null + 级联(谓词 #5 诊断经 issues 恒可见,不静默)
|
|
18
|
+
* 口径钉子 = 本文件全部产物为 node 级口径(layer 恒 ≠ 'instance',实例层无条件排除);
|
|
19
|
+
* 求值轴 Entry.binding = 默认实例口径(deriveBindingLayer 单源,layer 可 'instance')
|
|
20
|
+
* ——两口径文档化分立,勿合并。
|
|
21
|
+
*
|
|
22
|
+
* 落位依据:integrations 层为 views 下层公共单源(module-binding 先例);纯读投影零 IO。
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const NONE: ResolvedProvider = { provider: null, layer: null };
|
|
26
|
+
|
|
27
|
+
/** root 绑定(app 级事实——app 轴 effective 与 module/service 轴级联终点共用) */
|
|
28
|
+
function rootBinding(config: Record<string, unknown> | null): ResolvedProvider {
|
|
29
|
+
const p = (config as { provider?: unknown } | null)?.provider;
|
|
30
|
+
return typeof p === 'string' && p.length > 0 ? { provider: p, layer: 'app' } : NONE;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** app 轴绑定解析:configured ≡ effective(app 无上级——清除后无回落) */
|
|
34
|
+
export function appProviderBinding(config: Record<string, unknown> | null): ProviderBinding {
|
|
35
|
+
const configured = rootBinding(config).provider;
|
|
36
|
+
return {
|
|
37
|
+
configured,
|
|
38
|
+
effective: configured !== null ? { provider: configured, layer: 'app' } : NONE,
|
|
39
|
+
inherited: NONE,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** module 轴绑定解析:effective 复用 resolveModuleBinding 单源(谓词 #7 模块层同判);
|
|
44
|
+
* inherited = 清除模块级后的 root 回落(configured 缺席时 ≡ effective——无变化语义)。 */
|
|
45
|
+
export function moduleProviderBinding(config: Record<string, unknown> | null, moduleId: string): ProviderBinding {
|
|
46
|
+
const raw = (config as { modules?: Record<string, { provider?: unknown }> } | null)?.modules?.[moduleId]?.provider;
|
|
47
|
+
const configured = typeof raw === 'string' && raw.length > 0 ? raw : null;
|
|
48
|
+
const eff = resolveModuleBinding(config, moduleId);
|
|
49
|
+
const effective: ResolvedProvider = { provider: eff.provider, layer: eff.layer };
|
|
50
|
+
return {
|
|
51
|
+
configured,
|
|
52
|
+
effective,
|
|
53
|
+
inherited: configured !== null ? rootBinding(config) : effective,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** 服务节点 provider 归一(链推导四分支 ①-④ 的 provider 维):非空 string → 该值;受控内联 → 其名
|
|
58
|
+
* (内联形态 0.8.0 弃用——归一保留存量读);其余(缺席/空串/malformed)→ null(级联回落)。 */
|
|
59
|
+
function serviceConfiguredProvider(raw: unknown): string | null {
|
|
60
|
+
if (typeof raw === 'string') return raw.length > 0 ? raw : null;
|
|
61
|
+
if (isControlledInlineProvider(raw)) {
|
|
62
|
+
return (raw as { provider: string }).provider;
|
|
63
|
+
}
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** service 轴绑定解析(node 级口径):inherited = 上级绑定(owner 模块 ?? root——无主平台槽
|
|
68
|
+
* 直落 root);malformed → configured null + 级联(谓词 #5 诊断经 issues 恒可见,不静默)。 */
|
|
69
|
+
export function serviceProviderBinding(
|
|
70
|
+
config: Record<string, unknown> | null,
|
|
71
|
+
walk: Pick<WalkManifestsResult, 'ownership'>,
|
|
72
|
+
service: string,
|
|
73
|
+
): ProviderBinding {
|
|
74
|
+
const raw = (config as { services?: Record<string, { provider?: unknown }> } | null)?.services?.[service]?.provider;
|
|
75
|
+
const configured = serviceConfiguredProvider(raw);
|
|
76
|
+
const owner = walk.ownership[service];
|
|
77
|
+
const inherited = owner !== undefined ? moduleProviderBinding(config, owner).effective : rootBinding(config);
|
|
78
|
+
return {
|
|
79
|
+
configured,
|
|
80
|
+
effective: configured !== null ? { provider: configured, layer: 'service' } : inherited,
|
|
81
|
+
inherited,
|
|
82
|
+
};
|
|
83
|
+
}
|
package/src/views/app.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AppView, ServiceDemand } from '../dto.js';
|
|
2
2
|
import { APP_INTEGRATION_NODE_KEYS } from '../dto.js';
|
|
3
|
+
import { appProviderBinding } from '../integrations/provider-binding.js';
|
|
3
4
|
import { moduleOccupiedServices, resolveServiceDisplay, type ViewSnapshot } from './context.js';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -30,5 +31,6 @@ export function loadAppView(snapshot: ViewSnapshot): AppView {
|
|
|
30
31
|
}
|
|
31
32
|
integration = node as AppView['integration'];
|
|
32
33
|
}
|
|
33
|
-
|
|
34
|
+
// v8:binding 恒在场(「数据来源」状态单源——app 轴 configured ≡ effective、inherited 恒空)
|
|
35
|
+
return { services, integration, binding: appProviderBinding(config) };
|
|
34
36
|
}
|