@djvlc/contracts-types 1.7.0 → 1.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -790,6 +790,116 @@ interface Expression {
790
790
  returnType?: string;
791
791
  };
792
792
  }
793
+ /**
794
+ * 表达式求值上下文
795
+ *
796
+ * @description
797
+ * 表达式引擎在求值时可访问的上下文对象。
798
+ * 所有动态表达式(state/binding/context/template/computed)都从此上下文获取数据。
799
+ *
800
+ * 使用场景:
801
+ * - Runtime 表达式求值
802
+ * - 编辑器表达式预览
803
+ * - 表达式校验与调试
804
+ *
805
+ * @example
806
+ * ```typescript
807
+ * const ctx: ExpressionContext = {
808
+ * state: { count: 0, userInfo: { name: 'Alice' } },
809
+ * binding: { userList: [{ id: 1, name: 'Bob' }] },
810
+ * context: { item: { id: 1, name: 'Bob' }, index: 0 },
811
+ * };
812
+ *
813
+ * // 求值 { type: 'state', value: 'userInfo.name' } => 'Alice'
814
+ * // 求值 { type: 'context', value: 'item.name' } => 'Bob'
815
+ * ```
816
+ */
817
+ interface ExpressionContext {
818
+ /**
819
+ * 页面状态
820
+ *
821
+ * @description
822
+ * 对应 PageState.fields 的运行时值。
823
+ * 表达式通过 { type: 'state', value: 'fieldName.path' } 访问。
824
+ */
825
+ state: Record<string, unknown>;
826
+ /**
827
+ * 数据绑定结果
828
+ *
829
+ * @description
830
+ * 对应 DataBinding 查询的返回数据,按 bindingId 组织。
831
+ * 表达式通过 { type: 'binding', value: 'bindingId.path' } 访问。
832
+ */
833
+ binding: Record<string, unknown>;
834
+ /**
835
+ * 局部上下文
836
+ *
837
+ * @description
838
+ * 包含循环变量、事件参数等临时作用域数据。
839
+ * 表达式通过 { type: 'context', value: 'item.path' } 访问。
840
+ */
841
+ context: ExpressionLocalContext;
842
+ /**
843
+ * 组件属性(可选)
844
+ *
845
+ * @description
846
+ * 当前组件的 props 值,供组件内部表达式访问。
847
+ * 通常在组件内部求值时提供。
848
+ */
849
+ props?: Record<string, unknown>;
850
+ /**
851
+ * 当前事件(可选)
852
+ *
853
+ * @description
854
+ * 事件处理器执行时的事件对象。
855
+ * 仅在事件处理链中可用。
856
+ */
857
+ event?: ExpressionEventContext;
858
+ }
859
+ /**
860
+ * 局部上下文(循环变量、事件参数等)
861
+ */
862
+ interface ExpressionLocalContext {
863
+ /**
864
+ * 循环项(loop.itemName 指定的变量名)
865
+ *
866
+ * @description
867
+ * 在 loop 渲染中,当前迭代的数据项。
868
+ */
869
+ item?: unknown;
870
+ /**
871
+ * 循环索引(loop.indexName 指定的变量名)
872
+ *
873
+ * @description
874
+ * 在 loop 渲染中,当前迭代的索引。
875
+ */
876
+ index?: number;
877
+ /**
878
+ * 动态扩展字段
879
+ *
880
+ * @description
881
+ * 支持自定义局部变量,如嵌套循环的多个 item/index。
882
+ */
883
+ [key: string]: unknown;
884
+ }
885
+ /**
886
+ * 事件上下文
887
+ */
888
+ interface ExpressionEventContext {
889
+ /** 事件类型 */
890
+ type: string;
891
+ /** 事件目标(组件实例 ID) */
892
+ target?: string;
893
+ /** 事件载荷(组件抛出的数据) */
894
+ payload?: unknown;
895
+ /** 原生事件(如 MouseEvent 的部分安全属性) */
896
+ nativeEvent?: {
897
+ clientX?: number;
898
+ clientY?: number;
899
+ key?: string;
900
+ keyCode?: number;
901
+ };
902
+ }
793
903
  /**
794
904
  * 任意值或表达式
795
905
  *
@@ -805,6 +915,21 @@ type AnyValueOrExpression = Expression | string | number | boolean | null | AnyV
805
915
  * @deprecated 使用 AnyValueOrExpression 代替
806
916
  */
807
917
  type PropValue = AnyValueOrExpression;
