soma-core 2.2.5 → 2.2.7
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 +5 -6
- package/bin/soma.cjs +2 -2
- package/core/build/compiler/flat-page.ts +16 -0
- package/core/build/compiler/full-manifest-builder.ts +0 -3
- package/core/build/compiler/page-assets.ts +0 -1
- package/core/build/compiler/page-closure.ts +245 -0
- package/core/build/compiler/page-declaration-compiler.ts +2 -5
- package/core/build/compiler/soma-precompile.js +1972 -3312
- package/core/build/compiler/soma-precompile.ts +4 -7
- package/core/build/component-tree/artifact-codec.ts +4 -8
- package/core/build/lsp/soma-declaration.cjs +1 -1
- package/core/build/lsp/std-completion.generated.json +3 -3
- package/core/client/a11y/a11y-config.ts +2 -1
- package/core/client/a11y/dom-id.ts +1 -1
- package/core/client/base/SomaHttpClient.ts +11 -3
- package/core/client/base/SomaPageRootBase.ts +6 -0
- package/core/client/base/defineSomaView.ts +178 -0
- package/core/client/base/index.ts +13 -0
- package/core/client/base/view-context.ts +328 -0
- package/core/client/behavior/adapter-collection.ts +2 -2
- package/core/client/compiler/manifest-compiler.ts +5 -36
- package/core/client/component/component-definition.types.ts +2 -1
- package/core/client/component/component-manager.ts +110 -20
- package/core/client/component/structure-adapter.ts +3 -7
- package/core/client/container/IContainerAdapter.ts +4 -0
- package/core/client/container/SomaContainerAdapter.ts +52 -3
- package/core/client/data/data-object-resolver.ts +523 -184
- package/core/client/data/data-write-actions.ts +79 -15
- package/core/client/data/format-config.ts +3 -1
- package/core/client/data/region-scope-port.ts +11 -0
- package/core/client/engine/asset-resolver.ts +2 -5
- package/core/client/engine/dom-renderer.ts +7 -40
- package/core/client/engine/event-engine.ts +29 -108
- package/core/client/engine/property-watcher.ts +1 -1
- package/core/client/engine/reactive-proxy.ts +78 -17
- package/core/client/engine/runtime-builder.ts +0 -14
- package/core/client/engine/scope-resolver.ts +18 -0
- package/core/client/engine/soma-bootstrap.ts +387 -99
- package/core/client/engine/style-binder.ts +49 -106
- package/core/client/engine/timer-engine.ts +11 -1
- package/core/client/host-bridge/load-host-domain-class.ts +2 -1
- package/core/client/infra/http/SomaHttpService.ts +15 -4
- package/core/client/infra/i18n/pack-locales.ts +2 -2
- package/core/client/infra/notify/DefaultNotifyService.ts +2 -2
- package/core/client/mount/domain-rule.ts +7 -3
- package/core/client/mount/mount-page.ts +38 -5
- package/core/client/mount/types.ts +2 -0
- package/core/client/parser/confirm-spec.ts +100 -7
- package/core/client/parser/data-config-parser.ts +28 -211
- package/core/client/parser/pipeline-parser.ts +16 -60
- package/core/client/parser/style-config-parser.ts +101 -95
- package/core/client/parser/timer-parser.ts +21 -0
- package/core/client/parser/ui-config-parser.ts +64 -12
- package/core/client/registry/declaration-renderer.ts +1 -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/client/runtime/SomaRuntimeServices.ts +2 -1
- package/core/client/runtime/SomaSnapshotStore.ts +5 -0
- package/core/client/security/url-guard.ts +71 -11
- package/core/client/validation/async-check-registry.ts +2 -1
- package/core/client/validation/contract-validator.ts +2 -6
- package/core/client/validation/field-rules.ts +3 -13
- package/core/client/validation/object-rules.ts +2 -10
- package/core/index.ts +17 -39
- package/core/inspect/check-product.ts +5 -5
- package/core/inspect/runtime.ts +2 -1
- package/core/server/api/dispatch-service-api.ts +35 -36
- package/core/server/api/load-host-service.ts +8 -4
- package/core/server/api/paged-list.ts +259 -0
- package/core/server/compile-port.ts +1 -1
- package/core/server/host/app-config-composer.ts +2 -1
- package/core/server/host/empty-host-bootstrap.mjs +3 -0
- package/core/server/host/host-assembly-entry.ts +1 -0
- package/core/server/host/host-assembly.ts +50 -3
- package/core/server/host/host-caller.ts +2 -1
- package/core/server/host/host-dir.ts +9 -0
- package/core/server/host/host-response-headers.ts +2 -1
- package/core/server/host/invoke-host-request-hook.ts +28 -4
- package/core/server/host/published-page-assets.ts +2 -1
- package/core/server/host/resolve-host-request-hook.ts +25 -7
- package/core/server/host/server-page-assets.ts +4 -4
- 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/host/virtual-pages.ts +3 -2
- package/core/server/infra/cache/ServerFileCache.ts +83 -10
- package/core/server/node.ts +10 -0
- package/core/server/registry/api-registry-store.ts +3 -1
- package/core/server/registry/declaration-precompiler.ts +0 -2
- package/core/server/registry/page-registry-repository.ts +2 -1
- package/core/server/registry/page-registry-store.ts +2 -1
- package/core/server/registry/registry-error.ts +6 -1
- package/core/server/registry/registry-file-lock.ts +296 -23
- package/core/server/registry/request-body-limit.ts +3 -2
- package/core/server/registry/validation/declaration-safety-scan.ts +151 -27
- package/core/server/runtime-space/access-gate.ts +21 -7
- package/core/server/runtime-space/bindings.ts +3 -6
- package/core/server/runtime-space/dynamic-pages.ts +181 -49
- package/core/server/runtime-space/errors.ts +3 -0
- package/core/server/runtime-space/inject.ts +78 -16
- package/core/server/runtime-space/page-grants.ts +7 -1
- package/core/server/runtime-space/resolve.ts +66 -19
- package/core/server/runtime-space/store.ts +32 -3
- package/core/server/runtime-space/submit-steps.ts +2 -1
- package/core/server/runtime-space/types.ts +3 -1
- package/core/shared/component-tree-errors.ts +2 -1
- package/core/shared/contract-a11y.ts +1 -1
- package/core/shared/contract-sections.ts +2 -2
- package/core/shared/core-diagnostic-codes.ts +14 -0
- package/core/shared/data-declaration-checks.ts +29 -3
- package/core/shared/declaration-keys.ts +1 -1
- package/core/shared/engines/engine-error.ts +2 -1
- package/core/shared/generation-error.ts +2 -1
- package/core/shared/page-envelope.ts +1 -1
- package/core/shared/pure-binding.ts +88 -0
- package/core/shared/registry-generated/diagnostic-registry-index.ts +21 -19
- package/core/shared/registry-generated/diagnostic-registry.ts +170 -177
- package/core/shared/registry-generated/limits.ts +65 -13
- package/core/shared/registry-generated/std-grammar-completion.ts +0 -4
- package/core/shared/registry-generated/std-grammar-views.ts +40 -10
- package/core/shared/registry-generated/std-grammar.ts +43 -21
- package/core/shared/soma-error.ts +36 -0
- package/core/shared/types/compile-port.types.ts +1 -1
- package/core/shared/types/data-config.types.ts +20 -18
- package/core/shared/types/engine.types.ts +0 -3
- package/core/shared/types/event.types.ts +10 -11
- package/core/shared/types/generation-error.types.ts +5 -1
- package/core/shared/types/host-assembly.types.ts +7 -1
- package/core/shared/types/manifest.types.ts +0 -3
- package/core/shared/types/region-scope.types.ts +5 -1
- package/core/shared/types/scope-manifest.types.ts +0 -2
- package/core/shared/types/style-config.types.ts +21 -21
- package/core/shared/types/ui-config.types.ts +4 -5
- package/core/shared/types/watcher.types.ts +1 -1
- package/dist/browser/runtime-bundle.manifest.json +11 -13
- package/dist/browser/soma-runtime.js +2733 -2712
- package/dist/core/index.cjs +5665 -5534
- package/dist/host-native/aot-builder.cjs +330 -1
- package/dist/host-native/native-server.cjs +5434 -4726
- package/dist/lsp/component-tree.cjs +5868 -7040
- package/dist/types/build/compiler/full-manifest-builder.d.ts +0 -2
- package/dist/types/build/compiler/page-closure.d.ts +21 -0
- package/dist/types/build/compiler/page-declaration-compiler.d.ts +2 -4
- package/dist/types/build/compiler/soma-precompile.d.ts +1 -3
- package/dist/types/build/component-tree/artifact-codec.d.ts +0 -2
- package/dist/types/client/a11y/a11y-config.d.ts +2 -1
- package/dist/types/client/base/SomaHttpClient.d.ts +1 -1
- package/dist/types/client/base/SomaPageRootBase.d.ts +5 -0
- package/dist/types/client/base/defineSomaView.d.ts +46 -0
- package/dist/types/client/base/index.d.ts +2 -0
- package/dist/types/client/base/view-context.d.ts +136 -0
- package/dist/types/client/behavior/adapter-collection.d.ts +1 -1
- package/dist/types/client/compiler/manifest-compiler.d.ts +0 -3
- package/dist/types/client/component/component-definition.types.d.ts +2 -1
- package/dist/types/client/component/component-manager.d.ts +29 -0
- 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 +93 -31
- package/dist/types/client/data/format-config.d.ts +2 -1
- package/dist/types/client/engine/dom-renderer.d.ts +1 -2
- package/dist/types/client/engine/event-engine.d.ts +0 -7
- package/dist/types/client/engine/reactive-proxy.d.ts +11 -4
- package/dist/types/client/engine/runtime-builder.d.ts +0 -4
- package/dist/types/client/engine/soma-bootstrap.d.ts +44 -6
- package/dist/types/client/engine/style-binder.d.ts +8 -4
- package/dist/types/client/host-bridge/load-host-domain-class.d.ts +2 -1
- package/dist/types/client/mount/domain-rule.d.ts +2 -0
- package/dist/types/client/mount/mount-page.d.ts +2 -1
- package/dist/types/client/mount/types.d.ts +2 -0
- package/dist/types/client/parser/confirm-spec.d.ts +27 -3
- package/dist/types/client/parser/data-config-parser.d.ts +6 -5
- package/dist/types/client/parser/style-config-parser.d.ts +7 -3
- package/dist/types/client/parser/timer-parser.d.ts +5 -0
- package/dist/types/client/parser/ui-config-parser.d.ts +6 -2
- 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/client/runtime/SomaSnapshotStore.d.ts +2 -0
- package/dist/types/client/security/url-guard.d.ts +14 -0
- package/dist/types/client/validation/async-check-registry.d.ts +2 -1
- package/dist/types/client/validation/object-rules.d.ts +0 -5
- package/dist/types/index.d.ts +6 -11
- package/dist/types/inspect/runtime.d.ts +2 -1
- package/dist/types/server/api/dispatch-service-api.d.ts +5 -0
- package/dist/types/server/api/load-host-service.d.ts +1 -1
- package/dist/types/server/api/paged-list.d.ts +101 -0
- package/dist/types/server/compile-port.d.ts +1 -1
- package/dist/types/server/host/host-assembly-entry.d.ts +1 -1
- package/dist/types/server/host/host-assembly.d.ts +2 -0
- package/dist/types/server/host/host-dir.d.ts +2 -0
- package/dist/types/server/host/invoke-host-request-hook.d.ts +10 -3
- package/dist/types/server/host/published-page-assets.d.ts +2 -1
- package/dist/types/server/host/resolve-host-request-hook.d.ts +18 -5
- package/dist/types/server/host/server-page-assets.d.ts +2 -1
- 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/infra/cache/ServerFileCache.d.ts +8 -0
- package/dist/types/server/node.d.ts +1 -0
- package/dist/types/server/registry/declaration-precompiler.d.ts +0 -1
- package/dist/types/server/registry/registry-error.d.ts +5 -1
- package/dist/types/server/registry/registry-file-lock.d.ts +30 -0
- package/dist/types/server/registry/request-body-limit.d.ts +3 -2
- package/dist/types/server/registry/validation/declaration-safety-scan.d.ts +3 -0
- package/dist/types/server/runtime-space/access-gate.d.ts +7 -0
- package/dist/types/server/runtime-space/bindings.d.ts +3 -2
- package/dist/types/server/runtime-space/dynamic-pages.d.ts +6 -1
- package/dist/types/server/runtime-space/errors.d.ts +1 -1
- package/dist/types/server/runtime-space/resolve.d.ts +2 -0
- package/dist/types/server/runtime-space/store.d.ts +8 -1
- package/dist/types/server/runtime-space/submit-steps.d.ts +2 -1
- package/dist/types/server/runtime-space/types.d.ts +3 -1
- package/dist/types/shared/component-tree-errors.d.ts +2 -1
- package/dist/types/shared/core-diagnostic-codes.d.ts +1 -1
- package/dist/types/shared/declaration-keys.d.ts +1 -1
- package/dist/types/shared/engines/engine-error.d.ts +2 -1
- package/dist/types/shared/generation-error.d.ts +2 -1
- package/dist/types/shared/pure-binding.d.ts +48 -0
- package/dist/types/shared/registry-generated/diagnostic-registry.d.ts +149 -158
- package/dist/types/shared/registry-generated/limits.d.ts +54 -10
- package/dist/types/shared/registry-generated/std-grammar-completion.d.ts +0 -30
- package/dist/types/shared/registry-generated/std-grammar-views.d.ts +97 -23
- package/dist/types/shared/registry-generated/std-grammar.d.ts +110 -242
- package/dist/types/shared/soma-error.d.ts +15 -0
- package/dist/types/shared/types/data-config.types.d.ts +17 -17
- package/dist/types/shared/types/engine.types.d.ts +0 -3
- package/dist/types/shared/types/event.types.d.ts +9 -7
- package/dist/types/shared/types/generation-error.types.d.ts +1 -1
- package/dist/types/shared/types/host-assembly.types.d.ts +2 -0
- package/dist/types/shared/types/manifest.types.d.ts +0 -3
- package/dist/types/shared/types/region-scope.types.d.ts +4 -1
- package/dist/types/shared/types/scope-manifest.types.d.ts +0 -2
- package/dist/types/shared/types/style-config.types.d.ts +17 -19
- package/dist/types/shared/types/ui-config.types.d.ts +4 -5
- package/host-native/bin/host-native.cjs +22 -1
- package/host-native/client/browser-entry.ts +21 -172
- package/host-native/src/aot-builder.ts +75 -0
- package/host-native/src/host-prepare.ts +39 -5
- package/host-native/src/manifest-http.ts +2 -3
- package/host-native/src/native-server.ts +812 -174
- package/host-native/src/page-http.ts +3 -3
- package/host-native/src/public-packages.cjs +0 -1
- package/host-native/src/registry-handler.ts +12 -5
- package/host-native/src/static-file.ts +203 -53
- package/host-native/styles/globals.css +30 -28
- package/package.json +14 -2
- package/core/client/engine/step-runner.ts +0 -212
- package/core/client/engine/trigger-engine.ts +0 -55
- package/core/client/format/zoned.ts +0 -10
- package/core/client/parser/step-parser.ts +0 -359
- package/core/client/parser/trigger-parser.ts +0 -90
- package/core/client/parser/value-lang.ts +0 -340
- package/core/client/time/instant.ts +0 -2
- package/core/shared/calc/coerce.ts +0 -2
- package/core/shared/calc/errors.ts +0 -40
- package/core/shared/calc/evaluator.ts +0 -113
- package/core/shared/calc/index.ts +0 -11
- package/core/shared/calc/lexer.ts +0 -189
- package/core/shared/calc/parser.ts +0 -193
- package/core/shared/calc/typer.ts +0 -171
- package/core/shared/date-parts.ts +0 -2
- package/core/shared/show-when.ts +0 -77
- package/core/shared/types/step.types.ts +0 -91
- package/core/shared/types/trigger.types.ts +0 -14
- package/dist/types/client/engine/step-runner.d.ts +0 -42
- package/dist/types/client/engine/trigger-engine.d.ts +0 -16
- package/dist/types/client/format/zoned.d.ts +0 -1
- package/dist/types/client/parser/step-parser.d.ts +0 -23
- package/dist/types/client/parser/trigger-parser.d.ts +0 -13
- package/dist/types/client/parser/value-lang.d.ts +0 -63
- package/dist/types/client/time/instant.d.ts +0 -1
- package/dist/types/shared/calc/coerce.d.ts +0 -1
- package/dist/types/shared/calc/errors.d.ts +0 -14
- package/dist/types/shared/calc/evaluator.d.ts +0 -2
- package/dist/types/shared/calc/index.d.ts +0 -6
- package/dist/types/shared/calc/lexer.d.ts +0 -19
- package/dist/types/shared/calc/parser.d.ts +0 -43
- package/dist/types/shared/calc/typer.d.ts +0 -11
- package/dist/types/shared/date-parts.d.ts +0 -1
- package/dist/types/shared/show-when.d.ts +0 -21
- package/dist/types/shared/types/step.types.d.ts +0 -76
- package/dist/types/shared/types/trigger.types.d.ts +0 -12
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import { SomaError } from '../../shared/soma-error';
|
|
1
2
|
import type { SomaStyleViolationKind, StyleConfig } from '../../shared/types/style-config.types';
|
|
2
|
-
|
|
3
|
+
import { type SomaPureBindingCode } from '../../shared/pure-binding';
|
|
4
|
+
export declare class SomaStyleConfigError extends SomaError {
|
|
3
5
|
readonly path: string;
|
|
4
6
|
/** 违规类别;仅结构化校验失败时缺省(那类失败没有"类别"可言) */
|
|
5
7
|
readonly kind?: SomaStyleViolationKind;
|
|
6
|
-
|
|
8
|
+
/** 纯绑定违规码(样式比较形);其余解析错误无码 */
|
|
9
|
+
readonly code?: SomaPureBindingCode;
|
|
10
|
+
constructor(message: string, path?: string, kind?: SomaStyleViolationKind, code?: SomaPureBindingCode);
|
|
7
11
|
}
|
|
8
12
|
/**
|
|
9
13
|
* 将 YAML 解析后的原始对象转换为类型安全的 StyleConfig
|
|
@@ -11,7 +15,7 @@ export declare class SomaStyleConfigError extends Error {
|
|
|
11
15
|
* 校验规则:
|
|
12
16
|
* - host 必须是非空字符串
|
|
13
17
|
* - base 的值必须是纯 CSS 类名字符串;core 不解析也不编译具体类名
|
|
14
|
-
* - states
|
|
18
|
+
* - states / transitions.active_state 是纯绑定:`bind` 纯路径 + `tiers` 档位闭集(成员的值就是档位名),不再有 condition / value 比较
|
|
15
19
|
* - transitions 的 trigger 必须是有效枚举值
|
|
16
20
|
* - base 命中布局类模式即失败;states / transitions 放行显隐对(F-06)
|
|
17
21
|
* - themes 段已退役(主题是编译期事,T19):写了内容就明确拒收,不静默丢弃(空表等于没写)
|
|
@@ -4,3 +4,8 @@ export declare class SomaTimerParseError extends Error {
|
|
|
4
4
|
}
|
|
5
5
|
export declare function parseTimers(raw: unknown): ParsedTimer[];
|
|
6
6
|
export declare function compileTimer(timer: ParsedTimer): import('../../shared/types/timer.types').SomaCompiledTimer;
|
|
7
|
+
/** 从 event 配置根对象分离 timers 与事件声明(`triggers` 已删除:它不再是保留键,写了按事件声明形态报错) */
|
|
8
|
+
export declare function splitEventConfigRaw(raw: unknown): {
|
|
9
|
+
eventsRaw: Record<string, unknown>;
|
|
10
|
+
timers: ParsedTimer[];
|
|
11
|
+
};
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
import { SomaError } from '../../shared/soma-error';
|
|
1
2
|
import type { UiConfig, SomaPageFragments } from '../../shared/types/ui-config.types';
|
|
2
3
|
import type { SomaScopeDecl } from '../../shared/types/region-scope.types';
|
|
4
|
+
import { type SomaPureBindingCode } from '../../shared/pure-binding';
|
|
3
5
|
/**
|
|
4
6
|
* UI 配置解析错误
|
|
5
7
|
* 携带错误路径信息以便定位问题
|
|
6
8
|
*/
|
|
7
|
-
export declare class SomaUiConfigError extends
|
|
9
|
+
export declare class SomaUiConfigError extends SomaError {
|
|
8
10
|
readonly path: string;
|
|
9
|
-
|
|
11
|
+
/** 纯绑定违规码(取反 / role_by 非纯路径);其余解析错误无码 */
|
|
12
|
+
readonly code?: SomaPureBindingCode;
|
|
13
|
+
constructor(message: string, path?: string, code?: SomaPureBindingCode);
|
|
10
14
|
}
|
|
11
15
|
export interface SomaUiConfigParseOptions {
|
|
12
16
|
/** Raw collectionSlot is trusted package source only; runtimes consume plan references. */
|
|
@@ -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)。
|
|
@@ -6,6 +6,8 @@ export declare class SomaSnapshotStore {
|
|
|
6
6
|
capture(root: object, options?: {
|
|
7
7
|
exclude?: string[];
|
|
8
8
|
}): number;
|
|
9
|
+
/** 释放一条快照(不存在则什么也不做):热替换等内部流程用完自己 capture 的快照即释放,不占环形容量 */
|
|
10
|
+
release(id: number): void;
|
|
9
11
|
restore(id: number, root: Record<string, any>): void;
|
|
10
12
|
private cloneState;
|
|
11
13
|
private cloneValue;
|
|
@@ -1,5 +1,19 @@
|
|
|
1
|
+
/** 会被浏览器当作 URL 加载/跳转的属性 */
|
|
2
|
+
export declare const URL_BEARING_ATTR_NAMES: readonly ["href", "src", "srcset", "action", "formaction", "poster", "data", "xlink:href", "ping", "background"];
|
|
3
|
+
export declare const URL_BEARING_ATTRS: ReadonlySet<string>;
|
|
4
|
+
/** 危险伪协议:命中即阻断 */
|
|
5
|
+
export declare const BLOCKED_SCHEMES: readonly ["javascript:", "vbscript:", "data:", "file:", "blob:"];
|
|
1
6
|
/** 拦截后写入的安全占位值 */
|
|
2
7
|
export declare const BLOCKED_URL_PLACEHOLDER = "about:blank";
|
|
8
|
+
/**
|
|
9
|
+
* 解码基础 HTML 实体(命名实体 : / &tab; / &newline;、十进制 &#...; 与十六进制 &#x...;)
|
|
10
|
+
* 用于防范利用 HTML 实体编码混淆伪协议前缀绕过安全检查。
|
|
11
|
+
*/
|
|
12
|
+
export declare function decodeHtmlEntities(str: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* 归一化 URL 文本:先解码 HTML 实体,再去除所有空白与控制字符,再小写。
|
|
15
|
+
*/
|
|
16
|
+
export declare function normalizeUrlValue(value: string): string;
|
|
3
17
|
/** URL 的协议名(小写、不含冒号);相对地址或无协议返回 null。判定核:hasBlockedScheme 与 resolveSafeUrl 共用 */
|
|
4
18
|
export declare function urlSchemeOf(value: string): string | null;
|
|
5
19
|
/** 事件处理器属性(onclick/onerror/…):DSL 永不允许通过绑定写入 */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SomaError } from '../../shared/soma-error';
|
|
1
2
|
import type { SomaAsyncFieldChecker } from './async-rules';
|
|
2
3
|
/** 登记表:`{ 检查器名: 检查器 }` */
|
|
3
4
|
export type SomaAsyncCheckTable = Readonly<Record<string, SomaAsyncFieldChecker>>;
|
|
@@ -11,7 +12,7 @@ export interface SomaValidationService {
|
|
|
11
12
|
asyncChecks(): SomaAsyncCheckTable;
|
|
12
13
|
}
|
|
13
14
|
export type SomaAsyncCheckErrorCode = 'CORE-ASYNC-CHECK-TABLE' | 'CORE-ASYNC-CHECK-UNREGISTERED';
|
|
14
|
-
export declare class SomaAsyncCheckError extends
|
|
15
|
+
export declare class SomaAsyncCheckError extends SomaError {
|
|
15
16
|
readonly code: SomaAsyncCheckErrorCode;
|
|
16
17
|
readonly names: readonly string[];
|
|
17
18
|
constructor(code: SomaAsyncCheckErrorCode, message: string, names?: readonly string[]);
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import type { SomaDataFieldConfig, SomaDataWriteConfig, SomaValidateTrigger } from '../../shared/types/data-config.types';
|
|
2
|
-
import type { SomaNamedPredicates } from '../../shared/predicates';
|
|
3
2
|
import { type RuleFailure } from './field-rules';
|
|
4
3
|
/** 写通道声明的校验时机里有没有这一个:没声明 `validate_on` 恒为真(时机由调用方决定,存量口径) */
|
|
5
4
|
export declare function shouldValidateOn(write: Pick<SomaDataWriteConfig, 'validate_on'> | undefined, trigger: SomaValidateTrigger): boolean;
|
|
6
5
|
export interface ObjectRecordCheckOptions {
|
|
7
6
|
/** 只校验这些字段(缺省 = 字典里全部字段) */
|
|
8
7
|
readonly keys?: readonly string[];
|
|
9
|
-
/** 对象的具名谓词表(条件规则的 `{ ref }`) */
|
|
10
|
-
readonly named?: SomaNamedPredicates;
|
|
11
|
-
/** 条件规则的求值记录(缺省 = `record` 本身);数据端口传「读态 ∪ 表单值」 */
|
|
12
|
-
readonly context?: Readonly<Record<string, unknown>>;
|
|
13
8
|
/** 方言接入的领域值协议检查(日期粒度、时间型值形状等):非空值逐字段调用,返回失败或 null;缺省不检查 */
|
|
14
9
|
readonly protocolCheck?: (field: SomaDataFieldConfig, value: unknown) => RuleFailure | null;
|
|
15
10
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export type { SomaDataHttpLike, SomaDataResolverOptions, SomaDataResolveResult,
|
|
|
15
15
|
export { attachDataSubscriptions, parseInvalidation } from './client/data/data-subscriptions';
|
|
16
16
|
export { attachDataPolling, pollStillRunning } from './client/data/data-polling';
|
|
17
17
|
export type { SomaDataSubscriptionHandle, SomaDataSubscriptionOptions } from './client/data/data-subscriptions';
|
|
18
|
-
export { parseDataConfig, parseDataYaml, parseDataRef,
|
|
18
|
+
export { parseDataConfig, parseDataYaml, parseDataRef, SomaDataConfigError, SOMA_DATA_OBJECT_KEYS, SOMA_DATA_FIELD_KEYS, SOMA_DATA_RULE_KEYS, } from './client/parser/data-config-parser';
|
|
19
19
|
export { isOnStepGrid, stepCountOf, stepOriginOf } from './shared/rule-step';
|
|
20
20
|
export { SOMA_NAV_BACK_KEYS, isExcludedEntry, isInternalPath, matchPathPattern, navBackDiagnostics, navExcludeProblem, navPreviousCountProblem, pathOfUrl, pickBackIndex, } from './shared/nav-back';
|
|
21
21
|
export type { SomaNavBackDecl, SomaNavBackOptions, SomaNavBackResult, SomaNavHistoryEntry, SomaNavHistoryPort, } from './shared/types/nav-context.types';
|
|
@@ -27,13 +27,8 @@ export { SOMA_DATA_FIELD_TYPES, SOMA_DATA_FIELD_TYPE_ALIASES, } from './shared/t
|
|
|
27
27
|
export { SOMA_FIELD_PREDICATE_OPS, evaluatePredicate, validatePredicate, validateNamedPredicates, collectPredicateFields, SOMA_RELATIVE_WINDOW_UNITS, inspectRelativeWindowValue, } from './shared/predicates';
|
|
28
28
|
export type { SomaRelativeWindowUnit } from './shared/predicates';
|
|
29
29
|
export type { SomaFieldPredicateOp, SomaFieldCondition, SomaFieldPredicateRef, SomaFieldPredicateAllOf, SomaFieldPredicateAnyOf, SomaFieldPredicateNoneOf, SomaFieldPredicate, SomaNamedPredicates, SomaPredicateValidateOptions, } from './shared/predicates';
|
|
30
|
-
export { parseSteps } from './client/parser/step-parser';
|
|
31
|
-
export type { StepParseInput, StepParseDeps } from './client/parser/step-parser';
|
|
32
|
-
export { runSteps } from './client/engine/step-runner';
|
|
33
30
|
export { parsePageState, parseStateValue, encodePageState, decodePageState, } from './client/parser/page-state-parser';
|
|
34
31
|
export type { SomaPageState, SomaPageStateConfig, } from './shared/types/page-state.types';
|
|
35
|
-
export type { StepRunContext, StepRunResult } from './client/engine/step-runner';
|
|
36
|
-
export type { SomaStep, SomaDoStep, SomaSwitchStep, SomaParallelStep, SomaForEachStep, SomaStepOnError, SomaStepSlot, SomaCompiledStep, SomaStepGraph, } from './shared/types/step.types';
|
|
37
32
|
export { createObserverPool, scheduleFlush, } from './client/scheduling/index';
|
|
38
33
|
export type { SomaObserverPool, SomaObserverSize, SomaObserverSizeCallback, SomaFlushTask, } from './client/scheduling/index';
|
|
39
34
|
export type { SomaComponentDefinition, SomaComponentControllerContext, SomaComponentControllerFactory, } from './client/component/component-definition.types';
|
|
@@ -90,13 +85,13 @@ export type { IRealtimeTransport, RealtimeMessageHandler } from './client/infra/
|
|
|
90
85
|
export type { IRealtimeService, RealtimeSubscribeOptions } from './client/infra/realtime/IRealtimeService';
|
|
91
86
|
export { SseRealtimeTransport } from './client/infra/realtime/SseRealtimeTransport';
|
|
92
87
|
export { WebSocketRealtimeTransport } from './client/infra/realtime/WebSocketRealtimeTransport';
|
|
93
|
-
export type { NotifyEntry, NotifyRenderer, RegionFallbackRenderer, SomaRenderPorts } from './client/render-ports';
|
|
88
|
+
export type { HideTransition, NotifyEntry, NotifyRenderer, RegionFallbackRenderer, SomaRenderPorts } from './client/render-ports';
|
|
94
89
|
export type { SomaEngineAdapters, SomaEngineId } from './client/engines/engine-adapters';
|
|
95
90
|
export type { INotifyService, NotifyOptions, NotifyLevel, NotifyCarrier, NotifyAction } from './client/infra/notify/INotifyService';
|
|
96
91
|
export { DefaultNotifyService, createNotifyService } from './client/infra/notify/DefaultNotifyService';
|
|
97
|
-
export type { SomaConfirmSpec, SomaConfirmLevel } from './shared/types/event.types';
|
|
98
|
-
export { checkConfirmSpec, parseConfirmSegment, confirmSatisfied, confirmKeyAccepts } from './client/parser/confirm-spec';
|
|
99
|
-
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';
|
|
100
95
|
export { SomaRealtimeService } from './client/infra/realtime/SomaRealtimeService';
|
|
101
96
|
export { SomaMiddlewareChain } from './client/middleware/SomaMiddlewareChain';
|
|
102
97
|
export { createPermissionMiddleware } from './client/middleware/createPermissionMiddleware';
|
|
@@ -110,9 +105,9 @@ export { createSomaDomainLoaderKey, findSomaDomainLoader, loadSomaDomainModuleFr
|
|
|
110
105
|
export { createGeneratedPagePreview, createSomaPageLifecycle, renderPublishedPage, SomaPageLifecycle, type GeneratedPageDeclarations, type GeneratedPagePreviewOptions, type PrecompiledDeclarationAssets, type PreviewHandle, type PreviewObservabilityOptions, type MountedPageInfo, type PublishedPageHandle, type PublishedPageRecord, type RegisterDeclarationOptions, type RenderPublishedPageOptions, type SomaPageLifecycleOptions, PUBLISHED_PAGE_SLUG_PATTERN, RESERVED_PUBLISHED_PAGE_SLUGS, isPublishedPageSlug, normalizePublishedPageSlug, publishedPagePath, publishedPageSlugFromPath, } from './client/registry/index';
|
|
111
106
|
export { composeComponentPacks, ComponentPackError, PACK_NAME_PATTERN, type ComposedComponentPacks, type ComposePacksOptions, type SomaComponentPack, type SomaComponentPackStyles, type PackOverrideEvent, } from './client/component/component-pack';
|
|
112
107
|
export { registerComponentPackLocales, validatePackLocales, type SomaComponentPackLocales, type PackLocalesIssue, } from './client/infra/i18n/pack-locales';
|
|
113
|
-
export { parseValueSegment, evaluateValueNode, isArithSegment, isPlainPath, describeNode, SomaValueLangError, type ValueNode, type PipedValue, type ValuePosition, type HasVarFn, type EvalOptions, } from './client/parser/value-lang';
|
|
114
108
|
export type { CompiledFlatPage, FlatPageInput, SomaFlatDoc } from './build/compiler/flat-page';
|
|
115
109
|
export { SomaDeclarationError } from './shared/declaration-errors';
|
|
110
|
+
export { SomaError, isSomaError, somaErrorCodeOf } from './shared/soma-error';
|
|
116
111
|
export type { HtmlAnchorIndex, HtmlAnchorInfo } from './build/compiler/html-index';
|
|
117
112
|
export { SOMA_ANCHOR_DUPLICATE_CODE, anchorDuplicateMessage, declaredFragmentRegions, type SomaDeclaredFragmentRegion, } from './shared/anchor-space';
|
|
118
113
|
export { attachPackStyles, ensurePackBaseStyles, resetPackStyleInjection, type PackStyleOptions, } from './client/styles/pack-styles';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SomaError } from '../shared/soma-error';
|
|
1
2
|
import { SomaBootstrap } from '../client/engine/soma-bootstrap';
|
|
2
3
|
import type { RuntimeObservation } from '../shared/types/observation.types';
|
|
3
4
|
import type { SomaLocaleDictionary } from '../shared/types/locale.types';
|
|
@@ -7,7 +8,7 @@ export type { RuntimeObservation, SomaObservedActivation, SomaObservedAdaptive,
|
|
|
7
8
|
export { evaluatePredicate } from '../shared/predicates';
|
|
8
9
|
export type { SomaDataPort } from '../shared/types/data-config.types';
|
|
9
10
|
/** 运行出口的可辨认错误(testkit 据 code 报 ERR-VERIFY-EXIT-MODE) */
|
|
10
|
-
export declare class SomaRuntimeExitError extends
|
|
11
|
+
export declare class SomaRuntimeExitError extends SomaError {
|
|
11
12
|
readonly code: 'CORE-OBSERVE-OFF';
|
|
12
13
|
constructor(code: 'CORE-OBSERVE-OFF', message: string);
|
|
13
14
|
}
|
|
@@ -10,6 +10,11 @@ export interface RequestCookiesAdapter {
|
|
|
10
10
|
export interface DispatchHostServiceApiOptions {
|
|
11
11
|
readonly segments?: readonly string[];
|
|
12
12
|
readonly hostDir?: string;
|
|
13
|
+
/**
|
|
14
|
+
* 内部选项:标记宿主壳是否已经执行过请求钩子。
|
|
15
|
+
* 仅供原生宿主壳(如 native-server)在读请求体前已执行过鉴权钩子时使用,为 true 时避免重复执行钩子。
|
|
16
|
+
*/
|
|
17
|
+
readonly requestHookHandled?: boolean;
|
|
13
18
|
}
|
|
14
19
|
export declare function polyfillServiceRequest<T extends Request>(request: T): T & {
|
|
15
20
|
nextUrl: URL;
|
|
@@ -7,4 +7,4 @@ export declare function clearHostServiceCache(hostDir?: string): void;
|
|
|
7
7
|
/**
|
|
8
8
|
* 按约定从宿主 apiRoot 加载 IService 实例(运行时按需加载,零手动 registry)。
|
|
9
9
|
*/
|
|
10
|
-
export declare function loadHostService(segments: string[]): IService | null;
|
|
10
|
+
export declare function loadHostService(segments: string[], hostDir?: string): IService | null;
|
|
@@ -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 {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Server-side compile-port entry (subpath `soma-core/server/compile-port`, 06e §2.10).
|
|
3
3
|
*
|
|
4
|
-
* core 不持有编译器,也不回调方言编译器:方言(soma-ui / soma-
|
|
4
|
+
* core 不持有编译器,也不回调方言编译器:方言(soma-ui / soma-kit)在运行期把自己的页面编译成标准格式后按 URL 注入 core。
|
|
5
5
|
* 这里只剩编译用途闭集与页面生成资产来源的类型。
|
|
6
6
|
*
|
|
7
7
|
* 刻意不 `import 'server-only'`(与 `server/page-declaration.ts` 同一理由):宿主的 `soma.app.ts`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { loadHostAssembly, runHostStartup, isHostAssemblyReady, assertReservedRoutesShape, registerShellRoutes, registeredShellRoutes, resetShellRoutes, resolveHostLoginPath, isSafeLoginPath, SOMA_DEFAULT_LOGIN_PATH, SOMA_HOST_ASSEMBLY_FILE, } from './host-assembly';
|
|
1
|
+
export { loadHostAssembly, invalidateHostAssembly, runHostStartup, isHostAssemblyReady, assertReservedRoutesShape, registerShellRoutes, registeredShellRoutes, resetShellRoutes, resolveHostLoginPath, isSafeLoginPath, SOMA_DEFAULT_LOGIN_PATH, SOMA_HOST_ASSEMBLY_FILE, } from './host-assembly';
|
|
2
2
|
export { resolveHostCaller, readHostCaller } from './host-caller';
|
|
3
3
|
export type { SomaHostCaller } from './host-caller';
|
|
4
4
|
export { withHostResponseHeaders, resolveHostResponseHeaders, classifyHostResponseKind, } from './host-response-headers';
|
|
@@ -60,3 +60,5 @@ export declare function runHostStartup(appRoot: string): Promise<void>;
|
|
|
60
60
|
export declare function isHostAssemblyReady(appRoot: string): boolean;
|
|
61
61
|
/** 只给测试用:清空装配缓存 */
|
|
62
62
|
export declare function resetHostAssemblyCache(): void;
|
|
63
|
+
/** 清除单个应用的装配缓存(热更新重装配用);启动钩子记忆仍按进程保留一次 */
|
|
64
|
+
export declare function invalidateHostAssembly(appRoot: string): void;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import { type SomaHostRequestContext, type SomaRequestHook } from './resolve-host-request-hook';
|
|
2
|
-
export type SomaRequestHookResolver = () => Promise<SomaRequestHook | null>;
|
|
1
|
+
import { type ResolveHostRequestHookOptions, type SomaHostRequestContext, type SomaRequestHook } from './resolve-host-request-hook';
|
|
2
|
+
export type SomaRequestHookResolver = (options?: ResolveHostRequestHookOptions) => Promise<SomaRequestHook | null>;
|
|
3
|
+
export interface InvokeHostRequestHookOptions {
|
|
4
|
+
/**
|
|
5
|
+
* 显式传入的主机根目录。
|
|
6
|
+
* 仅当调用方未传时才回退环境变量 process.env.SOMA_HOST_DIR(兼容旧对外导出调用方)。
|
|
7
|
+
*/
|
|
8
|
+
readonly hostDir?: string;
|
|
9
|
+
}
|
|
3
10
|
export declare function isSomaInternalRequestPath(path: string): boolean;
|
|
4
11
|
/**
|
|
5
12
|
* Calls the Host extension exactly once for Host-owned page/API requests.
|
|
6
13
|
* SOMA's reserved /soma namespace never reaches the Host extension.
|
|
7
14
|
*/
|
|
8
|
-
export declare function invokeHostRequestHook(request: Request, context: SomaHostRequestContext,
|
|
15
|
+
export declare function invokeHostRequestHook(request: Request, context: SomaHostRequestContext, resolveHookOrOptions?: SomaRequestHookResolver | InvokeHostRequestHookOptions, maybeOptions?: InvokeHostRequestHookOptions): Promise<Response | undefined>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SomaError } from '../../shared/soma-error';
|
|
1
2
|
import { publishedPageSlugFromPath } from '../../shared/published-page-route';
|
|
2
3
|
import { type PublishedPageArtifactResult } from './published-page-artifact-cache';
|
|
3
4
|
import type { SomaCoreDiagnostic } from '../../shared/core-diagnostic-codes';
|
|
@@ -8,7 +9,7 @@ export declare const registryPageNameFromPath: typeof publishedPageSlugFromPath;
|
|
|
8
9
|
* 整页错误(页面主题整体解析失败等,端口给的整页失败):不存档、不缓存,Host 路由据此回受控文案 + 诊断码,
|
|
9
10
|
* 而不是静默替换成平台默认主题或把整页混成 404。`message` 是对访客的受控文案(不含内部细节),细节在 `diagnostics`。
|
|
10
11
|
*/
|
|
11
|
-
export declare class SomaPublishedPageError extends
|
|
12
|
+
export declare class SomaPublishedPageError extends SomaError {
|
|
12
13
|
readonly code: string;
|
|
13
14
|
readonly diagnostics: readonly SomaGenerationErrorShape[];
|
|
14
15
|
constructor(diagnostics: readonly SomaGenerationErrorShape[]);
|
|
@@ -3,15 +3,28 @@ export interface SomaHostRequestContext {
|
|
|
3
3
|
kind: SomaHostRequestKind;
|
|
4
4
|
path: string;
|
|
5
5
|
pageHref?: string;
|
|
6
|
+
/** 原生宿主可选的惰性 body 入口;一次读取、限流、断连取消,返回独立字节副本。 */
|
|
7
|
+
readBody?: () => Promise<Uint8Array>;
|
|
6
8
|
}
|
|
7
9
|
/**
|
|
8
10
|
* Generic server ingress extension. soma-core does not know authentication,
|
|
9
11
|
* authorization, Admin, or any business application.
|
|
10
12
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* A Host may normalize or add server-only request headers before returning
|
|
14
|
+
* undefined. The native adapter constructs a separate service Request with the
|
|
15
|
+
* same post-hook headers and the same original body bytes; Fetch bodies are
|
|
16
|
+
* one-shot, so the hook Request object itself is not reused for dispatch. On
|
|
17
|
+
* native API requests, use optional context.readBody() to lazily read a copied
|
|
18
|
+
* byte array without changing request.body; other adapters may omit it.
|
|
19
|
+
* Returning a Response still short-circuits the request. Client cancellation
|
|
20
|
+
* stops transport work only; it does not roll back server-side writes.
|
|
15
21
|
*/
|
|
16
22
|
export type SomaRequestHook = (request: Request, context: SomaHostRequestContext) => Response | undefined | Promise<Response | undefined>;
|
|
17
|
-
export
|
|
23
|
+
export interface ResolveHostRequestHookOptions {
|
|
24
|
+
/**
|
|
25
|
+
* 显式传入的主机根目录。
|
|
26
|
+
* 仅当调用方未传时才回退环境变量 process.env.SOMA_HOST_DIR(兼容旧对外导出调用方)。
|
|
27
|
+
*/
|
|
28
|
+
readonly hostDir?: string;
|
|
29
|
+
}
|
|
30
|
+
export declare function resolveHostRequestHook(options?: ResolveHostRequestHookOptions | string): Promise<SomaRequestHook | null>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SomaError } from '../../shared/soma-error';
|
|
1
2
|
import { type SomaAssetSource } from './source-packages';
|
|
2
3
|
import type { SomaPageMarkup, TreeCompileContext } from '../../shared/types/component-tree.types';
|
|
3
4
|
import type { TreeArtifact } from '../../shared/types/component-tree-artifact.types';
|
|
@@ -24,7 +25,7 @@ export interface SomaServerPageAssets {
|
|
|
24
25
|
colorScheme?: 'light dark' | 'light' | 'dark';
|
|
25
26
|
titleKey?: string;
|
|
26
27
|
}
|
|
27
|
-
export declare class SomaPageAssetError extends
|
|
28
|
+
export declare class SomaPageAssetError extends SomaError {
|
|
28
29
|
readonly code: string;
|
|
29
30
|
readonly status: number;
|
|
30
31
|
constructor(code: string, status: number, message: string);
|
|
@@ -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] */
|
|
@@ -18,6 +18,10 @@ export declare class ServerFileCache {
|
|
|
18
18
|
private dirCache;
|
|
19
19
|
private watchers;
|
|
20
20
|
private watchedRoots;
|
|
21
|
+
/** 各根连续的监听失败次数(建立失败或运行中 error);建立成功不清零(递归监听的错误是建立之后才异步到达的),只有该根的监听真正投递过一次变更回调才清零;达到 `WATCH_FAIL_LIMIT` 即放弃该根 */
|
|
22
|
+
private watchFailures;
|
|
23
|
+
/** 放弃监听的根:其下的读取绕过缓存直读磁盘(无人失效时,正确性优先于命中率) */
|
|
24
|
+
private unwatchableRoots;
|
|
21
25
|
private currentFileBytes;
|
|
22
26
|
constructor(options?: ServerFileCacheOptions);
|
|
23
27
|
static getInstance(options?: ServerFileCacheOptions): ServerFileCache;
|
|
@@ -40,6 +44,10 @@ export declare class ServerFileCache {
|
|
|
40
44
|
readDirFiles(dirPath: string, ext: string): string[];
|
|
41
45
|
readDirNames(dirPath: string, ext: string): string[];
|
|
42
46
|
private setDirCache;
|
|
47
|
+
private isUnwatchable;
|
|
48
|
+
private recordWatchFailure;
|
|
49
|
+
/** 该根(或其祖先)当前是否有存活的监听;监听出错被移除后为 false,调用方据此重试 `watchAndInvalidate` */
|
|
50
|
+
isWatching(rootDir: string): boolean;
|
|
43
51
|
/**
|
|
44
52
|
* 监听目录变化,自动失效缓存。
|
|
45
53
|
* 使用 fs.watch 递归监听;已监听同一目录或其祖先目录时自动去重。
|
|
@@ -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";
|