@djvlc/contracts-types 1.0.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.
- package/dist/index.d.mts +1958 -0
- package/dist/index.d.ts +1958 -0
- package/dist/index.js +697 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +643 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +59 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,1958 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 协议版本常量
|
|
3
|
+
* 用于标识当前 schema 版本,支持版本迁移
|
|
4
|
+
*/
|
|
5
|
+
/** 当前页面 Schema 版本 */
|
|
6
|
+
declare const PAGE_SCHEMA_VERSION = "1.0.0";
|
|
7
|
+
/** 当前组件 Meta Schema 版本 */
|
|
8
|
+
declare const COMPONENT_META_SCHEMA_VERSION = "1.0.0";
|
|
9
|
+
/** 当前 Action 规范版本 */
|
|
10
|
+
declare const ACTION_SPEC_VERSION = "1.0.0";
|
|
11
|
+
/** 当前 Data Query 规范版本 */
|
|
12
|
+
declare const DATA_QUERY_SPEC_VERSION = "1.0.0";
|
|
13
|
+
/** 协议版本信息 */
|
|
14
|
+
interface ContractsVersion {
|
|
15
|
+
pageSchema: string;
|
|
16
|
+
componentMeta: string;
|
|
17
|
+
actionSpec: string;
|
|
18
|
+
dataQuerySpec: string;
|
|
19
|
+
}
|
|
20
|
+
/** 获取当前协议版本 */
|
|
21
|
+
declare function getContractsVersion(): ContractsVersion;
|
|
22
|
+
/**
|
|
23
|
+
* 检查版本兼容性
|
|
24
|
+
* @param required 要求的版本
|
|
25
|
+
* @param current 当前版本
|
|
26
|
+
* @returns 是否兼容
|
|
27
|
+
*/
|
|
28
|
+
declare function isVersionCompatible(required: string, current: string): boolean;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* 错误码规范
|
|
32
|
+
* 统一的错误码定义,用于 Action Gateway / Data Proxy / Runtime
|
|
33
|
+
*/
|
|
34
|
+
/** 错误码枚举 */
|
|
35
|
+
declare enum ErrorCode {
|
|
36
|
+
UNKNOWN = 1000,
|
|
37
|
+
INVALID_REQUEST = 1001,
|
|
38
|
+
UNAUTHORIZED = 1002,
|
|
39
|
+
FORBIDDEN = 1003,
|
|
40
|
+
NOT_FOUND = 1004,
|
|
41
|
+
RATE_LIMITED = 1005,
|
|
42
|
+
VALIDATION_ERROR = 1006,
|
|
43
|
+
INTERNAL_ERROR = 1007,
|
|
44
|
+
SERVICE_UNAVAILABLE = 1008,
|
|
45
|
+
TIMEOUT = 1009,
|
|
46
|
+
ACTION_NOT_FOUND = 2001,
|
|
47
|
+
ACTION_INVALID_PARAMS = 2002,
|
|
48
|
+
ACTION_EXECUTION_FAILED = 2003,
|
|
49
|
+
ACTION_IDEMPOTENCY_CONFLICT = 2004,
|
|
50
|
+
ACTION_BLOCKED = 2005,
|
|
51
|
+
ACTION_RISK_REJECTED = 2006,
|
|
52
|
+
ACTION_EXPIRED = 2007,
|
|
53
|
+
ACTION_QUOTA_EXCEEDED = 2008,
|
|
54
|
+
QUERY_NOT_FOUND = 3001,
|
|
55
|
+
QUERY_INVALID_PARAMS = 3002,
|
|
56
|
+
QUERY_EXECUTION_FAILED = 3003,
|
|
57
|
+
QUERY_FIELD_NOT_ALLOWED = 3004,
|
|
58
|
+
QUERY_TIMEOUT = 3005,
|
|
59
|
+
QUERY_DISABLED = 3006,
|
|
60
|
+
COMPONENT_NOT_FOUND = 4001,
|
|
61
|
+
COMPONENT_VERSION_NOT_FOUND = 4002,
|
|
62
|
+
COMPONENT_BLOCKED = 4003,
|
|
63
|
+
COMPONENT_INTEGRITY_MISMATCH = 4004,
|
|
64
|
+
COMPONENT_INCOMPATIBLE = 4005,
|
|
65
|
+
COMPONENT_LOAD_FAILED = 4006,
|
|
66
|
+
COMPONENT_RENDER_ERROR = 4007,
|
|
67
|
+
PAGE_NOT_FOUND = 5001,
|
|
68
|
+
PAGE_VERSION_NOT_FOUND = 5002,
|
|
69
|
+
PAGE_SCHEMA_INVALID = 5003,
|
|
70
|
+
PAGE_MANIFEST_INVALID = 5004,
|
|
71
|
+
PAGE_PUBLISH_FAILED = 5005,
|
|
72
|
+
PAGE_ROLLBACK_FAILED = 5006,
|
|
73
|
+
ACTIVITY_NOT_FOUND = 6001,
|
|
74
|
+
ACTIVITY_NOT_STARTED = 6002,
|
|
75
|
+
ACTIVITY_ENDED = 6003,
|
|
76
|
+
ACTIVITY_ALREADY_CLAIMED = 6004,
|
|
77
|
+
ACTIVITY_ALREADY_SIGNED = 6005,
|
|
78
|
+
ACTIVITY_LIMIT_EXCEEDED = 6006,
|
|
79
|
+
ACTIVITY_DISABLED = 6007,
|
|
80
|
+
EXPRESSION_SYNTAX_ERROR = 7001,
|
|
81
|
+
EXPRESSION_UNKNOWN_FUNCTION = 7002,
|
|
82
|
+
EXPRESSION_INVALID_ARGUMENT = 7003,
|
|
83
|
+
EXPRESSION_UNKNOWN_VARIABLE = 7004,
|
|
84
|
+
EXPRESSION_TYPE_MISMATCH = 7005,
|
|
85
|
+
EXPRESSION_ACCESS_DENIED = 7006,
|
|
86
|
+
SCHEMA_VERSION_MISMATCH = 8001,
|
|
87
|
+
MIGRATION_FAILED = 8002,
|
|
88
|
+
MIGRATION_NOT_FOUND = 8003,
|
|
89
|
+
VERSION_INCOMPATIBLE = 8004
|
|
90
|
+
}
|
|
91
|
+
/** 错误码分类 */
|
|
92
|
+
declare const ErrorCodeCategory: {
|
|
93
|
+
GENERAL: readonly [1000, 1999];
|
|
94
|
+
ACTION: readonly [2000, 2999];
|
|
95
|
+
QUERY: readonly [3000, 3999];
|
|
96
|
+
COMPONENT: readonly [4000, 4999];
|
|
97
|
+
PAGE: readonly [5000, 5999];
|
|
98
|
+
ACTIVITY: readonly [6000, 6999];
|
|
99
|
+
EXPRESSION: readonly [7000, 7999];
|
|
100
|
+
VERSION: readonly [8000, 8999];
|
|
101
|
+
};
|
|
102
|
+
/** 错误信息映射 */
|
|
103
|
+
declare const ErrorMessages: Record<ErrorCode, string>;
|
|
104
|
+
/** DJV 错误对象 */
|
|
105
|
+
interface DjvlcError {
|
|
106
|
+
code: ErrorCode;
|
|
107
|
+
message: string;
|
|
108
|
+
details?: Record<string, unknown>;
|
|
109
|
+
traceId?: string;
|
|
110
|
+
timestamp?: number;
|
|
111
|
+
}
|
|
112
|
+
/** 创建 DJV 错误 */
|
|
113
|
+
declare function createDjvlcError(code: ErrorCode, details?: Record<string, unknown>, traceId?: string): DjvlcError;
|
|
114
|
+
/** 根据错误码获取 HTTP 状态码 */
|
|
115
|
+
declare function getHttpStatusFromErrorCode(code: ErrorCode): number;
|
|
116
|
+
/** 检查是否为可重试错误 */
|
|
117
|
+
declare function isRetryableError(code: ErrorCode): boolean;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* 通用类型定义
|
|
121
|
+
* 跨模块使用的基础类型
|
|
122
|
+
*/
|
|
123
|
+
/**
|
|
124
|
+
* 低代码操作类型
|
|
125
|
+
* 用于审计日志记录
|
|
126
|
+
*/
|
|
127
|
+
type LowcodeAction = 'CREATE' | 'UPDATE' | 'DELETE' | 'PUBLISH' | 'UNPUBLISH' | 'DUPLICATE' | 'RESTORE' | 'ARCHIVE' | 'UNARCHIVE' | 'SAVE_VERSION' | 'ROLLBACK_VERSION' | 'USE_TEMPLATE' | 'BLOCK' | 'UNBLOCK';
|
|
128
|
+
/**
|
|
129
|
+
* 操作用户信息
|
|
130
|
+
* 用于记录谁执行了操作
|
|
131
|
+
*/
|
|
132
|
+
interface OperatorInfo {
|
|
133
|
+
uid: string;
|
|
134
|
+
username: string;
|
|
135
|
+
role?: string;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* 排序方向
|
|
139
|
+
*/
|
|
140
|
+
type SortOrder = 'ASC' | 'DESC' | 'asc' | 'desc';
|
|
141
|
+
/**
|
|
142
|
+
* 通用排序配置
|
|
143
|
+
*/
|
|
144
|
+
interface SortConfig<T extends string = string> {
|
|
145
|
+
/** 排序字段 */
|
|
146
|
+
field: T;
|
|
147
|
+
/** 排序方向 */
|
|
148
|
+
order: SortOrder;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* 分页查询参数
|
|
152
|
+
*/
|
|
153
|
+
interface PaginationParams {
|
|
154
|
+
/** 页码(从 1 开始) */
|
|
155
|
+
page?: number;
|
|
156
|
+
/** 每页数量 */
|
|
157
|
+
pageSize?: number;
|
|
158
|
+
/** 偏移量(与 page 二选一) */
|
|
159
|
+
offset?: number;
|
|
160
|
+
/** 限制数量 */
|
|
161
|
+
limit?: number;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* 分页结果元数据
|
|
165
|
+
*/
|
|
166
|
+
interface PaginationMeta {
|
|
167
|
+
/** 当前页码 */
|
|
168
|
+
page: number;
|
|
169
|
+
/** 每页数量 */
|
|
170
|
+
pageSize: number;
|
|
171
|
+
/** 总数量 */
|
|
172
|
+
total: number;
|
|
173
|
+
/** 总页数 */
|
|
174
|
+
totalPages: number;
|
|
175
|
+
/** 是否有下一页 */
|
|
176
|
+
hasNext: boolean;
|
|
177
|
+
/** 是否有上一页 */
|
|
178
|
+
hasPrev: boolean;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* 分页结果
|
|
182
|
+
*/
|
|
183
|
+
interface PaginatedResult<T> {
|
|
184
|
+
/** 数据列表 */
|
|
185
|
+
items: T[];
|
|
186
|
+
/** 分页元数据 */
|
|
187
|
+
meta: PaginationMeta;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* 时间范围
|
|
191
|
+
*/
|
|
192
|
+
interface TimeRange {
|
|
193
|
+
/** 开始时间 */
|
|
194
|
+
startTime?: string;
|
|
195
|
+
/** 结束时间 */
|
|
196
|
+
endTime?: string;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* 通用键值对
|
|
200
|
+
*/
|
|
201
|
+
interface KeyValuePair<T = unknown> {
|
|
202
|
+
key: string;
|
|
203
|
+
value: T;
|
|
204
|
+
label?: string;
|
|
205
|
+
}
|
|
206
|
+
/** 页面 UID */
|
|
207
|
+
type PageUid = string;
|
|
208
|
+
/** 页面版本 ID */
|
|
209
|
+
type PageVersionId = string;
|
|
210
|
+
/** 组件版本 ID */
|
|
211
|
+
type ComponentVersionId = string;
|
|
212
|
+
/** Action Definition 版本 ID */
|
|
213
|
+
type ActionDefVersionId = string;
|
|
214
|
+
/** Data Query 版本 ID */
|
|
215
|
+
type DataQueryVersionId = string;
|
|
216
|
+
/** 追踪 ID */
|
|
217
|
+
type TraceId = string;
|
|
218
|
+
/**
|
|
219
|
+
* 通用状态
|
|
220
|
+
*/
|
|
221
|
+
type GenericStatus = 'active' | 'inactive' | 'pending' | 'archived';
|
|
222
|
+
/**
|
|
223
|
+
* 审计状态
|
|
224
|
+
*/
|
|
225
|
+
type AuditStatus = 'pending' | 'approved' | 'rejected';
|
|
226
|
+
/**
|
|
227
|
+
* 深度只读类型
|
|
228
|
+
*/
|
|
229
|
+
type DeepReadonly<T> = {
|
|
230
|
+
readonly [P in keyof T]: T[P] extends object ? DeepReadonly<T[P]> : T[P];
|
|
231
|
+
};
|
|
232
|
+
/**
|
|
233
|
+
* 可选属性类型
|
|
234
|
+
*/
|
|
235
|
+
type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
236
|
+
/**
|
|
237
|
+
* 必需属性类型
|
|
238
|
+
*/
|
|
239
|
+
type RequiredBy<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
|
|
240
|
+
/**
|
|
241
|
+
* 提取非空属性
|
|
242
|
+
*/
|
|
243
|
+
type NonNullableProperties<T> = {
|
|
244
|
+
[P in keyof T]: NonNullable<T[P]>;
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* 页面 Schema 类型定义
|
|
249
|
+
* 与 djvlc-platform @libs/contracts 保持一致
|
|
250
|
+
*/
|
|
251
|
+
/** 页面状态 */
|
|
252
|
+
type PageStatus = 'draft' | 'published';
|
|
253
|
+
/** 画布类型 */
|
|
254
|
+
type CanvasType = 'h5' | 'tablet' | 'pc';
|
|
255
|
+
/**
|
|
256
|
+
* 页面排序字段
|
|
257
|
+
*/
|
|
258
|
+
type PageSortField = 'id' | 'createdAt' | 'updatedAt' | 'publishedAt' | 'title' | 'viewCount' | 'sortOrder';
|
|
259
|
+
/** 发布渠道 */
|
|
260
|
+
type PublishChannel = 'preview' | 'prod' | 'gray';
|
|
261
|
+
/** 发布状态 */
|
|
262
|
+
declare enum PublishStatus {
|
|
263
|
+
PENDING = "pending",
|
|
264
|
+
PUBLISHING = "publishing",
|
|
265
|
+
SUCCESS = "success",
|
|
266
|
+
FAILED = "failed",
|
|
267
|
+
ROLLBACK = "rollback"
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* 模板分类
|
|
271
|
+
*/
|
|
272
|
+
type TemplateCategory = 'all' | 'ecommerce' | 'marketing' | 'corporate' | 'other';
|
|
273
|
+
/**
|
|
274
|
+
* 模板排序字段
|
|
275
|
+
*/
|
|
276
|
+
type TemplateSortField = 'id' | 'createdAt' | 'usageCount' | 'sortOrder';
|
|
277
|
+
/**
|
|
278
|
+
* 页面 Schema(核心)
|
|
279
|
+
* 存储在 Page 的 schema 字段中的完整结构
|
|
280
|
+
*/
|
|
281
|
+
interface PageSchema {
|
|
282
|
+
/** Schema 版本号 */
|
|
283
|
+
schemaVersion: string;
|
|
284
|
+
/** 页面配置 */
|
|
285
|
+
page: PageConfig;
|
|
286
|
+
/** 组件列表 */
|
|
287
|
+
components: ComponentInstance[];
|
|
288
|
+
/** 绑定的 ActionDefinition 版本 ID */
|
|
289
|
+
actionDefVersionIds?: string[];
|
|
290
|
+
/** 绑定的 DataQuery 版本 ID */
|
|
291
|
+
dataQueryVersionIds?: string[];
|
|
292
|
+
}
|
|
293
|
+
/** 页面配置 */
|
|
294
|
+
interface PageConfig {
|
|
295
|
+
id: string;
|
|
296
|
+
title: string;
|
|
297
|
+
description?: string;
|
|
298
|
+
canvas: CanvasConfig;
|
|
299
|
+
meta?: PageMeta;
|
|
300
|
+
variables?: Record<string, unknown>;
|
|
301
|
+
apis?: ApiConfig[];
|
|
302
|
+
}
|
|
303
|
+
/** 画布配置 */
|
|
304
|
+
interface CanvasConfig {
|
|
305
|
+
type: CanvasType;
|
|
306
|
+
width: number;
|
|
307
|
+
height?: number;
|
|
308
|
+
background?: string;
|
|
309
|
+
gridSize?: number;
|
|
310
|
+
showGrid?: boolean;
|
|
311
|
+
showRuler?: boolean;
|
|
312
|
+
guides?: Guide[];
|
|
313
|
+
}
|
|
314
|
+
/** 参考线 */
|
|
315
|
+
interface Guide {
|
|
316
|
+
id: string;
|
|
317
|
+
type: 'horizontal' | 'vertical';
|
|
318
|
+
position: number;
|
|
319
|
+
}
|
|
320
|
+
/** 页面元数据 */
|
|
321
|
+
interface PageMeta {
|
|
322
|
+
createTime?: string;
|
|
323
|
+
updateTime?: string;
|
|
324
|
+
author?: string;
|
|
325
|
+
version?: string;
|
|
326
|
+
tags?: string[];
|
|
327
|
+
status?: PageStatus;
|
|
328
|
+
}
|
|
329
|
+
/** API 配置 */
|
|
330
|
+
interface ApiConfig {
|
|
331
|
+
id: string;
|
|
332
|
+
name: string;
|
|
333
|
+
url: string;
|
|
334
|
+
method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
335
|
+
headers?: Record<string, string>;
|
|
336
|
+
params?: Record<string, unknown>;
|
|
337
|
+
body?: Record<string, unknown>;
|
|
338
|
+
timeout?: number;
|
|
339
|
+
autoRun?: boolean;
|
|
340
|
+
dependencies?: string[];
|
|
341
|
+
}
|
|
342
|
+
/** 组件实例(运行时数据) */
|
|
343
|
+
interface ComponentInstance {
|
|
344
|
+
id: string;
|
|
345
|
+
type: string;
|
|
346
|
+
name?: string;
|
|
347
|
+
props: Record<string, unknown>;
|
|
348
|
+
style: ComponentStyle;
|
|
349
|
+
layout?: ComponentLayout;
|
|
350
|
+
events?: ComponentEvent[];
|
|
351
|
+
visible?: boolean;
|
|
352
|
+
locked?: boolean;
|
|
353
|
+
children?: ComponentInstance[];
|
|
354
|
+
}
|
|
355
|
+
/** 组件样式 */
|
|
356
|
+
interface ComponentStyle {
|
|
357
|
+
width?: string | number;
|
|
358
|
+
height?: string | number;
|
|
359
|
+
minWidth?: string | number;
|
|
360
|
+
minHeight?: string | number;
|
|
361
|
+
maxWidth?: string | number;
|
|
362
|
+
maxHeight?: string | number;
|
|
363
|
+
margin?: string;
|
|
364
|
+
padding?: string;
|
|
365
|
+
color?: string;
|
|
366
|
+
backgroundColor?: string;
|
|
367
|
+
borderColor?: string;
|
|
368
|
+
border?: string;
|
|
369
|
+
borderWidth?: string | number;
|
|
370
|
+
borderStyle?: string;
|
|
371
|
+
borderRadius?: string | number;
|
|
372
|
+
fontSize?: string | number;
|
|
373
|
+
fontWeight?: string | number;
|
|
374
|
+
fontFamily?: string;
|
|
375
|
+
lineHeight?: string | number;
|
|
376
|
+
textAlign?: string;
|
|
377
|
+
position?: string;
|
|
378
|
+
top?: string | number;
|
|
379
|
+
right?: string | number;
|
|
380
|
+
bottom?: string | number;
|
|
381
|
+
left?: string | number;
|
|
382
|
+
zIndex?: number;
|
|
383
|
+
display?: string;
|
|
384
|
+
opacity?: number;
|
|
385
|
+
overflow?: string;
|
|
386
|
+
visibility?: string;
|
|
387
|
+
flexDirection?: string;
|
|
388
|
+
justifyContent?: string;
|
|
389
|
+
alignItems?: string;
|
|
390
|
+
flexWrap?: string;
|
|
391
|
+
flex?: string | number;
|
|
392
|
+
gap?: string | number;
|
|
393
|
+
gridTemplateColumns?: string;
|
|
394
|
+
gridTemplateRows?: string;
|
|
395
|
+
gridGap?: string | number;
|
|
396
|
+
transform?: string;
|
|
397
|
+
transformOrigin?: string;
|
|
398
|
+
transition?: string;
|
|
399
|
+
[key: string]: unknown;
|
|
400
|
+
}
|
|
401
|
+
/** 组件布局 */
|
|
402
|
+
interface ComponentLayout {
|
|
403
|
+
x?: number;
|
|
404
|
+
y?: number;
|
|
405
|
+
width?: number;
|
|
406
|
+
height?: number;
|
|
407
|
+
rotation?: number;
|
|
408
|
+
}
|
|
409
|
+
/** 组件事件 */
|
|
410
|
+
interface ComponentEvent {
|
|
411
|
+
id: string;
|
|
412
|
+
trigger: string;
|
|
413
|
+
actions: EventAction[];
|
|
414
|
+
enabled?: boolean;
|
|
415
|
+
condition?: string;
|
|
416
|
+
debounce?: number;
|
|
417
|
+
throttle?: number;
|
|
418
|
+
}
|
|
419
|
+
/** 事件动作 */
|
|
420
|
+
interface EventAction {
|
|
421
|
+
id: string;
|
|
422
|
+
type: string;
|
|
423
|
+
params: Record<string, unknown>;
|
|
424
|
+
enabled?: boolean;
|
|
425
|
+
delay?: number;
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* 灰度规则
|
|
429
|
+
*/
|
|
430
|
+
interface GrayRule {
|
|
431
|
+
/** 规则名称 */
|
|
432
|
+
name: string;
|
|
433
|
+
/** 规则类型 */
|
|
434
|
+
type: 'user' | 'ip' | 'header' | 'cookie' | 'custom';
|
|
435
|
+
/** 匹配条件 */
|
|
436
|
+
condition: string;
|
|
437
|
+
/** 是否启用 */
|
|
438
|
+
enabled: boolean;
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* 灰度发布配置
|
|
442
|
+
*/
|
|
443
|
+
interface GrayPublishConfig {
|
|
444
|
+
/** 灰度比例 (0-100) */
|
|
445
|
+
percentage?: number;
|
|
446
|
+
/** 白名单用户 UID */
|
|
447
|
+
whitelistUsers?: string[];
|
|
448
|
+
/** 白名单 IP */
|
|
449
|
+
whitelistIps?: string[];
|
|
450
|
+
/** 自定义规则 */
|
|
451
|
+
rules?: GrayRule[];
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* 发布配置
|
|
455
|
+
*/
|
|
456
|
+
interface PublishConfig {
|
|
457
|
+
/** 发布渠道 */
|
|
458
|
+
channel: PublishChannel;
|
|
459
|
+
/** 发布描述 */
|
|
460
|
+
description?: string;
|
|
461
|
+
/** 灰度配置(仅 gray 渠道) */
|
|
462
|
+
grayConfig?: GrayPublishConfig;
|
|
463
|
+
/** 是否自动发布(跳过审核) */
|
|
464
|
+
autoPublish?: boolean;
|
|
465
|
+
/** 定时发布时间 */
|
|
466
|
+
scheduledAt?: string;
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* 版本信息
|
|
470
|
+
*/
|
|
471
|
+
interface VersionInfo {
|
|
472
|
+
uid: string;
|
|
473
|
+
versionNumber: number;
|
|
474
|
+
versionLabel?: string;
|
|
475
|
+
description?: string;
|
|
476
|
+
isAutoSave: boolean;
|
|
477
|
+
isPublished: boolean;
|
|
478
|
+
createdAt: string;
|
|
479
|
+
createdBy: string;
|
|
480
|
+
createdByUsername: string;
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* 版本对比结果
|
|
484
|
+
*/
|
|
485
|
+
interface VersionDiff {
|
|
486
|
+
added: string[];
|
|
487
|
+
removed: string[];
|
|
488
|
+
modified: string[];
|
|
489
|
+
changeLog: Record<string, ChangeLogItem>;
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* 变更日志项
|
|
493
|
+
*/
|
|
494
|
+
interface ChangeLogItem {
|
|
495
|
+
/** 旧值 */
|
|
496
|
+
old: unknown;
|
|
497
|
+
/** 新值 */
|
|
498
|
+
new: unknown;
|
|
499
|
+
/** 摘要描述 */
|
|
500
|
+
summary?: string;
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* 变更日志
|
|
504
|
+
*/
|
|
505
|
+
type ChangeLog = Record<string, ChangeLogItem>;
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* 组件 Meta Schema 类型定义
|
|
509
|
+
* 定义每个组件版本必须包含的元数据
|
|
510
|
+
*/
|
|
511
|
+
/** JSON Schema 类型定义 */
|
|
512
|
+
interface JsonSchema {
|
|
513
|
+
type: 'string' | 'number' | 'boolean' | 'object' | 'array' | 'null';
|
|
514
|
+
title?: string;
|
|
515
|
+
description?: string;
|
|
516
|
+
default?: unknown;
|
|
517
|
+
enum?: unknown[];
|
|
518
|
+
properties?: Record<string, JsonSchema>;
|
|
519
|
+
items?: JsonSchema;
|
|
520
|
+
required?: string[];
|
|
521
|
+
minimum?: number;
|
|
522
|
+
maximum?: number;
|
|
523
|
+
minLength?: number;
|
|
524
|
+
maxLength?: number;
|
|
525
|
+
pattern?: string;
|
|
526
|
+
format?: string;
|
|
527
|
+
$ref?: string;
|
|
528
|
+
}
|
|
529
|
+
/** Props Schema - 组件属性定义 */
|
|
530
|
+
interface PropsSchema {
|
|
531
|
+
$schema?: string;
|
|
532
|
+
type: 'object';
|
|
533
|
+
title: string;
|
|
534
|
+
description?: string;
|
|
535
|
+
properties: Record<string, JsonSchema & {
|
|
536
|
+
/** 属性分组 */
|
|
537
|
+
group?: string;
|
|
538
|
+
/** 编辑器中的控件类型 */
|
|
539
|
+
'x-editor-widget'?: string;
|
|
540
|
+
/** 是否支持表达式绑定 */
|
|
541
|
+
'x-expression-enabled'?: boolean;
|
|
542
|
+
}>;
|
|
543
|
+
required?: string[];
|
|
544
|
+
}
|
|
545
|
+
/** 事件定义 */
|
|
546
|
+
interface EventDefinition {
|
|
547
|
+
/** 事件名称 */
|
|
548
|
+
name: string;
|
|
549
|
+
/** 事件显示名 */
|
|
550
|
+
label: string;
|
|
551
|
+
/** 事件描述 */
|
|
552
|
+
description?: string;
|
|
553
|
+
/** 事件参数 Schema */
|
|
554
|
+
payload?: JsonSchema;
|
|
555
|
+
}
|
|
556
|
+
/** 组件事件列表 */
|
|
557
|
+
interface EventsDefinition {
|
|
558
|
+
/** 事件版本 */
|
|
559
|
+
version: string;
|
|
560
|
+
/** 事件列表 */
|
|
561
|
+
events: EventDefinition[];
|
|
562
|
+
}
|
|
563
|
+
/** 组件能力声明 */
|
|
564
|
+
interface CapabilitiesDefinition {
|
|
565
|
+
/** 能力版本 */
|
|
566
|
+
version: string;
|
|
567
|
+
/** 是否需要用户登录态 */
|
|
568
|
+
requiresAuth?: boolean;
|
|
569
|
+
/** 是否需要执行 Action */
|
|
570
|
+
requiresAction?: boolean;
|
|
571
|
+
/** 需要的 Action 类型 */
|
|
572
|
+
actionTypes?: string[];
|
|
573
|
+
/** 是否需要 Data Query */
|
|
574
|
+
requiresDataQuery?: boolean;
|
|
575
|
+
/** 需要的 Query 类型 */
|
|
576
|
+
queryTypes?: string[];
|
|
577
|
+
/** 是否需要导航能力 */
|
|
578
|
+
requiresNavigation?: boolean;
|
|
579
|
+
/** 是否需要埋点能力 */
|
|
580
|
+
requiresTrack?: boolean;
|
|
581
|
+
/** 是否需要对话框能力 */
|
|
582
|
+
requiresDialog?: boolean;
|
|
583
|
+
/** 是否需要剪贴板能力 */
|
|
584
|
+
requiresClipboard?: boolean;
|
|
585
|
+
/** 自定义能力 */
|
|
586
|
+
custom?: string[];
|
|
587
|
+
}
|
|
588
|
+
/** 兼容性定义 */
|
|
589
|
+
interface CompatDefinition {
|
|
590
|
+
/** 兼容版本 */
|
|
591
|
+
version: string;
|
|
592
|
+
/** 最低运行时版本 */
|
|
593
|
+
minRuntime: string;
|
|
594
|
+
/** 最高运行时版本(可选) */
|
|
595
|
+
maxRuntime?: string;
|
|
596
|
+
/** 是否有破坏性变更 */
|
|
597
|
+
breaking?: boolean;
|
|
598
|
+
/** 破坏性变更说明 */
|
|
599
|
+
breakingChanges?: string[];
|
|
600
|
+
/** 从哪个版本可以无缝升级 */
|
|
601
|
+
upgradeFrom?: string[];
|
|
602
|
+
}
|
|
603
|
+
/** 组件分类 */
|
|
604
|
+
type ComponentCategory = 'basic' | 'form' | 'layout' | 'navigation' | 'feedback' | 'display' | 'data' | 'business' | 'chart' | 'other';
|
|
605
|
+
/** 组件分类列表(用于校验和 UI) */
|
|
606
|
+
declare const COMPONENT_CATEGORIES: ComponentCategory[];
|
|
607
|
+
/** SRI 完整性校验 */
|
|
608
|
+
interface IntegrityDefinition {
|
|
609
|
+
/** 完整性版本 */
|
|
610
|
+
version: string;
|
|
611
|
+
/** 主入口文件哈希 */
|
|
612
|
+
main: string;
|
|
613
|
+
/** 所有文件哈希 */
|
|
614
|
+
files: Record<string, string>;
|
|
615
|
+
/** 生成时间 */
|
|
616
|
+
generatedAt: string;
|
|
617
|
+
/** 哈希算法 */
|
|
618
|
+
algorithm: 'sha256' | 'sha384' | 'sha512';
|
|
619
|
+
}
|
|
620
|
+
/** 组件状态 */
|
|
621
|
+
type ComponentStatus = 'draft' | 'canary' | 'stable' | 'deprecated' | 'blocked';
|
|
622
|
+
/** 组件版本元数据(完整) */
|
|
623
|
+
interface ComponentMeta {
|
|
624
|
+
/** 组件名称 */
|
|
625
|
+
name: string;
|
|
626
|
+
/** 组件版本 */
|
|
627
|
+
version: string;
|
|
628
|
+
/** 显示名称 */
|
|
629
|
+
label: string;
|
|
630
|
+
/** 组件描述 */
|
|
631
|
+
description?: string;
|
|
632
|
+
/** 组件图标 */
|
|
633
|
+
icon?: string;
|
|
634
|
+
/** 组件分类 */
|
|
635
|
+
category: ComponentCategory;
|
|
636
|
+
/** 组件标签 */
|
|
637
|
+
tags?: string[];
|
|
638
|
+
/** 组件作者 */
|
|
639
|
+
author?: string;
|
|
640
|
+
/** 属性定义 */
|
|
641
|
+
props: PropsSchema;
|
|
642
|
+
/** 事件定义 */
|
|
643
|
+
events: EventsDefinition;
|
|
644
|
+
/** 能力声明 */
|
|
645
|
+
capabilities: CapabilitiesDefinition;
|
|
646
|
+
/** 兼容性 */
|
|
647
|
+
compat: CompatDefinition;
|
|
648
|
+
/** 完整性校验 */
|
|
649
|
+
integrity: IntegrityDefinition;
|
|
650
|
+
/** 组件状态 */
|
|
651
|
+
status: ComponentStatus;
|
|
652
|
+
/** 预览图 */
|
|
653
|
+
preview?: string;
|
|
654
|
+
/** 入口文件(相对路径) */
|
|
655
|
+
entry: string;
|
|
656
|
+
/** 样式文件(相对路径) */
|
|
657
|
+
styles?: string[];
|
|
658
|
+
}
|
|
659
|
+
/** Registry 中的组件版本记录 */
|
|
660
|
+
interface ComponentVersionRecord {
|
|
661
|
+
/** 组件 ID */
|
|
662
|
+
componentId: string;
|
|
663
|
+
/** 组件名称 */
|
|
664
|
+
name: string;
|
|
665
|
+
/** 版本号 */
|
|
666
|
+
version: string;
|
|
667
|
+
/** CDN 入口 URL */
|
|
668
|
+
entryUrl: string;
|
|
669
|
+
/** 元数据 */
|
|
670
|
+
meta: ComponentMeta;
|
|
671
|
+
/** 状态 */
|
|
672
|
+
status: ComponentStatus;
|
|
673
|
+
/** 发布时间 */
|
|
674
|
+
publishedAt: string;
|
|
675
|
+
/** 发布者 */
|
|
676
|
+
publishedBy: string;
|
|
677
|
+
/** 阻断信息(如果被阻断) */
|
|
678
|
+
blockInfo?: {
|
|
679
|
+
reason: string;
|
|
680
|
+
blockedAt: string;
|
|
681
|
+
blockedBy: string;
|
|
682
|
+
};
|
|
683
|
+
}
|
|
684
|
+
/** Manifest 中的组件引用 */
|
|
685
|
+
interface ManifestItem {
|
|
686
|
+
/** 组件名称 */
|
|
687
|
+
name: string;
|
|
688
|
+
/** 组件版本 */
|
|
689
|
+
version: string;
|
|
690
|
+
/** 入口 URL */
|
|
691
|
+
entryUrl: string;
|
|
692
|
+
/** SRI 哈希 */
|
|
693
|
+
integrity: string;
|
|
694
|
+
/** 是否必须成功加载 */
|
|
695
|
+
critical?: boolean;
|
|
696
|
+
}
|
|
697
|
+
/** 页面 Manifest */
|
|
698
|
+
interface PageManifest {
|
|
699
|
+
/** Manifest 版本 */
|
|
700
|
+
manifestVersion: string;
|
|
701
|
+
/** 内容哈希 */
|
|
702
|
+
contentHash: string;
|
|
703
|
+
/** 运行时版本 */
|
|
704
|
+
runtimeVersion: string;
|
|
705
|
+
/** 组件清单 */
|
|
706
|
+
components: ManifestItem[];
|
|
707
|
+
/** 生成时间 */
|
|
708
|
+
generatedAt: string;
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
/**
|
|
712
|
+
* Action 规范类型定义
|
|
713
|
+
* 用于 Action Gateway 的动作执行
|
|
714
|
+
*/
|
|
715
|
+
/** 内置动作类型 */
|
|
716
|
+
type BuiltinActionType = 'claim' | 'signin' | 'lottery' | 'reserve' | 'share' | 'navigate' | 'track' | 'custom';
|
|
717
|
+
/** 动作执行请求 */
|
|
718
|
+
interface ActionExecuteRequest {
|
|
719
|
+
/** 动作类型 */
|
|
720
|
+
actionType: string;
|
|
721
|
+
/** 动作参数 */
|
|
722
|
+
params: Record<string, unknown>;
|
|
723
|
+
/** 上下文 */
|
|
724
|
+
context: ActionContext;
|
|
725
|
+
/** 幂等键 */
|
|
726
|
+
idempotencyKey?: string;
|
|
727
|
+
}
|
|
728
|
+
/** 动作上下文 */
|
|
729
|
+
interface ActionContext {
|
|
730
|
+
/** 页面版本 ID */
|
|
731
|
+
pageVersionId?: string;
|
|
732
|
+
/** 组件版本 */
|
|
733
|
+
componentVersion?: string;
|
|
734
|
+
/** 用户 ID */
|
|
735
|
+
uid?: string;
|
|
736
|
+
/** 设备 ID */
|
|
737
|
+
deviceId?: string;
|
|
738
|
+
/** 渠道 */
|
|
739
|
+
channel?: string;
|
|
740
|
+
/** 追踪 ID */
|
|
741
|
+
traceId?: string;
|
|
742
|
+
/** 扩展数据 */
|
|
743
|
+
extra?: Record<string, unknown>;
|
|
744
|
+
}
|
|
745
|
+
/** 动作执行响应 */
|
|
746
|
+
interface ActionExecuteResponse<T = unknown> {
|
|
747
|
+
/** 是否成功 */
|
|
748
|
+
success: boolean;
|
|
749
|
+
/** 响应数据 */
|
|
750
|
+
data?: T;
|
|
751
|
+
/** 错误码 */
|
|
752
|
+
code?: number;
|
|
753
|
+
/** 错误信息 */
|
|
754
|
+
message?: string;
|
|
755
|
+
/** 追踪 ID */
|
|
756
|
+
traceId?: string;
|
|
757
|
+
}
|
|
758
|
+
/** 动作定义状态 */
|
|
759
|
+
type ActionDefinitionStatus = 'active' | 'deprecated' | 'disabled';
|
|
760
|
+
/** 动作定义 */
|
|
761
|
+
interface ActionDefinition {
|
|
762
|
+
/** 动作 ID */
|
|
763
|
+
id: string;
|
|
764
|
+
/** 动作名称 */
|
|
765
|
+
name: string;
|
|
766
|
+
/** 动作类型 */
|
|
767
|
+
actionType: string;
|
|
768
|
+
/** 描述 */
|
|
769
|
+
description?: string;
|
|
770
|
+
/** 参数 Schema */
|
|
771
|
+
paramsSchema: Record<string, unknown>;
|
|
772
|
+
/** 响应 Schema */
|
|
773
|
+
responseSchema?: Record<string, unknown>;
|
|
774
|
+
/** 是否需要认证 */
|
|
775
|
+
requiresAuth: boolean;
|
|
776
|
+
/** 幂等规则 */
|
|
777
|
+
idempotencyRule?: IdempotencyRule;
|
|
778
|
+
/** 频控规则 */
|
|
779
|
+
rateLimitRule?: RateLimitRule;
|
|
780
|
+
/** 版本 */
|
|
781
|
+
version: string;
|
|
782
|
+
/** 状态 */
|
|
783
|
+
status: ActionDefinitionStatus;
|
|
784
|
+
}
|
|
785
|
+
/** 动作定义版本(不可变) */
|
|
786
|
+
interface ActionDefinitionVersion {
|
|
787
|
+
/** 版本 ID */
|
|
788
|
+
id: string;
|
|
789
|
+
/** 所属定义 ID */
|
|
790
|
+
definitionId: string;
|
|
791
|
+
/** 版本号 */
|
|
792
|
+
version: string;
|
|
793
|
+
/** 定义快照 */
|
|
794
|
+
spec: ActionDefinition;
|
|
795
|
+
/** 状态 */
|
|
796
|
+
status: ActionDefinitionStatus;
|
|
797
|
+
/** 创建时间 */
|
|
798
|
+
createdAt: string;
|
|
799
|
+
/** 创建者 */
|
|
800
|
+
createdBy: string;
|
|
801
|
+
}
|
|
802
|
+
/** 幂等规则 */
|
|
803
|
+
interface IdempotencyRule {
|
|
804
|
+
/** 是否启用 */
|
|
805
|
+
enabled: boolean;
|
|
806
|
+
/** 幂等键字段 */
|
|
807
|
+
keyFields: string[];
|
|
808
|
+
/** 幂等有效期(秒) */
|
|
809
|
+
ttl: number;
|
|
810
|
+
}
|
|
811
|
+
/** 频控规则 */
|
|
812
|
+
interface RateLimitRule {
|
|
813
|
+
/** 是否启用 */
|
|
814
|
+
enabled: boolean;
|
|
815
|
+
/** 时间窗口(秒) */
|
|
816
|
+
window: number;
|
|
817
|
+
/** 最大次数 */
|
|
818
|
+
limit: number;
|
|
819
|
+
/** 频控维度 */
|
|
820
|
+
dimension: 'user' | 'ip' | 'device' | 'global';
|
|
821
|
+
}
|
|
822
|
+
/** 风控检查请求 */
|
|
823
|
+
interface RiskCheckRequest {
|
|
824
|
+
/** 动作类型 */
|
|
825
|
+
actionType: string;
|
|
826
|
+
/** 用户 ID */
|
|
827
|
+
uid?: string;
|
|
828
|
+
/** 设备 ID */
|
|
829
|
+
deviceId?: string;
|
|
830
|
+
/** IP 地址 */
|
|
831
|
+
ip?: string;
|
|
832
|
+
/** 追踪 ID */
|
|
833
|
+
traceId?: string;
|
|
834
|
+
}
|
|
835
|
+
/** 风控检查结果 */
|
|
836
|
+
interface RiskCheckResult {
|
|
837
|
+
/** 是否通过 */
|
|
838
|
+
passed: boolean;
|
|
839
|
+
/** 风险等级 */
|
|
840
|
+
riskLevel: 'low' | 'medium' | 'high' | 'critical';
|
|
841
|
+
/** 需要的验证类型 */
|
|
842
|
+
requiredVerification?: 'captcha' | 'sms' | 'none';
|
|
843
|
+
/** 拒绝原因 */
|
|
844
|
+
rejectReason?: string;
|
|
845
|
+
}
|
|
846
|
+
/** 动作审计日志 */
|
|
847
|
+
interface ActionAuditLog {
|
|
848
|
+
/** 日志 ID */
|
|
849
|
+
id: string;
|
|
850
|
+
/** 动作类型 */
|
|
851
|
+
actionType: string;
|
|
852
|
+
/** 请求参数 */
|
|
853
|
+
params: Record<string, unknown>;
|
|
854
|
+
/** 上下文 */
|
|
855
|
+
context: ActionContext;
|
|
856
|
+
/** 是否成功 */
|
|
857
|
+
success: boolean;
|
|
858
|
+
/** 错误码 */
|
|
859
|
+
code?: number;
|
|
860
|
+
/** 错误信息 */
|
|
861
|
+
message?: string;
|
|
862
|
+
/** 耗时(ms) */
|
|
863
|
+
duration: number;
|
|
864
|
+
/** 追踪 ID */
|
|
865
|
+
traceId: string;
|
|
866
|
+
/** 创建时间 */
|
|
867
|
+
createdAt: string;
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
/**
|
|
871
|
+
* Data Query 规范类型定义
|
|
872
|
+
* 用于 Data Proxy 的数据查询
|
|
873
|
+
*/
|
|
874
|
+
/** 数据查询请求 */
|
|
875
|
+
interface DataQueryRequest {
|
|
876
|
+
/** 查询版本 ID */
|
|
877
|
+
queryVersionId: string;
|
|
878
|
+
/** 查询参数 */
|
|
879
|
+
params: Record<string, unknown>;
|
|
880
|
+
/** 上下文 */
|
|
881
|
+
context?: DataQueryContext;
|
|
882
|
+
}
|
|
883
|
+
/** 查询上下文 */
|
|
884
|
+
interface DataQueryContext {
|
|
885
|
+
/** 页面版本 ID */
|
|
886
|
+
pageVersionId?: string;
|
|
887
|
+
/** 用户 ID */
|
|
888
|
+
uid?: string;
|
|
889
|
+
/** 追踪 ID */
|
|
890
|
+
traceId?: string;
|
|
891
|
+
}
|
|
892
|
+
/** 数据查询响应 */
|
|
893
|
+
interface DataQueryResponse<T = unknown> {
|
|
894
|
+
/** 是否成功 */
|
|
895
|
+
success: boolean;
|
|
896
|
+
/** 响应数据 */
|
|
897
|
+
data?: T;
|
|
898
|
+
/** 是否来自缓存 */
|
|
899
|
+
fromCache?: boolean;
|
|
900
|
+
/** 缓存时间(秒) */
|
|
901
|
+
cacheTime?: number;
|
|
902
|
+
/** 错误码 */
|
|
903
|
+
code?: number;
|
|
904
|
+
/** 错误信息 */
|
|
905
|
+
message?: string;
|
|
906
|
+
}
|
|
907
|
+
/** 数据源类型 */
|
|
908
|
+
type DataSourceType = 'api' | 'database' | 'cache' | 'custom';
|
|
909
|
+
/** 数据查询定义状态 */
|
|
910
|
+
type DataQueryDefinitionStatus = 'active' | 'deprecated' | 'disabled';
|
|
911
|
+
/** 数据查询定义 */
|
|
912
|
+
interface DataQueryDefinition {
|
|
913
|
+
/** 查询 ID */
|
|
914
|
+
id: string;
|
|
915
|
+
/** 查询名称 */
|
|
916
|
+
name: string;
|
|
917
|
+
/** 描述 */
|
|
918
|
+
description?: string;
|
|
919
|
+
/** 数据源类型 */
|
|
920
|
+
sourceType: DataSourceType;
|
|
921
|
+
/** 数据源配置 */
|
|
922
|
+
sourceConfig: DataSourceConfig;
|
|
923
|
+
/** 参数 Schema */
|
|
924
|
+
paramsSchema: Record<string, unknown>;
|
|
925
|
+
/** 响应 Schema */
|
|
926
|
+
responseSchema: Record<string, unknown>;
|
|
927
|
+
/** 字段白名单 */
|
|
928
|
+
allowedFields?: string[];
|
|
929
|
+
/** 脱敏规则 */
|
|
930
|
+
maskRules?: MaskRule[];
|
|
931
|
+
/** 缓存配置 */
|
|
932
|
+
cacheConfig?: CacheConfig;
|
|
933
|
+
/** 版本 */
|
|
934
|
+
version: string;
|
|
935
|
+
/** 状态 */
|
|
936
|
+
status: DataQueryDefinitionStatus;
|
|
937
|
+
}
|
|
938
|
+
/** 数据查询定义版本(不可变) */
|
|
939
|
+
interface DataQueryDefinitionVersion {
|
|
940
|
+
/** 版本 ID */
|
|
941
|
+
id: string;
|
|
942
|
+
/** 所属定义 ID */
|
|
943
|
+
definitionId: string;
|
|
944
|
+
/** 版本号 */
|
|
945
|
+
version: string;
|
|
946
|
+
/** 定义快照 */
|
|
947
|
+
spec: DataQueryDefinition;
|
|
948
|
+
/** 状态 */
|
|
949
|
+
status: DataQueryDefinitionStatus;
|
|
950
|
+
/** 创建时间 */
|
|
951
|
+
createdAt: string;
|
|
952
|
+
/** 创建者 */
|
|
953
|
+
createdBy: string;
|
|
954
|
+
}
|
|
955
|
+
/** 数据源配置 */
|
|
956
|
+
interface DataSourceConfig {
|
|
957
|
+
/** API URL(api 类型) */
|
|
958
|
+
url?: string;
|
|
959
|
+
/** HTTP 方法 */
|
|
960
|
+
method?: 'GET' | 'POST';
|
|
961
|
+
/** 请求头 */
|
|
962
|
+
headers?: Record<string, string>;
|
|
963
|
+
/** 数据库连接(database 类型) */
|
|
964
|
+
connection?: string;
|
|
965
|
+
/** SQL 查询 */
|
|
966
|
+
query?: string;
|
|
967
|
+
/** 自定义处理器 */
|
|
968
|
+
handler?: string;
|
|
969
|
+
}
|
|
970
|
+
/** 脱敏规则 */
|
|
971
|
+
interface MaskRule {
|
|
972
|
+
/** 字段路径 */
|
|
973
|
+
field: string;
|
|
974
|
+
/** 脱敏类型 */
|
|
975
|
+
type: 'phone' | 'email' | 'idcard' | 'name' | 'custom';
|
|
976
|
+
/** 自定义脱敏规则 */
|
|
977
|
+
pattern?: string;
|
|
978
|
+
/** 替换字符 */
|
|
979
|
+
replacement?: string;
|
|
980
|
+
}
|
|
981
|
+
/** 缓存配置 */
|
|
982
|
+
interface CacheConfig {
|
|
983
|
+
/** 是否启用 */
|
|
984
|
+
enabled: boolean;
|
|
985
|
+
/** TTL(秒) */
|
|
986
|
+
ttl: number;
|
|
987
|
+
/** 缓存键字段 */
|
|
988
|
+
keyFields?: string[];
|
|
989
|
+
/** 是否支持刷新 */
|
|
990
|
+
allowRefresh?: boolean;
|
|
991
|
+
}
|
|
992
|
+
/** 字段权限规则 */
|
|
993
|
+
interface FieldPermission {
|
|
994
|
+
/** 字段路径 */
|
|
995
|
+
field: string;
|
|
996
|
+
/** 允许的角色 */
|
|
997
|
+
allowedRoles?: string[];
|
|
998
|
+
/** 是否需要认证 */
|
|
999
|
+
requiresAuth?: boolean;
|
|
1000
|
+
/** 是否需要脱敏 */
|
|
1001
|
+
requiresMask?: boolean;
|
|
1002
|
+
}
|
|
1003
|
+
/** 查询权限配置 */
|
|
1004
|
+
interface QueryPermissionConfig {
|
|
1005
|
+
/** 是否需要认证 */
|
|
1006
|
+
requiresAuth: boolean;
|
|
1007
|
+
/** 允许的角色 */
|
|
1008
|
+
allowedRoles?: string[];
|
|
1009
|
+
/** 字段权限 */
|
|
1010
|
+
fieldPermissions?: FieldPermission[];
|
|
1011
|
+
}
|
|
1012
|
+
/** 查询审计日志 */
|
|
1013
|
+
interface QueryAuditLog {
|
|
1014
|
+
/** 日志 ID */
|
|
1015
|
+
id: string;
|
|
1016
|
+
/** 查询版本 ID */
|
|
1017
|
+
queryVersionId: string;
|
|
1018
|
+
/** 请求参数 */
|
|
1019
|
+
params: Record<string, unknown>;
|
|
1020
|
+
/** 上下文 */
|
|
1021
|
+
context?: DataQueryContext;
|
|
1022
|
+
/** 是否成功 */
|
|
1023
|
+
success: boolean;
|
|
1024
|
+
/** 是否命中缓存 */
|
|
1025
|
+
fromCache?: boolean;
|
|
1026
|
+
/** 错误码 */
|
|
1027
|
+
code?: number;
|
|
1028
|
+
/** 耗时(ms) */
|
|
1029
|
+
duration: number;
|
|
1030
|
+
/** 追踪 ID */
|
|
1031
|
+
traceId: string;
|
|
1032
|
+
/** 创建时间 */
|
|
1033
|
+
createdAt: string;
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
/**
|
|
1037
|
+
* HostAPI 类型定义
|
|
1038
|
+
* 运行时注入给组件的安全 API
|
|
1039
|
+
*
|
|
1040
|
+
* 组件只能通过 hostApi 与外部交互,禁止直接调用:
|
|
1041
|
+
* - window.fetch(绕过 Data Proxy)
|
|
1042
|
+
* - location.href(绕过权限/埋点)
|
|
1043
|
+
* - localStorage(乱写)
|
|
1044
|
+
*/
|
|
1045
|
+
|
|
1046
|
+
/** 导航选项 */
|
|
1047
|
+
interface NavigateOptions {
|
|
1048
|
+
/** 目标 URL */
|
|
1049
|
+
url: string;
|
|
1050
|
+
/** 是否新窗口 */
|
|
1051
|
+
newTab?: boolean;
|
|
1052
|
+
/** 是否替换当前页 */
|
|
1053
|
+
replace?: boolean;
|
|
1054
|
+
/** 附加参数 */
|
|
1055
|
+
params?: Record<string, string>;
|
|
1056
|
+
}
|
|
1057
|
+
/** 对话框选项 */
|
|
1058
|
+
interface DialogOptions {
|
|
1059
|
+
/** 对话框类型 */
|
|
1060
|
+
type: 'alert' | 'confirm' | 'prompt' | 'custom';
|
|
1061
|
+
/** 标题 */
|
|
1062
|
+
title?: string;
|
|
1063
|
+
/** 内容 */
|
|
1064
|
+
content?: string;
|
|
1065
|
+
/** 自定义组件 */
|
|
1066
|
+
component?: string;
|
|
1067
|
+
/** 组件属性 */
|
|
1068
|
+
componentProps?: Record<string, unknown>;
|
|
1069
|
+
/** 确认按钮文案 */
|
|
1070
|
+
confirmText?: string;
|
|
1071
|
+
/** 取消按钮文案 */
|
|
1072
|
+
cancelText?: string;
|
|
1073
|
+
}
|
|
1074
|
+
/** Toast 选项 */
|
|
1075
|
+
interface ToastOptions {
|
|
1076
|
+
/** 消息内容 */
|
|
1077
|
+
message: string;
|
|
1078
|
+
/** 类型 */
|
|
1079
|
+
type?: 'success' | 'error' | 'warning' | 'info';
|
|
1080
|
+
/** 持续时间(毫秒) */
|
|
1081
|
+
duration?: number;
|
|
1082
|
+
/** 位置 */
|
|
1083
|
+
position?: 'top' | 'center' | 'bottom';
|
|
1084
|
+
}
|
|
1085
|
+
/** 埋点事件 */
|
|
1086
|
+
interface TrackEvent {
|
|
1087
|
+
/** 事件名称 */
|
|
1088
|
+
eventName: string;
|
|
1089
|
+
/** 事件参数 */
|
|
1090
|
+
params?: Record<string, unknown>;
|
|
1091
|
+
/** 时间戳 */
|
|
1092
|
+
timestamp?: number;
|
|
1093
|
+
}
|
|
1094
|
+
/** 剪贴板操作结果 */
|
|
1095
|
+
interface ClipboardResult {
|
|
1096
|
+
success: boolean;
|
|
1097
|
+
content?: string;
|
|
1098
|
+
error?: string;
|
|
1099
|
+
}
|
|
1100
|
+
/** 存储选项 */
|
|
1101
|
+
interface StorageOptions {
|
|
1102
|
+
/** 命名空间 */
|
|
1103
|
+
namespace?: string;
|
|
1104
|
+
/** 过期时间(秒) */
|
|
1105
|
+
ttl?: number;
|
|
1106
|
+
}
|
|
1107
|
+
/**
|
|
1108
|
+
* HostAPI 接口
|
|
1109
|
+
* 运行时提供给组件的安全 API
|
|
1110
|
+
*/
|
|
1111
|
+
interface HostAPI {
|
|
1112
|
+
/**
|
|
1113
|
+
* 请求数据(走 Data Proxy)
|
|
1114
|
+
*/
|
|
1115
|
+
requestData<T = unknown>(queryId: string, params?: Record<string, unknown>): Promise<DataQueryResponse<T>>;
|
|
1116
|
+
/**
|
|
1117
|
+
* 执行动作(走 Action Gateway)
|
|
1118
|
+
*/
|
|
1119
|
+
executeAction<T = unknown>(actionType: string, params?: Record<string, unknown>): Promise<ActionExecuteResponse<T>>;
|
|
1120
|
+
/**
|
|
1121
|
+
* 页面导航
|
|
1122
|
+
*/
|
|
1123
|
+
navigate(options: NavigateOptions): void;
|
|
1124
|
+
/**
|
|
1125
|
+
* 返回上一页
|
|
1126
|
+
*/
|
|
1127
|
+
goBack(): void;
|
|
1128
|
+
/**
|
|
1129
|
+
* 刷新页面
|
|
1130
|
+
*/
|
|
1131
|
+
refresh(): void;
|
|
1132
|
+
/**
|
|
1133
|
+
* 打开对话框
|
|
1134
|
+
*/
|
|
1135
|
+
openDialog(options: DialogOptions): Promise<boolean | string>;
|
|
1136
|
+
/**
|
|
1137
|
+
* 关闭对话框
|
|
1138
|
+
*/
|
|
1139
|
+
closeDialog(): void;
|
|
1140
|
+
/**
|
|
1141
|
+
* 显示 Toast
|
|
1142
|
+
*/
|
|
1143
|
+
showToast(options: ToastOptions): void;
|
|
1144
|
+
/**
|
|
1145
|
+
* 上报埋点
|
|
1146
|
+
*/
|
|
1147
|
+
track(event: TrackEvent): void;
|
|
1148
|
+
/**
|
|
1149
|
+
* 复制到剪贴板
|
|
1150
|
+
*/
|
|
1151
|
+
copyToClipboard(text: string): Promise<ClipboardResult>;
|
|
1152
|
+
/**
|
|
1153
|
+
* 从剪贴板读取
|
|
1154
|
+
*/
|
|
1155
|
+
readFromClipboard(): Promise<ClipboardResult>;
|
|
1156
|
+
/**
|
|
1157
|
+
* 获取页面状态
|
|
1158
|
+
*/
|
|
1159
|
+
getState<T = unknown>(key: string): T | undefined;
|
|
1160
|
+
/**
|
|
1161
|
+
* 设置页面状态
|
|
1162
|
+
*/
|
|
1163
|
+
setState(key: string, value: unknown): void;
|
|
1164
|
+
/**
|
|
1165
|
+
* 获取全局变量
|
|
1166
|
+
*/
|
|
1167
|
+
getVariable<T = unknown>(name: string): T | undefined;
|
|
1168
|
+
/**
|
|
1169
|
+
* 发送消息给其他组件
|
|
1170
|
+
*/
|
|
1171
|
+
postMessage(componentId: string, message: unknown): void;
|
|
1172
|
+
/**
|
|
1173
|
+
* 广播消息
|
|
1174
|
+
*/
|
|
1175
|
+
broadcast(channel: string, message: unknown): void;
|
|
1176
|
+
/**
|
|
1177
|
+
* 安全存储(有命名空间隔离)
|
|
1178
|
+
*/
|
|
1179
|
+
storage: {
|
|
1180
|
+
get<T = unknown>(key: string, options?: StorageOptions): T | undefined;
|
|
1181
|
+
set(key: string, value: unknown, options?: StorageOptions): void;
|
|
1182
|
+
remove(key: string, options?: StorageOptions): void;
|
|
1183
|
+
};
|
|
1184
|
+
/**
|
|
1185
|
+
* 获取运行时上下文
|
|
1186
|
+
*/
|
|
1187
|
+
getContext(): RuntimeContext;
|
|
1188
|
+
}
|
|
1189
|
+
/** 运行时上下文 */
|
|
1190
|
+
interface RuntimeContext {
|
|
1191
|
+
/** 页面 UID */
|
|
1192
|
+
pageUid: string;
|
|
1193
|
+
/** 页面版本 ID */
|
|
1194
|
+
pageVersionId: string;
|
|
1195
|
+
/** 运行时版本 */
|
|
1196
|
+
runtimeVersion: string;
|
|
1197
|
+
/** 用户 ID */
|
|
1198
|
+
userId?: string;
|
|
1199
|
+
/** 设备 ID */
|
|
1200
|
+
deviceId?: string;
|
|
1201
|
+
/** 渠道 */
|
|
1202
|
+
channel?: string;
|
|
1203
|
+
/** 是否编辑模式 */
|
|
1204
|
+
isEditMode: boolean;
|
|
1205
|
+
/** 是否预览模式 */
|
|
1206
|
+
isPreviewMode: boolean;
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
/**
|
|
1210
|
+
* 资源相关类型定义
|
|
1211
|
+
* 用于管理图片、视频、文档等资源
|
|
1212
|
+
*/
|
|
1213
|
+
/**
|
|
1214
|
+
* 资源状态
|
|
1215
|
+
* - active: 活跃
|
|
1216
|
+
* - archived: 已归档
|
|
1217
|
+
*/
|
|
1218
|
+
type AssetStatus = 'active' | 'archived';
|
|
1219
|
+
/**
|
|
1220
|
+
* 资源类型
|
|
1221
|
+
* - image: 图片
|
|
1222
|
+
* - video: 视频
|
|
1223
|
+
* - audio: 音频
|
|
1224
|
+
* - document: 文档
|
|
1225
|
+
* - other: 其他
|
|
1226
|
+
*/
|
|
1227
|
+
type AssetType = 'image' | 'video' | 'audio' | 'document' | 'other';
|
|
1228
|
+
/**
|
|
1229
|
+
* 资源排序字段
|
|
1230
|
+
*/
|
|
1231
|
+
type AssetSortField = 'id' | 'createdAt' | 'size' | 'filename';
|
|
1232
|
+
/**
|
|
1233
|
+
* 资源元数据
|
|
1234
|
+
*/
|
|
1235
|
+
interface AssetMeta {
|
|
1236
|
+
/** 原始文件名 */
|
|
1237
|
+
originalName: string;
|
|
1238
|
+
/** MIME 类型 */
|
|
1239
|
+
mimeType: string;
|
|
1240
|
+
/** 文件大小(字节) */
|
|
1241
|
+
size: number;
|
|
1242
|
+
/** 宽度(仅图片/视频) */
|
|
1243
|
+
width?: number;
|
|
1244
|
+
/** 高度(仅图片/视频) */
|
|
1245
|
+
height?: number;
|
|
1246
|
+
/** 时长(仅音频/视频,秒) */
|
|
1247
|
+
duration?: number;
|
|
1248
|
+
/** 扩展信息 */
|
|
1249
|
+
extra?: Record<string, unknown>;
|
|
1250
|
+
}
|
|
1251
|
+
/**
|
|
1252
|
+
* 资源信息
|
|
1253
|
+
*/
|
|
1254
|
+
interface Asset {
|
|
1255
|
+
/** 资源 ID */
|
|
1256
|
+
id: string;
|
|
1257
|
+
/** 资源名称 */
|
|
1258
|
+
name: string;
|
|
1259
|
+
/** 资源类型 */
|
|
1260
|
+
type: AssetType;
|
|
1261
|
+
/** 资源状态 */
|
|
1262
|
+
status: AssetStatus;
|
|
1263
|
+
/** 存储路径/URL */
|
|
1264
|
+
url: string;
|
|
1265
|
+
/** 缩略图 URL */
|
|
1266
|
+
thumbnailUrl?: string;
|
|
1267
|
+
/** 元数据 */
|
|
1268
|
+
meta: AssetMeta;
|
|
1269
|
+
/** 标签 */
|
|
1270
|
+
tags?: string[];
|
|
1271
|
+
/** 所属目录 */
|
|
1272
|
+
folderId?: string;
|
|
1273
|
+
/** 创建时间 */
|
|
1274
|
+
createdAt: string;
|
|
1275
|
+
/** 创建者 */
|
|
1276
|
+
createdBy: string;
|
|
1277
|
+
/** 更新时间 */
|
|
1278
|
+
updatedAt?: string;
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1281
|
+
/**
|
|
1282
|
+
* 运行时相关类型定义
|
|
1283
|
+
* 包括页面解析结果、运行时配置、Manifest 等
|
|
1284
|
+
*/
|
|
1285
|
+
|
|
1286
|
+
/**
|
|
1287
|
+
* 运行时配置
|
|
1288
|
+
* 控制运行时行为的动态配置
|
|
1289
|
+
*/
|
|
1290
|
+
interface RuntimeConfig {
|
|
1291
|
+
/** Kill Switch 列表(紧急禁用的 actionType) */
|
|
1292
|
+
killSwitches?: string[];
|
|
1293
|
+
/** 被阻断的组件版本列表 */
|
|
1294
|
+
blockedComponents?: BlockedComponent[];
|
|
1295
|
+
/** 功能开关 */
|
|
1296
|
+
features?: Record<string, boolean>;
|
|
1297
|
+
/** 灰度配置 */
|
|
1298
|
+
rollout?: RolloutConfig;
|
|
1299
|
+
/** 调试模式 */
|
|
1300
|
+
debug?: boolean;
|
|
1301
|
+
}
|
|
1302
|
+
/**
|
|
1303
|
+
* 被阻断的组件信息
|
|
1304
|
+
*/
|
|
1305
|
+
interface BlockedComponent {
|
|
1306
|
+
/** 组件名称 */
|
|
1307
|
+
name: string;
|
|
1308
|
+
/** 被阻断的版本(支持 semver range) */
|
|
1309
|
+
version: string;
|
|
1310
|
+
/** 阻断原因 */
|
|
1311
|
+
reason: string;
|
|
1312
|
+
/** 阻断时间 */
|
|
1313
|
+
blockedAt: string;
|
|
1314
|
+
}
|
|
1315
|
+
/**
|
|
1316
|
+
* 灰度配置
|
|
1317
|
+
*/
|
|
1318
|
+
interface RolloutConfig {
|
|
1319
|
+
/** 是否启用 */
|
|
1320
|
+
enabled: boolean;
|
|
1321
|
+
/** 灰度百分比 (0-100) */
|
|
1322
|
+
percentage?: number;
|
|
1323
|
+
/** 白名单用户 */
|
|
1324
|
+
whitelistUsers?: string[];
|
|
1325
|
+
/** 黑名单用户 */
|
|
1326
|
+
blacklistUsers?: string[];
|
|
1327
|
+
}
|
|
1328
|
+
/**
|
|
1329
|
+
* 页面解析请求
|
|
1330
|
+
* GET /page/resolve
|
|
1331
|
+
*/
|
|
1332
|
+
interface PageResolveRequest {
|
|
1333
|
+
/** 页面 UID */
|
|
1334
|
+
pageUid: string;
|
|
1335
|
+
/** 渠道 */
|
|
1336
|
+
channel?: string;
|
|
1337
|
+
/** 用户 ID(用于灰度) */
|
|
1338
|
+
uid?: string;
|
|
1339
|
+
/** 设备 ID */
|
|
1340
|
+
deviceId?: string;
|
|
1341
|
+
/** 预览 Token */
|
|
1342
|
+
previewToken?: string;
|
|
1343
|
+
}
|
|
1344
|
+
/**
|
|
1345
|
+
* 页面解析结果
|
|
1346
|
+
* GET /page/resolve 的响应数据
|
|
1347
|
+
*/
|
|
1348
|
+
interface PageResolveResult {
|
|
1349
|
+
/** 页面 UID */
|
|
1350
|
+
pageUid: string;
|
|
1351
|
+
/** 页面版本 ID */
|
|
1352
|
+
pageVersionId: string;
|
|
1353
|
+
/** 页面 JSON */
|
|
1354
|
+
pageJson: PageSchema;
|
|
1355
|
+
/** 组件清单 */
|
|
1356
|
+
manifest: PageManifest;
|
|
1357
|
+
/** 运行时配置 */
|
|
1358
|
+
runtimeConfig: RuntimeConfig;
|
|
1359
|
+
/** 运行时版本要求 */
|
|
1360
|
+
runtimeVersion: string;
|
|
1361
|
+
/** 是否预览模式 */
|
|
1362
|
+
isPreview?: boolean;
|
|
1363
|
+
}
|
|
1364
|
+
/**
|
|
1365
|
+
* 组件加载状态
|
|
1366
|
+
*/
|
|
1367
|
+
type ComponentLoadStatus = 'pending' | 'loading' | 'loaded' | 'failed' | 'blocked';
|
|
1368
|
+
/**
|
|
1369
|
+
* 组件加载结果
|
|
1370
|
+
*/
|
|
1371
|
+
interface ComponentLoadResult {
|
|
1372
|
+
/** 组件名称 */
|
|
1373
|
+
name: string;
|
|
1374
|
+
/** 组件版本 */
|
|
1375
|
+
version: string;
|
|
1376
|
+
/** 加载状态 */
|
|
1377
|
+
status: ComponentLoadStatus;
|
|
1378
|
+
/** 组件类/构造函数 */
|
|
1379
|
+
component?: unknown;
|
|
1380
|
+
/** 错误信息 */
|
|
1381
|
+
error?: string;
|
|
1382
|
+
/** 加载耗时(ms) */
|
|
1383
|
+
loadTime?: number;
|
|
1384
|
+
}
|
|
1385
|
+
/**
|
|
1386
|
+
* 组件注册表
|
|
1387
|
+
*/
|
|
1388
|
+
interface ComponentRegistry {
|
|
1389
|
+
/** 已注册的组件 */
|
|
1390
|
+
components: Map<string, ComponentLoadResult>;
|
|
1391
|
+
/** 注册组件 */
|
|
1392
|
+
register(name: string, component: unknown): void;
|
|
1393
|
+
/** 获取组件 */
|
|
1394
|
+
get(name: string): ComponentLoadResult | undefined;
|
|
1395
|
+
/** 检查组件是否已加载 */
|
|
1396
|
+
has(name: string): boolean;
|
|
1397
|
+
}
|
|
1398
|
+
/**
|
|
1399
|
+
* 运行时错误类型
|
|
1400
|
+
*/
|
|
1401
|
+
type RuntimeErrorType = 'LOAD_ERROR' | 'RENDER_ERROR' | 'ACTION_ERROR' | 'QUERY_ERROR' | 'EXPRESSION_ERROR' | 'INTEGRITY_ERROR' | 'BLOCKED_ERROR';
|
|
1402
|
+
/**
|
|
1403
|
+
* 运行时错误
|
|
1404
|
+
*/
|
|
1405
|
+
interface RuntimeError {
|
|
1406
|
+
/** 错误类型 */
|
|
1407
|
+
type: RuntimeErrorType;
|
|
1408
|
+
/** 错误消息 */
|
|
1409
|
+
message: string;
|
|
1410
|
+
/** 组件 ID */
|
|
1411
|
+
componentId?: string;
|
|
1412
|
+
/** 组件类型 */
|
|
1413
|
+
componentType?: string;
|
|
1414
|
+
/** 组件版本 */
|
|
1415
|
+
componentVersion?: string;
|
|
1416
|
+
/** 动作 ID */
|
|
1417
|
+
actionId?: string;
|
|
1418
|
+
/** 堆栈 */
|
|
1419
|
+
stack?: string;
|
|
1420
|
+
/** 追踪 ID */
|
|
1421
|
+
traceId?: string;
|
|
1422
|
+
/** 发生时间 */
|
|
1423
|
+
timestamp: number;
|
|
1424
|
+
}
|
|
1425
|
+
/**
|
|
1426
|
+
* 错误边界处理器
|
|
1427
|
+
*/
|
|
1428
|
+
interface ErrorBoundaryHandler {
|
|
1429
|
+
/** 处理错误 */
|
|
1430
|
+
handleError(error: RuntimeError): void;
|
|
1431
|
+
/** 渲染 fallback */
|
|
1432
|
+
renderFallback(error: RuntimeError): unknown;
|
|
1433
|
+
}
|
|
1434
|
+
/**
|
|
1435
|
+
* 性能指标类型
|
|
1436
|
+
*/
|
|
1437
|
+
type PerformanceMetricType = 'page_resolve' | 'component_load' | 'first_render' | 'action_execute' | 'query_execute';
|
|
1438
|
+
/**
|
|
1439
|
+
* 性能指标
|
|
1440
|
+
*/
|
|
1441
|
+
interface PerformanceMetric {
|
|
1442
|
+
/** 指标类型 */
|
|
1443
|
+
type: PerformanceMetricType;
|
|
1444
|
+
/** 名称/标识 */
|
|
1445
|
+
name: string;
|
|
1446
|
+
/** 耗时(ms) */
|
|
1447
|
+
duration: number;
|
|
1448
|
+
/** 开始时间 */
|
|
1449
|
+
startTime: number;
|
|
1450
|
+
/** 额外数据 */
|
|
1451
|
+
extra?: Record<string, unknown>;
|
|
1452
|
+
}
|
|
1453
|
+
/**
|
|
1454
|
+
* 运行时事件类型
|
|
1455
|
+
*/
|
|
1456
|
+
type RuntimeEventType = 'page:loaded' | 'page:error' | 'component:mounted' | 'component:unmounted' | 'component:error' | 'action:start' | 'action:success' | 'action:error' | 'query:start' | 'query:success' | 'query:error';
|
|
1457
|
+
/**
|
|
1458
|
+
* 运行时事件
|
|
1459
|
+
*/
|
|
1460
|
+
interface RuntimeEvent<T = unknown> {
|
|
1461
|
+
/** 事件类型 */
|
|
1462
|
+
type: RuntimeEventType;
|
|
1463
|
+
/** 事件数据 */
|
|
1464
|
+
data: T;
|
|
1465
|
+
/** 时间戳 */
|
|
1466
|
+
timestamp: number;
|
|
1467
|
+
/** 追踪 ID */
|
|
1468
|
+
traceId?: string;
|
|
1469
|
+
}
|
|
1470
|
+
/**
|
|
1471
|
+
* 事件总线接口
|
|
1472
|
+
*/
|
|
1473
|
+
interface EventBus {
|
|
1474
|
+
/** 发送事件 */
|
|
1475
|
+
emit<T>(event: RuntimeEvent<T>): void;
|
|
1476
|
+
/** 订阅事件 */
|
|
1477
|
+
on<T>(type: RuntimeEventType, handler: (event: RuntimeEvent<T>) => void): () => void;
|
|
1478
|
+
/** 取消订阅 */
|
|
1479
|
+
off<T>(type: RuntimeEventType, handler: (event: RuntimeEvent<T>) => void): void;
|
|
1480
|
+
}
|
|
1481
|
+
|
|
1482
|
+
/**
|
|
1483
|
+
* 统一 API 响应类型定义
|
|
1484
|
+
* 所有 API 响应遵循统一格式
|
|
1485
|
+
*/
|
|
1486
|
+
|
|
1487
|
+
/**
|
|
1488
|
+
* 统一 API 响应格式
|
|
1489
|
+
*/
|
|
1490
|
+
interface ApiResponse<T = unknown> {
|
|
1491
|
+
/** 是否成功 */
|
|
1492
|
+
success: boolean;
|
|
1493
|
+
/** 响应数据 */
|
|
1494
|
+
data?: T;
|
|
1495
|
+
/** 错误码 */
|
|
1496
|
+
code?: ErrorCode | number;
|
|
1497
|
+
/** 错误信息 */
|
|
1498
|
+
message?: string;
|
|
1499
|
+
/** 追踪 ID */
|
|
1500
|
+
traceId?: string;
|
|
1501
|
+
/** 请求 ID */
|
|
1502
|
+
requestId?: string;
|
|
1503
|
+
/** 时间戳 */
|
|
1504
|
+
timestamp?: number;
|
|
1505
|
+
}
|
|
1506
|
+
/**
|
|
1507
|
+
* 分页 API 响应格式
|
|
1508
|
+
*/
|
|
1509
|
+
interface PaginatedApiResponse<T> extends ApiResponse<T[]> {
|
|
1510
|
+
/** 分页信息 */
|
|
1511
|
+
pagination?: {
|
|
1512
|
+
/** 当前页码 */
|
|
1513
|
+
page: number;
|
|
1514
|
+
/** 每页数量 */
|
|
1515
|
+
pageSize: number;
|
|
1516
|
+
/** 总数量 */
|
|
1517
|
+
total: number;
|
|
1518
|
+
/** 总页数 */
|
|
1519
|
+
totalPages: number;
|
|
1520
|
+
};
|
|
1521
|
+
}
|
|
1522
|
+
/**
|
|
1523
|
+
* 标准请求头
|
|
1524
|
+
*/
|
|
1525
|
+
interface StandardRequestHeaders {
|
|
1526
|
+
/** 追踪 ID */
|
|
1527
|
+
'x-trace-id'?: string;
|
|
1528
|
+
/** 请求 ID */
|
|
1529
|
+
'x-request-id'?: string;
|
|
1530
|
+
/** 页面版本 ID */
|
|
1531
|
+
'x-page-version-id'?: string;
|
|
1532
|
+
/** 组件版本 */
|
|
1533
|
+
'x-component-version'?: string;
|
|
1534
|
+
/** 用户 ID */
|
|
1535
|
+
'x-user-id'?: string;
|
|
1536
|
+
/** 设备 ID */
|
|
1537
|
+
'x-device-id'?: string;
|
|
1538
|
+
/** 渠道 */
|
|
1539
|
+
'x-channel'?: string;
|
|
1540
|
+
/** 应用 ID */
|
|
1541
|
+
'x-app-id'?: string;
|
|
1542
|
+
}
|
|
1543
|
+
/**
|
|
1544
|
+
* 标准响应头
|
|
1545
|
+
*/
|
|
1546
|
+
interface StandardResponseHeaders {
|
|
1547
|
+
/** 追踪 ID */
|
|
1548
|
+
'x-trace-id'?: string;
|
|
1549
|
+
/** 请求 ID */
|
|
1550
|
+
'x-request-id'?: string;
|
|
1551
|
+
/** 服务器时间戳 */
|
|
1552
|
+
'x-server-time'?: string;
|
|
1553
|
+
/** 缓存状态 */
|
|
1554
|
+
'x-cache-status'?: 'HIT' | 'MISS' | 'BYPASS';
|
|
1555
|
+
}
|
|
1556
|
+
/**
|
|
1557
|
+
* 健康检查响应
|
|
1558
|
+
*/
|
|
1559
|
+
interface HealthCheckResponse {
|
|
1560
|
+
/** 状态 */
|
|
1561
|
+
status: 'healthy' | 'degraded' | 'unhealthy';
|
|
1562
|
+
/** 版本 */
|
|
1563
|
+
version: string;
|
|
1564
|
+
/** 服务名 */
|
|
1565
|
+
service: string;
|
|
1566
|
+
/** 依赖服务状态 */
|
|
1567
|
+
dependencies?: Record<string, DependencyHealth>;
|
|
1568
|
+
/** 时间戳 */
|
|
1569
|
+
timestamp: number;
|
|
1570
|
+
}
|
|
1571
|
+
/**
|
|
1572
|
+
* 依赖服务健康状态
|
|
1573
|
+
*/
|
|
1574
|
+
interface DependencyHealth {
|
|
1575
|
+
/** 状态 */
|
|
1576
|
+
status: 'up' | 'down';
|
|
1577
|
+
/** 延迟(ms) */
|
|
1578
|
+
latency?: number;
|
|
1579
|
+
/** 错误信息 */
|
|
1580
|
+
error?: string;
|
|
1581
|
+
}
|
|
1582
|
+
/**
|
|
1583
|
+
* 批量操作请求
|
|
1584
|
+
*/
|
|
1585
|
+
interface BatchRequest<T> {
|
|
1586
|
+
/** 操作列表 */
|
|
1587
|
+
items: T[];
|
|
1588
|
+
/** 是否原子操作(全部成功或全部失败) */
|
|
1589
|
+
atomic?: boolean;
|
|
1590
|
+
}
|
|
1591
|
+
/**
|
|
1592
|
+
* 批量操作结果
|
|
1593
|
+
*/
|
|
1594
|
+
interface BatchResult<T> {
|
|
1595
|
+
/** 成功数量 */
|
|
1596
|
+
successCount: number;
|
|
1597
|
+
/** 失败数量 */
|
|
1598
|
+
failedCount: number;
|
|
1599
|
+
/** 结果列表 */
|
|
1600
|
+
results: BatchItemResult<T>[];
|
|
1601
|
+
}
|
|
1602
|
+
/**
|
|
1603
|
+
* 单个批量操作项结果
|
|
1604
|
+
*/
|
|
1605
|
+
interface BatchItemResult<T> {
|
|
1606
|
+
/** 索引 */
|
|
1607
|
+
index: number;
|
|
1608
|
+
/** 是否成功 */
|
|
1609
|
+
success: boolean;
|
|
1610
|
+
/** 数据 */
|
|
1611
|
+
data?: T;
|
|
1612
|
+
/** 错误码 */
|
|
1613
|
+
code?: number;
|
|
1614
|
+
/** 错误信息 */
|
|
1615
|
+
message?: string;
|
|
1616
|
+
}
|
|
1617
|
+
/**
|
|
1618
|
+
* 上传凭证请求
|
|
1619
|
+
*/
|
|
1620
|
+
interface UploadCredentialRequest {
|
|
1621
|
+
/** 文件名 */
|
|
1622
|
+
filename: string;
|
|
1623
|
+
/** 文件类型 */
|
|
1624
|
+
contentType: string;
|
|
1625
|
+
/** 文件大小 */
|
|
1626
|
+
size: number;
|
|
1627
|
+
/** 目录 */
|
|
1628
|
+
directory?: string;
|
|
1629
|
+
}
|
|
1630
|
+
/**
|
|
1631
|
+
* 上传凭证响应
|
|
1632
|
+
*/
|
|
1633
|
+
interface UploadCredentialResponse {
|
|
1634
|
+
/** 上传 URL */
|
|
1635
|
+
uploadUrl: string;
|
|
1636
|
+
/** 上传方法 */
|
|
1637
|
+
method: 'PUT' | 'POST';
|
|
1638
|
+
/** 需要的请求头 */
|
|
1639
|
+
headers: Record<string, string>;
|
|
1640
|
+
/** 表单字段(POST multipart 时) */
|
|
1641
|
+
formFields?: Record<string, string>;
|
|
1642
|
+
/** 最终文件 URL */
|
|
1643
|
+
fileUrl: string;
|
|
1644
|
+
/** 凭证过期时间 */
|
|
1645
|
+
expiresAt: string;
|
|
1646
|
+
}
|
|
1647
|
+
/**
|
|
1648
|
+
* WebSocket 消息类型
|
|
1649
|
+
*/
|
|
1650
|
+
type WsMessageType = 'ping' | 'pong' | 'subscribe' | 'unsubscribe' | 'publish' | 'error';
|
|
1651
|
+
/**
|
|
1652
|
+
* WebSocket 消息
|
|
1653
|
+
*/
|
|
1654
|
+
interface WsMessage<T = unknown> {
|
|
1655
|
+
/** 消息类型 */
|
|
1656
|
+
type: WsMessageType;
|
|
1657
|
+
/** 频道 */
|
|
1658
|
+
channel?: string;
|
|
1659
|
+
/** 消息数据 */
|
|
1660
|
+
data?: T;
|
|
1661
|
+
/** 消息 ID */
|
|
1662
|
+
id?: string;
|
|
1663
|
+
/** 时间戳 */
|
|
1664
|
+
timestamp: number;
|
|
1665
|
+
}
|
|
1666
|
+
|
|
1667
|
+
/**
|
|
1668
|
+
* 表达式引擎类型定义
|
|
1669
|
+
* 无 eval 的安全 DSL,支持发布期校验
|
|
1670
|
+
*/
|
|
1671
|
+
/**
|
|
1672
|
+
* 表达式类型
|
|
1673
|
+
*/
|
|
1674
|
+
type ExpressionType = 'literal' | 'identifier' | 'member' | 'index' | 'call' | 'binary' | 'unary' | 'conditional' | 'array' | 'object';
|
|
1675
|
+
/**
|
|
1676
|
+
* 表达式 AST 节点基类
|
|
1677
|
+
*/
|
|
1678
|
+
interface ExpressionNode {
|
|
1679
|
+
/** 节点类型 */
|
|
1680
|
+
type: ExpressionType;
|
|
1681
|
+
/** 原始表达式 */
|
|
1682
|
+
raw?: string;
|
|
1683
|
+
/** 起始位置 */
|
|
1684
|
+
start?: number;
|
|
1685
|
+
/** 结束位置 */
|
|
1686
|
+
end?: number;
|
|
1687
|
+
}
|
|
1688
|
+
/**
|
|
1689
|
+
* 字面量节点
|
|
1690
|
+
*/
|
|
1691
|
+
interface LiteralNode extends ExpressionNode {
|
|
1692
|
+
type: 'literal';
|
|
1693
|
+
value: string | number | boolean | null;
|
|
1694
|
+
}
|
|
1695
|
+
/**
|
|
1696
|
+
* 标识符节点
|
|
1697
|
+
*/
|
|
1698
|
+
interface IdentifierNode extends ExpressionNode {
|
|
1699
|
+
type: 'identifier';
|
|
1700
|
+
name: string;
|
|
1701
|
+
}
|
|
1702
|
+
/**
|
|
1703
|
+
* 成员访问节点
|
|
1704
|
+
*/
|
|
1705
|
+
interface MemberNode extends ExpressionNode {
|
|
1706
|
+
type: 'member';
|
|
1707
|
+
object: ExpressionNode;
|
|
1708
|
+
property: string;
|
|
1709
|
+
}
|
|
1710
|
+
/**
|
|
1711
|
+
* 函数调用节点
|
|
1712
|
+
*/
|
|
1713
|
+
interface CallNode extends ExpressionNode {
|
|
1714
|
+
type: 'call';
|
|
1715
|
+
callee: string;
|
|
1716
|
+
arguments: ExpressionNode[];
|
|
1717
|
+
}
|
|
1718
|
+
/**
|
|
1719
|
+
* 二元运算节点
|
|
1720
|
+
*/
|
|
1721
|
+
interface BinaryNode extends ExpressionNode {
|
|
1722
|
+
type: 'binary';
|
|
1723
|
+
operator: BinaryOperator;
|
|
1724
|
+
left: ExpressionNode;
|
|
1725
|
+
right: ExpressionNode;
|
|
1726
|
+
}
|
|
1727
|
+
/**
|
|
1728
|
+
* 二元运算符
|
|
1729
|
+
*/
|
|
1730
|
+
type BinaryOperator = '+' | '-' | '*' | '/' | '%' | '==' | '!=' | '>' | '<' | '>=' | '<=' | '&&' | '||' | '??';
|
|
1731
|
+
/**
|
|
1732
|
+
* 一元运算符
|
|
1733
|
+
*/
|
|
1734
|
+
type UnaryOperator = '!' | '-' | '+';
|
|
1735
|
+
/**
|
|
1736
|
+
* 内置函数定义
|
|
1737
|
+
*/
|
|
1738
|
+
interface BuiltinFunction {
|
|
1739
|
+
/** 函数名 */
|
|
1740
|
+
name: string;
|
|
1741
|
+
/** 描述 */
|
|
1742
|
+
description: string;
|
|
1743
|
+
/** 参数定义 */
|
|
1744
|
+
params: FunctionParam[];
|
|
1745
|
+
/** 返回类型 */
|
|
1746
|
+
returnType: ValueType;
|
|
1747
|
+
/** 示例 */
|
|
1748
|
+
examples?: string[];
|
|
1749
|
+
}
|
|
1750
|
+
/**
|
|
1751
|
+
* 函数参数定义
|
|
1752
|
+
*/
|
|
1753
|
+
interface FunctionParam {
|
|
1754
|
+
/** 参数名 */
|
|
1755
|
+
name: string;
|
|
1756
|
+
/** 参数类型 */
|
|
1757
|
+
type: ValueType;
|
|
1758
|
+
/** 是否必填 */
|
|
1759
|
+
required: boolean;
|
|
1760
|
+
/** 默认值 */
|
|
1761
|
+
defaultValue?: unknown;
|
|
1762
|
+
/** 描述 */
|
|
1763
|
+
description?: string;
|
|
1764
|
+
}
|
|
1765
|
+
/**
|
|
1766
|
+
* 值类型
|
|
1767
|
+
*/
|
|
1768
|
+
type ValueType = 'string' | 'number' | 'boolean' | 'array' | 'object' | 'null' | 'any' | 'void';
|
|
1769
|
+
/**
|
|
1770
|
+
* 内置函数白名单
|
|
1771
|
+
* 表达式中只能调用这些函数
|
|
1772
|
+
*/
|
|
1773
|
+
declare const BUILTIN_FUNCTIONS: BuiltinFunction[];
|
|
1774
|
+
/**
|
|
1775
|
+
* 内置函数名称集合(用于快速校验)
|
|
1776
|
+
*/
|
|
1777
|
+
declare const BUILTIN_FUNCTION_NAMES: Set<string>;
|
|
1778
|
+
/**
|
|
1779
|
+
* 表达式上下文
|
|
1780
|
+
* 表达式执行时可访问的变量
|
|
1781
|
+
*/
|
|
1782
|
+
interface ExpressionContext {
|
|
1783
|
+
/** 页面状态 */
|
|
1784
|
+
state: Record<string, unknown>;
|
|
1785
|
+
/** 查询结果 */
|
|
1786
|
+
query: Record<string, unknown>;
|
|
1787
|
+
/** 运行时上下文 */
|
|
1788
|
+
context: {
|
|
1789
|
+
userId?: string;
|
|
1790
|
+
deviceId?: string;
|
|
1791
|
+
channel?: string;
|
|
1792
|
+
pageVersionId?: string;
|
|
1793
|
+
[key: string]: unknown;
|
|
1794
|
+
};
|
|
1795
|
+
/** 事件参数 */
|
|
1796
|
+
event?: Record<string, unknown>;
|
|
1797
|
+
/** 循环变量 */
|
|
1798
|
+
item?: unknown;
|
|
1799
|
+
/** 循环索引 */
|
|
1800
|
+
index?: number;
|
|
1801
|
+
}
|
|
1802
|
+
/**
|
|
1803
|
+
* 表达式允许访问的根变量
|
|
1804
|
+
*/
|
|
1805
|
+
declare const ALLOWED_ROOT_VARIABLES: readonly ["state", "query", "context", "event", "item", "index"];
|
|
1806
|
+
/**
|
|
1807
|
+
* 表达式校验结果
|
|
1808
|
+
*/
|
|
1809
|
+
interface ExpressionValidationResult {
|
|
1810
|
+
/** 是否有效 */
|
|
1811
|
+
valid: boolean;
|
|
1812
|
+
/** 错误列表 */
|
|
1813
|
+
errors: ExpressionError[];
|
|
1814
|
+
/** 警告列表 */
|
|
1815
|
+
warnings: ExpressionWarning[];
|
|
1816
|
+
/** 引用的变量路径 */
|
|
1817
|
+
referencedPaths: string[];
|
|
1818
|
+
/** 调用的函数 */
|
|
1819
|
+
calledFunctions: string[];
|
|
1820
|
+
}
|
|
1821
|
+
/**
|
|
1822
|
+
* 表达式错误
|
|
1823
|
+
*/
|
|
1824
|
+
interface ExpressionError {
|
|
1825
|
+
/** 错误类型 */
|
|
1826
|
+
type: ExpressionErrorType;
|
|
1827
|
+
/** 错误消息 */
|
|
1828
|
+
message: string;
|
|
1829
|
+
/** 位置 */
|
|
1830
|
+
position?: {
|
|
1831
|
+
start: number;
|
|
1832
|
+
end: number;
|
|
1833
|
+
};
|
|
1834
|
+
}
|
|
1835
|
+
/**
|
|
1836
|
+
* 表达式错误类型
|
|
1837
|
+
*/
|
|
1838
|
+
type ExpressionErrorType = 'SYNTAX_ERROR' | 'UNKNOWN_FUNCTION' | 'INVALID_ARGUMENT' | 'UNKNOWN_VARIABLE' | 'TYPE_MISMATCH' | 'ACCESS_DENIED';
|
|
1839
|
+
/**
|
|
1840
|
+
* 表达式警告
|
|
1841
|
+
*/
|
|
1842
|
+
interface ExpressionWarning {
|
|
1843
|
+
/** 警告类型 */
|
|
1844
|
+
type: 'DEPRECATED' | 'PERFORMANCE' | 'NULLABLE';
|
|
1845
|
+
/** 警告消息 */
|
|
1846
|
+
message: string;
|
|
1847
|
+
/** 位置 */
|
|
1848
|
+
position?: {
|
|
1849
|
+
start: number;
|
|
1850
|
+
end: number;
|
|
1851
|
+
};
|
|
1852
|
+
}
|
|
1853
|
+
/**
|
|
1854
|
+
* 表达式绑定
|
|
1855
|
+
* 用于属性值的动态绑定
|
|
1856
|
+
*/
|
|
1857
|
+
interface ExpressionBinding {
|
|
1858
|
+
/** 是否为表达式 */
|
|
1859
|
+
__isExpression: true;
|
|
1860
|
+
/** 表达式字符串 */
|
|
1861
|
+
expression: string;
|
|
1862
|
+
/** 默认值(表达式失败时使用) */
|
|
1863
|
+
fallback?: unknown;
|
|
1864
|
+
}
|
|
1865
|
+
/**
|
|
1866
|
+
* 检查是否为表达式绑定
|
|
1867
|
+
*/
|
|
1868
|
+
declare function isExpressionBinding(value: unknown): value is ExpressionBinding;
|
|
1869
|
+
/**
|
|
1870
|
+
* 创建表达式绑定
|
|
1871
|
+
*/
|
|
1872
|
+
declare function createExpressionBinding(expression: string, fallback?: unknown): ExpressionBinding;
|
|
1873
|
+
|
|
1874
|
+
/**
|
|
1875
|
+
* Schema 迁移脚本
|
|
1876
|
+
* 用于 Editor/Platform 在读取草稿/发布版本时做迁移
|
|
1877
|
+
*
|
|
1878
|
+
* 原则:
|
|
1879
|
+
* 1. 不可变版本:发布后永不修改
|
|
1880
|
+
* 2. 向前迁移:从旧版本迁移到新版本
|
|
1881
|
+
* 3. 草稿迁移:Editor 打开草稿时执行
|
|
1882
|
+
* 4. 发布固化:发布时固化迁移后的 Schema
|
|
1883
|
+
*/
|
|
1884
|
+
|
|
1885
|
+
declare const SCHEMA_VERSIONS: readonly ["1.0.0", "1.1.0", "2.0.0"];
|
|
1886
|
+
type SchemaVersion = (typeof SCHEMA_VERSIONS)[number];
|
|
1887
|
+
declare const CURRENT_SCHEMA_VERSION: SchemaVersion;
|
|
1888
|
+
/**
|
|
1889
|
+
* 迁移函数类型
|
|
1890
|
+
*/
|
|
1891
|
+
type MigrationFn<T = PageSchema> = (data: T) => T;
|
|
1892
|
+
/**
|
|
1893
|
+
* 迁移定义
|
|
1894
|
+
*/
|
|
1895
|
+
interface Migration {
|
|
1896
|
+
/** 源版本 */
|
|
1897
|
+
from: string;
|
|
1898
|
+
/** 目标版本 */
|
|
1899
|
+
to: string;
|
|
1900
|
+
/** 迁移描述 */
|
|
1901
|
+
description: string;
|
|
1902
|
+
/** 迁移函数 */
|
|
1903
|
+
migrate: MigrationFn;
|
|
1904
|
+
/** 是否破坏性变更 */
|
|
1905
|
+
breaking?: boolean;
|
|
1906
|
+
}
|
|
1907
|
+
/**
|
|
1908
|
+
* 迁移结果
|
|
1909
|
+
*/
|
|
1910
|
+
interface MigrationResult<T = PageSchema> {
|
|
1911
|
+
/** 是否成功 */
|
|
1912
|
+
success: boolean;
|
|
1913
|
+
/** 迁移后的数据 */
|
|
1914
|
+
data?: T;
|
|
1915
|
+
/** 原始版本 */
|
|
1916
|
+
fromVersion: string;
|
|
1917
|
+
/** 目标版本 */
|
|
1918
|
+
toVersion: string;
|
|
1919
|
+
/** 应用的迁移列表 */
|
|
1920
|
+
appliedMigrations: string[];
|
|
1921
|
+
/** 错误信息 */
|
|
1922
|
+
error?: string;
|
|
1923
|
+
}
|
|
1924
|
+
/**
|
|
1925
|
+
* 注册迁移
|
|
1926
|
+
*/
|
|
1927
|
+
declare function registerMigration(migration: Migration): void;
|
|
1928
|
+
/**
|
|
1929
|
+
* 获取所有迁移
|
|
1930
|
+
*/
|
|
1931
|
+
declare function getAllMigrations(): Migration[];
|
|
1932
|
+
/**
|
|
1933
|
+
* 查找从源版本到目标版本的迁移路径
|
|
1934
|
+
*/
|
|
1935
|
+
declare function findMigrationPath(from: string, to: string): Migration[];
|
|
1936
|
+
/**
|
|
1937
|
+
* 执行 PageSchema 迁移
|
|
1938
|
+
*/
|
|
1939
|
+
declare function migratePageSchema(data: PageSchema, targetVersion?: string): MigrationResult<PageSchema>;
|
|
1940
|
+
/**
|
|
1941
|
+
* 检查是否需要迁移
|
|
1942
|
+
*/
|
|
1943
|
+
declare function needsMigration(data: PageSchema, targetVersion?: string): boolean;
|
|
1944
|
+
/**
|
|
1945
|
+
* 获取版本信息
|
|
1946
|
+
*/
|
|
1947
|
+
declare function getVersionInfo(version: string): {
|
|
1948
|
+
major: number;
|
|
1949
|
+
minor: number;
|
|
1950
|
+
patch: number;
|
|
1951
|
+
};
|
|
1952
|
+
/**
|
|
1953
|
+
* 比较版本
|
|
1954
|
+
* @returns -1 if a < b, 0 if a === b, 1 if a > b
|
|
1955
|
+
*/
|
|
1956
|
+
declare function compareVersions(a: string, b: string): number;
|
|
1957
|
+
|
|
1958
|
+
export { ACTION_SPEC_VERSION, ALLOWED_ROOT_VARIABLES, type ActionAuditLog, type ActionContext, type ActionDefVersionId, type ActionDefinition, type ActionDefinitionStatus, type ActionDefinitionVersion, type ActionExecuteRequest, type ActionExecuteResponse, type ApiConfig, type ApiResponse, type Asset, type AssetMeta, type AssetSortField, type AssetStatus, type AssetType, type AuditStatus, BUILTIN_FUNCTIONS, BUILTIN_FUNCTION_NAMES, type BatchItemResult, type BatchRequest, type BatchResult, type BinaryNode, type BinaryOperator, type BlockedComponent, type BuiltinActionType, type BuiltinFunction, COMPONENT_CATEGORIES, COMPONENT_META_SCHEMA_VERSION, CURRENT_SCHEMA_VERSION, type CacheConfig, type CallNode, type CanvasConfig, type CanvasType, type CapabilitiesDefinition, type ChangeLog, type ChangeLogItem, type ClipboardResult, type CompatDefinition, type ComponentCategory, type ComponentEvent, type ComponentInstance, type ComponentLayout, type ComponentLoadResult, type ComponentLoadStatus, type ComponentMeta, type ComponentRegistry, type ComponentStatus, type ComponentStyle, type ComponentVersionId, type ComponentVersionRecord, type ContractsVersion, DATA_QUERY_SPEC_VERSION, type DataQueryContext, type DataQueryDefinition, type DataQueryDefinitionStatus, type DataQueryDefinitionVersion, type DataQueryRequest, type DataQueryResponse, type DataQueryVersionId, type DataSourceConfig, type DataSourceType, type DeepReadonly, type DependencyHealth, type DialogOptions, type DjvlcError, type ErrorBoundaryHandler, ErrorCode, ErrorCodeCategory, ErrorMessages, type EventAction, type EventBus, type EventDefinition, type EventsDefinition, type ExpressionBinding, type ExpressionContext, type ExpressionError, type ExpressionErrorType, type ExpressionNode, type ExpressionType, type ExpressionValidationResult, type ExpressionWarning, type FieldPermission, type FunctionParam, type GenericStatus, type GrayPublishConfig, type GrayRule, type Guide, type HealthCheckResponse, type HostAPI, type IdempotencyRule, type IdentifierNode, type IntegrityDefinition, type JsonSchema, type KeyValuePair, type LiteralNode, type LowcodeAction, type ManifestItem, type MaskRule, type MemberNode, type Migration, type MigrationFn, type MigrationResult, type NavigateOptions, type NonNullableProperties, type OperatorInfo, PAGE_SCHEMA_VERSION, type PageConfig, type PageManifest, type PageMeta, type PageResolveRequest, type PageResolveResult, type PageSchema, type PageSortField, type PageStatus, type PageUid, type PageVersionId, type PaginatedApiResponse, type PaginatedResult, type PaginationMeta, type PaginationParams, type PartialBy, type PerformanceMetric, type PerformanceMetricType, type PropsSchema, type PublishChannel, type PublishConfig, PublishStatus, type QueryAuditLog, type QueryPermissionConfig, type RateLimitRule, type RequiredBy, type RiskCheckRequest, type RiskCheckResult, type RolloutConfig, type RuntimeConfig, type RuntimeContext, type RuntimeError, type RuntimeErrorType, type RuntimeEvent, type RuntimeEventType, SCHEMA_VERSIONS, type SchemaVersion, type SortConfig, type SortOrder, type StandardRequestHeaders, type StandardResponseHeaders, type StorageOptions, type TemplateCategory, type TemplateSortField, type TimeRange, type ToastOptions, type TraceId, type TrackEvent, type UnaryOperator, type UploadCredentialRequest, type UploadCredentialResponse, type ValueType, type VersionDiff, type VersionInfo, type WsMessage, type WsMessageType, compareVersions, createDjvlcError, createExpressionBinding, findMigrationPath, getAllMigrations, getContractsVersion, getHttpStatusFromErrorCode, getVersionInfo, isExpressionBinding, isRetryableError, isVersionCompatible, migratePageSchema, needsMigration, registerMigration };
|