918
+ /**
919
+ * 创建空的表达式上下文
920
+ *
921
+ * @description
922
+ * 用于初始化表达式求值环境,所有字段都有合理的默认值。
923
+ */
924
+ declare function createExpressionContext(partial?: Partial<ExpressionContext>): ExpressionContext;
925
+ /**
926
+ * 创建带循环变量的局部上下文
927
+ *
928
+ * @param item - 当前循环项
929
+ * @param index - 当前循环索引
930
+ * @param extras - 额外的局部变量(如嵌套循环)
931
+ */
932
+ declare function createLoopContext(item: unknown, index: number, extras?: Record<string, unknown>): ExpressionLocalContext;
808
933
  /**
809
934
  * 创建字面量表达式
810
935
  * @deprecated V2 版本移除 literal 表达式类型,静态值请直接使用原始类型
@@ -1704,14 +1829,487 @@ interface PageDraft {
1704
1829
  updatedAt: ISODateTime;
1705
1830
  }
1706
1831
 
1832
+ /**
1833
+ * 页面快照类型(CDN 产物核心结构)
1834
+ *
1835
+ * @description
1836
+ * PageSnapshotJson 是发布后生成的运行时渲染闭包,包含:
1837
+ * - 页面渲染数据
1838
+ * - 组件锁定清单
1839
+ * - Definition 版本摘要
1840
+ * - 运维配置引用
1841
+ * - 元数据
1842
+ *
1843
+ * 设计原则:一次 resolve 返回渲染所需的一切闭包,减少运行时请求次数。
1844
+ */
1845
+
1846
+ /**
1847
+ * 页面快照 JSON 结构
1848
+ *
1849
+ * @description
1850
+ * 对应 CDN 产物:`/pages/{pageId}/{pageVersionId}/snapshot.json`
1851
+ * Runtime 加载此文件即可完成页面渲染。
1852
+ */
1853
+ interface PageSnapshotJson {
1854
+ /**
1855
+ * 页面渲染数据
1856
+ */
1857
+ page: PageSnapshotPage;
1858
+ /**
1859
+ * 组件锁定清单
1860
+ */
1861
+ manifest: PageSnapshotManifest;
1862
+ /**
1863
+ * 绑定的 Definition 版本摘要(审计/回放用)
1864
+ */
1865
+ definitionsDigest: DefinitionsDigest;
1866
+ /**
1867
+ * 运维配置(内联或引用)
1868
+ */
1869
+ ops: OpsConfig;
1870
+ /**
1871
+ * 元数据
1872
+ */
1873
+ meta: PageSnapshotMeta;
1874
+ }
1875
+ /**
1876
+ * 页面渲染数据
1877
+ */
1878
+ interface PageSnapshotPage {
1879
+ /** Schema 版本 */
1880
+ schemaVersion: string;
1881
+ /** 页面 ID */
1882
+ pageId: string;
1883
+ /** 页面版本 */
1884
+ pageVersion: SemVer;
1885
+ /** 页面标题 */
1886
+ title: string;
1887
+ /** 初始状态 */
1888
+ initialState: Record<string, JsonValue>;
1889
+ /** 数据绑定配置 */
1890
+ bindings: DataBinding[];
1891
+ /** 组件树根节点 */
1892
+ root: ComponentNode;
1893
+ /** 页面配置(画布类型、背景等) */
1894
+ config: {
1895
+ canvasType: 'h5' | 'tablet' | 'pc' | 'responsive';
1896
+ canvasSize?: {
1897
+ width: number;
1898
+ height: number;
1899
+ };
1900
+ background?: {
1901
+ type: 'color' | 'image' | 'gradient';
1902
+ value: string;
1903
+ };
1904
+ cssVariables?: Record<string, string>;
1905
+ };
1906
+ /** SEO 配置 */
1907
+ seo?: {
1908
+ title?: string;
1909
+ description?: string;
1910
+ keywords?: string[];
1911
+ };
1912
+ }
1913
+ /**
1914
+ * 组件锁定清单(Snapshot 内嵌版本)
1915
+ */
1916
+ interface PageSnapshotManifest {
1917
+ /** 组件列表 */
1918
+ components: SnapshotComponentEntry[];
1919
+ /** Runtime 版本要求 */
1920
+ runtime: {
1921
+ /** 推荐版本 */
1922
+ version: SemVer;
1923
+ /** 最低版本 */
1924
+ minVersion: SemVer;
1925
+ };
1926
+ }
1927
+ /**
1928
+ * Snapshot 中的组件条目
1929
+ */
1930
+ interface SnapshotComponentEntry {
1931
+ /** 组件名称 */
1932
+ name: string;
1933
+ /** 组件版本 */
1934
+ version: SemVer;
1935
+ /** SRI 完整性哈希 */
1936
+ integrity: SHAIntegrity;
1937
+ /** CDN 资源基础 URL */
1938
+ assetsUrl: string;
1939
+ /** 入口点 */
1940
+ entrypoints: {
1941
+ /** JS 入口(相对于 assetsUrl) */
1942
+ js: string;
1943
+ /** CSS 入口(可选) */
1944
+ css?: string;
1945
+ /** 分包列表(可选) */
1946
+ chunks?: string[];
1947
+ };
1948
+ /** 是否预加载 */
1949
+ preload?: boolean;
1950
+ /** 加载优先级 */
1951
+ priority?: 'critical' | 'high' | 'normal' | 'low';
1952
+ }
1953
+ /**
1954
+ * Definition 版本摘要
1955
+ *
1956
+ * @description
1957
+ * 记录页面绑定的 ActionDefinition 和 DataQueryDefinition 版本。
1958
+ * 用于审计、回放、版本追溯。
1959
+ */
1960
+ interface DefinitionsDigest {
1961
+ /** 绑定的 Action Definition 版本 */
1962
+ actions: DefinitionVersionDigest[];
1963
+ /** 绑定的 Data Query Definition 版本 */
1964
+ queries: DefinitionVersionDigest[];
1965
+ }
1966
+ /**
1967
+ * 单个 Definition 版本摘要
1968
+ */
1969
+ interface DefinitionVersionDigest {
1970
+ /** Definition ID */
1971
+ id: UniqueId;
1972
+ /** Definition 名称 */
1973
+ name: string;
1974
+ /** 版本 ID */
1975
+ versionId: UniqueId;
1976
+ /** 内容哈希(用于完整性校验) */
1977
+ hash: string;
1978
+ }
1979
+ /**
1980
+ * 运维配置
1981
+ *
1982
+ * @description
1983
+ * 包含 kill-switch、blocked 组件列表、功能开关等运维控制配置。
1984
+ * 由 User API resolve 时下发,Runtime 据此做运行时控制。
1985
+ */
1986
+ interface OpsConfig {
1987
+ /** 配置版本 ID(用于缓存失效) */
1988
+ configVersionId?: string;
1989
+ /** Kill-Switch 列表(被紧急关闭的功能/动作) */
1990
+ killSwitch: KillSwitchItem[];
1991
+ /** 被阻断的组件列表 */
1992
+ blockedComponents: BlockedComponentItem[];
1993
+ /** 功能开关 */
1994
+ flags: Record<string, boolean>;
1995
+ /** 限流配置(可选) */
1996
+ rateLimit?: {
1997
+ /** 全局 QPS 限制 */
1998
+ globalQps?: number;
1999
+ /** 按动作类型的 QPS 限制 */
2000
+ actionQps?: Record<string, number>;
2001
+ };
2002
+ /** 配置过期时间(用于缓存) */
2003
+ expiresAt?: ISODateTime;
2004
+ }
2005
+ /**
2006
+ * Kill-Switch 条目
2007
+ */
2008
+ interface KillSwitchItem {
2009
+ /** 目标类型 */
2010
+ targetType: 'action' | 'component' | 'feature' | 'page' | 'query';
2011
+ /** 目标 ID(actionType / componentName / featureKey / pageId / queryId) */
2012
+ targetId: string;
2013
+ /** 是否启用(true = 被关闭) */
2014
+ enabled: boolean;
2015
+ /** 关闭原因 */
2016
+ reason?: string;
2017
+ /** 关闭时间 */
2018
+ enabledAt?: ISODateTime;
2019
+ /** 关闭操作者 */
2020
+ enabledBy?: string;
2021
+ /** 用户提示消息 */
2022
+ userMessage?: string;
2023
+ }
2024
+ /**
2025
+ * 被阻断的组件条目
2026
+ */
2027
+ interface BlockedComponentItem {
2028
+ /** 组件名称 */
2029
+ name: string;
2030
+ /** 组件版本(可选,不指定则阻断所有版本) */
2031
+ version?: SemVer;
2032
+ /** 阻断原因 */
2033
+ reason: string;
2034
+ /** 阻断时间 */
2035
+ blockedAt: ISODateTime;
2036
+ /** 阻断操作者 */
2037
+ blockedBy: string;
2038
+ /** 降级版本(可选) */
2039
+ fallbackVersion?: SemVer;
2040
+ /** 是否紧急阻断 */
2041
+ urgent: boolean;
2042
+ }
2043
+ /**
2044
+ * 页面快照元数据
2045
+ *
2046
+ * @description
2047
+ * 对应 CDN 产物:`/pages/{pageId}/{pageVersionId}/meta.json`
2048
+ * 用于审计、回放、排查。
2049
+ */
2050
+ interface PageSnapshotMeta {
2051
+ /** 页面 ID */
2052
+ pageId: UniqueId;
2053
+ /** 页面版本 ID */
2054
+ pageVersionId: UniqueId;
2055
+ /** 发布 ID(用于追踪发布操作) */
2056
+ publishId: UniqueId;
2057
+ /** Schema 版本 */
2058
+ schemaVersion: string;
2059
+ /** 创建时间 */
2060
+ createdAt: ISODateTime;
2061
+ /** 创建者 */
2062
+ createdBy: string;
2063
+ /** 内容哈希 */
2064
+ contentHash: string;
2065
+ /** 绑定摘要 */
2066
+ bindings: {
2067
+ /** 组件版本列表(格式:name@version) */
2068
+ componentVersions: string[];
2069
+ /** Definition 版本列表 */
2070
+ definitionVersions: string[];
2071
+ };
2072
+ /** Runtime 版本 */
2073
+ runtimeVersion: SemVer;
2074
+ /** 环境 */
2075
+ env?: 'preview' | 'staging' | 'prod';
2076
+ }
2077
+ /**
2078
+ * Bootstrap 配置
2079
+ *
2080
+ * @description
2081
+ * 极小的启动参数,用于静态 HTML 场景。
2082
+ * 对应 CDN 产物:`/pages/{pageId}/{pageVersionId}/bootstrap.json`
2083
+ *
2084
+ * 使用场景:
2085
+ * - 静态 HTML 页面(不经过服务端渲染)
2086
+ * - 嵌入式页面(iframe)
2087
+ * - 离线缓存场景
2088
+ */
2089
+ interface BootstrapConfig {
2090
+ /** 页面 ID */
2091
+ pageId: UniqueId;
2092
+ /** 页面版本 ID */
2093
+ pageVersionId: UniqueId;
2094
+ /** Runtime 版本 */
2095
+ runtimeVersion: SemVer;
2096
+ /** Runtime 入口 URL */
2097
+ runtimeEntryUrl: string;
2098
+ /** 页面 JSON URL(snapshot.json) */
2099
+ snapshotUrl: string;
2100
+ /** Manifest URL */
2101
+ manifestUrl: string;
2102
+ /** CDN 基础 URL */
2103
+ cdnBaseUrl: string;
2104
+ /** API 基础 URL */
2105
+ apiBaseUrl: string;
2106
+ /** 环境 */
2107
+ env: 'preview' | 'staging' | 'prod';
2108
+ /** 预连接 URL 列表(性能优化) */
2109
+ preconnectUrls?: string[];
2110
+ /** 预加载资源列表 */
2111
+ preloadAssets?: string[];
2112
+ }
2113
+ /**
2114
+ * 预览 Token
2115
+ *
2116
+ * @description
2117
+ * Editor 生成预览链接时使用的令牌。
2118
+ * 存储在 Redis,短 TTL(通常 1-4 小时)。
2119
+ *
2120
+ * 使用流程:
2121
+ * 1. Editor 调用 Admin API 生成预览 Token
2122
+ * 2. 预览链接:`https://{domain}/preview/{token}`
2123
+ * 3. Runtime 调用 User API 验证 Token 并获取草稿内容
2124
+ */
2125
+ interface PreviewToken {
2126
+ /** Token 值 */
2127
+ token: string;
2128
+ /** 页面 ID */
2129
+ pageId: UniqueId;
2130
+ /** 页面版本 ID(如果预览已发布版本) */
2131
+ pageVersionId?: UniqueId;
2132
+ /** 草稿 ID(如果预览草稿) */
2133
+ draftId?: UniqueId;
2134
+ /** 预览类型 */
2135
+ type: 'draft' | 'version';
2136
+ /** 过期时间 */
2137
+ expiresAt: ISODateTime;
2138
+ /** 创建时间 */
2139
+ createdAt: ISODateTime;
2140
+ /** 创建者 */
2141
+ createdBy: string;
2142
+ /** 允许的访问者(可选,用于限制预览范围) */
2143
+ allowedViewers?: string[];
2144
+ /** 是否允许编辑(预览时是否可以修改草稿) */
2145
+ allowEdit?: boolean;
2146
+ }
2147
+ /**
2148
+ * 预览 Token 创建请求
2149
+ */
2150
+ interface CreatePreviewTokenRequest {
2151
+ /** 页面 ID */
2152
+ pageId: UniqueId;
2153
+ /** 预览类型 */
2154
+ type: 'draft' | 'version';
2155
+ /** 页面版本 ID(type 为 version 时必填) */
2156
+ pageVersionId?: UniqueId;
2157
+ /** 过期时间(秒),默认 3600 */
2158
+ ttlSeconds?: number;
2159
+ /** 允许的访问者 */
2160
+ allowedViewers?: string[];
2161
+ }
2162
+ /**
2163
+ * 预览 Token 验证响应
2164
+ */
2165
+ interface PreviewTokenValidationResult {
2166
+ /** 是否有效 */
2167
+ valid: boolean;
2168
+ /** Token 信息(有效时返回) */
2169
+ token?: PreviewToken;
2170
+ /** 错误原因(无效时返回) */
2171
+ error?: 'expired' | 'not_found' | 'invalid_viewer' | 'revoked';
2172
+ }
2173
+ /**
2174
+ * 页面完整性校验 JSON
2175
+ *
2176
+ * @description
2177
+ * 对应 CDN 产物:`/pages/{pageId}/{pageVersionId}/integrity.json`
2178
+ * 用于防篡改校验。
2179
+ */
2180
+ interface PageIntegrityJson {
2181
+ /** 文件完整性哈希 */
2182
+ files: {
2183
+ /** snapshot.json 的哈希 */
2184
+ 'snapshot.json': SHAIntegrity;
2185
+ /** manifest.json 的哈希 */
2186
+ 'manifest.json': SHAIntegrity;
2187
+ /** meta.json 的哈希(可选) */
2188
+ 'meta.json'?: SHAIntegrity;
2189
+ };
2190
+ /** 聚合哈希(所有文件的综合哈希) */
2191
+ aggregateHash: SHAIntegrity;
2192
+ /** 签名(可选,用于更高安全级别) */
2193
+ signature?: {
2194
+ /** 签名算法 */
2195
+ algorithm: 'ed25519' | 'rsa-sha256';
2196
+ /** 签名值(Base64) */
2197
+ value: string;
2198
+ /** 公钥 ID(用于查找对应的公钥) */
2199
+ keyId: string;
2200
+ };
2201
+ /** 生成时间 */
2202
+ generatedAt: ISODateTime;
2203
+ /** 生成者 */
2204
+ generatedBy: string;
2205
+ }
2206
+ /**
2207
+ * 页面资源列表 JSON
2208
+ *
2209
+ * @description
2210
+ * 对应 CDN 产物:`/pages/{pageId}/{pageVersionId}/assets.json`
2211
+ * 用于预热、排障。
2212
+ */
2213
+ interface PageAssetsJson {
2214
+ /** 页面 ID */
2215
+ pageId: UniqueId;
2216
+ /** 页面版本 ID */
2217
+ pageVersionId: UniqueId;
2218
+ /** Runtime 资源 */
2219
+ runtime: {
2220
+ /** Runtime 版本 */
2221
+ version: SemVer;
2222
+ /** JS 入口 */
2223
+ js: string;
2224
+ /** CSS 入口 */
2225
+ css?: string;
2226
+ };
2227
+ /** 组件资源 */
2228
+ components: {
2229
+ /** 组件名称 */
2230
+ name: string;
2231
+ /** 组件版本 */
2232
+ version: SemVer;
2233
+ /** JS 入口 */
2234
+ js: string;
2235
+ /** CSS 入口 */
2236
+ css?: string;
2237
+ /** 分包列表 */
2238
+ chunks?: string[];
2239
+ }[];
2240
+ /** 所有资源 URL 列表(用于预热) */
2241
+ allUrls: string[];
2242
+ /** 生成时间 */
2243
+ generatedAt: ISODateTime;
2244
+ }
2245
+
1707
2246
  /**
1708
2247
  * 页面解析响应类型
1709
2248
  */
