@flowgram.ai/variable-core 0.5.5 → 0.5.6

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.ts CHANGED
@@ -3,13 +3,17 @@ import * as _flowgram_ai_utils from '@flowgram.ai/utils';
3
3
  import { Disposable, Emitter, DisposableCollection, Event } from '@flowgram.ai/utils';
4
4
  import { Subject, Observable, BehaviorSubject, Observer as Observer$1 } from 'rxjs';
5
5
  export { Observer } from 'rxjs';
6
- import * as react from 'react';
6
+ import React from 'react';
7
7
 
8
8
  /**
9
9
  * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
10
10
  * SPDX-License-Identifier: MIT
11
11
  */
12
12
 
13
+ /**
14
+ * An InversifyJS container module that binds all the necessary services for the variable engine.
15
+ * This module sets up the dependency injection for the core components of the variable engine.
16
+ */
13
17
  declare const VariableContainerModule: ContainerModule;
14
18
 
15
19
  /**
@@ -17,11 +21,15 @@ declare const VariableContainerModule: ContainerModule;
17
21
  * SPDX-License-Identifier: MIT
18
22
  */
19
23
 
24
+ /**
25
+ * A provider for dynamically obtaining the `VariableEngine` instance.
26
+ * This is used to prevent circular dependencies when injecting `VariableEngine`.
27
+ */
20
28
  declare const VariableEngineProvider: unique symbol;
21
29
  type VariableEngineProvider = () => VariableEngine;
22
30
 
23
31
  /**
24
- * 作用域输出
32
+ * Manages the output variables of a scope.
25
33
  */
26
34
  declare class ScopeOutputData {
27
35
  readonly scope: Scope;
@@ -30,46 +38,60 @@ declare class ScopeOutputData {
30
38
  <T>(key: string | symbol, fn: () => T): T;
31
39
  clear: (key?: string | symbol) => void;
32
40
  };
41
+ /**
42
+ * The variable engine instance.
43
+ */
33
44
  get variableEngine(): VariableEngine;
45
+ /**
46
+ * The global variable table from the variable engine.
47
+ */
34
48
  get globalVariableTable(): IVariableTable;
49
+ /**
50
+ * The current version of the output data, which increments on each change.
51
+ */
35
52
  get version(): number;
36
53
  /**
37
54
  * @deprecated use onListOrAnyVarChange instead
38
55
  */
39
56
  get onDataChange(): _flowgram_ai_utils.Event<void>;
40
57
  /**
41
- * listen to variable list change
58
+ * An event that fires when the list of output variables changes.
42
59
  */
43
60
  get onVariableListChange(): (observer: (variables: VariableDeclaration[]) => void) => _flowgram_ai_utils.Disposable;
44
61
  /**
45
- * listen to any variable update in list
62
+ * An event that fires when any output variable's value changes.
46
63
  */
47
64
  get onAnyVariableChange(): (observer: (changedVariable: VariableDeclaration) => void) => _flowgram_ai_utils.Disposable;
48
65
  /**
49
- * listen to variable list change + any variable update in list
66
+ * An event that fires when the output variable list changes or any variable's value is updated.
50
67
  */
51
68
  get onListOrAnyVarChange(): (observer: () => void) => _flowgram_ai_utils.Disposable;
52
69
  protected _hasChanges: boolean;
53
70
  constructor(scope: Scope);
54
71
  /**
55
- * Scope Output Variable Declarations
72
+ * The output variable declarations of the scope, sorted by order.
56
73
  */
57
74
  get variables(): VariableDeclaration[];
58
75
  /**
59
- * Output Variable Keys
76
+ * The keys of the output variables.
60
77
  */
61
78
  get variableKeys(): string[];
62
- addVariableToTable(variable: VariableDeclaration): void;
63
- removeVariableFromTable(key: string): void;
79
+ protected addVariableToTable(variable: VariableDeclaration): void;
80
+ protected removeVariableFromTable(key: string): void;
81
+ /**
82
+ * Retrieves a variable declaration by its key.
83
+ * @param key The key of the variable.
84
+ * @returns The `VariableDeclaration` or `undefined` if not found.
85
+ */
64
86
  getVariableByKey(key: string): VariableDeclaration<any> | undefined;
65
87
  /**
66
- *
88
+ * Notifies the covering scopes that the available variables have changed.
67
89
  */
68
90
  notifyCoversChange(): void;
69
91
  }
70
92
 
71
93
  /**
72
- * 作用域可用变量
94
+ * Manages the available variables within a scope.
73
95
  */
74
96
  declare class ScopeAvailableData {
75
97
  readonly scope: Scope;
@@ -77,28 +99,41 @@ declare class ScopeAvailableData {
77
99
  <T>(key: string | symbol, fn: () => T): T;
78
100
  clear: (key?: string | symbol) => void;
79
101
  };
102
+ /**
103
+ * The global variable table from the variable engine.
104
+ */
80
105
  get globalVariableTable(): IVariableTable;
81
106
  protected _version: number;
82
107
  protected refresh$: Subject<void>;
83
108
  protected _variables: VariableDeclaration[];
109
+ /**
110
+ * The current version of the available data, which increments on each change.
111
+ */
84
112
  get version(): number;
85
113
  protected bumpVersion(): void;
114
+ /**
115
+ * Refreshes the list of available variables.
116
+ * This should be called when the dependencies of the scope change.
117
+ */
86
118
  refresh(): void;
87
119
  /**
88
- * 监听
120
+ * An observable that emits when the list of available variables changes.
89
121
  */
90
122
  protected variables$: Observable<VariableDeclaration[]>;
123
+ /**
124
+ * An observable that emits when any variable in the available list changes its value.
125
+ */
91
126
  protected anyVariableChange$: Observable<VariableDeclaration>;
92
127
  /**
93
- * listen to any variable update in list
94
- * @param observer
95
- * @returns
128
+ * Subscribes to changes in any variable's value in the available list.
129
+ * @param observer A function to be called with the changed variable.
130
+ * @returns A disposable to unsubscribe from the changes.
96
131
  */
97
132
  onAnyVariableChange(observer: (changedVariable: VariableDeclaration) => void): Disposable;
98
133
  /**
99
- * listen to variable list change
100
- * @param observer
101
- * @returns
134
+ * Subscribes to changes in the list of available variables.
135
+ * @param observer A function to be called with the new list of variables.
136
+ * @returns A disposable to unsubscribe from the changes.
102
137
  */
103
138
  onVariableListChange(observer: (variables: VariableDeclaration[]) => void): Disposable;
104
139
  /**
@@ -111,31 +146,35 @@ declare class ScopeAvailableData {
111
146
  */
112
147
  onDataChange: _flowgram_ai_utils.Event<VariableDeclaration<any>[]>;
113
148
  /**
114
- * listen to variable list change + any variable drilldown change
149
+ * An event that fires when the variable list changes or any variable's value is updated.
115
150
  */
116
151
  onListOrAnyVarChange: _flowgram_ai_utils.Event<VariableDeclaration<any>[]>;
117
152
  constructor(scope: Scope);
118
153
  /**
119
- * 获取可消费变量
154
+ * Gets the list of available variables.
120
155
  */
121
156
  get variables(): VariableDeclaration[];
122
157
  /**
123
- * 获取可访问的变量 keys
158
+ * Gets the keys of the available variables.
124
159
  */
125
160
  get variableKeys(): string[];
126
161
  /**
127
- * 返回依赖的作用域
162
+ * Gets the dependency scopes.
128
163
  */
129
164
  get depScopes(): Scope[];
130
165
  /**
131
- * 通过 keyPath 找到可用变量
132
- * @param keyPath
133
- * @returns
166
+ * Retrieves a variable field by its key path from the available variables.
167
+ * @param keyPath The key path to the variable field.
168
+ * @returns The found `BaseVariableField` or `undefined`.
134
169
  */
135
170
  getByKeyPath(keyPath?: string[]): BaseVariableField | undefined;
136
171
  /**
137
- * Track Variable Change (Includes type update and children update) By KeyPath
138
- * @returns
172
+ * Tracks changes to a variable field by its key path.
173
+ * This includes changes to its type, value, or any nested properties.
174
+ * @param keyPath The key path to the variable field to track.
175
+ * @param cb The callback to execute when the variable changes.
176
+ * @param opts Configuration options for the subscription.
177
+ * @returns A disposable to unsubscribe from the tracking.
139
178
  */
140
179
  trackByKeyPath<Data = BaseVariableField | undefined>(keyPath: string[] | undefined, cb: (variable?: Data) => void, opts?: SubscribeConfig<BaseVariableField | undefined, Data>): Disposable;
141
180
  }
