@finesoft/front 0.2.0 → 0.4.0

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.
@@ -1,1573 +0,0 @@
1
- //#region ../core/src/actions/types.d.ts
2
- /**
3
- * Action 类型定义
4
- *
5
- * FlowAction — SPA 内部导航
6
- * ExternalUrlAction — 打开外部链接
7
- * CompoundAction — 组合多个 Action
8
- */
9
- /** Action Kind 常量 */
10
- declare const ACTION_KINDS: {
11
- FLOW: "flow";
12
- EXTERNAL_URL: "externalUrl";
13
- COMPOUND: "compound";
14
- };
15
- /** FlowAction — SPA 导航 */
16
- interface FlowAction {
17
- kind: typeof ACTION_KINDS.FLOW;
18
- url: string;
19
- /** 展示方式: 默认 push,modal 弹窗 */
20
- presentationContext?: "default" | "modal";
21
- }
22
- /** ExternalUrlAction — 外部链接 */
23
- interface ExternalUrlAction {
24
- kind: typeof ACTION_KINDS.EXTERNAL_URL;
25
- url: string;
26
- }
27
- /** CompoundAction — 组合 Action */
28
- interface CompoundAction {
29
- kind: typeof ACTION_KINDS.COMPOUND;
30
- actions: Action[];
31
- }
32
- /** 所有 Action 的联合类型 */
33
- type Action = FlowAction | ExternalUrlAction | CompoundAction;
34
- declare function isFlowAction(action: Action): action is FlowAction;
35
- declare function isExternalUrlAction(action: Action): action is ExternalUrlAction;
36
- declare function isCompoundAction(action: Action): action is CompoundAction;
37
- declare function makeFlowAction(url: string, presentationContext?: FlowAction["presentationContext"]): FlowAction;
38
- declare function makeExternalUrlAction(url: string): ExternalUrlAction;
39
- //#endregion
40
- //#region ../core/src/actions/dispatcher.d.ts
41
- /** Action 处理器函数类型 */
42
- type ActionHandler<A extends Action = Action> = (action: A) => Promise<void> | void;
43
- declare class ActionDispatcher {
44
- private handlers;
45
- /**
46
- * 注册指定 kind 的 handler。
47
- *
48
- * 重复 kind 时保留第一个注册者并发出警告——这是有意设计:
49
- * framework 内部 handler 先注册,应用层意外覆盖会被记录而非静默生效。
50
- * 如需显式替换,先调用 removeAction(kind)。
51
- */
52
- onAction<A extends Action>(kind: string, handler: ActionHandler<A>): void;
53
- /** 移除指定 kind 的 handler(用于显式覆盖场景) */
54
- removeAction(kind: string): boolean;
55
- /** 执行一个 Action(CompoundAction 递归展开,有深度限制) */
56
- perform(action: Action, _depth?: number): Promise<void>;
57
- }
58
- //#endregion
59
- //#region ../core/src/dependencies/container.d.ts
60
- /**
61
- * Container — 通用的依赖注入容器
62
- */
63
- type Factory<T> = () => T;
64
- declare class Container {
65
- private registrations;
66
- private resolutionStack;
67
- private parent?;
68
- private children;
69
- /** 注册依赖(默认单例) */
70
- register<T>(key: string, factory: Factory<T>, singleton?: boolean): this;
71
- /** 解析依赖 — 当前容器未注册时回退到 parent */
72
- resolve<T>(key: string): T;
73
- /** 检查是否已注册(含 parent) */
74
- has(key: string): boolean;
75
- /**
76
- * 移除当前容器的注册(不影响 parent)。
77
- *
78
- * 用途:在 scope 内显式撤销之前覆写的依赖,避免用 `register(() => null)` 这种
79
- * 反语义的写法。被移除的 key 之后再 resolve 会回退到 parent 容器。
80
- *
81
- * 返回 true 表示当前层确实存在过这个注册并被移除,false 表示未注册(含「只在
82
- * parent 注册」的情况,本方法不向上递归删除 —— scope 不应能影响 parent 状态)。
83
- */
84
- unregister(key: string): boolean;
85
- /**
86
- * 创建子容器(请求级 scope)
87
- *
88
- * 子容器可覆写父容器的依赖(如每请求的 locale、user),
89
- * 未覆写的 key 自动回退到父容器解析。子容器会被父容器跟踪,
90
- * 父容器 dispose 时一并销毁所有未独立 dispose 的子容器。
91
- */
92
- createScope(): Container;
93
- /**
94
- * 销毁容器,清除所有缓存。
95
- *
96
- * - 递归 dispose 所有 createScope() 创建的未 dispose 子容器
97
- * - 自身被 dispose 后从父容器移除引用,允许 GC
98
- * - 重复 dispose 安全(幂等)
99
- */
100
- dispose(): void;
101
- }
102
- //#endregion
103
- //#region ../core/src/intents/types.d.ts
104
- /** Intent — 描述一个用户意图 */
105
- interface Intent<T = unknown> {
106
- /** Intent 标识符(用于匹配 Controller) */
107
- id: string;
108
- /** 意图参数(path/query 经 codec 转换后可能是 number/boolean 等) */
109
- params?: Record<string, unknown>;
110
- /** 预期返回的数据(仅用于类型推断) */
111
- _returnType?: T;
112
- }
113
- /** Intent Controller — 处理特定 intentId 的业务逻辑 */
114
- interface IntentController<T = unknown> {
115
- /** Controller 对应的 Intent ID */
116
- intentId: string;
117
- /** 执行意图,返回页面数据 */
118
- perform(intent: Intent<T>, container: Container): Promise<T> | T;
119
- }
120
- //#endregion
121
- //#region ../core/src/intents/dispatcher.d.ts
122
- declare class IntentDispatcher {
123
- private controllers;
124
- /** 注册一个 IntentController */
125
- register(controller: IntentController): void;
126
- /** 分发 Intent 到对应 Controller */
127
- dispatch<T>(intent: Intent<T>, container: Container): Promise<T>;
128
- /** 检查是否已注册某个 Intent */
129
- has(intentId: string): boolean;
130
- }
131
- //#endregion
132
- //#region ../core/src/http/secure-fetch.d.ts
133
- /**
134
- * secureFetch — `fetch` with SSRF defense baked in.
135
- *
136
- * Wraps an existing fetch implementation and refuses targets that resolve to
137
- * private / loopback / reserved ranges. Use when your controller fetches a
138
- * URL that the user can influence (image proxies, link previews, callbacks).
139
- *
140
- * Defaults to checking IP literals (sync) AND resolving hostnames via DNS
141
- * (Node only; silently skipped in browsers). Pass `allowInternalHosts: true`
142
- * to opt out — for example, when you have a legitimate server-to-server call
143
- * to 10.x or 127.0.0.1 and you trust the URL source.
144
- *
145
- * @example
146
- * ```ts
147
- * import { secureFetch, DEP_KEYS } from "@finesoft/front";
148
- *
149
- * class ShareController extends BaseController<{ next?: string }, Page> {
150
- * async execute(params, container) {
151
- * const baseFetch = container.resolve<typeof globalThis.fetch>(DEP_KEYS.FETCH);
152
- * const fetch = secureFetch(baseFetch);
153
- * const response = await fetch(params.next ?? "https://example.com");
154
- * ...
155
- * }
156
- * }
157
- * ```
158
- */
159
- interface SecureFetchOptions {
160
- /** Opt out of SSRF defense entirely (default false). */
161
- allowInternalHosts?: boolean;
162
- /** DNS-resolve hostnames and check each resolved IP (default true, Node only). */
163
- validateDns?: boolean;
164
- }
165
- /**
166
- * Return a `fetch`-shaped function that refuses requests to private hosts
167
- * before calling through to `baseFetch`.
168
- */
169
- declare function secureFetch(baseFetch: typeof globalThis.fetch, options?: SecureFetchOptions): typeof globalThis.fetch;
170
- //#endregion
171
- //#region ../core/src/logger/types.d.ts
172
- /** 日志级别 */
173
- type Level = "debug" | "info" | "warn" | "error";
174
- /**
175
- * Logger 接口
176
- *
177
- * 所有方法返回空字符串,允许在模板中内联使用而不渲染文本。
178
- */
179
- interface Logger {
180
- debug(...args: unknown[]): string;
181
- info(...args: unknown[]): string;
182
- warn(...args: unknown[]): string;
183
- error(...args: unknown[]): string;
184
- }
185
- interface LoggerFactory {
186
- loggerFor(category: string): Logger;
187
- }
188
- //#endregion
189
- //#region ../core/src/logger/base.d.ts
190
- declare abstract class BaseLogger implements Logger {
191
- protected category: string;
192
- constructor(category: string);
193
- abstract debug(...args: unknown[]): string;
194
- abstract info(...args: unknown[]): string;
195
- abstract warn(...args: unknown[]): string;
196
- abstract error(...args: unknown[]): string;
197
- }
198
- //#endregion
199
- //#region ../core/src/logger/reporting.d.ts
200
- /** 日志上报回调 */
201
- interface ReportCallback {
202
- (level: Level, category: string, args: unknown[]): void;
203
- }
204
- /** 配置 */
205
- interface ReportingLoggerOptions {
206
- /** 最低上报级别(默认 "warn") */
207
- minLevel?: Level;
208
- /** 上报回调 */
209
- report: ReportCallback;
210
- }
211
- declare class ReportingLogger extends BaseLogger {
212
- private readonly minPriority;
213
- private readonly report;
214
- constructor(category: string, options: ReportingLoggerOptions);
215
- debug(...args: unknown[]): string;
216
- info(...args: unknown[]): string;
217
- warn(...args: unknown[]): string;
218
- error(...args: unknown[]): string;
219
- private maybeReport;
220
- }
221
- declare class ReportingLoggerFactory implements LoggerFactory {
222
- private readonly options;
223
- constructor(options: ReportingLoggerOptions);
224
- loggerFor(category: string): Logger;
225
- }
226
- //#endregion
227
- //#region ../core/src/metrics/types.d.ts
228
- /**
229
- * Metrics — 类型定义
230
- *
231
- * 框架级埋点基础设施的核心接口。
232
- */
233
- /** 事件记录器 — 所有 metrics 后端实现此接口 */
234
- interface EventRecorder {
235
- /** 记录一条事件 */
236
- record(type: string, fields?: Record<string, unknown>): void;
237
- /** 刷新待发送的事件队列 */
238
- flush?(): Promise<void>;
239
- /** 销毁记录器,释放资源 */
240
- destroy?(): void;
241
- }
242
- /** 字段提供者 — 每次记录前自动注入公共字段 */
243
- interface MetricsFieldsProvider {
244
- /** 返回需要附加到每条事件的字段 */
245
- getFields(): Record<string, unknown>;
246
- }
247
- /** Impression 条目 */
248
- interface ImpressionEntry {
249
- /** 被追踪元素的唯一标识 */
250
- id: string;
251
- /** 元素进入视口的时间戳 */
252
- timestamp: number;
253
- /** 附加数据 */
254
- metadata?: Record<string, unknown>;
255
- }
256
- /** Impression 观察器 — 追踪元素可见性 */
257
- interface ImpressionObserver {
258
- /** 开始追踪一个元素 */
259
- observe(element: Element, id: string, metadata?: Record<string, unknown>): void;
260
- /** 停止追踪一个元素 */
261
- unobserve(element: Element): void;
262
- /** 获取已捕获的曝光并清空 */
263
- consume(): ImpressionEntry[];
264
- /** 销毁观察器 */
265
- destroy(): void;
266
- }
267
- //#endregion
268
- //#region ../core/src/utils/platform.d.ts
269
- /**
270
- * Platform — UA 解析与平台检测
271
- *
272
- * 提供统一的平台/浏览器/OS 检测,避免在各处手写 UA 判断。
273
- */
274
- interface PlatformInfo {
275
- /** 操作系统 */
276
- os: "ios" | "android" | "macos" | "windows" | "linux" | "unknown";
277
- /** 浏览器 */
278
- browser: "safari" | "chrome" | "firefox" | "edge" | "opera" | "samsung" | "unknown";
279
- /** 渲染引擎 */
280
- engine: "webkit" | "blink" | "gecko" | "unknown";
281
- /** 是否为移动设备 */
282
- isMobile: boolean;
283
- /** 是否为触摸设备 */
284
- isTouch: boolean;
285
- }
286
- /**
287
- * 从 User-Agent 字符串解析平台信息
288
- *
289
- * @param ua - User-Agent 字符串(默认取 navigator.userAgent)
290
- */
291
- declare function detectPlatform(ua?: string): PlatformInfo;
292
- //#endregion
293
- //#region ../core/src/i18n/messages.d.ts
294
- /**
295
- * i18n message helpers shared by SSR and browser startup.
296
- */
297
- /** Flat translation table: key -> localized text */
298
- type FlatMessages = Record<string, string>;
299
- /** Nested translation value: plain text or pluralized text map */
300
- type NestedMessageValue = string | Record<string, string>;
301
- /** Locale-grouped translation table */
302
- type LocaleMessages = Record<string, Record<string, NestedMessageValue>>;
303
- /**
304
- * Translation message formats supported by the framework:
305
- * - flat messages for a single locale
306
- * - locale-grouped messages with optional plural subkeys
307
- */
308
- type TranslationMessages = FlatMessages | LocaleMessages;
309
- interface MessagesLoaderContext {
310
- readonly runtime: "server" | "browser";
311
- readonly fetch: typeof globalThis.fetch;
312
- readonly url: string;
313
- readonly request?: Request;
314
- }
315
- type MessagesLoader = (locale: string, context: MessagesLoaderContext) => TranslationMessages | Promise<TranslationMessages | undefined> | undefined;
316
- interface ResolveConfiguredMessagesOptions {
317
- locale?: string;
318
- loadMessages?: MessagesLoader;
319
- context?: MessagesLoaderContext;
320
- }
321
- /**
322
- * Resolve the effective translation source for a locale.
323
- */
324
- declare function resolveConfiguredMessages(options: ResolveConfiguredMessagesOptions): Promise<TranslationMessages | undefined>;
325
- /**
326
- * Resolve `TranslationMessages` into the flat map consumed by
327
- * `SimpleTranslator`.
328
- */
329
- declare function resolveMessages(messages: TranslationMessages, locale: string): Record<string, string> | undefined;
330
- //#endregion
331
- //#region ../core/src/dependencies/make-dependencies.d.ts
332
- /** 网络请求层 */
333
- interface Net {
334
- fetch(url: string, options?: RequestInit): Promise<Response>;
335
- }
336
- /** 存储接口 */
337
- interface Storage {
338
- get(key: string): string | undefined;
339
- set(key: string, value: string): void;
340
- delete(key: string): void;
341
- }
342
- /** Feature Flags */
343
- interface FeatureFlags {
344
- isEnabled(key: string): boolean;
345
- getString(key: string): string | undefined;
346
- getNumber(key: string): number | undefined;
347
- }
348
- /** Feature Flags Provider — 用于从远程/外部源加载 flags */
349
- interface FeatureFlagsProvider {
350
- isEnabled(key: string): boolean;
351
- getString?(key: string): string | undefined;
352
- getNumber?(key: string): number | undefined;
353
- }
354
- /** Metrics 记录器 */
355
- interface MetricsRecorder {
356
- /** 记录一条事件(通用方法) */
357
- record(type: string, fields?: Record<string, unknown>): void;
358
- /** 记录页面访问(便捷方法) */
359
- recordPageView(page: string, fields?: Record<string, unknown>): void;
360
- /** 记录自定义事件(便捷方法) */
361
- recordEvent(name: string, fields?: Record<string, unknown>): void;
362
- /** 刷新待发送队列 */
363
- flush?(): Promise<void>;
364
- /** 销毁记录器 */
365
- destroy?(): void;
366
- }
367
- declare const DEP_KEYS: {
368
- readonly LOGGER: "logger";
369
- readonly LOGGER_FACTORY: "loggerFactory";
370
- readonly NET: "net";
371
- readonly STORAGE: "storage";
372
- readonly FEATURE_FLAGS: "featureFlags";
373
- readonly METRICS: "metrics";
374
- readonly FETCH: "fetch";
375
- /**
376
- * `fetch` 包了 SSRF 防护(拒绝 private / loopback / 保留 IP + DNS resolve 后逐 IP 校验)。
377
- * 当 controller 用用户可控的 URL 发起请求(图片代理、链接预览、回调等),
378
- * 优先 resolve 这个 key 而不是 `FETCH`。要 opt-out 可手动调 `secureFetch(baseFetch, { allowInternalHosts: true })`。
379
- */
380
- readonly SAFE_FETCH: "safeFetch";
381
- readonly EVENT_RECORDER: "eventRecorder";
382
- readonly LOCALE: "locale";
383
- readonly PLATFORM: "platform";
384
- readonly TRANSLATOR: "translator";
385
- };
386
- interface MakeDependenciesOptions {
387
- fetch?: typeof globalThis.fetch;
388
- featureFlags?: Record<string, boolean | string | number>;
389
- /** 外部 feature flags providers(远程配置、A/B 测试等) */
390
- featureFlagsProviders?: FeatureFlagsProvider[];
391
- /** 日志上报回调 — 提供后自动组合 ReportingLoggerFactory */
392
- reportCallback?: ReportCallback;
393
- /** 自定义 EventRecorder(默认 ConsoleEventRecorder) */
394
- eventRecorder?: EventRecorder;
395
- /** 语言代码(如 "zh-Hans"、"en-US"),用于注入 locale 信息 */
396
- locale?: string;
397
- /** 自定义 PlatformInfo(默认通过 UA 自动检测) */
398
- platform?: PlatformInfo;
399
- /**
400
- * 覆盖 `DEP_KEYS.SAFE_FETCH` 默认行为。比如服务正常需要打内网,可以传
401
- * `{ allowInternalHosts: true }` 整体放行;或自定义 DNS 校验策略。
402
- */
403
- safeFetch?: SecureFetchOptions;
404
- }
405
- declare function makeDependencies(container: Container, options?: MakeDependenciesOptions): void;
406
- //#endregion
407
- //#region ../core/src/dependencies/request-scoped-key.d.ts
408
- /** Anything that exposes the per-request DI container — covers NavigationContext, PostLoadContext, and raw Container. */
409
- type ContainerHolder = Container | {
410
- container: Container;
411
- };
412
- interface RequestScopedKey<T> {
413
- /** The underlying string key registered with the Container. */
414
- readonly key: string;
415
- /** Write the current request's value. Overwrites any prior registration. */
416
- set(target: ContainerHolder, value: T): void;
417
- /** Read the current request's value, or `undefined` if not set. */
418
- get(target: ContainerHolder): T | undefined;
419
- /**
420
- * Remove the registration from this request's container. Subsequent `get`
421
- * calls return `undefined`. Returns true if the key existed.
422
- */
423
- clear(target: ContainerHolder): boolean;
424
- }
425
- /**
426
- * Define a typed, request-scoped DI key.
427
- *
428
- * The returned object's `set`/`get`/`clear` work against the container belonging
429
- * to the request you hand in — typically `ctx.container` from a middleware or
430
- * the `container` argument inside `BaseController.execute`.
431
- */
432
- declare function defineRequestScopedKey<T>(key: string): RequestScopedKey<T>;
433
- //#endregion
434
- //#region ../core/src/models/page.d.ts
435
- /**
436
- * BasePage — 所有页面共享的基础属性
437
- *
438
- * 具体页面类型由应用层定义并扩展此接口。
439
- *
440
- * SSR prefetch 数据序列化时的可见性由 `FINESOFT_PUBLIC` symbol 控制 —— 见
441
- * `markPublic` / `isPublicMarked`。没有 marker 时 `serializeServerData` 仍按全字段
442
- * 序列化(向后兼容),但会在 dev 启动后打印一次告警,下一个 major 会改为只序列化
443
- * `BasePage` 的标准字段(id/pageType/title/description/url)。
444
- */
445
- interface BasePage {
446
- id: string;
447
- pageType: string;
448
- title: string;
449
- description?: string;
450
- url?: string;
451
- }
452
- /**
453
- * 显式声明 page 对象里哪些字段可以跨 SSR/CSR 边界进入 HTML。未列出的字段在
454
- * `serializeServerData` 时会被剥除,杜绝整 page 对象(含 apiToken、内部备注等)
455
- * 被无意中 hydrate 到客户端的失误。
456
- *
457
- * 用 symbol 而非普通字段名:避免和应用自己的字段冲突,且 `JSON.stringify` 自动
458
- * 忽略 symbol key,所以 marker 永远不会出现在序列化输出里。
459
- */
460
- declare const FINESOFT_PUBLIC: unique symbol;
461
- /** 标准 BasePage 字段 —— marker 缺失但显式标注时使用。 */
462
- declare const BASE_PAGE_FIELDS: readonly ["id", "pageType", "title", "description", "url"];
463
- /**
464
- * 把 `publicFields` 列表写到 page 上,供 `serializeServerData` 读取。
465
- * 推荐做法是不要直接渲染原始 page 对象,而是经过这个函数显式声明 contract:
466
- *
467
- * ```ts
468
- * return markPublic(
469
- * {
470
- * id: "profile",
471
- * pageType: "profile",
472
- * title: user.name,
473
- * email: user.email,
474
- * apiToken: user.apiToken, // 仍在对象上,给服务端别处用
475
- * },
476
- * ["id", "pageType", "title", "email"], // 但 prefetch 只 serialize 这些
477
- * );
478
- * ```
479
- *
480
- * 也可以传 `true` 表示「所有字段都安全」—— 当作 opt-out,等价于不调用本函数。
481
- */
482
- declare function markPublic<P extends BasePage>(page: P, publicFields: readonly (keyof P)[] | true): P;
483
- /** True 如果 page 用 `markPublic` 显式标过。 */
484
- declare function isPublicMarked(page: unknown): boolean;
485
- /** 取出 `markPublic` 写入的字段白名单;`true` 表示全开放,`null` 表示未标注。 */
486
- declare function getPublicFields(page: unknown): readonly string[] | true | null;
487
- //#endregion
488
- //#region ../core/src/middleware/types.d.ts
489
- /** 导航上下文(beforeLoad 阶段可用) */
490
- interface NavigationContext {
491
- /** 完整 URL(path + query) */
492
- readonly url: string;
493
- /** 仅路径部分 */
494
- readonly path: string;
495
- /** 路由参数 + 查询参数(codec 转换后可能是 number/boolean 等) */
496
- readonly params: Record<string, unknown>;
497
- /** 匹配的 Intent */
498
- readonly intent: Intent;
499
- /** 是否在服务端运行 */
500
- readonly isServer: boolean;
501
- /** DI 容器(可获取自定义服务) */
502
- readonly container: Container;
503
- /** 获取 Cookie 值(两端均可用) */
504
- getCookie(name: string): string | undefined;
505
- /** 获取请求头值(仅服务端有值,客户端始终返回 undefined) */
506
- getHeader(name: string): string | undefined;
507
- }
508
- /** 后置上下文(afterLoad 阶段,包含页面数据) */
509
- interface PostLoadContext extends NavigationContext {
510
- /** 控制器返回的页面数据 */
511
- readonly page: BasePage;
512
- }
513
- /** 继续执行下一个中间件 */
514
- interface NextResult {
515
- readonly kind: "next";
516
- }
517
- /** 重定向(服务端: HTTP 301/302,客户端: 触发新导航) */
518
- interface RedirectResult {
519
- readonly kind: "redirect";
520
- readonly url: string;
521
- readonly status: number;
522
- }
523
- /** URL 重写(服务端: HTTP 301,客户端: replaceState 仅更新地址栏) */
524
- interface RewriteResult {
525
- readonly kind: "rewrite";
526
- readonly url: string;
527
- }
528
- /** 拒绝访问 */
529
- interface DenyResult {
530
- readonly kind: "deny";
531
- readonly status: number;
532
- readonly message: string;
533
- }
534
- type MiddlewareResult = NextResult | RedirectResult | RewriteResult | DenyResult;
535
- /** 继续执行 */
536
- declare function next(): NextResult;
537
- /** 重定向到新 URL */
538
- declare function redirect(url: string, status?: 301 | 302): RedirectResult;
539
- /** URL 重写(不重新加载数据) */
540
- declare function rewrite(url: string): RewriteResult;
541
- /** 拒绝访问 */
542
- declare function deny(status?: number, message?: string): DenyResult;
543
- /** beforeLoad 守卫:路由匹配后、数据加载前 */
544
- type BeforeLoadGuard = (ctx: NavigationContext) => MiddlewareResult | Promise<MiddlewareResult>;
545
- /** afterLoad 守卫:数据加载后、渲染前 */
546
- type AfterLoadGuard = (ctx: PostLoadContext) => MiddlewareResult | Promise<MiddlewareResult>;
547
- //#endregion
548
- //#region ../core/src/router/params/standard.d.ts
549
- /**
550
- * Standard Schema v1 接口的最小本地声明 + 运行助手。
551
- * 纯 type-level 规范 + 运行时鸭子类型,不依赖 @standard-schema/spec 运行时包。
552
- * https://standardschema.dev
553
- */
554
- interface StandardSchemaV1<Input = unknown, Output = Input> {
555
- readonly "~standard": {
556
- readonly version: 1;
557
- readonly vendor: string;
558
- readonly validate: (value: unknown) => StandardResult<Output> | Promise<StandardResult<Output>>;
559
- readonly types?: {
560
- readonly input: Input;
561
- readonly output: Output;
562
- };
563
- };
564
- }
565
- type StandardResult<Output> = {
566
- readonly value: Output;
567
- readonly issues?: undefined;
568
- } | {
569
- readonly issues: ReadonlyArray<StandardIssue>;
570
- };
571
- interface StandardIssue {
572
- readonly message: string;
573
- readonly path?: ReadonlyArray<PropertyKey | {
574
- readonly key: PropertyKey;
575
- }>;
576
- }
577
- /** 提取 Standard Schema 的输出类型 */
578
- type InferOutput<S extends StandardSchemaV1> = NonNullable<S["~standard"]["types"]>["output"];
579
- /** 路由参数 codec:输入恒为 string(缺失时 undefined),输出为目标类型 T */
580
- type ParamSchema<T = unknown> = StandardSchemaV1<string, T>;
581
- /** 工厂:从一个 validate 函数构造实现了 ~standard 的 codec */
582
- declare function makeSchema<T>(validate: (value: unknown) => StandardResult<T> | Promise<StandardResult<T>>): ParamSchema<T>;
583
- /** 统一执行任意 Standard Schema 的校验,吸收同步/异步差异 */
584
- declare function runStandard(schema: StandardSchemaV1, raw: string | undefined): Promise<{
585
- ok: true;
586
- value: unknown;
587
- } | {
588
- ok: false;
589
- issues: readonly StandardIssue[];
590
- }>;
591
- //#endregion
592
- //#region ../core/src/router/router.d.ts
593
- /** 路由匹配结果 */
594
- interface RouteMatch {
595
- intent: Intent;
596
- action: FlowAction;
597
- renderMode?: string;
598
- /** 该路由绑定的 beforeLoad 守卫 */
599
- beforeGuards?: BeforeLoadGuard[];
600
- /** 该路由绑定的 afterLoad 守卫 */
601
- afterGuards?: AfterLoadGuard[];
602
- }
603
- /** 路由添加选项 */
604
- interface RouteAddOptions {
605
- renderMode?: string;
606
- beforeGuards?: BeforeLoadGuard[];
607
- afterGuards?: AfterLoadGuard[];
608
- paramCodecs?: Record<string, ParamSchema>;
609
- queryCodecs?: Record<string, StandardSchemaV1<string, unknown>>;
610
- }
611
- declare class Router {
612
- private readonly debug?;
613
- private routes;
614
- constructor(debug?: ((message: string) => void) | undefined);
615
- /** 添加路由规则 */
616
- add(pattern: string, intentId: string, renderModeOrOptions?: string | RouteAddOptions): this;
617
- /** 解析 URL → RouteMatch(含参数校验;校验失败则 fall-through 到下一条路由) */
618
- resolve(urlOrPath: string): Promise<RouteMatch | null>;
619
- /** 获取所有已注册的路由 */
620
- getRoutes(): string[];
621
- private parseUrl;
622
- }
623
- //#endregion
624
- //#region ../core/src/router/params/primitives.d.ts
625
- interface StrOptions {
626
- minLength?: number;
627
- maxLength?: number;
628
- pattern?: RegExp;
629
- }
630
- declare function str(opts?: StrOptions): ParamSchema<string>;
631
- interface NumOptions {
632
- min?: number;
633
- max?: number;
634
- }
635
- declare function int(opts?: NumOptions): ParamSchema<number>;
636
- declare function num(opts?: NumOptions): ParamSchema<number>;
637
- declare function bool(): ParamSchema<boolean>;
638
- declare function oneOf<const T extends readonly string[]>(values: T): ParamSchema<T[number]>;
639
- declare function uuid(): ParamSchema<string>;
640
- //#endregion
641
- //#region ../core/src/router/params/modifiers.d.ts
642
- /** 输入缺失(undefined)时跳过校验、产出 undefined;否则委托内部 codec(同步或异步均可)。 */
643
- declare function optional<T>(codec: ParamSchema<T>): ParamSchema<T | undefined>;
644
- /** 输入缺失时用 fallback;否则委托内部 codec。 */
645
- declare function withDefault<T>(codec: ParamSchema<T>, fallback: T): ParamSchema<T>;
646
- //#endregion
647
- //#region ../core/src/router/params/infer.d.ts
648
- /** 剥离可选参数尾随的 "?" */
649
- type StripOptional<S extends string> = S extends `${infer N}?` ? N : S;
650
- /** 从 path pattern 字面量提取参数名联合(处理 :param 与 :param?) */
651
- type ExtractParamNames<Path extends string> = Path extends `${infer _Head}:${infer Rest}` ? Rest extends `${infer Name}/${infer Tail}` ? StripOptional<Name> | ExtractParamNames<`/${Tail}`> : StripOptional<Rest> : never;
652
- /** path 参数 codec map 的形状:key 只能是 path 中出现的参数名(均可选声明) */
653
- type ParamsFor<Path extends string> = { [K in ExtractParamNames<Path>]?: ParamSchema };
654
- /** query 参数 codec map:key 自由开放 */
655
- type QuerySchemaMap = Record<string, StandardSchemaV1<string, unknown>>;
656
- /** 从 codec map 推导运行期参数类型 */
657
- type InferParams<P extends Record<string, ParamSchema>> = { [K in keyof P]: InferOutput<P[K]> };
658
- type InferQuery<Q extends QuerySchemaMap> = { [K in keyof Q]: InferOutput<Q[K]> };
659
- //#endregion
660
- //#region ../core/src/logger/composite.d.ts
661
- declare class CompositeLoggerFactory implements LoggerFactory {
662
- private readonly factories;
663
- constructor(factories: LoggerFactory[]);
664
- loggerFor(name: string): Logger;
665
- }
666
- declare class CompositeLogger implements Logger {
667
- private readonly loggers;
668
- constructor(loggers: Logger[]);
669
- debug(...args: unknown[]): string;
670
- info(...args: unknown[]): string;
671
- warn(...args: unknown[]): string;
672
- error(...args: unknown[]): string;
673
- private callAll;
674
- }
675
- //#endregion
676
- //#region ../core/src/logger/console.d.ts
677
- declare class ConsoleLogger extends BaseLogger {
678
- debug(...args: unknown[]): string;
679
- info(...args: unknown[]): string;
680
- warn(...args: unknown[]): string;
681
- error(...args: unknown[]): string;
682
- }
683
- declare class ConsoleLoggerFactory implements LoggerFactory {
684
- loggerFor(category: string): Logger;
685
- }
686
- //#endregion
687
- //#region ../core/src/logger/local-storage-filter.d.ts
688
- declare function shouldLog(name: string, level: Level): boolean;
689
- declare function resetFilterCache(): void;
690
- //#endregion
691
- //#region ../core/src/i18n/types.d.ts
692
- /**
693
- * i18n — 类型定义
694
- *
695
- * 框架级国际化基础设施。
696
- */
697
- /** 翻译函数 */
698
- interface Translator {
699
- /**
700
- * 翻译 key → 本地化字符串
701
- * @param key - 翻译 key
702
- * @param values - 插值参数
703
- */
704
- t(key: string, values?: Record<string, string | number>): string;
705
- /**
706
- * 复数形式翻译
707
- * @param key - 翻译 key 前缀
708
- * @param count - 数量
709
- * @param values - 附加插值
710
- */
711
- plural(key: string, count: number, values?: Record<string, string | number>): string;
712
- /** 当前 locale(如 "zh-Hans" / "en-US") */
713
- readonly locale: string;
714
- }
715
- /** 文本方向 */
716
- type TextDirection = "ltr" | "rtl";
717
- /** HTML 语言属性 */
718
- interface LocaleAttributes {
719
- /** BCP 47 语言标签 */
720
- lang: string;
721
- /** 文本方向 */
722
- dir: TextDirection;
723
- }
724
- /** Locale 信息 */
725
- interface LocaleInfo {
726
- /** 语言代码(如 "zh-Hans", "en") */
727
- language: string;
728
- /** 地区/Storefront 代码(如 "CN", "US") */
729
- region?: string;
730
- /** BCP 47 完整标签 */
731
- bcp47: string;
732
- /** 文本方向 */
733
- dir: TextDirection;
734
- }
735
- //#endregion
736
- //#region ../core/src/prefetched-intents/prefetched-intents.d.ts
737
- /** 预获取的 Intent-Data 对 */
738
- interface PrefetchedIntent {
739
- intent: Intent;
740
- data: unknown;
741
- }
742
- declare class PrefetchedIntents {
743
- private intents;
744
- private constructor();
745
- /** 从 PrefetchedIntent 数组创建缓存实例 */
746
- static fromArray(items: PrefetchedIntent[]): PrefetchedIntents;
747
- /** 创建空缓存实例 */
748
- static empty(): PrefetchedIntents;
749
- /**
750
- * 获取缓存的 Intent 结果(一次性使用)。
751
- * 命中后从缓存中删除。
752
- */
753
- get<T>(intent: Intent<T>): T | undefined;
754
- /** 检查缓存中是否有某个 Intent 的数据 */
755
- has(intent: Intent): boolean;
756
- /** 缓存中的条目数 */
757
- get size(): number;
758
- }
759
- //#endregion
760
- //#region ../core/src/framework.d.ts
761
- /** Framework 初始化配置 */
762
- interface FrameworkConfig extends MakeDependenciesOptions {
763
- setupRoutes?: (router: Router) => void;
764
- prefetchedIntents?: PrefetchedIntents;
765
- }
766
- declare class Framework {
767
- readonly container: Container;
768
- readonly intentDispatcher: IntentDispatcher;
769
- readonly actionDispatcher: ActionDispatcher;
770
- readonly router: Router;
771
- readonly prefetchedIntents: PrefetchedIntents;
772
- private readonly beforeGuards;
773
- private readonly afterGuards;
774
- private _logger?;
775
- private constructor();
776
- /** 创建并初始化 Framework 实例 */
777
- static create(config?: FrameworkConfig): Framework;
778
- private getLogger;
779
- /** 分发 Intent — 获取页面数据 */
780
- dispatch<T>(intent: Intent<T>): Promise<T>;
781
- /** 执行 Action — 处理用户交互 */
782
- perform(action: Action): Promise<void>;
783
- /** 路由 URL — 将 URL 解析为 Intent + Action */
784
- routeUrl(url: string): Promise<RouteMatch | null>;
785
- /** 记录页面访问事件 */
786
- didEnterPage(page: BasePage): void;
787
- /** 获取 locale 信息(如果已配置) */
788
- getLocale(): LocaleAttributes | undefined;
789
- /** 获取翻译器(如果当前 locale 已经初始化了翻译字典) */
790
- getTranslator(): Translator | undefined;
791
- /** 获取平台信息 */
792
- getPlatform(): PlatformInfo;
793
- /** 注册 Action 处理器 */
794
- onAction<A extends Action>(kind: string, handler: ActionHandler<A>): void;
795
- /** 注册 Intent Controller */
796
- registerIntent(controller: IntentController): void;
797
- /** 注册 beforeLoad 守卫(路由匹配后、数据加载前) */
798
- beforeLoad(guard: BeforeLoadGuard): void;
799
- /** 注册 afterLoad 守卫(数据加载后、渲染前) */
800
- afterLoad(guard: AfterLoadGuard): void;
801
- /** 执行所有 beforeLoad 守卫(全局 → 路由级) */
802
- runBeforeLoad(ctx: NavigationContext, routeGuards?: BeforeLoadGuard[]): Promise<MiddlewareResult>;
803
- /** 执行所有 afterLoad 守卫(全局 → 路由级) */
804
- runAfterLoad(ctx: PostLoadContext, routeGuards?: AfterLoadGuard[]): Promise<MiddlewareResult>;
805
- /** 销毁 Framework 实例 */
806
- dispose(): void;
807
- }
808
- //#endregion
809
- //#region ../core/src/models/safe-error-page.d.ts
810
- interface SafeErrorPageOptions {
811
- /** HTTP-style status code used in the page title (e.g. 404, 500). */
812
- status: number;
813
- /**
814
- * The message users / client code may safely see in production. Should
815
- * contain no stack, file paths, hostnames, or secrets.
816
- */
817
- publicMessage: string;
818
- /**
819
- * Optional error / debug payload to surface only in non-production. In
820
- * production this is dropped entirely; only `publicMessage` is exposed.
821
- */
822
- devError?: unknown;
823
- /**
824
- * Override the production detection. Pass `true` to force the prod-safe
825
- * variant (drops devError). Defaults to detecting `process.env.NODE_ENV`.
826
- */
827
- isProduction?: boolean;
828
- }
829
- /**
830
- * Build a BasePage for an error condition. In production, only `publicMessage`
831
- * makes it into the page. In dev, `devError` (if provided) is appended.
832
- */
833
- declare function safeErrorPage(options: SafeErrorPageOptions): BasePage;
834
- //#endregion
835
- //#region ../core/src/models/shelf.d.ts
836
- interface BaseShelf {
837
- id: string;
838
- shelfType: string;
839
- title?: string;
840
- subtitle?: string;
841
- seeAllAction?: Action;
842
- isHorizontal?: boolean;
843
- }
844
- interface BaseItem {
845
- id: string;
846
- itemType: string;
847
- clickAction?: Action;
848
- }
849
- //#endregion
850
- //#region ../core/src/prefetched-intents/stable-stringify.d.ts
851
- /**
852
- * stableStringify — 确定性 JSON 序列化(keys 按字母排序)
853
- *
854
- * 用作缓存 key:相同内容的对象始终产生相同字符串。
855
- */
856
- declare function stableStringify(obj: unknown): string;
857
- //#endregion
858
- //#region ../core/src/http/client.d.ts
859
- /**
860
- * HttpClient — 通用 HTTP 客户端基类
861
- *
862
- * 为 API Client 提供标准化的 HTTP 请求能力。
863
- * 子类继承后只需关注业务端点定义,不需要重复实现 fetch / JSON 解析 / 错误处理。
864
- *
865
- * 默认安全:拒绝向内网 / loopback / 保留地址发请求(SSRF 防御)。应用层
866
- * 显式 opt-out 用 `allowInternalHosts: true`。详见 host-guard.ts。
867
- */
868
- /** HTTP 请求错误 */
869
- declare class HttpError extends Error {
870
- readonly status: number;
871
- readonly statusText: string;
872
- readonly body?: string | undefined;
873
- constructor(status: number, statusText: string, body?: string | undefined);
874
- }
875
- /**
876
- * SSRF 防护拦截到不安全的目标地址时抛出。应用层可以 catch 它来给出业务友好的错误,
877
- * 不需要靠 message 字符串匹配。
878
- */
879
- declare class HostGuardError extends Error {
880
- readonly url: string;
881
- readonly reason: string;
882
- constructor(url: string, reason: string);
883
- }
884
- /** 请求拦截器 — 在发送前修改请求 */
885
- interface RequestInterceptor {
886
- (url: string, init: RequestInit): RequestInit | Promise<RequestInit>;
887
- }
888
- /** 响应拦截器 — 在解析前修改响应 */
889
- interface ResponseInterceptor {
890
- (response: Response, url: string): Response | Promise<Response>;
891
- }
892
- /** HttpClient 构造配置 */
893
- interface HttpClientConfig {
894
- /** API base URL(如 "/api" 或 "https://example.com/api") */
895
- baseUrl: string;
896
- /** 默认请求头 */
897
- defaultHeaders?: Record<string, string>;
898
- /** 自定义 fetch 实现(便于测试或 SSR) */
899
- fetch?: typeof globalThis.fetch;
900
- /** 请求拦截器(按注册顺序执行) */
901
- requestInterceptors?: RequestInterceptor[];
902
- /** 响应拦截器(按注册顺序执行) */
903
- responseInterceptors?: ResponseInterceptor[];
904
- /**
905
- * 是否允许向私有 / loopback / 保留 IP 段发请求。
906
- *
907
- * **默认 false** —— 阻止内网穿透(SSRF)。如果你的服务正常需要打内网(如
908
- * 微服务对内 API、127.0.0.1 上的开发依赖),把它设为 true 显式 opt-out,并
909
- * 自己做来源校验。
910
- */
911
- allowInternalHosts?: boolean;
912
- /**
913
- * 是否在请求前 DNS 解析 hostname 并对解析结果做 IP 段校验。
914
- *
915
- * **默认 true**(仅 Node 环境有效;浏览器静默跳过)。配合 `allowInternalHosts`
916
- * 防御 DNS rebinding:如果 hostname 不是 IP 字面量,框架会 resolve 它的 A/AAAA
917
- * 记录并按 IP 段校验。`false` 关闭只剩 IP 字面量同步校验。
918
- */
919
- validateDns?: boolean;
920
- }
921
- /**
922
- * 通用 HTTP 客户端基类
923
- *
924
- * 使用方式: 创建子类继承 HttpClient,定义业务方法调用 this.get() / this.post() 等。
925
- *
926
- * @example
927
- * ```ts
928
- * class MyApiClient extends HttpClient {
929
- * async getUser(id: string) {
930
- * return this.get<User>(`/users/${id}`);
931
- * }
932
- * }
933
- * ```
934
- */
935
- declare abstract class HttpClient {
936
- protected readonly baseUrl: string;
937
- protected readonly defaultHeaders: Record<string, string>;
938
- protected readonly fetchFn: typeof globalThis.fetch;
939
- private readonly requestInterceptors;
940
- private readonly responseInterceptors;
941
- private readonly allowInternalHosts;
942
- private readonly validateDns;
943
- constructor(config: HttpClientConfig);
944
- /** 动态添加请求拦截器 */
945
- useRequestInterceptor(interceptor: RequestInterceptor): this;
946
- /** 动态添加响应拦截器 */
947
- useResponseInterceptor(interceptor: ResponseInterceptor): this;
948
- /** GET 请求,返回解析后的 JSON */
949
- protected get<T>(path: string, params?: Record<string, string>): Promise<T>;
950
- /** POST 请求,自动序列化 body 为 JSON */
951
- protected post<T>(path: string, body?: unknown, params?: Record<string, string>): Promise<T>;
952
- /** PUT 请求 */
953
- protected put<T>(path: string, body?: unknown, params?: Record<string, string>): Promise<T>;
954
- /** DELETE 请求 */
955
- protected del<T>(path: string, params?: Record<string, string>): Promise<T>;
956
- /**
957
- * 底层请求方法 — 子类可覆写以自定义行为
958
- *
959
- * 自动处理:
960
- * - URL 拼接 (baseUrl + path + params)
961
- * - SSRF 防护(IP 字面量同步校验 + 可选 DNS 解析校验)
962
- * - 默认 headers 合并
963
- * - JSON body 序列化
964
- * - 响应 JSON 解析
965
- * - 非 2xx 状态码抛出 HttpError
966
- */
967
- protected request<T>(method: string, path: string, options?: {
968
- params?: Record<string, string>;
969
- body?: unknown;
970
- headers?: Record<string, string>;
971
- }): Promise<T>;
972
- /** 构建完整 URL — 子类可覆写以自定义 URL 拼接逻辑 */
973
- protected buildUrl(path: string, params?: Record<string, string>): string;
974
- private enforceHostGuard;
975
- }
976
- //#endregion
977
- //#region ../core/src/http/host-guard.d.ts
978
- /**
979
- * host-guard — refuse outbound requests to private / loopback / reserved hosts.
980
- *
981
- * Why this exists: `HttpClient` and the raw `fetch` injected via DI both used
982
- * to accept any URL the application built. SSR controllers that take a
983
- * user-controlled URL (image proxy, link preview, OAuth callback) could be
984
- * tricked into fetching `http://127.0.0.1/admin` and embedding the response in
985
- * the SSR HTML. Round 1 of the adversarial drill walked straight through this;
986
- * round 2's hand-rolled IPv4 regex was bypassed in five minutes with
987
- * `[::ffff:7f00:1]`. This module centralises the check so applications can stop
988
- * re-implementing it (badly).
989
- *
990
- * Coverage (synchronous, IP-literal forms):
991
- * - IPv4 dotted-decimal: `127.0.0.1`, `10.0.0.5`, `192.168.1.1`, `172.16.0.1`
992
- * - IPv4 zero / link-local / multicast / reserved: `0.0.0.0`, `169.254.0.1`,
993
- * `224.0.0.1`, `240.0.0.0/4`
994
- * - IPv4 non-dotted forms accepted by some parsers: decimal `2130706433`,
995
- * hex `0x7f000001`, octal `0177.0.0.1`
996
- * - IPv6 loopback `::1`, link-local `fe80::/10`, ULA `fc00::/7`, unspecified `::`
997
- * - IPv4-mapped IPv6: `::ffff:7f00:1`, `::ffff:127.0.0.1`
998
- * - Names: `localhost`, `*.localhost`
999
- *
1000
- * NOT covered here (callers can layer on top):
1001
- * - DNS resolution of arbitrary hostnames — see `validateUrlWithDns` in
1002
- * server-only callers. DNS rebinding is impossible to fix at this layer
1003
- * alone; the right pattern is "resolve once, then fetch by IP".
1004
- * - IDN / homograph attacks — Node's URL parser punycode-encodes hostnames
1005
- * already, so the hostname this code sees is the ASCII form.
1006
- */
1007
- type HostCheckResult = {
1008
- ok: true;
1009
- } | {
1010
- ok: false;
1011
- reason: string;
1012
- };
1013
- /**
1014
- * Inspect a hostname string (the `URL.hostname` value, without brackets, port,
1015
- * or userinfo). Returns `{ok: false}` for anything in a private/loopback/
1016
- * reserved range; `{ok: true}` if the literal looks like a public address or a
1017
- * non-IP name (the caller may then DNS-resolve and re-check).
1018
- */
1019
- declare function classifyHost(rawHost: string): HostCheckResult;
1020
- /**
1021
- * Convenience wrapper for callers holding a full URL string. Also rejects
1022
- * non-http(s) schemes (gopher, file, data, …).
1023
- */
1024
- declare function classifyUrl(rawUrl: string): HostCheckResult;
1025
- //#endregion
1026
- //#region ../core/src/intents/base-controller.d.ts
1027
- /**
1028
- * 抽象 Controller 基类
1029
- *
1030
- * 统一处理:
1031
- * - 类型安全的参数提取 (TParams)
1032
- * - 返回类型约束 (TResult)
1033
- * - try/catch 错误处理 + 可选 fallback
1034
- *
1035
- * @example
1036
- * ```ts
1037
- * class ProductController extends BaseController<{ productId: string }, ProductPage> {
1038
- * readonly intentId = "product-page";
1039
- *
1040
- * async execute(params: { productId: string }, container: Container) {
1041
- * const api = container.resolve<ApiClient>("api");
1042
- * return api.getProduct(params.productId);
1043
- * }
1044
- *
1045
- * fallback(params: { productId: string }, error: Error) {
1046
- * return getMockProduct(params.productId);
1047
- * }
1048
- * }
1049
- * ```
1050
- */
1051
- declare abstract class BaseController<TParams extends Record<string, unknown> = Record<string, unknown>, TResult = unknown> implements IntentController<TResult> {
1052
- /** Controller 对应的 Intent ID */
1053
- abstract readonly intentId: string;
1054
- /**
1055
- * 执行业务逻辑 — 子类必须实现
1056
- *
1057
- * @param params - Intent 参数(已类型化)
1058
- * @param container - DI 容器
1059
- * @returns 页面数据
1060
- */
1061
- abstract execute(params: TParams, container: Container): Promise<TResult> | TResult;
1062
- /**
1063
- * 错误回退 — 子类可选覆写
1064
- *
1065
- * 当 execute() 抛出异常时调用。
1066
- * 默认行为: 重新抛出原始错误。
1067
- *
1068
- * @param params - Intent 参数
1069
- * @param error - execute() 抛出的错误
1070
- * @returns 回退数据
1071
- */
1072
- fallback(params: TParams, error: Error): Promise<TResult> | TResult;
1073
- /**
1074
- * IntentController.perform() 实现
1075
- *
1076
- * 自动 try/catch → fallback 模式。
1077
- */
1078
- perform(intent: Intent<TResult>, container: Container): Promise<TResult>;
1079
- }
1080
- //#endregion
1081
- //#region ../core/src/data/mapper.d.ts
1082
- /**
1083
- * Mapper 类型工具 — 标准化数据转换管线
1084
- *
1085
- * 提供类型约定和组合函数,让 API 响应 → 页面模型 的转换有统一的签名模式。
1086
- */
1087
- /** 同步映射函数 */
1088
- type Mapper<TInput, TOutput> = (input: TInput) => TOutput;
1089
- /** 异步映射函数 */
1090
- type AsyncMapper<TInput, TOutput> = (input: TInput) => TOutput | Promise<TOutput>;
1091
- /**
1092
- * 组合两个同步 Mapper: A → B → C
1093
- */
1094
- declare function pipe<A, B, C>(m1: Mapper<A, B>, m2: Mapper<B, C>): Mapper<A, C>;
1095
- /**
1096
- * 组合三个同步 Mapper: A → B → C → D
1097
- */
1098
- declare function pipe<A, B, C, D>(m1: Mapper<A, B>, m2: Mapper<B, C>, m3: Mapper<C, D>): Mapper<A, D>;
1099
- /**
1100
- * 组合四个同步 Mapper: A → B → C → D → E
1101
- */
1102
- declare function pipe<A, B, C, D, E>(m1: Mapper<A, B>, m2: Mapper<B, C>, m3: Mapper<C, D>, m4: Mapper<D, E>): Mapper<A, E>;
1103
- /**
1104
- * 组合任意数量的同步 Mapper
1105
- */
1106
- declare function pipe(...mappers: Mapper<unknown, unknown>[]): Mapper<unknown, unknown>;
1107
- /**
1108
- * 组合两个可能异步的 Mapper: A → B → C
1109
- */
1110
- declare function pipeAsync<A, B, C>(m1: AsyncMapper<A, B>, m2: AsyncMapper<B, C>): AsyncMapper<A, C>;
1111
- /**
1112
- * 组合三个可能异步的 Mapper
1113
- */
1114
- declare function pipeAsync<A, B, C, D>(m1: AsyncMapper<A, B>, m2: AsyncMapper<B, C>, m3: AsyncMapper<C, D>): AsyncMapper<A, D>;
1115
- /**
1116
- * 将一个 Mapper 应用到数组的每个元素
1117
- */
1118
- declare function mapEach<TInput, TOutput>(mapper: Mapper<TInput, TOutput>): Mapper<TInput[], TOutput[]>;
1119
- //#endregion
1120
- //#region ../core/src/bootstrap/define-routes.d.ts
1121
- /** 渲染模式 */
1122
- type RenderMode = "ssr" | "csr" | "prerender";
1123
- /** 单条路由定义 */
1124
- interface RouteDefinition<Path extends string = string, P extends ParamsFor<Path> = ParamsFor<Path>, Q extends QuerySchemaMap = QuerySchemaMap> {
1125
- /** URL pattern (如 "/product/:id") */
1126
- path: Path;
1127
- /** Intent ID */
1128
- intentId: string;
1129
- /** Controller 实例(可选)。同一 intentId 的多条路由只需在第一条提供。 */
1130
- controller?: IntentController;
1131
- /** path 参数 codec;key 必须是 path 中出现的 :param 名 */
1132
- params?: P;
1133
- /** query 参数 codec;key 自由 */
1134
- query?: Q;
1135
- /** 渲染模式(可选,默认 "ssr") */
1136
- renderMode?: RenderMode;
1137
- /** 路由级 beforeLoad 守卫 */
1138
- beforeLoad?: BeforeLoadGuard[];
1139
- /** 路由级 afterLoad 守卫 */
1140
- afterLoad?: AfterLoadGuard[];
1141
- }
1142
- /**
1143
- * 构造一条强类型路由定义。
1144
- * `params` 的 key 受 `path` 字面量约束——写入 path 中不存在的参数名会编译期报错。
1145
- *
1146
- * @example
1147
- * route("/product/:id", { intentId: "product", controller, params: { id: int() } })
1148
- */
1149
- declare function route<const Path extends string, P extends ParamsFor<Path> = ParamsFor<Path>, Q extends QuerySchemaMap = QuerySchemaMap>(path: Path, def: {
1150
- intentId: string;
1151
- controller?: IntentController;
1152
- params?: P;
1153
- query?: Q;
1154
- renderMode?: RenderMode;
1155
- beforeLoad?: BeforeLoadGuard[];
1156
- afterLoad?: AfterLoadGuard[];
1157
- }): RouteDefinition;
1158
- /** defineRoutes 选项 */
1159
- interface DefineRoutesOptions {
1160
- /**
1161
- * 支持的 locale 列表。
1162
- * 提供后,每条路由会额外注册 `/:locale/path` 版本,
1163
- * `:locale` 参数自动出现在 `intent.params.locale` 中。
1164
- * 原始无前缀路径保留作为备选路由。
1165
- *
1166
- * @example
1167
- * ```ts
1168
- * defineRoutes(framework, routes, { locales: ["zh", "en", "ja"] });
1169
- * // "/about" → 注册 /about + /zh/about + /en/about + /ja/about
1170
- * ```
1171
- */
1172
- locales?: string[];
1173
- }
1174
- /**
1175
- * 声明式注册路由和 Controller
1176
- *
1177
- * - 自动去重: 同一 intentId 的 controller 只注册一次
1178
- * - 路由和 controller 在同一个配置数组中,方便检查一致性
1179
- *
1180
- * @example
1181
- * ```ts
1182
- * defineRoutes(framework, [
1183
- * { path: "/", intentId: "home", controller: new HomeController() },
1184
- * { path: "/product/:id", intentId: "product", controller: new ProductController() },
1185
- * { path: "/search", intentId: "search", controller: new SearchController() },
1186
- * { path: "/charts/:type", intentId: "charts", controller: new ChartsController() },
1187
- * { path: "/charts", intentId: "charts" }, // 同 intentId,不需要重复 controller
1188
- * ]);
1189
- * ```
1190
- */
1191
- declare function defineRoutes(framework: Framework, definitions: RouteDefinition[], options?: DefineRoutesOptions): void;
1192
- //#endregion
1193
- //#region ../core/src/utils/lru-map.d.ts
1194
- /**
1195
- * LruMap — 固定容量的 LRU 缓存
1196
- */
1197
- declare class LruMap<K, V> {
1198
- private map;
1199
- private readonly capacity;
1200
- constructor(capacity: number);
1201
- get(key: K): V | undefined;
1202
- set(key: K, value: V): void;
1203
- has(key: K): boolean;
1204
- delete(key: K): boolean;
1205
- get size(): number;
1206
- clear(): void;
1207
- }
1208
- //#endregion
1209
- //#region ../core/src/utils/optional.d.ts
1210
- /**
1211
- * Optional 类型工具
1212
- */
1213
- type None = null | undefined;
1214
- type Optional<T> = T | None;
1215
- declare function isSome<T>(value: Optional<T>): value is T;
1216
- declare function isNone<T>(value: Optional<T>): value is None;
1217
- //#endregion
1218
- //#region ../core/src/utils/pwa.d.ts
1219
- /**
1220
- * PWA Display Mode 检测
1221
- *
1222
- * 检测当前应用是否以 PWA 模式运行。
1223
- */
1224
- type PWADisplayMode = "standalone" | "twa" | "browser";
1225
- /**
1226
- * 检测 PWA display mode
1227
- *
1228
- * - `standalone`: 已安装的 PWA(通过 Add to Home Screen)
1229
- * - `twa`: Trusted Web Activity(Android 原生壳)
1230
- * - `browser`: 普通浏览器标签页
1231
- */
1232
- declare function getPWADisplayMode(): PWADisplayMode;
1233
- //#endregion
1234
- //#region ../core/src/utils/url.d.ts
1235
- /**
1236
- * URL 工具函数
1237
- */
1238
- /** 移除 URL scheme (https://, http://) */
1239
- declare function removeScheme(url: string): string;
1240
- /** 移除 URL host 部分,保留路径 */
1241
- declare function removeHost(url: string): string;
1242
- /** 移除 query 参数 */
1243
- declare function removeQueryParams(url: string): string;
1244
- /** 获取 URL 的基础路径(无 query、hash) */
1245
- declare function getBaseUrl(url: string): string;
1246
- /** 构建 URL(路径 + query 参数) */
1247
- declare function buildUrl(path: string, params?: Record<string, string | undefined>): string;
1248
- //#endregion
1249
- //#region ../core/src/utils/uuid.d.ts
1250
- /**
1251
- * UUID v4 生成器
1252
- */
1253
- declare function generateUuid(): string;
1254
- //#endregion
1255
- //#region ../core/src/middleware/context.d.ts
1256
- interface ServerContextOptions {
1257
- url: string;
1258
- intent: Intent;
1259
- container: Container;
1260
- /** 原始 Request 对象(提取 cookie 和 header) */
1261
- request?: Request;
1262
- }
1263
- /** 从 Request 对象构建服务端上下文 */
1264
- declare function createServerContext(options: ServerContextOptions): NavigationContext;
1265
- interface BrowserContextOptions {
1266
- url: string;
1267
- intent: Intent;
1268
- container: Container;
1269
- }
1270
- /** 从 document.cookie 构建浏览器端上下文 */
1271
- declare function createBrowserContext(options: BrowserContextOptions): NavigationContext;
1272
- //#endregion
1273
- //#region ../core/src/middleware/pipeline.d.ts
1274
- /** 执行 beforeLoad 守卫链 */
1275
- declare function runBeforeLoadGuards(guards: BeforeLoadGuard[], ctx: NavigationContext): Promise<MiddlewareResult>;
1276
- /** 执行 afterLoad 守卫链 */
1277
- declare function runAfterLoadGuards(guards: AfterLoadGuard[], ctx: PostLoadContext): Promise<MiddlewareResult>;
1278
- //#endregion
1279
- //#region ../core/src/metrics/composite-recorder.d.ts
1280
- declare class CompositeEventRecorder implements EventRecorder {
1281
- private readonly recorders;
1282
- constructor(recorders: EventRecorder[]);
1283
- record(type: string, fields?: Record<string, unknown>): void;
1284
- flush(): Promise<void>;
1285
- destroy(): void;
1286
- }
1287
- //#endregion
1288
- //#region ../core/src/metrics/console-recorder.d.ts
1289
- declare class ConsoleEventRecorder implements EventRecorder {
1290
- private readonly prefix;
1291
- constructor(prefix?: string);
1292
- record(type: string, fields?: Record<string, unknown>): void;
1293
- flush(): Promise<void>;
1294
- destroy(): void;
1295
- }
1296
- //#endregion
1297
- //#region ../core/src/metrics/impression-observer.d.ts
1298
- interface ImpressionObserverOptions {
1299
- /** 可见比例阈值(0~1),默认 0.5 */
1300
- threshold?: number;
1301
- /** 最小可见时长(毫秒),默认 1000 */
1302
- minVisibleDuration?: number;
1303
- }
1304
- declare class IntersectionImpressionObserver implements ImpressionObserver {
1305
- private readonly observer;
1306
- private readonly tracked;
1307
- private readonly captured;
1308
- private readonly minDuration;
1309
- constructor(options?: ImpressionObserverOptions);
1310
- observe(element: Element, id: string, metadata?: Record<string, unknown>): void;
1311
- unobserve(element: Element): void;
1312
- consume(): ImpressionEntry[];
1313
- destroy(): void;
1314
- }
1315
- //#endregion
1316
- //#region ../core/src/metrics/void-recorder.d.ts
1317
- declare class VoidEventRecorder implements EventRecorder {
1318
- record(): void;
1319
- flush(): Promise<void>;
1320
- destroy(): void;
1321
- }
1322
- //#endregion
1323
- //#region ../core/src/metrics/with-fields-recorder.d.ts
1324
- declare class WithFieldsRecorder implements EventRecorder {
1325
- private readonly inner;
1326
- private readonly providers;
1327
- constructor(inner: EventRecorder, providers: MetricsFieldsProvider[]);
1328
- record(type: string, fields?: Record<string, unknown>): void;
1329
- flush(): Promise<void>;
1330
- destroy(): void;
1331
- }
1332
- //#endregion
1333
- //#region ../core/src/i18n/interpolate.d.ts
1334
- /**
1335
- * ICU 消息格式插值
1336
- *
1337
- * 支持 `{name}` 占位符替换和基础复数规则。
1338
- */
1339
- /** 将 `{key}` 占位符替换为 values 中的对应值 */
1340
- declare function interpolate(template: string, values?: Record<string, string | number>): string;
1341
- /**
1342
- * CLDR 复数类别
1343
- *
1344
- * 简化版:覆盖 zero / one / two / few / many / other。
1345
- * 完整 CLDR 规则可通过 PluralRuleProvider 注入。
1346
- */
1347
- type PluralCategory = "zero" | "one" | "two" | "few" | "many" | "other";
1348
- /** 复数规则函数 — 给定数量返回复数类别 */
1349
- type PluralRuleProvider = (count: number) => PluralCategory;
1350
- /**
1351
- * 英语复数规则(默认)
1352
- * 0 → other, 1 → one, 2+ → other
1353
- */
1354
- declare function englishPlural(count: number): PluralCategory;
1355
- /**
1356
- * 解析带复数后缀的翻译 key
1357
- *
1358
- * 约定: `key.one`, `key.other`, `key.zero`, etc.
1359
- */
1360
- declare function resolvePluralKey(key: string, category: PluralCategory): string;
1361
- //#endregion
1362
- //#region ../core/src/i18n/locale.d.ts
1363
- /** 检测语言是否为 RTL */
1364
- declare function isRtl(language: string): boolean;
1365
- /** 获取文本方向 */
1366
- declare function getTextDirection(language: string): TextDirection;
1367
- /**
1368
- * 从语言代码生成 HTML lang/dir 属性
1369
- *
1370
- * @example
1371
- * ```ts
1372
- * getLocaleAttributes("ar-SA") // { lang: "ar-SA", dir: "rtl" }
1373
- * getLocaleAttributes("en-US") // { lang: "en-US", dir: "ltr" }
1374
- * ```
1375
- */
1376
- declare function getLocaleAttributes(language: string): LocaleAttributes;
1377
- /**
1378
- * 构建 LocaleInfo
1379
- *
1380
- * @param language - 语言代码(如 "zh-Hans")
1381
- * @param region - 地区代码(如 "CN"),可选
1382
- */
1383
- declare function makeLocaleInfo(language: string, region?: string): LocaleInfo;
1384
- /**
1385
- * 将 locale 属性应用到 `<html>` 元素
1386
- *
1387
- * 服务端渲染时可用于字符串拼接,浏览器端直接操作 DOM。
1388
- */
1389
- declare function setHtmlLocaleAttributes(attrs: LocaleAttributes): void;
1390
- /**
1391
- * 从 URL 前缀中提取 locale
1392
- *
1393
- * @param url - 请求 URL(如 "/zh/about")
1394
- * @param supportedLocales - 支持的 locale 列表(如 ["zh", "en", "ja"])
1395
- * @returns 匹配时返回 `{ locale, strippedUrl }`,不匹配返回 null
1396
- *
1397
- * @example
1398
- * ```ts
1399
- * resolveLocaleFromUrl("/zh/about", ["zh", "en"])
1400
- * // → { locale: "zh", strippedUrl: "/about" }
1401
- *
1402
- * resolveLocaleFromUrl("/about", ["zh", "en"])
1403
- * // → null
1404
- * ```
1405
- */
1406
- declare function resolveLocaleFromUrl(url: string, supportedLocales: string[]): {
1407
- locale: string;
1408
- strippedUrl: string;
1409
- } | null;
1410
- //#endregion
1411
- //#region ../core/src/i18n/translator.d.ts
1412
- interface SimpleTranslatorOptions {
1413
- /** 翻译映射 */
1414
- messages: Record<string, string>;
1415
- /** 当前 locale */
1416
- locale: string;
1417
- /** 复数规则函数(默认英语规则) */
1418
- pluralRule?: PluralRuleProvider;
1419
- /** 找不到翻译时的回退行为(默认返回 key) */
1420
- fallback?: (key: string) => string;
1421
- }
1422
- declare class SimpleTranslator implements Translator {
1423
- readonly locale: string;
1424
- private readonly messages;
1425
- private readonly pluralRule;
1426
- private readonly fallback;
1427
- constructor(options: SimpleTranslatorOptions);
1428
- t(key: string, values?: Record<string, string | number>): string;
1429
- plural(key: string, count: number, values?: Record<string, string | number>): string;
1430
- }
1431
- //#endregion
1432
- //#region ../browser/src/action-handlers/external-url-action.d.ts
1433
- interface ExternalUrlDependencies {
1434
- framework: Framework;
1435
- log: Logger;
1436
- }
1437
- declare function registerExternalUrlHandler(deps: ExternalUrlDependencies): void;
1438
- //#endregion
1439
- //#region ../browser/src/action-handlers/flow-action.d.ts
1440
- /** UI 框架回调 — 解耦 Svelte store 等依赖 */
1441
- interface FlowActionCallbacks {
1442
- /** 导航后更新当前路径(替代 currentPath.set()) */
1443
- onNavigate(pathname: string): void;
1444
- /** 模态页面展示(替代 openModal()) */
1445
- onModal(page: BasePage): void;
1446
- }
1447
- /** 注册 FlowAction handler 所需的依赖 */
1448
- interface FlowActionDependencies {
1449
- framework: Framework;
1450
- log: Logger;
1451
- callbacks: FlowActionCallbacks;
1452
- /** 更新应用 UI 的回调,page 可以是 Promise */
1453
- updateApp: (props: {
1454
- page: Promise<BasePage> | BasePage;
1455
- isFirstPage?: boolean;
1456
- }) => void;
1457
- /** 获取可滚动页面元素,用于滚动位置保存/恢复 */
1458
- getScrollablePageElement?: () => HTMLElement | null;
1459
- }
1460
- declare function registerFlowActionHandler(deps: FlowActionDependencies): void;
1461
- //#endregion
1462
- //#region ../browser/src/action-handlers/register.d.ts
1463
- interface ActionHandlerDependencies {
1464
- framework: Framework;
1465
- log: Logger;
1466
- callbacks: FlowActionCallbacks;
1467
- updateApp: (props: {
1468
- page: Promise<BasePage> | BasePage;
1469
- isFirstPage?: boolean;
1470
- }) => void;
1471
- /** 获取可滚动页面元素,用于滚动位置保存/恢复 */
1472
- getScrollablePageElement?: () => HTMLElement | null;
1473
- }
1474
- declare function registerActionHandlers(deps: ActionHandlerDependencies): void;
1475
- //#endregion
1476
- //#region ../browser/src/start-app.d.ts
1477
- interface BrowserAppConfig {
1478
- /** 注册 controllers 和路由的引导函数 */
1479
- bootstrap: (framework: Framework) => void;
1480
- /** DOM 挂载点 ID(默认 "app") */
1481
- mountId?: string;
1482
- /** 获取可滚动页面元素,用于滚动位置保存/恢复 */
1483
- getScrollablePageElement?: () => HTMLElement | null;
1484
- /**
1485
- * 启动前钩子 — 在 Framework 创建后、挂载前执行
1486
- *
1487
- * 用于初始化错误监控、埋点 SDK、i18n 等。
1488
- */
1489
- onBeforeStart?: (framework: Framework) => void | Promise<void>;
1490
- /**
1491
- * 启动后钩子 — 在初始页面触发后执行
1492
- *
1493
- * 用于启动后操作(如 service worker 注册、性能打点)。
1494
- */
1495
- onAfterStart?: (framework: Framework) => void | Promise<void>;
1496
- /**
1497
- * 挂载应用到 DOM
1498
- *
1499
- * 框架无关 — Svelte / React / Vue 均可通过此回调实现。
1500
- *
1501
- * @param target - DOM 挂载点
1502
- * @param context - Framework 实例 + 语言
1503
- * @returns 更新函数,用于后续页面切换
1504
- */
1505
- mount: (target: HTMLElement, context: {
1506
- framework: Framework;
1507
- }) => (props: {
1508
- page: Promise<BasePage> | BasePage;
1509
- isFirstPage?: boolean;
1510
- }) => void;
1511
- /** FlowAction / ExternalUrl 回调 */
1512
- callbacks: FlowActionCallbacks;
1513
- /**
1514
- * Framework 配置 — locale、reportCallback、eventRecorder 等
1515
- *
1516
- * 传入后会在 Framework.create() 时合并。
1517
- * prefetchedIntents 由框架自动从 DOM 提取,无需传入。
1518
- */
1519
- frameworkConfig?: Omit<FrameworkConfig, "prefetchedIntents">;
1520
- /**
1521
- * 异步加载当前 locale 的翻译字典。
1522
- *
1523
- * 显式传入时会覆盖 bootstrap / Vite 自动生成的 loader。
1524
- */
1525
- loadMessages?: MessagesLoader;
1526
- }
1527
- /**
1528
- * 启动客户端应用
1529
- *
1530
- * 自动执行 hydration 全流程。
1531
- */
1532
- declare function startBrowserApp(config: BrowserAppConfig): Promise<void>;
1533
- //#endregion
1534
- //#region ../browser/src/utils/history.d.ts
1535
- interface HistoryOptions {
1536
- getScrollablePageElement: () => HTMLElement | null;
1537
- }
1538
- declare class History<State> {
1539
- private readonly entries;
1540
- private readonly log;
1541
- private readonly getScrollablePageElement;
1542
- private currentStateId;
1543
- constructor(log: Logger, options: HistoryOptions, sizeLimit?: number);
1544
- replaceState(state: State, url: string): void;
1545
- pushState(state: State, url: string): void;
1546
- beforeTransition(): void;
1547
- onPopState(listener: (url: string, state?: State) => void | Promise<void>): void;
1548
- /** 仅推入 URL,不缓存页面状态(用于页面加载失败场景) */
1549
- pushUrl(url: string): void;
1550
- /** 仅替换 URL,不缓存页面状态(用于页面加载失败场景) */
1551
- replaceUrl(url: string): void;
1552
- updateState(update: (current?: State) => State): void;
1553
- private get scrollTop();
1554
- private set scrollTop(value);
1555
- }
1556
- //#endregion
1557
- //#region ../browser/src/utils/try-scroll.d.ts
1558
- declare function tryScroll(log: Logger, getScrollableElement: () => HTMLElement | null, scrollY: number): void;
1559
- //#endregion
1560
- //#region ../browser/src/server-data.d.ts
1561
- /**
1562
- * 从 DOM 反序列化服务端嵌入的数据。
1563
- * 读取 `<script id="serialized-server-data">` 的内容并移除标签。
1564
- */
1565
- declare function deserializeServerData(): PrefetchedIntent[] | undefined;
1566
- /**
1567
- * 从 DOM 提取 SSR 数据并构建 PrefetchedIntents 实例。
1568
- * 替代原来的 PrefetchedIntents.fromDom()。
1569
- */
1570
- declare function createPrefetchedIntentsFromDom(): PrefetchedIntents;
1571
- //#endregion
1572
- export { RenderMode as $, BaseLogger as $n, RouteAddOptions as $t, IntersectionImpressionObserver as A, DEP_KEYS as An, Translator as At, buildUrl as B, TranslationMessages as Bn, ParamsFor as Bt, PluralRuleProvider as C, BasePage as Cn, Framework as Ct, WithFieldsRecorder as D, markPublic as Dn, LocaleAttributes as Dt, resolvePluralKey as E, isPublicMarked as En, PrefetchedIntents as Et, BrowserContextOptions as F, Net as Fn, CompositeLogger as Ft, PWADisplayMode as G, EventRecorder as Gn, NumOptions as Gt, removeHost as H, resolveMessages as Hn, StripOptional as Ht, ServerContextOptions as I, Storage as In, CompositeLoggerFactory as It, Optional as J, MetricsFieldsProvider as Jn, int as Jt, getPWADisplayMode as K, ImpressionEntry as Kn, StrOptions as Kt, createBrowserContext as L, makeDependencies as Ln, ExtractParamNames as Lt, CompositeEventRecorder as M, FeatureFlagsProvider as Mn, shouldLog as Mt, runAfterLoadGuards as N, MakeDependenciesOptions as Nn, ConsoleLogger as Nt, VoidEventRecorder as O, RequestScopedKey as On, LocaleInfo as Ot, runBeforeLoadGuards as P, MetricsRecorder as Pn, ConsoleLoggerFactory as Pt, DefineRoutesOptions as Q, ReportingLoggerOptions as Qn, uuid as Qt, createServerContext as R, MessagesLoader as Rn, InferParams as Rt, PluralCategory as S, BASE_PAGE_FIELDS as Sn, safeErrorPage as St, interpolate as T, getPublicFields as Tn, PrefetchedIntent as Tt, removeQueryParams as U, PlatformInfo as Un, optional as Ut, getBaseUrl as V, resolveConfiguredMessages as Vn, QuerySchemaMap as Vt, removeScheme as W, detectPlatform as Wn, withDefault as Wt, isSome as X, ReportingLogger as Xn, oneOf as Xt, isNone as Y, ReportCallback as Yn, num as Yt, LruMap as Z, ReportingLoggerFactory as Zn, str as Zt, getTextDirection as _, RewriteResult as _n, isFlowAction as _r, ResponseInterceptor as _t, BrowserAppConfig as a, StandardResult as an, Intent as ar, mapEach as at, resolveLocaleFromUrl as b, redirect as bn, BaseShelf as bt, registerActionHandlers as c, runStandard as cn, ActionDispatcher as cr, BaseController as ct, registerFlowActionHandler as d, DenyResult as dn, Action as dr, classifyUrl as dt, RouteMatch as en, Logger as er, RouteDefinition as et, ExternalUrlDependencies as f, MiddlewareResult as fn, CompoundAction as fr, HostGuardError as ft, getLocaleAttributes as g, RedirectResult as gn, isExternalUrlAction as gr, RequestInterceptor as gt, SimpleTranslatorOptions as h, PostLoadContext as hn, isCompoundAction as hr, HttpError as ht, History as i, StandardIssue as in, IntentDispatcher as ir, Mapper as it, ConsoleEventRecorder as j, FeatureFlags as jn, resetFilterCache as jt, ImpressionObserverOptions as k, defineRequestScopedKey as kn, TextDirection as kt, FlowActionCallbacks as l, AfterLoadGuard as ln, ActionHandler as lr, HostCheckResult as lt, SimpleTranslator as m, NextResult as mn, FlowAction as mr, HttpClientConfig as mt, deserializeServerData as n, InferOutput as nn, SecureFetchOptions as nr, route as nt, startBrowserApp as o, StandardSchemaV1 as on, IntentController as or, pipe as ot, registerExternalUrlHandler as p, NavigationContext as pn, ExternalUrlAction as pr, HttpClient as pt, None as q, ImpressionObserver as qn, bool as qt, tryScroll as r, ParamSchema as rn, secureFetch as rr, AsyncMapper as rt, ActionHandlerDependencies as s, makeSchema as sn, Container as sr, pipeAsync as st, createPrefetchedIntentsFromDom as t, Router as tn, LoggerFactory as tr, defineRoutes as tt, FlowActionDependencies as u, BeforeLoadGuard as un, ACTION_KINDS as ur, classifyHost as ut, isRtl as v, deny as vn, makeExternalUrlAction as vr, stableStringify as vt, englishPlural as w, FINESOFT_PUBLIC as wn, FrameworkConfig as wt, setHtmlLocaleAttributes as x, rewrite as xn, SafeErrorPageOptions as xt, makeLocaleInfo as y, next as yn, makeFlowAction as yr, BaseItem as yt, generateUuid as z, MessagesLoaderContext as zn, InferQuery as zt };
1573
- //# sourceMappingURL=server-data-DQzknR97.d.mts.map