1710
2249
 
1711
2250
  /**
1712
- * 页面解析响应(Runtime 使用)
2251
+ * 页面解析响应(User API → Runtime
2252
+ *
2253
+ * @description
2254
+ * 对应 User API:`GET /page/resolve`
2255
+ * Runtime 首先调用此接口获取要加载的版本信息。
1713
2256
  */
1714
2257
  interface PageResolveResponse {
2258
+ /** 页面 ID */
2259
+ pageId: UniqueId;
2260
+ /** 解析后的页面版本 ID */
2261
+ resolvedVersionId: UniqueId;
2262
+ /** CDN 基础 URL */
2263
+ cdnBase: string;
2264
+ /** Snapshot URL */
2265
+ snapshotUrl: string;
2266
+ /** Manifest URL */
2267
+ manifestUrl: string;
2268
+ /** 运维配置 */
2269
+ ops: OpsConfig;
2270
+ /** ETag(用于缓存) */
2271
+ etag: string;
2272
+ /** 缓存 TTL(秒) */
2273
+ cacheTtlSeconds: number;
2274
+ /** 灰度匹配信息(可选,用于调试) */
2275
+ rolloutMatch?: {
2276
+ /** 匹配的策略 ID */
2277
+ strategyId?: string;
2278
+ /** 匹配的策略名称 */
2279
+ strategyName?: string;
2280
+ /** 是否使用默认版本 */
2281
+ isDefault: boolean;
2282
+ };
2283
+ }
2284
+ /**
2285
+ * 页面解析请求参数
2286
+ */
2287
+ interface PageResolveRequest {
2288
+ /** 页面 ID */
2289
+ pageId: UniqueId;
2290
+ /** 环境 */
2291
+ env?: 'preview' | 'staging' | 'prod';
2292
+ /** 用户 ID(用于灰度) */
2293
+ uid?: string;
2294
+ /** 设备 ID(用于灰度) */
2295
+ deviceId?: string;
2296
+ /** 渠道(用于灰度) */
2297
+ channel?: string;
2298
+ /** 是否包含完整 Snapshot(CDN 失败保底) */
2299
+ includeSnapshot?: boolean;
2300
+ }
2301
+ /**
2302
+ * 页面解析响应(包含 Snapshot 的保底版本)
2303
+ */
2304
+ interface PageResolveWithSnapshotResponse extends PageResolveResponse {
2305
+ /** 完整的页面快照(CDN 失败时使用) */
2306
+ snapshot: PageSnapshotJson;
2307
+ }
2308
+ /**
2309
+ * 页面解析响应(旧版本)
2310
+ * @deprecated 使用 PageResolveResponse 代替
2311
+ */
2312
+ interface LegacyPageResolveResponse {
1715
2313
  /** 页面版本 ID */
1716
2314
  pageVersionId: UniqueId;
1717
2315
  /** 页面 Schema */
@@ -1724,7 +2322,8 @@ interface PageResolveResponse {
1724
2322
  preloadedData?: Record<string, JsonValue>;
1725
2323
  }
1726
2324
  /**
1727
- * 运行时配置
2325
+ * 运行时配置(旧版本)
2326
+ * @deprecated 使用 OpsConfig 代替
1728
2327
  */
1729
2328
  interface RuntimeConfig {
1730
2329
  /** 推荐的运行时版本 */
@@ -4252,4 +4851,4 @@ declare const ACTION_SPEC_VERSION = "2.0.0";
4252
4851
  */
4253
4852
  declare const DATA_QUERY_SPEC_VERSION = "2.0.0";
4254
4853
 
4255
- export { type ABTestRolloutConfig, ACTION_SPEC_VERSION, ALLOWED_FUNCTION_NAMES, ALL_BUILTIN_FUNCTIONS, ARRAY_FUNCTIONS, type ActionClientContext, type ActionDefinition, type ActionDefinitionVersion, type ActionExecuteRequest, type ActionExecuteResponse, type ActionExecutor, type ActionPolicy, type ActionRef, type ActionResult, type ActionSheetItem, type ActionSheetOptions, type ActionSheetResult, type ActionSpec, ActionType, type Activity, type ActivityPrecondition, type ActivityRule, type ActivityStatus, type ActivityType, type AggregationDataSourceConfig, type AggregationQueryItem, type AnyValueOrExpression, type ApiErrorDetail, type ApiErrorResponse, type ApiResponse, type ApiSuccessResponse, type AppContext, AuditAction, type AuditConfig, type AuditLogEntry, type BackgroundConfig, type BaseActivityRule, type BlacklistRolloutConfig, type BlockedComponentInfo, type BrowserCompat, type BuiltinActionType, COMPONENT_META_SCHEMA_VERSION, CURRENT_ACTION_SPEC_VERSION, CURRENT_COMPONENT_META_VERSION, CURRENT_DATA_QUERY_SPEC_VERSION, CURRENT_SCHEMA_VERSION, type CacheConfig, type CacheLevel, type CanaryHealthCheck, type CanaryRolloutConfig, type CanaryStage, type CanvasType, type CapabilityDeclaration, type CapabilityName, type ChangeLog, type ChangeLogItem, type ClaimActivityRule, type ClaimPrize, type ClaimRecord, type ClaimState, type ClipboardApi, type CompatInfo, type Component, type ComponentCategory, type ComponentContext, type ComponentDependency, type ComponentIntegrity, type ComponentMeta, type ComponentNode, type ComponentQueryParams, type ComponentRegisterRequest, type ComponentStatus, type ComponentStatusChangeRequest, type ComponentVersion, type ConfirmOptions, type ConsecutiveReward, type CreateManifestRequest, type CumulativeReward, DATA_QUERY_SPEC_VERSION, DATE_FUNCTIONS, DEFAULT_EXPRESSION_VALIDATION_CONFIG, type DataBinding, type DataBindingErrorConfig, type DataLoadStrategy, type DataQueryDefinition, type DataQueryDefinitionVersion, type DataQueryRequest, type DataQueryResponse, type DataQuerySpec, type DataSourceConfig, type DataSourceType, type DatabaseDataSourceConfig, type DialogOptions, type DialogResult, type DjvlcError, type EditorComponent, type Environment, ErrorCategory, ErrorCode, ErrorCodeToHttpStatus, type ErrorMapping, ErrorMessages, type EventDeclaration, type EventHandler, type ExecutorContext, type ExecutorResult, type Expression, type ExpressionFunctionCategory, type ExpressionFunctionDefinition, type ExpressionType, type ExpressionValidationConfig, type ExpressionValidationError, type ExpressionValidationResult, type ExpressionValidationWarning, FORMAT_FUNCTIONS, type FallbackCondition, type FallbackConfig, type FeatureCondition, type FeatureRolloutConfig, type FieldPermission, type FieldPolicy, type FieldTransform, type FileIntegrity, type FunctionParamDefinition, type GraphQLDataSourceConfig, type HostApi, type HttpDataSourceConfig, type HttpRetryConfig, type I18nDetectionStrategy, type ISODateTime, type IdempotencyKeyStrategy, type IdempotencyRule, type IntegrityHash, type InternalDataSourceConfig, type InventoryConfig, type JsonObject, type JsonValue, LOGIC_FUNCTIONS, type LayoutConfig, type LayoutValues, type LoopConfig, type LotteryActivityRule, type LotteryCost, type LotteryPrize, type LotteryState, type Manifest, type ManifestEntry, type ManifestItem, type ManifestValidationError, type ManifestValidationResult, type ManifestValidationWarning, type MaskingConfig, type MaskingRule, type MaskingType, type MethodCategory, type MethodDeclaration, type MethodParam, NUMBER_FUNCTIONS, type NavigateOptions, type NodeStyleConfig, type OperatorInfo, type OrderByItem, PAGE_SCHEMA_VERSION, PROTOCOL_VERSION, type PageConfig, type PageDraft, type PageI18nConfig, type PageLifecycle, type PageManifest, type PageMeta, type PageResolveResponse, type PageSEO, type PageSchema, type PageState, PageStatus, type PageStatusType, type PageVersion, type PaginatedResponse, type PaginationMeta, type PaginationParams, type ParamPermission, type ParticipationLimit, type PercentageRolloutConfig, type PityConfig, type Precondition, type PreconditionType, type PreviewImageOptions, type ProbabilityConfig, type PropDefinition, type PropFormat, type PropGroup, type PropType, type PropValue, type PropsSchema, type PublishCdnConfig, PublishChannel, type PublishConfig, type PublishEnvironment, type PublishNotificationConfig, type PublishRecord, type PublishRolloutConfig, PublishStatus, type QueryPermissions, type RateLimitDimension, type RateLimitItem, type RateLimitRule, type RequestContext, type ResolvedManifest, type ResponsiveBreakpoints, type RetryPolicy, type RiskControlConfig, type RolloutConfig, type RolloutMatchRequest, type RolloutMatchResult, type RolloutStrategy, type RolloutStrategyConfig, type RolloutStrategyType, type RuntimeConfig, type RuntimeContext, type RuntimeSpec, type SHAIntegrity, STRING_FUNCTIONS, type ScanCodeResult, type SchemaVersion, type SemVer, type ShareOptions, type ShareResult, type SigninActivityRule, type SigninRecord, type SigninRewardRecord, type SigninState, type SlotCategory, type SlotDeclaration, type StateFieldDefinition, type StorageApi, type StorageOptions, type StyleConfig, type StyleIsolation, type TimeWindowRolloutConfig, type ToastOptions, type TrackEvent, type URLString, UTILITY_FUNCTIONS, type UniqueId, type UpsertRolloutRequest, type UserActivityState, type UserContext, VERSION, type ValidationRule, type VersionDiff, type VersionInfo, VersionStatus, type VersionStatusType, type WhitelistRolloutConfig, bindingRef, createDjvlcError, isDjvlcError, literal, queryRef, stateRef, template };
4854
+ export { type ABTestRolloutConfig, ACTION_SPEC_VERSION, ALLOWED_FUNCTION_NAMES, ALL_BUILTIN_FUNCTIONS, ARRAY_FUNCTIONS, type ActionClientContext, type ActionDefinition, type ActionDefinitionVersion, type ActionExecuteRequest, type ActionExecuteResponse, type ActionExecutor, type ActionPolicy, type ActionRef, type ActionResult, type ActionSheetItem, type ActionSheetOptions, type ActionSheetResult, type ActionSpec, ActionType, type Activity, type ActivityPrecondition, type ActivityRule, type ActivityStatus, type ActivityType, type AggregationDataSourceConfig, type AggregationQueryItem, type AnyValueOrExpression, type ApiErrorDetail, type ApiErrorResponse, type ApiResponse, type ApiSuccessResponse, type AppContext, AuditAction, type AuditConfig, type AuditLogEntry, type BackgroundConfig, type BaseActivityRule, type BlacklistRolloutConfig, type BlockedComponentInfo, type BlockedComponentItem, type BootstrapConfig, type BrowserCompat, type BuiltinActionType, COMPONENT_META_SCHEMA_VERSION, CURRENT_ACTION_SPEC_VERSION, CURRENT_COMPONENT_META_VERSION, CURRENT_DATA_QUERY_SPEC_VERSION, CURRENT_SCHEMA_VERSION, type CacheConfig, type CacheLevel, type CanaryHealthCheck, type CanaryRolloutConfig, type CanaryStage, type CanvasType, type CapabilityDeclaration, type CapabilityName, type ChangeLog, type ChangeLogItem, type ClaimActivityRule, type ClaimPrize, type ClaimRecord, type ClaimState, type ClipboardApi, type CompatInfo, type Component, type ComponentCategory, type ComponentContext, type ComponentDependency, type ComponentIntegrity, type ComponentMeta, type ComponentNode, type ComponentQueryParams, type ComponentRegisterRequest, type ComponentStatus, type ComponentStatusChangeRequest, type ComponentVersion, type ConfirmOptions, type ConsecutiveReward, type CreateManifestRequest, type CreatePreviewTokenRequest, type CumulativeReward, DATA_QUERY_SPEC_VERSION, DATE_FUNCTIONS, DEFAULT_EXPRESSION_VALIDATION_CONFIG, type DataBinding, type DataBindingErrorConfig, type DataLoadStrategy, type DataQueryDefinition, type DataQueryDefinitionVersion, type DataQueryRequest, type DataQueryResponse, type DataQuerySpec, type DataSourceConfig, type DataSourceType, type DatabaseDataSourceConfig, type DefinitionVersionDigest, type DefinitionsDigest, type DialogOptions, type DialogResult, type DjvlcError, type EditorComponent, type Environment, ErrorCategory, ErrorCode, ErrorCodeToHttpStatus, type ErrorMapping, ErrorMessages, type EventDeclaration, type EventHandler, type ExecutorContext, type ExecutorResult, type Expression, type ExpressionContext, type ExpressionEventContext, type ExpressionFunctionCategory, type ExpressionFunctionDefinition, type ExpressionLocalContext, type ExpressionType, type ExpressionValidationConfig, type ExpressionValidationError, type ExpressionValidationResult, type ExpressionValidationWarning, FORMAT_FUNCTIONS, type FallbackCondition, type FallbackConfig, type FeatureCondition, type FeatureRolloutConfig, type FieldPermission, type FieldPolicy, type FieldTransform, type FileIntegrity, type FunctionParamDefinition, type GraphQLDataSourceConfig, type HostApi, type HttpDataSourceConfig, type HttpRetryConfig, type I18nDetectionStrategy, type ISODateTime, type IdempotencyKeyStrategy, type IdempotencyRule, type IntegrityHash, type InternalDataSourceConfig, type InventoryConfig, type JsonObject, type JsonValue, type KillSwitchItem, LOGIC_FUNCTIONS, type LayoutConfig, type LayoutValues, type LegacyPageResolveResponse, type LoopConfig, type LotteryActivityRule, type LotteryCost, type LotteryPrize, type LotteryState, type Manifest, type ManifestEntry, type ManifestItem, type ManifestValidationError, type ManifestValidationResult, type ManifestValidationWarning, type MaskingConfig, type MaskingRule, type MaskingType, type MethodCategory, type MethodDeclaration, type MethodParam, NUMBER_FUNCTIONS, type NavigateOptions, type NodeStyleConfig, type OperatorInfo, type OpsConfig, type OrderByItem, PAGE_SCHEMA_VERSION, PROTOCOL_VERSION, type PageAssetsJson, type PageConfig, type PageDraft, type PageI18nConfig, type PageIntegrityJson, type PageLifecycle, type PageManifest, type PageMeta, type PageResolveRequest, type PageResolveResponse, type PageResolveWithSnapshotResponse, type PageSEO, type PageSchema, type PageSnapshotJson, type PageSnapshotManifest, type PageSnapshotMeta, type PageSnapshotPage, type PageState, PageStatus, type PageStatusType, type PageVersion, type PaginatedResponse, type PaginationMeta, type PaginationParams, type ParamPermission, type ParticipationLimit, type PercentageRolloutConfig, type PityConfig, type Precondition, type PreconditionType, type PreviewImageOptions, type PreviewToken, type PreviewTokenValidationResult, type ProbabilityConfig, type PropDefinition, type PropFormat, type PropGroup, type PropType, type PropValue, type PropsSchema, type PublishCdnConfig, PublishChannel, type PublishConfig, type PublishEnvironment, type PublishNotificationConfig, type PublishRecord, type PublishRolloutConfig, PublishStatus, type QueryPermissions, type RateLimitDimension, type RateLimitItem, type RateLimitRule, type RequestContext, type ResolvedManifest, type ResponsiveBreakpoints, type RetryPolicy, type RiskControlConfig, type RolloutConfig, type RolloutMatchRequest, type RolloutMatchResult, type RolloutStrategy, type RolloutStrategyConfig, type RolloutStrategyType, type RuntimeConfig, type RuntimeContext, type RuntimeSpec, type SHAIntegrity, STRING_FUNCTIONS, type ScanCodeResult, type SchemaVersion, type SemVer, type ShareOptions, type ShareResult, type SigninActivityRule, type SigninRecord, type SigninRewardRecord, type SigninState, type SlotCategory, type SlotDeclaration, type SnapshotComponentEntry, type StateFieldDefinition, type StorageApi, type StorageOptions, type StyleConfig, type StyleIsolation, type TimeWindowRolloutConfig, type ToastOptions, type TrackEvent, type URLString, UTILITY_FUNCTIONS, type UniqueId, type UpsertRolloutRequest, type UserActivityState, type UserContext, VERSION, type ValidationRule, type VersionDiff, type VersionInfo, VersionStatus, type VersionStatusType, type WhitelistRolloutConfig, bindingRef, createDjvlcError, createExpressionContext, createLoopContext, isDjvlcError, literal, queryRef, stateRef, template };
package/dist/index.d.ts CHANGED
@@ -790,6 +790,116 @@ interface Expression {
790
790
  returnType?: string;
791
791
  };
792
792
  }
793
+ /**
794
+ * 表达式求值上下文
795
+ *
796
+ * @description
797
+ * 表达式引擎在求值时可访问的上下文对象。
798
+ * 所有动态表达式(state/binding/context/template/computed)都从此上下文获取数据。
799
+ *
800
+ * 使用场景:
801
+ * - Runtime 表达式求值
802
+ * - 编辑器表达式预览
803
+ * - 表达式校验与调试
804
+ *
805
+ * @example
806
+ * ```typescript
807
+ * const ctx: ExpressionContext = {
808
+ * state: { count: 0, userInfo: { name: 'Alice' } },
809
+ * binding: { userList: [{ id: 1, name: 'Bob' }] },
810
+ * context: { item: { id: 1, name: 'Bob' }, index: 0 },
811
+ * };
812
+ *
813
+ * // 求值 { type: 'state', value: 'userInfo.name' } => 'Alice'
814
+ * // 求值 { type: 'context', value: 'item.name' } => 'Bob'
815
+ * ```
816
+ */
817
+ interface ExpressionContext {
818
+ /**
819
+ * 页面状态
820
+ *
821
+ * @description
822
+ * 对应 PageState.fields 的运行时值。
823
+ * 表达式通过 { type: 'state', value: 'fieldName.path' } 访问。
824
+ */
825
+ state: Record<string, unknown>;
826
+ /**
827
+ * 数据绑定结果
828
+ *
829
+ * @description
830
+ * 对应 DataBinding 查询的返回数据,按 bindingId 组织。
831
+ * 表达式通过 { type: 'binding', value: 'bindingId.path' } 访问。
832
+ */
833
+ binding: Record<string, unknown>;
834
+ /**
835
+ * 局部上下文
836
+ *
837
+ * @description
838
+ * 包含循环变量、事件参数等临时作用域数据。
839
+ * 表达式通过 { type: 'context', value: 'item.path' } 访问。
840
+ */
841
+ context: ExpressionLocalContext;
842
+ /**
843
+ * 组件属性(可选)
844
+ *
845
+ * @description
846
+ * 当前组件的 props 值,供组件内部表达式访问。
847
+ * 通常在组件内部求值时提供。
848
+ */
849
+ props?: Record<string, unknown>;
850
+ /**
851
+ * 当前事件(可选)
852
+ *
853
+ * @description
854
+ * 事件处理器执行时的事件对象。
855
+ * 仅在事件处理链中可用。
856
+ */
857
+ event?: ExpressionEventContext;
858
+ }
859
+ /**
860
+ * 局部上下文(循环变量、事件参数等)
861
+ */
862
+ interface ExpressionLocalContext {
863
+ /**
864
+ * 循环项(loop.itemName 指定的变量名)
865
+ *
866
+ * @description
867
+ * 在 loop 渲染中,当前迭代的数据项。
868
+ */
869
+ item?: unknown;
870
+ /**
871
+ * 循环索引(loop.indexName 指定的变量名)
872
+ *
873
+ * @description
874
+ * 在 loop 渲染中,当前迭代的索引。
875
+ */
876
+ index?: number;
877
+ /**
878
+ * 动态扩展字段
879
+ *
880
+ * @description
881
+ * 支持自定义局部变量,如嵌套循环的多个 item/index。
882
+ */
883
+ [key: string]: unknown;
884
+ }
885
+ /**
886
+ * 事件上下文
887
+ */
888
+ interface ExpressionEventContext {
889
+ /** 事件类型 */
890
+ type: string;
891
+ /** 事件目标(组件实例 ID) */
892
+ target?: string;
893
+ /** 事件载荷(组件抛出的数据) */
894
+ payload?: unknown;
895
+ /** 原生事件(如 MouseEvent 的部分安全属性) */
896
+ nativeEvent?: {
897
+ clientX?: number;
898
+ clientY?: number;
899
+ key?: string;
900
+ keyCode?: number;
901
+ };
902
+ }
793
903
  /**
794
904
  * 任意值或表达式
795
905
  *
@@ -805,6 +915,21 @@ type AnyValueOrExpression = Expression | string | number | boolean | null | AnyV
805
915
  * @deprecated 使用 AnyValueOrExpression 代替
806
916
  */
807
917
  type PropValue = AnyValueOrExpression;
918
+ /**
919
+ * 创建空的表达式上下文
920
+ *
921
+ * @description
922
+ * 用于初始化表达式求值环境,所有字段都有合理的默认值。
923
+ */
924
+ declare function createExpressionContext(partial?: Partial<ExpressionContext>): ExpressionContext;
925
+ /**
926
+ * 创建带循环变量的局部上下文
927
+ *
928
+ * @param item - 当前循环项
929
+ * @param index - 当前循环索引
930
+ * @param extras - 额外的局部变量(如嵌套循环)
931
+ */
932
+ declare function createLoopContext(item: unknown, index: number, extras?: Record<string, unknown>): ExpressionLocalContext;
808
933
  /**
809
934
  * 创建字面量表达式
810
935
  * @deprecated V2 版本移除 literal 表达式类型,静态值请直接使用原始类型
@@ -1704,14 +1829,487 @@ interface PageDraft {
1704
1829
  updatedAt: ISODateTime;
1705
1830
  }
1706
1831
 
1832
+ /**
1833
+ * 页面快照类型(CDN 产物核心结构)
1834
+ *
1835
+ * @description
1836
+ * PageSnapshotJson 是发布后生成的运行时渲染闭包,包含:
1837
+ * - 页面渲染数据
1838
+ * - 组件锁定清单
1839
+ * - Definition 版本摘要
1840
+ * - 运维配置引用
1841
+ * - 元数据
1842
+ *
1843
+ * 设计原则:一次 resolve 返回渲染所需的一切闭包,减少运行时请求次数。
1844
+ */
1845
+
1846
+ /**
1847
+ * 页面快照 JSON 结构
1848
+ *
1849
+ * @description
1850
+ * 对应 CDN 产物:`/pages/{pageId}/{pageVersionId}/snapshot.json`
1851
+ * Runtime 加载此文件即可完成页面渲染。
1852
+ */
1853
+ interface PageSnapshotJson {
1854
+ /**
1855
+ * 页面渲染数据
1856
+ */
1857
+ page: PageSnapshotPage;
1858
+ /**
1859
+ * 组件锁定清单
1860
+ */
1861
+ manifest: PageSnapshotManifest;
1862
+ /**
1863
+ * 绑定的 Definition 版本摘要(审计/回放用)
1864
+ */
1865
+ definitionsDigest: DefinitionsDigest;
1866
+ /**
1867
+ * 运维配置(内联或引用)
1868
+ */
1869
+ ops: OpsConfig;
1870
+ /**
1871
+ * 元数据
1872
+ */
1873
+ meta: PageSnapshotMeta;
1874
+ }
1875
+ /**
1876
+ * 页面渲染数据
1877
+ */
1878
+ interface PageSnapshotPage {
1879
+ /** Schema 版本 */
1880
+ schemaVersion: string;
1881
+ /** 页面 ID */
1882
+ pageId: string;
1883
+ /** 页面版本 */
1884
+ pageVersion: SemVer;
1885
+ /** 页面标题 */
1886
+ title: string;
1887
+ /** 初始状态 */
1888
+ initialState: Record<string, JsonValue>;
1889
+ /** 数据绑定配置 */
1890
+ bindings: DataBinding[];
1891
+ /** 组件树根节点 */
1892
+ root: ComponentNode;
1893
+ /** 页面配置(画布类型、背景等) */
1894
+ config: {
1895
+ canvasType: 'h5' | 'tablet' | 'pc' | 'responsive';
1896
+ canvasSize?: {
1897
+ width: number;
1898
+ height: number;
1899
+ };
1900
+ background?: {
1901
+ type: 'color' | 'image' | 'gradient';
1902
+ value: string;
1903
+ };
1904
+ cssVariables?: Record<string, string>;
1905
+ };
1906
+ /** SEO 配置 */
1907
+ seo?: {
1908
+ title?: string;
1909
+ description?: string;
1910
+ keywords?: string[];
1911
+ };
1912
+ }
1913
+ /**
1914
+ * 组件锁定清单(Snapshot 内嵌版本)
1915
+ */
1916
+ interface PageSnapshotManifest {
1917
+ /** 组件列表 */
1918
+ components: SnapshotComponentEntry[];
1919
+ /** Runtime 版本要求 */
1920
+ runtime: {
1921
+ /** 推荐版本 */
1922
+ version: SemVer;
1923
+ /** 最低版本 */
1924
+ minVersion: SemVer;
1925
+ };
1926
+ }
1927
+ /**
1928
+ * Snapshot 中的组件条目
1929
+ */
1930
+ interface SnapshotComponentEntry {
1931
+ /** 组件名称 */
1932
+ name: string;
1933
+ /** 组件版本 */
1934
+ version: SemVer;
1935
+ /** SRI 完整性哈希 */
1936
+ integrity: SHAIntegrity;
1937
+ /** CDN 资源基础 URL */
1938
+ assetsUrl: string;
1939
+ /** 入口点 */
1940
+ entrypoints: {
1941
+ /** JS 入口(相对于 assetsUrl) */
1942
+ js: string;
1943
+ /** CSS 入口(可选) */
1944
+ css?: string;
1945
+ /** 分包列表(可选) */
1946
+ chunks?: string[];
1947
+ };
1948
+ /** 是否预加载 */
1949
+ preload?: boolean;
1950
+ /** 加载优先级 */
1951
+ priority?: 'critical' | 'high' | 'normal' | 'low';
1952
+ }
1953
+ /**
1954
+ * Definition 版本摘要
1955
+ *
1956
+ * @description
1957
+ * 记录页面绑定的 ActionDefinition 和 DataQueryDefinition 版本。
1958
+ * 用于审计、回放、版本追溯。
1959
+ */
1960
+ interface DefinitionsDigest {
1961
+ /** 绑定的 Action Definition 版本 */
1962
+ actions: DefinitionVersionDigest[];
1963
+ /** 绑定的 Data Query Definition 版本 */
1964
+ queries: DefinitionVersionDigest[];
1965
+ }
1966
+ /**
1967
+ * 单个 Definition 版本摘要
1968
+ */
1969
+ interface DefinitionVersionDigest {
1970
+ /** Definition ID */
1971
+ id: UniqueId;
1972
+ /** Definition 名称 */
1973
+ name: string;
1974
+ /** 版本 ID */
1975
+ versionId: UniqueId;
1976
+ /** 内容哈希(用于完整性校验) */
1977
+ hash: string;
1978
+ }
1979
+ /**
1980
+ * 运维配置
1981
+ *
1982
+ * @description
1983
+ * 包含 kill-switch、blocked 组件列表、功能开关等运维控制配置。
1984
+ * 由 User API resolve 时下发,Runtime 据此做运行时控制。
1985
+ */
1986
+ interface OpsConfig {
1987
+ /** 配置版本 ID(用于缓存失效) */
1988
+ configVersionId?: string;
1989
+ /** Kill-Switch 列表(被紧急关闭的功能/动作) */
1990
+ killSwitch: KillSwitchItem[];
1991
+ /** 被阻断的组件列表 */
1992
+ blockedComponents: BlockedComponentItem[];
1993
+ /** 功能开关 */
1994
+ flags: Record<string, boolean>;
1995
+ /** 限流配置(可选) */
1996
+ rateLimit?: {
1997
+ /** 全局 QPS 限制 */
1998
+ globalQps?: number;
1999
+ /** 按动作类型的 QPS 限制 */
2000
+ actionQps?: Record<string, number>;
2001
+ };
2002
+ /** 配置过期时间(用于缓存) */
2003
+ expiresAt?: ISODateTime;
2004
+ }
2005
+ /**
2006
+ * Kill-Switch 条目
2007
+ */
2008
+ interface KillSwitchItem {
2009
+ /** 目标类型 */
2010
+ targetType: 'action' | 'component' | 'feature' | 'page' | 'query';
2011
+ /** 目标 ID(actionType / componentName / featureKey / pageId / queryId) */
2012
+ targetId: string;
2013
+ /** 是否启用(true = 被关闭) */
2014
+ enabled: boolean;
2015
+ /** 关闭原因 */
2016
+ reason?: string;
2017
+ /** 关闭时间 */
2018
+ enabledAt?: ISODateTime;
2019
+ /** 关闭操作者 */
2020
+ enabledBy?: string;
2021
+ /** 用户提示消息 */
2022
+ userMessage?: string;
2023
+ }
2024
+ /**
2025
+ * 被阻断的组件条目
2026
+ */
2027
+ interface BlockedComponentItem {
2028
+ /** 组件名称 */
2029
+ name: string;
2030
+ /** 组件版本(可选,不指定则阻断所有版本) */
2031
+ version?: SemVer;
2032
+ /** 阻断原因 */
2033
+ reason: string;
2034
+ /** 阻断时间 */
2035
+ blockedAt: ISODateTime;
2036
+ /** 阻断操作者 */
2037
+ blockedBy: string;
2038
+ /** 降级版本(可选) */
2039
+ fallbackVersion?: SemVer;
2040
+ /** 是否紧急阻断 */
2041
+ urgent: boolean;
2042
+ }
2043
+ /**
2044
+ * 页面快照元数据
2045
+ *
2046
+ * @description
2047
+ * 对应 CDN 产物:`/pages/{pageId}/{pageVersionId}/meta.json`
2048
+ * 用于审计、回放、排查。
2049
+ */
2050
+ interface PageSnapshotMeta {
2051
+ /** 页面 ID */
2052
+ pageId: UniqueId;
2053
+ /** 页面版本 ID */
2054
+ pageVersionId: UniqueId;
2055
+ /** 发布 ID(用于追踪发布操作) */
2056
+ publishId: UniqueId;
2057
+ /** Schema 版本 */
2058
+ schemaVersion: string;
2059
+ /** 创建时间 */
2060
+ createdAt: ISODateTime;
2061
+ /** 创建者 */
2062
+ createdBy: string;
2063
+ /** 内容哈希 */
2064
+ contentHash: string;
2065
+ /** 绑定摘要 */
2066
+ bindings: {
2067
+ /** 组件版本列表(格式:name@version) */
2068
+ componentVersions: string[];
2069
+ /** Definition 版本列表 */
2070
+ definitionVersions: string[];
2071
+ };
2072
+ /** Runtime 版本 */
2073
+ runtimeVersion: SemVer;
2074
+ /** 环境 */
2075
+ env?: 'preview' | 'staging' | 'prod';
2076
+ }
2077
+ /**
2078
+ * Bootstrap 配置
2079
+ *
2080
+ * @description
2081
+ * 极小的启动参数,用于静态 HTML 场景。
2082
+ * 对应 CDN 产物:`/pages/{pageId}/{pageVersionId}/bootstrap.json`
2083
+ *
2084
+ * 使用场景:
2085
+ * - 静态 HTML 页面(不经过服务端渲染)
2086
+ * - 嵌入式页面(iframe)
2087
+ * - 离线缓存场景
2088
+ */
2089
+ interface BootstrapConfig {
2090
+ /** 页面 ID */
2091
+ pageId: UniqueId;
2092
+ /** 页面版本 ID */
2093
+ pageVersionId: UniqueId;
2094
+ /** Runtime 版本 */
2095
+ runtimeVersion: SemVer;
2096
+ /** Runtime 入口 URL */
2097
+ runtimeEntryUrl: string;
2098
+ /** 页面 JSON URL(snapshot.json) */
2099
+ snapshotUrl: string;
2100
+ /** Manifest URL */
2101
+ manifestUrl: string;
2102
+ /** CDN 基础 URL */
2103
+ cdnBaseUrl: string;
2104
+ /** API 基础 URL */
2105
+ apiBaseUrl: string;
2106
+ /** 环境 */
2107
+ env: 'preview' | 'staging' | 'prod';
2108
+ /** 预连接 URL 列表(性能优化) */
2109
+ preconnectUrls?: string[];
2110
+ /** 预加载资源列表 */
2111
+ preloadAssets?: string[];
2112
+ }
2113
+ /**
2114
+ * 预览 Token
2115
+ *
2116
+ * @description
2117
+ * Editor 生成预览链接时使用的令牌。
2118
+ * 存储在 Redis,短 TTL(通常 1-4 小时)。
2119
+ *
2120
+ * 使用流程:
2121
+ * 1. Editor 调用 Admin API 生成预览 Token
2122
+ * 2. 预览链接:`https://{domain}/preview/{token}`
2123
+ * 3. Runtime 调用 User API 验证 Token 并获取草稿内容
2124
+ */
2125
+ interface PreviewToken {
2126
+ /** Token 值 */
2127
+ token: string;
2128
+ /** 页面 ID */
2129
+ pageId: UniqueId;
2130
+ /** 页面版本 ID(如果预览已发布版本) */
2131
+ pageVersionId?: UniqueId;
2132
+ /** 草稿 ID(如果预览草稿) */
2133
+ draftId?: UniqueId;
2134
+ /** 预览类型 */
2135
+ type: 'draft' | 'version';
2136
+ /** 过期时间 */
2137
+ expiresAt: ISODateTime;
2138
+ /** 创建时间 */
2139
+ createdAt: ISODateTime;
2140
+ /** 创建者 */
2141
+ createdBy: string;
2142
+ /** 允许的访问者(可选,用于限制预览范围) */
2143
+ allowedViewers?: string[];
2144
+ /** 是否允许编辑(预览时是否可以修改草稿) */
2145
+ allowEdit?: boolean;
2146
+ }
2147
+ /**
2148
+ * 预览 Token 创建请求
2149
+ */
2150
+ interface CreatePreviewTokenRequest {
2151
+ /** 页面 ID */
2152
+ pageId: UniqueId;
2153
+ /** 预览类型 */
2154
+ type: 'draft' | 'version';
2155
+ /** 页面版本 ID(type 为 version 时必填) */
2156
+ pageVersionId?: UniqueId;
2157
+ /** 过期时间(秒),默认 3600 */
2158
+ ttlSeconds?: number;
2159
+ /** 允许的访问者 */
2160
+ allowedViewers?: string[];
2161
+ }
2162
+ /**
2163
+ * 预览 Token 验证响应
2164
+ */
2165
+ interface PreviewTokenValidationResult {
2166
+ /** 是否有效 */
2167
+ valid: boolean;
2168
+ /** Token 信息(有效时返回) */
2169
+ token?: PreviewToken;
2170
+ /** 错误原因(无效时返回) */
2171
+ error?: 'expired' | 'not_found' | 'invalid_viewer' | 'revoked';
2172
+ }
2173
+ /**
2174
+ * 页面完整性校验 JSON
2175
+ *
2176
+ * @description
2177
+ * 对应 CDN 产物:`/pages/{pageId}/{pageVersionId}/integrity.json`
2178
+ * 用于防篡改校验。
2179
+ */
2180
+ interface PageIntegrityJson {
2181
+ /** 文件完整性哈希 */
2182
+ files: {
2183
+ /** snapshot.json 的哈希 */
2184
+ 'snapshot.json': SHAIntegrity;
2185
+ /** manifest.json 的哈希 */
2186
+ 'manifest.json': SHAIntegrity;
2187
+ /** meta.json 的哈希(可选) */
2188
+ 'meta.json'?: SHAIntegrity;
2189
+ };
2190
+ /** 聚合哈希(所有文件的综合哈希) */
2191
+ aggregateHash: SHAIntegrity;
2192
+ /** 签名(可选,用于更高安全级别) */
2193
+ signature?: {
2194
+ /** 签名算法 */
2195
+ algorithm: 'ed25519' | 'rsa-sha256';
2196
+ /** 签名值(Base64) */
2197
+ value: string;
2198
+ /** 公钥 ID(用于查找对应的公钥) */
2199
+ keyId: string;
2200
+ };
2201
+ /** 生成时间 */
2202
+ generatedAt: ISODateTime;
2203
+ /** 生成者 */
2204
+ generatedBy: string;
2205
+ }
2206
+ /**
2207
+ * 页面资源列表 JSON
2208
+ *
2209
+ * @description
2210
+ * 对应 CDN 产物:`/pages/{pageId}/{pageVersionId}/assets.json`
2211
+ * 用于预热、排障。
2212
+ */
2213
+ interface PageAssetsJson {
2214
+ /** 页面 ID */
2215
+ pageId: UniqueId;
2216
+ /** 页面版本 ID */
2217
+ pageVersionId: UniqueId;
2218
+ /** Runtime 资源 */
2219
+ runtime: {
2220
+ /** Runtime 版本 */
2221
+ version: SemVer;
2222
+ /** JS 入口 */
2223
+ js: string;
2224
+ /** CSS 入口 */
2225
+ css?: string;
2226
+ };
2227
+ /** 组件资源 */
2228
+ components: {
2229
+ /** 组件名称 */
2230
+ name: string;
2231
+ /** 组件版本 */
2232
+ version: SemVer;
2233
+ /** JS 入口 */
2234
+ js: string;
2235
+ /** CSS 入口 */
2236
+ css?: string;
2237
+ /** 分包列表 */
2238
+ chunks?: string[];
2239
+ }[];
2240
+ /** 所有资源 URL 列表(用于预热) */
2241
+ allUrls: string[];
2242
+ /** 生成时间 */
2243
+ generatedAt: ISODateTime;
2244
+ }
2245
+
1707
2246
  /**
1708
2247
  * 页面解析响应类型
1709
2248
  */
1710
2249
 
1711
2250
  /**
1712
- * 页面解析响应(Runtime 使用)
2251
+ * 页面解析响应(User API → Runtime
2252
+ *
2253
+ * @description
2254
+ * 对应 User API:`GET /page/resolve`
2255
+ * Runtime 首先调用此接口获取要加载的版本信息。
1713
2256
  */
1714
2257
  interface PageResolveResponse {
2258
+ /** 页面 ID */
2259
+ pageId: UniqueId;
2260
+ /** 解析后的页面版本 ID */
2261
+ resolvedVersionId: UniqueId;
2262
+ /** CDN 基础 URL */
2263
+ cdnBase: string;
2264
+ /** Snapshot URL */
2265
+ snapshotUrl: string;
2266
+ /** Manifest URL */
2267
+ manifestUrl: string;
2268
+ /** 运维配置 */
2269
+ ops: OpsConfig;
2270
+ /** ETag(用于缓存) */
2271
+ etag: string;
2272
+ /** 缓存 TTL(秒) */
2273
+ cacheTtlSeconds: number;
2274
+ /** 灰度匹配信息(可选,用于调试) */
2275
+ rolloutMatch?: {
2276
+ /** 匹配的策略 ID */
2277
+ strategyId?: string;
2278
+ /** 匹配的策略名称 */
2279
+ strategyName?: string;
2280
+ /** 是否使用默认版本 */
2281
+ isDefault: boolean;
2282
+ };
2283
+ }
2284
+ /**
2285
+ * 页面解析请求参数
2286
+ */
2287
+ interface PageResolveRequest {
2288
+ /** 页面 ID */
2289
+ pageId: UniqueId;
2290
+ /** 环境 */
2291
+ env?: 'preview' | 'staging' | 'prod';
2292
+ /** 用户 ID(用于灰度) */
2293
+ uid?: string;
2294
+ /** 设备 ID(用于灰度) */
2295
+ deviceId?: string;
2296
+ /** 渠道(用于灰度) */
2297
+ channel?: string;
2298
+ /** 是否包含完整 Snapshot(CDN 失败保底) */
2299
+ includeSnapshot?: boolean;
2300
+ }
2301
+ /**
2302
+ * 页面解析响应(包含 Snapshot 的保底版本)
2303
+ */
2304
+ interface PageResolveWithSnapshotResponse extends PageResolveResponse {
2305
+ /** 完整的页面快照(CDN 失败时使用) */
2306
+ snapshot: PageSnapshotJson;
2307
+ }
2308
+ /**
2309
+ * 页面解析响应(旧版本)
2310
+ * @deprecated 使用 PageResolveResponse 代替
2311
+ */
2312
+ interface LegacyPageResolveResponse {
1715
2313
  /** 页面版本 ID */
1716
2314
  pageVersionId: UniqueId;
1717
2315
  /** 页面 Schema */
@@ -1724,7 +2322,8 @@ interface PageResolveResponse {
1724
2322
  preloadedData?: Record<string, JsonValue>;
1725
2323
  }
1726
2324
  /**
1727
- * 运行时配置
2325
+ * 运行时配置(旧版本)
2326
+ * @deprecated 使用 OpsConfig 代替
1728
2327
  */
1729
2328
  interface RuntimeConfig {
1730
2329
  /** 推荐的运行时版本 */
@@ -4252,4 +4851,4 @@ declare const ACTION_SPEC_VERSION = "2.0.0";
4252
4851
  */
4253
4852
  declare const DATA_QUERY_SPEC_VERSION = "2.0.0";
4254
4853
 
4255
- export { type ABTestRolloutConfig, ACTION_SPEC_VERSION, ALLOWED_FUNCTION_NAMES, ALL_BUILTIN_FUNCTIONS, ARRAY_FUNCTIONS, type ActionClientContext, type ActionDefinition, type ActionDefinitionVersion, type ActionExecuteRequest, type ActionExecuteResponse, type ActionExecutor, type ActionPolicy, type ActionRef, type ActionResult, type ActionSheetItem, type ActionSheetOptions, type ActionSheetResult, type ActionSpec, ActionType, type Activity, type ActivityPrecondition, type ActivityRule, type ActivityStatus, type ActivityType, type AggregationDataSourceConfig, type AggregationQueryItem, type AnyValueOrExpression, type ApiErrorDetail, type ApiErrorResponse, type ApiResponse, type ApiSuccessResponse, type AppContext, AuditAction, type AuditConfig, type AuditLogEntry, type BackgroundConfig, type BaseActivityRule, type BlacklistRolloutConfig, type BlockedComponentInfo, type BrowserCompat, type BuiltinActionType, COMPONENT_META_SCHEMA_VERSION, CURRENT_ACTION_SPEC_VERSION, CURRENT_COMPONENT_META_VERSION, CURRENT_DATA_QUERY_SPEC_VERSION, CURRENT_SCHEMA_VERSION, type CacheConfig, type CacheLevel, type CanaryHealthCheck, type CanaryRolloutConfig, type CanaryStage, type CanvasType, type CapabilityDeclaration, type CapabilityName, type ChangeLog, type ChangeLogItem, type ClaimActivityRule, type ClaimPrize, type ClaimRecord, type ClaimState, type ClipboardApi, type CompatInfo, type Component, type ComponentCategory, type ComponentContext, type ComponentDependency, type ComponentIntegrity, type ComponentMeta, type ComponentNode, type ComponentQueryParams, type ComponentRegisterRequest, type ComponentStatus, type ComponentStatusChangeRequest, type ComponentVersion, type ConfirmOptions, type ConsecutiveReward, type CreateManifestRequest, type CumulativeReward, DATA_QUERY_SPEC_VERSION, DATE_FUNCTIONS, DEFAULT_EXPRESSION_VALIDATION_CONFIG, type DataBinding, type DataBindingErrorConfig, type DataLoadStrategy, type DataQueryDefinition, type DataQueryDefinitionVersion, type DataQueryRequest, type DataQueryResponse, type DataQuerySpec, type DataSourceConfig, type DataSourceType, type DatabaseDataSourceConfig, type DialogOptions, type DialogResult, type DjvlcError, type EditorComponent, type Environment, ErrorCategory, ErrorCode, ErrorCodeToHttpStatus, type ErrorMapping, ErrorMessages, type EventDeclaration, type EventHandler, type ExecutorContext, type ExecutorResult, type Expression, type ExpressionFunctionCategory, type ExpressionFunctionDefinition, type ExpressionType, type ExpressionValidationConfig, type ExpressionValidationError, type ExpressionValidationResult, type ExpressionValidationWarning, FORMAT_FUNCTIONS, type FallbackCondition, type FallbackConfig, type FeatureCondition, type FeatureRolloutConfig, type FieldPermission, type FieldPolicy, type FieldTransform, type FileIntegrity, type FunctionParamDefinition, type GraphQLDataSourceConfig, type HostApi, type HttpDataSourceConfig, type HttpRetryConfig, type I18nDetectionStrategy, type ISODateTime, type IdempotencyKeyStrategy, type IdempotencyRule, type IntegrityHash, type InternalDataSourceConfig, type InventoryConfig, type JsonObject, type JsonValue, LOGIC_FUNCTIONS, type LayoutConfig, type LayoutValues, type LoopConfig, type LotteryActivityRule, type LotteryCost, type LotteryPrize, type LotteryState, type Manifest, type ManifestEntry, type ManifestItem, type ManifestValidationError, type ManifestValidationResult, type ManifestValidationWarning, type MaskingConfig, type MaskingRule, type MaskingType, type MethodCategory, type MethodDeclaration, type MethodParam, NUMBER_FUNCTIONS, type NavigateOptions, type NodeStyleConfig, type OperatorInfo, type OrderByItem, PAGE_SCHEMA_VERSION, PROTOCOL_VERSION, type PageConfig, type PageDraft, type PageI18nConfig, type PageLifecycle, type PageManifest, type PageMeta, type PageResolveResponse, type PageSEO, type PageSchema, type PageState, PageStatus, type PageStatusType, type PageVersion, type PaginatedResponse, type PaginationMeta, type PaginationParams, type ParamPermission, type ParticipationLimit, type PercentageRolloutConfig, type PityConfig, type Precondition, type PreconditionType, type PreviewImageOptions, type ProbabilityConfig, type PropDefinition, type PropFormat, type PropGroup, type PropType, type PropValue, type PropsSchema, type PublishCdnConfig, PublishChannel, type PublishConfig, type PublishEnvironment, type PublishNotificationConfig, type PublishRecord, type PublishRolloutConfig, PublishStatus, type QueryPermissions, type RateLimitDimension, type RateLimitItem, type RateLimitRule, type RequestContext, type ResolvedManifest, type ResponsiveBreakpoints, type RetryPolicy, type RiskControlConfig, type RolloutConfig, type RolloutMatchRequest, type RolloutMatchResult, type RolloutStrategy, type RolloutStrategyConfig, type RolloutStrategyType, type RuntimeConfig, type RuntimeContext, type RuntimeSpec, type SHAIntegrity, STRING_FUNCTIONS, type ScanCodeResult, type SchemaVersion, type SemVer, type ShareOptions, type ShareResult, type SigninActivityRule, type SigninRecord, type SigninRewardRecord, type SigninState, type SlotCategory, type SlotDeclaration, type StateFieldDefinition, type StorageApi, type StorageOptions, type StyleConfig, type StyleIsolation, type TimeWindowRolloutConfig, type ToastOptions, type TrackEvent, type URLString, UTILITY_FUNCTIONS, type UniqueId, type UpsertRolloutRequest, type UserActivityState, type UserContext, VERSION, type ValidationRule, type VersionDiff, type VersionInfo, VersionStatus, type VersionStatusType, type WhitelistRolloutConfig, bindingRef, createDjvlcError, isDjvlcError, literal, queryRef, stateRef, template };
4854
+ export { type ABTestRolloutConfig, ACTION_SPEC_VERSION, ALLOWED_FUNCTION_NAMES, ALL_BUILTIN_FUNCTIONS, ARRAY_FUNCTIONS, type ActionClientContext, type ActionDefinition, type ActionDefinitionVersion, type ActionExecuteRequest, type ActionExecuteResponse, type ActionExecutor, type ActionPolicy, type ActionRef, type ActionResult, type ActionSheetItem, type ActionSheetOptions, type ActionSheetResult, type ActionSpec, ActionType, type Activity, type ActivityPrecondition, type ActivityRule, type ActivityStatus, type ActivityType, type AggregationDataSourceConfig, type AggregationQueryItem, type AnyValueOrExpression, type ApiErrorDetail, type ApiErrorResponse, type ApiResponse, type ApiSuccessResponse, type AppContext, AuditAction, type AuditConfig, type AuditLogEntry, type BackgroundConfig, type BaseActivityRule, type BlacklistRolloutConfig, type BlockedComponentInfo, type BlockedComponentItem, type BootstrapConfig, type BrowserCompat, type BuiltinActionType, COMPONENT_META_SCHEMA_VERSION, CURRENT_ACTION_SPEC_VERSION, CURRENT_COMPONENT_META_VERSION, CURRENT_DATA_QUERY_SPEC_VERSION, CURRENT_SCHEMA_VERSION, type CacheConfig, type CacheLevel, type CanaryHealthCheck, type CanaryRolloutConfig, type CanaryStage, type CanvasType, type CapabilityDeclaration, type CapabilityName, type ChangeLog, type ChangeLogItem, type ClaimActivityRule, type ClaimPrize, type ClaimRecord, type ClaimState, type ClipboardApi, type CompatInfo, type Component, type ComponentCategory, type ComponentContext, type ComponentDependency, type ComponentIntegrity, type ComponentMeta, type ComponentNode, type ComponentQueryParams, type ComponentRegisterRequest, type ComponentStatus, type ComponentStatusChangeRequest, type ComponentVersion, type ConfirmOptions, type ConsecutiveReward, type CreateManifestRequest, type CreatePreviewTokenRequest, type CumulativeReward, DATA_QUERY_SPEC_VERSION, DATE_FUNCTIONS, DEFAULT_EXPRESSION_VALIDATION_CONFIG, type DataBinding, type DataBindingErrorConfig, type DataLoadStrategy, type DataQueryDefinition, type DataQueryDefinitionVersion, type DataQueryRequest, type DataQueryResponse, type DataQuerySpec, type DataSourceConfig, type DataSourceType, type DatabaseDataSourceConfig, type DefinitionVersionDigest, type DefinitionsDigest, type DialogOptions, type DialogResult, type DjvlcError, type EditorComponent, type Environment, ErrorCategory, ErrorCode, ErrorCodeToHttpStatus, type ErrorMapping, ErrorMessages, type EventDeclaration, type EventHandler, type ExecutorContext, type ExecutorResult, type Expression, type ExpressionContext, type ExpressionEventContext, type ExpressionFunctionCategory, type ExpressionFunctionDefinition, type ExpressionLocalContext, type ExpressionType, type ExpressionValidationConfig, type ExpressionValidationError, type ExpressionValidationResult, type ExpressionValidationWarning, FORMAT_FUNCTIONS, type FallbackCondition, type FallbackConfig, type FeatureCondition, type FeatureRolloutConfig, type FieldPermission, type FieldPolicy, type FieldTransform, type FileIntegrity, type FunctionParamDefinition, type GraphQLDataSourceConfig, type HostApi, type HttpDataSourceConfig, type HttpRetryConfig, type I18nDetectionStrategy, type ISODateTime, type IdempotencyKeyStrategy, type IdempotencyRule, type IntegrityHash, type InternalDataSourceConfig, type InventoryConfig, type JsonObject, type JsonValue, type KillSwitchItem, LOGIC_FUNCTIONS, type LayoutConfig, type LayoutValues, type LegacyPageResolveResponse, type LoopConfig, type LotteryActivityRule, type LotteryCost, type LotteryPrize, type LotteryState, type Manifest, type ManifestEntry, type ManifestItem, type ManifestValidationError, type ManifestValidationResult, type ManifestValidationWarning, type MaskingConfig, type MaskingRule, type MaskingType, type MethodCategory, type MethodDeclaration, type MethodParam, NUMBER_FUNCTIONS, type NavigateOptions, type NodeStyleConfig, type OperatorInfo, type OpsConfig, type OrderByItem, PAGE_SCHEMA_VERSION, PROTOCOL_VERSION, type PageAssetsJson, type PageConfig, type PageDraft, type PageI18nConfig, type PageIntegrityJson, type PageLifecycle, type PageManifest, type PageMeta, type PageResolveRequest, type PageResolveResponse, type PageResolveWithSnapshotResponse, type PageSEO, type PageSchema, type PageSnapshotJson, type PageSnapshotManifest, type PageSnapshotMeta, type PageSnapshotPage, type PageState, PageStatus, type PageStatusType, type PageVersion, type PaginatedResponse, type PaginationMeta, type PaginationParams, type ParamPermission, type ParticipationLimit, type PercentageRolloutConfig, type PityConfig, type Precondition, type PreconditionType, type PreviewImageOptions, type PreviewToken, type PreviewTokenValidationResult, type ProbabilityConfig, type PropDefinition, type PropFormat, type PropGroup, type PropType, type PropValue, type PropsSchema, type PublishCdnConfig, PublishChannel, type PublishConfig, type PublishEnvironment, type PublishNotificationConfig, type PublishRecord, type PublishRolloutConfig, PublishStatus, type QueryPermissions, type RateLimitDimension, type RateLimitItem, type RateLimitRule, type RequestContext, type ResolvedManifest, type ResponsiveBreakpoints, type RetryPolicy, type RiskControlConfig, type RolloutConfig, type RolloutMatchRequest, type RolloutMatchResult, type RolloutStrategy, type RolloutStrategyConfig, type RolloutStrategyType, type RuntimeConfig, type RuntimeContext, type RuntimeSpec, type SHAIntegrity, STRING_FUNCTIONS, type ScanCodeResult, type SchemaVersion, type SemVer, type ShareOptions, type ShareResult, type SigninActivityRule, type SigninRecord, type SigninRewardRecord, type SigninState, type SlotCategory, type SlotDeclaration, type SnapshotComponentEntry, type StateFieldDefinition, type StorageApi, type StorageOptions, type StyleConfig, type StyleIsolation, type TimeWindowRolloutConfig, type ToastOptions, type TrackEvent, type URLString, UTILITY_FUNCTIONS, type UniqueId, type UpsertRolloutRequest, type UserActivityState, type UserContext, VERSION, type ValidationRule, type VersionDiff, type VersionInfo, VersionStatus, type VersionStatusType, type WhitelistRolloutConfig, bindingRef, createDjvlcError, createExpressionContext, createLoopContext, isDjvlcError, literal, queryRef, stateRef, template };
package/dist/index.js CHANGED
@@ -1002,6 +1002,21 @@ var DEFAULT_EXPRESSION_VALIDATION_CONFIG = {
1002
1002
  };
1003
1003
 
1004
1004
  // src/page/expression.ts
1005
+ function createExpressionContext(partial) {
1006
+ return {
1007
+ state: {},
1008
+ binding: {},
1009
+ context: {},
1010
+ ...partial
1011
+ };
1012
+ }
1013
+ function createLoopContext(item, index, extras) {
1014
+ return {
1015
+ item,
1016
+ index,
1017
+ ...extras
1018
+ };
1019
+ }
1005
1020
  function literal(value) {
1006
1021
  return value;
1007
1022
  }
@@ -1105,6 +1120,8 @@ exports.VERSION = VERSION;
1105
1120
  exports.VersionStatus = VersionStatus;
1106
1121
  exports.bindingRef = bindingRef;
1107
1122
  exports.createDjvlcError = createDjvlcError;
1123
+ exports.createExpressionContext = createExpressionContext;
1124
+ exports.createLoopContext = createLoopContext;
1108
1125
  exports.isDjvlcError = isDjvlcError;
1109
1126
  exports.literal = literal;
1110
1127
  exports.queryRef = queryRef;
package/dist/index.mjs CHANGED
@@ -1000,6 +1000,21 @@ var DEFAULT_EXPRESSION_VALIDATION_CONFIG = {
1000
1000
  };
1001
1001
 
1002
1002
  // src/page/expression.ts
1003
+ function createExpressionContext(partial) {
1004
+ return {
1005
+ state: {},
1006
+ binding: {},
1007
+ context: {},
1008
+ ...partial
1009
+ };
1010
+ }
1011
+ function createLoopContext(item, index, extras) {
1012
+ return {
1013
+ item,
1014
+ index,
1015
+ ...extras
1016
+ };
1017
+ }
1003
1018
  function literal(value) {
1004
1019
  return value;
1005
1020
  }
@@ -1071,4 +1086,4 @@ var COMPONENT_META_SCHEMA_VERSION = "2.0.0";
1071
1086
  var ACTION_SPEC_VERSION = "2.0.0";
1072
1087
  var DATA_QUERY_SPEC_VERSION = "2.0.0";
1073
1088
 
1074
- export { ACTION_SPEC_VERSION, ALLOWED_FUNCTION_NAMES, ALL_BUILTIN_FUNCTIONS, ARRAY_FUNCTIONS, ActionType, AuditAction, COMPONENT_META_SCHEMA_VERSION, CURRENT_ACTION_SPEC_VERSION, CURRENT_COMPONENT_META_VERSION, CURRENT_DATA_QUERY_SPEC_VERSION, CURRENT_SCHEMA_VERSION, DATA_QUERY_SPEC_VERSION, DATE_FUNCTIONS, DEFAULT_EXPRESSION_VALIDATION_CONFIG, ErrorCategory, ErrorCode, ErrorCodeToHttpStatus, ErrorMessages, FORMAT_FUNCTIONS, LOGIC_FUNCTIONS, NUMBER_FUNCTIONS, PAGE_SCHEMA_VERSION, PROTOCOL_VERSION, PageStatus, PublishChannel, PublishStatus, STRING_FUNCTIONS, UTILITY_FUNCTIONS, VERSION, VersionStatus, bindingRef, createDjvlcError, isDjvlcError, literal, queryRef, stateRef, template };
1089
+ export { ACTION_SPEC_VERSION, ALLOWED_FUNCTION_NAMES, ALL_BUILTIN_FUNCTIONS, ARRAY_FUNCTIONS, ActionType, AuditAction, COMPONENT_META_SCHEMA_VERSION, CURRENT_ACTION_SPEC_VERSION, CURRENT_COMPONENT_META_VERSION, CURRENT_DATA_QUERY_SPEC_VERSION, CURRENT_SCHEMA_VERSION, DATA_QUERY_SPEC_VERSION, DATE_FUNCTIONS, DEFAULT_EXPRESSION_VALIDATION_CONFIG, ErrorCategory, ErrorCode, ErrorCodeToHttpStatus, ErrorMessages, FORMAT_FUNCTIONS, LOGIC_FUNCTIONS, NUMBER_FUNCTIONS, PAGE_SCHEMA_VERSION, PROTOCOL_VERSION, PageStatus, PublishChannel, PublishStatus, STRING_FUNCTIONS, UTILITY_FUNCTIONS, VERSION, VersionStatus, bindingRef, createDjvlcError, createExpressionContext, createLoopContext, isDjvlcError, literal, queryRef, stateRef, template };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djvlc/contracts-types",
3
- "version": "1.7.0",
3
+ "version": "1.7.2",
4
4
  "description": "DJV Low-code Platform - TypeScript 类型定义包",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",