@@ -146,15 +185,36 @@ declare class ScopeAvailableData {
146
185
  */
147
186
 
148
187
  type Observer<ActionType extends GlobalEventActionType = GlobalEventActionType> = (action: ActionType) => void;
188
+ /**
189
+ * Manages global events within a scope.
190
+ */
149
191
  declare class ScopeEventData {
150
192
  readonly scope: Scope;
151
193
  event$: Subject<GlobalEventActionType>;
194
+ /**
195
+ * Dispatches a global event.
196
+ * @param action The event action to dispatch.
197
+ */
152
198
  dispatch<ActionType extends GlobalEventActionType = GlobalEventActionType>(action: ActionType): void;
199
+ /**
200
+ * Subscribes to all global events.
201
+ * @param observer The observer function to call with the event action.
202
+ * @returns A disposable to unsubscribe from the events.
203
+ */
153
204
  subscribe<ActionType extends GlobalEventActionType = GlobalEventActionType>(observer: Observer<ActionType>): Disposable;
205
+ /**
206
+ * Subscribes to a specific type of global event.
207
+ * @param type The type of the event to subscribe to.
208
+ * @param observer The observer function to call with the event action.
209
+ * @returns A disposable to unsubscribe from the event.
210
+ */
154
211
  on<ActionType extends GlobalEventActionType = GlobalEventActionType>(type: ActionType['type'], observer: Observer<ActionType>): Disposable;
155
212
  constructor(scope: Scope);
156
213
  }
157
214
 
215
+ /**
216
+ * Interface for the Scope constructor.
217
+ */
158
218
  interface IScopeConstructor {
159
219
  new (options: {
160
220
  id: string | symbol;
@@ -162,38 +222,43 @@ interface IScopeConstructor {
162
222
  meta?: Record<string, any>;
163
223
  }): Scope;
164
224
  }
225
+ /**
226
+ * Represents a variable scope, which manages its own set of variables and their lifecycle.
227
+ * - `scope.output` represents the variables declared within this scope.
228
+ * - `scope.available` represents all variables accessible from this scope, including those from parent scopes.
229
+ */
165
230
  declare class Scope<ScopeMeta extends Record<string, any> = Record<string, any>> {
166
231
  /**
167
- * Scope 唯一索引
232
+ * A unique identifier for the scope.
168
233
  */
169
234
  readonly id: string | symbol;
170
235
  /**
171
- * Scope 依赖变量引擎
236
+ * The variable engine instance this scope belongs to.
172
237
  */
173
238
  readonly variableEngine: VariableEngine;
174
239
  /**
175
- * 作用域的基本元信息,包括作用域所在节点及一些 flag 信息,上层业务可以额外扩展
240
+ * Metadata associated with the scope, which can be extended by higher-level business logic.
176
241
  */
177
242
  readonly meta: ScopeMeta;
178
243
  /**
179
- * 作用域 AST 根节点
180
- * - Map<formItemKey, formItemValue>
244
+ * The root AST node for this scope, which is a MapNode.
245
+ * It stores various data related to the scope, such as `outputs`.
181
246
  */
182
247
  readonly ast: MapNode;
183
248
  /**
184
- * 可用变量数据管理
249
+ * Manages the available variables for this scope.
185
250
  */
186
251
  readonly available: ScopeAvailableData;
187
252
  /**
188
- * 输出变量数据管理
253
+ * Manages the output variables for this scope.
189
254
  */
190
255
  readonly output: ScopeOutputData;
191
256
  /**
192
- * 作用域事件管理
257
+ * Manages event dispatching and handling for this scope.
193
258
  */
194
259
  readonly event: ScopeEventData;
195
260
  /**
196
- * 数据缓存
261
+ * A memoization utility for caching computed values.
197
262
  */
198
263
  protected memo: {
199
264
  <T>(key: string | symbol, fn: () => T): T;
@@ -205,47 +270,62 @@ declare class Scope<ScopeMeta extends Record<string, any> = Record<string, any>>
205
270
  variableEngine: VariableEngine;
206
271
  meta?: ScopeMeta;
207
272
  });
273
+ /**
274
+ * Refreshes the covering scopes.
275
+ */
208
276
  refreshCovers(): void;
277
+ /**
278
+ * Refreshes the dependency scopes and the available variables.
279
+ */
209
280
  refreshDeps(): void;
281
+ /**
282
+ * Gets the scopes that this scope depends on.
283
+ */
210
284
  get depScopes(): Scope[];
285
+ /**
286
+ * Gets the scopes that are covered by this scope.
287
+ */
211
288
  get coverScopes(): Scope[];
289
+ /**
290
+ * Disposes of the scope and its resources.
291
+ * This will also trigger updates in dependent and covering scopes.
292
+ */
212
293
  dispose(): void;
213
294
  onDispose: _flowgram_ai_utils.Event<void>;
214
295
  get disposed(): boolean;
215
296
  /**
216
- * Sets a variable in the Scope with the default key 'outputs'.
297
+ * Sets a variable in the scope with the default key 'outputs'.
217
298
  *
218
- * @param json - The JSON value to store.
219
- * @returns The updated AST node.
299
+ * @param json The JSON representation of the AST node to set.
300
+ * @returns The created or updated AST node.
220
301
  */
221
- setVar(json: ASTNodeJSON): ASTNode;
302
+ setVar<Node extends ASTNode = ASTNode>(json: ASTNodeJSON): Node;
222
303
  /**
223
- * Sets a variable in the Scope by key.
304
+ * Sets a variable in the scope with a specified key.
224
305
  *
225
- * @param key - The key of the variable to set.
226
- * @param json - The JSON value to store.
227
- * @returns The updated AST node.
306
+ * @param key The key of the variable to set.
307
+ * @param json The JSON representation of the AST node to set.
308
+ * @returns The created or updated AST node.
228
309
  */
229
- setVar(key: string, json: ASTNodeJSON): ASTNode;
310
+ setVar<Node extends ASTNode = ASTNode>(key: string, json: ASTNodeJSON): Node;
230
311
  /**
231
- * Retrieves a variable from the Scope by key.
312
+ * Retrieves a variable from the scope by its key.
232
313
  *
233
- * @param key - The key of the variable to retrieve. Defaults to 'outputs'.
234
- * @returns The value of the variable, or undefined if not found.
314
+ * @param key The key of the variable to retrieve. Defaults to 'outputs'.
315
+ * @returns The AST node for the variable, or `undefined` if not found.
235
316
  */
236
- getVar(key?: string): ASTNode<any, any> | undefined;
317
+ getVar<Node extends ASTNode = ASTNode>(key?: string): Node | undefined;
237
318
  /**
238
- * Clears a variable from the Scope by key.
319
+ * Clears a variable from the scope by its key.
239
320
  *
240
- * @param key - The key of the variable to clear. Defaults to 'outputs'.
241
- * @returns The updated AST node.
321
+ * @param key The key of the variable to clear. Defaults to 'outputs'.
242
322
  */
243
323
  clearVar(key?: string): void;
244
324
  }
245
325
 
246
326
  /**
247
- * 作用域依赖关系管理数据结构
248
- * - ScopeOrder 可能存在多种实现方式,因此采取抽象类的方式,具体的实现由子类实现
327
+ * Manages the dependency relationships between scopes.
328
+ * This is an abstract class, and specific implementations determine how the scope order is managed.
249
329
  */
250
330
  declare abstract class ScopeChain {
251
331
  readonly toDispose: DisposableCollection;
@@ -253,11 +333,25 @@ declare abstract class ScopeChain {
253
333
  get variableEngine(): VariableEngine;
254
334
  constructor();
255
335
  /**
256
- * 所有作用域依赖关系刷新
336
+ * Refreshes the dependency and coverage relationships for all scopes.
257
337
  */
258
338
  refreshAllChange(): void;
339
+ /**
340
+ * Gets the dependency scopes for a given scope.
341
+ * @param scope The scope to get dependencies for.
342
+ * @returns An array of dependency scopes.
343
+ */
259
344
  abstract getDeps(scope: Scope): Scope[];
345
+ /**
346
+ * Gets the covering scopes for a given scope.
347
+ * @param scope The scope to get covers for.
348
+ * @returns An array of covering scopes.
349
+ */
260
350
  abstract getCovers(scope: Scope): Scope[];
351
+ /**
352
+ * Sorts all scopes based on their dependency relationships.
353
+ * @returns A sorted array of all scopes.
354
+ */
261
355
  abstract sortAll(): Scope[];
262
356
  dispose(): void;
263
357
  get disposed(): boolean;
@@ -268,133 +362,157 @@ interface ASTNodeRegistry<JSON extends ASTNodeJSON = any, InjectOpts = any> {
268
362
  kind: string;
269
363
  new (params: CreateASTParams, injectOpts: InjectOpts): ASTNode<JSON>;
270
364
  }
365
+ /**
366
+ * An `ASTNode` represents a fundamental unit of variable information within the system's Abstract Syntax Tree.
367
+ * It can model various constructs, for example:
368
+ * - **Declarations**: `const a = 1`
369
+ * - **Expressions**: `a.b.c`
370
+ * - **Types**: `number`, `string`, `boolean`
371
+ *
372
+ * Here is some characteristic of ASTNode:
373
+ * - **Tree-like Structure**: ASTNodes can be nested to form a tree, representing complex variable structures.
374
+ * - **Extendable**: New features can be added by extending the base ASTNode class.
375
+ * - **Reactive**: Changes in an ASTNode's value trigger events, enabling reactive programming patterns.
376
+ * - **Serializable**: ASTNodes can be converted to and from a JSON format (ASTNodeJSON) for storage or transmission.
377
+ */
271
378
  declare abstract class ASTNode<JSON extends ASTNodeJSON = any, InjectOpts = any> implements Disposable {
272
379
  /**
273
380
  * @deprecated
274
- * 获取 ASTNode 注入的 opts
381
+ * Get the injected options for the ASTNode.
275
382
  *
276
- * 请使用 @injectToAst(XXXService) declare xxxService: XXXService 实现外部依赖注入
383
+ * Please use `@injectToAst(XXXService) declare xxxService: XXXService` to achieve external dependency injection.
277
384
  */
278
385
  readonly opts?: InjectOpts;
279
386
  /**
280
- * 节点的唯一标识符,节点不指定则默认由 nanoid 生成,不可更改
281
- * - 如需要生成新 key,则销毁当前节点并生成新的节点
387
+ * The unique identifier of the ASTNode, which is **immutable**.
388
+ * - Immutable: Once assigned, the key cannot be changed.
389
+ * - Automatically generated if not specified, and cannot be changed as well.
390
+ * - If a new key needs to be generated, the current ASTNode should be destroyed and a new ASTNode should be generated.
282
391
  */
283
392
  readonly key: Identifier;
284
393
  /**
285
- * 节点类型
394
+ * The kind of the ASTNode.
286
395
  */
287
396
  static readonly kind: ASTKindType;
288
397
  /**
289
- * 节点 Flags,记录一些 Flag 信息
398
+ * Node flags, used to record some flag information.
290
399
  */
291
400
  readonly flags: number;
292
401
  /**
293
- * 节点所处的作用域
402
+ * The scope in which the ASTNode is located.
294
403
  */
295
404
  readonly scope: Scope;
296
405
  /**
297
- * 父节点
406
+ * The parent ASTNode.
298
407
  */
299
408
  readonly parent: ASTNode | undefined;
300
409
  /**
301
- * 节点的版本号,每 fireChange 一次 version + 1
410
+ * The version number of the ASTNode, which increments by 1 each time `fireChange` is called.
302
411
  */
303
412
  protected _version: number;
304
413
  /**
305
- * 更新锁
414
+ * Update lock.
415
+ * - When set to `true`, `fireChange` will not trigger any events.
416
+ * - This is useful when multiple updates are needed, and you want to avoid multiple triggers.
306
417
  */
307
418
  changeLocked: boolean;
308
419
  /**
309
- * Batch Update 相关参数
420
+ * Parameters related to batch updates.
310
421
  */
311
422
  private _batch;
312
423
  /**
313
- * AST 节点变化事件,基于 Rxjs 实现
314
- * - 使用了 BehaviorSubject, 在订阅时会自动触发一次事件,事件为当前值
424
+ * AST node change Observable events, implemented based on RxJS.
425
+ * - Emits the current ASTNode value upon subscription.
426
+ * - Emits a new value whenever `fireChange` is called.
315
427
  */
316
428
  readonly value$: BehaviorSubject<ASTNode>;
317
429
  /**
318
- * 子节点
430
+ * Child ASTNodes.
319
431
  */
320
432
  protected _children: Set<ASTNode<any, any>>;
321
433
  /**
322
- * 删除节点处理事件列表
434
+ * List of disposal handlers for the ASTNode.
323
435
  */
324
436
  readonly toDispose: DisposableCollection;
325
437
  /**
326
- * 销毁时触发的回调
438
+ * Callback triggered upon disposal.
327
439
  */
328
440
  onDispose: _flowgram_ai_utils.Event<void>;
329
441
  /**
330
- * 构造函数
331
- * @param createParams 创建 ASTNode 的必要参数
332
- * @param injectOptions 依赖注入各种模块
442
+ * Constructor.
443
+ * @param createParams Necessary parameters for creating an ASTNode.
444
+ * @param injectOptions Dependency injection for various modules.
333
445
  */
334
446
  constructor({ key, parent, scope }: CreateASTParams, opts?: InjectOpts);
335
447
  /**
336
- * AST 节点的类型
448
+ * The type of the ASTNode.
337
449
  */
338
450
  get kind(): string;
339
451
  /**
340
- * 解析 AST JSON 数据
341
- * @param json AST JSON 数据
452
+ * Parses AST JSON data.
453
+ * @param json AST JSON data.
342
454
  */
343
455
  abstract fromJSON(json: JSON): void;
344
456
  /**
345
- * 获取当前节点所有子节点
457
+ * Gets all child ASTNodes of the current ASTNode.
346
458
  */
347
459
  get children(): ASTNode[];
348
460
  /**
349
- * 转化为 ASTNodeJSON
461
+ * Serializes the current ASTNode to ASTNodeJSON.
350
462
  * @returns
351
463
  */
352
464
  toJSON(): ASTNodeJSON;
353
465
  /**
354
- * 创建子节点
355
- * @param json 子节点的 AST JSON
466
+ * Creates a child ASTNode.
467
+ * @param json The AST JSON of the child ASTNode.
356
468
  * @returns
357
469
  */
358
470
  protected createChildNode<ChildNode extends ASTNode = ASTNode>(json: ASTNodeJSON): ChildNode;
359
471
  /**
360
- * 更新子节点,快速实现子节点更新消费逻辑
361
- * @param keyInThis 当前对象上的指定 key
472
+ * Updates a child ASTNode, quickly implementing the consumption logic for child ASTNode updates.
473
+ * @param keyInThis The specified key on the current object.
362
474
  */
363
475
  protected updateChildNodeByKey(keyInThis: keyof this, nextJSON?: ASTNodeJSON): void;
364
476
  /**
365
- * 批处理更新,批处理函数内所有的 fireChange 都合并成一个
366
- * @param updater 批处理函数
477
+ * Batch updates the ASTNode, merging all `fireChange` calls within the batch function into one.
478
+ * @param updater The batch function.
367
479
  * @returns
368
480
  */
369
481
  protected withBatchUpdate<ParamTypes extends any[], ReturnType>(updater: (...args: ParamTypes) => ReturnType): (...args: ParamTypes) => ReturnType;
370
482
  /**
371
- * 触发当前节点更新
483
+ * Triggers an update for the current node.
372
484
  */
373
485
  fireChange(): void;
374
486
  /**
375
- * 节点的版本值
376
- * - 通过 NodeA === NodeB && versionA === versionB 可以比较两者是否相等
487
+ * The version value of the ASTNode.
488
+ * - You can used to check whether ASTNode are updated.
377
489
  */
378
490
  get version(): number;
379
491
  /**
380
- * 节点唯一 hash
492
+ * The unique hash value of the ASTNode.
493
+ * - It will update when the ASTNode is updated.
494
+ * - You can used to check two ASTNode are equal.
381
495
  */
382
496
  get hash(): string;
383
497
  /**
384
- * 监听 AST 节点的变化
385
- * @param observer 监听回调
386
- * @param selector 监听指定数据
498
+ * Listens for changes to the ASTNode.
499
+ * @param observer The listener callback.
500
+ * @param selector Listens for specified data.
387
501
  * @returns
388
502
  */
389
503
  subscribe<Data = this>(observer: ObserverOrNext<Data>, { selector, debounceAnimation, triggerOnInit }?: SubscribeConfig<this, Data>): Disposable;
504
+ /**
505
+ * Dispatches a global event for the current ASTNode.
506
+ * @param event The global event.
507
+ */
390
508
  dispatchGlobalEvent<ActionType extends GlobalEventActionType = GlobalEventActionType>(event: Omit<ActionType, 'ast'>): void;
391
509
  /**
392
- * 销毁
510
+ * Disposes the ASTNode.
393
511
  */
394
512
  dispose(): void;
395
513
  get disposed(): boolean;
396
514
  /**
397
- * 节点扩展信息
515
+ * Extended information of the ASTNode.
398
516
  */
399
517
  [key: string]: unknown;
400
518
  }
@@ -406,46 +524,116 @@ declare abstract class ASTNode<JSON extends ASTNodeJSON = any, InjectOpts = any>
406
524
 
407
525
  type ASTKindType = string;
408
526
  type Identifier = string;
527
+ /**
528
+ * ASTNodeJSON is the JSON representation of an ASTNode.
529
+ */
409
530
  interface ASTNodeJSON {
531
+ /**
532
+ * Kind is the type of the AST node.
533
+ */
410
534
  kind?: ASTKindType;
535
+ /**
536
+ * Key is the unique identifier of the node.
537
+ * If not provided, the node will generate a default key value.
538
+ */
411
539
  key?: Identifier;
412
540
  [key: string]: any;
413
541
  }
414
542
  /**
415
- * 核心 AST 节点类型
543
+ * Core AST node types.
416
544
  */
417
545
  declare enum ASTKind {
418
546
  /**
419
- * 类型相关
420
- * - 内部默认实现一套基于 JSON 类型的类型 AST 节点
547
+ * # Type-related.
548
+ * - A set of type AST nodes based on JSON types is implemented internally by default.
549
+ */
550
+ /**
551
+ * String type.
552
+ */
553
+ String = "String",
554
+ /**
555
+ * Number type.
556
+ */
557
+ Number = "Number",
558
+ /**
559
+ * Integer type.
560
+ */
561
+ Integer = "Integer",
562
+ /**
563
+ * Boolean type.
564
+ */
565
+ Boolean = "Boolean",
566
+ /**
567
+ * Object type.
568
+ */
569
+ Object = "Object",
570
+ /**
571
+ * Array type.
572
+ */
573
+ Array = "Array",
574
+ /**
575
+ * Map type.
576
+ */
577
+ Map = "Map",
578
+ /**
579
+ * Union type.
580
+ * Commonly used for type checking, generally not exposed to the business.
581
+ */
582
+ Union = "Union",
583
+ /**
584
+ * Any type.
585
+ * Commonly used for business logic.
586
+ */
587
+ Any = "Any",
588
+ /**
589
+ * Custom type.
590
+ * For business-defined types.
591
+ */
592
+ CustomType = "CustomType",
593
+ /**
594
+ * # Declaration-related.
595
+ */
596
+ /**
597
+ * Field definition for Object drill-down.
598
+ */
599
+ Property = "Property",
600
+ /**
601
+ * Variable declaration.
602
+ */
603
+ VariableDeclaration = "VariableDeclaration",
604
+ /**
605
+ * Variable declaration list.
606
+ */
607
+ VariableDeclarationList = "VariableDeclarationList",
608
+ /**
609
+ * # Expression-related.
421
610
  */
422
- String = "String",// 字符串
423
- Number = "Number",// 数字
424
- Integer = "Integer",// 整数
425
- Boolean = "Boolean",// 布尔值
426
- Object = "Object",// Object
427
- Array = "Array",// Array
428
- Map = "Map",// Map
429
- Union = "Union",// 联合类型,常用于类型判断,一般不对业务透出
430
- Any = "Any",// 任意类型,常用于业务判断
431
- CustomType = "CustomType",// 自定义类型,用于业务自定义类型
432
611
  /**
433
- * 声明
612
+ * Access fields on variables through the path system.
434
613
  */
435
- Property = "Property",// Object 下钻的字段定义
436
- VariableDeclaration = "VariableDeclaration",// 变量声明
437
- VariableDeclarationList = "VariableDeclarationList",// 变量声明
614
+ KeyPathExpression = "KeyPathExpression",
438
615
  /**
439
- * 表达式
616
+ * Iterate over specified data.
440
617
  */
441
- KeyPathExpression = "KeyPathExpression",// 通过路径系统访问变量上的字段
442
- EnumerateExpression = "EnumerateExpression",// 对指定的数据进行遍历
443
- WrapArrayExpression = "WrapArrayExpression",// Wrap with Array Type
618
+ EnumerateExpression = "EnumerateExpression",
444
619
  /**
445
- * 通用 AST 节点
620
+ * Wrap with Array Type.
621
+ */
622
+ WrapArrayExpression = "WrapArrayExpression",
623
+ /**
624
+ * # General-purpose AST nodes.
625
+ */
626
+ /**
627
+ * General-purpose List<ASTNode> storage node.
628
+ */
629
+ ListNode = "ListNode",
630
+ /**
631
+ * General-purpose data storage node.
632
+ */
633
+ DataNode = "DataNode",
634
+ /**
635
+ * General-purpose Map<string, ASTNode> storage node.
446
636
  */
447
- ListNode = "ListNode",// 通用 List<ASTNode> 存储节点
448
- DataNode = "DataNode",// 通用的数据存储节点
449
637
  MapNode = "MapNode"
450
638
  }
451
639
  interface CreateASTParams {
@@ -460,14 +648,24 @@ interface SubscribeConfig<This, Data> {
460
648
  triggerOnInit?: boolean;
461
649
  selector?: (curr: This) => Data;
462
650
  }
651
+ /**
652
+ * TypeUtils to get the JSON representation of an AST node with a specific kind.
653
+ */
463
654
  type GetKindJSON<KindType extends string, JSON extends ASTNodeJSON> = {
464
655
  kind: KindType;
465
656
  key?: Identifier;
466
657
  } & JSON;
658
+ /**
659
+ * TypeUtils to get the JSON representation of an AST node with a specific kind or just the kind string.
660
+ */
467
661
  type GetKindJSONOrKind<KindType extends string, JSON extends ASTNodeJSON> = ({
468
662
  kind: KindType;
469
663
  key?: Identifier;
470
664
  } & JSON) | KindType;
665
+ /**
666
+ * Global event action type.
667
+ * - Global event might be dispatched from `ASTNode` or `Scope`.
668
+ */
471
669
  interface GlobalEventActionType<Type = string, Payload = any, AST extends ASTNode = ASTNode> {
472
670
  type: Type;
473
671
  payload?: Payload;
@@ -480,27 +678,30 @@ interface GlobalEventActionType<Type = string, Payload = any, AST extends ASTNod
480
678
  */
481
679
 
482
680
  type DataInjector = () => Record<string, any>;
681
+ /**
682
+ * Register the AST node to the engine.
683
+ */
483
684
  declare class ASTRegisters {
484
685
  protected injectors: Map<ASTKindType, DataInjector>;
485
686
  protected astMap: Map<ASTKindType, ASTNodeRegistry>;
486
687
  /**
487
- * 核心 AST 节点注册
688
+ * Core AST node registration.
488
689
  */
489
690
  constructor();
490
691
  /**
491
- * 创建 AST 节点
492
- * @param param 创建参数
692
+ * Creates an AST node.
693
+ * @param param Creation parameters.
493
694
  * @returns
494
695
  */
495
696
  createAST<ReturnNode extends ASTNode = ASTNode>(json: ASTNodeJSON, { parent, scope }: CreateASTParams): ReturnNode;
496
697
  /**
497
- * 根据 AST 节点类型获取节点 Registry
698
+ * Gets the node Registry by AST node type.
498
699
  * @param kind
499
700
  * @returns
500
701
  */
501
702
  getASTRegistryByKind(kind: ASTKindType): ASTNodeRegistry<any, any> | undefined;
502
703
  /**
503
- * 注册 AST 节点
704
+ * Registers an AST node.
504
705
  * @param ASTNode
505
706
  * @param injector
506
707
  */
@@ -511,23 +712,44 @@ declare class ASTRegisters {
511
712
  * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
512
713
  * SPDX-License-Identifier: MIT
513
714
  */
715
+ /**
716
+ * ASTNode flags. Stored in the `flags` property of the `ASTNode`.
717
+ */
514
718
  declare enum ASTNodeFlags {
719
+ /**
720
+ * None.
721
+ */
515
722
  None = 0,
516
723
  /**
517
- * 变量字段
724
+ * Variable Field.
518
725
  */
519
726
  VariableField = 1,
520
727
  /**
521
- * 表达式
728
+ * Expression.
522
729
  */
523
730
  Expression = 4,
524
731
  /**
525
- * 变量类型
732
+ * # Variable Type Flags
733
+ */
734
+ /**
735
+ * Basic type.
736
+ */
737
+ BasicType = 8,
738
+ /**
739
+ * Drillable variable type.
740
+ */
741
+ DrilldownType = 16,
742
+ /**
743
+ * Enumerable variable type.
744
+ */
745
+ EnumerateType = 32,
746
+ /**
747
+ * Composite type, currently not in use.
748
+ */
749
+ UnionType = 64,
750
+ /**
751
+ * Variable type.
526
752
  */
527
- BasicType = 8,// 基础类型
528
- DrilldownType = 16,// 可下钻的变量类型
529
- EnumerateType = 32,// 可遍历的变量类型
530
- UnionType = 64,// 复合类型,暂时不存在
531
753
  VariableType = 120
532
754
  }
533
755
 
@@ -537,16 +759,31 @@ declare enum ASTNodeFlags {
537
759
  */
538
760
 
539
761
  /**
540
- * 通用数据 AST 节点,无子节点
762
+ * Represents a general data node with no child nodes.
541
763
  */
542
764
  declare class DataNode<Data = any> extends ASTNode {
543
765
  static kind: string;
544
766
  protected _data: Data;
767
+ /**
768
+ * The data of the node.
769
+ */
545
770
  get data(): Data;
771
+ /**
772
+ * Deserializes the `DataNodeJSON` to the `DataNode`.
773
+ * @param json The `DataNodeJSON` to deserialize.
774
+ */
546
775
  fromJSON(json: Data): void;
776
+ /**
777
+ * Serialize the `DataNode` to `DataNodeJSON`.
778
+ * @returns The JSON representation of `DataNode`.
779
+ */
547
780
  toJSON(): {
548
781
  kind: ASTKind;
549
782
  } & Data;
783
+ /**
784
+ * Partially update the data of the node.
785
+ * @param nextData The data to be updated.
786
+ */
550
787
  partialUpdate(nextData: Data): void;
551
788
  }
552
789
 
@@ -555,14 +792,34 @@ declare class DataNode<Data = any> extends ASTNode {
555
792
  * SPDX-License-Identifier: MIT
556
793
  */
557
794
 
795
+ /**
796
+ * ASTNodeJSON representation of `ListNode`
797
+ */
558
798
  interface ListNodeJSON {
799
+ /**
800
+ * The list of nodes.
801
+ */
559
802
  list: ASTNodeJSON[];
560
803
  }
804
+ /**
805
+ * Represents a list of nodes.
806
+ */
561
807
  declare class ListNode extends ASTNode<ListNodeJSON> {
562
808
  static kind: string;
563
809
  protected _list: ASTNode[];
810
+ /**
811
+ * The list of nodes.
812
+ */
564
813
  get list(): ASTNode[];
814
+ /**
815
+ * Deserializes the `ListNodeJSON` to the `ListNode`.
816
+ * @param json The `ListNodeJSON` to deserialize.
817
+ */
565
818
  fromJSON({ list }: ListNodeJSON): void;
819
+ /**
820
+ * Serialize the `ListNode` to `ListNodeJSON`.
821
+ * @returns The JSON representation of `ListNode`.
822
+ */
566
823
  toJSON(): ASTNodeJSON;
567
824
  }
568
825
 
@@ -571,31 +828,49 @@ declare class ListNode extends ASTNode<ListNodeJSON> {
571
828
  * SPDX-License-Identifier: MIT
572
829
  */
573
830
 
831
+ /**
832
+ * ASTNodeJSON representation of `MapNode`
833
+ */
574
834
  interface MapNodeJSON {
835
+ /**
836
+ * The map of nodes.
837
+ */
575
838
  map: [string, ASTNodeJSON][];
576
839
  }
840
+ /**
841
+ * Represents a map of nodes.
842
+ */
577
843
  declare class MapNode extends ASTNode<MapNodeJSON> {
578
844
  static kind: string;
579
845
  protected map: Map<string, ASTNode>;
846
+ /**
847
+ * Deserializes the `MapNodeJSON` to the `MapNode`.
848
+ * @param json The `MapNodeJSON` to deserialize.
849
+ */
580
850
  fromJSON({ map }: MapNodeJSON): void;
851
+ /**
852
+ * Serialize the `MapNode` to `MapNodeJSON`.
853
+ * @returns The JSON representation of `MapNode`.
854
+ */
581
855
  toJSON(): ASTNodeJSON;
582
856
  /**
583
- * Map 中设置 ASTNode
584
- * @param key ASTNode 的索引,
585
- * @param json
857
+ * Set a node in the map.
858
+ * @param key The key of the node.
859
+ * @param nextJSON The JSON representation of the node.
860
+ * @returns The node instance.
586
861
  */
587
862
  set<Node extends ASTNode = ASTNode>(key: string, nextJSON: ASTNodeJSON): Node;
588
863
  /**
589
- * 移除指定 ASTNode
590
- * @param key
864
+ * Remove a node from the map.
865
+ * @param key The key of the node.
591
866
  */
592
867
  remove(key: string): void;
593
868
  /**
594
- * 获取 ASTNode
595
- * @param key
596
- * @returns
869
+ * Get a node from the map.
870
+ * @param key The key of the node.
871
+ * @returns The node instance if found, otherwise `undefined`.
597
872
  */
598
- get(key: string): ASTNode | undefined;
873
+ get<Node extends ASTNode = ASTNode>(key: string): Node | undefined;
599
874
  }
600
875
 
601
876
  /**
@@ -603,21 +878,30 @@ declare class MapNode extends ASTNode<MapNodeJSON> {
603
878
  * SPDX-License-Identifier: MIT
604
879
  */
605
880
 
881
+ /**
882
+ * Base class for all types.
883
+ *
884
+ * All other types should extend this class.
885
+ */
606
886
  declare abstract class BaseType<JSON extends ASTNodeJSON = any, InjectOpts = any> extends ASTNode<JSON, InjectOpts> {
607
887
  flags: number;
608
888
  /**
609
- * 类型是否一致
610
- * @param targetTypeJSON
889
+ * Check if the current type is equal to the target type.
890
+ * @param targetTypeJSONOrKind The type to compare with.
891
+ * @returns `true` if the types are equal, `false` otherwise.
611
892
  */
612
893
  isTypeEqual(targetTypeJSONOrKind?: ASTNodeJSONOrKind): boolean;
613
894
  /**
614
- * 可下钻类型需实现
615
- * @param keyPath
895
+ * Get a variable field by key path.
896
+ *
897
+ * This method should be implemented by drillable types.
898
+ * @param keyPath The key path to search for.
899
+ * @returns The variable field if found, otherwise `undefined`.
616
900
  */
617
901
  getByKeyPath(keyPath?: string[]): BaseVariableField | undefined;
618
902
  /**
619
- * Get AST JSON for current base type
620
- * @returns
903
+ * Serialize the node to a JSON object.
904
+ * @returns The JSON representation of the node.
621
905
  */
622
906
  toJSON(): ASTNodeJSON;
623
907
  }
@@ -627,9 +911,12 @@ declare abstract class BaseType<JSON extends ASTNodeJSON = any, InjectOpts = any
627
911
  * SPDX-License-Identifier: MIT
628
912
  */
629
913
 
914
+ /**
915
+ * ASTNodeJSON representation of the `StringType`.
916
+ */
630
917
  interface StringJSON {
631
918
  /**
632
- * https://json-schema.org/understanding-json-schema/reference/type#format
919
+ * see https://json-schema.org/understanding-json-schema/reference/type#format
633
920
  */
634
921
  format?: string;
635
922
  }
@@ -638,9 +925,14 @@ declare class StringType extends BaseType {
638
925
  static kind: string;
639
926
  protected _format?: string;
640
927
  /**
641
- * https://json-schema.org/understanding-json-schema/reference/type#format
928
+ * see https://json-schema.org/understanding-json-schema/reference/string#format
642
929
  */
643
930
  get format(): string | undefined;
931
+ /**
932
+ * Deserialize the `StringJSON` to the `StringType`.
933
+ *
934
+ * @param json StringJSON representation of the `StringType`.
935
+ */
644
936
  fromJSON(json?: StringJSON): void;
645
937
  }
646
938
 
@@ -649,9 +941,16 @@ declare class StringType extends BaseType {
649
941
  * SPDX-License-Identifier: MIT
650
942
  */
651
943
 
944
+ /**
945
+ * Represents an integer type.
946
+ */
652
947
  declare class IntegerType extends BaseType {
653
948
  flags: ASTNodeFlags;
654
949
  static kind: string;
950
+ /**
951
+ * Deserializes the `IntegerJSON` to the `IntegerType`.
952
+ * @param json The `IntegerJSON` to deserialize.
953
+ */
655
954
  fromJSON(): void;
656
955
  }
657
956
 
@@ -660,8 +959,15 @@ declare class IntegerType extends BaseType {
660
959
  * SPDX-License-Identifier: MIT
661
960
  */
662
961
 
962
+ /**
963
+ * Represents a boolean type.
964
+ */
663
965
  declare class BooleanType extends BaseType {
664
966
  static kind: string;
967
+ /**
968
+ * Deserializes the `BooleanJSON` to the `BooleanType`.
969
+ * @param json The `BooleanJSON` to deserialize.
970
+ */
665
971
  fromJSON(): void;
666
972
  }
667
973
 
@@ -670,8 +976,15 @@ declare class BooleanType extends BaseType {
670
976
  * SPDX-License-Identifier: MIT
671
977
  */
672
978
 
979
+ /**
980
+ * Represents a number type.
981
+ */
673
982
  declare class NumberType extends BaseType {
674
983
  static kind: string;
984
+ /**
985
+ * Deserializes the `NumberJSON` to the `NumberType`.
986
+ * @param json The `NumberJSON` to deserialize.
987
+ */
675
988
  fromJSON(): void;
676
989
  }
677
990
 
@@ -680,23 +993,56 @@ declare class NumberType extends BaseType {
680
993
  * SPDX-License-Identifier: MIT
681
994
  */
682
995
 
996
+ /**
997
+ * ASTNodeJSON representation of `ArrayType`
998
+ */
683
999
  interface ArrayJSON {
1000
+ /**
1001
+ * The type of the items in the array.
1002
+ */
684
1003
  items?: ASTNodeJSONOrKind;
685
1004
  }
1005
+ /**
1006
+ * Represents an array type.
1007
+ */
686
1008
  declare class ArrayType extends BaseType<ArrayJSON> {
687
1009
  flags: ASTNodeFlags;
688
1010
  static kind: string;
1011
+ /**
1012
+ * The type of the items in the array.
1013
+ */
689
1014
  items: BaseType;
1015
+ /**
1016
+ * Deserializes the `ArrayJSON` to the `ArrayType`.
1017
+ * @param json The `ArrayJSON` to deserialize.
1018
+ */
690
1019
  fromJSON({ items }: ArrayJSON): void;
1020
+ /**
1021
+ * Whether the items type can be drilled down.
1022
+ */
691
1023
  get canDrilldownItems(): boolean;
1024
+ /**
1025
+ * Get a variable field by key path.
1026
+ * @param keyPath The key path to search for.
1027
+ * @returns The variable field if found, otherwise `undefined`.
1028
+ */
692
1029
  getByKeyPath(keyPath: string[]): BaseVariableField | undefined;
1030
+ /**
1031
+ * Check if the current type is equal to the target type.
1032
+ * @param targetTypeJSONOrKind The type to compare with.
1033
+ * @returns `true` if the types are equal, `false` otherwise.
1034
+ */
693
1035
  isTypeEqual(targetTypeJSONOrKind?: ASTNodeJSONOrKind): boolean;
694
1036
  /**
695
- * Array 强比较
696
- * @param targetTypeJSON
697
- * @returns
1037
+ * Array strong comparison.
1038
+ * @param targetTypeJSON The type to compare with.
1039
+ * @returns `true` if the types are equal, `false` otherwise.
698
1040
  */
699
1041
  protected customStrongEqual(targetTypeJSON: ASTNodeJSON): boolean;
1042
+ /**
1043
+ * Serialize the `ArrayType` to `ArrayJSON`
1044
+ * @returns The JSON representation of `ArrayType`.
1045
+ */
700
1046
  toJSON(): ASTNodeJSON;
701
1047
  }
702
1048
 
@@ -705,22 +1051,53 @@ declare class ArrayType extends BaseType<ArrayJSON> {
705
1051
  * SPDX-License-Identifier: MIT
706
1052
  */
707
1053
 
1054
+ /**
1055
+ * ASTNodeJSON representation of `MapType`
1056
+ */
708
1057
  interface MapJSON {
1058
+ /**
1059
+ * The type of the keys in the map.
1060
+ */
709
1061
  keyType?: ASTNodeJSONOrKind;
1062
+ /**
1063
+ * The type of the values in the map.
1064
+ */
710
1065
  valueType?: ASTNodeJSONOrKind;
711
1066
  }
1067
+ /**
1068
+ * Represents a map type.
1069
+ */
712
1070
  declare class MapType extends BaseType<MapJSON> {
713
1071
  static kind: string;
1072
+ /**
1073
+ * The type of the keys in the map.
1074
+ */
714
1075
  keyType: BaseType;
1076
+ /**
1077
+ * The type of the values in the map.
1078
+ */
715
1079
  valueType: BaseType;
1080
+ /**
1081
+ * Deserializes the `MapJSON` to the `MapType`.
1082
+ * @param json The `MapJSON` to deserialize.
1083
+ */
716
1084
  fromJSON({ keyType, valueType }: MapJSON): void;
1085
+ /**
1086
+ * Check if the current type is equal to the target type.
1087
+ * @param targetTypeJSONOrKind The type to compare with.
1088
+ * @returns `true` if the types are equal, `false` otherwise.
1089
+ */
717
1090
  isTypeEqual(targetTypeJSONOrKind?: ASTNodeJSONOrKind): boolean;
718
1091
  /**
719
- * Map 强比较
720
- * @param targetTypeJSON
721
- * @returns
1092
+ * Map strong comparison.
1093
+ * @param targetTypeJSON The type to compare with.
1094
+ * @returns `true` if the types are equal, `false` otherwise.
722
1095
  */
723
1096
  protected customStrongEqual(targetTypeJSON: ASTNodeJSON): boolean;
1097
+ /**
1098
+ * Serialize the node to a JSON object.
1099
+ * @returns The JSON representation of the node.
1100
+ */
724
1101
  toJSON(): ASTNodeJSON;
725
1102
  }
726
1103
 
@@ -729,9 +1106,15 @@ declare class MapType extends BaseType<MapJSON> {
729
1106
  * SPDX-License-Identifier: MIT
730
1107
  */
731
1108
 
1109
+ /**
1110
+ * ASTNodeJSON representation of the `Property`.
1111
+ */
732
1112
  type PropertyJSON<VariableMeta = any> = BaseVariableFieldJSON<VariableMeta> & {
733
1113
  key: string;
734
1114
  };
1115
+ /**
1116
+ * `Property` is a variable field that represents a property of a `ObjectType`.
1117
+ */
735
1118
  declare class Property<VariableMeta = any> extends BaseVariableField<VariableMeta> {
736
1119
  static kind: string;
737
1120
  }
@@ -741,34 +1124,64 @@ declare class Property<VariableMeta = any> extends BaseVariableField<VariableMet
741
1124
  * SPDX-License-Identifier: MIT
742
1125
  */
743
1126
 
1127
+ /**
1128
+ * ASTNodeJSON representation of `ObjectType`
1129
+ */
744
1130
  interface ObjectJSON<VariableMeta = any> {
745
1131
  /**
746
- * Object properties 一定是 Property 类型,因此业务可以不用填 kind
1132
+ * The properties of the object.
1133
+ *
1134
+ * The `properties` of an Object must be of type `Property`, so the business can omit the `kind` field.
747
1135
  */
748
1136
  properties?: PropertyJSON<VariableMeta>[];
749
1137
  }
1138
+ /**
1139
+ * Action type for object properties change.
1140
+ */
750
1141
  type ObjectPropertiesChangeAction = GlobalEventActionType<'ObjectPropertiesChange', {
751
1142
  prev: Property[];
752
1143
  next: Property[];
753
1144
  }, ObjectType>;
1145
+ /**
1146
+ * Represents an object type.
1147
+ */
754
1148
  declare class ObjectType extends BaseType<ObjectJSON> {
755
1149
  flags: ASTNodeFlags;
756
1150
  static kind: string;
1151
+ /**
1152
+ * A map of property keys to `Property` instances.
1153
+ */
757
1154
  propertyTable: Map<string, Property>;
1155
+ /**
1156
+ * An array of `Property` instances.
1157
+ */
758
1158
  properties: Property[];
1159
+ /**
1160
+ * Deserializes the `ObjectJSON` to the `ObjectType`.
1161
+ * @param json The `ObjectJSON` to deserialize.
1162
+ */
759
1163
  fromJSON({ properties }: ObjectJSON): void;
1164
+ /**
1165
+ * Serialize the `ObjectType` to `ObjectJSON`.
1166
+ * @returns The JSON representation of `ObjectType`.
1167
+ */
760
1168
  toJSON(): ASTNodeJSON;
761
1169
  /**
762
- * 根据 KeyPath 找到对应的变量
763
- * @param keyPath 变量路径
764
- * @returns
1170
+ * Get a variable field by key path.
1171
+ * @param keyPath The key path to search for.
1172
+ * @returns The variable field if found, otherwise `undefined`.
765
1173
  */
766
1174
  getByKeyPath(keyPath: string[]): Property | undefined;
1175
+ /**
1176
+ * Check if the current type is equal to the target type.
1177
+ * @param targetTypeJSONOrKind The type to compare with.
1178
+ * @returns `true` if the types are equal, `false` otherwise.
1179
+ */
767
1180
  isTypeEqual(targetTypeJSONOrKind?: ASTNodeJSONOrKind): boolean;
768
1181
  /**
769
- * Object 类型强比较
770
- * @param targetTypeJSON
771
- * @returns
1182
+ * Object type strong comparison.
1183
+ * @param targetTypeJSON The type to compare with.
1184
+ * @returns `true` if the types are equal, `false` otherwise.
772
1185
  */
773
1186
  protected customStrongEqual(targetTypeJSON: ASTNodeJSON): boolean;
774
1187
  }
@@ -778,6 +1191,9 @@ declare class ObjectType extends BaseType<ObjectJSON> {
778
1191
  * SPDX-License-Identifier: MIT
779
1192
  */
780
1193
 
1194
+ /**
1195
+ * ASTNodeJSON representation of `UnionType`, which union multiple `BaseType`.
1196
+ */
781
1197
  interface UnionJSON {
782
1198
  types?: ASTNodeJSONOrKind[];
783
1199
  }
@@ -787,14 +1203,35 @@ interface UnionJSON {
787
1203
  * SPDX-License-Identifier: MIT
788
1204
  */
789
1205
 
1206
+ /**
1207
+ * ASTNodeJSON representation of `CustomType`
1208
+ */
790
1209
  interface CustomTypeJSON {
1210
+ /**
1211
+ * The name of the custom type.
1212
+ */
791
1213
  typeName: string;
792
1214
  }
1215
+ /**
1216
+ * Represents a custom type.
1217
+ */
793
1218
  declare class CustomType extends BaseType<CustomTypeJSON> {
794
1219
  static kind: string;
795
1220
  protected _typeName: string;
1221
+ /**
1222
+ * The name of the custom type.
1223
+ */
796
1224
  get typeName(): string;
1225
+ /**
1226
+ * Deserializes the `CustomTypeJSON` to the `CustomType`.
1227
+ * @param json The `CustomTypeJSON` to deserialize.
1228
+ */
797
1229
  fromJSON(json: CustomTypeJSON): void;
1230
+ /**
1231
+ * Check if the current type is equal to the target type.
1232
+ * @param targetTypeJSONOrKind The type to compare with.
1233
+ * @returns `true` if the types are equal, `false` otherwise.
1234
+ */
798
1235
  isTypeEqual(targetTypeJSONOrKind?: ASTNodeJSONOrKind): boolean;
799
1236
  }
800
1237
 
@@ -804,38 +1241,47 @@ declare class CustomType extends BaseType<CustomTypeJSON> {
804
1241
  */
805
1242
 
806
1243
  type ExpressionRefs = (BaseVariableField | undefined)[];
1244
+ /**
1245
+ * Base class for all expressions.
1246
+ *
1247
+ * All other expressions should extend this class.
1248
+ */
807
1249
  declare abstract class BaseExpression<JSON extends ASTNodeJSON = any, InjectOpts = any> extends ASTNode<JSON, InjectOpts> {
808
1250
  flags: ASTNodeFlags;
809
1251
  /**
810
- * 获取全局变量表,方便表达式获取引用变量
1252
+ * Get the global variable table, which is used to access referenced variables.
811
1253
  */
812
1254
  get globalVariableTable(): IVariableTable;
813
1255
  /**
814
- * 父变量字段,通过由近而远的方式进行排序
1256
+ * Parent variable fields, sorted from closest to farthest.
815
1257
  */
816
1258
  get parentFields(): BaseVariableField[];
817
1259
  /**
818
- * 获取表达式引用的变量字段
819
- * - 通常是 变量 VariableDeclaration,或者 属性 Property 节点
1260
+ * Get the variable fields referenced by the expression.
1261
+ *
1262
+ * This method should be implemented by subclasses.
1263
+ * @returns An array of referenced variable fields.
820
1264
  */
821
1265
  abstract getRefFields(): ExpressionRefs;
822
1266
  /**
823
- * 表达式返回的数据类型
1267
+ * The return type of the expression.
824
1268
  */
825
1269
  abstract returnType: BaseType | undefined;
826
1270
  /**
827
- * 引用变量
1271
+ * The variable fields referenced by the expression.
828
1272
  */
829
1273
  protected _refs: ExpressionRefs;
1274
+ /**
1275
+ * The variable fields referenced by the expression.
1276
+ */
830
1277
  get refs(): ExpressionRefs;
831
1278
  protected refreshRefs$: Subject<void>;
832
1279
  /**
833
- * 刷新变量引用
1280
+ * Refresh the variable references.
834
1281
  */
835
1282
  refreshRefs(): void;
836
1283
  /**
837
- * 监听引用变量变化
838
- * 监听 [a.b.c] -> [a.b]
1284
+ * An observable that emits the referenced variable fields when they change.
839
1285
  */
840
1286
  refs$: Observable<ExpressionRefs>;
841
1287
  constructor(params: CreateASTParams, opts?: InjectOpts);
@@ -846,45 +1292,43 @@ declare abstract class BaseExpression<JSON extends ASTNodeJSON = any, InjectOpts
846
1292
  * SPDX-License-Identifier: MIT
847
1293
  */
848
1294
 
849
- interface KeyPathExpressionJSON$1 {
850
- keyPath: string[];
851
- }
852
- declare class KeyPathExpression<CustomPathJSON extends ASTNodeJSON = KeyPathExpressionJSON$1> extends BaseExpression<CustomPathJSON> {
853
- static kind: string;
854
- protected _keyPath: string[];
855
- get keyPath(): string[];
856
- getRefFields(): BaseVariableField[];
857
- get returnType(): BaseType | undefined;
858
- /**
859
- * 业务重改该方法可快速定制自己的 Path 表达式
860
- * - 只需要将业务的 Path 解析为变量系统的 KeyPath 即可
861
- * @param json 业务定义的 Path 表达式
862
- * @returns
863
- */
864
- protected parseToKeyPath(json: CustomPathJSON): string[];
865
- fromJSON(json: CustomPathJSON): void;
866
- constructor(params: CreateASTParams, opts: any);
867
- toJSON(): ASTNodeJSON;
868
- }
869
-
870
1295
  /**
871
- * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
872
- * SPDX-License-Identifier: MIT
1296
+ * ASTNodeJSON representation of `EnumerateExpression`
873
1297
  */
874
-
875
1298
  interface EnumerateExpressionJSON {
1299
+ /**
1300
+ * The expression to be enumerated.
1301
+ */
876
1302
  enumerateFor: ASTNodeJSON;
877
1303
  }
878
1304
  /**
879
- * 遍历表达式,对列表进行遍历,获取遍历后的变量类型
1305
+ * Represents an enumeration expression, which iterates over a list and returns the type of the enumerated variable.
880
1306
  */
881
1307
  declare class EnumerateExpression extends BaseExpression<EnumerateExpressionJSON> {
882
1308
  static kind: string;
883
1309
  protected _enumerateFor: BaseExpression | undefined;
1310
+ /**
1311
+ * The expression to be enumerated.
1312
+ */
884
1313
  get enumerateFor(): BaseExpression<any, any> | undefined;
1314
+ /**
1315
+ * The return type of the expression.
1316
+ */
885
1317
  get returnType(): BaseType | undefined;
1318
+ /**
1319
+ * Get the variable fields referenced by the expression.
1320
+ * @returns An empty array, as this expression does not reference any variables.
1321
+ */
886
1322
  getRefFields(): [];
1323
+ /**
1324
+ * Deserializes the `EnumerateExpressionJSON` to the `EnumerateExpression`.
1325
+ * @param json The `EnumerateExpressionJSON` to deserialize.
1326
+ */
887
1327
  fromJSON({ enumerateFor: expression }: EnumerateExpressionJSON): void;
1328
+ /**
1329
+ * Serialize the `EnumerateExpression` to `EnumerateExpressionJSON`.
1330
+ * @returns The JSON representation of `EnumerateExpression`.
1331
+ */
888
1332
  toJSON(): ASTNodeJSON;
889
1333
  }
890
1334
 
@@ -893,32 +1337,69 @@ declare class EnumerateExpression extends BaseExpression<EnumerateExpressionJSON
893
1337
  * SPDX-License-Identifier: MIT
894
1338
  */
895
1339
 
896
- interface KeyPathExpressionJSON {
1340
+ /**
1341
+ * ASTNodeJSON representation of `KeyPathExpression`
1342
+ */
1343
+ interface KeyPathExpressionJSON$1 {
1344
+ /**
1345
+ * The key path of the variable.
1346
+ */
897
1347
  keyPath: string[];
898
1348
  }
899
1349
  /**
900
- * 新版 KeyPathExpressionV2,相比旧版:
901
- * - returnType 拷贝新一份,避免引用问题
902
- * - 引入成环检测
1350
+ * Represents a key path expression, which is used to reference a variable by its key path.
1351
+ *
1352
+ * This is the V2 of `KeyPathExpression`, with the following improvements:
1353
+ * - `returnType` is copied to a new instance to avoid reference issues.
1354
+ * - Circular reference detection is introduced.
903
1355
  */
904
- declare class KeyPathExpressionV2<CustomPathJSON extends ASTNodeJSON = KeyPathExpressionJSON> extends BaseExpression<CustomPathJSON> {
1356
+ declare class KeyPathExpression<CustomPathJSON extends ASTNodeJSON = KeyPathExpressionJSON$1> extends BaseExpression<CustomPathJSON> {
905
1357
  static kind: string;
906
1358
  protected _keyPath: string[];
1359
+ /**
1360
+ * The key path of the variable.
1361
+ */
907
1362
  get keyPath(): string[];
1363
+ /**
1364
+ * Get the variable fields referenced by the expression.
1365
+ * @returns An array of referenced variable fields.
1366
+ */
908
1367
  getRefFields(): BaseVariableField[];
1368
+ /**
1369
+ * The return type of the expression.
1370
+ *
1371
+ * A new `returnType` node is generated directly, instead of reusing the existing one, to ensure that different key paths do not point to the same field.
1372
+ */
909
1373
  _returnType: BaseType;
1374
+ /**
1375
+ * The return type of the expression.
1376
+ */
910
1377
  get returnType(): BaseType<any, any>;
911
1378
  /**
912
- * 业务重改该方法可快速定制自己的 Path 表达式
913
- * - 只需要将业务的 Path 解析为变量系统的 KeyPath 即可
914
- * @param json 业务定义的 Path 表达式
915
- * @returns
1379
+ * Parse the business-defined path expression into a key path.
1380
+ *
1381
+ * Businesses can quickly customize their own path expressions by modifying this method.
1382
+ * @param json The path expression defined by the business.
1383
+ * @returns The key path.
916
1384
  */
917
1385
  protected parseToKeyPath(json: CustomPathJSON): string[];
1386
+ /**
1387
+ * Deserializes the `KeyPathExpressionJSON` to the `KeyPathExpression`.
1388
+ * @param json The `KeyPathExpressionJSON` to deserialize.
1389
+ */
918
1390
  fromJSON(json: CustomPathJSON): void;
1391
+ /**
1392
+ * Get the return type JSON by reference.
1393
+ * @param _ref The referenced variable field.
1394
+ * @returns The JSON representation of the return type.
1395
+ */
919
1396
  getReturnTypeJSONByRef(_ref: BaseVariableField | undefined): ASTNodeJSON | undefined;
920
1397
  protected prevRefTypeHash: string | undefined;
921
1398
  constructor(params: CreateASTParams, opts: any);
1399
+ /**
1400
+ * Serialize the `KeyPathExpression` to `KeyPathExpressionJSON`.
1401
+ * @returns The JSON representation of `KeyPathExpression`.
1402
+ */
922
1403
  toJSON(): ASTNodeJSON;
923
1404
  }
924
1405
 
@@ -927,70 +1408,209 @@ declare class KeyPathExpressionV2<CustomPathJSON extends ASTNodeJSON = KeyPathEx
927
1408
  * SPDX-License-Identifier: MIT
928
1409
  */
929
1410
 
1411
+ /**
1412
+ * ASTNodeJSON representation of `KeyPathExpression`
1413
+ */
1414
+ interface KeyPathExpressionJSON {
1415
+ /**
1416
+ * The key path of the variable.
1417
+ */
1418
+ keyPath: string[];
1419
+ }
1420
+ /**
1421
+ * @deprecated Use `KeyPathExpression` instead.
1422
+ * Represents a key path expression, which is used to reference a variable by its key path.
1423
+ */
1424
+ declare class LegacyKeyPathExpression<CustomPathJSON extends ASTNodeJSON = KeyPathExpressionJSON> extends BaseExpression<CustomPathJSON> {
1425
+ static kind: string;
1426
+ protected _keyPath: string[];
1427
+ /**
1428
+ * The key path of the variable.
1429
+ */
1430
+ get keyPath(): string[];
1431
+ /**
1432
+ * Get the variable fields referenced by the expression.
1433
+ * @returns An array of referenced variable fields.
1434
+ */
1435
+ getRefFields(): BaseVariableField[];
1436
+ /**
1437
+ * The return type of the expression.
1438
+ */
1439
+ get returnType(): BaseType | undefined;
1440
+ /**
1441
+ * Parse the business-defined path expression into a key path.
1442
+ *
1443
+ * Businesses can quickly customize their own path expressions by modifying this method.
1444
+ * @param json The path expression defined by the business.
1445
+ * @returns The key path.
1446
+ */
1447
+ protected parseToKeyPath(json: CustomPathJSON): string[];
1448
+ /**
1449
+ * Deserializes the `KeyPathExpressionJSON` to the `KeyPathExpression`.
1450
+ * @param json The `KeyPathExpressionJSON` to deserialize.
1451
+ */
1452
+ fromJSON(json: CustomPathJSON): void;
1453
+ constructor(params: CreateASTParams, opts: any);
1454
+ /**
1455
+ * Serialize the `KeyPathExpression` to `KeyPathExpressionJSON`.
1456
+ * @returns The JSON representation of `KeyPathExpression`.
1457
+ */
1458
+ toJSON(): ASTNodeJSON;
1459
+ }
1460
+
1461
+ /**
1462
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
1463
+ * SPDX-License-Identifier: MIT
1464
+ */
1465
+
1466
+ /**
1467
+ * ASTNodeJSON representation of `WrapArrayExpression`
1468
+ */
930
1469
  interface WrapArrayExpressionJSON {
1470
+ /**
1471
+ * The expression to be wrapped.
1472
+ */
931
1473
  wrapFor: ASTNodeJSON;
932
1474
  }
933
1475
  /**
934
- * 遍历表达式,对列表进行遍历,获取遍历后的变量类型
1476
+ * Represents a wrap expression, which wraps an expression with an array.
935
1477
  */
936
1478
  declare class WrapArrayExpression extends BaseExpression<WrapArrayExpressionJSON> {
937
1479
  static kind: string;
938
1480
  protected _wrapFor: BaseExpression | undefined;
939
1481
  protected _returnType: BaseType | undefined;
1482
+ /**
1483
+ * The expression to be wrapped.
1484
+ */
940
1485
  get wrapFor(): BaseExpression<any, any> | undefined;
1486
+ /**
1487
+ * The return type of the expression.
1488
+ */
941
1489
  get returnType(): BaseType | undefined;
1490
+ /**
1491
+ * Refresh the return type of the expression.
1492
+ */
942
1493
  refreshReturnType(): void;
1494
+ /**
1495
+ * Get the variable fields referenced by the expression.
1496
+ * @returns An empty array, as this expression does not reference any variables.
1497
+ */
943
1498
  getRefFields(): [];
1499
+ /**
1500
+ * Deserializes the `WrapArrayExpressionJSON` to the `WrapArrayExpression`.
1501
+ * @param json The `WrapArrayExpressionJSON` to deserialize.
1502
+ */
944
1503
  fromJSON({ wrapFor: expression }: WrapArrayExpressionJSON): void;
1504
+ /**
1505
+ * Serialize the `WrapArrayExpression` to `WrapArrayExpressionJSON`.
1506
+ * @returns The JSON representation of `WrapArrayExpression`.
1507
+ */
945
1508
  toJSON(): ASTNodeJSON;
946
1509
  protected init(): void;
947
1510
  }
948
1511
 
949
1512
  /**
950
- * 声明类 AST 节点
1513
+ * ASTNodeJSON representation of `BaseVariableField`
951
1514
  */
952
1515
  type BaseVariableFieldJSON<VariableMeta = any> = {
1516
+ /**
1517
+ * key of the variable field
1518
+ * - For `VariableDeclaration`, the key should be global unique.
1519
+ * - For `Property`, the key is the property name.
1520
+ */
953
1521
  key?: Identifier;
1522
+ /**
1523
+ * type of the variable field, similar to js code:
1524
+ * `const v: string`
1525
+ */
954
1526
  type?: ASTNodeJSONOrKind;
1527
+ /**
1528
+ * initializer of the variable field, similar to js code:
1529
+ * `const v = 'hello'`
1530
+ *
1531
+ * with initializer, the type of field will be inferred from the initializer.
1532
+ */
955
1533
  initializer?: ASTNodeJSON;
1534
+ /**
1535
+ * meta data of the variable field, you cans store information like `title`, `icon`, etc.
1536
+ */
956
1537
  meta?: VariableMeta;
957
1538
  };
1539
+ /**
1540
+ * Variable Field abstract class, which is the base class for `VariableDeclaration` and `Property`
1541
+ *
1542
+ * - `VariableDeclaration` is used to declare a variable in a block scope.
1543
+ * - `Property` is used to declare a property in an object.
1544
+ */
958
1545
  declare abstract class BaseVariableField<VariableMeta = any> extends ASTNode<BaseVariableFieldJSON<VariableMeta>> {
959
1546
  flags: ASTNodeFlags;
960
1547
  protected _type?: BaseType;
961
1548
  protected _meta: VariableMeta;
962
1549
  protected _initializer?: BaseExpression;
963
1550
  /**
964
- * 父变量字段,通过由近而远的方式进行排序
1551
+ * Parent variable fields, sorted from closest to farthest
965
1552
  */
966
1553
  get parentFields(): BaseVariableField[];
1554
+ /**
1555
+ * KeyPath of the variable field, sorted from farthest to closest
1556
+ */
967
1557
  get keyPath(): string[];
1558
+ /**
1559
+ * Metadata of the variable field, you cans store information like `title`, `icon`, etc.
1560
+ */
968
1561
  get meta(): VariableMeta;
1562
+ /**
1563
+ * Type of the variable field, similar to js code:
1564
+ * `const v: string`
1565
+ */
969
1566
  get type(): BaseType;
1567
+ /**
1568
+ * Initializer of the variable field, similar to js code:
1569
+ * `const v = 'hello'`
1570
+ *
1571
+ * with initializer, the type of field will be inferred from the initializer.
1572
+ */
970
1573
  get initializer(): BaseExpression | undefined;
1574
+ /**
1575
+ * The global unique hash of the field, and will be changed when the field is updated.
1576
+ */
971
1577
  get hash(): string;
972
1578
  /**
973
- * 解析 VariableDeclarationJSON 从而生成变量声明节点
1579
+ * Deserialize the `BaseVariableFieldJSON` to the `BaseVariableField`.
1580
+ * @param json ASTJSON representation of `BaseVariableField`
974
1581
  */
975
1582
  fromJSON({ type, initializer, meta }: BaseVariableFieldJSON<VariableMeta>): void;
1583
+ /**
1584
+ * Update the type of the variable field
1585
+ * @param type type ASTJSON representation of Type
1586
+ */
976
1587
  updateType(type: BaseVariableFieldJSON['type']): void;
1588
+ /**
1589
+ * Update the initializer of the variable field
1590
+ * @param nextInitializer initializer ASTJSON representation of Expression
1591
+ */
977
1592
  updateInitializer(nextInitializer?: BaseVariableFieldJSON['initializer']): void;
1593
+ /**
1594
+ * Update the meta data of the variable field
1595
+ * @param nextMeta meta data of the variable field
1596
+ */
978
1597
  updateMeta(nextMeta: VariableMeta): void;
979
1598
  /**
980
- * 根据 keyPath 去找下钻的变量字段
1599
+ * Get the variable field by keyPath, similar to js code:
1600
+ * `v.a.b`
981
1601
  * @param keyPath
982
1602
  * @returns
983
1603
  */
984
1604
  getByKeyPath(keyPath: string[]): BaseVariableField | undefined;
985
1605
  /**
986
- * 监听类型变化
1606
+ * Subscribe to type change of the variable field
987
1607
  * @param observer
988
1608
  * @returns
989
1609
  */
990
1610
  onTypeChange(observer: (type: ASTNode | undefined) => void): _flowgram_ai_utils.Disposable;
991
1611
  /**
992
- * 转换为 JSON
993
- * @returns
1612
+ * Serialize the variable field to JSON
1613
+ * @returns ASTNodeJSON representation of `BaseVariableField`
994
1614
  */
995
1615
  toJSON(): BaseVariableFieldJSON<VariableMeta> & {
996
1616
  kind: string;
@@ -998,22 +1618,39 @@ declare abstract class BaseVariableField<VariableMeta = any> extends ASTNode<Bas
998
1618
  }
999
1619
 
1000
1620
  /**
1001
- * 声明类 AST 节点
1621
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
1622
+ * SPDX-License-Identifier: MIT
1623
+ */
1624
+
1625
+ /**
1626
+ * ASTNodeJSON representation of the `VariableDeclaration`.
1002
1627
  */
1003
1628
  type VariableDeclarationJSON<VariableMeta = any> = BaseVariableFieldJSON<VariableMeta> & {
1629
+ /**
1630
+ * Variable sorting order, which is used to sort variables in `scope.outputs.variables`
1631
+ */
1004
1632
  order?: number;
1005
1633
  };
1634
+ /**
1635
+ * `VariableDeclaration` is a variable field that represents a variable declaration.
1636
+ */
1006
1637
  declare class VariableDeclaration<VariableMeta = any> extends BaseVariableField<VariableMeta> {
1007
1638
  static kind: string;
1008
1639
  protected _order: number;
1640
+ /**
1641
+ * Variable sorting order, which is used to sort variables in `scope.outputs.variables`
1642
+ */
1009
1643
  get order(): number;
1010
1644
  constructor(params: CreateASTParams);
1011
1645
  /**
1012
- * 解析 VariableDeclarationJSON 从而生成变量声明节点
1646
+ * Deserialize the `VariableDeclarationJSON` to the `VariableDeclaration`.
1013
1647
  */
1014
1648
  fromJSON({ order, ...rest }: VariableDeclarationJSON<VariableMeta>): void;
1649
+ /**
1650
+ * Update the sorting order of the variable declaration.
1651
+ * @param order Variable sorting order. Default is 0.
1652
+ */
1015
1653
  updateOrder(order?: number): void;
1016
- onTypeChange(observer: (type: ASTNode | undefined) => void): _flowgram_ai_utils.Disposable;
1017
1654
  }
1018
1655
 
1019
1656
  /**
@@ -1023,9 +1660,12 @@ declare class VariableDeclaration<VariableMeta = any> extends BaseVariableField<
1023
1660
 
1024
1661
  interface VariableDeclarationListJSON<VariableMeta = any> {
1025
1662
  /**
1026
- * declarations 一定是 VariableDeclaration 类型,因此业务可以不用填 kind
1663
+ * `declarations` must be of type `VariableDeclaration`, so the business can omit the `kind` field.
1027
1664
  */
1028
1665
  declarations?: VariableDeclarationJSON<VariableMeta>[];
1666
+ /**
1667
+ * The starting order number for variables.
1668
+ */
1029
1669
  startOrder?: number;
1030
1670
  }
1031
1671
  type VariableDeclarationListChangeAction = GlobalEventActionType<'VariableListChange', {
@@ -1034,53 +1674,102 @@ type VariableDeclarationListChangeAction = GlobalEventActionType<'VariableListCh
1034
1674
  }, VariableDeclarationList>;
1035
1675
  declare class VariableDeclarationList extends ASTNode<VariableDeclarationListJSON> {
1036
1676
  static kind: string;
1677
+ /**
1678
+ * Map of variable declarations, keyed by variable name.
1679
+ */
1037
1680
  declarationTable: Map<string, VariableDeclaration>;
1681
+ /**
1682
+ * Variable declarations, sorted by `order`.
1683
+ */
1038
1684
  declarations: VariableDeclaration[];
1685
+ /**
1686
+ * Deserialize the `VariableDeclarationListJSON` to the `VariableDeclarationList`.
1687
+ * - VariableDeclarationListChangeAction will be dispatched after deserialization.
1688
+ *
1689
+ * @param declarations Variable declarations.
1690
+ * @param startOrder The starting order number for variables. Default is 0.
1691
+ */
1039
1692
  fromJSON({ declarations, startOrder }: VariableDeclarationListJSON): void;
1693
+ /**
1694
+ * Serialize the `VariableDeclarationList` to the `VariableDeclarationListJSON`.
1695
+ * @returns ASTJSON representation of `VariableDeclarationList`
1696
+ */
1040
1697
  toJSON(): ASTNodeJSON;
1041
1698
  }
1042
1699
 
1700
+ /**
1701
+ * Variable-core ASTNode factories.
1702
+ */
1043
1703
  declare namespace ASTFactory {
1044
1704
  /**
1045
- * 类型相关
1046
- * @returns
1705
+ * Type-related factories.
1706
+ */
1707
+ /**
1708
+ * Creates a `String` type node.
1047
1709
  */
1048
1710
  const createString: (json?: StringJSON) => {
1049
1711
  format?: string;
1050
1712
  kind: ASTKind;
1051
1713
  };
1714
+ /**
1715
+ * Creates a `Number` type node.
1716
+ */
1052
1717
  const createNumber: () => {
1053
1718
  kind: ASTKind;
1054
1719
  };
1720
+ /**
1721
+ * Creates a `Boolean` type node.
1722
+ */
1055
1723
  const createBoolean: () => {
1056
1724
  kind: ASTKind;
1057
1725
  };
1726
+ /**
1727
+ * Creates an `Integer` type node.
1728
+ */
1058
1729
  const createInteger: () => {
1059
1730
  kind: ASTKind;
1060
1731
  };
1732
+ /**
1733
+ * Creates an `Object` type node.
1734
+ */
1061
1735
  const createObject: (json: ObjectJSON) => {
1062
1736
  properties?: PropertyJSON<any>[] | undefined;
1063
1737
  kind: ASTKind;
1064
1738
  };
1739
+ /**
1740
+ * Creates an `Array` type node.
1741
+ */
1065
1742
  const createArray: (json: ArrayJSON) => {
1066
1743
  items?: ASTNodeJSONOrKind;
1067
1744
  kind: ASTKind;
1068
1745
  };
1746
+ /**
1747
+ * Creates a `Map` type node.
1748
+ */
1069
1749
  const createMap: (json: MapJSON) => {
1070
1750
  keyType?: ASTNodeJSONOrKind;
1071
1751
  valueType?: ASTNodeJSONOrKind;
1072
1752
  kind: ASTKind;
1073
1753
  };
1754
+ /**
1755
+ * Creates a `Union` type node.
1756
+ */
1074
1757
  const createUnion: (json: UnionJSON) => {
1075
1758
  types?: ASTNodeJSONOrKind[];
1076
1759
  kind: ASTKind;
1077
1760
  };
1761
+ /**
1762
+ * Creates a `CustomType` node.
1763
+ */
1078
1764
  const createCustomType: (json: CustomTypeJSON) => {
1079
1765
  typeName: string;
1080
1766
  kind: ASTKind;
1081
1767
  };
1082
1768
  /**
1083
- * 声明相关
1769
+ * Declaration-related factories.
1770
+ */
1771
+ /**
1772
+ * Creates a `VariableDeclaration` node.
1084
1773
  */
1085
1774
  const createVariableDeclaration: <VariableMeta = any>(json: VariableDeclarationJSON<VariableMeta>) => {
1086
1775
  key?: Identifier;
@@ -1090,6 +1779,9 @@ declare namespace ASTFactory {
1090
1779
  order?: number;
1091
1780
  kind: ASTKind;
1092
1781
  };
1782
+ /**
1783
+ * Creates a `Property` node.
1784
+ */
1093
1785
  const createProperty: <VariableMeta = any>(json: PropertyJSON<VariableMeta>) => {
1094
1786
  key: Identifier;
1095
1787
  type?: ASTNodeJSONOrKind;
@@ -1097,28 +1789,47 @@ declare namespace ASTFactory {
1097
1789
  meta?: VariableMeta | undefined;
1098
1790
  kind: ASTKind;
1099
1791
  };
1792
+ /**
1793
+ * Creates a `VariableDeclarationList` node.
1794
+ */
1100
1795
  const createVariableDeclarationList: (json: VariableDeclarationListJSON) => {
1101
1796
  declarations?: VariableDeclarationJSON<any>[] | undefined;
1102
1797
  startOrder?: number;
1103
1798
  kind: ASTKind;
1104
1799
  };
1105
1800
  /**
1106
- * 表达式相关
1801
+ * Expression-related factories.
1802
+ */
1803
+ /**
1804
+ * Creates an `EnumerateExpression` node.
1107
1805
  */
1108
1806
  const createEnumerateExpression: (json: EnumerateExpressionJSON) => {
1109
1807
  enumerateFor: ASTNodeJSON;
1110
1808
  kind: ASTKind;
1111
1809
  };
1810
+ /**
1811
+ * Creates a `KeyPathExpression` node.
1812
+ */
1112
1813
  const createKeyPathExpression: (json: KeyPathExpressionJSON$1) => {
1113
1814
  keyPath: string[];
1114
1815
  kind: ASTKind;
1115
1816
  };
1817
+ /**
1818
+ * Creates a `WrapArrayExpression` node.
1819
+ */
1116
1820
  const createWrapArrayExpression: (json: WrapArrayExpressionJSON) => {
1117
1821
  wrapFor: ASTNodeJSON;
1118
1822
  kind: ASTKind;
1119
1823
  };
1120
1824
  /**
1121
- * 通过 AST Class 创建
1825
+ * Create by AST Class.
1826
+ */
1827
+ /**
1828
+ * Creates Type-Safe ASTNodeJSON object based on the provided AST class.
1829
+ *
1830
+ * @param targetType Target ASTNode class.
1831
+ * @param json The JSON data for the node.
1832
+ * @returns The ASTNode JSON object.
1122
1833
  */
1123
1834
  const create: <JSON extends ASTNodeJSON>(targetType: {
1124
1835
  kind: string;
@@ -1133,32 +1844,87 @@ declare namespace ASTFactory {
1133
1844
  * SPDX-License-Identifier: MIT
1134
1845
  */
1135
1846
 
1847
+ /**
1848
+ * Variable-core ASTNode matchers.
1849
+ *
1850
+ * - Typescript code inside if statement will be type guarded.
1851
+ */
1136
1852
  declare namespace ASTMatch {
1137
1853
  /**
1138
- * 类型相关
1139
- * @returns
1854
+ * # Type-related matchers.
1855
+ */
1856
+ /**
1857
+ * Check if the node is a `StringType`.
1140
1858
  */
1141
1859
  const isString: (node?: ASTNode) => node is StringType;
1860
+ /**
1861
+ * Check if the node is a `NumberType`.
1862
+ */
1142
1863
  const isNumber: (node?: ASTNode) => node is NumberType;
1864
+ /**
1865
+ * Check if the node is a `BooleanType`.
1866
+ */
1143
1867
  const isBoolean: (node?: ASTNode) => node is BooleanType;
1868
+ /**
1869
+ * Check if the node is a `IntegerType`.
1870
+ */
1144
1871
  const isInteger: (node?: ASTNode) => node is IntegerType;
1872
+ /**
1873
+ * Check if the node is a `ObjectType`.
1874
+ */
1145
1875
  const isObject: (node?: ASTNode) => node is ObjectType;
1876
+ /**
1877
+ * Check if the node is a `ArrayType`.
1878
+ */
1146
1879
  const isArray: (node?: ASTNode) => node is ArrayType;
1880
+ /**
1881
+ * Check if the node is a `MapType`.
1882
+ */
1147
1883
  const isMap: (node?: ASTNode) => node is MapType;
1884
+ /**
1885
+ * Check if the node is a `CustomType`.
1886
+ */
1148
1887
  const isCustomType: (node?: ASTNode) => node is CustomType;
1149
1888
  /**
1150
- * 声明相关
1889
+ * # Declaration-related matchers.
1890
+ */
1891
+ /**
1892
+ * Check if the node is a `VariableDeclaration`.
1151
1893
  */
1152
1894
  const isVariableDeclaration: <VariableMeta = any>(node?: ASTNode) => node is VariableDeclaration<VariableMeta>;
1895
+ /**
1896
+ * Check if the node is a `Property`.
1897
+ */
1153
1898
  const isProperty: <VariableMeta = any>(node?: ASTNode) => node is Property<VariableMeta>;
1899
+ /**
1900
+ * Check if the node is a `BaseVariableField`.
1901
+ */
1902
+ const isBaseVariableField: (node?: ASTNode) => node is BaseVariableField;
1903
+ /**
1904
+ * Check if the node is a `VariableDeclarationList`.
1905
+ */
1154
1906
  const isVariableDeclarationList: (node?: ASTNode) => node is VariableDeclarationList;
1155
1907
  /**
1156
- * 表达式相关
1908
+ * # Expression-related matchers.
1909
+ */
1910
+ /**
1911
+ * Check if the node is a `EnumerateExpression`.
1157
1912
  */
1158
1913
  const isEnumerateExpression: (node?: ASTNode) => node is EnumerateExpression;
1914
+ /**
1915
+ * Check if the node is a `WrapArrayExpression`.
1916
+ */
1917
+ const isWrapArrayExpression: (node?: ASTNode) => node is WrapArrayExpression;
1918
+ /**
1919
+ * Check if the node is a `KeyPathExpression`.
1920
+ */
1159
1921
  const isKeyPathExpression: (node?: ASTNode) => node is KeyPathExpression;
1160
1922
  /**
1161
- * Check AST Match by ASTClass
1923
+ * Check ASTNode Match by ASTClass
1924
+ *
1925
+ * @param node ASTNode to be checked.
1926
+ * @param targetType Target ASTNode class.
1927
+ * @returns Whether the node is of the target type.
1162
1928
  */
1163
1929
  function is<TargetASTNode extends ASTNode>(node?: ASTNode, targetType?: {
1164
1930
  kind: string;
@@ -1195,27 +1961,89 @@ declare function isMatchAST<TargetASTNode extends ASTNode>(node?: ASTNode, targe
1195
1961
  * SPDX-License-Identifier: MIT
1196
1962
  */
1197
1963
 
1964
+ /**
1965
+ * Action type for scope changes.
1966
+ */
1198
1967
  interface ScopeChangeAction {
1199
1968
  type: 'add' | 'delete' | 'update' | 'available';
1200
1969
  scope: Scope;
1201
1970
  }
1971
+ /**
1972
+ * Interface for a variable table.
1973
+ */
1202
1974
  interface IVariableTable extends Disposable {
1975
+ /**
1976
+ * The parent variable table.
1977
+ */
1203
1978
  parentTable?: IVariableTable;
1979
+ /**
1980
+ * @deprecated Use `onVariableListChange` or `onAnyVariableChange` instead.
1981
+ */
1204
1982
  onDataChange: Event<void>;
1983
+ /**
1984
+ * The current version of the variable table.
1985
+ */
1205
1986
  version: number;
1987
+ /**
1988
+ * The list of variables in the table.
1989
+ */
1206
1990
  variables: VariableDeclaration[];
1991
+ /**
1992
+ * The keys of the variables in the table.
1993
+ */
1207
1994
  variableKeys: string[];
1995
+ /**
1996
+ * Fires a change event.
1997
+ */
1208
1998
  fireChange(): void;
1999
+ /**
2000
+ * Gets a variable or property by its key path.
2001
+ * @param keyPath The key path to the variable or property.
2002
+ * @returns The found `BaseVariableField` or `undefined`.
2003
+ */
1209
2004
  getByKeyPath(keyPath: string[]): BaseVariableField | undefined;
2005
+ /**
2006
+ * Gets a variable by its key.
2007
+ * @param key The key of the variable.
2008
+ * @returns The found `VariableDeclaration` or `undefined`.
2009
+ */
1210
2010
  getVariableByKey(key: string): VariableDeclaration | undefined;
2011
+ /**
2012
+ * Disposes the variable table.
2013
+ */
1211
2014
  dispose(): void;
2015
+ /**
2016
+ * Subscribes to changes in the variable list.
2017
+ * @param observer The observer function.
2018
+ * @returns A disposable to unsubscribe.
2019
+ */
1212
2020
  onVariableListChange(observer: (variables: VariableDeclaration[]) => void): Disposable;
2021
+ /**
2022
+ * Subscribes to changes in any variable's value.
2023
+ * @param observer The observer function.
2024
+ * @returns A disposable to unsubscribe.
2025
+ */
1213
2026
  onAnyVariableChange(observer: (changedVariable: VariableDeclaration) => void): Disposable;
2027
+ /**
2028
+ * Subscribes to both variable list changes and any variable's value changes.
2029
+ * @param observer The observer function.
2030
+ * @returns A disposable to unsubscribe.
2031
+ */
1214
2032
  onListOrAnyVarChange(observer: () => void): Disposable;
1215
2033
  }
1216
2034
 
2035
+ /**
2036
+ * The core of the variable engine system.
2037
+ * It manages scopes, variables, and events within the system.
2038
+ */
1217
2039
  declare class VariableEngine implements Disposable {
2040
+ /**
2041
+ * The scope chain, which manages the dependency relationships between scopes.
2042
+ */
1218
2043
  readonly chain: ScopeChain;
2044
+ /**
2045
+ * The registry for all AST node types.
2046
+ */
1219
2047
  readonly astRegisters: ASTRegisters;
1220
2048
  protected toDispose: DisposableCollection;
1221
2049
  protected memo: {
@@ -1223,40 +2051,113 @@ declare class VariableEngine implements Disposable {
1223
2051
  clear: (key?: string | symbol) => void;
1224
2052
  };
1225
2053
  protected scopeMap: Map<string | symbol, Scope<Record<string, any>>>;
2054
+ /**
2055
+ * A rxjs subject that emits global events occurring within the variable engine.
2056
+ */
1226
2057
  globalEvent$: Subject<GlobalEventActionType>;
1227
2058
  protected onScopeChangeEmitter: Emitter<ScopeChangeAction>;
2059
+ /**
2060
+ * A table containing all global variables.
2061
+ */
1228
2062
  globalVariableTable: IVariableTable;
2063
+ /**
2064
+ * An event that fires whenever a scope is added, updated, or deleted.
2065
+ */
1229
2066
  onScopeChange: _flowgram_ai_utils.Event<ScopeChangeAction>;
1230
2067
  private readonly containerProvider;
2068
+ /**
2069
+ * The Inversify container instance.
2070
+ */
1231
2071
  get container(): interfaces.Container;
1232
- constructor(chain: ScopeChain, // 作用域依赖关系偏序集
2072
+ constructor(
2073
+ /**
2074
+ * The scope chain, which manages the dependency relationships between scopes.
2075
+ */
2076
+ chain: ScopeChain,
2077
+ /**
2078
+ * The registry for all AST node types.
2079
+ */
1233
2080
  astRegisters: ASTRegisters);
2081
+ /**
2082
+ * Disposes of all resources used by the variable engine.
2083
+ */
1234
2084
  dispose(): void;
2085
+ /**
2086
+ * Retrieves a scope by its unique identifier.
2087
+ * @param scopeId The ID of the scope to retrieve.
2088
+ * @returns The scope if found, otherwise undefined.
2089
+ */
1235
2090
  getScopeById(scopeId: string | symbol): Scope | undefined;
2091
+ /**
2092
+ * Removes a scope by its unique identifier and disposes of it.
2093
+ * @param scopeId The ID of the scope to remove.
2094
+ */
1236
2095
  removeScopeById(scopeId: string | symbol): void;
1237
2096
  /**
1238
- * Get Scope, if Scope exists and type is same, will use it directly
1239
- * @param id scope id
1240
- * @param meta scope meta, defined by user
1241
- * @param ScopeConstructor scope constructor, default is Scope. you can extends Scope to create your own scope
1242
- * @returns
2097
+ * Creates a new scope or retrieves an existing one if the ID and type match.
2098
+ * @param id The unique identifier for the scope.
2099
+ * @param meta Optional metadata for the scope, defined by the user.
2100
+ * @param options Options for creating the scope.
2101
+ * @param options.ScopeConstructor The constructor to use for creating the scope. Defaults to `Scope`.
2102
+ * @returns The created or existing scope.
1243
2103
  */
1244
2104
  createScope(id: string | symbol, meta?: Record<string, any>, options?: {
1245
2105
  ScopeConstructor?: IScopeConstructor;
1246
2106
  }): Scope;
2107
+ /**
2108
+ * Retrieves all scopes currently managed by the engine.
2109
+ * @param options Options for retrieving the scopes.
2110
+ * @param options.sort Whether to sort the scopes based on their dependency chain.
2111
+ * @returns An array of all scopes.
2112
+ */
1247
2113
  getAllScopes({ sort, }?: {
1248
2114
  sort?: boolean;
1249
2115
  }): Scope[];
2116
+ /**
2117
+ * Fires a global event to be broadcast to all listeners.
2118
+ * @param event The global event to fire.
2119
+ */
1250
2120
  fireGlobalEvent(event: GlobalEventActionType): void;
2121
+ /**
2122
+ * Subscribes to a specific type of global event.
2123
+ * @param type The type of the event to listen for.
2124
+ * @param observer A function to be called when the event is observed.
2125
+ * @returns A disposable object to unsubscribe from the event.
2126
+ */
1251
2127
  onGlobalEvent<ActionType extends GlobalEventActionType = GlobalEventActionType>(type: ActionType['type'], observer: (action: ActionType) => void): Disposable;
1252
2128
  }
1253
2129
 
2130
+ /**
2131
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
2132
+ * SPDX-License-Identifier: MIT
2133
+ */
2134
+
1254
2135
  interface ScopeContextProps {
1255
2136
  scope: Scope;
1256
2137
  }
1257
- declare const ScopeProvider: react.Provider<ScopeContextProps>;
1258
- declare const useScopeContext: () => ScopeContextProps | null;
1259
- declare const useCurrentScope: () => Scope<Record<string, any>>;
2138
+ /**
2139
+ * ScopeProvider provides the scope to its children via context.
2140
+ */
2141
+ declare const ScopeProvider: (props: React.PropsWithChildren<{
2142
+ /**
2143
+ * scope used in the context
2144
+ */
2145
+ scope?: Scope;
2146
+ /**
2147
+ * @deprecated use scope prop instead, this is kept for backward compatibility
2148
+ */
2149
+ value?: ScopeContextProps;
2150
+ }>) => React.JSX.Element;
2151
+ /**
2152
+ * useCurrentScope returns the scope provided by ScopeProvider.
2153
+ * @returns
2154
+ */
2155
+ declare const useCurrentScope: (params?: {
2156
+ /**
2157
+ * whether to throw error when no scope in ScopeProvider is found
2158
+ */
2159
+ strict?: boolean;
2160
+ }) => Scope;
1260
2161
 
1261
2162
  /**
1262
2163
  * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
@@ -1264,9 +2165,14 @@ declare const useCurrentScope: () => Scope<Record<string, any>>;
1264
2165
  */
1265
2166
 
1266
2167
  /**
2168
+ * Get the available variables in the current scope.
1267
2169
  * 获取作用域的可访问变量
2170
+ *
2171
+ * @returns the available variables in the current scope
1268
2172
  */
1269
- declare function useScopeAvailable(): ScopeAvailableData;
2173
+ declare function useScopeAvailable(params?: {
2174
+ autoRefresh?: boolean;
2175
+ }): ScopeAvailableData;
1270
2176
 
1271
2177
  /**
1272
2178
  * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
@@ -1274,25 +2180,66 @@ declare function useScopeAvailable(): ScopeAvailableData;
1274
2180
  */
1275
2181
 
1276
2182
  /**
1277
- * 获取作用域的可访问变量
2183
+ * Get available variable list in the current scope.
2184
+ *
2185
+ * - If no scope, return global variable list.
2186
+ * - The hook is reactive to variable list or any variables change.
1278
2187
  */
1279
2188
  declare function useAvailableVariables(): VariableDeclaration[];
1280
2189
 
2190
+ /**
2191
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
2192
+ * SPDX-License-Identifier: MIT
2193
+ */
2194
+
2195
+ /**
2196
+ * Get output variable list in the current scope.
2197
+ *
2198
+ * - The hook is reactive to variable list or any variables change.
2199
+ */
2200
+ declare function useOutputVariables(): VariableDeclaration[];
2201
+
1281
2202
  interface RenameInfo {
1282
2203
  before: BaseVariableField;
1283
2204
  after: BaseVariableField;
1284
2205
  }
2206
+ /**
2207
+ * This service is responsible for detecting when a variable field's key is renamed.
2208
+ * It listens for changes in variable declaration lists and object properties, and
2209
+ * determines if a change constitutes a rename operation.
2210
+ */
1285
2211
  declare class VariableFieldKeyRenameService {
1286
2212
  variableEngine: VariableEngine;
1287
2213
  toDispose: DisposableCollection;
1288
2214
  renameEmitter: Emitter<RenameInfo>;
2215
+ /**
2216
+ * Emits events for fields that are disposed of during a list change, but not renamed.
2217
+ * This helps distinguish between a field that was truly removed and one that was renamed.
2218
+ */
1289
2219
  disposeInListEmitter: Emitter<BaseVariableField<any>>;
2220
+ /**
2221
+ * An event that fires when a variable field key is successfully renamed.
2222
+ */
1290
2223
  onRename: _flowgram_ai_utils.Event<RenameInfo>;
2224
+ /**
2225
+ * An event that fires when a field is removed from a list (and not part of a rename).
2226
+ */
1291
2227
  onDisposeInList: _flowgram_ai_utils.Event<BaseVariableField<any>>;
2228
+ /**
2229
+ * Handles changes in a list of fields to detect rename operations.
2230
+ * @param ast The AST node where the change occurred.
2231
+ * @param prev The list of fields before the change.
2232
+ * @param next The list of fields after the change.
2233
+ */
1292
2234
  handleFieldListChange(ast?: ASTNode, prev?: BaseVariableField[], next?: BaseVariableField[]): void;
2235
+ /**
2236
+ * Notifies listeners about fields that were removed from a list.
2237
+ * @param prev The list of fields before the change.
2238
+ * @param next The list of fields after the change.
2239
+ */
1293
2240
  notifyFieldsDispose(prev?: BaseVariableField[], next?: BaseVariableField[]): void;
1294
2241
  init(): void;
1295
2242
  dispose(): void;
1296
2243
  }
1297
2244
 
1298
- export { ASTFactory, ASTKind, ASTMatch, ASTNode, ASTNodeFlags, type ASTNodeJSON, type ASTNodeRegistry, ASTRegisters, ArrayType, BaseExpression, BaseType, BaseVariableField, BooleanType, type CreateASTParams, CustomType, type CustomTypeJSON, DataNode, EnumerateExpression, type EnumerateExpressionJSON, type GetKindJSON, type GetKindJSONOrKind, type GlobalEventActionType, type IVariableTable, IntegerType, KeyPathExpression, type KeyPathExpressionJSON$1 as KeyPathExpressionJSON, KeyPathExpressionV2, ListNode, type ListNodeJSON, MapNode, type MapNodeJSON, MapType, NumberType, type ObjectJSON, type ObjectPropertiesChangeAction, ObjectType, Property, type PropertyJSON, Scope, ScopeChain, ScopeOutputData, ScopeProvider, StringType, type UnionJSON, VariableContainerModule, VariableDeclaration, type VariableDeclarationJSON, VariableDeclarationList, type VariableDeclarationListChangeAction, type VariableDeclarationListJSON, VariableEngine, VariableEngineProvider, VariableFieldKeyRenameService, WrapArrayExpression, type WrapArrayExpressionJSON, injectToAST, isMatchAST, postConstructAST, useAvailableVariables, useCurrentScope, useScopeAvailable, useScopeContext };
2245
+ export { ASTFactory, ASTKind, ASTMatch, ASTNode, ASTNodeFlags, type ASTNodeJSON, type ASTNodeRegistry, ASTRegisters, ArrayType, BaseExpression, BaseType, BaseVariableField, BooleanType, type CreateASTParams, CustomType, type CustomTypeJSON, DataNode, EnumerateExpression, type EnumerateExpressionJSON, type GetKindJSON, type GetKindJSONOrKind, type GlobalEventActionType, type IVariableTable, IntegerType, KeyPathExpression, type KeyPathExpressionJSON$1 as KeyPathExpressionJSON, LegacyKeyPathExpression, ListNode, type ListNodeJSON, MapNode, type MapNodeJSON, MapType, NumberType, type ObjectJSON, type ObjectPropertiesChangeAction, ObjectType, Property, type PropertyJSON, Scope, ScopeChain, ScopeOutputData, ScopeProvider, StringType, type UnionJSON, VariableContainerModule, VariableDeclaration, type VariableDeclarationJSON, VariableDeclarationList, type VariableDeclarationListChangeAction, type VariableDeclarationListJSON, VariableEngine, VariableEngineProvider, VariableFieldKeyRenameService, WrapArrayExpression, type WrapArrayExpressionJSON, injectToAST, isMatchAST, postConstructAST, useAvailableVariables, useCurrentScope, useOutputVariables, useScopeAvailable };