@flowgram.ai/variable-layout 0.2.14 → 0.2.15
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/esm/index.js +107 -64
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +25 -15
- package/dist/index.d.ts +25 -15
- package/dist/index.js +110 -69
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/dist/esm/index.js
CHANGED
|
@@ -127,19 +127,78 @@ var FlowNodeVariableData = class extends EntityData {
|
|
|
127
127
|
FlowNodeVariableData.type = "FlowNodeVariableData";
|
|
128
128
|
|
|
129
129
|
// src/chains/free-layout-scope-chain.ts
|
|
130
|
-
import { inject, optional, postConstruct } from "inversify";
|
|
130
|
+
import { inject as inject2, optional as optional2, postConstruct } from "inversify";
|
|
131
131
|
import { ScopeChain } from "@flowgram.ai/variable-core";
|
|
132
132
|
import { WorkflowNodeLinesData } from "@flowgram.ai/free-layout-core";
|
|
133
|
-
import {
|
|
133
|
+
import {
|
|
134
|
+
FlowDocument as FlowDocument2,
|
|
135
|
+
FlowNodeBaseType
|
|
136
|
+
} from "@flowgram.ai/document";
|
|
134
137
|
import { EntityManager } from "@flowgram.ai/core";
|
|
135
138
|
|
|
136
139
|
// src/variable-layout-config.ts
|
|
137
140
|
var VariableLayoutConfig = Symbol("VariableLayoutConfig");
|
|
138
141
|
|
|
142
|
+
// src/services/scope-chain-transform-service.ts
|
|
143
|
+
import { inject, injectable, optional } from "inversify";
|
|
144
|
+
import { VariableEngine } from "@flowgram.ai/variable-core";
|
|
145
|
+
import { FlowDocument } from "@flowgram.ai/document";
|
|
146
|
+
import { lazyInject } from "@flowgram.ai/core";
|
|
147
|
+
var ScopeChainTransformService = class {
|
|
148
|
+
constructor(configs) {
|
|
149
|
+
this.configs = configs;
|
|
150
|
+
this.transformDepsFns = [];
|
|
151
|
+
this.transformCoversFns = [];
|
|
152
|
+
if (this.configs?.transformDeps) {
|
|
153
|
+
this.transformDepsFns.push(this.configs.transformDeps);
|
|
154
|
+
}
|
|
155
|
+
if (this.configs?.transformCovers) {
|
|
156
|
+
this.transformCoversFns.push(this.configs.transformCovers);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
registerTransformDeps(transformer) {
|
|
160
|
+
this.transformDepsFns.push(transformer);
|
|
161
|
+
}
|
|
162
|
+
registerTransformCovers(transformer) {
|
|
163
|
+
this.transformCoversFns.push(transformer);
|
|
164
|
+
}
|
|
165
|
+
transformDeps(scopes, { scope }) {
|
|
166
|
+
return this.transformDepsFns.reduce(
|
|
167
|
+
(scopes2, transformer) => transformer(scopes2, {
|
|
168
|
+
scope,
|
|
169
|
+
document: this.document,
|
|
170
|
+
variableEngine: this.variableEngine
|
|
171
|
+
}),
|
|
172
|
+
scopes
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
transformCovers(scopes, { scope }) {
|
|
176
|
+
return this.transformCoversFns.reduce(
|
|
177
|
+
(scopes2, transformer) => transformer(scopes2, {
|
|
178
|
+
scope,
|
|
179
|
+
document: this.document,
|
|
180
|
+
variableEngine: this.variableEngine
|
|
181
|
+
}),
|
|
182
|
+
scopes
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
__decorateClass([
|
|
187
|
+
lazyInject(FlowDocument)
|
|
188
|
+
], ScopeChainTransformService.prototype, "document", 2);
|
|
189
|
+
__decorateClass([
|
|
190
|
+
lazyInject(VariableEngine)
|
|
191
|
+
], ScopeChainTransformService.prototype, "variableEngine", 2);
|
|
192
|
+
ScopeChainTransformService = __decorateClass([
|
|
193
|
+
injectable(),
|
|
194
|
+
__decorateParam(0, optional()),
|
|
195
|
+
__decorateParam(0, inject(VariableLayoutConfig))
|
|
196
|
+
], ScopeChainTransformService);
|
|
197
|
+
|
|
139
198
|
// src/scopes/global-scope.ts
|
|
140
|
-
import { injectable } from "inversify";
|
|
141
|
-
import { Scope, VariableEngine } from "@flowgram.ai/variable-core";
|
|
142
|
-
var GlobalScope = class extends
|
|
199
|
+
import { injectable as injectable2 } from "inversify";
|
|
200
|
+
import { Scope as Scope2, VariableEngine as VariableEngine2 } from "@flowgram.ai/variable-core";
|
|
201
|
+
var GlobalScope = class extends Scope2 {
|
|
143
202
|
static is(scope) {
|
|
144
203
|
return scope.id === GlobalScope.ID;
|
|
145
204
|
}
|
|
@@ -173,11 +232,11 @@ var GlobalScope = class extends Scope {
|
|
|
173
232
|
};
|
|
174
233
|
GlobalScope.ID = Symbol("GlobalScope");
|
|
175
234
|
GlobalScope = __decorateClass([
|
|
176
|
-
|
|
235
|
+
injectable2()
|
|
177
236
|
], GlobalScope);
|
|
178
237
|
var bindGlobalScope = (bind) => {
|
|
179
238
|
bind(GlobalScope).toDynamicValue((ctx) => {
|
|
180
|
-
const variableEngine = ctx.container.get(
|
|
239
|
+
const variableEngine = ctx.container.get(VariableEngine2);
|
|
181
240
|
let scope = variableEngine.getScopeById(GlobalScope.ID);
|
|
182
241
|
if (!scope) {
|
|
183
242
|
scope = variableEngine.createScope(
|
|
@@ -212,20 +271,22 @@ var FreeLayoutScopeChain = class extends ScopeChain {
|
|
|
212
271
|
}
|
|
213
272
|
// 获取同一层级所有输入节点
|
|
214
273
|
getAllInputLayerNodes(curr) {
|
|
274
|
+
const currParent = this.getParent(curr);
|
|
215
275
|
return (curr.getData(WorkflowNodeLinesData)?.allInputNodes || []).filter(
|
|
216
|
-
(_node) => _node
|
|
276
|
+
(_node) => this.getParent(_node) === currParent
|
|
217
277
|
);
|
|
218
278
|
}
|
|
219
279
|
// 获取同一层级所有输出节点
|
|
220
280
|
getAllOutputLayerNodes(curr) {
|
|
281
|
+
const currParent = this.getParent(curr);
|
|
221
282
|
return (curr.getData(WorkflowNodeLinesData)?.allOutputNodes || []).filter(
|
|
222
|
-
(_node) => _node
|
|
283
|
+
(_node) => this.getParent(_node) === currParent
|
|
223
284
|
);
|
|
224
285
|
}
|
|
225
286
|
getDeps(scope) {
|
|
226
287
|
const { node } = scope.meta || {};
|
|
227
288
|
if (!node) {
|
|
228
|
-
return this.transformDeps([], { scope });
|
|
289
|
+
return this.transformService.transformDeps([], { scope });
|
|
229
290
|
}
|
|
230
291
|
const deps = [];
|
|
231
292
|
let curr = node;
|
|
@@ -245,7 +306,7 @@ var FreeLayoutScopeChain = class extends ScopeChain {
|
|
|
245
306
|
deps.unshift(globalScope);
|
|
246
307
|
}
|
|
247
308
|
const uniqDeps = Array.from(new Set(deps));
|
|
248
|
-
return this.transformDeps(uniqDeps, { scope });
|
|
309
|
+
return this.transformService.transformDeps(uniqDeps, { scope });
|
|
249
310
|
}
|
|
250
311
|
getCovers(scope) {
|
|
251
312
|
if (GlobalScope.is(scope)) {
|
|
@@ -253,7 +314,7 @@ var FreeLayoutScopeChain = class extends ScopeChain {
|
|
|
253
314
|
}
|
|
254
315
|
const { node } = scope.meta || {};
|
|
255
316
|
if (!node) {
|
|
256
|
-
return this.transformCovers([], { scope });
|
|
317
|
+
return this.transformService.transformCovers([], { scope });
|
|
257
318
|
}
|
|
258
319
|
const isPrivate = scope.meta.type === "private" /* private */;
|
|
259
320
|
const queue = [];
|
|
@@ -277,21 +338,7 @@ var FreeLayoutScopeChain = class extends ScopeChain {
|
|
|
277
338
|
scopes.push(currentVariableData.public);
|
|
278
339
|
}
|
|
279
340
|
const uniqScopes = Array.from(new Set(scopes));
|
|
280
|
-
return this.transformCovers(uniqScopes, { scope });
|
|
281
|
-
}
|
|
282
|
-
transformCovers(covers, { scope }) {
|
|
283
|
-
return this.configs?.transformCovers ? this.configs.transformCovers(covers, {
|
|
284
|
-
scope,
|
|
285
|
-
document: this.flowDocument,
|
|
286
|
-
variableEngine: this.variableEngine
|
|
287
|
-
}) : covers;
|
|
288
|
-
}
|
|
289
|
-
transformDeps(deps, { scope }) {
|
|
290
|
-
return this.configs?.transformDeps ? this.configs.transformDeps(deps, {
|
|
291
|
-
scope,
|
|
292
|
-
document: this.flowDocument,
|
|
293
|
-
variableEngine: this.variableEngine
|
|
294
|
-
}) : deps;
|
|
341
|
+
return this.transformService.transformCovers(uniqScopes, { scope });
|
|
295
342
|
}
|
|
296
343
|
getChildren(node) {
|
|
297
344
|
if (this.configs?.getFreeChildren) {
|
|
@@ -312,16 +359,19 @@ var FreeLayoutScopeChain = class extends ScopeChain {
|
|
|
312
359
|
if (this.configs?.getFreeParent) {
|
|
313
360
|
return this.configs.getFreeParent(node);
|
|
314
361
|
}
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
362
|
+
let parent = node.document.originTree.getParent(node);
|
|
363
|
+
while (parent?.flowNodeType === FlowNodeBaseType.GROUP) {
|
|
364
|
+
parent = parent.parent;
|
|
318
365
|
}
|
|
319
|
-
|
|
320
|
-
|
|
366
|
+
if (!parent) {
|
|
367
|
+
return parent;
|
|
368
|
+
}
|
|
369
|
+
const nodeMeta = parent.getNodeMeta();
|
|
370
|
+
const subCanvas = nodeMeta.subCanvas?.(parent);
|
|
321
371
|
if (subCanvas?.isCanvas) {
|
|
322
372
|
return subCanvas.parentNode;
|
|
323
373
|
}
|
|
324
|
-
return
|
|
374
|
+
return parent;
|
|
325
375
|
}
|
|
326
376
|
sortAll() {
|
|
327
377
|
console.warn("FreeLayoutScopeChain.sortAll is not implemented");
|
|
@@ -329,23 +379,26 @@ var FreeLayoutScopeChain = class extends ScopeChain {
|
|
|
329
379
|
}
|
|
330
380
|
};
|
|
331
381
|
__decorateClass([
|
|
332
|
-
|
|
382
|
+
inject2(EntityManager)
|
|
333
383
|
], FreeLayoutScopeChain.prototype, "entityManager", 2);
|
|
334
384
|
__decorateClass([
|
|
335
|
-
|
|
385
|
+
inject2(FlowDocument2)
|
|
336
386
|
], FreeLayoutScopeChain.prototype, "flowDocument", 2);
|
|
337
387
|
__decorateClass([
|
|
338
|
-
|
|
339
|
-
|
|
388
|
+
optional2(),
|
|
389
|
+
inject2(VariableLayoutConfig)
|
|
340
390
|
], FreeLayoutScopeChain.prototype, "configs", 2);
|
|
391
|
+
__decorateClass([
|
|
392
|
+
inject2(ScopeChainTransformService)
|
|
393
|
+
], FreeLayoutScopeChain.prototype, "transformService", 2);
|
|
341
394
|
__decorateClass([
|
|
342
395
|
postConstruct()
|
|
343
396
|
], FreeLayoutScopeChain.prototype, "onInit", 1);
|
|
344
397
|
|
|
345
398
|
// src/chains/fixed-layout-scope-chain.ts
|
|
346
|
-
import { inject as
|
|
399
|
+
import { inject as inject3, optional as optional3 } from "inversify";
|
|
347
400
|
import { ScopeChain as ScopeChain2 } from "@flowgram.ai/variable-core";
|
|
348
|
-
import { FlowDocument as
|
|
401
|
+
import { FlowDocument as FlowDocument3 } from "@flowgram.ai/document";
|
|
349
402
|
var FixedLayoutScopeChain = class extends ScopeChain2 {
|
|
350
403
|
constructor(flowDocument, configs) {
|
|
351
404
|
super();
|
|
@@ -366,11 +419,11 @@ var FixedLayoutScopeChain = class extends ScopeChain2 {
|
|
|
366
419
|
// 获取依赖作用域
|
|
367
420
|
getDeps(scope) {
|
|
368
421
|
if (!this.tree) {
|
|
369
|
-
return this.transformDeps([], { scope });
|
|
422
|
+
return this.transformService.transformDeps([], { scope });
|
|
370
423
|
}
|
|
371
424
|
const node = scope.meta.node;
|
|
372
425
|
if (!node) {
|
|
373
|
-
return this.transformDeps([], { scope });
|
|
426
|
+
return this.transformService.transformDeps([], { scope });
|
|
374
427
|
}
|
|
375
428
|
const deps = [];
|
|
376
429
|
let curr = node;
|
|
@@ -418,19 +471,19 @@ var FixedLayoutScopeChain = class extends ScopeChain2 {
|
|
|
418
471
|
if (globalScope) {
|
|
419
472
|
deps.unshift(globalScope);
|
|
420
473
|
}
|
|
421
|
-
return this.transformDeps(deps, { scope });
|
|
474
|
+
return this.transformService.transformDeps(deps, { scope });
|
|
422
475
|
}
|
|
423
476
|
// 获取覆盖作用域
|
|
424
477
|
getCovers(scope) {
|
|
425
478
|
if (!this.tree) {
|
|
426
|
-
return this.transformCovers([], { scope });
|
|
479
|
+
return this.transformService.transformCovers([], { scope });
|
|
427
480
|
}
|
|
428
481
|
if (GlobalScope.is(scope)) {
|
|
429
482
|
return this.variableEngine.getAllScopes({ sort: true }).filter((_scope) => !GlobalScope.is(_scope));
|
|
430
483
|
}
|
|
431
484
|
const node = scope.meta.node;
|
|
432
485
|
if (!node) {
|
|
433
|
-
return this.transformCovers([], { scope });
|
|
486
|
+
return this.transformService.transformCovers([], { scope });
|
|
434
487
|
}
|
|
435
488
|
const covers = [];
|
|
436
489
|
if (scope.meta.type === "private" /* private */) {
|
|
@@ -439,7 +492,7 @@ var FixedLayoutScopeChain = class extends ScopeChain2 {
|
|
|
439
492
|
addNodePrivateScope: true
|
|
440
493
|
})
|
|
441
494
|
);
|
|
442
|
-
return this.transformCovers(covers, { scope });
|
|
495
|
+
return this.transformService.transformCovers(covers, { scope });
|
|
443
496
|
}
|
|
444
497
|
let curr = node;
|
|
445
498
|
while (curr) {
|
|
@@ -465,7 +518,7 @@ var FixedLayoutScopeChain = class extends ScopeChain2 {
|
|
|
465
518
|
let currParentNext = this.tree.getNext(currParent);
|
|
466
519
|
while (currParent) {
|
|
467
520
|
if (this.isNodeChildrenPrivate(currParent)) {
|
|
468
|
-
return this.transformCovers(covers, { scope });
|
|
521
|
+
return this.transformService.transformCovers(covers, { scope });
|
|
469
522
|
}
|
|
470
523
|
if (currParentNext) {
|
|
471
524
|
break;
|
|
@@ -481,21 +534,7 @@ var FixedLayoutScopeChain = class extends ScopeChain2 {
|
|
|
481
534
|
}
|
|
482
535
|
curr = void 0;
|
|
483
536
|
}
|
|
484
|
-
return this.transformCovers(covers, { scope });
|
|
485
|
-
}
|
|
486
|
-
transformCovers(covers, { scope }) {
|
|
487
|
-
return this.configs?.transformCovers ? this.configs.transformCovers(covers, {
|
|
488
|
-
scope,
|
|
489
|
-
document: this.flowDocument,
|
|
490
|
-
variableEngine: this.variableEngine
|
|
491
|
-
}) : covers;
|
|
492
|
-
}
|
|
493
|
-
transformDeps(deps, { scope }) {
|
|
494
|
-
return this.configs?.transformDeps ? this.configs.transformDeps(deps, {
|
|
495
|
-
scope,
|
|
496
|
-
document: this.flowDocument,
|
|
497
|
-
variableEngine: this.variableEngine
|
|
498
|
-
}) : deps;
|
|
537
|
+
return this.transformService.transformCovers(covers, { scope });
|
|
499
538
|
}
|
|
500
539
|
// 排序所有作用域
|
|
501
540
|
sortAll() {
|
|
@@ -557,10 +596,13 @@ var FixedLayoutScopeChain = class extends ScopeChain2 {
|
|
|
557
596
|
return scopes;
|
|
558
597
|
}
|
|
559
598
|
};
|
|
599
|
+
__decorateClass([
|
|
600
|
+
inject3(ScopeChainTransformService)
|
|
601
|
+
], FixedLayoutScopeChain.prototype, "transformService", 2);
|
|
560
602
|
FixedLayoutScopeChain = __decorateClass([
|
|
561
|
-
__decorateParam(0,
|
|
562
|
-
__decorateParam(1,
|
|
563
|
-
__decorateParam(1,
|
|
603
|
+
__decorateParam(0, inject3(FlowDocument3)),
|
|
604
|
+
__decorateParam(1, optional3()),
|
|
605
|
+
__decorateParam(1, inject3(VariableLayoutConfig))
|
|
564
606
|
], FixedLayoutScopeChain);
|
|
565
607
|
export {
|
|
566
608
|
FixedLayoutScopeChain,
|
|
@@ -568,6 +610,7 @@ export {
|
|
|
568
610
|
FlowNodeVariableData,
|
|
569
611
|
FreeLayoutScopeChain,
|
|
570
612
|
GlobalScope,
|
|
613
|
+
ScopeChainTransformService,
|
|
571
614
|
VariableLayoutConfig,
|
|
572
615
|
bindGlobalScope
|
|
573
616
|
};
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/flow-node-variable-data.ts","../../src/types.ts","../../src/chains/free-layout-scope-chain.ts","../../src/variable-layout-config.ts","../../src/scopes/global-scope.ts","../../src/chains/fixed-layout-scope-chain.ts"],"sourcesContent":["import { VariableEngine } from '@flowgram.ai/variable-core';\nimport { type ASTNode, ASTNodeJSON } from '@flowgram.ai/variable-core';\nimport { FlowNodeEntity } from '@flowgram.ai/document';\nimport { EntityData } from '@flowgram.ai/core';\n\nimport { FlowNodeScope, FlowNodeScopeMeta, FlowNodeScopeTypeEnum } from './types';\n\ninterface Options {\n variableEngine: VariableEngine;\n}\n\nexport class FlowNodeVariableData extends EntityData {\n static type: string = 'FlowNodeVariableData';\n\n declare entity: FlowNodeEntity;\n\n readonly variableEngine: VariableEngine;\n\n /**\n * Private variables can be accessed by public ones, but not the other way around.\n */\n protected _private?: FlowNodeScope;\n\n protected _public: FlowNodeScope;\n\n get private() {\n return this._private;\n }\n\n get public() {\n return this._public;\n }\n\n /**\n * Sets a variable in the public AST (Abstract Syntax Tree) with the given key and JSON value.\n *\n * @param key - The key under which the variable will be stored.\n * @param json - The JSON value to store.\n * @returns The updated AST node.\n */\n public setVar(key: string, json: ASTNodeJSON): ASTNode;\n\n /**\n * Sets a variable in the public AST (Abstract Syntax Tree) with the default key 'outputs'.\n *\n * @param json - The JSON value to store.\n * @returns The updated AST node.\n */\n public setVar(json: ASTNodeJSON): ASTNode;\n\n public setVar(arg1: string | ASTNodeJSON, arg2?: ASTNodeJSON): ASTNode {\n if (typeof arg1 === 'string' && arg2 !== undefined) {\n return this.public.ast.set(arg1, arg2);\n }\n\n if (typeof arg1 === 'object' && arg2 === undefined) {\n return this.public.ast.set('outputs', arg1);\n }\n\n throw new Error('Invalid arguments');\n }\n\n /**\n * Retrieves a variable from the public AST (Abstract Syntax Tree) by key.\n *\n * @param key - The key of the variable to retrieve. Defaults to 'outputs'.\n * @returns The value of the variable, or undefined if not found.\n */\n public getVar(key: string = 'outputs') {\n return this.public.ast.get(key);\n }\n\n /**\n * Clears a variable from the public AST (Abstract Syntax Tree) by key.\n *\n * @param key - The key of the variable to clear. Defaults to 'outputs'.\n * @returns The updated AST node.\n */\n public clearVar(key: string = 'outputs') {\n return this.public.ast.remove(key);\n }\n\n /**\n * Sets a variable in the private AST (Abstract Syntax Tree) with the given key and JSON value.\n *\n * @param key - The key under which the variable will be stored.\n * @param json - The JSON value to store.\n * @returns The updated AST node.\n */\n public setPrivateVar(key: string, json: ASTNodeJSON): ASTNode;\n\n /**\n * Sets a variable in the private AST (Abstract Syntax Tree) with the default key 'outputs'.\n *\n * @param json - The JSON value to store.\n * @returns The updated AST node.\n */\n public setPrivateVar(json: ASTNodeJSON): ASTNode;\n\n public setPrivateVar(arg1: string | ASTNodeJSON, arg2?: ASTNodeJSON): ASTNode {\n if (typeof arg1 === 'string' && arg2 !== undefined) {\n return this.initPrivate().ast.set(arg1, arg2);\n }\n\n if (typeof arg1 === 'object' && arg2 === undefined) {\n return this.initPrivate().ast.set('outputs', arg1);\n }\n\n throw new Error('Invalid arguments');\n }\n\n /**\n * Retrieves a variable from the private AST (Abstract Syntax Tree) by key.\n *\n * @param key - The key of the variable to retrieve. Defaults to 'outputs'.\n * @returns The value of the variable, or undefined if not found.\n */\n public getPrivateVar(key: string = 'outputs') {\n return this.private?.ast.get(key);\n }\n\n /**\n * Clears a variable from the private AST (Abstract Syntax Tree) by key.\n *\n * @param key - The key of the variable to clear. Defaults to 'outputs'.\n * @returns The updated AST node.\n */\n public clearPrivateVar(key: string = 'outputs') {\n return this.private?.ast.remove(key);\n }\n\n get allScopes(): FlowNodeScope[] {\n const res = [];\n\n if (this._public) {\n res.push(this._public);\n }\n if (this._private) {\n res.push(this._private);\n }\n\n return res;\n }\n\n getDefaultData() {\n return {};\n }\n\n constructor(entity: FlowNodeEntity, readonly opts: Options) {\n super(entity);\n\n const { variableEngine } = opts || {};\n this.variableEngine = variableEngine;\n this._public = this.variableEngine.createScope(this.entity.id, {\n node: this.entity,\n type: FlowNodeScopeTypeEnum.public,\n } as FlowNodeScopeMeta);\n this.toDispose.push(this._public);\n }\n\n initPrivate(): FlowNodeScope {\n if (!this._private) {\n this._private = this.variableEngine.createScope(`${this.entity.id}_private`, {\n node: this.entity,\n type: FlowNodeScopeTypeEnum.private,\n } as FlowNodeScopeMeta);\n // 1. Notify the covering scopes of private to update dependencies\n this._private.coverScopes.forEach((_scope) => {\n _scope.refreshDeps();\n });\n // 2. Notify the dependent scopes of private to update their covers\n this._private.depScopes.forEach((_scope) => {\n _scope.refreshCovers();\n });\n // 3. The private scope itself needs to refresh its dependencies\n this._private.available.refresh();\n\n this.toDispose.push(this._private);\n }\n return this._private;\n }\n}\n","import { Scope } from '@flowgram.ai/variable-core';\nimport { FlowNodeEntity } from '@flowgram.ai/document';\n\nexport enum FlowNodeScopeTypeEnum {\n public = 'public',\n private = 'private',\n}\n\nexport interface FlowNodeScopeMeta {\n node?: FlowNodeEntity;\n type?: FlowNodeScopeTypeEnum;\n}\n\nexport interface ScopeVirtualNode {\n id: string;\n flowNodeType: 'virtualNode';\n}\n\nexport type ScopeChainNode = FlowNodeEntity | ScopeVirtualNode;\n\n// 节点内部的作用域\nexport type FlowNodeScope = Scope<FlowNodeScopeMeta>;\n","import { inject, optional, postConstruct } from 'inversify';\nimport { Scope, ScopeChain } from '@flowgram.ai/variable-core';\nimport { WorkflowNodeLinesData, WorkflowNodeMeta } from '@flowgram.ai/free-layout-core';\nimport { FlowNodeEntity, FlowDocument, FlowVirtualTree } from '@flowgram.ai/document';\nimport { EntityManager } from '@flowgram.ai/core';\n\nimport { VariableLayoutConfig } from '../variable-layout-config';\nimport { FlowNodeScope, FlowNodeScopeTypeEnum } from '../types';\nimport { GlobalScope } from '../scopes/global-scope';\nimport { FlowNodeVariableData } from '../flow-node-variable-data';\n\n/**\n * 自由布局作用域链实现\n */\nexport class FreeLayoutScopeChain extends ScopeChain {\n @inject(EntityManager) entityManager: EntityManager;\n\n @inject(FlowDocument)\n protected flowDocument: FlowDocument;\n\n @optional()\n @inject(VariableLayoutConfig)\n protected configs?: VariableLayoutConfig;\n\n get tree(): FlowVirtualTree<FlowNodeEntity> {\n return this.flowDocument.originTree;\n }\n\n @postConstruct()\n onInit() {\n this.toDispose.pushAll([\n // 线条发生变化时,会触发作用域链的更新\n this.entityManager.onEntityDataChange(({ entityDataType }) => {\n if (entityDataType === WorkflowNodeLinesData.type) {\n this.refreshAllChange();\n }\n }),\n // 树变化时候刷新作用域\n this.tree.onTreeChange(() => {\n this.refreshAllChange();\n }),\n ]);\n }\n\n // 获取同一层级所有输入节点\n protected getAllInputLayerNodes(curr: FlowNodeEntity): FlowNodeEntity[] {\n return (curr.getData(WorkflowNodeLinesData)?.allInputNodes || []).filter(\n (_node) => _node.parent === curr.parent\n );\n }\n\n // 获取同一层级所有输出节点\n protected getAllOutputLayerNodes(curr: FlowNodeEntity): FlowNodeEntity[] {\n return (curr.getData(WorkflowNodeLinesData)?.allOutputNodes || []).filter(\n (_node) => _node.parent === curr.parent\n );\n }\n\n getDeps(scope: FlowNodeScope): FlowNodeScope[] {\n const { node } = scope.meta || {};\n if (!node) {\n return this.transformDeps([], { scope });\n }\n\n const deps: FlowNodeScope[] = [];\n\n // 1. 找到依赖的节点\n let curr: FlowNodeEntity | undefined = node;\n\n while (curr) {\n const allInputNodes: FlowNodeEntity[] = this.getAllInputLayerNodes(curr);\n\n // 2. 获取所有依赖节点的 public 作用域\n deps.push(\n ...allInputNodes.map((_node) => _node.getData(FlowNodeVariableData).public).filter(Boolean)\n );\n\n // 父节点的 private 也可以访问\n const currVarData: FlowNodeVariableData = curr.getData(FlowNodeVariableData);\n if (currVarData?.private && scope !== currVarData.private) {\n deps.push(currVarData.private);\n }\n\n curr = this.getParent(curr);\n }\n\n // If scope is GlobalScope, add globalScope to deps\n const globalScope = this.variableEngine.getScopeById(GlobalScope.ID);\n if (globalScope) {\n deps.unshift(globalScope);\n }\n\n const uniqDeps = Array.from(new Set(deps));\n return this.transformDeps(uniqDeps, { scope });\n }\n\n getCovers(scope: FlowNodeScope): FlowNodeScope[] {\n // If scope is GlobalScope, return all scopes except GlobalScope\n if (GlobalScope.is(scope)) {\n return this.variableEngine\n .getAllScopes({ sort: true })\n .filter((_scope) => !GlobalScope.is(_scope));\n }\n\n const { node } = scope.meta || {};\n if (!node) {\n return this.transformCovers([], { scope });\n }\n\n const isPrivate = scope.meta.type === FlowNodeScopeTypeEnum.private;\n\n // 1. BFS 找到所有覆盖的节点\n const queue: FlowNodeEntity[] = [];\n\n if (isPrivate) {\n // private 只能覆盖其子节点\n queue.push(...this.getChildren(node));\n } else {\n // 否则覆盖其所有输出线的节点\n queue.push(...(this.getAllOutputLayerNodes(node) || []));\n }\n\n // 2. 获取所有覆盖节点的 public、private 作用域\n const scopes: FlowNodeScope[] = [];\n\n while (queue.length) {\n const _node = queue.shift()!;\n const variableData: FlowNodeVariableData = _node.getData(FlowNodeVariableData);\n scopes.push(...variableData.allScopes);\n const children = _node && this.getChildren(_node);\n\n if (children?.length) {\n queue.push(...children);\n }\n }\n\n // 3. 如果当前 scope 是 private,则当前节点的 public 也可覆盖\n const currentVariableData: FlowNodeVariableData = node.getData(FlowNodeVariableData);\n if (isPrivate && currentVariableData.public) {\n scopes.push(currentVariableData.public);\n }\n\n const uniqScopes = Array.from(new Set(scopes));\n\n return this.transformCovers(uniqScopes, { scope });\n }\n\n protected transformCovers(covers: Scope[], { scope }: { scope: Scope }): Scope[] {\n return this.configs?.transformCovers\n ? this.configs.transformCovers(covers, {\n scope,\n document: this.flowDocument,\n variableEngine: this.variableEngine,\n })\n : covers;\n }\n\n protected transformDeps(deps: Scope[], { scope }: { scope: Scope }): Scope[] {\n return this.configs?.transformDeps\n ? this.configs.transformDeps(deps, {\n scope,\n document: this.flowDocument,\n variableEngine: this.variableEngine,\n })\n : deps;\n }\n\n getChildren(node: FlowNodeEntity): FlowNodeEntity[] {\n if (this.configs?.getFreeChildren) {\n return this.configs.getFreeChildren?.(node);\n }\n const nodeMeta = node.getNodeMeta<WorkflowNodeMeta>();\n const subCanvas = nodeMeta.subCanvas?.(node);\n\n if (subCanvas) {\n // 子画布本身不存在 children\n if (subCanvas.isCanvas) {\n return [];\n } else {\n return subCanvas.canvasNode.collapsedChildren;\n }\n }\n\n // 部分场景通过连线来表达父子关系,因此需要上层配置\n return this.tree.getChildren(node);\n }\n\n getParent(node: FlowNodeEntity): FlowNodeEntity | undefined {\n // 部分场景通过连线来表达父子关系,因此需要上层配置\n if (this.configs?.getFreeParent) {\n return this.configs.getFreeParent(node);\n }\n const initParent = node.document.originTree.getParent(node);\n\n if (!initParent) {\n return initParent;\n }\n\n const nodeMeta = initParent.getNodeMeta<WorkflowNodeMeta>();\n const subCanvas = nodeMeta.subCanvas?.(initParent);\n if (subCanvas?.isCanvas) {\n return subCanvas.parentNode;\n }\n\n return initParent;\n }\n\n sortAll(): Scope[] {\n // 暂未实现\n console.warn('FreeLayoutScopeChain.sortAll is not implemented');\n return [];\n }\n}\n","import { Scope } from '@flowgram.ai/variable-core';\nimport { VariableEngine } from '@flowgram.ai/variable-core';\nimport { FlowNodeEntity, FlowDocument } from '@flowgram.ai/document';\n\nimport { type FlowNodeScope, type ScopeChainNode } from './types';\n\ninterface TransformerContext {\n scope: FlowNodeScope;\n document: FlowDocument;\n variableEngine: VariableEngine;\n}\n\nexport interface VariableLayoutConfig {\n /**\n * 节点的子节点输出变量,不能被后续节点所访问,用于固定布局场景\n * @param node\n * @returns\n */\n isNodeChildrenPrivate?: (node: ScopeChainNode) => boolean;\n\n /**\n * 用于自由画布场景,部分场景通过连线或者其他交互形式来表达节点之间的父子关系,需要可配置化\n */\n getFreeChildren?: (node: FlowNodeEntity) => FlowNodeEntity[];\n getFreeParent?: (node: FlowNodeEntity) => FlowNodeEntity | undefined;\n\n /**\n * 对依赖作用域进行微调\n */\n transformDeps?: (scopes: Scope[], ctx: TransformerContext) => Scope[];\n\n /**\n * 对依赖作用域进行微调\n */\n transformCovers?: (scopes: Scope[], ctx: TransformerContext) => Scope[];\n}\n\nexport const VariableLayoutConfig = Symbol('VariableLayoutConfig');\n","import { injectable, interfaces } from 'inversify';\nimport { ASTNode, ASTNodeJSON, Scope, VariableEngine } from '@flowgram.ai/variable-core';\n\n@injectable()\nexport class GlobalScope extends Scope {\n static readonly ID = Symbol('GlobalScope');\n\n static is(scope: Scope): scope is GlobalScope {\n return scope.id === GlobalScope.ID;\n }\n\n /**\n * Sets a variable in the Global Scope with the given key and JSON value.\n *\n * @param key - The key under which the variable will be stored.\n * @param json - The JSON value to store.\n * @returns The updated AST node.\n */\n public setVar(key: string, json: ASTNodeJSON): ASTNode;\n\n /**\n * Sets a variable in the Global Scope with the default key 'outputs'.\n *\n * @param json - The JSON value to store.\n * @returns The updated AST node.\n */\n public setVar(json: ASTNodeJSON): ASTNode;\n\n public setVar(arg1: string | ASTNodeJSON, arg2?: ASTNodeJSON): ASTNode {\n if (typeof arg1 === 'string' && arg2 !== undefined) {\n return this.ast.set(arg1, arg2);\n }\n\n if (typeof arg1 === 'object' && arg2 === undefined) {\n return this.ast.set('outputs', arg1);\n }\n\n throw new Error('Invalid arguments');\n }\n\n /**\n * Retrieves a variable from the Global Scope by key.\n *\n * @param key - The key of the variable to retrieve. Defaults to 'outputs'.\n * @returns The value of the variable, or undefined if not found.\n */\n public getVar(key: string = 'outputs') {\n return this.ast.get(key);\n }\n\n /**\n * Clears a variable from the Global Scope by key.\n *\n * @param key - The key of the variable to clear. Defaults to 'outputs'.\n * @returns The updated AST node.\n */\n public clearVar(key: string = 'outputs') {\n return this.ast.remove(key);\n }\n}\n\nexport const bindGlobalScope = (bind: interfaces.Bind) => {\n bind(GlobalScope).toDynamicValue((ctx) => {\n const variableEngine = ctx.container.get(VariableEngine);\n let scope = variableEngine.getScopeById(GlobalScope.ID) as GlobalScope;\n\n if (!scope) {\n scope = variableEngine.createScope(\n GlobalScope.ID,\n {},\n { ScopeConstructor: GlobalScope }\n ) as GlobalScope;\n variableEngine.chain.refreshAllChange();\n }\n\n return scope;\n });\n};\n","import { inject, optional } from 'inversify';\nimport { Scope, ScopeChain } from '@flowgram.ai/variable-core';\nimport { FlowDocument, type FlowVirtualTree } from '@flowgram.ai/document';\nimport { FlowNodeEntity } from '@flowgram.ai/document';\n\nimport { VariableLayoutConfig } from '../variable-layout-config';\nimport { FlowNodeScope, FlowNodeScopeTypeEnum, ScopeChainNode } from '../types';\nimport { GlobalScope } from '../scopes/global-scope';\nimport { FlowNodeVariableData } from '../flow-node-variable-data';\n\n/**\n * 基于 FlowVirtualTree 的 ScopeOrder 实现\n */\nexport class FixedLayoutScopeChain extends ScopeChain {\n // 增加 { id: string } 使得可以灵活添加自定义虚拟节点\n tree: FlowVirtualTree<ScopeChainNode> | undefined;\n\n constructor(\n @inject(FlowDocument)\n protected flowDocument: FlowDocument,\n @optional()\n @inject(VariableLayoutConfig)\n protected configs?: VariableLayoutConfig\n ) {\n super();\n\n // 绑定 flowDocument 里面的树\n this.bindTree(flowDocument.originTree);\n\n // originTree 发生变化时,触发依赖关系的变化\n this.toDispose.push(\n // REFRACTOR: onTreeChange 触发时机精细化\n flowDocument.originTree.onTreeChange(() => {\n this.refreshAllChange();\n })\n );\n }\n\n // 绑定树\n bindTree(tree: FlowVirtualTree<ScopeChainNode>): void {\n this.tree = tree;\n }\n\n // 获取依赖作用域\n getDeps(scope: FlowNodeScope): FlowNodeScope[] {\n if (!this.tree) {\n return this.transformDeps([], { scope });\n }\n\n const node = scope.meta.node;\n if (!node) {\n return this.transformDeps([], { scope });\n }\n\n const deps: FlowNodeScope[] = [];\n\n let curr: ScopeChainNode | undefined = node;\n\n while (curr) {\n const { parent, pre } = this.tree.getInfo(curr);\n const currData = this.getVariableData(curr);\n\n // 包含子节点,且不是私有作用域\n\n if (curr === node) {\n // public 可以依赖 private\n if (scope.meta.type === FlowNodeScopeTypeEnum.public && currData?.private) {\n deps.unshift(currData.private);\n }\n } else if (this.hasChildren(curr) && !this.isNodeChildrenPrivate(curr)) {\n // 有子元素的节点,则将子元素纳入依赖作用域\n deps.unshift(\n ...this.getAllSortedChildScope(curr, {\n ignoreNodeChildrenPrivate: true,\n })\n );\n }\n\n // 节点的 public 都可以被访问\n if (currData && curr !== node) {\n deps.unshift(currData.public);\n }\n\n // 上个节点处理\n if (pre) {\n curr = pre;\n continue;\n }\n\n // 父节点处理\n if (parent) {\n let currParent: ScopeChainNode | undefined = parent;\n let currParentPre: ScopeChainNode | undefined = this.tree.getPre(currParent);\n\n while (currParent) {\n // 父节点的 private 和 public 都能被子节点访问\n const currParentData = this.getVariableData(currParent);\n if (currParentData) {\n deps.unshift(...currParentData.allScopes);\n }\n\n // 当前 parent 有 pre 节点,则停止向上查找\n if (currParentPre) {\n break;\n }\n\n currParent = this.tree.getParent(currParent);\n currParentPre = currParent ? this.tree.getPre(currParent) : undefined;\n }\n curr = currParentPre;\n continue;\n }\n\n // next 和 parent 都没有,直接结束循环\n curr = undefined;\n }\n\n // If scope is GlobalScope, add globalScope to deps\n const globalScope = this.variableEngine.getScopeById(GlobalScope.ID);\n if (globalScope) {\n deps.unshift(globalScope);\n }\n\n return this.transformDeps(deps, { scope });\n }\n\n // 获取覆盖作用域\n getCovers(scope: FlowNodeScope): FlowNodeScope[] {\n if (!this.tree) {\n return this.transformCovers([], { scope });\n }\n\n // If scope is GlobalScope, return all scopes except GlobalScope\n if (GlobalScope.is(scope)) {\n return this.variableEngine\n .getAllScopes({ sort: true })\n .filter((_scope) => !GlobalScope.is(_scope));\n }\n\n const node = scope.meta.node;\n if (!node) {\n return this.transformCovers([], { scope });\n }\n\n const covers: FlowNodeScope[] = [];\n\n // 如果是 private 作用域,则只能子节点访问\n if (scope.meta.type === FlowNodeScopeTypeEnum.private) {\n covers.push(\n ...this.getAllSortedChildScope(node, {\n addNodePrivateScope: true,\n })\n );\n return this.transformCovers(covers, { scope });\n }\n\n let curr: ScopeChainNode | undefined = node;\n\n while (curr) {\n const { next, parent } = this.tree.getInfo(curr);\n const currData = this.getVariableData(curr);\n\n // 有子元素的节点,则将子元素纳入覆盖作用域\n if (curr !== node) {\n if (this.hasChildren(curr)) {\n covers.push(\n ...this.getAllSortedChildScope(curr, {\n addNodePrivateScope: true,\n })\n );\n } else if (currData) {\n covers.push(...currData.allScopes);\n }\n }\n\n // 下个节点处理\n if (next) {\n curr = next;\n continue;\n }\n\n if (parent) {\n let currParent: ScopeChainNode | undefined = parent;\n let currParentNext: ScopeChainNode | undefined = this.tree.getNext(currParent);\n\n while (currParent) {\n // 私有作用域不能被后续节点访问\n if (this.isNodeChildrenPrivate(currParent)) {\n return this.transformCovers(covers, { scope });\n }\n\n // 当前 parent 有 next 节点,则停止向上查找\n if (currParentNext) {\n break;\n }\n\n currParent = this.tree.getParent(currParent);\n currParentNext = currParent ? this.tree.getNext(currParent) : undefined;\n }\n if (!currParentNext && currParent) {\n break;\n }\n\n curr = currParentNext;\n continue;\n }\n\n // next 和 parent 都没有,直接结束循环\n curr = undefined;\n }\n\n return this.transformCovers(covers, { scope });\n }\n\n protected transformCovers(covers: Scope[], { scope }: { scope: Scope }): Scope[] {\n return this.configs?.transformCovers\n ? this.configs.transformCovers(covers, {\n scope,\n document: this.flowDocument,\n variableEngine: this.variableEngine,\n })\n : covers;\n }\n\n protected transformDeps(deps: Scope[], { scope }: { scope: Scope }): Scope[] {\n return this.configs?.transformDeps\n ? this.configs.transformDeps(deps, {\n scope,\n document: this.flowDocument,\n variableEngine: this.variableEngine,\n })\n : deps;\n }\n\n // 排序所有作用域\n sortAll(): Scope[] {\n const startNode = this.flowDocument.getAllNodes().find((_node) => _node.isStart);\n if (!startNode) {\n return [];\n }\n\n const startVariableData = startNode.getData(FlowNodeVariableData);\n const startPublicScope = startVariableData.public;\n const deps = this.getDeps(startPublicScope);\n\n const covers = this.getCovers(startPublicScope).filter(\n (_scope) => !deps.includes(_scope) && _scope !== startPublicScope\n );\n\n return [...deps, startPublicScope, ...covers];\n }\n\n // 获取变量 Data 数据\n private getVariableData(node: ScopeChainNode): FlowNodeVariableData | undefined {\n if (node.flowNodeType === 'virtualNode') {\n return;\n }\n // TODO 包含 $ 的节点不注册 variableData\n if (node.id.startsWith('$')) {\n return;\n }\n\n return (node as FlowNodeEntity).getData(FlowNodeVariableData);\n }\n\n // privateScope:子节点不可以被后续节点访问\n private isNodeChildrenPrivate(node?: ScopeChainNode): boolean {\n if (this.configs?.isNodeChildrenPrivate) {\n return node ? this.configs?.isNodeChildrenPrivate(node) : false;\n }\n\n const isSystemNode = node?.id.startsWith('$');\n // 兜底:有子节点(节点 id 没有 $ 开头)的全部为私有作用域\n return !isSystemNode && this.hasChildren(node);\n }\n\n private hasChildren(node?: ScopeChainNode): boolean {\n return Boolean(this.tree && node && this.tree.getChildren(node).length > 0);\n }\n\n // 子节点按照顺序进行排序(含自身)\n private getAllSortedChildScope(\n node: ScopeChainNode,\n {\n ignoreNodeChildrenPrivate,\n addNodePrivateScope,\n }: { ignoreNodeChildrenPrivate?: boolean; addNodePrivateScope?: boolean } = {}\n ): FlowNodeScope[] {\n const scopes: FlowNodeScope[] = [];\n\n const variableData = this.getVariableData(node);\n\n if (variableData) {\n scopes.push(variableData.public);\n }\n\n // 私有作用域,子节点的变量不对外输出\n //(父节点如果存在 public 变量则对外输出)\n if (ignoreNodeChildrenPrivate && this.isNodeChildrenPrivate(node)) {\n return scopes;\n }\n\n if (addNodePrivateScope && variableData?.private) {\n scopes.push(variableData.private);\n }\n\n const children = this.tree?.getChildren(node) || [];\n scopes.push(\n ...children\n .map((child) =>\n this.getAllSortedChildScope(child, { ignoreNodeChildrenPrivate, addNodePrivateScope })\n )\n .flat()\n );\n\n return scopes;\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAGA,SAAS,kBAAkB;;;ACApB,IAAK,wBAAL,kBAAKA,2BAAL;AACL,EAAAA,uBAAA,YAAS;AACT,EAAAA,uBAAA,aAAU;AAFA,SAAAA;AAAA,GAAA;;;ADQL,IAAM,uBAAN,cAAmC,WAAW;AAAA,EAyInD,YAAY,QAAiC,MAAe;AAC1D,UAAM,MAAM;AAD+B;AAG3C,UAAM,EAAE,eAAe,IAAI,QAAQ,CAAC;AACpC,SAAK,iBAAiB;AACtB,SAAK,UAAU,KAAK,eAAe,YAAY,KAAK,OAAO,IAAI;AAAA,MAC7D,MAAM,KAAK;AAAA,MACX;AAAA,IACF,CAAsB;AACtB,SAAK,UAAU,KAAK,KAAK,OAAO;AAAA,EAClC;AAAA,EArIA,IAAI,UAAU;AACZ,WAAO,KAAK;AAAA,EACd;AAAA,E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,oBAAoB,CAAC;AAAA,MACvF,EACC,KAAK;AAAA,IACV;AAEA,WAAO;AAAA,EACT;AACF;AAhTa,wBAAN;AAAA,EAKF,mBAAAC,QAAOC,aAAY;AAAA,EAEnB,mBAAAC,UAAS;AAAA,EACT,mBAAAF,QAAO,oBAAoB;AAAA,GARnB;","names":["FlowNodeScopeTypeEnum","inject","optional","ScopeChain","FlowDocument","ScopeChain","inject","FlowDocument","optional"]}
|
|
1
|
+
{"version":3,"sources":["../../src/flow-node-variable-data.ts","../../src/types.ts","../../src/chains/free-layout-scope-chain.ts","../../src/variable-layout-config.ts","../../src/services/scope-chain-transform-service.ts","../../src/scopes/global-scope.ts","../../src/chains/fixed-layout-scope-chain.ts"],"sourcesContent":["import { VariableEngine } from '@flowgram.ai/variable-core';\nimport { type ASTNode, ASTNodeJSON } from '@flowgram.ai/variable-core';\nimport { FlowNodeEntity } from '@flowgram.ai/document';\nimport { EntityData } from '@flowgram.ai/core';\n\nimport { FlowNodeScope, FlowNodeScopeMeta, FlowNodeScopeTypeEnum } from './types';\n\ninterface Options {\n variableEngine: VariableEngine;\n}\n\nexport class FlowNodeVariableData extends EntityData {\n static type: string = 'FlowNodeVariableData';\n\n declare entity: FlowNodeEntity;\n\n readonly variableEngine: VariableEngine;\n\n /**\n * Private variables can be accessed by public ones, but not the other way around.\n */\n protected _private?: FlowNodeScope;\n\n protected _public: FlowNodeScope;\n\n get private() {\n return this._private;\n }\n\n get public() {\n return this._public;\n }\n\n /**\n * Sets a variable in the public AST (Abstract Syntax Tree) with the given key and JSON value.\n *\n * @param key - The key under which the variable will be stored.\n * @param json - The JSON value to store.\n * @returns The updated AST node.\n */\n public setVar(key: string, json: ASTNodeJSON): ASTNode;\n\n /**\n * Sets a variable in the public AST (Abstract Syntax Tree) with the default key 'outputs'.\n *\n * @param json - The JSON value to store.\n * @returns The updated AST node.\n */\n public setVar(json: ASTNodeJSON): ASTNode;\n\n public setVar(arg1: string | ASTNodeJSON, arg2?: ASTNodeJSON): ASTNode {\n if (typeof arg1 === 'string' && arg2 !== undefined) {\n return this.public.ast.set(arg1, arg2);\n }\n\n if (typeof arg1 === 'object' && arg2 === undefined) {\n return this.public.ast.set('outputs', arg1);\n }\n\n throw new Error('Invalid arguments');\n }\n\n /**\n * Retrieves a variable from the public AST (Abstract Syntax Tree) by key.\n *\n * @param key - The key of the variable to retrieve. Defaults to 'outputs'.\n * @returns The value of the variable, or undefined if not found.\n */\n public getVar(key: string = 'outputs') {\n return this.public.ast.get(key);\n }\n\n /**\n * Clears a variable from the public AST (Abstract Syntax Tree) by key.\n *\n * @param key - The key of the variable to clear. Defaults to 'outputs'.\n * @returns The updated AST node.\n */\n public clearVar(key: string = 'outputs') {\n return this.public.ast.remove(key);\n }\n\n /**\n * Sets a variable in the private AST (Abstract Syntax Tree) with the given key and JSON value.\n *\n * @param key - The key under which the variable will be stored.\n * @param json - The JSON value to store.\n * @returns The updated AST node.\n */\n public setPrivateVar(key: string, json: ASTNodeJSON): ASTNode;\n\n /**\n * Sets a variable in the private AST (Abstract Syntax Tree) with the default key 'outputs'.\n *\n * @param json - The JSON value to store.\n * @returns The updated AST node.\n */\n public setPrivateVar(json: ASTNodeJSON): ASTNode;\n\n public setPrivateVar(arg1: string | ASTNodeJSON, arg2?: ASTNodeJSON): ASTNode {\n if (typeof arg1 === 'string' && arg2 !== undefined) {\n return this.initPrivate().ast.set(arg1, arg2);\n }\n\n if (typeof arg1 === 'object' && arg2 === undefined) {\n return this.initPrivate().ast.set('outputs', arg1);\n }\n\n throw new Error('Invalid arguments');\n }\n\n /**\n * Retrieves a variable from the private AST (Abstract Syntax Tree) by key.\n *\n * @param key - The key of the variable to retrieve. Defaults to 'outputs'.\n * @returns The value of the variable, or undefined if not found.\n */\n public getPrivateVar(key: string = 'outputs') {\n return this.private?.ast.get(key);\n }\n\n /**\n * Clears a variable from the private AST (Abstract Syntax Tree) by key.\n *\n * @param key - The key of the variable to clear. Defaults to 'outputs'.\n * @returns The updated AST node.\n */\n public clearPrivateVar(key: string = 'outputs') {\n return this.private?.ast.remove(key);\n }\n\n get allScopes(): FlowNodeScope[] {\n const res = [];\n\n if (this._public) {\n res.push(this._public);\n }\n if (this._private) {\n res.push(this._private);\n }\n\n return res;\n }\n\n getDefaultData() {\n return {};\n }\n\n constructor(entity: FlowNodeEntity, readonly opts: Options) {\n super(entity);\n\n const { variableEngine } = opts || {};\n this.variableEngine = variableEngine;\n this._public = this.variableEngine.createScope(this.entity.id, {\n node: this.entity,\n type: FlowNodeScopeTypeEnum.public,\n } as FlowNodeScopeMeta);\n this.toDispose.push(this._public);\n }\n\n initPrivate(): FlowNodeScope {\n if (!this._private) {\n this._private = this.variableEngine.createScope(`${this.entity.id}_private`, {\n node: this.entity,\n type: FlowNodeScopeTypeEnum.private,\n } as FlowNodeScopeMeta);\n // 1. Notify the covering scopes of private to update dependencies\n this._private.coverScopes.forEach((_scope) => {\n _scope.refreshDeps();\n });\n // 2. Notify the dependent scopes of private to update their covers\n this._private.depScopes.forEach((_scope) => {\n _scope.refreshCovers();\n });\n // 3. The private scope itself needs to refresh its dependencies\n this._private.available.refresh();\n\n this.toDispose.push(this._private);\n }\n return this._private;\n }\n}\n","import { Scope } from '@flowgram.ai/variable-core';\nimport { FlowNodeEntity } from '@flowgram.ai/document';\n\nexport enum FlowNodeScopeTypeEnum {\n public = 'public',\n private = 'private',\n}\n\nexport interface FlowNodeScopeMeta {\n node?: FlowNodeEntity;\n type?: FlowNodeScopeTypeEnum;\n}\n\nexport interface ScopeVirtualNode {\n id: string;\n flowNodeType: 'virtualNode';\n}\n\nexport type ScopeChainNode = FlowNodeEntity | ScopeVirtualNode;\n\n// 节点内部的作用域\nexport type FlowNodeScope = Scope<FlowNodeScopeMeta>;\n","import { inject, optional, postConstruct } from 'inversify';\nimport { Scope, ScopeChain } from '@flowgram.ai/variable-core';\nimport { WorkflowNodeLinesData, WorkflowNodeMeta } from '@flowgram.ai/free-layout-core';\nimport {\n FlowNodeEntity,\n FlowDocument,\n FlowVirtualTree,\n FlowNodeBaseType,\n} from '@flowgram.ai/document';\nimport { EntityManager } from '@flowgram.ai/core';\n\nimport { VariableLayoutConfig } from '../variable-layout-config';\nimport { FlowNodeScope, FlowNodeScopeTypeEnum } from '../types';\nimport { ScopeChainTransformService } from '../services/scope-chain-transform-service';\nimport { GlobalScope } from '../scopes/global-scope';\nimport { FlowNodeVariableData } from '../flow-node-variable-data';\n\n/**\n * 自由布局作用域链实现\n */\nexport class FreeLayoutScopeChain extends ScopeChain {\n @inject(EntityManager) entityManager: EntityManager;\n\n @inject(FlowDocument)\n protected flowDocument: FlowDocument;\n\n @optional()\n @inject(VariableLayoutConfig)\n protected configs?: VariableLayoutConfig;\n\n @inject(ScopeChainTransformService)\n protected transformService: ScopeChainTransformService;\n\n get tree(): FlowVirtualTree<FlowNodeEntity> {\n return this.flowDocument.originTree;\n }\n\n @postConstruct()\n onInit() {\n this.toDispose.pushAll([\n // 线条发生变化时,会触发作用域链的更新\n this.entityManager.onEntityDataChange(({ entityDataType }) => {\n if (entityDataType === WorkflowNodeLinesData.type) {\n this.refreshAllChange();\n }\n }),\n // 树变化时候刷新作用域\n this.tree.onTreeChange(() => {\n this.refreshAllChange();\n }),\n ]);\n }\n\n // 获取同一层级所有输入节点\n protected getAllInputLayerNodes(curr: FlowNodeEntity): FlowNodeEntity[] {\n const currParent = this.getParent(curr);\n\n return (curr.getData(WorkflowNodeLinesData)?.allInputNodes || []).filter(\n (_node) => this.getParent(_node) === currParent\n );\n }\n\n // 获取同一层级所有输出节点\n protected getAllOutputLayerNodes(curr: FlowNodeEntity): FlowNodeEntity[] {\n const currParent = this.getParent(curr);\n\n return (curr.getData(WorkflowNodeLinesData)?.allOutputNodes || []).filter(\n (_node) => this.getParent(_node) === currParent\n );\n }\n\n getDeps(scope: FlowNodeScope): FlowNodeScope[] {\n const { node } = scope.meta || {};\n if (!node) {\n return this.transformService.transformDeps([], { scope });\n }\n\n const deps: FlowNodeScope[] = [];\n\n // 1. 找到依赖的节点\n let curr: FlowNodeEntity | undefined = node;\n\n while (curr) {\n const allInputNodes: FlowNodeEntity[] = this.getAllInputLayerNodes(curr);\n\n // 2. 获取所有依赖节点的 public 作用域\n deps.push(\n ...allInputNodes.map((_node) => _node.getData(FlowNodeVariableData).public).filter(Boolean)\n );\n\n // 父节点的 private 也可以访问\n const currVarData: FlowNodeVariableData = curr.getData(FlowNodeVariableData);\n if (currVarData?.private && scope !== currVarData.private) {\n deps.push(currVarData.private);\n }\n\n curr = this.getParent(curr);\n }\n\n // If scope is GlobalScope, add globalScope to deps\n const globalScope = this.variableEngine.getScopeById(GlobalScope.ID);\n if (globalScope) {\n deps.unshift(globalScope);\n }\n\n const uniqDeps = Array.from(new Set(deps));\n return this.transformService.transformDeps(uniqDeps, { scope });\n }\n\n getCovers(scope: FlowNodeScope): FlowNodeScope[] {\n // If scope is GlobalScope, return all scopes except GlobalScope\n if (GlobalScope.is(scope)) {\n return this.variableEngine\n .getAllScopes({ sort: true })\n .filter((_scope) => !GlobalScope.is(_scope));\n }\n\n const { node } = scope.meta || {};\n if (!node) {\n return this.transformService.transformCovers([], { scope });\n }\n\n const isPrivate = scope.meta.type === FlowNodeScopeTypeEnum.private;\n\n // 1. BFS 找到所有覆盖的节点\n const queue: FlowNodeEntity[] = [];\n\n if (isPrivate) {\n // private 只能覆盖其子节点\n queue.push(...this.getChildren(node));\n } else {\n // 否则覆盖其所有输出线的节点\n queue.push(...(this.getAllOutputLayerNodes(node) || []));\n }\n\n // 2. 获取所有覆盖节点的 public、private 作用域\n const scopes: FlowNodeScope[] = [];\n\n while (queue.length) {\n const _node = queue.shift()!;\n const variableData: FlowNodeVariableData = _node.getData(FlowNodeVariableData);\n scopes.push(...variableData.allScopes);\n const children = _node && this.getChildren(_node);\n\n if (children?.length) {\n queue.push(...children);\n }\n }\n\n // 3. 如果当前 scope 是 private,则当前节点的 public 也可覆盖\n const currentVariableData: FlowNodeVariableData = node.getData(FlowNodeVariableData);\n if (isPrivate && currentVariableData.public) {\n scopes.push(currentVariableData.public);\n }\n\n const uniqScopes = Array.from(new Set(scopes));\n\n return this.transformService.transformCovers(uniqScopes, { scope });\n }\n\n getChildren(node: FlowNodeEntity): FlowNodeEntity[] {\n if (this.configs?.getFreeChildren) {\n return this.configs.getFreeChildren?.(node);\n }\n const nodeMeta = node.getNodeMeta<WorkflowNodeMeta>();\n const subCanvas = nodeMeta.subCanvas?.(node);\n\n if (subCanvas) {\n // 子画布本身不存在 children\n if (subCanvas.isCanvas) {\n return [];\n } else {\n return subCanvas.canvasNode.collapsedChildren;\n }\n }\n\n // 部分场景通过连线来表达父子关系,因此需要上层配置\n return this.tree.getChildren(node);\n }\n\n getParent(node: FlowNodeEntity): FlowNodeEntity | undefined {\n // 部分场景通过连线来表达父子关系,因此需要上层配置\n if (this.configs?.getFreeParent) {\n return this.configs.getFreeParent(node);\n }\n let parent = node.document.originTree.getParent(node);\n\n // If currentParent is Group, get the parent of parent\n while (parent?.flowNodeType === FlowNodeBaseType.GROUP) {\n parent = parent.parent;\n }\n\n if (!parent) {\n return parent;\n }\n\n const nodeMeta = parent.getNodeMeta<WorkflowNodeMeta>();\n const subCanvas = nodeMeta.subCanvas?.(parent);\n if (subCanvas?.isCanvas) {\n // Get real parent node by subCanvas Configuration\n return subCanvas.parentNode;\n }\n\n return parent;\n }\n\n sortAll(): Scope[] {\n // 暂未实现\n console.warn('FreeLayoutScopeChain.sortAll is not implemented');\n return [];\n }\n}\n","import { FlowNodeEntity } from '@flowgram.ai/document';\n\nimport { type ScopeChainNode } from './types';\nimport { IScopeTransformer } from './services/scope-chain-transform-service';\n\nexport interface VariableLayoutConfig {\n /**\n * 节点的子节点输出变量,不能被后续节点所访问,用于固定布局场景\n * @param node\n * @returns\n */\n isNodeChildrenPrivate?: (node: ScopeChainNode) => boolean;\n\n /**\n * 用于自由画布场景,部分场景通过连线或者其他交互形式来表达节点之间的父子关系,需要可配置化\n */\n getFreeChildren?: (node: FlowNodeEntity) => FlowNodeEntity[];\n getFreeParent?: (node: FlowNodeEntity) => FlowNodeEntity | undefined;\n\n /**\n * @deprecated\n * 对依赖作用域进行微调\n */\n transformDeps?: IScopeTransformer;\n\n /**\n * @deprecated\n * 对依赖作用域进行微调\n */\n transformCovers?: IScopeTransformer;\n}\n\nexport const VariableLayoutConfig = Symbol('VariableLayoutConfig');\n","import { inject, injectable, optional } from 'inversify';\nimport { Scope, VariableEngine } from '@flowgram.ai/variable-core';\nimport { FlowDocument } from '@flowgram.ai/document';\nimport { lazyInject } from '@flowgram.ai/core';\n\nimport { VariableLayoutConfig } from '../variable-layout-config';\nimport { FlowNodeScope } from '../types';\n\nexport interface TransformerContext {\n scope: FlowNodeScope;\n document: FlowDocument;\n variableEngine: VariableEngine;\n}\n\nexport type IScopeTransformer = (scopes: Scope[], ctx: TransformerContext) => Scope[];\n\n@injectable()\nexport class ScopeChainTransformService {\n protected transformDepsFns: IScopeTransformer[] = [];\n\n protected transformCoversFns: IScopeTransformer[] = [];\n\n @lazyInject(FlowDocument) document: FlowDocument;\n\n @lazyInject(VariableEngine) variableEngine: VariableEngine;\n\n constructor(\n @optional()\n @inject(VariableLayoutConfig)\n protected configs?: VariableLayoutConfig\n ) {\n if (this.configs?.transformDeps) {\n this.transformDepsFns.push(this.configs.transformDeps);\n }\n if (this.configs?.transformCovers) {\n this.transformCoversFns.push(this.configs.transformCovers);\n }\n }\n\n registerTransformDeps(transformer: IScopeTransformer) {\n this.transformDepsFns.push(transformer);\n }\n\n registerTransformCovers(transformer: IScopeTransformer) {\n this.transformCoversFns.push(transformer);\n }\n\n transformDeps(scopes: Scope[], { scope }: { scope: Scope }): Scope[] {\n return this.transformDepsFns.reduce(\n (scopes, transformer) =>\n transformer(scopes, {\n scope,\n document: this.document,\n variableEngine: this.variableEngine,\n }),\n scopes\n );\n }\n\n transformCovers(scopes: Scope[], { scope }: { scope: Scope }): Scope[] {\n return this.transformCoversFns.reduce(\n (scopes, transformer) =>\n transformer(scopes, {\n scope,\n document: this.document,\n variableEngine: this.variableEngine,\n }),\n scopes\n );\n }\n}\n","import { injectable, interfaces } from 'inversify';\nimport { ASTNode, ASTNodeJSON, Scope, VariableEngine } from '@flowgram.ai/variable-core';\n\n@injectable()\nexport class GlobalScope extends Scope {\n static readonly ID = Symbol('GlobalScope');\n\n static is(scope: Scope): scope is GlobalScope {\n return scope.id === GlobalScope.ID;\n }\n\n /**\n * Sets a variable in the Global Scope with the given key and JSON value.\n *\n * @param key - The key under which the variable will be stored.\n * @param json - The JSON value to store.\n * @returns The updated AST node.\n */\n public setVar(key: string, json: ASTNodeJSON): ASTNode;\n\n /**\n * Sets a variable in the Global Scope with the default key 'outputs'.\n *\n * @param json - The JSON value to store.\n * @returns The updated AST node.\n */\n public setVar(json: ASTNodeJSON): ASTNode;\n\n public setVar(arg1: string | ASTNodeJSON, arg2?: ASTNodeJSON): ASTNode {\n if (typeof arg1 === 'string' && arg2 !== undefined) {\n return this.ast.set(arg1, arg2);\n }\n\n if (typeof arg1 === 'object' && arg2 === undefined) {\n return this.ast.set('outputs', arg1);\n }\n\n throw new Error('Invalid arguments');\n }\n\n /**\n * Retrieves a variable from the Global Scope by key.\n *\n * @param key - The key of the variable to retrieve. Defaults to 'outputs'.\n * @returns The value of the variable, or undefined if not found.\n */\n public getVar(key: string = 'outputs') {\n return this.ast.get(key);\n }\n\n /**\n * Clears a variable from the Global Scope by key.\n *\n * @param key - The key of the variable to clear. Defaults to 'outputs'.\n * @returns The updated AST node.\n */\n public clearVar(key: string = 'outputs') {\n return this.ast.remove(key);\n }\n}\n\nexport const bindGlobalScope = (bind: interfaces.Bind) => {\n bind(GlobalScope).toDynamicValue((ctx) => {\n const variableEngine = ctx.container.get(VariableEngine);\n let scope = variableEngine.getScopeById(GlobalScope.ID) as GlobalScope;\n\n if (!scope) {\n scope = variableEngine.createScope(\n GlobalScope.ID,\n {},\n { ScopeConstructor: GlobalScope }\n ) as GlobalScope;\n variableEngine.chain.refreshAllChange();\n }\n\n return scope;\n });\n};\n","import { inject, optional } from 'inversify';\nimport { Scope, ScopeChain } from '@flowgram.ai/variable-core';\nimport { FlowDocument, type FlowVirtualTree } from '@flowgram.ai/document';\nimport { FlowNodeEntity } from '@flowgram.ai/document';\n\nimport { VariableLayoutConfig } from '../variable-layout-config';\nimport { FlowNodeScope, FlowNodeScopeTypeEnum, ScopeChainNode } from '../types';\nimport { ScopeChainTransformService } from '../services/scope-chain-transform-service';\nimport { GlobalScope } from '../scopes/global-scope';\nimport { FlowNodeVariableData } from '../flow-node-variable-data';\n\n/**\n * 基于 FlowVirtualTree 的 ScopeOrder 实现\n */\nexport class FixedLayoutScopeChain extends ScopeChain {\n // 增加 { id: string } 使得可以灵活添加自定义虚拟节点\n tree: FlowVirtualTree<ScopeChainNode> | undefined;\n\n @inject(ScopeChainTransformService)\n protected transformService: ScopeChainTransformService;\n\n constructor(\n @inject(FlowDocument)\n protected flowDocument: FlowDocument,\n @optional()\n @inject(VariableLayoutConfig)\n protected configs?: VariableLayoutConfig\n ) {\n super();\n\n // 绑定 flowDocument 里面的树\n this.bindTree(flowDocument.originTree);\n\n // originTree 发生变化时,触发依赖关系的变化\n this.toDispose.push(\n // REFRACTOR: onTreeChange 触发时机精细化\n flowDocument.originTree.onTreeChange(() => {\n this.refreshAllChange();\n })\n );\n }\n\n // 绑定树\n bindTree(tree: FlowVirtualTree<ScopeChainNode>): void {\n this.tree = tree;\n }\n\n // 获取依赖作用域\n getDeps(scope: FlowNodeScope): FlowNodeScope[] {\n if (!this.tree) {\n return this.transformService.transformDeps([], { scope });\n }\n\n const node = scope.meta.node;\n if (!node) {\n return this.transformService.transformDeps([], { scope });\n }\n\n const deps: FlowNodeScope[] = [];\n\n let curr: ScopeChainNode | undefined = node;\n\n while (curr) {\n const { parent, pre } = this.tree.getInfo(curr);\n const currData = this.getVariableData(curr);\n\n // 包含子节点,且不是私有作用域\n\n if (curr === node) {\n // public 可以依赖 private\n if (scope.meta.type === FlowNodeScopeTypeEnum.public && currData?.private) {\n deps.unshift(currData.private);\n }\n } else if (this.hasChildren(curr) && !this.isNodeChildrenPrivate(curr)) {\n // 有子元素的节点,则将子元素纳入依赖作用域\n deps.unshift(\n ...this.getAllSortedChildScope(curr, {\n ignoreNodeChildrenPrivate: true,\n })\n );\n }\n\n // 节点的 public 都可以被访问\n if (currData && curr !== node) {\n deps.unshift(currData.public);\n }\n\n // 上个节点处理\n if (pre) {\n curr = pre;\n continue;\n }\n\n // 父节点处理\n if (parent) {\n let currParent: ScopeChainNode | undefined = parent;\n let currParentPre: ScopeChainNode | undefined = this.tree.getPre(currParent);\n\n while (currParent) {\n // 父节点的 private 和 public 都能被子节点访问\n const currParentData = this.getVariableData(currParent);\n if (currParentData) {\n deps.unshift(...currParentData.allScopes);\n }\n\n // 当前 parent 有 pre 节点,则停止向上查找\n if (currParentPre) {\n break;\n }\n\n currParent = this.tree.getParent(currParent);\n currParentPre = currParent ? this.tree.getPre(currParent) : undefined;\n }\n curr = currParentPre;\n continue;\n }\n\n // next 和 parent 都没有,直接结束循环\n curr = undefined;\n }\n\n // If scope is GlobalScope, add globalScope to deps\n const globalScope = this.variableEngine.getScopeById(GlobalScope.ID);\n if (globalScope) {\n deps.unshift(globalScope);\n }\n\n return this.transformService.transformDeps(deps, { scope });\n }\n\n // 获取覆盖作用域\n getCovers(scope: FlowNodeScope): FlowNodeScope[] {\n if (!this.tree) {\n return this.transformService.transformCovers([], { scope });\n }\n\n // If scope is GlobalScope, return all scopes except GlobalScope\n if (GlobalScope.is(scope)) {\n return this.variableEngine\n .getAllScopes({ sort: true })\n .filter((_scope) => !GlobalScope.is(_scope));\n }\n\n const node = scope.meta.node;\n if (!node) {\n return this.transformService.transformCovers([], { scope });\n }\n\n const covers: FlowNodeScope[] = [];\n\n // 如果是 private 作用域,则只能子节点访问\n if (scope.meta.type === FlowNodeScopeTypeEnum.private) {\n covers.push(\n ...this.getAllSortedChildScope(node, {\n addNodePrivateScope: true,\n })\n );\n return this.transformService.transformCovers(covers, { scope });\n }\n\n let curr: ScopeChainNode | undefined = node;\n\n while (curr) {\n const { next, parent } = this.tree.getInfo(curr);\n const currData = this.getVariableData(curr);\n\n // 有子元素的节点,则将子元素纳入覆盖作用域\n if (curr !== node) {\n if (this.hasChildren(curr)) {\n covers.push(\n ...this.getAllSortedChildScope(curr, {\n addNodePrivateScope: true,\n })\n );\n } else if (currData) {\n covers.push(...currData.allScopes);\n }\n }\n\n // 下个节点处理\n if (next) {\n curr = next;\n continue;\n }\n\n if (parent) {\n let currParent: ScopeChainNode | undefined = parent;\n let currParentNext: ScopeChainNode | undefined = this.tree.getNext(currParent);\n\n while (currParent) {\n // 私有作用域不能被后续节点访问\n if (this.isNodeChildrenPrivate(currParent)) {\n return this.transformService.transformCovers(covers, { scope });\n }\n\n // 当前 parent 有 next 节点,则停止向上查找\n if (currParentNext) {\n break;\n }\n\n currParent = this.tree.getParent(currParent);\n currParentNext = currParent ? this.tree.getNext(currParent) : undefined;\n }\n if (!currParentNext && currParent) {\n break;\n }\n\n curr = currParentNext;\n continue;\n }\n\n // next 和 parent 都没有,直接结束循环\n curr = undefined;\n }\n\n return this.transformService.transformCovers(covers, { scope });\n }\n\n // 排序所有作用域\n sortAll(): Scope[] {\n const startNode = this.flowDocument.getAllNodes().find((_node) => _node.isStart);\n if (!startNode) {\n return [];\n }\n\n const startVariableData = startNode.getData(FlowNodeVariableData);\n const startPublicScope = startVariableData.public;\n const deps = this.getDeps(startPublicScope);\n\n const covers = this.getCovers(startPublicScope).filter(\n (_scope) => !deps.includes(_scope) && _scope !== startPublicScope\n );\n\n return [...deps, startPublicScope, ...covers];\n }\n\n // 获取变量 Data 数据\n private getVariableData(node: ScopeChainNode): FlowNodeVariableData | undefined {\n if (node.flowNodeType === 'virtualNode') {\n return;\n }\n // TODO 包含 $ 的节点不注册 variableData\n if (node.id.startsWith('$')) {\n return;\n }\n\n return (node as FlowNodeEntity).getData(FlowNodeVariableData);\n }\n\n // privateScope:子节点不可以被后续节点访问\n private isNodeChildrenPrivate(node?: ScopeChainNode): boolean {\n if (this.configs?.isNodeChildrenPrivate) {\n return node ? this.configs?.isNodeChildrenPrivate(node) : false;\n }\n\n const isSystemNode = node?.id.startsWith('$');\n // 兜底:有子节点(节点 id 没有 $ 开头)的全部为私有作用域\n return !isSystemNode && this.hasChildren(node);\n }\n\n private hasChildren(node?: ScopeChainNode): boolean {\n return Boolean(this.tree && node && this.tree.getChildren(node).length > 0);\n }\n\n // 子节点按照顺序进行排序(含自身)\n private getAllSortedChildScope(\n node: ScopeChainNode,\n {\n ignoreNodeChildrenPrivate,\n addNodePrivateScope,\n }: { ignoreNodeChildrenPrivate?: boolean; addNodePrivateScope?: boolean } = {}\n ): FlowNodeScope[] {\n const scopes: FlowNodeScope[] = [];\n\n const variableData = this.getVariableData(node);\n\n if (variableData) {\n scopes.push(variableData.public);\n }\n\n // 私有作用域,子节点的变量不对外输出\n //(父节点如果存在 public 变量则对外输出)\n if (ignoreNodeChildrenPrivate && this.isNodeChildrenPrivate(node)) {\n return scopes;\n }\n\n if (addNodePrivateScope && variableData?.private) {\n scopes.push(variableData.private);\n }\n\n const children = this.tree?.getChildren(node) || [];\n scopes.push(\n ...children\n .map((child) =>\n this.getAllSortedChildScope(child, { ignoreNodeChildrenPrivate, addNodePrivateScope })\n )\n .flat()\n );\n\n return scopes;\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAGA,SAAS,kBAAkB;;;ACApB,IAAK,wBAAL,kBAAKA,2BAAL;AACL,EAAAA,uBAAA,YAAS;AACT,EAAAA,uBAAA,aAAU;AAFA,SAAAA;AAAA,GAAA;;;ADQL,IAAM,uBAAN,cAAmC,WAAW;AAAA,EAyInD,YAAY,QAAiC,MAAe;AAC1D,UAAM,MAAM;AAD+B;AAG3C,UAAM,EAAE,eAAe,IAAI,QAAQ,CAAC;AACpC,SAAK,iBAAiB;AACtB,SAAK,UAAU,KAAK,eAAe,YAAY,KAAK,OAAO,IAAI;AAAA,MAC7D,MAAM,KAAK;AAAA,MACX;AAAA,IACF,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injectable","VariableEngine","inject","FlowDocument","optional","inject","optional","ScopeChain","FlowDocument","ScopeChain","inject","FlowDocument","optional"]}
|
package/dist/index.d.mts
CHANGED
|
@@ -102,6 +102,24 @@ interface TransformerContext {
|
|
|
102
102
|
document: FlowDocument;
|
|
103
103
|
variableEngine: VariableEngine;
|
|
104
104
|
}
|
|
105
|
+
type IScopeTransformer = (scopes: Scope[], ctx: TransformerContext) => Scope[];
|
|
106
|
+
declare class ScopeChainTransformService {
|
|
107
|
+
protected configs?: VariableLayoutConfig | undefined;
|
|
108
|
+
protected transformDepsFns: IScopeTransformer[];
|
|
109
|
+
protected transformCoversFns: IScopeTransformer[];
|
|
110
|
+
document: FlowDocument;
|
|
111
|
+
variableEngine: VariableEngine;
|
|
112
|
+
constructor(configs?: VariableLayoutConfig | undefined);
|
|
113
|
+
registerTransformDeps(transformer: IScopeTransformer): void;
|
|
114
|
+
registerTransformCovers(transformer: IScopeTransformer): void;
|
|
115
|
+
transformDeps(scopes: Scope[], { scope }: {
|
|
116
|
+
scope: Scope;
|
|
117
|
+
}): Scope[];
|
|
118
|
+
transformCovers(scopes: Scope[], { scope }: {
|
|
119
|
+
scope: Scope;
|
|
120
|
+
}): Scope[];
|
|
121
|
+
}
|
|
122
|
+
|
|
105
123
|
interface VariableLayoutConfig {
|
|
106
124
|
/**
|
|
107
125
|
* 节点的子节点输出变量,不能被后续节点所访问,用于固定布局场景
|
|
@@ -115,13 +133,15 @@ interface VariableLayoutConfig {
|
|
|
115
133
|
getFreeChildren?: (node: FlowNodeEntity) => FlowNodeEntity[];
|
|
116
134
|
getFreeParent?: (node: FlowNodeEntity) => FlowNodeEntity | undefined;
|
|
117
135
|
/**
|
|
136
|
+
* @deprecated
|
|
118
137
|
* 对依赖作用域进行微调
|
|
119
138
|
*/
|
|
120
|
-
transformDeps?:
|
|
139
|
+
transformDeps?: IScopeTransformer;
|
|
121
140
|
/**
|
|
141
|
+
* @deprecated
|
|
122
142
|
* 对依赖作用域进行微调
|
|
123
143
|
*/
|
|
124
|
-
transformCovers?:
|
|
144
|
+
transformCovers?: IScopeTransformer;
|
|
125
145
|
}
|
|
126
146
|
declare const VariableLayoutConfig: unique symbol;
|
|
127
147
|
|
|
@@ -132,18 +152,13 @@ declare class FreeLayoutScopeChain extends ScopeChain {
|
|
|
132
152
|
entityManager: EntityManager;
|
|
133
153
|
protected flowDocument: FlowDocument;
|
|
134
154
|
protected configs?: VariableLayoutConfig;
|
|
155
|
+
protected transformService: ScopeChainTransformService;
|
|
135
156
|
get tree(): FlowVirtualTree<FlowNodeEntity>;
|
|
136
157
|
onInit(): void;
|
|
137
158
|
protected getAllInputLayerNodes(curr: FlowNodeEntity): FlowNodeEntity[];
|
|
138
159
|
protected getAllOutputLayerNodes(curr: FlowNodeEntity): FlowNodeEntity[];
|
|
139
160
|
getDeps(scope: FlowNodeScope): FlowNodeScope[];
|
|
140
161
|
getCovers(scope: FlowNodeScope): FlowNodeScope[];
|
|
141
|
-
protected transformCovers(covers: Scope[], { scope }: {
|
|
142
|
-
scope: Scope;
|
|
143
|
-
}): Scope[];
|
|
144
|
-
protected transformDeps(deps: Scope[], { scope }: {
|
|
145
|
-
scope: Scope;
|
|
146
|
-
}): Scope[];
|
|
147
162
|
getChildren(node: FlowNodeEntity): FlowNodeEntity[];
|
|
148
163
|
getParent(node: FlowNodeEntity): FlowNodeEntity | undefined;
|
|
149
164
|
sortAll(): Scope[];
|
|
@@ -156,16 +171,11 @@ declare class FixedLayoutScopeChain extends ScopeChain {
|
|
|
156
171
|
protected flowDocument: FlowDocument;
|
|
157
172
|
protected configs?: VariableLayoutConfig | undefined;
|
|
158
173
|
tree: FlowVirtualTree<ScopeChainNode> | undefined;
|
|
174
|
+
protected transformService: ScopeChainTransformService;
|
|
159
175
|
constructor(flowDocument: FlowDocument, configs?: VariableLayoutConfig | undefined);
|
|
160
176
|
bindTree(tree: FlowVirtualTree<ScopeChainNode>): void;
|
|
161
177
|
getDeps(scope: FlowNodeScope): FlowNodeScope[];
|
|
162
178
|
getCovers(scope: FlowNodeScope): FlowNodeScope[];
|
|
163
|
-
protected transformCovers(covers: Scope[], { scope }: {
|
|
164
|
-
scope: Scope;
|
|
165
|
-
}): Scope[];
|
|
166
|
-
protected transformDeps(deps: Scope[], { scope }: {
|
|
167
|
-
scope: Scope;
|
|
168
|
-
}): Scope[];
|
|
169
179
|
sortAll(): Scope[];
|
|
170
180
|
private getVariableData;
|
|
171
181
|
private isNodeChildrenPrivate;
|
|
@@ -208,4 +218,4 @@ declare class GlobalScope extends Scope {
|
|
|
208
218
|
}
|
|
209
219
|
declare const bindGlobalScope: (bind: interfaces.Bind) => void;
|
|
210
220
|
|
|
211
|
-
export { FixedLayoutScopeChain, type FlowNodeScope, type FlowNodeScopeMeta, FlowNodeScopeTypeEnum as FlowNodeScopeType, FlowNodeVariableData, FreeLayoutScopeChain, GlobalScope, VariableLayoutConfig, bindGlobalScope };
|
|
221
|
+
export { FixedLayoutScopeChain, type FlowNodeScope, type FlowNodeScopeMeta, FlowNodeScopeTypeEnum as FlowNodeScopeType, FlowNodeVariableData, FreeLayoutScopeChain, GlobalScope, ScopeChainTransformService, VariableLayoutConfig, bindGlobalScope };
|
package/dist/index.d.ts
CHANGED
|
@@ -102,6 +102,24 @@ interface TransformerContext {
|
|
|
102
102
|
document: FlowDocument;
|
|
103
103
|
variableEngine: VariableEngine;
|
|
104
104
|
}
|
|
105
|
+
type IScopeTransformer = (scopes: Scope[], ctx: TransformerContext) => Scope[];
|
|
106
|
+
declare class ScopeChainTransformService {
|
|
107
|
+
protected configs?: VariableLayoutConfig | undefined;
|
|
108
|
+
protected transformDepsFns: IScopeTransformer[];
|
|
109
|
+
protected transformCoversFns: IScopeTransformer[];
|
|
110
|
+
document: FlowDocument;
|
|
111
|
+
variableEngine: VariableEngine;
|
|
112
|
+
constructor(configs?: VariableLayoutConfig | undefined);
|
|
113
|
+
registerTransformDeps(transformer: IScopeTransformer): void;
|
|
114
|
+
registerTransformCovers(transformer: IScopeTransformer): void;
|
|
115
|
+
transformDeps(scopes: Scope[], { scope }: {
|
|
116
|
+
scope: Scope;
|
|
117
|
+
}): Scope[];
|
|
118
|
+
transformCovers(scopes: Scope[], { scope }: {
|
|
119
|
+
scope: Scope;
|
|
120
|
+
}): Scope[];
|
|
121
|
+
}
|
|
122
|
+
|
|
105
123
|
interface VariableLayoutConfig {
|
|
106
124
|
/**
|
|
107
125
|
* 节点的子节点输出变量,不能被后续节点所访问,用于固定布局场景
|
|
@@ -115,13 +133,15 @@ interface VariableLayoutConfig {
|
|
|
115
133
|
getFreeChildren?: (node: FlowNodeEntity) => FlowNodeEntity[];
|
|
116
134
|
getFreeParent?: (node: FlowNodeEntity) => FlowNodeEntity | undefined;
|
|
117
135
|
/**
|
|
136
|
+
* @deprecated
|
|
118
137
|
* 对依赖作用域进行微调
|
|
119
138
|
*/
|
|
120
|
-
transformDeps?:
|
|
139
|
+
transformDeps?: IScopeTransformer;
|
|
121
140
|
/**
|
|
141
|
+
* @deprecated
|
|
122
142
|
* 对依赖作用域进行微调
|
|
123
143
|
*/
|
|
124
|
-
transformCovers?:
|
|
144
|
+
transformCovers?: IScopeTransformer;
|
|
125
145
|
}
|
|
126
146
|
declare const VariableLayoutConfig: unique symbol;
|
|
127
147
|
|
|
@@ -132,18 +152,13 @@ declare class FreeLayoutScopeChain extends ScopeChain {
|
|
|
132
152
|
entityManager: EntityManager;
|
|
133
153
|
protected flowDocument: FlowDocument;
|
|
134
154
|
protected configs?: VariableLayoutConfig;
|
|
155
|
+
protected transformService: ScopeChainTransformService;
|
|
135
156
|
get tree(): FlowVirtualTree<FlowNodeEntity>;
|
|
136
157
|
onInit(): void;
|
|
137
158
|
protected getAllInputLayerNodes(curr: FlowNodeEntity): FlowNodeEntity[];
|
|
138
159
|
protected getAllOutputLayerNodes(curr: FlowNodeEntity): FlowNodeEntity[];
|
|
139
160
|
getDeps(scope: FlowNodeScope): FlowNodeScope[];
|
|
140
161
|
getCovers(scope: FlowNodeScope): FlowNodeScope[];
|
|
141
|
-
protected transformCovers(covers: Scope[], { scope }: {
|
|
142
|
-
scope: Scope;
|
|
143
|
-
}): Scope[];
|
|
144
|
-
protected transformDeps(deps: Scope[], { scope }: {
|
|
145
|
-
scope: Scope;
|
|
146
|
-
}): Scope[];
|
|
147
162
|
getChildren(node: FlowNodeEntity): FlowNodeEntity[];
|
|
148
163
|
getParent(node: FlowNodeEntity): FlowNodeEntity | undefined;
|
|
149
164
|
sortAll(): Scope[];
|
|
@@ -156,16 +171,11 @@ declare class FixedLayoutScopeChain extends ScopeChain {
|
|
|
156
171
|
protected flowDocument: FlowDocument;
|
|
157
172
|
protected configs?: VariableLayoutConfig | undefined;
|
|
158
173
|
tree: FlowVirtualTree<ScopeChainNode> | undefined;
|
|
174
|
+
protected transformService: ScopeChainTransformService;
|
|
159
175
|
constructor(flowDocument: FlowDocument, configs?: VariableLayoutConfig | undefined);
|
|
160
176
|
bindTree(tree: FlowVirtualTree<ScopeChainNode>): void;
|
|
161
177
|
getDeps(scope: FlowNodeScope): FlowNodeScope[];
|
|
162
178
|
getCovers(scope: FlowNodeScope): FlowNodeScope[];
|
|
163
|
-
protected transformCovers(covers: Scope[], { scope }: {
|
|
164
|
-
scope: Scope;
|
|
165
|
-
}): Scope[];
|
|
166
|
-
protected transformDeps(deps: Scope[], { scope }: {
|
|
167
|
-
scope: Scope;
|
|
168
|
-
}): Scope[];
|
|
169
179
|
sortAll(): Scope[];
|
|
170
180
|
private getVariableData;
|
|
171
181
|
private isNodeChildrenPrivate;
|
|
@@ -208,4 +218,4 @@ declare class GlobalScope extends Scope {
|
|
|
208
218
|
}
|
|
209
219
|
declare const bindGlobalScope: (bind: interfaces.Bind) => void;
|
|
210
220
|
|
|
211
|
-
export { FixedLayoutScopeChain, type FlowNodeScope, type FlowNodeScopeMeta, FlowNodeScopeTypeEnum as FlowNodeScopeType, FlowNodeVariableData, FreeLayoutScopeChain, GlobalScope, VariableLayoutConfig, bindGlobalScope };
|
|
221
|
+
export { FixedLayoutScopeChain, type FlowNodeScope, type FlowNodeScopeMeta, FlowNodeScopeTypeEnum as FlowNodeScopeType, FlowNodeVariableData, FreeLayoutScopeChain, GlobalScope, ScopeChainTransformService, VariableLayoutConfig, bindGlobalScope };
|
package/dist/index.js
CHANGED
|
@@ -34,6 +34,7 @@ __export(src_exports, {
|
|
|
34
34
|
FlowNodeVariableData: () => FlowNodeVariableData,
|
|
35
35
|
FreeLayoutScopeChain: () => FreeLayoutScopeChain,
|
|
36
36
|
GlobalScope: () => GlobalScope,
|
|
37
|
+
ScopeChainTransformService: () => ScopeChainTransformService,
|
|
37
38
|
VariableLayoutConfig: () => VariableLayoutConfig,
|
|
38
39
|
bindGlobalScope: () => bindGlobalScope
|
|
39
40
|
});
|
|
@@ -156,19 +157,75 @@ var FlowNodeVariableData = class extends import_core.EntityData {
|
|
|
156
157
|
FlowNodeVariableData.type = "FlowNodeVariableData";
|
|
157
158
|
|
|
158
159
|
// src/chains/free-layout-scope-chain.ts
|
|
159
|
-
var
|
|
160
|
-
var
|
|
160
|
+
var import_inversify3 = require("inversify");
|
|
161
|
+
var import_variable_core3 = require("@flowgram.ai/variable-core");
|
|
161
162
|
var import_free_layout_core = require("@flowgram.ai/free-layout-core");
|
|
162
|
-
var
|
|
163
|
-
var
|
|
163
|
+
var import_document2 = require("@flowgram.ai/document");
|
|
164
|
+
var import_core3 = require("@flowgram.ai/core");
|
|
164
165
|
|
|
165
166
|
// src/variable-layout-config.ts
|
|
166
167
|
var VariableLayoutConfig = Symbol("VariableLayoutConfig");
|
|
167
168
|
|
|
168
|
-
// src/
|
|
169
|
+
// src/services/scope-chain-transform-service.ts
|
|
169
170
|
var import_inversify = require("inversify");
|
|
170
171
|
var import_variable_core = require("@flowgram.ai/variable-core");
|
|
171
|
-
var
|
|
172
|
+
var import_document = require("@flowgram.ai/document");
|
|
173
|
+
var import_core2 = require("@flowgram.ai/core");
|
|
174
|
+
var ScopeChainTransformService = class {
|
|
175
|
+
constructor(configs) {
|
|
176
|
+
this.configs = configs;
|
|
177
|
+
this.transformDepsFns = [];
|
|
178
|
+
this.transformCoversFns = [];
|
|
179
|
+
if (this.configs?.transformDeps) {
|
|
180
|
+
this.transformDepsFns.push(this.configs.transformDeps);
|
|
181
|
+
}
|
|
182
|
+
if (this.configs?.transformCovers) {
|
|
183
|
+
this.transformCoversFns.push(this.configs.transformCovers);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
registerTransformDeps(transformer) {
|
|
187
|
+
this.transformDepsFns.push(transformer);
|
|
188
|
+
}
|
|
189
|
+
registerTransformCovers(transformer) {
|
|
190
|
+
this.transformCoversFns.push(transformer);
|
|
191
|
+
}
|
|
192
|
+
transformDeps(scopes, { scope }) {
|
|
193
|
+
return this.transformDepsFns.reduce(
|
|
194
|
+
(scopes2, transformer) => transformer(scopes2, {
|
|
195
|
+
scope,
|
|
196
|
+
document: this.document,
|
|
197
|
+
variableEngine: this.variableEngine
|
|
198
|
+
}),
|
|
199
|
+
scopes
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
transformCovers(scopes, { scope }) {
|
|
203
|
+
return this.transformCoversFns.reduce(
|
|
204
|
+
(scopes2, transformer) => transformer(scopes2, {
|
|
205
|
+
scope,
|
|
206
|
+
document: this.document,
|
|
207
|
+
variableEngine: this.variableEngine
|
|
208
|
+
}),
|
|
209
|
+
scopes
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
__decorateClass([
|
|
214
|
+
(0, import_core2.lazyInject)(import_document.FlowDocument)
|
|
215
|
+
], ScopeChainTransformService.prototype, "document", 2);
|
|
216
|
+
__decorateClass([
|
|
217
|
+
(0, import_core2.lazyInject)(import_variable_core.VariableEngine)
|
|
218
|
+
], ScopeChainTransformService.prototype, "variableEngine", 2);
|
|
219
|
+
ScopeChainTransformService = __decorateClass([
|
|
220
|
+
(0, import_inversify.injectable)(),
|
|
221
|
+
__decorateParam(0, (0, import_inversify.optional)()),
|
|
222
|
+
__decorateParam(0, (0, import_inversify.inject)(VariableLayoutConfig))
|
|
223
|
+
], ScopeChainTransformService);
|
|
224
|
+
|
|
225
|
+
// src/scopes/global-scope.ts
|
|
226
|
+
var import_inversify2 = require("inversify");
|
|
227
|
+
var import_variable_core2 = require("@flowgram.ai/variable-core");
|
|
228
|
+
var GlobalScope = class extends import_variable_core2.Scope {
|
|
172
229
|
static is(scope) {
|
|
173
230
|
return scope.id === GlobalScope.ID;
|
|
174
231
|
}
|
|
@@ -202,11 +259,11 @@ var GlobalScope = class extends import_variable_core.Scope {
|
|
|
202
259
|
};
|
|
203
260
|
GlobalScope.ID = Symbol("GlobalScope");
|
|
204
261
|
GlobalScope = __decorateClass([
|
|
205
|
-
(0,
|
|
262
|
+
(0, import_inversify2.injectable)()
|
|
206
263
|
], GlobalScope);
|
|
207
264
|
var bindGlobalScope = (bind) => {
|
|
208
265
|
bind(GlobalScope).toDynamicValue((ctx) => {
|
|
209
|
-
const variableEngine = ctx.container.get(
|
|
266
|
+
const variableEngine = ctx.container.get(import_variable_core2.VariableEngine);
|
|
210
267
|
let scope = variableEngine.getScopeById(GlobalScope.ID);
|
|
211
268
|
if (!scope) {
|
|
212
269
|
scope = variableEngine.createScope(
|
|
@@ -221,7 +278,7 @@ var bindGlobalScope = (bind) => {
|
|
|
221
278
|
};
|
|
222
279
|
|
|
223
280
|
// src/chains/free-layout-scope-chain.ts
|
|
224
|
-
var FreeLayoutScopeChain = class extends
|
|
281
|
+
var FreeLayoutScopeChain = class extends import_variable_core3.ScopeChain {
|
|
225
282
|
get tree() {
|
|
226
283
|
return this.flowDocument.originTree;
|
|
227
284
|
}
|
|
@@ -241,20 +298,22 @@ var FreeLayoutScopeChain = class extends import_variable_core2.ScopeChain {
|
|
|
241
298
|
}
|
|
242
299
|
// 获取同一层级所有输入节点
|
|
243
300
|
getAllInputLayerNodes(curr) {
|
|
301
|
+
const currParent = this.getParent(curr);
|
|
244
302
|
return (curr.getData(import_free_layout_core.WorkflowNodeLinesData)?.allInputNodes || []).filter(
|
|
245
|
-
(_node) => _node
|
|
303
|
+
(_node) => this.getParent(_node) === currParent
|
|
246
304
|
);
|
|
247
305
|
}
|
|
248
306
|
// 获取同一层级所有输出节点
|
|
249
307
|
getAllOutputLayerNodes(curr) {
|
|
308
|
+
const currParent = this.getParent(curr);
|
|
250
309
|
return (curr.getData(import_free_layout_core.WorkflowNodeLinesData)?.allOutputNodes || []).filter(
|
|
251
|
-
(_node) => _node
|
|
310
|
+
(_node) => this.getParent(_node) === currParent
|
|
252
311
|
);
|
|
253
312
|
}
|
|
254
313
|
getDeps(scope) {
|
|
255
314
|
const { node } = scope.meta || {};
|
|
256
315
|
if (!node) {
|
|
257
|
-
return this.transformDeps([], { scope });
|
|
316
|
+
return this.transformService.transformDeps([], { scope });
|
|
258
317
|
}
|
|
259
318
|
const deps = [];
|
|
260
319
|
let curr = node;
|
|
@@ -274,7 +333,7 @@ var FreeLayoutScopeChain = class extends import_variable_core2.ScopeChain {
|
|
|
274
333
|
deps.unshift(globalScope);
|
|
275
334
|
}
|
|
276
335
|
const uniqDeps = Array.from(new Set(deps));
|
|
277
|
-
return this.transformDeps(uniqDeps, { scope });
|
|
336
|
+
return this.transformService.transformDeps(uniqDeps, { scope });
|
|
278
337
|
}
|
|
279
338
|
getCovers(scope) {
|
|
280
339
|
if (GlobalScope.is(scope)) {
|
|
@@ -282,7 +341,7 @@ var FreeLayoutScopeChain = class extends import_variable_core2.ScopeChain {
|
|
|
282
341
|
}
|
|
283
342
|
const { node } = scope.meta || {};
|
|
284
343
|
if (!node) {
|
|
285
|
-
return this.transformCovers([], { scope });
|
|
344
|
+
return this.transformService.transformCovers([], { scope });
|
|
286
345
|
}
|
|
287
346
|
const isPrivate = scope.meta.type === "private" /* private */;
|
|
288
347
|
const queue = [];
|
|
@@ -306,21 +365,7 @@ var FreeLayoutScopeChain = class extends import_variable_core2.ScopeChain {
|
|
|
306
365
|
scopes.push(currentVariableData.public);
|
|
307
366
|
}
|
|
308
367
|
const uniqScopes = Array.from(new Set(scopes));
|
|
309
|
-
return this.transformCovers(uniqScopes, { scope });
|
|
310
|
-
}
|
|
311
|
-
transformCovers(covers, { scope }) {
|
|
312
|
-
return this.configs?.transformCovers ? this.configs.transformCovers(covers, {
|
|
313
|
-
scope,
|
|
314
|
-
document: this.flowDocument,
|
|
315
|
-
variableEngine: this.variableEngine
|
|
316
|
-
}) : covers;
|
|
317
|
-
}
|
|
318
|
-
transformDeps(deps, { scope }) {
|
|
319
|
-
return this.configs?.transformDeps ? this.configs.transformDeps(deps, {
|
|
320
|
-
scope,
|
|
321
|
-
document: this.flowDocument,
|
|
322
|
-
variableEngine: this.variableEngine
|
|
323
|
-
}) : deps;
|
|
368
|
+
return this.transformService.transformCovers(uniqScopes, { scope });
|
|
324
369
|
}
|
|
325
370
|
getChildren(node) {
|
|
326
371
|
if (this.configs?.getFreeChildren) {
|
|
@@ -341,16 +386,19 @@ var FreeLayoutScopeChain = class extends import_variable_core2.ScopeChain {
|
|
|
341
386
|
if (this.configs?.getFreeParent) {
|
|
342
387
|
return this.configs.getFreeParent(node);
|
|
343
388
|
}
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
389
|
+
let parent = node.document.originTree.getParent(node);
|
|
390
|
+
while (parent?.flowNodeType === import_document2.FlowNodeBaseType.GROUP) {
|
|
391
|
+
parent = parent.parent;
|
|
392
|
+
}
|
|
393
|
+
if (!parent) {
|
|
394
|
+
return parent;
|
|
347
395
|
}
|
|
348
|
-
const nodeMeta =
|
|
349
|
-
const subCanvas = nodeMeta.subCanvas?.(
|
|
396
|
+
const nodeMeta = parent.getNodeMeta();
|
|
397
|
+
const subCanvas = nodeMeta.subCanvas?.(parent);
|
|
350
398
|
if (subCanvas?.isCanvas) {
|
|
351
399
|
return subCanvas.parentNode;
|
|
352
400
|
}
|
|
353
|
-
return
|
|
401
|
+
return parent;
|
|
354
402
|
}
|
|
355
403
|
sortAll() {
|
|
356
404
|
console.warn("FreeLayoutScopeChain.sortAll is not implemented");
|
|
@@ -358,24 +406,27 @@ var FreeLayoutScopeChain = class extends import_variable_core2.ScopeChain {
|
|
|
358
406
|
}
|
|
359
407
|
};
|
|
360
408
|
__decorateClass([
|
|
361
|
-
(0,
|
|
409
|
+
(0, import_inversify3.inject)(import_core3.EntityManager)
|
|
362
410
|
], FreeLayoutScopeChain.prototype, "entityManager", 2);
|
|
363
411
|
__decorateClass([
|
|
364
|
-
(0,
|
|
412
|
+
(0, import_inversify3.inject)(import_document2.FlowDocument)
|
|
365
413
|
], FreeLayoutScopeChain.prototype, "flowDocument", 2);
|
|
366
414
|
__decorateClass([
|
|
367
|
-
(0,
|
|
368
|
-
(0,
|
|
415
|
+
(0, import_inversify3.optional)(),
|
|
416
|
+
(0, import_inversify3.inject)(VariableLayoutConfig)
|
|
369
417
|
], FreeLayoutScopeChain.prototype, "configs", 2);
|
|
370
418
|
__decorateClass([
|
|
371
|
-
(0,
|
|
419
|
+
(0, import_inversify3.inject)(ScopeChainTransformService)
|
|
420
|
+
], FreeLayoutScopeChain.prototype, "transformService", 2);
|
|
421
|
+
__decorateClass([
|
|
422
|
+
(0, import_inversify3.postConstruct)()
|
|
372
423
|
], FreeLayoutScopeChain.prototype, "onInit", 1);
|
|
373
424
|
|
|
374
425
|
// src/chains/fixed-layout-scope-chain.ts
|
|
375
|
-
var
|
|
376
|
-
var
|
|
377
|
-
var
|
|
378
|
-
var FixedLayoutScopeChain = class extends
|
|
426
|
+
var import_inversify4 = require("inversify");
|
|
427
|
+
var import_variable_core4 = require("@flowgram.ai/variable-core");
|
|
428
|
+
var import_document3 = require("@flowgram.ai/document");
|
|
429
|
+
var FixedLayoutScopeChain = class extends import_variable_core4.ScopeChain {
|
|
379
430
|
constructor(flowDocument, configs) {
|
|
380
431
|
super();
|
|
381
432
|
this.flowDocument = flowDocument;
|
|
@@ -395,11 +446,11 @@ var FixedLayoutScopeChain = class extends import_variable_core3.ScopeChain {
|
|
|
395
446
|
// 获取依赖作用域
|
|
396
447
|
getDeps(scope) {
|
|
397
448
|
if (!this.tree) {
|
|
398
|
-
return this.transformDeps([], { scope });
|
|
449
|
+
return this.transformService.transformDeps([], { scope });
|
|
399
450
|
}
|
|
400
451
|
const node = scope.meta.node;
|
|
401
452
|
if (!node) {
|
|
402
|
-
return this.transformDeps([], { scope });
|
|
453
|
+
return this.transformService.transformDeps([], { scope });
|
|
403
454
|
}
|
|
404
455
|
const deps = [];
|
|
405
456
|
let curr = node;
|
|
@@ -447,19 +498,19 @@ var FixedLayoutScopeChain = class extends import_variable_core3.ScopeChain {
|
|
|
447
498
|
if (globalScope) {
|
|
448
499
|
deps.unshift(globalScope);
|
|
449
500
|
}
|
|
450
|
-
return this.transformDeps(deps, { scope });
|
|
501
|
+
return this.transformService.transformDeps(deps, { scope });
|
|
451
502
|
}
|
|
452
503
|
// 获取覆盖作用域
|
|
453
504
|
getCovers(scope) {
|
|
454
505
|
if (!this.tree) {
|
|
455
|
-
return this.transformCovers([], { scope });
|
|
506
|
+
return this.transformService.transformCovers([], { scope });
|
|
456
507
|
}
|
|
457
508
|
if (GlobalScope.is(scope)) {
|
|
458
509
|
return this.variableEngine.getAllScopes({ sort: true }).filter((_scope) => !GlobalScope.is(_scope));
|
|
459
510
|
}
|
|
460
511
|
const node = scope.meta.node;
|
|
461
512
|
if (!node) {
|
|
462
|
-
return this.transformCovers([], { scope });
|
|
513
|
+
return this.transformService.transformCovers([], { scope });
|
|
463
514
|
}
|
|
464
515
|
const covers = [];
|
|
465
516
|
if (scope.meta.type === "private" /* private */) {
|
|
@@ -468,7 +519,7 @@ var FixedLayoutScopeChain = class extends import_variable_core3.ScopeChain {
|
|
|
468
519
|
addNodePrivateScope: true
|
|
469
520
|
})
|
|
470
521
|
);
|
|
471
|
-
return this.transformCovers(covers, { scope });
|
|
522
|
+
return this.transformService.transformCovers(covers, { scope });
|
|
472
523
|
}
|
|
473
524
|
let curr = node;
|
|
474
525
|
while (curr) {
|
|
@@ -494,7 +545,7 @@ var FixedLayoutScopeChain = class extends import_variable_core3.ScopeChain {
|
|
|
494
545
|
let currParentNext = this.tree.getNext(currParent);
|
|
495
546
|
while (currParent) {
|
|
496
547
|
if (this.isNodeChildrenPrivate(currParent)) {
|
|
497
|
-
return this.transformCovers(covers, { scope });
|
|
548
|
+
return this.transformService.transformCovers(covers, { scope });
|
|
498
549
|
}
|
|
499
550
|
if (currParentNext) {
|
|
500
551
|
break;
|
|
@@ -510,21 +561,7 @@ var FixedLayoutScopeChain = class extends import_variable_core3.ScopeChain {
|
|
|
510
561
|
}
|
|
511
562
|
curr = void 0;
|
|
512
563
|
}
|
|
513
|
-
return this.transformCovers(covers, { scope });
|
|
514
|
-
}
|
|
515
|
-
transformCovers(covers, { scope }) {
|
|
516
|
-
return this.configs?.transformCovers ? this.configs.transformCovers(covers, {
|
|
517
|
-
scope,
|
|
518
|
-
document: this.flowDocument,
|
|
519
|
-
variableEngine: this.variableEngine
|
|
520
|
-
}) : covers;
|
|
521
|
-
}
|
|
522
|
-
transformDeps(deps, { scope }) {
|
|
523
|
-
return this.configs?.transformDeps ? this.configs.transformDeps(deps, {
|
|
524
|
-
scope,
|
|
525
|
-
document: this.flowDocument,
|
|
526
|
-
variableEngine: this.variableEngine
|
|
527
|
-
}) : deps;
|
|
564
|
+
return this.transformService.transformCovers(covers, { scope });
|
|
528
565
|
}
|
|
529
566
|
// 排序所有作用域
|
|
530
567
|
sortAll() {
|
|
@@ -586,10 +623,13 @@ var FixedLayoutScopeChain = class extends import_variable_core3.ScopeChain {
|
|
|
586
623
|
return scopes;
|
|
587
624
|
}
|
|
588
625
|
};
|
|
626
|
+
__decorateClass([
|
|
627
|
+
(0, import_inversify4.inject)(ScopeChainTransformService)
|
|
628
|
+
], FixedLayoutScopeChain.prototype, "transformService", 2);
|
|
589
629
|
FixedLayoutScopeChain = __decorateClass([
|
|
590
|
-
__decorateParam(0, (0,
|
|
591
|
-
__decorateParam(1, (0,
|
|
592
|
-
__decorateParam(1, (0,
|
|
630
|
+
__decorateParam(0, (0, import_inversify4.inject)(import_document3.FlowDocument)),
|
|
631
|
+
__decorateParam(1, (0, import_inversify4.optional)()),
|
|
632
|
+
__decorateParam(1, (0, import_inversify4.inject)(VariableLayoutConfig))
|
|
593
633
|
], FixedLayoutScopeChain);
|
|
594
634
|
// Annotate the CommonJS export names for ESM import in node:
|
|
595
635
|
0 && (module.exports = {
|
|
@@ -598,6 +638,7 @@ FixedLayoutScopeChain = __decorateClass([
|
|
|
598
638
|
FlowNodeVariableData,
|
|
599
639
|
FreeLayoutScopeChain,
|
|
600
640
|
GlobalScope,
|
|
641
|
+
ScopeChainTransformService,
|
|
601
642
|
VariableLayoutConfig,
|
|
602
643
|
bindGlobalScope
|
|
603
644
|
});
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/flow-node-variable-data.ts","../src/types.ts","../src/chains/free-layout-scope-chain.ts","../src/variable-layout-config.ts","../src/scopes/global-scope.ts","../src/chains/fixed-layout-scope-chain.ts"],"sourcesContent":["export { FlowNodeVariableData } from './flow-node-variable-data';\nexport { FreeLayoutScopeChain } from './chains/free-layout-scope-chain';\nexport { VariableLayoutConfig } from './variable-layout-config';\nexport { FixedLayoutScopeChain } from './chains/fixed-layout-scope-chain';\nexport {\n type FlowNodeScopeMeta,\n type FlowNodeScope,\n FlowNodeScopeTypeEnum as FlowNodeScopeType,\n} from './types';\nexport { GlobalScope, bindGlobalScope } from './scopes/global-scope';\n","import { VariableEngine } from '@flowgram.ai/variable-core';\nimport { type ASTNode, ASTNodeJSON } from '@flowgram.ai/variable-core';\nimport { FlowNodeEntity } from '@flowgram.ai/document';\nimport { EntityData } from '@flowgram.ai/core';\n\nimport { FlowNodeScope, FlowNodeScopeMeta, FlowNodeScopeTypeEnum } from './types';\n\ninterface Options {\n variableEngine: VariableEngine;\n}\n\nexport class FlowNodeVariableData extends EntityData {\n static type: string = 'FlowNodeVariableData';\n\n declare entity: FlowNodeEntity;\n\n readonly variableEngine: VariableEngine;\n\n /**\n * Private variables can be accessed by public ones, but not the other way around.\n */\n protected _private?: FlowNodeScope;\n\n protected _public: FlowNodeScope;\n\n get private() {\n return this._private;\n }\n\n get public() {\n return this._public;\n }\n\n /**\n * Sets a variable in the public AST (Abstract Syntax Tree) with the given key and JSON value.\n *\n * @param key - The key under which the variable will be stored.\n * @param json - The JSON value to store.\n * @returns The updated AST node.\n */\n public setVar(key: string, json: ASTNodeJSON): ASTNode;\n\n /**\n * Sets a variable in the public AST (Abstract Syntax Tree) with the default key 'outputs'.\n *\n * @param json - The JSON value to store.\n * @returns The updated AST node.\n */\n public setVar(json: ASTNodeJSON): ASTNode;\n\n public setVar(arg1: string | ASTNodeJSON, arg2?: ASTNodeJSON): ASTNode {\n if (typeof arg1 === 'string' && arg2 !== undefined) {\n return this.public.ast.set(arg1, arg2);\n }\n\n if (typeof arg1 === 'object' && arg2 === undefined) {\n return this.public.ast.set('outputs', arg1);\n }\n\n throw new Error('Invalid arguments');\n }\n\n /**\n * Retrieves a variable from the public AST (Abstract Syntax Tree) by key.\n *\n * @param key - The key of the variable to retrieve. Defaults to 'outputs'.\n * @returns The value of the variable, or undefined if not found.\n */\n public getVar(key: string = 'outputs') {\n return this.public.ast.get(key);\n }\n\n /**\n * Clears a variable from the public AST (Abstract Syntax Tree) by key.\n *\n * @param key - The key of the variable to clear. Defaults to 'outputs'.\n * @returns The updated AST node.\n */\n public clearVar(key: string = 'outputs') {\n return this.public.ast.remove(key);\n }\n\n /**\n * Sets a variable in the private AST (Abstract Syntax Tree) with the given key and JSON value.\n *\n * @param key - The key under which the variable will be stored.\n * @param json - The JSON value to store.\n * @returns The updated AST node.\n */\n public setPrivateVar(key: string, json: ASTNodeJSON): ASTNode;\n\n /**\n * Sets a variable in the private AST (Abstract Syntax Tree) with the default key 'outputs'.\n *\n * @param json - The JSON value to store.\n * @returns The updated AST node.\n */\n public setPrivateVar(json: ASTNodeJSON): ASTNode;\n\n public setPrivateVar(arg1: string | ASTNodeJSON, arg2?: ASTNodeJSON): ASTNode {\n if (typeof arg1 === 'string' && arg2 !== undefined) {\n return this.initPrivate().ast.set(arg1, arg2);\n }\n\n if (typeof arg1 === 'object' && arg2 === undefined) {\n return this.initPrivate().ast.set('outputs', arg1);\n }\n\n throw new Error('Invalid arguments');\n }\n\n /**\n * Retrieves a variable from the private AST (Abstract Syntax Tree) by key.\n *\n * @param key - The key of the variable to retrieve. Defaults to 'outputs'.\n * @returns The value of the variable, or undefined if not found.\n */\n public getPrivateVar(key: string = 'outputs') {\n return this.private?.ast.get(key);\n }\n\n /**\n * Clears a variable from the private AST (Abstract Syntax Tree) by key.\n *\n * @param key - The key of the variable to clear. Defaults to 'outputs'.\n * @returns The updated AST node.\n */\n public clearPrivateVar(key: string = 'outputs') {\n return this.private?.ast.remove(key);\n }\n\n get allScopes(): FlowNodeScope[] {\n const res = [];\n\n if (this._public) {\n res.push(this._public);\n }\n if (this._private) {\n res.push(this._private);\n }\n\n return res;\n }\n\n getDefaultData() {\n return {};\n }\n\n constructor(entity: FlowNodeEntity, readonly opts: Options) {\n super(entity);\n\n const { variableEngine } = opts || {};\n this.variableEngine = variableEngine;\n this._public = this.variableEngine.createScope(this.entity.id, {\n node: this.entity,\n type: FlowNodeScopeTypeEnum.public,\n } as FlowNodeScopeMeta);\n this.toDispose.push(this._public);\n }\n\n initPrivate(): FlowNodeScope {\n if (!this._private) {\n this._private = this.variableEngine.createScope(`${this.entity.id}_private`, {\n node: this.entity,\n type: FlowNodeScopeTypeEnum.private,\n } as FlowNodeScopeMeta);\n // 1. Notify the covering scopes of private to update dependencies\n this._private.coverScopes.forEach((_scope) => {\n _scope.refreshDeps();\n });\n // 2. Notify the dependent scopes of private to update their covers\n this._private.depScopes.forEach((_scope) => {\n _scope.refreshCovers();\n });\n // 3. The private scope itself needs to refresh its dependencies\n this._private.available.refresh();\n\n this.toDispose.push(this._private);\n }\n return this._private;\n }\n}\n","import { Scope } from '@flowgram.ai/variable-core';\nimport { FlowNodeEntity } from '@flowgram.ai/document';\n\nexport enum FlowNodeScopeTypeEnum {\n public = 'public',\n private = 'private',\n}\n\nexport interface FlowNodeScopeMeta {\n node?: FlowNodeEntity;\n type?: FlowNodeScopeTypeEnum;\n}\n\nexport interface ScopeVirtualNode {\n id: string;\n flowNodeType: 'virtualNode';\n}\n\nexport type ScopeChainNode = FlowNodeEntity | ScopeVirtualNode;\n\n// 节点内部的作用域\nexport type FlowNodeScope = Scope<FlowNodeScopeMeta>;\n","import { inject, optional, postConstruct } from 'inversify';\nimport { Scope, ScopeChain } from '@flowgram.ai/variable-core';\nimport { WorkflowNodeLinesData, WorkflowNodeMeta } from '@flowgram.ai/free-layout-core';\nimport { FlowNodeEntity, FlowDocument, FlowVirtualTree } from '@flowgram.ai/document';\nimport { EntityManager } from '@flowgram.ai/core';\n\nimport { VariableLayoutConfig } from '../variable-layout-config';\nimport { FlowNodeScope, FlowNodeScopeTypeEnum } from '../types';\nimport { GlobalScope } from '../scopes/global-scope';\nimport { FlowNodeVariableData } from '../flow-node-variable-data';\n\n/**\n * 自由布局作用域链实现\n */\nexport class FreeLayoutScopeChain extends ScopeChain {\n @inject(EntityManager) entityManager: EntityManager;\n\n @inject(FlowDocument)\n protected flowDocument: FlowDocument;\n\n @optional()\n @inject(VariableLayoutConfig)\n protected configs?: VariableLayoutConfig;\n\n get tree(): FlowVirtualTree<FlowNodeEntity> {\n return this.flowDocument.originTree;\n }\n\n @postConstruct()\n onInit() {\n this.toDispose.pushAll([\n // 线条发生变化时,会触发作用域链的更新\n this.entityManager.onEntityDataChange(({ entityDataType }) => {\n if (entityDataType === WorkflowNodeLinesData.type) {\n this.refreshAllChange();\n }\n }),\n // 树变化时候刷新作用域\n this.tree.onTreeChange(() => {\n this.refreshAllChange();\n }),\n ]);\n }\n\n // 获取同一层级所有输入节点\n protected getAllInputLayerNodes(curr: FlowNodeEntity): FlowNodeEntity[] {\n return (curr.getData(WorkflowNodeLinesData)?.allInputNodes || []).filter(\n (_node) => _node.parent === curr.parent\n );\n }\n\n // 获取同一层级所有输出节点\n protected getAllOutputLayerNodes(curr: FlowNodeEntity): FlowNodeEntity[] {\n return (curr.getData(WorkflowNodeLinesData)?.allOutputNodes || []).filter(\n (_node) => _node.parent === curr.parent\n );\n }\n\n getDeps(scope: FlowNodeScope): FlowNodeScope[] {\n const { node } = scope.meta || {};\n if (!node) {\n return this.transformDeps([], { scope });\n }\n\n const deps: FlowNodeScope[] = [];\n\n // 1. 找到依赖的节点\n let curr: FlowNodeEntity | undefined = node;\n\n while (curr) {\n const allInputNodes: FlowNodeEntity[] = this.getAllInputLayerNodes(curr);\n\n // 2. 获取所有依赖节点的 public 作用域\n deps.push(\n ...allInputNodes.map((_node) => _node.getData(FlowNodeVariableData).public).filter(Boolean)\n );\n\n // 父节点的 private 也可以访问\n const currVarData: FlowNodeVariableData = curr.getData(FlowNodeVariableData);\n if (currVarData?.private && scope !== currVarData.private) {\n deps.push(currVarData.private);\n }\n\n curr = this.getParent(curr);\n }\n\n // If scope is GlobalScope, add globalScope to deps\n const globalScope = this.variableEngine.getScopeById(GlobalScope.ID);\n if (globalScope) {\n deps.unshift(globalScope);\n }\n\n const uniqDeps = Array.from(new Set(deps));\n return this.transformDeps(uniqDeps, { scope });\n }\n\n getCovers(scope: FlowNodeScope): FlowNodeScope[] {\n // If scope is GlobalScope, return all scopes except GlobalScope\n if (GlobalScope.is(scope)) {\n return this.variableEngine\n .getAllScopes({ sort: true })\n .filter((_scope) => !GlobalScope.is(_scope));\n }\n\n const { node } = scope.meta || {};\n if (!node) {\n return this.transformCovers([], { scope });\n }\n\n const isPrivate = scope.meta.type === FlowNodeScopeTypeEnum.private;\n\n // 1. BFS 找到所有覆盖的节点\n const queue: FlowNodeEntity[] = [];\n\n if (isPrivate) {\n // private 只能覆盖其子节点\n queue.push(...this.getChildren(node));\n } else {\n // 否则覆盖其所有输出线的节点\n queue.push(...(this.getAllOutputLayerNodes(node) || []));\n }\n\n // 2. 获取所有覆盖节点的 public、private 作用域\n const scopes: FlowNodeScope[] = [];\n\n while (queue.length) {\n const _node = queue.shift()!;\n const variableData: FlowNodeVariableData = _node.getData(FlowNodeVariableData);\n scopes.push(...variableData.allScopes);\n const children = _node && this.getChildren(_node);\n\n if (children?.length) {\n queue.push(...children);\n }\n }\n\n // 3. 如果当前 scope 是 private,则当前节点的 public 也可覆盖\n const currentVariableData: FlowNodeVariableData = node.getData(FlowNodeVariableData);\n if (isPrivate && currentVariableData.public) {\n scopes.push(currentVariableData.public);\n }\n\n const uniqScopes = Array.from(new Set(scopes));\n\n return this.transformCovers(uniqScopes, { scope });\n }\n\n protected transformCovers(covers: Scope[], { scope }: { scope: Scope }): Scope[] {\n return this.configs?.transformCovers\n ? this.configs.transformCovers(covers, {\n scope,\n document: this.flowDocument,\n variableEngine: this.variableEngine,\n })\n : covers;\n }\n\n protected transformDeps(deps: Scope[], { scope }: { scope: Scope }): Scope[] {\n return this.configs?.transformDeps\n ? this.configs.transformDeps(deps, {\n scope,\n document: this.flowDocument,\n variableEngine: this.variableEngine,\n })\n : deps;\n }\n\n getChildren(node: FlowNodeEntity): FlowNodeEntity[] {\n if (this.configs?.getFreeChildren) {\n return this.configs.getFreeChildren?.(node);\n }\n const nodeMeta = node.getNodeMeta<WorkflowNodeMeta>();\n const subCanvas = nodeMeta.subCanvas?.(node);\n\n if (subCanvas) {\n // 子画布本身不存在 children\n if (subCanvas.isCanvas) {\n return [];\n } else {\n return subCanvas.canvasNode.collapsedChildren;\n }\n }\n\n // 部分场景通过连线来表达父子关系,因此需要上层配置\n return this.tree.getChildren(node);\n }\n\n getParent(node: FlowNodeEntity): FlowNodeEntity | undefined {\n // 部分场景通过连线来表达父子关系,因此需要上层配置\n if (this.configs?.getFreeParent) {\n return this.configs.getFreeParent(node);\n }\n const initParent = node.document.originTree.getParent(node);\n\n if (!initParent) {\n return initParent;\n }\n\n const nodeMeta = initParent.getNodeMeta<WorkflowNodeMeta>();\n const subCanvas = nodeMeta.subCanvas?.(initParent);\n if (subCanvas?.isCanvas) {\n return subCanvas.parentNode;\n }\n\n return initParent;\n }\n\n sortAll(): Scope[] {\n // 暂未实现\n console.warn('FreeLayoutScopeChain.sortAll is not implemented');\n return [];\n }\n}\n","import { Scope } from '@flowgram.ai/variable-core';\nimport { VariableEngine } from '@flowgram.ai/variable-core';\nimport { FlowNodeEntity, FlowDocument } from '@flowgram.ai/document';\n\nimport { type FlowNodeScope, type ScopeChainNode } from './types';\n\ninterface TransformerContext {\n scope: FlowNodeScope;\n document: FlowDocument;\n variableEngine: VariableEngine;\n}\n\nexport interface VariableLayoutConfig {\n /**\n * 节点的子节点输出变量,不能被后续节点所访问,用于固定布局场景\n * @param node\n * @returns\n */\n isNodeChildrenPrivate?: (node: ScopeChainNode) => boolean;\n\n /**\n * 用于自由画布场景,部分场景通过连线或者其他交互形式来表达节点之间的父子关系,需要可配置化\n */\n getFreeChildren?: (node: FlowNodeEntity) => FlowNodeEntity[];\n getFreeParent?: (node: FlowNodeEntity) => FlowNodeEntity | undefined;\n\n /**\n * 对依赖作用域进行微调\n */\n transformDeps?: (scopes: Scope[], ctx: TransformerContext) => Scope[];\n\n /**\n * 对依赖作用域进行微调\n */\n transformCovers?: (scopes: Scope[], ctx: TransformerContext) => Scope[];\n}\n\nexport const VariableLayoutConfig = Symbol('VariableLayoutConfig');\n","import { injectable, interfaces } from 'inversify';\nimport { ASTNode, ASTNodeJSON, Scope, VariableEngine } from '@flowgram.ai/variable-core';\n\n@injectable()\nexport class GlobalScope extends Scope {\n static readonly ID = Symbol('GlobalScope');\n\n static is(scope: Scope): scope is GlobalScope {\n return scope.id === GlobalScope.ID;\n }\n\n /**\n * Sets a variable in the Global Scope with the given key and JSON value.\n *\n * @param key - The key under which the variable will be stored.\n * @param json - The JSON value to store.\n * @returns The updated AST node.\n */\n public setVar(key: string, json: ASTNodeJSON): ASTNode;\n\n /**\n * Sets a variable in the Global Scope with the default key 'outputs'.\n *\n * @param json - The JSON value to store.\n * @returns The updated AST node.\n */\n public setVar(json: ASTNodeJSON): ASTNode;\n\n public setVar(arg1: string | ASTNodeJSON, arg2?: ASTNodeJSON): ASTNode {\n if (typeof arg1 === 'string' && arg2 !== undefined) {\n return this.ast.set(arg1, arg2);\n }\n\n if (typeof arg1 === 'object' && arg2 === undefined) {\n return this.ast.set('outputs', arg1);\n }\n\n throw new Error('Invalid arguments');\n }\n\n /**\n * Retrieves a variable from the Global Scope by key.\n *\n * @param key - The key of the variable to retrieve. Defaults to 'outputs'.\n * @returns The value of the variable, or undefined if not found.\n */\n public getVar(key: string = 'outputs') {\n return this.ast.get(key);\n }\n\n /**\n * Clears a variable from the Global Scope by key.\n *\n * @param key - The key of the variable to clear. Defaults to 'outputs'.\n * @returns The updated AST node.\n */\n public clearVar(key: string = 'outputs') {\n return this.ast.remove(key);\n }\n}\n\nexport const bindGlobalScope = (bind: interfaces.Bind) => {\n bind(GlobalScope).toDynamicValue((ctx) => {\n const variableEngine = ctx.container.get(VariableEngine);\n let scope = variableEngine.getScopeById(GlobalScope.ID) as GlobalScope;\n\n if (!scope) {\n scope = variableEngine.createScope(\n GlobalScope.ID,\n {},\n { ScopeConstructor: GlobalScope }\n ) as GlobalScope;\n variableEngine.chain.refreshAllChange();\n }\n\n return scope;\n });\n};\n","import { inject, optional } from 'inversify';\nimport { Scope, ScopeChain } from '@flowgram.ai/variable-core';\nimport { FlowDocument, type FlowVirtualTree } from '@flowgram.ai/document';\nimport { FlowNodeEntity } from '@flowgram.ai/document';\n\nimport { VariableLayoutConfig } from '../variable-layout-config';\nimport { FlowNodeScope, FlowNodeScopeTypeEnum, ScopeChainNode } from '../types';\nimport { GlobalScope } from '../scopes/global-scope';\nimport { FlowNodeVariableData } from '../flow-node-variable-data';\n\n/**\n * 基于 FlowVirtualTree 的 ScopeOrder 实现\n */\nexport class FixedLayoutScopeChain extends ScopeChain {\n // 增加 { id: string } 使得可以灵活添加自定义虚拟节点\n tree: FlowVirtualTree<ScopeChainNode> | undefined;\n\n constructor(\n @inject(FlowDocument)\n protected flowDocument: FlowDocument,\n @optional()\n @inject(VariableLayoutConfig)\n protected configs?: VariableLayoutConfig\n ) {\n super();\n\n // 绑定 flowDocument 里面的树\n this.bindTree(flowDocument.originTree);\n\n // originTree 发生变化时,触发依赖关系的变化\n this.toDispose.push(\n // REFRACTOR: onTreeChange 触发时机精细化\n flowDocument.originTree.onTreeChange(() => {\n this.refreshAllChange();\n })\n );\n }\n\n // 绑定树\n bindTree(tree: FlowVirtualTree<ScopeChainNode>): void {\n this.tree = tree;\n }\n\n // 获取依赖作用域\n getDeps(scope: FlowNodeScope): FlowNodeScope[] {\n if (!this.tree) {\n return this.transformDeps([], { scope });\n }\n\n const node = scope.meta.node;\n if (!node) {\n return this.transformDeps([], { scope });\n }\n\n const deps: FlowNodeScope[] = [];\n\n let curr: ScopeChainNode | undefined = node;\n\n while (curr) {\n const { parent, pre } = this.tree.getInfo(curr);\n const currData = this.getVariableData(curr);\n\n // 包含子节点,且不是私有作用域\n\n if (curr === node) {\n // public 可以依赖 private\n if (scope.meta.type === FlowNodeScopeTypeEnum.public && currData?.private) {\n deps.unshift(currData.private);\n }\n } else if (this.hasChildren(curr) && !this.isNodeChildrenPrivate(curr)) {\n // 有子元素的节点,则将子元素纳入依赖作用域\n deps.unshift(\n ...this.getAllSortedChildScope(curr, {\n ignoreNodeChildrenPrivate: true,\n })\n );\n }\n\n // 节点的 public 都可以被访问\n if (currData && curr !== node) {\n deps.unshift(currData.public);\n }\n\n // 上个节点处理\n if (pre) {\n curr = pre;\n continue;\n }\n\n // 父节点处理\n if (parent) {\n let currParent: ScopeChainNode | undefined = parent;\n let currParentPre: ScopeChainNode | undefined = this.tree.getPre(currParent);\n\n while (currParent) {\n // 父节点的 private 和 public 都能被子节点访问\n const currParentData = this.getVariableData(currParent);\n if (currParentData) {\n deps.unshift(...currParentData.allScopes);\n }\n\n // 当前 parent 有 pre 节点,则停止向上查找\n if (currParentPre) {\n break;\n }\n\n currParent = this.tree.getParent(currParent);\n currParentPre = currParent ? this.tree.getPre(currParent) : undefined;\n }\n curr = currParentPre;\n continue;\n }\n\n // next 和 parent 都没有,直接结束循环\n curr = undefined;\n }\n\n // If scope is GlobalScope, add globalScope to deps\n const globalScope = this.variableEngine.getScopeById(GlobalScope.ID);\n if (globalScope) {\n deps.unshift(globalScope);\n }\n\n return this.transformDeps(deps, { scope });\n }\n\n // 获取覆盖作用域\n getCovers(scope: FlowNodeScope): FlowNodeScope[] {\n if (!this.tree) {\n return this.transformCovers([], { scope });\n }\n\n // If scope is GlobalScope, return all scopes except GlobalScope\n if (GlobalScope.is(scope)) {\n return this.variableEngine\n .getAllScopes({ sort: true })\n .filter((_scope) => !GlobalScope.is(_scope));\n }\n\n const node = scope.meta.node;\n if (!node) {\n return this.transformCovers([], { scope });\n }\n\n const covers: FlowNodeScope[] = [];\n\n // 如果是 private 作用域,则只能子节点访问\n if (scope.meta.type === FlowNodeScopeTypeEnum.private) {\n covers.push(\n ...this.getAllSortedChildScope(node, {\n addNodePrivateScope: true,\n })\n );\n return this.transformCovers(covers, { scope });\n }\n\n let curr: ScopeChainNode | undefined = node;\n\n while (curr) {\n const { next, parent } = this.tree.getInfo(curr);\n const currData = this.getVariableData(curr);\n\n // 有子元素的节点,则将子元素纳入覆盖作用域\n if (curr !== node) {\n if (this.hasChildren(curr)) {\n covers.push(\n ...this.getAllSortedChildScope(curr, {\n addNodePrivateScope: true,\n })\n );\n } else if (currData) {\n covers.push(...currData.allScopes);\n }\n }\n\n // 下个节点处理\n if (next) {\n curr = next;\n continue;\n }\n\n if (parent) {\n let currParent: ScopeChainNode | undefined = parent;\n let currParentNext: ScopeChainNode | undefined = this.tree.getNext(currParent);\n\n while (currParent) {\n // 私有作用域不能被后续节点访问\n if (this.isNodeChildrenPrivate(currParent)) {\n return this.transformCovers(covers, { scope });\n }\n\n // 当前 parent 有 next 节点,则停止向上查找\n if (currParentNext) {\n break;\n }\n\n currParent = this.tree.getParent(currParent);\n currParentNext = currParent ? this.tree.getNext(currParent) : undefined;\n }\n if (!currParentNext && currParent) {\n break;\n }\n\n curr = currParentNext;\n continue;\n }\n\n // next 和 parent 都没有,直接结束循环\n curr = undefined;\n }\n\n return this.transformCovers(covers, { scope });\n }\n\n protected transformCovers(covers: Scope[], { scope }: { scope: Scope }): Scope[] {\n return this.configs?.transformCovers\n ? this.configs.transformCovers(covers, {\n scope,\n document: this.flowDocument,\n variableEngine: this.variableEngine,\n })\n : covers;\n }\n\n protected transformDeps(deps: Scope[], { scope }: { scope: Scope }): Scope[] {\n return this.configs?.transformDeps\n ? this.configs.transformDeps(deps, {\n scope,\n document: this.flowDocument,\n variableEngine: this.variableEngine,\n })\n : deps;\n }\n\n // 排序所有作用域\n sortAll(): Scope[] {\n const startNode = this.flowDocument.getAllNodes().find((_node) => _node.isStart);\n if (!startNode) {\n return [];\n }\n\n const startVariableData = startNode.getData(FlowNodeVariableData);\n const startPublicScope = startVariableData.public;\n const deps = this.getDeps(startPublicScope);\n\n const covers = this.getCovers(startPublicScope).filter(\n (_scope) => !deps.includes(_scope) && _scope !== startPublicScope\n );\n\n return [...deps, startPublicScope, ...covers];\n }\n\n // 获取变量 Data 数据\n private getVariableData(node: ScopeChainNode): FlowNodeVariableData | undefined {\n if (node.flowNodeType === 'virtualNode') {\n return;\n }\n // TODO 包含 $ 的节点不注册 variableData\n if (node.id.startsWith('$')) {\n return;\n }\n\n return (node as FlowNodeEntity).getData(FlowNodeVariableData);\n }\n\n // privateScope:子节点不可以被后续节点访问\n private isNodeChildrenPrivate(node?: ScopeChainNode): boolean {\n if (this.configs?.isNodeChildrenPrivate) {\n return node ? this.configs?.isNodeChildrenPrivate(node) : false;\n }\n\n const isSystemNode = node?.id.startsWith('$');\n // 兜底:有子节点(节点 id 没有 $ 开头)的全部为私有作用域\n return !isSystemNode && this.hasChildren(node);\n }\n\n private hasChildren(node?: ScopeChainNode): boolean {\n return Boolean(this.tree && node && this.tree.getChildren(node).length > 0);\n }\n\n // 子节点按照顺序进行排序(含自身)\n private getAllSortedChildScope(\n node: ScopeChainNode,\n {\n ignoreNodeChildrenPrivate,\n addNodePrivateScope,\n }: { ignoreNodeChildrenPrivate?: boolean; addNodePrivateScope?: boolean } = {}\n ): FlowNodeScope[] {\n const scopes: FlowNodeScope[] = [];\n\n const variableData = this.getVariableData(node);\n\n if (variableData) {\n scopes.push(variableData.public);\n }\n\n // 私有作用域,子节点的变量不对外输出\n //(父节点如果存在 public 变量则对外输出)\n if (ignoreNodeChildrenPrivate && this.isNodeChildrenPrivate(node)) {\n return scopes;\n }\n\n if (addNodePrivateScope && variableData?.private) {\n scopes.push(variableData.private);\n }\n\n const children = this.tree?.getChildren(node) || [];\n scopes.push(\n ...children\n .map((child) =>\n this.getAllSortedChildScope(child, { ignoreNodeChildrenPrivate, addNodePrivateScope })\n )\n .flat()\n );\n\n return scopes;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGA,kBAA2B;;;ACApB,IAAK,wBAAL,kBAAKA,2BAAL;AACL,EAAAA,uBAAA,YAAS;AACT,EAAAA,uBAAA,aAAU;AAFA,SAAAA;AAAA,GAAA;;;ADQL,IAAM,uBAAN,cAAmC,uBAAW;AAAA,EAyInD,YAAY,QAAiC,MAAe;AAC1D,UAAM,MAAM;AAD+B;AAG3C,UAAM,EAAE,eAAe,IAAI,QAAQ,CAAC;AACpC,SAAK,iBAAiB;AACtB,SAAK,UAAU,KAAK,eAAe,YAAY,KAAK,OAAO,IAAI;AAAA,MAC7D,MAAM,KAAK;AAAA,MACX;AAAA,IACF,CAAsB;AACtB,SAAK,UAAU,KAAK,KAAK,OAAO;AAAA,EAClC;AAAA,EArIA,IAAI,UAAU;AACZ,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAI,SAAS;AACX,WAAO,KAAK;AAAA,EACd;AAAA,EAmBO,OAAO,MAA4B,MAA6B;AAC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T,iDAAO,oBAAoB;AAAA,GARnB;","names":["FlowNodeScopeTypeEnum","import_inversify","import_variable_core","import_core","import_inversify","import_variable_core","import_document"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/flow-node-variable-data.ts","../src/types.ts","../src/chains/free-layout-scope-chain.ts","../src/variable-layout-config.ts","../src/services/scope-chain-transform-service.ts","../src/scopes/global-scope.ts","../src/chains/fixed-layout-scope-chain.ts"],"sourcesContent":["export { FlowNodeVariableData } from './flow-node-variable-data';\nexport { FreeLayoutScopeChain } from './chains/free-layout-scope-chain';\nexport { VariableLayoutConfig } from './variable-layout-config';\nexport { FixedLayoutScopeChain } from './chains/fixed-layout-scope-chain';\nexport {\n type FlowNodeScopeMeta,\n type FlowNodeScope,\n FlowNodeScopeTypeEnum as FlowNodeScopeType,\n} from './types';\nexport { GlobalScope, bindGlobalScope } from './scopes/global-scope';\nexport { ScopeChainTransformService } from './services/scope-chain-transform-service';\n","import { VariableEngine } from '@flowgram.ai/variable-core';\nimport { type ASTNode, ASTNodeJSON } from '@flowgram.ai/variable-core';\nimport { FlowNodeEntity } from '@flowgram.ai/document';\nimport { EntityData } from '@flowgram.ai/core';\n\nimport { FlowNodeScope, FlowNodeScopeMeta, FlowNodeScopeTypeEnum } from './types';\n\ninterface Options {\n variableEngine: VariableEngine;\n}\n\nexport class FlowNodeVariableData extends EntityData {\n static type: string = 'FlowNodeVariableData';\n\n declare entity: FlowNodeEntity;\n\n readonly variableEngine: VariableEngine;\n\n /**\n * Private variables can be accessed by public ones, but not the other way around.\n */\n protected _private?: FlowNodeScope;\n\n protected _public: FlowNodeScope;\n\n get private() {\n return this._private;\n }\n\n get public() {\n return this._public;\n }\n\n /**\n * Sets a variable in the public AST (Abstract Syntax Tree) with the given key and JSON value.\n *\n * @param key - The key under which the variable will be stored.\n * @param json - The JSON value to store.\n * @returns The updated AST node.\n */\n public setVar(key: string, json: ASTNodeJSON): ASTNode;\n\n /**\n * Sets a variable in the public AST (Abstract Syntax Tree) with the default key 'outputs'.\n *\n * @param json - The JSON value to store.\n * @returns The updated AST node.\n */\n public setVar(json: ASTNodeJSON): ASTNode;\n\n public setVar(arg1: string | ASTNodeJSON, arg2?: ASTNodeJSON): ASTNode {\n if (typeof arg1 === 'string' && arg2 !== undefined) {\n return this.public.ast.set(arg1, arg2);\n }\n\n if (typeof arg1 === 'object' && arg2 === undefined) {\n return this.public.ast.set('outputs', arg1);\n }\n\n throw new Error('Invalid arguments');\n }\n\n /**\n * Retrieves a variable from the public AST (Abstract Syntax Tree) by key.\n *\n * @param key - The key of the variable to retrieve. Defaults to 'outputs'.\n * @returns The value of the variable, or undefined if not found.\n */\n public getVar(key: string = 'outputs') {\n return this.public.ast.get(key);\n }\n\n /**\n * Clears a variable from the public AST (Abstract Syntax Tree) by key.\n *\n * @param key - The key of the variable to clear. Defaults to 'outputs'.\n * @returns The updated AST node.\n */\n public clearVar(key: string = 'outputs') {\n return this.public.ast.remove(key);\n }\n\n /**\n * Sets a variable in the private AST (Abstract Syntax Tree) with the given key and JSON value.\n *\n * @param key - The key under which the variable will be stored.\n * @param json - The JSON value to store.\n * @returns The updated AST node.\n */\n public setPrivateVar(key: string, json: ASTNodeJSON): ASTNode;\n\n /**\n * Sets a variable in the private AST (Abstract Syntax Tree) with the default key 'outputs'.\n *\n * @param json - The JSON value to store.\n * @returns The updated AST node.\n */\n public setPrivateVar(json: ASTNodeJSON): ASTNode;\n\n public setPrivateVar(arg1: string | ASTNodeJSON, arg2?: ASTNodeJSON): ASTNode {\n if (typeof arg1 === 'string' && arg2 !== undefined) {\n return this.initPrivate().ast.set(arg1, arg2);\n }\n\n if (typeof arg1 === 'object' && arg2 === undefined) {\n return this.initPrivate().ast.set('outputs', arg1);\n }\n\n throw new Error('Invalid arguments');\n }\n\n /**\n * Retrieves a variable from the private AST (Abstract Syntax Tree) by key.\n *\n * @param key - The key of the variable to retrieve. Defaults to 'outputs'.\n * @returns The value of the variable, or undefined if not found.\n */\n public getPrivateVar(key: string = 'outputs') {\n return this.private?.ast.get(key);\n }\n\n /**\n * Clears a variable from the private AST (Abstract Syntax Tree) by key.\n *\n * @param key - The key of the variable to clear. Defaults to 'outputs'.\n * @returns The updated AST node.\n */\n public clearPrivateVar(key: string = 'outputs') {\n return this.private?.ast.remove(key);\n }\n\n get allScopes(): FlowNodeScope[] {\n const res = [];\n\n if (this._public) {\n res.push(this._public);\n }\n if (this._private) {\n res.push(this._private);\n }\n\n return res;\n }\n\n getDefaultData() {\n return {};\n }\n\n constructor(entity: FlowNodeEntity, readonly opts: Options) {\n super(entity);\n\n const { variableEngine } = opts || {};\n this.variableEngine = variableEngine;\n this._public = this.variableEngine.createScope(this.entity.id, {\n node: this.entity,\n type: FlowNodeScopeTypeEnum.public,\n } as FlowNodeScopeMeta);\n this.toDispose.push(this._public);\n }\n\n initPrivate(): FlowNodeScope {\n if (!this._private) {\n this._private = this.variableEngine.createScope(`${this.entity.id}_private`, {\n node: this.entity,\n type: FlowNodeScopeTypeEnum.private,\n } as FlowNodeScopeMeta);\n // 1. Notify the covering scopes of private to update dependencies\n this._private.coverScopes.forEach((_scope) => {\n _scope.refreshDeps();\n });\n // 2. Notify the dependent scopes of private to update their covers\n this._private.depScopes.forEach((_scope) => {\n _scope.refreshCovers();\n });\n // 3. The private scope itself needs to refresh its dependencies\n this._private.available.refresh();\n\n this.toDispose.push(this._private);\n }\n return this._private;\n }\n}\n","import { Scope } from '@flowgram.ai/variable-core';\nimport { FlowNodeEntity } from '@flowgram.ai/document';\n\nexport enum FlowNodeScopeTypeEnum {\n public = 'public',\n private = 'private',\n}\n\nexport interface FlowNodeScopeMeta {\n node?: FlowNodeEntity;\n type?: FlowNodeScopeTypeEnum;\n}\n\nexport interface ScopeVirtualNode {\n id: string;\n flowNodeType: 'virtualNode';\n}\n\nexport type ScopeChainNode = FlowNodeEntity | ScopeVirtualNode;\n\n// 节点内部的作用域\nexport type FlowNodeScope = Scope<FlowNodeScopeMeta>;\n","import { inject, optional, postConstruct } from 'inversify';\nimport { Scope, ScopeChain } from '@flowgram.ai/variable-core';\nimport { WorkflowNodeLinesData, WorkflowNodeMeta } from '@flowgram.ai/free-layout-core';\nimport {\n FlowNodeEntity,\n FlowDocument,\n FlowVirtualTree,\n FlowNodeBaseType,\n} from '@flowgram.ai/document';\nimport { EntityManager } from '@flowgram.ai/core';\n\nimport { VariableLayoutConfig } from '../variable-layout-config';\nimport { FlowNodeScope, FlowNodeScopeTypeEnum } from '../types';\nimport { ScopeChainTransformService } from '../services/scope-chain-transform-service';\nimport { GlobalScope } from '../scopes/global-scope';\nimport { FlowNodeVariableData } from '../flow-node-variable-data';\n\n/**\n * 自由布局作用域链实现\n */\nexport class FreeLayoutScopeChain extends ScopeChain {\n @inject(EntityManager) entityManager: EntityManager;\n\n @inject(FlowDocument)\n protected flowDocument: FlowDocument;\n\n @optional()\n @inject(VariableLayoutConfig)\n protected configs?: VariableLayoutConfig;\n\n @inject(ScopeChainTransformService)\n protected transformService: ScopeChainTransformService;\n\n get tree(): FlowVirtualTree<FlowNodeEntity> {\n return this.flowDocument.originTree;\n }\n\n @postConstruct()\n onInit() {\n this.toDispose.pushAll([\n // 线条发生变化时,会触发作用域链的更新\n this.entityManager.onEntityDataChange(({ entityDataType }) => {\n if (entityDataType === WorkflowNodeLinesData.type) {\n this.refreshAllChange();\n }\n }),\n // 树变化时候刷新作用域\n this.tree.onTreeChange(() => {\n this.refreshAllChange();\n }),\n ]);\n }\n\n // 获取同一层级所有输入节点\n protected getAllInputLayerNodes(curr: FlowNodeEntity): FlowNodeEntity[] {\n const currParent = this.getParent(curr);\n\n return (curr.getData(WorkflowNodeLinesData)?.allInputNodes || []).filter(\n (_node) => this.getParent(_node) === currParent\n );\n }\n\n // 获取同一层级所有输出节点\n protected getAllOutputLayerNodes(curr: FlowNodeEntity): FlowNodeEntity[] {\n const currParent = this.getParent(curr);\n\n return (curr.getData(WorkflowNodeLinesData)?.allOutputNodes || []).filter(\n (_node) => this.getParent(_node) === currParent\n );\n }\n\n getDeps(scope: FlowNodeScope): FlowNodeScope[] {\n const { node } = scope.meta || {};\n if (!node) {\n return this.transformService.transformDeps([], { scope });\n }\n\n const deps: FlowNodeScope[] = [];\n\n // 1. 找到依赖的节点\n let curr: FlowNodeEntity | undefined = node;\n\n while (curr) {\n const allInputNodes: FlowNodeEntity[] = this.getAllInputLayerNodes(curr);\n\n // 2. 获取所有依赖节点的 public 作用域\n deps.push(\n ...allInputNodes.map((_node) => _node.getData(FlowNodeVariableData).public).filter(Boolean)\n );\n\n // 父节点的 private 也可以访问\n const currVarData: FlowNodeVariableData = curr.getData(FlowNodeVariableData);\n if (currVarData?.private && scope !== currVarData.private) {\n deps.push(currVarData.private);\n }\n\n curr = this.getParent(curr);\n }\n\n // If scope is GlobalScope, add globalScope to deps\n const globalScope = this.variableEngine.getScopeById(GlobalScope.ID);\n if (globalScope) {\n deps.unshift(globalScope);\n }\n\n const uniqDeps = Array.from(new Set(deps));\n return this.transformService.transformDeps(uniqDeps, { scope });\n }\n\n getCovers(scope: FlowNodeScope): FlowNodeScope[] {\n // If scope is GlobalScope, return all scopes except GlobalScope\n if (GlobalScope.is(scope)) {\n return this.variableEngine\n .getAllScopes({ sort: true })\n .filter((_scope) => !GlobalScope.is(_scope));\n }\n\n const { node } = scope.meta || {};\n if (!node) {\n return this.transformService.transformCovers([], { scope });\n }\n\n const isPrivate = scope.meta.type === FlowNodeScopeTypeEnum.private;\n\n // 1. BFS 找到所有覆盖的节点\n const queue: FlowNodeEntity[] = [];\n\n if (isPrivate) {\n // private 只能覆盖其子节点\n queue.push(...this.getChildren(node));\n } else {\n // 否则覆盖其所有输出线的节点\n queue.push(...(this.getAllOutputLayerNodes(node) || []));\n }\n\n // 2. 获取所有覆盖节点的 public、private 作用域\n const scopes: FlowNodeScope[] = [];\n\n while (queue.length) {\n const _node = queue.shift()!;\n const variableData: FlowNodeVariableData = _node.getData(FlowNodeVariableData);\n scopes.push(...variableData.allScopes);\n const children = _node && this.getChildren(_node);\n\n if (children?.length) {\n queue.push(...children);\n }\n }\n\n // 3. 如果当前 scope 是 private,则当前节点的 public 也可覆盖\n const currentVariableData: FlowNodeVariableData = node.getData(FlowNodeVariableData);\n if (isPrivate && currentVariableData.public) {\n scopes.push(currentVariableData.public);\n }\n\n const uniqScopes = Array.from(new Set(scopes));\n\n return this.transformService.transformCovers(uniqScopes, { scope });\n }\n\n getChildren(node: FlowNodeEntity): FlowNodeEntity[] {\n if (this.configs?.getFreeChildren) {\n return this.configs.getFreeChildren?.(node);\n }\n const nodeMeta = node.getNodeMeta<WorkflowNodeMeta>();\n const subCanvas = nodeMeta.subCanvas?.(node);\n\n if (subCanvas) {\n // 子画布本身不存在 children\n if (subCanvas.isCanvas) {\n return [];\n } else {\n return subCanvas.canvasNode.collapsedChildren;\n }\n }\n\n // 部分场景通过连线来表达父子关系,因此需要上层配置\n return this.tree.getChildren(node);\n }\n\n getParent(node: FlowNodeEntity): FlowNodeEntity | undefined {\n // 部分场景通过连线来表达父子关系,因此需要上层配置\n if (this.configs?.getFreeParent) {\n return this.configs.getFreeParent(node);\n }\n let parent = node.document.originTree.getParent(node);\n\n // If currentParent is Group, get the parent of parent\n while (parent?.flowNodeType === FlowNodeBaseType.GROUP) {\n parent = parent.parent;\n }\n\n if (!parent) {\n return parent;\n }\n\n const nodeMeta = parent.getNodeMeta<WorkflowNodeMeta>();\n const subCanvas = nodeMeta.subCanvas?.(parent);\n if (subCanvas?.isCanvas) {\n // Get real parent node by subCanvas Configuration\n return subCanvas.parentNode;\n }\n\n return parent;\n }\n\n sortAll(): Scope[] {\n // 暂未实现\n console.warn('FreeLayoutScopeChain.sortAll is not implemented');\n return [];\n }\n}\n","import { FlowNodeEntity } from '@flowgram.ai/document';\n\nimport { type ScopeChainNode } from './types';\nimport { IScopeTransformer } from './services/scope-chain-transform-service';\n\nexport interface VariableLayoutConfig {\n /**\n * 节点的子节点输出变量,不能被后续节点所访问,用于固定布局场景\n * @param node\n * @returns\n */\n isNodeChildrenPrivate?: (node: ScopeChainNode) => boolean;\n\n /**\n * 用于自由画布场景,部分场景通过连线或者其他交互形式来表达节点之间的父子关系,需要可配置化\n */\n getFreeChildren?: (node: FlowNodeEntity) => FlowNodeEntity[];\n getFreeParent?: (node: FlowNodeEntity) => FlowNodeEntity | undefined;\n\n /**\n * @deprecated\n * 对依赖作用域进行微调\n */\n transformDeps?: IScopeTransformer;\n\n /**\n * @deprecated\n * 对依赖作用域进行微调\n */\n transformCovers?: IScopeTransformer;\n}\n\nexport const VariableLayoutConfig = Symbol('VariableLayoutConfig');\n","import { inject, injectable, optional } from 'inversify';\nimport { Scope, VariableEngine } from '@flowgram.ai/variable-core';\nimport { FlowDocument } from '@flowgram.ai/document';\nimport { lazyInject } from '@flowgram.ai/core';\n\nimport { VariableLayoutConfig } from '../variable-layout-config';\nimport { FlowNodeScope } from '../types';\n\nexport interface TransformerContext {\n scope: FlowNodeScope;\n document: FlowDocument;\n variableEngine: VariableEngine;\n}\n\nexport type IScopeTransformer = (scopes: Scope[], ctx: TransformerContext) => Scope[];\n\n@injectable()\nexport class ScopeChainTransformService {\n protected transformDepsFns: IScopeTransformer[] = [];\n\n protected transformCoversFns: IScopeTransformer[] = [];\n\n @lazyInject(FlowDocument) document: FlowDocument;\n\n @lazyInject(VariableEngine) variableEngine: VariableEngine;\n\n constructor(\n @optional()\n @inject(VariableLayoutConfig)\n protected configs?: VariableLayoutConfig\n ) {\n if (this.configs?.transformDeps) {\n this.transformDepsFns.push(this.configs.transformDeps);\n }\n if (this.configs?.transformCovers) {\n this.transformCoversFns.push(this.configs.transformCovers);\n }\n }\n\n registerTransformDeps(transformer: IScopeTransformer) {\n this.transformDepsFns.push(transformer);\n }\n\n registerTransformCovers(transformer: IScopeTransformer) {\n this.transformCoversFns.push(transformer);\n }\n\n transformDeps(scopes: Scope[], { scope }: { scope: Scope }): Scope[] {\n return this.transformDepsFns.reduce(\n (scopes, transformer) =>\n transformer(scopes, {\n scope,\n document: this.document,\n variableEngine: this.variableEngine,\n }),\n scopes\n );\n }\n\n transformCovers(scopes: Scope[], { scope }: { scope: Scope }): Scope[] {\n return this.transformCoversFns.reduce(\n (scopes, transformer) =>\n transformer(scopes, {\n scope,\n document: this.document,\n variableEngine: this.variableEngine,\n }),\n scopes\n );\n }\n}\n","import { injectable, interfaces } from 'inversify';\nimport { ASTNode, ASTNodeJSON, Scope, VariableEngine } from '@flowgram.ai/variable-core';\n\n@injectable()\nexport class GlobalScope extends Scope {\n static readonly ID = Symbol('GlobalScope');\n\n static is(scope: Scope): scope is GlobalScope {\n return scope.id === GlobalScope.ID;\n }\n\n /**\n * Sets a variable in the Global Scope with the given key and JSON value.\n *\n * @param key - The key under which the variable will be stored.\n * @param json - The JSON value to store.\n * @returns The updated AST node.\n */\n public setVar(key: string, json: ASTNodeJSON): ASTNode;\n\n /**\n * Sets a variable in the Global Scope with the default key 'outputs'.\n *\n * @param json - The JSON value to store.\n * @returns The updated AST node.\n */\n public setVar(json: ASTNodeJSON): ASTNode;\n\n public setVar(arg1: string | ASTNodeJSON, arg2?: ASTNodeJSON): ASTNode {\n if (typeof arg1 === 'string' && arg2 !== undefined) {\n return this.ast.set(arg1, arg2);\n }\n\n if (typeof arg1 === 'object' && arg2 === undefined) {\n return this.ast.set('outputs', arg1);\n }\n\n throw new Error('Invalid arguments');\n }\n\n /**\n * Retrieves a variable from the Global Scope by key.\n *\n * @param key - The key of the variable to retrieve. Defaults to 'outputs'.\n * @returns The value of the variable, or undefined if not found.\n */\n public getVar(key: string = 'outputs') {\n return this.ast.get(key);\n }\n\n /**\n * Clears a variable from the Global Scope by key.\n *\n * @param key - The key of the variable to clear. Defaults to 'outputs'.\n * @returns The updated AST node.\n */\n public clearVar(key: string = 'outputs') {\n return this.ast.remove(key);\n }\n}\n\nexport const bindGlobalScope = (bind: interfaces.Bind) => {\n bind(GlobalScope).toDynamicValue((ctx) => {\n const variableEngine = ctx.container.get(VariableEngine);\n let scope = variableEngine.getScopeById(GlobalScope.ID) as GlobalScope;\n\n if (!scope) {\n scope = variableEngine.createScope(\n GlobalScope.ID,\n {},\n { ScopeConstructor: GlobalScope }\n ) as GlobalScope;\n variableEngine.chain.refreshAllChange();\n }\n\n return scope;\n });\n};\n","import { inject, optional } from 'inversify';\nimport { Scope, ScopeChain } from '@flowgram.ai/variable-core';\nimport { FlowDocument, type FlowVirtualTree } from '@flowgram.ai/document';\nimport { FlowNodeEntity } from '@flowgram.ai/document';\n\nimport { VariableLayoutConfig } from '../variable-layout-config';\nimport { FlowNodeScope, FlowNodeScopeTypeEnum, ScopeChainNode } from '../types';\nimport { ScopeChainTransformService } from '../services/scope-chain-transform-service';\nimport { GlobalScope } from '../scopes/global-scope';\nimport { FlowNodeVariableData } from '../flow-node-variable-data';\n\n/**\n * 基于 FlowVirtualTree 的 ScopeOrder 实现\n */\nexport class FixedLayoutScopeChain extends ScopeChain {\n // 增加 { id: string } 使得可以灵活添加自定义虚拟节点\n tree: FlowVirtualTree<ScopeChainNode> | undefined;\n\n @inject(ScopeChainTransformService)\n protected transformService: ScopeChainTransformService;\n\n constructor(\n @inject(FlowDocument)\n protected flowDocument: FlowDocument,\n @optional()\n @inject(VariableLayoutConfig)\n protected configs?: VariableLayoutConfig\n ) {\n super();\n\n // 绑定 flowDocument 里面的树\n this.bindTree(flowDocument.originTree);\n\n // originTree 发生变化时,触发依赖关系的变化\n this.toDispose.push(\n // REFRACTOR: onTreeChange 触发时机精细化\n flowDocument.originTree.onTreeChange(() => {\n this.refreshAllChange();\n })\n );\n }\n\n // 绑定树\n bindTree(tree: FlowVirtualTree<ScopeChainNode>): void {\n this.tree = tree;\n }\n\n // 获取依赖作用域\n getDeps(scope: FlowNodeScope): FlowNodeScope[] {\n if (!this.tree) {\n return this.transformService.transformDeps([], { scope });\n }\n\n const node = scope.meta.node;\n if (!node) {\n return this.transformService.transformDeps([], { scope });\n }\n\n const deps: FlowNodeScope[] = [];\n\n let curr: ScopeChainNode | undefined = node;\n\n while (curr) {\n const { parent, pre } = this.tree.getInfo(curr);\n const currData = this.getVariableData(curr);\n\n // 包含子节点,且不是私有作用域\n\n if (curr === node) {\n // public 可以依赖 private\n if (scope.meta.type === FlowNodeScopeTypeEnum.public && currData?.private) {\n deps.unshift(currData.private);\n }\n } else if (this.hasChildren(curr) && !this.isNodeChildrenPrivate(curr)) {\n // 有子元素的节点,则将子元素纳入依赖作用域\n deps.unshift(\n ...this.getAllSortedChildScope(curr, {\n ignoreNodeChildrenPrivate: true,\n })\n );\n }\n\n // 节点的 public 都可以被访问\n if (currData && curr !== node) {\n deps.unshift(currData.public);\n }\n\n // 上个节点处理\n if (pre) {\n curr = pre;\n continue;\n }\n\n // 父节点处理\n if (parent) {\n let currParent: ScopeChainNode | undefined = parent;\n let currParentPre: ScopeChainNode | undefined = this.tree.getPre(currParent);\n\n while (currParent) {\n // 父节点的 private 和 public 都能被子节点访问\n const currParentData = this.getVariableData(currParent);\n if (currParentData) {\n deps.unshift(...currParentData.allScopes);\n }\n\n // 当前 parent 有 pre 节点,则停止向上查找\n if (currParentPre) {\n break;\n }\n\n currParent = this.tree.getParent(currParent);\n currParentPre = currParent ? this.tree.getPre(currParent) : undefined;\n }\n curr = currParentPre;\n continue;\n }\n\n // next 和 parent 都没有,直接结束循环\n curr = undefined;\n }\n\n // If scope is GlobalScope, add globalScope to deps\n const globalScope = this.variableEngine.getScopeById(GlobalScope.ID);\n if (globalScope) {\n deps.unshift(globalScope);\n }\n\n return this.transformService.transformDeps(deps, { scope });\n }\n\n // 获取覆盖作用域\n getCovers(scope: FlowNodeScope): FlowNodeScope[] {\n if (!this.tree) {\n return this.transformService.transformCovers([], { scope });\n }\n\n // If scope is GlobalScope, return all scopes except GlobalScope\n if (GlobalScope.is(scope)) {\n return this.variableEngine\n .getAllScopes({ sort: true })\n .filter((_scope) => !GlobalScope.is(_scope));\n }\n\n const node = scope.meta.node;\n if (!node) {\n return this.transformService.transformCovers([], { scope });\n }\n\n const covers: FlowNodeScope[] = [];\n\n // 如果是 private 作用域,则只能子节点访问\n if (scope.meta.type === FlowNodeScopeTypeEnum.private) {\n covers.push(\n ...this.getAllSortedChildScope(node, {\n addNodePrivateScope: true,\n })\n );\n return this.transformService.transformCovers(covers, { scope });\n }\n\n let curr: ScopeChainNode | undefined = node;\n\n while (curr) {\n const { next, parent } = this.tree.getInfo(curr);\n const currData = this.getVariableData(curr);\n\n // 有子元素的节点,则将子元素纳入覆盖作用域\n if (curr !== node) {\n if (this.hasChildren(curr)) {\n covers.push(\n ...this.getAllSortedChildScope(curr, {\n addNodePrivateScope: true,\n })\n );\n } else if (currData) {\n covers.push(...currData.allScopes);\n }\n }\n\n // 下个节点处理\n if (next) {\n curr = next;\n continue;\n }\n\n if (parent) {\n let currParent: ScopeChainNode | undefined = parent;\n let currParentNext: ScopeChainNode | undefined = this.tree.getNext(currParent);\n\n while (currParent) {\n // 私有作用域不能被后续节点访问\n if (this.isNodeChildrenPrivate(currParent)) {\n return this.transformService.transformCovers(covers, { scope });\n }\n\n // 当前 parent 有 next 节点,则停止向上查找\n if (currParentNext) {\n break;\n }\n\n currParent = this.tree.getParent(currParent);\n currParentNext = currParent ? this.tree.getNext(currParent) : undefined;\n }\n if (!currParentNext && currParent) {\n break;\n }\n\n curr = currParentNext;\n continue;\n }\n\n // next 和 parent 都没有,直接结束循环\n curr = undefined;\n }\n\n return this.transformService.transformCovers(covers, { scope });\n }\n\n // 排序所有作用域\n sortAll(): Scope[] {\n const startNode = this.flowDocument.getAllNodes().find((_node) => _node.isStart);\n if (!startNode) {\n return [];\n }\n\n const startVariableData = startNode.getData(FlowNodeVariableData);\n const startPublicScope = startVariableData.public;\n const deps = this.getDeps(startPublicScope);\n\n const covers = this.getCovers(startPublicScope).filter(\n (_scope) => !deps.includes(_scope) && _scope !== startPublicScope\n );\n\n return [...deps, startPublicScope, ...covers];\n }\n\n // 获取变量 Data 数据\n private getVariableData(node: ScopeChainNode): FlowNodeVariableData | undefined {\n if (node.flowNodeType === 'virtualNode') {\n return;\n }\n // TODO 包含 $ 的节点不注册 variableData\n if (node.id.startsWith('$')) {\n return;\n }\n\n return (node as FlowNodeEntity).getData(FlowNodeVariableData);\n }\n\n // privateScope:子节点不可以被后续节点访问\n private isNodeChildrenPrivate(node?: ScopeChainNode): boolean {\n if (this.configs?.isNodeChildrenPrivate) {\n return node ? this.configs?.isNodeChildrenPrivate(node) : false;\n }\n\n const isSystemNode = node?.id.startsWith('$');\n // 兜底:有子节点(节点 id 没有 $ 开头)的全部为私有作用域\n return !isSystemNode && this.hasChildren(node);\n }\n\n private hasChildren(node?: ScopeChainNode): boolean {\n return Boolean(this.tree && node && this.tree.getChildren(node).length > 0);\n }\n\n // 子节点按照顺序进行排序(含自身)\n private getAllSortedChildScope(\n node: ScopeChainNode,\n {\n ignoreNodeChildrenPrivate,\n addNodePrivateScope,\n }: { ignoreNodeChildrenPrivate?: boolean; addNodePrivateScope?: boolean } = {}\n ): FlowNodeScope[] {\n const scopes: FlowNodeScope[] = [];\n\n const variableData = this.getVariableData(node);\n\n if (variableData) {\n scopes.push(variableData.public);\n }\n\n // 私有作用域,子节点的变量不对外输出\n //(父节点如果存在 public 变量则对外输出)\n if (ignoreNodeChildrenPrivate && this.isNodeChildrenPrivate(node)) {\n return scopes;\n }\n\n if (addNodePrivateScope && variableData?.private) {\n scopes.push(variableData.private);\n }\n\n const children = this.tree?.getChildren(node) || [];\n scopes.push(\n ...children\n .map((child) =>\n this.getAllSortedChildScope(child, { ignoreNodeChildrenPrivate, addNodePrivateScope })\n )\n .flat()\n );\n\n return scopes;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGA,kBAA2B;;;ACApB,IAAK,wBAAL,kBAAKA,2BAAL;AACL,EAAAA,uBAAA,YAAS;AACT,EAAAA,uBAAA,aAAU;AAFA,SAAAA;AAAA,GAAA;;;ADQL,IAAM,uBAAN,cAAmC,uBAAW;AA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opeTypeEnum","import_inversify","import_variable_core","import_document","import_core","import_core","scopes","import_inversify","import_variable_core","import_inversify","import_variable_core","import_document"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowgram.ai/variable-layout",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.15",
|
|
4
4
|
"homepage": "https://flowgram.ai/",
|
|
5
5
|
"repository": "https://github.com/bytedance/flowgram.ai",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
"inversify": "^6.0.1",
|
|
20
20
|
"reflect-metadata": "~0.2.2",
|
|
21
21
|
"styled-components": "^5",
|
|
22
|
-
"@flowgram.ai/
|
|
23
|
-
"@flowgram.ai/
|
|
24
|
-
"@flowgram.ai/free-layout-core": "0.2.
|
|
25
|
-
"@flowgram.ai/
|
|
26
|
-
"@flowgram.ai/
|
|
22
|
+
"@flowgram.ai/core": "0.2.15",
|
|
23
|
+
"@flowgram.ai/document": "0.2.15",
|
|
24
|
+
"@flowgram.ai/free-layout-core": "0.2.15",
|
|
25
|
+
"@flowgram.ai/utils": "0.2.15",
|
|
26
|
+
"@flowgram.ai/variable-core": "0.2.15"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@vitest/coverage-v8": "^0.32.0",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"tsup": "^8.0.1",
|
|
32
32
|
"typescript": "^5.0.4",
|
|
33
33
|
"vitest": "^0.34.6",
|
|
34
|
-
"@flowgram.ai/eslint-config": "0.2.
|
|
35
|
-
"@flowgram.ai/ts-config": "0.2.
|
|
34
|
+
"@flowgram.ai/eslint-config": "0.2.15",
|
|
35
|
+
"@flowgram.ai/ts-config": "0.2.15"
|
|
36
36
|
},
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"access": "public",
|