soma-core 2.2.6 → 2.2.8
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/core/build/compiler/soma-precompile.js +66 -10
- package/core/client/container/IContainerAdapter.ts +4 -0
- package/core/client/container/SomaContainerAdapter.ts +43 -2
- package/core/client/data/data-object-resolver.ts +43 -8
- package/core/client/engine/event-engine.ts +28 -3
- package/core/client/engine/soma-bootstrap.ts +2 -1
- package/core/client/engines/chart/adapter-echarts.ts +75 -2
- package/core/client/engines/chart/index.ts +18 -0
- package/core/client/engines/chart/port.ts +13 -0
- package/core/client/infra/notify/DefaultNotifyService.ts +2 -2
- package/core/client/parser/confirm-spec.ts +99 -6
- package/core/client/parser/data-config-parser.ts +1 -1
- package/core/client/parser/pipeline-parser.ts +2 -1
- package/core/client/render-ports/hide-transition.ts +9 -0
- package/core/client/render-ports/index.ts +4 -0
- package/core/client/render-ports/notify-renderer.ts +2 -1
- package/core/index.ts +16 -4
- package/core/server/api/load-host-service.ts +3 -0
- package/core/server/api/paged-list.ts +259 -0
- package/core/server/host/empty-host-bootstrap.mjs +3 -0
- package/core/server/host/host-assembly.ts +3 -0
- package/core/server/host/source-aliases.cjs +345 -0
- package/core/server/host/source-aliases.ts +32 -0
- package/core/server/host/source-packages.cjs +1 -0
- package/core/server/infra/cache/ServerFileCache.ts +4 -1
- package/core/server/node.ts +10 -0
- package/core/server/runtime-space/bindings.ts +47 -1
- package/core/server/runtime-space/digest.ts +6 -0
- package/core/server/runtime-space/index.ts +1 -1
- package/core/server/runtime-space/inject.ts +4 -1
- package/core/server/runtime-space/prewarm.ts +8 -8
- package/core/server/runtime-space/store.ts +8 -7
- package/core/server/runtime-space/types.ts +3 -2
- package/core/shared/core-diagnostic-codes.ts +6 -0
- package/core/shared/data-declaration-checks.ts +29 -3
- package/core/shared/registry-generated/diagnostic-registry-index.ts +5 -0
- package/core/shared/registry-generated/diagnostic-registry.ts +35 -0
- package/core/shared/registry-generated/limits.ts +18 -2
- package/core/shared/registry-generated/std-grammar.ts +1 -1
- package/core/shared/types/data-config.types.ts +3 -1
- package/core/shared/types/event.types.ts +9 -0
- package/dist/browser/soma-runtime.js +262 -23
- package/dist/core/index.cjs +283 -23
- package/dist/host-native/aot-builder.cjs +284 -0
- package/dist/host-native/native-server.cjs +395 -24
- package/dist/lsp/component-tree.cjs +66 -10
- package/dist/types/client/container/IContainerAdapter.d.ts +3 -0
- package/dist/types/client/container/SomaContainerAdapter.d.ts +5 -0
- package/dist/types/client/data/data-object-resolver.d.ts +2 -0
- package/dist/types/client/engines/chart/index.d.ts +1 -1
- package/dist/types/client/engines/chart/port.d.ts +15 -0
- package/dist/types/client/parser/confirm-spec.d.ts +27 -3
- package/dist/types/client/render-ports/hide-transition.d.ts +9 -0
- package/dist/types/client/render-ports/index.d.ts +4 -0
- package/dist/types/client/render-ports/notify-renderer.d.ts +2 -1
- package/dist/types/index.d.ts +4 -4
- package/dist/types/server/api/paged-list.d.ts +101 -0
- package/dist/types/server/host/source-aliases.d.cts +53 -0
- package/dist/types/server/host/source-aliases.d.ts +30 -0
- package/dist/types/server/host/source-packages.d.cts +2 -0
- package/dist/types/server/node.d.ts +1 -0
- package/dist/types/server/runtime-space/bindings.d.ts +9 -0
- package/dist/types/server/runtime-space/digest.d.ts +5 -0
- package/dist/types/server/runtime-space/index.d.ts +1 -1
- package/dist/types/server/runtime-space/prewarm.d.ts +2 -2
- package/dist/types/server/runtime-space/types.d.ts +3 -2
- package/dist/types/shared/core-diagnostic-codes.d.ts +1 -1
- package/dist/types/shared/registry-generated/diagnostic-registry.d.ts +30 -0
- package/dist/types/shared/registry-generated/limits.d.ts +14 -0
- package/dist/types/shared/registry-generated/std-grammar.d.ts +1 -1
- package/dist/types/shared/types/data-config.types.d.ts +3 -1
- package/dist/types/shared/types/event.types.d.ts +8 -0
- package/host-native/src/aot-builder.ts +23 -0
- package/host-native/src/host-prepare.ts +18 -1
- package/host-native/src/native-server.ts +16 -0
- package/host-native/styles/globals.css +30 -28
- package/package.json +13 -2
|
@@ -5016,6 +5016,17 @@ var SOMA_CORE_DIAGNOSTIC_CODES = [
|
|
|
5016
5016
|
// 时间:ready() 前调同步方法
|
|
5017
5017
|
"CORE-TEMPORAL-ZONE",
|
|
5018
5018
|
// 时间:时区标识非法
|
|
5019
|
+
// 宿主源码别名(产生点 core/server/host/source-aliases.cjs,CJS 不能 import 本表,码字面量两处各一份,由本表对账测试与注册表一致)
|
|
5020
|
+
"CORE-HOST-ALIAS-INVALID",
|
|
5021
|
+
// 别名声明形状不对 / 路径越界或不存在 / 别名名字非法(error)
|
|
5022
|
+
"CORE-HOST-ALIAS-RESERVED",
|
|
5023
|
+
// 别名占了保留名(soma / soma-*、server-only、node_modules、带子路径的 Node 内置)(error)
|
|
5024
|
+
"CORE-HOST-ALIAS-SHADOW",
|
|
5025
|
+
// 宿主 node_modules/<别名> 已存在且不是指向别名目录的软链(warning,别名仍生效)
|
|
5026
|
+
"CORE-HOST-ALIAS-DUPLICATE",
|
|
5027
|
+
// 多个源码根里同名别名,先声明者胜(warning)
|
|
5028
|
+
"CORE-HOST-ALIAS-TSCONFIG-DRIFT",
|
|
5029
|
+
// tsconfig.json 的 baseUrl 与第一个源码根不一致(warning)
|
|
5019
5030
|
"CORE-DND-SPEC",
|
|
5020
5031
|
// 拖放:getData 返回非对象 / 同元素重复登记
|
|
5021
5032
|
"CORE-ALGO-DIFF-INPUT",
|
|
@@ -5296,6 +5307,11 @@ var SOMA_PIPELINE_LIMITS = {
|
|
|
5296
5307
|
"file": "core/server/registry/registry-file-lock.ts",
|
|
5297
5308
|
"symbol": "SOMA_PIPELINE_LIMITS"
|
|
5298
5309
|
},
|
|
5310
|
+
{
|
|
5311
|
+
"module": "soma-core",
|
|
5312
|
+
"file": "core/server/api/paged-list.ts",
|
|
5313
|
+
"symbol": "SOMA_PIPELINE_LIMITS"
|
|
5314
|
+
},
|
|
5299
5315
|
{
|
|
5300
5316
|
"module": "soma-core",
|
|
5301
5317
|
"file": "core/server/registry/registry-write-pipeline.ts",
|
|
@@ -5311,6 +5327,11 @@ var SOMA_PIPELINE_LIMITS = {
|
|
|
5311
5327
|
"file": "core/server/registry/source/version-store.ts",
|
|
5312
5328
|
"symbol": "SOMA_PIPELINE_LIMITS"
|
|
5313
5329
|
},
|
|
5330
|
+
{
|
|
5331
|
+
"module": "soma-core",
|
|
5332
|
+
"file": "core/server/runtime-space/inject.ts",
|
|
5333
|
+
"symbol": "SOMA_PIPELINE_LIMITS"
|
|
5334
|
+
},
|
|
5314
5335
|
{
|
|
5315
5336
|
"module": "soma-ui",
|
|
5316
5337
|
"file": "src/compiler/bdl/registry/archive.ts",
|
|
@@ -5659,7 +5680,8 @@ var SOMA_PIPELINE_LIMITS = {
|
|
|
5659
5680
|
"watchFailLimit": 2,
|
|
5660
5681
|
"serverFileMaxEntries": 512,
|
|
5661
5682
|
"serverFileMaxBytes": 33554432,
|
|
5662
|
-
"serverDirMaxEntries": 256
|
|
5683
|
+
"serverDirMaxEntries": 256,
|
|
5684
|
+
"sourceRootAliasCapacity": 64
|
|
5663
5685
|
},
|
|
5664
5686
|
"runtimeCache": {
|
|
5665
5687
|
"basis": "runtime \u7A7A\u95F4 L1 \u5185\u5B58 LRU \u7684\u6761\u76EE\u5BB9\u91CF\uFF08\u7F16\u8BD1\u7ED3\u679C\u4E0E\u6807\u51C6\u683C\u5F0F\u4EA7\u7269\u5404\u4E00\u6761\u76EE\uFF09\u4E0E\u9759\u6001\u9875\u5730\u5740\u6E05\u5355\u7684\u5F00\u53D1\u6001\u590D\u6838\u95F4\u9694\uFF1B\u5BB9\u91CF\u4E0D\u5C0F\u4E8E\u53D1\u5E03\u9875\u4EA7\u7269\u7F13\u5B58\u5BB9\u91CF\uFF08cache.publishedArtifactCapacity\uFF09\uFF0C\u56E0\u4E3A L1 \u8981\u5BB9\u5F97\u4E0B\u5DF2\u53D1\u5E03\u9875\u52A0\u4E0A\u8FD0\u884C\u671F\u6309 URL \u6CE8\u5165\u7684\u9875\uFF1B\u590D\u6838\u95F4\u9694\u8BA9\u65B0\u589E\u9759\u6001\u9875\u6700\u8FDF\u8FD9\u4E2A\u6BEB\u79D2\u6570\u540E\u8FDB\u5165\u5199\u5165\u671F\u51B2\u7A81\u5224\u5B9A\uFF08\u751F\u4EA7\u6001\u4E0D\u8FC7\u671F\uFF09\u3002\u8FC1\u5165\u524D\u662F soma-core store.ts \u7684 SOMA_RUNTIME_CACHE_ENTRIES_DEFAULT \u4E0E static-source.ts \u7684 DEV_TTL_MS",
|
|
@@ -5677,6 +5699,10 @@ var SOMA_PIPELINE_LIMITS = {
|
|
|
5677
5699
|
"maxWaitMs": 5e3,
|
|
5678
5700
|
"waitSliceMs": 15
|
|
5679
5701
|
},
|
|
5702
|
+
"pagedList": {
|
|
5703
|
+
"pageSizeDefault": 10,
|
|
5704
|
+
"pageSizeMax": 500
|
|
5705
|
+
},
|
|
5680
5706
|
"writeRate": {
|
|
5681
5707
|
"limit": 120,
|
|
5682
5708
|
"windowMs": 6e4
|
|
@@ -5687,7 +5713,8 @@ var SOMA_PIPELINE_LIMITS = {
|
|
|
5687
5713
|
"defaultDebounceMs": 300
|
|
5688
5714
|
},
|
|
5689
5715
|
"inject": {
|
|
5690
|
-
"pageMaxBytes": 4194304
|
|
5716
|
+
"pageMaxBytes": 4194304,
|
|
5717
|
+
"batchFailureMessageMaxChars": 2e3
|
|
5691
5718
|
},
|
|
5692
5719
|
"execution": {
|
|
5693
5720
|
"maxNodes": 128,
|
|
@@ -6746,14 +6773,16 @@ function inspectSourceRequire(raw, paramNames) {
|
|
|
6746
6773
|
}
|
|
6747
6774
|
const issues = [];
|
|
6748
6775
|
const seen = /* @__PURE__ */ new Set();
|
|
6749
|
-
|
|
6750
|
-
const at = `require[${index}]`;
|
|
6776
|
+
const checkName = (name, at, inGroup) => {
|
|
6751
6777
|
if (typeof name !== "string" || name.trim() === "") {
|
|
6752
6778
|
issues.push({ path: at, message: `require \u91CC\u7684\u53C2\u6570\u540D\u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32\uFF0C\u5F53\u524D\u503C: ${show(name)}` });
|
|
6753
6779
|
return;
|
|
6754
6780
|
}
|
|
6755
6781
|
if (seen.has(name)) {
|
|
6756
|
-
issues.push({
|
|
6782
|
+
issues.push({
|
|
6783
|
+
path: at,
|
|
6784
|
+
message: inGroup ? `require \u91CC\u6709\u91CD\u590D\u7684\u53C2\u6570\u540D "${name}"\uFF08\u540C\u540D\u4E0D\u80FD\u5728\u5355\u9879\u4E0E\u5206\u7EC4\u91CC\u3001\u6216\u4E24\u4E2A\u5206\u7EC4\u91CC\u91CD\u590D\u51FA\u73B0\uFF09` : `require \u91CC\u6709\u91CD\u590D\u7684\u53C2\u6570\u540D "${name}"`
|
|
6785
|
+
});
|
|
6757
6786
|
return;
|
|
6758
6787
|
}
|
|
6759
6788
|
seen.add(name);
|
|
@@ -6763,6 +6792,28 @@ function inspectSourceRequire(raw, paramNames) {
|
|
|
6763
6792
|
message: `require \u91CC\u7684 "${name}" \u6CA1\u6709\u51FA\u73B0\u5728\u540C\u4E00\u6765\u6E90\u7684 params \u91CC\uFF08params \u6709: ${paramNames.join(" / ") || "\u65E0"}\uFF09`
|
|
6764
6793
|
});
|
|
6765
6794
|
}
|
|
6795
|
+
};
|
|
6796
|
+
raw.forEach((entry, index) => {
|
|
6797
|
+
const at = `require[${index}]`;
|
|
6798
|
+
if (!Array.isArray(entry)) {
|
|
6799
|
+
checkName(entry, at, false);
|
|
6800
|
+
return;
|
|
6801
|
+
}
|
|
6802
|
+
if (entry.length < 2) {
|
|
6803
|
+
issues.push({
|
|
6804
|
+
path: at,
|
|
6805
|
+
message: `require \u91CC\u7684\u300C\u81F3\u5C11\u4E00\u4E2A\u300D\u5206\u7EC4\u81F3\u5C11\u8981 2 \u4E2A\u53C2\u6570\u540D\uFF08\u5355\u4E2A\u53C2\u6570\u76F4\u63A5\u5199\u540D\u5B57\uFF09\uFF0C\u5F53\u524D\u503C: ${show(entry)}`
|
|
6806
|
+
});
|
|
6807
|
+
return;
|
|
6808
|
+
}
|
|
6809
|
+
entry.forEach((member, memberIndex) => {
|
|
6810
|
+
const memberAt = `${at}[${memberIndex}]`;
|
|
6811
|
+
if (Array.isArray(member)) {
|
|
6812
|
+
issues.push({ path: memberAt, message: `require \u7684\u5206\u7EC4\u53EA\u8BB8\u4E00\u5C42\uFF0C\u4E0D\u80FD\u518D\u5D4C\u5957\u6570\u7EC4\uFF0C\u5F53\u524D\u503C: ${show(member)}` });
|
|
6813
|
+
return;
|
|
6814
|
+
}
|
|
6815
|
+
checkName(member, memberAt, true);
|
|
6816
|
+
});
|
|
6766
6817
|
});
|
|
6767
6818
|
return issues;
|
|
6768
6819
|
}
|
|
@@ -8199,7 +8250,7 @@ function parseSource(raw, path, objectNames, selfName, deps) {
|
|
|
8199
8250
|
SOMA_FROM_REQUIRE_CODE
|
|
8200
8251
|
);
|
|
8201
8252
|
}
|
|
8202
|
-
source.require = [...
|
|
8253
|
+
source.require = requireRaw.map((entry) => Array.isArray(entry) ? [...entry] : entry);
|
|
8203
8254
|
}
|
|
8204
8255
|
return source;
|
|
8205
8256
|
}
|
|
@@ -8623,11 +8674,12 @@ function parseDataConfig(raw) {
|
|
|
8623
8674
|
var NOTIFY_LEVELS = ["success", "info", "warning", "error", "alert", "announce"];
|
|
8624
8675
|
var NOTIFY_POLITENESS = ["polite", "assertive"];
|
|
8625
8676
|
var SOMA_CONFIRM_LEVELS = ["plain", "typed", "consent"];
|
|
8677
|
+
var SOMA_CONFIRM_TONES = ["default", "danger"];
|
|
8626
8678
|
|
|
8627
8679
|
// core/client/parser/confirm-spec.ts
|
|
8628
8680
|
var SOMA_CONFIRM_REJECTED_PREFIX = "soma-confirm:";
|
|
8629
8681
|
var SOMA_CONFIRM_TEXT_MAX = 1e3;
|
|
8630
|
-
var SPEC_KEYS = ["level", "text", "phrase", "impact"];
|
|
8682
|
+
var SPEC_KEYS = ["level", "text", "phrase", "impact", "tone"];
|
|
8631
8683
|
function boundedText(value2, key) {
|
|
8632
8684
|
if (typeof value2 !== "string" || value2.trim() === "") return `confirm.${key} \u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32\uFF0C\u5F53\u524D\u503C: ${JSON.stringify(value2)}`;
|
|
8633
8685
|
if (value2.length > SOMA_CONFIRM_TEXT_MAX) return `confirm.${key} \u8FC7\u957F\uFF08\u4E0A\u9650 ${SOMA_CONFIRM_TEXT_MAX} \u5B57\u7B26\uFF09`;
|
|
@@ -8635,7 +8687,7 @@ function boundedText(value2, key) {
|
|
|
8635
8687
|
}
|
|
8636
8688
|
function checkConfirmSpec(raw) {
|
|
8637
8689
|
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
|
|
8638
|
-
return { ok: false, error: `confirm \u7ED3\u6784\u5FC5\u987B\u662F { level, text, phrase?, impact? } \u5BF9\u8C61\uFF0C\u5F53\u524D\u503C: ${JSON.stringify(raw)}` };
|
|
8690
|
+
return { ok: false, error: `confirm \u7ED3\u6784\u5FC5\u987B\u662F { level, text, phrase?, impact?, tone? } \u5BF9\u8C61\uFF0C\u5F53\u524D\u503C: ${JSON.stringify(raw)}` };
|
|
8639
8691
|
}
|
|
8640
8692
|
const record = raw;
|
|
8641
8693
|
const extra = Object.keys(record).find((key) => !SPEC_KEYS.includes(key));
|
|
@@ -8646,6 +8698,9 @@ function checkConfirmSpec(raw) {
|
|
|
8646
8698
|
if (typeof level !== "string" || !SOMA_CONFIRM_LEVELS.includes(level)) {
|
|
8647
8699
|
return { ok: false, error: `confirm.level \u5FC5\u987B\u662F ${SOMA_CONFIRM_LEVELS.join(" / ")} \u4E4B\u4E00\uFF0C\u5F53\u524D\u503C: ${JSON.stringify(level)}` };
|
|
8648
8700
|
}
|
|
8701
|
+
if (record.tone !== void 0 && (typeof record.tone !== "string" || !SOMA_CONFIRM_TONES.includes(record.tone))) {
|
|
8702
|
+
return { ok: false, error: `confirm.tone \u5FC5\u987B\u662F ${SOMA_CONFIRM_TONES.join(" / ")} \u4E4B\u4E00\uFF08\u4E0D\u5199 = default\uFF09\uFF0C\u5F53\u524D\u503C: ${JSON.stringify(record.tone)}` };
|
|
8703
|
+
}
|
|
8649
8704
|
const textProblem = boundedText(record.text, "text");
|
|
8650
8705
|
if (textProblem !== null) return { ok: false, error: textProblem };
|
|
8651
8706
|
for (const key of ["phrase", "impact"]) {
|
|
@@ -8673,7 +8728,8 @@ function checkConfirmSpec(raw) {
|
|
|
8673
8728
|
level: lv,
|
|
8674
8729
|
text,
|
|
8675
8730
|
...lv === "typed" ? { phrase: record.phrase.trim() } : {},
|
|
8676
|
-
...lv !== "plain" && record.impact !== void 0 ? { impact: record.impact.trim() } : {}
|
|
8731
|
+
...lv !== "plain" && record.impact !== void 0 ? { impact: record.impact.trim() } : {},
|
|
8732
|
+
...record.tone === "danger" ? { tone: "danger" } : {}
|
|
8677
8733
|
}
|
|
8678
8734
|
};
|
|
8679
8735
|
}
|
|
@@ -8894,7 +8950,7 @@ function splitOptionalSegments(parts) {
|
|
|
8894
8950
|
const segment = parseConfirmSegment(message);
|
|
8895
8951
|
if ("error" in segment) throw new SomaEventParseError(segment.error, parts.join(" | "));
|
|
8896
8952
|
confirm = segment.spec.text;
|
|
8897
|
-
confirmSpec = segment.spec.level === "plain" ? void 0 : segment.spec;
|
|
8953
|
+
confirmSpec = segment.spec.level === "plain" && segment.spec.tone === void 0 ? void 0 : segment.spec;
|
|
8898
8954
|
continue;
|
|
8899
8955
|
}
|
|
8900
8956
|
if (index > 0 && part.startsWith(PERMISSION_PREFIX)) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { HideTransition } from '../render-ports/hide-transition';
|
|
1
2
|
/** 容器适配层协议 — 端口:Web 适配器为缺省实现,其他容器由调用方实现 */
|
|
2
3
|
export interface SomaAnchorStats {
|
|
3
4
|
anchors: Set<string>;
|
|
@@ -29,6 +30,8 @@ export interface IContainerAdapter {
|
|
|
29
30
|
replace?: boolean;
|
|
30
31
|
}): void;
|
|
31
32
|
now(): number;
|
|
33
|
+
/** 注入隐藏前过渡钩子(`renderPorts.hideTransition`);传 null 清除。未注入时 setVisibility 立即写 hidden */
|
|
34
|
+
setHideTransition?(hook: HideTransition | null): void;
|
|
32
35
|
setNavigateHandler?(handler: (url: string, options?: {
|
|
33
36
|
replace?: boolean;
|
|
34
37
|
}) => void): void;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { IContainerAdapter, SomaAnchorStats } from './IContainerAdapter';
|
|
2
|
+
import type { HideTransition } from '../render-ports/hide-transition';
|
|
2
3
|
export type { SomaAnchorStats } from './IContainerAdapter';
|
|
3
4
|
export declare class SomaContainerAdapter implements IContainerAdapter {
|
|
4
5
|
private navigateHandler;
|
|
6
|
+
private hideTransition;
|
|
7
|
+
/** 正在「隐藏前过渡」的元素 -> 取消控制器(显示时 abort,作废旧 Promise) */
|
|
8
|
+
private readonly pendingHides;
|
|
5
9
|
/** 注入自定义导航处理器(如 SomaRouter + Next.js 路由) */
|
|
6
10
|
setNavigateHandler(handler: (url: string, options?: {
|
|
7
11
|
replace?: boolean;
|
|
@@ -22,6 +26,7 @@ export declare class SomaContainerAdapter implements IContainerAdapter {
|
|
|
22
26
|
/** 显隐只有 `hidden` 属性这一个机制:不写内联样式、不切类名;元素自带的 display 规则压不过 `[hidden]`,见 host-next/app/globals.css(宿主壳样式) */
|
|
23
27
|
setVisibility(element: HTMLElement, visible: boolean): void;
|
|
24
28
|
isVisible(element: HTMLElement): boolean;
|
|
29
|
+
setHideTransition(hook: HideTransition | null): void;
|
|
25
30
|
toggleClasses(element: HTMLElement, classes: string[], enabled: boolean): void;
|
|
26
31
|
setValue(element: HTMLElement, value: string): void;
|
|
27
32
|
getValue(element: HTMLElement): string;
|
|
@@ -13,8 +13,10 @@ export declare class SomaDataCycleError extends Error {
|
|
|
13
13
|
}
|
|
14
14
|
/** 解析器需要的最小 http 能力(结构兼容 IHttpClient / SomaHttpService) */
|
|
15
15
|
export interface SomaDataHttpLike {
|
|
16
|
+
/** `silentErrorToast`:读失败已由读状态在内容区内联呈现,请求层不再全局弹 toast(避免同一错误出现两次) */
|
|
16
17
|
get<T = unknown>(url: string, config?: {
|
|
17
18
|
params?: Record<string, string>;
|
|
19
|
+
silentErrorToast?: boolean;
|
|
18
20
|
onResponse?: (info: {
|
|
19
21
|
status: number;
|
|
20
22
|
}) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { ChartInit, ChartInstance, ChartPointer, ChartTheme, SomaChartAdapter, SomaChartEnginePort, } from './port';
|
|
1
|
+
export type { ChartColumn, ChartInit, ChartInstance, ChartPointer, ChartTheme, SomaChartAdapter, SomaChartEnginePort, } from './port';
|
|
2
2
|
export { assertChartAdapter } from './port';
|
|
3
3
|
import type { EngineLoadTelemetry } from '../load';
|
|
4
4
|
import { type SomaChartAdapter, type SomaChartEnginePort } from './port';
|
|
@@ -19,7 +19,22 @@ export interface ChartPointer {
|
|
|
19
19
|
readonly y: number;
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
+
/** 指针 / 键盘所在的类目轴列;空值列、列间空白也能命中(与系列是否有图元无关) */
|
|
23
|
+
export interface ChartColumn {
|
|
24
|
+
/** 第一个类目轴上的列序号(与系列 data 下标一致) */
|
|
25
|
+
readonly dataIndex: number;
|
|
26
|
+
/** 该列在容器内的锚点像素(列中心、绘图区顶部) */
|
|
27
|
+
readonly anchor: {
|
|
28
|
+
readonly x: number;
|
|
29
|
+
readonly y: number;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
22
32
|
export interface ChartInstance {
|
|
33
|
+
/**
|
|
34
|
+
* 指针在绘图区内移动 / 点击 / 离开时按坐标轴换算所在列;落在绘图区外按 leave 处理;无类目轴的图(饼、仪表等)不触发。
|
|
35
|
+
* 可选:旧适配器缺该方法时调用方回落到 `onPointer`(只有带图元的列可交互)。
|
|
36
|
+
*/
|
|
37
|
+
onColumn?(handler: (kind: 'hover' | 'click' | 'leave', col: ChartColumn | null) => void): () => void;
|
|
23
38
|
setOption(option: Readonly<Record<string, unknown>>, mode?: 'merge' | 'replace'): void;
|
|
24
39
|
/** 键盘漫游驱动 */
|
|
25
40
|
highlight(p: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SOMA_CONFIRM_LEVELS, type SomaConfirmLevel, type SomaConfirmSpec } from '../../shared/types/event.types';
|
|
2
|
-
export { SOMA_CONFIRM_LEVELS };
|
|
3
|
-
export type { SomaConfirmLevel, SomaConfirmSpec };
|
|
1
|
+
import { SOMA_CONFIRM_LEVELS, SOMA_CONFIRM_TONES, type SomaConfirmLevel, type SomaConfirmSpec, type SomaConfirmTone } from '../../shared/types/event.types';
|
|
2
|
+
export { SOMA_CONFIRM_LEVELS, SOMA_CONFIRM_TONES };
|
|
3
|
+
export type { SomaConfirmLevel, SomaConfirmSpec, SomaConfirmTone };
|
|
4
4
|
/** 确认文案 / 键入串 / 影响说明的长度上限(与执行编排的确认文案上限同口径) */
|
|
5
5
|
export declare const SOMA_CONFIRM_TEXT_MAX = 1000;
|
|
6
6
|
export type SomaConfirmCheck = {
|
|
@@ -22,6 +22,30 @@ export interface SomaConfirmSegment {
|
|
|
22
22
|
export declare function parseConfirmSegment(message: string): SomaConfirmSegment | {
|
|
23
23
|
readonly error: string;
|
|
24
24
|
};
|
|
25
|
+
/** 缺失占位的代入串 */
|
|
26
|
+
export declare const SOMA_CONFIRM_MISSING = "\u2014";
|
|
27
|
+
/** 保留占位名:已选行数 */
|
|
28
|
+
export declare const SOMA_CONFIRM_COUNT_NAME = "n";
|
|
29
|
+
/** 占位取值的来源(触发时由事件引擎按载荷与所在行给出) */
|
|
30
|
+
export interface SomaConfirmContext {
|
|
31
|
+
/** 触发行 / 记录(载荷 `row`,或行内触发的所在行数据) */
|
|
32
|
+
readonly row?: unknown;
|
|
33
|
+
/** 已选行数(载荷 `rows` 数组的长度);没有批量载荷时不给 */
|
|
34
|
+
readonly count?: number;
|
|
35
|
+
}
|
|
36
|
+
/** 文案里出现的占位名(按出现顺序去重;`{{` / `}}` 转义不算)。方言编译期据此静态核对用,运行期不依赖 */
|
|
37
|
+
export declare function listConfirmPlaceholders(text: string): string[];
|
|
38
|
+
/** 代入一段确认文案里的占位;`onMissing` 收到每个缺失的占位名(引擎用它记开发期告警) */
|
|
39
|
+
export declare function substituteConfirmText(text: string, context: SomaConfirmContext, onMissing?: (name: string) => void): string;
|
|
40
|
+
/** 把确认规格的 text / impact 代入占位;无花括号时返回原规格(同一引用) */
|
|
41
|
+
export declare function resolveConfirmSpec(spec: SomaConfirmSpec, context: SomaConfirmContext, onMissing?: (name: string) => void): SomaConfirmSpec;
|
|
42
|
+
/** 开发期告警(按占位名去重;生产构建不输出) */
|
|
43
|
+
export declare function warnConfirmMissing(name: string, where: string): void;
|
|
44
|
+
/**
|
|
45
|
+
* 从事件载荷与所在行取占位来源:`row` 取载荷 `row`(没有则取所在行数据);`count` 取载荷 `rows` 数组长度。
|
|
46
|
+
* 载荷不是对象时按空载荷处理。
|
|
47
|
+
*/
|
|
48
|
+
export declare function confirmContextOf(payload: unknown, rowData?: unknown): SomaConfirmContext;
|
|
25
49
|
export interface SomaConfirmInput {
|
|
26
50
|
/** typed 级已键入的串 */
|
|
27
51
|
readonly typed: string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 隐藏前过渡端口(UI 体系注入,经 `renderPorts.hideTransition`;方言中性)。
|
|
3
|
+
* core 的显隐唯一出口 `setVisibility(el, false)` 在真正写 `hidden` 之前调用它:
|
|
4
|
+
* - 返回 `void`(或抛错):立即隐藏,与未注册时完全一致;
|
|
5
|
+
* - 返回 Promise:等它 resolve 后才隐藏;等待期间 core 视该元素为「已隐藏」(`isVisible` 为 false,重复隐藏不再调用钩子);
|
|
6
|
+
* - 等待期间该元素被再次显示:core 先触发 `signal` 的 abort(实现据此撤销过渡状态),再直接显示,旧 Promise 的结果作废。
|
|
7
|
+
* 钩子只在元素当前可见时被调用;是否做过渡、做什么、多久,全由实现自己决定,core 不认识动画。
|
|
8
|
+
*/
|
|
9
|
+
export type HideTransition = (element: HTMLElement, signal: AbortSignal) => Promise<void> | void;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { NotifyRenderer } from './notify-renderer';
|
|
2
2
|
import type { RegionFallbackRenderer } from './region-fallback';
|
|
3
|
+
import type { HideTransition } from './hide-transition';
|
|
3
4
|
export type { NotifyEntry, NotifyRenderer } from './notify-renderer';
|
|
4
5
|
export type { RegionFallbackRenderer } from './region-fallback';
|
|
6
|
+
export type { HideTransition } from './hide-transition';
|
|
5
7
|
export { TOAST_CONFIG_ERROR, createToastScheduler } from './scheduling/toast-scheduler';
|
|
6
8
|
export type { ToastClock, ToastItemState, ToastPhase, ToastScheduler, ToastTimingConfig } from './scheduling/toast-scheduler';
|
|
7
9
|
export { createPromptQueue } from './scheduling/prompt-queue';
|
|
@@ -10,6 +12,8 @@ export type { PromptOptions, PromptQueue } from './scheduling/prompt-queue';
|
|
|
10
12
|
export interface SomaRenderPorts {
|
|
11
13
|
notify?: NotifyRenderer;
|
|
12
14
|
regionFallback?: RegionFallbackRenderer;
|
|
15
|
+
/** 隐藏前过渡:core 写 `hidden` 之前先等它(缺省立即隐藏) */
|
|
16
|
+
hideTransition?: HideTransition;
|
|
13
17
|
}
|
|
14
18
|
export { confirmSatisfied, confirmKeyAccepts } from '../parser/confirm-spec';
|
|
15
19
|
export type { SomaConfirmInput } from '../parser/confirm-spec';
|
|
@@ -23,7 +23,8 @@ export interface NotifyRenderer {
|
|
|
23
23
|
dismiss(): void;
|
|
24
24
|
};
|
|
25
25
|
/**
|
|
26
|
-
* 确认。`spec` 只在 typed / consent
|
|
26
|
+
* 确认。`spec` 只在 typed / consent 级或 `tone: 'danger'` 时出现(plain 且无语气不带),`message` 恒等于 `spec.text`,不认识分级的渲染器照旧显示一句话。
|
|
27
|
+
* `spec.tone === 'danger'`(破坏性确认):渲染器应给确认钮警示呈现,并把初始焦点放在「取消」;typed / consent 的放行规则不变。
|
|
27
28
|
* 认识分级的渲染器必须用 `confirmSatisfied(spec, { typed, consented })` 决定确认钮此刻能不能点:
|
|
28
29
|
* typed 要键入 `phrase`、consent 要先勾选同意(`impact` 是勾选旁的影响说明);
|
|
29
30
|
* 键入框里输入法组字(`isImeProcessing`)期间的 Enter 是选词,不算确认;取消 / Esc / 点遮罩一律 resolve(false)。
|
package/dist/types/index.d.ts
CHANGED
|
@@ -85,13 +85,13 @@ export type { IRealtimeTransport, RealtimeMessageHandler } from './client/infra/
|
|
|
85
85
|
export type { IRealtimeService, RealtimeSubscribeOptions } from './client/infra/realtime/IRealtimeService';
|
|
86
86
|
export { SseRealtimeTransport } from './client/infra/realtime/SseRealtimeTransport';
|
|
87
87
|
export { WebSocketRealtimeTransport } from './client/infra/realtime/WebSocketRealtimeTransport';
|
|
88
|
-
export type { NotifyEntry, NotifyRenderer, RegionFallbackRenderer, SomaRenderPorts } from './client/render-ports';
|
|
88
|
+
export type { HideTransition, NotifyEntry, NotifyRenderer, RegionFallbackRenderer, SomaRenderPorts } from './client/render-ports';
|
|
89
89
|
export type { SomaEngineAdapters, SomaEngineId } from './client/engines/engine-adapters';
|
|
90
90
|
export type { INotifyService, NotifyOptions, NotifyLevel, NotifyCarrier, NotifyAction } from './client/infra/notify/INotifyService';
|
|
91
91
|
export { DefaultNotifyService, createNotifyService } from './client/infra/notify/DefaultNotifyService';
|
|
92
|
-
export type { SomaConfirmSpec, SomaConfirmLevel } from './shared/types/event.types';
|
|
93
|
-
export { checkConfirmSpec, parseConfirmSegment, confirmSatisfied, confirmKeyAccepts } from './client/parser/confirm-spec';
|
|
94
|
-
export type { SomaConfirmInput, SomaConfirmCheck, SomaConfirmSegment } from './client/parser/confirm-spec';
|
|
92
|
+
export type { SomaConfirmSpec, SomaConfirmLevel, SomaConfirmTone } from './shared/types/event.types';
|
|
93
|
+
export { SOMA_CONFIRM_TONES, checkConfirmSpec, parseConfirmSegment, confirmSatisfied, confirmKeyAccepts, confirmContextOf, listConfirmPlaceholders, resolveConfirmSpec, substituteConfirmText, SOMA_CONFIRM_MISSING, SOMA_CONFIRM_COUNT_NAME, } from './client/parser/confirm-spec';
|
|
94
|
+
export type { SomaConfirmInput, SomaConfirmCheck, SomaConfirmSegment, SomaConfirmContext } from './client/parser/confirm-spec';
|
|
95
95
|
export { SomaRealtimeService } from './client/infra/realtime/SomaRealtimeService';
|
|
96
96
|
export { SomaMiddlewareChain } from './client/middleware/SomaMiddlewareChain';
|
|
97
97
|
export { createPermissionMiddleware } from './client/middleware/createPermissionMiddleware';
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
type Rec = Record<string, unknown>;
|
|
2
|
+
/** 缺省页长 / 页长上限(调用方可用 defaultPageSize / maxPageSize 覆盖);数字只在 design 真源 pipeline/limits.json 的 pagedList,经生成表读 */
|
|
3
|
+
export declare const SOMA_PAGED_LIST_LIMITS: {
|
|
4
|
+
readonly pageSizeDefault: 10;
|
|
5
|
+
readonly pageSizeMax: 500;
|
|
6
|
+
};
|
|
7
|
+
/** 响应信封声明:failWhen 为闭集谓词(命中 = 失败)、messagePath 为失败文案点路径、dataPath 为成功数据点路径(缺省不拆) */
|
|
8
|
+
export interface SomaResponseEnvelope {
|
|
9
|
+
failWhen?: Rec;
|
|
10
|
+
messagePath?: string;
|
|
11
|
+
dataPath?: string;
|
|
12
|
+
}
|
|
13
|
+
export type SomaUnwrappedEnvelope = {
|
|
14
|
+
ok: true;
|
|
15
|
+
data: unknown;
|
|
16
|
+
} | {
|
|
17
|
+
ok: false;
|
|
18
|
+
error: Rec;
|
|
19
|
+
};
|
|
20
|
+
/** 响应命中信封失败判定(没有声明 failWhen 一律不判失败) */
|
|
21
|
+
export declare function isResponseEnvelopeFailure(raw: unknown, env?: SomaResponseEnvelope): raw is Rec;
|
|
22
|
+
/** 拆信封:失败信封原样放进 `error`;成功按 dataPath 取数据(没声明不拆) */
|
|
23
|
+
export declare function unwrapResponseEnvelope(raw: unknown, env?: SomaResponseEnvelope): SomaUnwrappedEnvelope;
|
|
24
|
+
export interface PagedListAdapterOptions {
|
|
25
|
+
/** 请求里的页码键 / 页长键(缺省 pageNo / pageSize;其余键都当筛选) */
|
|
26
|
+
pageKey?: string;
|
|
27
|
+
sizeKey?: string;
|
|
28
|
+
/** 上游页码参数名(缺省 page) */
|
|
29
|
+
upstreamPage?: string;
|
|
30
|
+
/** 上游页长参数名(缺省 pageSize) */
|
|
31
|
+
upstreamSize?: string;
|
|
32
|
+
/** 响应里行数组的位置:点路径(相对拆信封后的 data),或候选键列表(取第一个数组);缺省 list / records / rows / items / data */
|
|
33
|
+
rowsPath?: string | readonly string[];
|
|
34
|
+
/** 总数的候选位置(相对拆信封后的 data);缺省 totalCount / total / count */
|
|
35
|
+
totalPaths?: readonly string[];
|
|
36
|
+
/** 筛选参数:字段名 -> 上游参数名;数组 = 同名透传的白名单;缺省收全部非保留参数同名透传 */
|
|
37
|
+
filterMap?: Readonly<Record<string, string>> | readonly string[];
|
|
38
|
+
/** 给行补主键 id:依次取这些键里第一个非空值(已有非空 id 不动) */
|
|
39
|
+
rowId?: string | readonly string[];
|
|
40
|
+
/** 缺省页长 / 页长上限(缺省 SOMA_PAGED_LIST_LIMITS) */
|
|
41
|
+
defaultPageSize?: number;
|
|
42
|
+
maxPageSize?: number;
|
|
43
|
+
/** 业务信封声明(由调用方显式传入;缺省按无信封处理,不读任何全局) */
|
|
44
|
+
envelope?: SomaResponseEnvelope;
|
|
45
|
+
}
|
|
46
|
+
export interface PagedQuery {
|
|
47
|
+
/** 从 1 起 */
|
|
48
|
+
page: number;
|
|
49
|
+
pageSize: number;
|
|
50
|
+
/** 字段名 -> 值(已去空白,空值不进) */
|
|
51
|
+
filters: Record<string, string>;
|
|
52
|
+
/** 可直接拼到上游请求的参数:页码、页长、已改名的筛选 */
|
|
53
|
+
upstream: Record<string, string | number>;
|
|
54
|
+
}
|
|
55
|
+
export interface PagedList {
|
|
56
|
+
rows: Rec[];
|
|
57
|
+
total: number;
|
|
58
|
+
}
|
|
59
|
+
export interface PagedListAdapter {
|
|
60
|
+
/** 请求里没有页码键 = 旧调用方(调用方可据此原样转交旧服务) */
|
|
61
|
+
hasPage(input: unknown): boolean;
|
|
62
|
+
readQuery(input: unknown): PagedQuery;
|
|
63
|
+
/** 上游响应 -> 列表;失败信封返回 { error } */
|
|
64
|
+
toList(raw: unknown, mapRow?: (row: Rec, index: number) => Rec): PagedList | {
|
|
65
|
+
error: Rec;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/** 给行补主键:id 缺省时依次取 keys 里第一个非空值(字符串化),已有非空 id 不动 */
|
|
69
|
+
export declare function withRowId(row: Rec, keys: string | readonly string[]): Rec;
|
|
70
|
+
export declare function createPagedListAdapter(options?: PagedListAdapterOptions): PagedListAdapter;
|
|
71
|
+
export type CursorLoader = (query: {
|
|
72
|
+
cursor?: string;
|
|
73
|
+
limit: number;
|
|
74
|
+
}) => Promise<unknown>;
|
|
75
|
+
export interface CursorPageOptions<T> {
|
|
76
|
+
load: CursorLoader;
|
|
77
|
+
/** 响应里行数组的键(缺省 rows) */
|
|
78
|
+
rowsKey?: string;
|
|
79
|
+
/** 响应里总数的键(缺省 total) */
|
|
80
|
+
totalKey?: string;
|
|
81
|
+
/** 响应里下一页游标的键(缺省 nextCursor) */
|
|
82
|
+
nextKey?: string;
|
|
83
|
+
parse?: (raw: unknown) => T;
|
|
84
|
+
/** 目标页(从 1 起)与页长 */
|
|
85
|
+
page: number;
|
|
86
|
+
pageSize: number;
|
|
87
|
+
/** 出错信息前缀(如「接口目录」) */
|
|
88
|
+
label: string;
|
|
89
|
+
}
|
|
90
|
+
export interface CursorPageResult<T> {
|
|
91
|
+
rows: T[];
|
|
92
|
+
total: number;
|
|
93
|
+
/** 最后一次取到的原始响应(调用方要读其它字段,如 snapshotVersion);页号超过末页时是末页那次的响应 */
|
|
94
|
+
raw: Rec | null;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* 沿游标走到第 page 页,返回该页行与总数;页号超过末页返回空行(total 仍真实)。
|
|
98
|
+
* 响应结构非法(行不是数组、总数不是非负整数、行数超过页长)抛错,不静默截断;游标重复也抛错(防死循环)。
|
|
99
|
+
*/
|
|
100
|
+
export declare function cursorPageWindow<T = unknown>(options: CursorPageOptions<T>): Promise<CursorPageResult<T>>;
|
|
101
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vitest / vite 用的完整宿主别名:源码根别名(`somaViteAliases`)+ 可选宿主引导模块。
|
|
3
|
+
* core 对 `@soma-host/bootstrap/soma-bootstrap` 做可选动态 import:原生 Node 下缺失会被捕获(按「无宿主钩子」处理),
|
|
4
|
+
* 但 vite 在转换期就要解析该说明符,宿主没有这个文件时测试直接失败——以前每个应用自己写一个空垫片。
|
|
5
|
+
* 这里统一给出:宿主源码根下有该文件就指向它,没有就指向 core 自带的空模块(与运行期「无钩子」同形)。
|
|
6
|
+
*/
|
|
7
|
+
export function somaViteHostAliases(hostDir: any, env?: NodeJS.ProcessEnv): {
|
|
8
|
+
find: RegExp;
|
|
9
|
+
replacement: string;
|
|
10
|
+
}[];
|
|
11
|
+
export const CODE_INVALID: "CORE-HOST-ALIAS-INVALID";
|
|
12
|
+
export const CODE_RESERVED: "CORE-HOST-ALIAS-RESERVED";
|
|
13
|
+
export const CODE_SHADOW: "CORE-HOST-ALIAS-SHADOW";
|
|
14
|
+
export const CODE_DUPLICATE: "CORE-HOST-ALIAS-DUPLICATE";
|
|
15
|
+
export const CODE_TSCONFIG_DRIFT: "CORE-HOST-ALIAS-TSCONFIG-DRIFT";
|
|
16
|
+
export function clearSomaSourceRootCache(): void;
|
|
17
|
+
/**
|
|
18
|
+
* 解析声明的源码根 → 别名表。纯函数式(只读文件系统),不抛、不打印;结果带诊断。
|
|
19
|
+
* @returns {{ declared: boolean, entries: Array<{ name: string, dir: string }>, aliases: Record<string, string>, diagnostics: Array<{ code: string, severity: "error" | "warning", message: string, name?: string }> }}
|
|
20
|
+
*/
|
|
21
|
+
export function resolveSomaSourceRoots(hostDir: any, env?: NodeJS.ProcessEnv): {
|
|
22
|
+
declared: boolean;
|
|
23
|
+
entries: Array<{
|
|
24
|
+
name: string;
|
|
25
|
+
dir: string;
|
|
26
|
+
}>;
|
|
27
|
+
aliases: Record<string, string>;
|
|
28
|
+
diagnostics: Array<{
|
|
29
|
+
code: string;
|
|
30
|
+
severity: "error" | "warning";
|
|
31
|
+
message: string;
|
|
32
|
+
name?: string;
|
|
33
|
+
}>;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* 运行期 / 构建期取别名表的统一入口:error 级诊断抛出(带 `code`),warning 级每个宿主每条只打一次。
|
|
37
|
+
* 未声明 → `{}`。
|
|
38
|
+
* @returns {Record<string, string>} 别名 → 绝对目录(无尾斜杠)
|
|
39
|
+
*/
|
|
40
|
+
export function getSomaSourceRootAliases(hostDir: any, env?: NodeJS.ProcessEnv): Record<string, string>;
|
|
41
|
+
/** 说明符 → `{ dir, subpath }`(只认带斜杠的整段前缀匹配);不匹配 → null。供 esbuild 等自己解析的构建器使用 */
|
|
42
|
+
export function matchSomaSourceRoot(aliases: any, specifier: any): {
|
|
43
|
+
name: string;
|
|
44
|
+
dir: any;
|
|
45
|
+
subpath: string;
|
|
46
|
+
} | null;
|
|
47
|
+
/** esbuild `onResolve` 的 filter:`^(?:a|b)/`;无别名 → null(调用方不注册钩子,零开销) */
|
|
48
|
+
export function somaSourceRootFilter(aliases: any): RegExp | null;
|
|
49
|
+
/** vitest / vite `resolve.alias` 数组:`[{ find: /^name\//, replacement: "<dir>/" }]`;未声明 → [] */
|
|
50
|
+
export function somaViteAliases(hostDir: any, env?: NodeJS.ProcessEnv): {
|
|
51
|
+
find: RegExp;
|
|
52
|
+
replacement: string;
|
|
53
|
+
}[];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface SomaSourceRootDiagnostic {
|
|
2
|
+
readonly code: string;
|
|
3
|
+
readonly severity: "error" | "warning";
|
|
4
|
+
readonly message: string;
|
|
5
|
+
readonly name?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface SomaSourceRootResolution {
|
|
8
|
+
readonly declared: boolean;
|
|
9
|
+
readonly entries: ReadonlyArray<{
|
|
10
|
+
readonly name: string;
|
|
11
|
+
readonly dir: string;
|
|
12
|
+
}>;
|
|
13
|
+
readonly aliases: Readonly<Record<string, string>>;
|
|
14
|
+
readonly diagnostics: readonly SomaSourceRootDiagnostic[];
|
|
15
|
+
}
|
|
16
|
+
type Env = Readonly<Record<string, string | undefined>>;
|
|
17
|
+
/** 实现只有 `source-aliases.cjs` 一份(单实现);这里只补类型再导出,不另写第二份。 */
|
|
18
|
+
export declare const resolveSomaSourceRoots: (hostDir: string, env?: Env) => SomaSourceRootResolution;
|
|
19
|
+
/** 别名 → 绝对目录;未声明 → `{}`;error 级诊断抛出(带 `code`) */
|
|
20
|
+
export declare const getSomaSourceRootAliases: (hostDir: string, env?: Env) => Record<string, string>;
|
|
21
|
+
export declare const somaViteAliases: (hostDir: string, env?: Env) => Array<{
|
|
22
|
+
find: RegExp;
|
|
23
|
+
replacement: string;
|
|
24
|
+
}>;
|
|
25
|
+
/** vitest / vite 的完整宿主别名:源码根别名 + 可选宿主引导模块(宿主没有该文件时指向 core 自带空模块) */
|
|
26
|
+
export declare const somaViteHostAliases: (hostDir: string, env?: Env) => Array<{
|
|
27
|
+
find: RegExp;
|
|
28
|
+
replacement: string;
|
|
29
|
+
}>;
|
|
30
|
+
export {};
|
|
@@ -12,6 +12,8 @@ export type SomaAssetSourceItem = {
|
|
|
12
12
|
export const SOMA_SOURCE_PACKAGES_ENV: "SOMA_SOURCE_PACKAGES";
|
|
13
13
|
export function getSomaHostSourceRoot(hostDir: any, env?: NodeJS.ProcessEnv): string;
|
|
14
14
|
export function getSomaHostApiRoot(hostDir: any, env?: NodeJS.ProcessEnv): string;
|
|
15
|
+
/** 子路径必须落在 parent 内且存在,否则回落 parent(越界不报错、不跟随) */
|
|
16
|
+
export function resolveSafeChildRoot(parent: any, relativePath: any): string;
|
|
15
17
|
export function clearSomaAssetSourcesCache(): void;
|
|
16
18
|
/** Host 自己 + 全部源包(依赖里声明的与环境变量显式声明的);Host 恒在第一位 */
|
|
17
19
|
/** @param {SomaEnv} [env] */
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* 与 `soma-core/server` 的关系:同名导出是同一份实现的再导出,不是第二份;Next 服务端代码继续用 `soma-core/server`。
|
|
10
10
|
*/
|
|
11
11
|
export { clearSomaAssetSourcesCache, collectIncludes, collectPageEntries, getSomaAssetSources, getSomaHostApiRoot, getSomaHostConfigRoot, getSomaHostSourceRoot, listSomaSourcePackageNames, normalizeSomaEnv, orderSourcesForOverride, readSomaEnv, resolveAppConfigPath, resolveHostAppConfigPath, resolveHostConfigRoot, type SomaAssetSource, type SomaEnvName, type SomaSourcePageEntry, } from "./host/source-packages";
|
|
12
|
+
export { getSomaSourceRootAliases, resolveSomaSourceRoots, somaViteAliases, somaViteHostAliases, type SomaSourceRootDiagnostic, type SomaSourceRootResolution, } from "./host/source-aliases";
|
|
12
13
|
export { loadSomaServerPageAssets, resolveSomaPageSource, SomaPageAssetError, type SomaServerPageAssets, } from "./host/server-page-assets";
|
|
13
14
|
export { loadPageMarkupConfig, renderColorSchemeMeta } from "./host/page-markup-config";
|
|
14
15
|
export { resolveHostServiceCandidate, resolveServiceFilePath, toPascalCase, validateServiceSegments, type ResolveHostServiceCandidateOptions, } from "./api/service-path";
|
|
@@ -3,6 +3,8 @@ import { addressShapeKey, compareAddressSpecificity } from '../../shared/runtime
|
|
|
3
3
|
import { type SomaAccessIdentity, type SomaAccessPolicy } from './access-gate';
|
|
4
4
|
import { SomaRuntimeStore } from './store';
|
|
5
5
|
import type { SomaNavView, SomaRuntimeBinding, SomaRuntimeLayout, SomaStandardPage, SomaStandardPageEnvelope } from './types';
|
|
6
|
+
/** 方言所有者给的版本守卫:`version` 是它随产物给出的不透明版本号;返回 false = 该产物不是本版产出方编的,不得恢复 */
|
|
7
|
+
export type OwnerVersionGuard = (version: string | undefined) => boolean;
|
|
6
8
|
/** 前缀解析器交回的东西:标准格式载荷,或兼容旧入口已经拼好的运行时资产(虚拟页的 `artifact` / 声明分支) */
|
|
7
9
|
export type PrefixPageResult = {
|
|
8
10
|
readonly kind: 'page';
|
|
@@ -47,10 +49,17 @@ interface SpaceState {
|
|
|
47
49
|
readonly layout: SomaRuntimeLayout;
|
|
48
50
|
} | null;
|
|
49
51
|
rootErrorReported: boolean;
|
|
52
|
+
/** owner → 版本守卫(方言所有者登记;core 不解释 version) */
|
|
53
|
+
readonly ownerGuards: Map<string, OwnerVersionGuard>;
|
|
50
54
|
}
|
|
51
55
|
export declare function space(): SpaceState;
|
|
52
56
|
/** 测试复位:清空绑定表、代次、到期记录与装入标记(不动磁盘) */
|
|
53
57
|
export declare function resetRuntimeSpace(): void;
|
|
58
|
+
/**
|
|
59
|
+
* 方言所有者登记版本守卫(升级隐患闸):持久绑定恢复时,owner 相同的条目其 `version` 须被守卫接受,否则丢弃(连绑定文件),
|
|
60
|
+
* 页面由所有者按本版编译器重新注入。登记时已装入的同 owner 持久条目立刻对一遍。core 只存守卫、不解释 version(缓存键 = URL + version)。
|
|
61
|
+
*/
|
|
62
|
+
export declare function registerOwnerVersionGuard(owner: string, guard: OwnerVersionGuard): void;
|
|
54
63
|
/** 当前进程的 runtime 布局(按环境签名记忆,避免每次调用都读盘) */
|
|
55
64
|
export declare function runtimeLayout(): SomaRuntimeLayout;
|
|
56
65
|
export declare function runtimeStore(layout?: SomaRuntimeLayout): SomaRuntimeStore;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import type { SomaStandardPage } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* core 落盘产物的格式版本(绑定记录、预热索引与旁档、预热元数据共用)。落盘结构(信封、闸门等)有不兼容变化时递增;
|
|
4
|
+
* 读回时版本不符一律视为无效并丢弃,由方言所有者重新编译注入,不做迁移也不手工清目录。
|
|
5
|
+
*/
|
|
6
|
+
export declare const SOMA_RUNTIME_STORE_FORMAT = 2;
|
|
2
7
|
/** 摘要形状:64 位小写十六进制 */
|
|
3
8
|
export declare const SOMA_RUNTIME_DIGEST_PATTERN: RegExp;
|
|
4
9
|
export declare function isRuntimeDigest(value: unknown): value is string;
|
|
@@ -2,7 +2,7 @@ export { inject, injectMany, bindPrefix, unbind, validateAddress, type SomaInjec
|
|
|
2
2
|
export { registerSomaPage, registerSomaPages, injectCompiledPage, withdrawPage, readCachedPage, pageCacheKey, listRegisteredPages, parseSomaDsl, renderHtmlTree, normalizeSomaPageInput, type SomaPageInput, type SomaCompiledPage, type SomaHtmlNode, type SomaHtmlChild, type SomaDslDoc, type SomaDslKind, type SomaDslParseResult, type SomaPageRegisterOptions, type SomaPageRegistration, type SomaPageBatchEntry, type SomaPageBatchOutcome, type SomaCachedPage, type SomaRegisteredPage, } from './dynamic-pages';
|
|
3
3
|
export { resolveAddress, loadPageByAddress, listBindings, runtimeSpaceStats, type SomaLoadedPage, type SomaLoadPageOptions } from './resolve';
|
|
4
4
|
export { SomaRuntimeError, type SomaRuntimeBatchFailure, type SomaRuntimeErrorCode } from './errors';
|
|
5
|
-
export { setNavProvider, type NavProvider } from './bindings';
|
|
5
|
+
export { setNavProvider, registerOwnerVersionGuard, type NavProvider, type OwnerVersionGuard } from './bindings';
|
|
6
6
|
export { registerPage, registerPages, validatePageGrants, adjudicateGrant, stampEnvelope, SOMA_DEFAULT_PAGE_GRANTS, type SomaRegisterOptions, type SomaRegisterManyEntry, type SomaGrantDecision, type SomaGrantRequest, } from './page-grants';
|
|
7
7
|
export { SomaSubmitStepError, checkSubmitOptions, decideSubmitAddress, precheckSubmitSlot, checkExpectedGeneration, stampSubmitEnvelope, buildRegisterRequest, registerPageOrReject, findUnchangedBinding, createProvenanceLedger, unbindOwnedPage, listPageBindings, } from './submit-steps';
|
|
8
8
|
export type { SomaSubmitStepIssue, SomaSubmitStepsRuntime, SomaSubmitAddressKind, SomaPageRegisterRequest, SomaPageBindingView, SomaProvenanceLedger, } from './types';
|
|
@@ -3,7 +3,7 @@ export declare const SOMA_PREWARM_COMPILED_DIR = "compiled";
|
|
|
3
3
|
export declare const SOMA_PREWARM_META_FILE = "meta.json";
|
|
4
4
|
/** 旁档:一个静态页的构建期编译结果 */
|
|
5
5
|
export interface SomaPrewarmCompiledRecord<T = unknown> {
|
|
6
|
-
readonly schemaVersion:
|
|
6
|
+
readonly schemaVersion: number;
|
|
7
7
|
readonly address: string;
|
|
8
8
|
/** 对应标准格式产物的摘要;与索引不一致即视为失效 */
|
|
9
9
|
readonly digest: string;
|
|
@@ -13,7 +13,7 @@ export interface SomaPrewarmCompiledRecord<T = unknown> {
|
|
|
13
13
|
}
|
|
14
14
|
/** 全局元数据(路由表、词表、应用配置):不属于某一页 */
|
|
15
15
|
export interface SomaPrewarmMeta<M = unknown> {
|
|
16
|
-
readonly schemaVersion:
|
|
16
|
+
readonly schemaVersion: number;
|
|
17
17
|
readonly meta: M;
|
|
18
18
|
}
|
|
19
19
|
export interface SomaPrewarmStaticPage<T = unknown> {
|