@tbox.cn/app-contracts 0.13.3 → 0.13.5
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.
|
@@ -42,6 +42,7 @@ export declare const integrationsSchema: z.ZodEffects<z.ZodObject<{
|
|
|
42
42
|
modules: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodObject<{
|
|
43
43
|
provider: z.ZodOptional<z.ZodString>;
|
|
44
44
|
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
45
|
+
credentialRef: z.ZodOptional<z.ZodString>;
|
|
45
46
|
resources: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
46
47
|
type: z.ZodLiteral<"knowledge">;
|
|
47
48
|
datasetId: z.ZodOptional<z.ZodString>;
|
|
@@ -75,6 +76,7 @@ export declare const integrationsSchema: z.ZodEffects<z.ZodObject<{
|
|
|
75
76
|
}>>>;
|
|
76
77
|
}, "strict", z.ZodTypeAny, {
|
|
77
78
|
provider?: string | undefined;
|
|
79
|
+
credentialRef?: string | undefined;
|
|
78
80
|
config?: Record<string, unknown> | undefined;
|
|
79
81
|
resources?: Record<string, {
|
|
80
82
|
type: "knowledge";
|
|
@@ -85,6 +87,7 @@ export declare const integrationsSchema: z.ZodEffects<z.ZodObject<{
|
|
|
85
87
|
}> | undefined;
|
|
86
88
|
}, {
|
|
87
89
|
provider?: string | undefined;
|
|
90
|
+
credentialRef?: string | undefined;
|
|
88
91
|
config?: Record<string, unknown> | undefined;
|
|
89
92
|
resources?: Record<string, {
|
|
90
93
|
type: "knowledge";
|
|
@@ -95,6 +98,7 @@ export declare const integrationsSchema: z.ZodEffects<z.ZodObject<{
|
|
|
95
98
|
}> | undefined;
|
|
96
99
|
}>, {
|
|
97
100
|
provider?: string | undefined;
|
|
101
|
+
credentialRef?: string | undefined;
|
|
98
102
|
config?: Record<string, unknown> | undefined;
|
|
99
103
|
resources?: Record<string, {
|
|
100
104
|
type: "knowledge";
|
|
@@ -105,6 +109,7 @@ export declare const integrationsSchema: z.ZodEffects<z.ZodObject<{
|
|
|
105
109
|
}> | undefined;
|
|
106
110
|
}, {
|
|
107
111
|
provider?: string | undefined;
|
|
112
|
+
credentialRef?: string | undefined;
|
|
108
113
|
config?: Record<string, unknown> | undefined;
|
|
109
114
|
resources?: Record<string, {
|
|
110
115
|
type: "knowledge";
|
|
@@ -290,6 +295,7 @@ export declare const integrationsSchema: z.ZodEffects<z.ZodObject<{
|
|
|
290
295
|
credentialRefByInstance?: Record<string, string> | undefined;
|
|
291
296
|
modules?: Record<string, {
|
|
292
297
|
provider?: string | undefined;
|
|
298
|
+
credentialRef?: string | undefined;
|
|
293
299
|
config?: Record<string, unknown> | undefined;
|
|
294
300
|
resources?: Record<string, {
|
|
295
301
|
type: "knowledge";
|
|
@@ -332,6 +338,7 @@ export declare const integrationsSchema: z.ZodEffects<z.ZodObject<{
|
|
|
332
338
|
credentialRefByInstance?: Record<string, string> | undefined;
|
|
333
339
|
modules?: Record<string, {
|
|
334
340
|
provider?: string | undefined;
|
|
341
|
+
credentialRef?: string | undefined;
|
|
335
342
|
config?: Record<string, unknown> | undefined;
|
|
336
343
|
resources?: Record<string, {
|
|
337
344
|
type: "knowledge";
|
|
@@ -374,6 +381,7 @@ export declare const integrationsSchema: z.ZodEffects<z.ZodObject<{
|
|
|
374
381
|
credentialRefByInstance?: Record<string, string> | undefined;
|
|
375
382
|
modules?: Record<string, {
|
|
376
383
|
provider?: string | undefined;
|
|
384
|
+
credentialRef?: string | undefined;
|
|
377
385
|
config?: Record<string, unknown> | undefined;
|
|
378
386
|
resources?: Record<string, {
|
|
379
387
|
type: "knowledge";
|
|
@@ -416,6 +424,7 @@ export declare const integrationsSchema: z.ZodEffects<z.ZodObject<{
|
|
|
416
424
|
credentialRefByInstance?: Record<string, string> | undefined;
|
|
417
425
|
modules?: Record<string, {
|
|
418
426
|
provider?: string | undefined;
|
|
427
|
+
credentialRef?: string | undefined;
|
|
419
428
|
config?: Record<string, unknown> | undefined;
|
|
420
429
|
resources?: Record<string, {
|
|
421
430
|
type: "knowledge";
|
package/dist/providers.d.ts
CHANGED
|
@@ -63,6 +63,11 @@ export interface AuthenticatedTransport {
|
|
|
63
63
|
body?: unknown;
|
|
64
64
|
timeoutMs?: number;
|
|
65
65
|
extraHeaders?: Record<string, string>;
|
|
66
|
+
/** 请求级 baseUrl 覆盖(任务12 通用扩展——固定地址供给厂商):缺席时沿用 transport
|
|
67
|
+
* 工厂闭包 baseUrl(instance.config.baseUrl——既有行为零变化);在场时本请求用此值
|
|
68
|
+
* 构造 URL(HTTPS 强制/超时/熔断/响应上限等公共链路约束不变)。属最小通用能力,
|
|
69
|
+
* 平台层不承载任何厂商常量——值由调用方(厂商 provider 代码)提供。 */
|
|
70
|
+
baseUrl?: string;
|
|
66
71
|
}): Promise<unknown>;
|
|
67
72
|
}
|
|
68
73
|
/** resolve 产物:传输层 + 只读实例(模块 connector 构造输入) */
|
|
@@ -167,6 +172,9 @@ export interface ModuleConfig {
|
|
|
167
172
|
provider?: string;
|
|
168
173
|
/** 模块级共享配置(config 五层级联第三层:root ByInstance 之后、slot 之前) */
|
|
169
174
|
config?: Record<string, unknown>;
|
|
175
|
+
/** 模块级共享凭据引用(v6 归属链层:实例 > 槽 > modules[owner] > root——连接三件套
|
|
176
|
+
* (provider/config/credentialRef)共享营业主写位;该模块拥有的全部槽免逐槽重配) */
|
|
177
|
+
credentialRef?: string;
|
|
170
178
|
/** resourceId → 类型化资源声明(resourceId 词汇真源 = 模块 manifest declare.resources) */
|
|
171
179
|
resources?: Record<string, ResourceSpec>;
|
|
172
180
|
}
|
package/dist/runtime.js
CHANGED
|
@@ -94,7 +94,7 @@ function unresolved(service, instanceId, detail) {
|
|
|
94
94
|
}
|
|
95
95
|
function hasModuleBindingNodes(integrations) {
|
|
96
96
|
return Object.values(integrations.modules ?? {}).some(
|
|
97
|
-
(m) => m.provider != null || m.config != null
|
|
97
|
+
(m) => m.provider != null || m.config != null || m.credentialRef != null
|
|
98
98
|
);
|
|
99
99
|
}
|
|
100
100
|
function resolveEffectiveService(integrations, service, instanceId, supplies, ownerOf) {
|
|
@@ -157,7 +157,7 @@ function resolveEffectiveService(integrations, service, instanceId, supplies, ow
|
|
|
157
157
|
...slot.config,
|
|
158
158
|
...inst.config
|
|
159
159
|
};
|
|
160
|
-
const credentialRef = inst.credentialRef ?? slot.credentialRef ?? integrations.credentialRefByInstance?.[instanceId] ?? integrations.credentialRef;
|
|
160
|
+
const credentialRef = inst.credentialRef ?? slot.credentialRef ?? mod?.credentialRef ?? integrations.credentialRefByInstance?.[instanceId] ?? integrations.credentialRef;
|
|
161
161
|
return {
|
|
162
162
|
status: "ok",
|
|
163
163
|
effective: {
|
|
@@ -253,9 +253,10 @@ var resourceSpecSchema = z.discriminatedUnion("type", [knowledgeSpecSchema]).ref
|
|
|
253
253
|
var moduleConfigSchema = z.strictObject({
|
|
254
254
|
provider: z.string().min(1).optional(),
|
|
255
255
|
config: z.record(z.string(), z.unknown()).optional(),
|
|
256
|
+
credentialRef: z.string().optional(),
|
|
256
257
|
resources: z.record(z.string(), resourceSpecSchema).optional()
|
|
257
|
-
}).refine((m) => m.provider !== void 0 || m.config !== void 0 || m.resources !== void 0, {
|
|
258
|
-
message: "modules \u8282\u70B9 provider/config/resources \u81F3\u5C11\u5176\u4E00\uFF08\u7A7A\u8282\u70B9\u65E0\u610F\u4E49\u2014\u2014\u5220\u9664\u8BE5\u952E\uFF09"
|
|
258
|
+
}).refine((m) => m.provider !== void 0 || m.config !== void 0 || m.credentialRef !== void 0 || m.resources !== void 0, {
|
|
259
|
+
message: "modules \u8282\u70B9 provider/config/credentialRef/resources \u81F3\u5C11\u5176\u4E00\uFF08\u7A7A\u8282\u70B9\u65E0\u610F\u4E49\u2014\u2014\u5220\u9664\u8BE5\u952E\uFF09"
|
|
259
260
|
});
|
|
260
261
|
var integrationsSchema = z.strictObject({
|
|
261
262
|
$comment: z.union([z.string(), z.record(z.string(), z.unknown())]).optional(),
|
package/package.json
CHANGED
|
@@ -24,6 +24,25 @@ function base(overrides: Record<string, unknown> = {}): Record<string, unknown>
|
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
describe('parseIntegrationsConfig:v6 modules 节 credentialRef(归属层共享连接三件套)', () => {
|
|
28
|
+
it('modules 节 credentialRef 接受(共享连接归属层——连接只配一次写位)', () => {
|
|
29
|
+
const raw = base({
|
|
30
|
+
modules: { 'module-parking': { provider: 'joycity', credentialRef: 'secret://parking-shared' } },
|
|
31
|
+
});
|
|
32
|
+
expect(() => parseIntegrationsConfig(raw)).not.toThrow();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('modules 节仅 credentialRef 合法(provider 绑定可走槽/default 层派生——凭据先行形态)', () => {
|
|
36
|
+
const raw = base({ modules: { 'module-parking': { credentialRef: 'secret://parking-shared' } } });
|
|
37
|
+
expect(() => parseIntegrationsConfig(raw)).not.toThrow();
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('modules 空节点仍拒(credentialRef 在场 = 有意义——不触发空节点防线)', () => {
|
|
41
|
+
const raw = base({ modules: { 'module-parking': {} } });
|
|
42
|
+
expect(() => parseIntegrationsConfig(raw)).toThrow(/至少其一/);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
|
|
27
46
|
describe('parseIntegrationsConfig:v3 回归锁', () => {
|
|
28
47
|
it('合法基线通过', () => {
|
|
29
48
|
expect(() => parseIntegrationsConfig(base())).not.toThrow();
|