soma-core 1.4.0 → 1.4.2
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 +1 -1
- package/core/build/blocks/block-compile.ts +31 -2
- package/core/build/blocks/block-container.ts +2 -11
- package/core/build/compiler/page-declaration-compiler.ts +30 -2
- package/core/build/compiler/soma-precompile.js +2053 -23
- package/core/build/component/component-graph.ts +208 -0
- package/core/build/component/package-loader.ts +32 -0
- package/core/build/eject/component-eject.ts +473 -0
- package/core/build/eject/component-upgrade.ts +359 -0
- package/core/build/layout/constraint-solver.ts +235 -0
- package/core/build/layout/css-emitter.ts +116 -0
- package/core/build/layout/page-layout.ts +85 -0
- package/core/build/pack/pack-init.ts +270 -0
- package/core/client/base/SomaHttpClient.ts +34 -1
- package/core/client/base/SomaPageRootBase.ts +61 -0
- package/core/client/component/ai-catalog.ts +121 -4
- package/core/client/component/component-defaults.ts +100 -0
- package/core/client/component/component-definition.types.ts +39 -0
- package/core/client/component/component-manager.ts +79 -4
- package/core/client/component/component-pack.ts +126 -2
- package/core/client/component/keyboard-matrix.ts +144 -0
- package/core/client/component/pack-styles.ts +59 -1
- package/core/client/component/style-features.ts +131 -0
- package/core/client/component/theme-component-tokens.ts +83 -0
- package/core/client/component/verify-pack.ts +120 -1
- package/core/client/container/SomaContainerAdapter.ts +6 -2
- package/core/client/data/data-object-resolver.ts +407 -4
- package/core/client/data/reaction-engine.ts +176 -0
- package/core/client/data/window-engine.ts +477 -0
- package/core/client/engine/event-engine.ts +98 -0
- package/core/client/engine/soma-bootstrap.ts +265 -5
- package/core/client/engine/step-runner.ts +134 -0
- package/core/client/infra/http/SomaHttpService.ts +2 -2
- package/core/client/parser/blocks/page-parser.ts +15 -1
- package/core/client/parser/blocks/use-parser.ts +5 -12
- package/core/client/parser/data-config-parser.ts +316 -8
- package/core/client/parser/duration.ts +16 -0
- package/core/client/parser/layout-parser.ts +157 -0
- package/core/client/parser/page-state-parser.ts +166 -0
- package/core/client/parser/pipeline-parser.ts +76 -1
- package/core/client/parser/reaction-parser.ts +459 -0
- package/core/client/parser/reaction-sugar.ts +47 -0
- package/core/client/parser/step-parser.ts +359 -0
- package/core/client/parser/ui-config-parser.ts +59 -0
- package/core/client/parser/window-parser.ts +294 -0
- package/core/client/theme/theme-engine.ts +102 -2
- package/core/index.ts +184 -0
- package/core/shared/block-errors.ts +11 -0
- package/core/shared/calc/coerce.ts +29 -0
- package/core/shared/calc/errors.ts +43 -0
- package/core/shared/calc/evaluator.ts +101 -0
- package/core/shared/calc/index.ts +12 -0
- package/core/shared/calc/lexer.ts +194 -0
- package/core/shared/calc/parser.ts +204 -0
- package/core/shared/calc/typer.ts +184 -0
- package/core/shared/component/derive-sample.ts +105 -0
- package/core/shared/component/field-lines.ts +473 -0
- package/core/shared/path-algebra.ts +169 -0
- package/core/shared/predicates/index.ts +527 -0
- package/core/shared/types/component-contract.types.ts +151 -9
- package/core/shared/types/data-config.types.ts +120 -1
- package/core/shared/types/domain.types.ts +13 -0
- package/core/shared/types/event.types.ts +22 -2
- package/core/shared/types/layout-constraint.types.ts +73 -0
- package/core/shared/types/page-state.types.ts +60 -0
- package/core/shared/types/reaction.types.ts +144 -0
- package/core/shared/types/step.types.ts +91 -0
- package/core/shared/types/ui-config.types.ts +18 -0
- package/core/shared/types/window.types.ts +177 -0
- package/dist/cli/soma.js +13 -1
- package/dist/core/index.cjs +5529 -631
- package/dist/types/build/blocks/block-container.d.ts +1 -6
- package/dist/types/build/compiler/page-declaration-compiler.d.ts +2 -0
- package/dist/types/build/component/component-graph.d.ts +85 -0
- package/dist/types/build/eject/component-eject.d.ts +121 -0
- package/dist/types/build/eject/component-upgrade.d.ts +43 -0
- package/dist/types/build/layout/constraint-solver.d.ts +36 -0
- package/dist/types/build/layout/css-emitter.d.ts +18 -0
- package/dist/types/build/layout/page-layout.d.ts +24 -0
- package/dist/types/build/pack/pack-init.d.ts +8 -0
- package/dist/types/client/base/SomaHttpClient.d.ts +8 -0
- package/dist/types/client/base/SomaPageRootBase.d.ts +28 -0
- package/dist/types/client/component/ai-catalog.d.ts +33 -1
- package/dist/types/client/component/component-defaults.d.ts +15 -0
- package/dist/types/client/component/component-definition.types.d.ts +38 -0
- package/dist/types/client/component/component-manager.d.ts +36 -0
- package/dist/types/client/component/component-pack.d.ts +32 -2
- package/dist/types/client/component/keyboard-matrix.d.ts +24 -0
- package/dist/types/client/component/pack-styles.d.ts +21 -0
- package/dist/types/client/component/style-features.d.ts +26 -0
- package/dist/types/client/component/theme-component-tokens.d.ts +14 -0
- package/dist/types/client/component/verify-pack.d.ts +10 -0
- package/dist/types/client/data/data-object-resolver.d.ts +106 -1
- package/dist/types/client/data/reaction-engine.d.ts +21 -0
- package/dist/types/client/data/window-engine.d.ts +27 -0
- package/dist/types/client/engine/event-engine.d.ts +15 -0
- package/dist/types/client/engine/soma-bootstrap.d.ts +70 -0
- package/dist/types/client/engine/step-runner.d.ts +24 -0
- package/dist/types/client/parser/blocks/use-parser.d.ts +2 -2
- package/dist/types/client/parser/duration.d.ts +1 -0
- package/dist/types/client/parser/layout-parser.d.ts +9 -0
- package/dist/types/client/parser/page-state-parser.d.ts +32 -0
- package/dist/types/client/parser/reaction-parser.d.ts +16 -0
- package/dist/types/client/parser/reaction-sugar.d.ts +13 -0
- package/dist/types/client/parser/step-parser.d.ts +23 -0
- package/dist/types/client/parser/ui-config-parser.d.ts +5 -0
- package/dist/types/client/parser/window-parser.d.ts +25 -0
- package/dist/types/client/theme/theme-engine.d.ts +26 -0
- package/dist/types/index.d.ts +35 -2
- package/dist/types/shared/block-errors.d.ts +5 -0
- package/dist/types/shared/calc/coerce.d.ts +4 -0
- package/dist/types/shared/calc/errors.d.ts +14 -0
- package/dist/types/shared/calc/evaluator.d.ts +2 -0
- package/dist/types/shared/calc/index.d.ts +6 -0
- package/dist/types/shared/calc/lexer.d.ts +20 -0
- package/dist/types/shared/calc/parser.d.ts +49 -0
- package/dist/types/shared/calc/typer.d.ts +16 -0
- package/dist/types/shared/component/derive-sample.d.ts +23 -0
- package/dist/types/shared/component/field-lines.d.ts +19 -0
- package/dist/types/shared/path-algebra.d.ts +56 -0
- package/dist/types/shared/predicates/index.d.ts +79 -0
- package/dist/types/shared/types/component-contract.types.d.ts +134 -6
- package/dist/types/shared/types/data-config.types.d.ts +115 -1
- package/dist/types/shared/types/domain.types.d.ts +12 -0
- package/dist/types/shared/types/event.types.d.ts +8 -2
- package/dist/types/shared/types/layout-constraint.types.d.ts +52 -0
- package/dist/types/shared/types/page-state.types.d.ts +49 -0
- package/dist/types/shared/types/reaction.types.d.ts +115 -0
- package/dist/types/shared/types/step.types.d.ts +76 -0
- package/dist/types/shared/types/ui-config.types.d.ts +18 -0
- package/dist/types/shared/types/window.types.d.ts +171 -0
- package/package.json +3 -2
|
@@ -14,7 +14,11 @@
|
|
|
14
14
|
import type { SomaComponentDefinition } from './component-definition.types';
|
|
15
15
|
import type { SomaComponentPack } from './component-pack';
|
|
16
16
|
import { PACK_NAME_PATTERN } from './component-pack';
|
|
17
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
findNestedMutableContractDefault,
|
|
19
|
+
type SomaContractField,
|
|
20
|
+
} from '../../shared/types/component-contract.types';
|
|
21
|
+
import { deriveContractSample, hasRenderableSample } from '../../shared/component/derive-sample';
|
|
18
22
|
|
|
19
23
|
const LAYERS = new Set(['atom', 'composite', 'solution', 'template', 'page', 'token']);
|
|
20
24
|
|
|
@@ -32,6 +36,16 @@ export interface VerifyPackOptions {
|
|
|
32
36
|
* 换肤与 RTL 的正确性没有任何自动保障。
|
|
33
37
|
*/
|
|
34
38
|
skipStyleChecks?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* 要求 solution 层组件带得出样张(REQ-012,默认开)。
|
|
41
|
+
*
|
|
42
|
+
* 没有示例值的业务组件在展示页上只有一个空壳,在视觉矩阵里量不出真实高度,
|
|
43
|
+
* 在 AI 那边只剩一句 desc——三处都不报错,所以要在这里拦。
|
|
44
|
+
* 存量组件用 samplePending 豁免,清单只减不增。
|
|
45
|
+
*/
|
|
46
|
+
requireSamples?: boolean;
|
|
47
|
+
/** 样张待补清单(组件名):只减不增 */
|
|
48
|
+
samplePending?: readonly string[];
|
|
35
49
|
}
|
|
36
50
|
|
|
37
51
|
/**
|
|
@@ -59,8 +73,12 @@ export function verifyComponentPack(
|
|
|
59
73
|
issues.push('[包] 一个组件都没有');
|
|
60
74
|
}
|
|
61
75
|
|
|
76
|
+
const pending = new Set(options.samplePending ?? []);
|
|
62
77
|
for (const [key, definition] of Object.entries(pack.components)) {
|
|
63
78
|
issues.push(...verifyDefinition(key, definition));
|
|
79
|
+
if (options.requireSamples !== false && !pending.has(key)) {
|
|
80
|
+
issues.push(...verifySample(key, definition));
|
|
81
|
+
}
|
|
64
82
|
}
|
|
65
83
|
issues.push(...verifyStyleRegistration(pack));
|
|
66
84
|
if (!options.skipStyleChecks) {
|
|
@@ -121,6 +139,7 @@ function verifyDefinition(key: string, definition: SomaComponentDefinition): str
|
|
|
121
139
|
`[契约] ${label} 的 prop "${propName}" default.${nestedMutablePath} 是嵌套可变默认值——运行时只隔离最外层(规则 C4a)`,
|
|
122
140
|
);
|
|
123
141
|
}
|
|
142
|
+
issues.push(...verifyFieldTree(label, propName, prop as unknown as SomaContractField));
|
|
124
143
|
}
|
|
125
144
|
|
|
126
145
|
const ai = contract.ai as Record<string, unknown> | undefined;
|
|
@@ -163,6 +182,106 @@ function verifyDefinition(key: string, definition: SomaComponentDefinition): str
|
|
|
163
182
|
return issues;
|
|
164
183
|
}
|
|
165
184
|
|
|
185
|
+
/**
|
|
186
|
+
* 字段树自检(REQ-012)。
|
|
187
|
+
*
|
|
188
|
+
* 查的都是「不报错但坏掉」:示例值类型对不上会静默渲染成错误形状;
|
|
189
|
+
* object 没写 fields 等于形状没描述,展示页与 AI 拿不到任何东西。
|
|
190
|
+
*/
|
|
191
|
+
function verifyFieldTree(label: string, path: string, field: SomaContractField): string[] {
|
|
192
|
+
const issues: string[] = [];
|
|
193
|
+
if (!field || typeof field !== 'object') return issues;
|
|
194
|
+
|
|
195
|
+
if (field.type === 'object' && field.fields === undefined && field.example === undefined) {
|
|
196
|
+
issues.push(
|
|
197
|
+
`[字段] ${label} 的 "${path}" 是 object 却既没有 fields 也没有 example——`
|
|
198
|
+
+ '对象的形状必须写出来,否则展示页与 AI 只能猜',
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
if (field.type === 'array' && field.items === undefined && field.example === undefined) {
|
|
202
|
+
issues.push(
|
|
203
|
+
`[字段] ${label} 的 "${path}" 是 array 却既没有 items 也没有 example——`
|
|
204
|
+
+ '元素形状必须写出来',
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
if (field.type === 'enum' && (!field.values || field.values.length === 0)) {
|
|
208
|
+
issues.push(`[字段] ${label} 的 "${path}" 是 enum 却没有 values`);
|
|
209
|
+
}
|
|
210
|
+
if (field.example !== undefined) {
|
|
211
|
+
const mismatch = exampleTypeMismatch(field.example, field);
|
|
212
|
+
if (mismatch) issues.push(`[字段] ${label} 的 "${path}" 示例值${mismatch}`);
|
|
213
|
+
}
|
|
214
|
+
if (field.required === true && field.default !== undefined) {
|
|
215
|
+
issues.push(`[字段] ${label} 的 "${path}" 同时是必填与有默认值——二选一`);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
for (const [name, child] of Object.entries(field.fields ?? {})) {
|
|
219
|
+
issues.push(...verifyFieldTree(label, `${path}.${name}`, child));
|
|
220
|
+
}
|
|
221
|
+
if (field.items) {
|
|
222
|
+
issues.push(...verifyFieldTree(label, `${path}[]`, field.items));
|
|
223
|
+
}
|
|
224
|
+
return issues;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/** 示例值与字段类型对不上时返回中文原因,对得上返回 null */
|
|
228
|
+
function exampleTypeMismatch(value: unknown, field: SomaContractField): string | null {
|
|
229
|
+
switch (field.type) {
|
|
230
|
+
case 'string':
|
|
231
|
+
return typeof value === 'string' ? null : `应该是字符串,实际是 ${typeName(value)}`;
|
|
232
|
+
case 'number':
|
|
233
|
+
return typeof value === 'number' ? null : `应该是数字,实际是 ${typeName(value)}`;
|
|
234
|
+
case 'boolean':
|
|
235
|
+
return typeof value === 'boolean' ? null : `应该是布尔,实际是 ${typeName(value)}`;
|
|
236
|
+
case 'array':
|
|
237
|
+
return Array.isArray(value) ? null : `应该是数组,实际是 ${typeName(value)}`;
|
|
238
|
+
case 'object':
|
|
239
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value)
|
|
240
|
+
? null
|
|
241
|
+
: `应该是对象,实际是 ${typeName(value)}`;
|
|
242
|
+
case 'enum': {
|
|
243
|
+
const values = field.values ?? [];
|
|
244
|
+
if (values.length === 0) return null;
|
|
245
|
+
return values.includes(value as string | number)
|
|
246
|
+
? null
|
|
247
|
+
: `不在取值集合里(${values.join(' | ')})`;
|
|
248
|
+
}
|
|
249
|
+
default:
|
|
250
|
+
return null;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
function typeName(value: unknown): string {
|
|
255
|
+
if (value === null) return 'null';
|
|
256
|
+
if (Array.isArray(value)) return '数组';
|
|
257
|
+
const names: Record<string, string> = {
|
|
258
|
+
string: '字符串',
|
|
259
|
+
number: '数字',
|
|
260
|
+
boolean: '布尔',
|
|
261
|
+
object: '对象',
|
|
262
|
+
};
|
|
263
|
+
return names[typeof value] ?? typeof value;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/** solution 层必须派生得出一份有内容的样张 */
|
|
267
|
+
function verifySample(key: string, definition: SomaComponentDefinition): string[] {
|
|
268
|
+
const contract = definition?.contract;
|
|
269
|
+
if (!contract || contract.layer !== 'solution') return [];
|
|
270
|
+
|
|
271
|
+
const issues: string[] = [];
|
|
272
|
+
if (!hasRenderableSample(contract)) {
|
|
273
|
+
issues.push(
|
|
274
|
+
`[样张] 组件 ${key} 的 props 一个 example 都没有——`
|
|
275
|
+
+ '展示页只会渲染出一个空壳,视觉矩阵量不出真实高度,AI 也看不到数据形状(REQ-012)',
|
|
276
|
+
);
|
|
277
|
+
return issues;
|
|
278
|
+
}
|
|
279
|
+
for (const gap of deriveContractSample(contract).gaps) {
|
|
280
|
+
issues.push(`[样张] 组件 ${key} 的 "${gap.path}":${gap.reason}`);
|
|
281
|
+
}
|
|
282
|
+
return issues;
|
|
283
|
+
}
|
|
284
|
+
|
|
166
285
|
/** 样式登记的键必须是本包真的提供的组件/分片 */
|
|
167
286
|
function verifyStyleRegistration(pack: SomaComponentPack): string[] {
|
|
168
287
|
const issues: string[] = [];
|
|
@@ -170,8 +170,8 @@ export class SomaContainerAdapter implements IContainerAdapter {
|
|
|
170
170
|
return globalThis.performance?.now?.() ?? Date.now();
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
private resolveIncludes(
|
|
174
|
-
const elements =
|
|
173
|
+
private resolveIncludes(root: ParentNode, includes: Record<string, string>): void {
|
|
174
|
+
const elements = root.querySelectorAll<HTMLElement>('[data-soma-include]');
|
|
175
175
|
for (const element of elements) {
|
|
176
176
|
const includePath = element.getAttribute('data-soma-include');
|
|
177
177
|
if (!includePath || !includes[includePath]) {
|
|
@@ -182,5 +182,9 @@ export class SomaContainerAdapter implements IContainerAdapter {
|
|
|
182
182
|
element.removeAttribute('data-soma-include');
|
|
183
183
|
this.resolveIncludes(element, includes);
|
|
184
184
|
}
|
|
185
|
+
|
|
186
|
+
for (const template of root.querySelectorAll<HTMLTemplateElement>('template')) {
|
|
187
|
+
this.resolveIncludes(template.content, includes);
|
|
188
|
+
}
|
|
185
189
|
}
|
|
186
190
|
}
|
|
@@ -21,8 +21,17 @@ import type {
|
|
|
21
21
|
SomaDataConfig,
|
|
22
22
|
SomaDataDicts,
|
|
23
23
|
SomaDataObjectConfig,
|
|
24
|
+
SomaDataFieldConfig,
|
|
25
|
+
SomaDataPort,
|
|
24
26
|
SomaDataSourceConfig,
|
|
27
|
+
SomaDataSubmitResult,
|
|
28
|
+
SomaDataWriteConfig,
|
|
25
29
|
} from '../../shared/types/data-config.types';
|
|
30
|
+
import type { SomaReactionGraph } from '../../shared/types/reaction.types';
|
|
31
|
+
import type { SomaTransaction, SomaWindowHandle } from '../../shared/types/window.types';
|
|
32
|
+
import { createWindow } from './window-engine';
|
|
33
|
+
import { collectCalcRefs, evaluateCalc, parseCalc, type CalcAst } from '../../shared/calc';
|
|
34
|
+
import type { SomaNamedPredicates } from '../../shared/predicates';
|
|
26
35
|
|
|
27
36
|
// ─── 错误类 ───────────────────────────────────────────────────────────────────
|
|
28
37
|
|
|
@@ -58,6 +67,10 @@ export function isSomaMockEnabled(): boolean {
|
|
|
58
67
|
/** 解析器需要的最小 http 能力(结构兼容 IHttpClient / SomaHttpService) */
|
|
59
68
|
export interface SomaDataHttpLike {
|
|
60
69
|
get<T = unknown>(url: string, config?: { params?: Record<string, string> }): Promise<T>;
|
|
70
|
+
/** 写通道(§8):不实现时 submit 抛「本 Host 的 http 不支持写」而不是静默失败 */
|
|
71
|
+
post?<T = unknown>(url: string, body?: unknown): Promise<T>;
|
|
72
|
+
put?<T = unknown>(url: string, body?: unknown): Promise<T>;
|
|
73
|
+
patch?<T = unknown>(url: string, body?: unknown): Promise<T>;
|
|
61
74
|
}
|
|
62
75
|
|
|
63
76
|
export interface SomaDataResolverOptions {
|
|
@@ -121,6 +134,38 @@ function referencesObject(value: unknown, objectName: string): boolean {
|
|
|
121
134
|
return false;
|
|
122
135
|
}
|
|
123
136
|
|
|
137
|
+
/**
|
|
138
|
+
* 从 http 抛出的错误里挖出后端约定的 { message, fieldErrors }。
|
|
139
|
+
*
|
|
140
|
+
* 各家 http 客户端把响应体放在不同位置(error.response.data / error.data / error.body),
|
|
141
|
+
* 这里逐个试而不是绑定某一家——写通道不该要求 Host 换 http 客户端。
|
|
142
|
+
*/
|
|
143
|
+
function extractErrorPayload(error: unknown): {
|
|
144
|
+
message?: string;
|
|
145
|
+
fieldErrors?: Record<string, string>;
|
|
146
|
+
} {
|
|
147
|
+
const candidates: unknown[] = [error];
|
|
148
|
+
if (isPlainObject(error)) {
|
|
149
|
+
candidates.push(error.response, error.data, error.body);
|
|
150
|
+
if (isPlainObject(error.response)) candidates.push(error.response.data);
|
|
151
|
+
}
|
|
152
|
+
for (const candidate of candidates) {
|
|
153
|
+
if (!isPlainObject(candidate)) continue;
|
|
154
|
+
const rawFieldErrors = candidate.fieldErrors ?? candidate.field_errors ?? candidate.errors;
|
|
155
|
+
const message = typeof candidate.message === 'string' ? candidate.message : undefined;
|
|
156
|
+
if (isPlainObject(rawFieldErrors)) {
|
|
157
|
+
const fieldErrors: Record<string, string> = {};
|
|
158
|
+
for (const [key, value] of Object.entries(rawFieldErrors)) {
|
|
159
|
+
if (typeof value === 'string') fieldErrors[key] = value;
|
|
160
|
+
else if (Array.isArray(value) && typeof value[0] === 'string') fieldErrors[key] = value[0];
|
|
161
|
+
}
|
|
162
|
+
if (Object.keys(fieldErrors).length > 0) return { message, fieldErrors };
|
|
163
|
+
}
|
|
164
|
+
if (message) return { message };
|
|
165
|
+
}
|
|
166
|
+
return {};
|
|
167
|
+
}
|
|
168
|
+
|
|
124
169
|
// ─── 解析器 ──────────────────────────────────────────────────────────────────
|
|
125
170
|
|
|
126
171
|
export class SomaDataObjectResolver {
|
|
@@ -188,6 +233,261 @@ export class SomaDataObjectResolver {
|
|
|
188
233
|
return { objects: this.objects, dicts };
|
|
189
234
|
}
|
|
190
235
|
|
|
236
|
+
// ─── 写通道(§8,REQ-009 M-5)────────────────────────────────────────────
|
|
237
|
+
|
|
238
|
+
/** 已解析对象的只读视图(data 端口的 getObject) */
|
|
239
|
+
getObject(name: string): unknown {
|
|
240
|
+
return this.objects[name];
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/** 字段字典(data 端口的 getDict);无字典时返回空表而不是 undefined */
|
|
244
|
+
getDict(name: string): Record<string, SomaDataFieldConfig> {
|
|
245
|
+
return this.config.objects[name]?.fields ?? {};
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* 反应图与具名谓词表(REQ-010 S1b)。
|
|
250
|
+
* 图在**解析期**就建好了(拓扑序、反向索引、回溯表都在里面),这里只是把它交出去;
|
|
251
|
+
* 没声明 `reactions:` 的对象返回 null,组件据此走「无联动」的老路。
|
|
252
|
+
*/
|
|
253
|
+
/**
|
|
254
|
+
* 数据窗口(REQ-010 S2):声了 `window:` 段的对象才有,按对象名单例。
|
|
255
|
+
*
|
|
256
|
+
* 惰性创建而不是 `resolve()` 后统一建:一个声明了窗口的对象未必这一屏就在用它
|
|
257
|
+
* (同一份 `_data.yaml` 服务多个页面是常态),提前建会平白多发一轮取数。
|
|
258
|
+
* 对象 `reload` 时整个销毁——窗口缓存的是"按某组意图取回的行",
|
|
259
|
+
* 而 reload 的意思正是"那些行已经不作数了"。
|
|
260
|
+
*/
|
|
261
|
+
window(name: string): SomaWindowHandle | null {
|
|
262
|
+
const decl = this.config.objects[name];
|
|
263
|
+
if (!decl?.window) return null;
|
|
264
|
+
|
|
265
|
+
const existing = this.windows.get(name);
|
|
266
|
+
if (existing) return existing;
|
|
267
|
+
|
|
268
|
+
const handle = createWindow(decl.window, {
|
|
269
|
+
http: this.http,
|
|
270
|
+
api: decl.from[0]?.api ?? '',
|
|
271
|
+
idField: this.primaryKeyOf(decl),
|
|
272
|
+
onChange: this.onWindowChange,
|
|
273
|
+
commit: decl.write
|
|
274
|
+
? (tx) => this.commit(name, tx)
|
|
275
|
+
: undefined,
|
|
276
|
+
});
|
|
277
|
+
this.windows.set(name, handle);
|
|
278
|
+
return handle;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* 行主键:写通道的 `version` 位不是主键,所以不能拿它顶。
|
|
283
|
+
* 按约定取 `id`;字典里没有 `id` 时取声明序第一个字段——比报错好:
|
|
284
|
+
* 主键猜错的后果是选择态与编辑按错的键归组,而报错的后果是整张表打不开。
|
|
285
|
+
* 猜了就要说出来。
|
|
286
|
+
*/
|
|
287
|
+
private primaryKeyOf(decl: SomaDataObjectConfig): string {
|
|
288
|
+
const fields = decl.fields ?? {};
|
|
289
|
+
if ('id' in fields) return 'id';
|
|
290
|
+
const first = Object.keys(fields)[0];
|
|
291
|
+
if (first === undefined) return 'id';
|
|
292
|
+
console.warn(
|
|
293
|
+
`[soma-core][数据] 对象 "${decl.name}" 的字典里没有 id 字段,`
|
|
294
|
+
+ `窗口按 "${first}" 认行。若它不唯一,行选与单元格编辑会串行。`,
|
|
295
|
+
);
|
|
296
|
+
return first;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/** 事务提交(REQ-010 F-36):窗口把整批改动交给写通道,编排复用 submit 那一套 */
|
|
300
|
+
async commit(name: string, tx: SomaTransaction): Promise<SomaDataSubmitResult> {
|
|
301
|
+
const rows = [...(tx.update ?? []), ...(tx.add ?? [])];
|
|
302
|
+
if (rows.length === 0 && (tx.remove ?? []).length === 0) {
|
|
303
|
+
return { ok: false, message: '空事务:没有要提交的改动' };
|
|
304
|
+
}
|
|
305
|
+
// 逐行走既有的 submit 编排(白名单构体、map 改名、派生列闸门、错误逆映射)。
|
|
306
|
+
// 一次网络往返打包整批是后端 BFF 的形状,这里不替它决定——
|
|
307
|
+
// 先让语义正确,批量合并是后端接口就绪之后的事。
|
|
308
|
+
for (const row of rows) {
|
|
309
|
+
const result = await this.submit(name, row as Record<string, unknown>);
|
|
310
|
+
if (!result.ok) return result;
|
|
311
|
+
}
|
|
312
|
+
return { ok: true };
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
getReactions(name: string): { graph: SomaReactionGraph; named: SomaNamedPredicates } | null {
|
|
316
|
+
const object = this.config.objects[name];
|
|
317
|
+
if (!object?.reactions) return null;
|
|
318
|
+
return { graph: object.reactions, named: object.predicates ?? {} };
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* 提交一个数据对象(§8.6 全链)。
|
|
323
|
+
*
|
|
324
|
+
* 编排全部在这里,组件只做「收值 → 调它 → 渲染返回的 fieldErrors」:
|
|
325
|
+
* ① 按 permission 白名单剔除只读字段(version 乐观锁位是唯一显式例外);
|
|
326
|
+
* ② map 平面改名;
|
|
327
|
+
* ③ 选端点:显式 mode 优先,否则按对象当前是否已有主键值自动判定;
|
|
328
|
+
* ④ 调接口;
|
|
329
|
+
* ⑤ 失败时把后端的字段级错误**逆映射**回表单键(否则表单认不出那是自己的哪个字段);
|
|
330
|
+
* ⑥ 成功后按 reload 重取。
|
|
331
|
+
*
|
|
332
|
+
* 前端按 permission 过滤是 UX 与声明自洽,**不是安全边界**——
|
|
333
|
+
* 后端仍须按自身权限模型校验(数据对象层原则 2)。
|
|
334
|
+
*/
|
|
335
|
+
async submit(
|
|
336
|
+
name: string,
|
|
337
|
+
model: Record<string, unknown>,
|
|
338
|
+
mode?: 'create' | 'update',
|
|
339
|
+
): Promise<SomaDataSubmitResult> {
|
|
340
|
+
const decl = this.config.objects[name];
|
|
341
|
+
if (!decl) {
|
|
342
|
+
return { ok: false, message: `本页没有名为 "${name}" 的数据对象` };
|
|
343
|
+
}
|
|
344
|
+
const write = decl.write;
|
|
345
|
+
if (!write) {
|
|
346
|
+
return { ok: false, message: `数据对象 "${name}" 没有声明 write 段(它是只读对象)` };
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
const resolvedMode = mode ?? this.inferWriteMode(name, write);
|
|
350
|
+
const endpoint = resolvedMode === 'update' ? write.update ?? write.create : write.create ?? write.update;
|
|
351
|
+
if (!endpoint) {
|
|
352
|
+
return { ok: false, message: `数据对象 "${name}" 没有可用于 ${resolvedMode} 的写端点` };
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// DW-4:派生字段不进请求体。
|
|
356
|
+
//
|
|
357
|
+
// 它本可以像其它只读字段一样被静默丢弃,但那是错的:只读字段被丢弃时,
|
|
358
|
+
// 作者本来就没打算写它;而派生字段出现在提交体里,说明作者以为自己能写它。
|
|
359
|
+
// 静默丢弃的表现是「我改了利润并保存,没报错,但值没变」——他会去查后端。
|
|
360
|
+
const derived = Object.keys(model).filter((key) => (decl.fields ?? {})[key]?.calc !== undefined);
|
|
361
|
+
if (derived.length > 0) {
|
|
362
|
+
return {
|
|
363
|
+
ok: false,
|
|
364
|
+
message: `派生字段不能提交:${derived.join(' / ')}`
|
|
365
|
+
+ `——它们由 calc 算出(改上游字段即可),写它们没有落点`,
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
const body = this.buildRequestBody(decl, write, model);
|
|
370
|
+
const send = this.methodOf(endpoint.method);
|
|
371
|
+
if (!send) {
|
|
372
|
+
return {
|
|
373
|
+
ok: false,
|
|
374
|
+
message: `本 Host 的 http 服务没有实现 ${endpoint.method}——写通道需要它`,
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
try {
|
|
379
|
+
const data = await send(endpoint.api, body);
|
|
380
|
+
await this.reloadAfterWrite(name, write);
|
|
381
|
+
return { ok: true, data };
|
|
382
|
+
} catch (error) {
|
|
383
|
+
return this.mapSubmitError(error, write);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/** 手动重取(data 端口的 reload);不给名字时重取全部 */
|
|
388
|
+
async reload(names?: string[]): Promise<void> {
|
|
389
|
+
// 窗口缓存的是"按某组意图取回的行",而 reload 的意思正是"那些行已经不作数了"。
|
|
390
|
+
// 留着它们的话,重取之后列表纹丝不动——最像"没生效"的一种生效。
|
|
391
|
+
for (const name of names && names.length > 0 ? names : [...this.windows.keys()]) {
|
|
392
|
+
this.windows.get(name)?.destroy();
|
|
393
|
+
this.windows.delete(name);
|
|
394
|
+
}
|
|
395
|
+
if (!names || names.length === 0) {
|
|
396
|
+
await this.resolve();
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
for (const name of names) {
|
|
400
|
+
const decl = this.config.objects[name];
|
|
401
|
+
if (!decl) continue;
|
|
402
|
+
this.objects[name] = await this.resolveObject(decl);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* 自动判定 create / update:对象已有值(读通道取回过一条记录)即为更新。
|
|
408
|
+
* 显式 write_mode 永远优先——自动判定只是缺省,不是规则。
|
|
409
|
+
*/
|
|
410
|
+
private inferWriteMode(name: string, write: SomaDataWriteConfig): 'create' | 'update' {
|
|
411
|
+
if (!write.update) return 'create';
|
|
412
|
+
if (!write.create) return 'update';
|
|
413
|
+
const current = this.objects[name];
|
|
414
|
+
const hasRecord = isPlainObject(current) && Object.keys(current).length > 0;
|
|
415
|
+
return hasRecord ? 'update' : 'create';
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/** 构造请求体:剔除只读字段 → map 改名 → 补乐观锁位 */
|
|
419
|
+
private buildRequestBody(
|
|
420
|
+
decl: SomaDataObjectConfig,
|
|
421
|
+
write: SomaDataWriteConfig,
|
|
422
|
+
model: Record<string, unknown>,
|
|
423
|
+
): Record<string, unknown> {
|
|
424
|
+
const fields = decl.fields ?? {};
|
|
425
|
+
const body: Record<string, unknown> = {};
|
|
426
|
+
|
|
427
|
+
// 白名单:声了 only 就只送这几个。乐观锁位不受它管——它是协议位不是业务字段,
|
|
428
|
+
// 漏送的后果是乐观锁静默失效(并发覆盖,且没有任何一方会知道)。
|
|
429
|
+
const only = write.only === undefined ? null : new Set(write.only);
|
|
430
|
+
|
|
431
|
+
for (const [key, value] of Object.entries(model)) {
|
|
432
|
+
const field = fields[key];
|
|
433
|
+
if (only !== null && !only.has(key) && key !== write.version) continue;
|
|
434
|
+
// 字典里没有的键:按 w 处理(与 resolveFieldComponent「只对显式 r 降级」一致)
|
|
435
|
+
if (field?.permission === 'r' && key !== write.version) continue;
|
|
436
|
+
body[write.map?.[key] ?? key] = value;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
// 乐观锁位取自**读态**而不是表单:它是只读字段,表单里根本没有它
|
|
440
|
+
if (write.version && !(write.version in model)) {
|
|
441
|
+
const current = this.objects[decl.name];
|
|
442
|
+
const versionValue = isPlainObject(current) ? current[write.version] : undefined;
|
|
443
|
+
if (versionValue !== undefined) {
|
|
444
|
+
body[write.map?.[write.version] ?? write.version] = versionValue;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
return body;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
private methodOf(method: string): ((url: string, body?: unknown) => Promise<unknown>) | null {
|
|
451
|
+
const key = method.toLowerCase() as 'post' | 'put' | 'patch';
|
|
452
|
+
const fn = this.http[key];
|
|
453
|
+
return typeof fn === 'function' ? fn.bind(this.http) : null;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
private async reloadAfterWrite(name: string, write: SomaDataWriteConfig): Promise<void> {
|
|
457
|
+
if (!write.reload) return;
|
|
458
|
+
if (write.reload === 'all') {
|
|
459
|
+
await this.resolve();
|
|
460
|
+
return;
|
|
461
|
+
}
|
|
462
|
+
const targets = write.reload === 'self' ? [name] : write.reload;
|
|
463
|
+
await this.reload(targets);
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* 后端错误 → 表单可渲染的结果(§8.3)。
|
|
468
|
+
*
|
|
469
|
+
* 逆映射是关键的一步:后端按请求体键报错(`order_no`),
|
|
470
|
+
* 而表单只认自己的字段键(`orderNo`)。不逆映射的话错误会挂不上任何一个字段,
|
|
471
|
+
* 于是「提交失败」有文案却没有红框,用户不知道该改哪里。
|
|
472
|
+
*/
|
|
473
|
+
private mapSubmitError(error: unknown, write: SomaDataWriteConfig): SomaDataSubmitResult {
|
|
474
|
+
const payload = extractErrorPayload(error);
|
|
475
|
+
const message = payload.message
|
|
476
|
+
?? (error instanceof Error ? error.message : '提交失败');
|
|
477
|
+
|
|
478
|
+
if (!payload.fieldErrors) return { ok: false, message };
|
|
479
|
+
|
|
480
|
+
const reverse = new Map<string, string>();
|
|
481
|
+
for (const [formKey, bodyKey] of Object.entries(write.map ?? {})) {
|
|
482
|
+
reverse.set(bodyKey, formKey);
|
|
483
|
+
}
|
|
484
|
+
const fieldErrors: Record<string, string> = {};
|
|
485
|
+
for (const [bodyKey, text] of Object.entries(payload.fieldErrors)) {
|
|
486
|
+
fieldErrors[reverse.get(bodyKey) ?? bodyKey] = text;
|
|
487
|
+
}
|
|
488
|
+
return { ok: false, message, fieldErrors };
|
|
489
|
+
}
|
|
490
|
+
|
|
191
491
|
// ─── DAG 拓扑 ──────────────────────────────────────────────────────────────
|
|
192
492
|
|
|
193
493
|
/** Kahn 分层拓扑排序:返回逐层对象名(每层内部无依赖,可并发);残留节点即环 */
|
|
@@ -238,15 +538,20 @@ export class SomaDataObjectResolver {
|
|
|
238
538
|
// ─── 单对象解析 ────────────────────────────────────────────────────────────
|
|
239
539
|
|
|
240
540
|
private async resolveObject(decl: SomaDataObjectConfig): Promise<unknown> {
|
|
541
|
+
// 声了 window: 的对象,**窗口就是它的读通道**。这里再取一遍等于每个窗口页面
|
|
542
|
+
// 都先做一次没人看的全量取数——列表页恰恰是全量最贵的地方。
|
|
543
|
+
// 值给空对象而不是 undefined:`page.data.<对象>` 仍要能被绑定读到(读出空而不是炸)。
|
|
544
|
+
if (decl.window) return {};
|
|
545
|
+
|
|
241
546
|
// mock 开关全局打开且声明了样本:直接用样本(透传 transform 派生)
|
|
242
547
|
if (this.mockEnabled && decl.mock !== undefined) {
|
|
243
548
|
console.warn(`[soma-core][数据] 对象 "${decl.name}" 使用 mock 样本(SOMA_MOCK_ENABLED)`);
|
|
244
|
-
return this.
|
|
549
|
+
return this.finalize(cloneSample(decl.mock), decl);
|
|
245
550
|
}
|
|
246
551
|
|
|
247
552
|
// 无接口预览对象(仅 mock):样本即数据
|
|
248
553
|
if (decl.from.length === 0) {
|
|
249
|
-
return this.
|
|
554
|
+
return this.finalize(cloneSample(decl.mock) ?? {}, decl);
|
|
250
555
|
}
|
|
251
556
|
|
|
252
557
|
// 来源分波:不自引用的来源无内部依赖 → 首波并发 Promise.all;
|
|
@@ -294,12 +599,12 @@ export class SomaDataObjectResolver {
|
|
|
294
599
|
// 接口失败且声明了 mock:整对象回退样本并警示(不吞、不阻塞其余对象)
|
|
295
600
|
if (decl.mock !== undefined) {
|
|
296
601
|
console.warn(`[soma-core][数据] 对象 "${decl.name}" 来源 "${api}" 取数失败,回退 mock 样本:`, error);
|
|
297
|
-
return this.
|
|
602
|
+
return this.finalize(cloneSample(decl.mock), decl);
|
|
298
603
|
}
|
|
299
604
|
console.error(`[soma-core][数据] 对象 "${decl.name}" 来源 "${api}" 取数失败(保留已取得的部分数据):`, error);
|
|
300
605
|
}
|
|
301
606
|
|
|
302
|
-
return this.
|
|
607
|
+
return this.finalize(value, decl);
|
|
303
608
|
}
|
|
304
609
|
|
|
305
610
|
private async fetchSource(
|
|
@@ -390,6 +695,30 @@ export class SomaDataObjectResolver {
|
|
|
390
695
|
// ─── transform 派生字段 ────────────────────────────────────────────────────
|
|
391
696
|
|
|
392
697
|
/** 按 "字段路径 | 管道链" 补派生字段(复用 pipe-registry 链式执行) */
|
|
698
|
+
/** 派生列 AST 缓存:对象名 → 字段名 → AST */
|
|
699
|
+
private readonly derivedAsts = new Map<string, Map<string, CalcAst>>();
|
|
700
|
+
|
|
701
|
+
/** 数据窗口:对象名 → 窗口实例(惰性建,reload 时销毁) */
|
|
702
|
+
private readonly windows = new Map<string, SomaWindowHandle>();
|
|
703
|
+
|
|
704
|
+
/** 窗口内容变化时通知宿主重渲(由 bootstrap 注入) */
|
|
705
|
+
private onWindowChange: (() => void) | undefined;
|
|
706
|
+
|
|
707
|
+
/** 由 bootstrap 接上:窗口自己的取数完成后要能推动页面渲染 */
|
|
708
|
+
setWindowChangeHandler(handler: () => void): void {
|
|
709
|
+
this.onWindowChange = handler;
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
/**
|
|
713
|
+
* 取数收尾:先算派生列,再跑展示管道。
|
|
714
|
+
*
|
|
715
|
+
* 次序不能反:`calc` 产出的是带类型的值(能排序、能求和),`transform` 产出的是
|
|
716
|
+
* 给人看的串。先格式化再算式的话,`[金额] - [折扣]` 拿到的是 "¥1,000.00" 这样的串。
|
|
717
|
+
*/
|
|
718
|
+
private finalize(value: unknown, decl: SomaDataObjectConfig): unknown {
|
|
719
|
+
return this.applyTransform(this.applyDerived(value, decl), decl);
|
|
720
|
+
}
|
|
721
|
+
|
|
393
722
|
private applyTransform(value: unknown, decl: SomaDataObjectConfig): unknown {
|
|
394
723
|
if (!decl.transform) return value;
|
|
395
724
|
if (!isPlainObject(value)) {
|
|
@@ -414,4 +743,78 @@ export class SomaDataObjectResolver {
|
|
|
414
743
|
}
|
|
415
744
|
return value;
|
|
416
745
|
}
|
|
746
|
+
|
|
747
|
+
/**
|
|
748
|
+
* 派生列求值(REQ-010 F-10):把 `fields.<x>.calc` 算出来挂到值上。
|
|
749
|
+
*
|
|
750
|
+
* 与 `transform:` 的分工:`transform` 是**展示管道**(金额加千分位、日期换格式),
|
|
751
|
+
* 产出的是字符串;`calc` 是**算式**,产出的是带类型的值,能参与排序、聚合与比较。
|
|
752
|
+
* 混成一个的话,「利润」既是一个能求和的数、又是一个格式化过的串,取决于谁先跑。
|
|
753
|
+
*
|
|
754
|
+
* 只作用于普通对象与对象数组两种形状——其余形状(标量、嵌套聚合)原样返回:
|
|
755
|
+
* 猜一个结构去写值,写错的地方不会报错,只会多出一个没人认识的键。
|
|
756
|
+
*/
|
|
757
|
+
private applyDerived(value: unknown, decl: SomaDataObjectConfig): unknown {
|
|
758
|
+
const fields = decl.fields ?? {};
|
|
759
|
+
const derived = Object.keys(fields).filter((key) => fields[key].calc !== undefined);
|
|
760
|
+
if (derived.length === 0) return value;
|
|
761
|
+
|
|
762
|
+
// AST 按对象缓存:每次重取都重新解析一遍表达式是纯浪费,而声明在页面生命周期内不变
|
|
763
|
+
let asts = this.derivedAsts.get(decl.name);
|
|
764
|
+
if (!asts) {
|
|
765
|
+
asts = new Map();
|
|
766
|
+
for (const key of derived) asts.set(key, parseCalc(fields[key].calc!));
|
|
767
|
+
this.derivedAsts.set(decl.name, asts);
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
// 派生列可以引用另一个派生列,所以要按依赖序算。解析期已经检过环,
|
|
771
|
+
// 这里按「引用的派生列先算」做一次简单的深度优先即可。
|
|
772
|
+
const order: string[] = [];
|
|
773
|
+
const seen = new Set<string>();
|
|
774
|
+
const visit = (key: string): void => {
|
|
775
|
+
if (seen.has(key)) return;
|
|
776
|
+
seen.add(key);
|
|
777
|
+
for (const ref of collectCalcRefs(asts!.get(key)!)) {
|
|
778
|
+
if (asts!.has(ref)) visit(ref);
|
|
779
|
+
}
|
|
780
|
+
order.push(key);
|
|
781
|
+
};
|
|
782
|
+
for (const key of derived) visit(key);
|
|
783
|
+
|
|
784
|
+
const fill = (row: Record<string, unknown>): void => {
|
|
785
|
+
for (const key of order) row[key] = evaluateCalc(asts!.get(key)!, row);
|
|
786
|
+
};
|
|
787
|
+
|
|
788
|
+
if (Array.isArray(value)) {
|
|
789
|
+
for (const row of value) if (isPlainObject(row)) fill(row);
|
|
790
|
+
return value;
|
|
791
|
+
}
|
|
792
|
+
if (isPlainObject(value)) {
|
|
793
|
+
fill(value);
|
|
794
|
+
// 对象里挂着的行数组(`{ list: [...] }` 这种取数形状)同样要算:
|
|
795
|
+
// 派生列在列表上才是常态,只处理根对象等于对最常见的形状没生效。
|
|
796
|
+
for (const nested of Object.values(value)) {
|
|
797
|
+
if (Array.isArray(nested)) for (const row of nested) if (isPlainObject(row)) fill(row);
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
return value;
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
|
|
805
|
+
/**
|
|
806
|
+
* 把解析器包成注入给自治组件的 data 端口(§8.4)。
|
|
807
|
+
*
|
|
808
|
+
* 为什么是包一层而不是直接注入解析器:解析器还有 resolve / 内部拓扑等大量能力,
|
|
809
|
+
* 组件不该看得见。端口是刻意收窄的四个方法——读态、字典、提交、重取。
|
|
810
|
+
*/
|
|
811
|
+
export function createSomaDataPort(resolver: SomaDataObjectResolver): SomaDataPort {
|
|
812
|
+
return {
|
|
813
|
+
getObject: (name) => resolver.getObject(name),
|
|
814
|
+
getDict: (name) => resolver.getDict(name),
|
|
815
|
+
getReactions: (name) => resolver.getReactions(name),
|
|
816
|
+
window: (name) => resolver.window(name),
|
|
817
|
+
submit: (name, model, mode) => resolver.submit(name, model, mode),
|
|
818
|
+
reload: (names) => resolver.reload(names),
|
|
819
|
+
};
|
|
417
820
|
}
|