@milaboratories/pl-middle-layer 1.35.1 → 1.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +78 -66
- package/dist/index.mjs.map +1 -1
- package/dist/model/project_model_util.d.ts +9 -5
- package/dist/model/project_model_util.d.ts.map +1 -1
- package/dist/mutator/project.d.ts.map +1 -1
- package/package.json +9 -9
- package/src/model/project_model_util.test.ts +10 -6
- package/src/model/project_model_util.ts +49 -19
- package/src/mutator/project.ts +1 -2
|
@@ -3,18 +3,22 @@ export declare function allBlocks(structure: ProjectStructure): Iterable<Block>;
|
|
|
3
3
|
export interface BlockGraphNode {
|
|
4
4
|
readonly id: string;
|
|
5
5
|
readonly missingReferences: boolean;
|
|
6
|
-
/**
|
|
6
|
+
/** Upstreams, calculated accounting for potential indirect block dependencies */
|
|
7
7
|
readonly upstream: Set<string>;
|
|
8
|
-
/** Direct
|
|
8
|
+
/** Direct upstream, listed in block args */
|
|
9
|
+
readonly directUpstream: Set<string>;
|
|
10
|
+
/** Downstreams, calculated accounting for potential indirect block dependencies */
|
|
9
11
|
readonly downstream: Set<string>;
|
|
12
|
+
/** Direct downstreams listing our block in it's args */
|
|
13
|
+
readonly directDownstream: Set<string>;
|
|
10
14
|
}
|
|
11
15
|
export declare class BlockGraph {
|
|
12
16
|
/** Nodes are stored in the map in topological order */
|
|
13
17
|
readonly nodes: Map<string, BlockGraphNode>;
|
|
14
18
|
constructor(nodes: Map<string, BlockGraphNode>);
|
|
15
|
-
traverseIds(direction: 'upstream' | 'downstream', ...rootBlockIds: string[]): Set<string>;
|
|
16
|
-
traverseIdsExcludingRoots(direction: 'upstream' | 'downstream', ...rootBlockIds: string[]): Set<string>;
|
|
17
|
-
traverse(direction: 'upstream' | 'downstream', rootBlockIds: string[], cb: (node: BlockGraphNode) => void): void;
|
|
19
|
+
traverseIds(direction: 'upstream' | 'downstream' | 'directUpstream' | 'directDownstream', ...rootBlockIds: string[]): Set<string>;
|
|
20
|
+
traverseIdsExcludingRoots(direction: 'upstream' | 'downstream' | 'directUpstream' | 'directDownstream', ...rootBlockIds: string[]): Set<string>;
|
|
21
|
+
traverse(direction: 'upstream' | 'downstream' | 'directUpstream' | 'directDownstream', rootBlockIds: string[], cb: (node: BlockGraphNode) => void): void;
|
|
18
22
|
}
|
|
19
23
|
export declare function stagingGraph(structure: ProjectStructure): BlockGraph;
|
|
20
24
|
export declare function productionGraph(structure: ProjectStructure, argsProvider: (blockId: string) => unknown): BlockGraph;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project_model_util.d.ts","sourceRoot":"","sources":["../../src/model/project_model_util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAI/D,wBAAgB,SAAS,CAAC,SAAS,EAAE,gBAAgB,GAAG,QAAQ,CAAC,KAAK,CAAC,CAMtE;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;IACpC,
|
|
1
|
+
{"version":3,"file":"project_model_util.d.ts","sourceRoot":"","sources":["../../src/model/project_model_util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAI/D,wBAAgB,SAAS,CAAC,SAAS,EAAE,gBAAgB,GAAG,QAAQ,CAAC,KAAK,CAAC,CAMtE;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;IACpC,kFAAkF;IAClF,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/B,4CAA4C;IAC5C,QAAQ,CAAC,cAAc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AC,CAAC,CAAC,CAmBZ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milaboratories/pl-middle-layer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.36.0",
|
|
4
4
|
"description": "Pl Middle Layer",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20.16.0"
|
|
@@ -33,21 +33,21 @@
|
|
|
33
33
|
"zod": "~3.23.8",
|
|
34
34
|
"remeda": "^2.21.2",
|
|
35
35
|
"@milaboratories/pl-http": "^1.1.2",
|
|
36
|
-
"@milaboratories/resolve-helper": "^1.1.0",
|
|
37
36
|
"@milaboratories/computable": "^2.4.5",
|
|
38
|
-
"@platforma-sdk/block-tools": "^2.5.40",
|
|
39
|
-
"@milaboratories/pl-client": "^2.8.1",
|
|
40
37
|
"@milaboratories/pl-drivers": "^1.5.48",
|
|
41
|
-
"@milaboratories/
|
|
38
|
+
"@milaboratories/resolve-helper": "^1.1.0",
|
|
39
|
+
"@milaboratories/pl-client": "^2.8.1",
|
|
40
|
+
"@platforma-sdk/block-tools": "^2.5.40",
|
|
42
41
|
"@milaboratories/pl-model-common": "^1.13.8",
|
|
42
|
+
"@milaboratories/pl-model-middle-layer": "^1.7.26",
|
|
43
43
|
"@milaboratories/pl-tree": "^1.5.7",
|
|
44
|
-
"@milaboratories/pl-model-backend": "^1.1.0",
|
|
45
44
|
"@platforma-sdk/model": "^1.29.22",
|
|
46
|
-
"@
|
|
45
|
+
"@milaboratories/pl-model-backend": "^1.1.0",
|
|
47
46
|
"@milaboratories/ts-helpers": "^1.1.6",
|
|
48
47
|
"@milaboratories/pl-config": "^1.4.7",
|
|
49
|
-
"@
|
|
50
|
-
"@milaboratories/pl-deployments": "^2.0
|
|
48
|
+
"@platforma-sdk/workflow-tengo": "4.1.2",
|
|
49
|
+
"@milaboratories/pl-deployments": "^2.1.0",
|
|
50
|
+
"@milaboratories/pl-errors": "^1.0.7"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"semver": "^7.6.3",
|
|
@@ -29,13 +29,17 @@ describe('simple traverse', () => {
|
|
|
29
29
|
const pGraph1 = productionGraph(struct1, (id) => inputs.get(id) ?? null);
|
|
30
30
|
|
|
31
31
|
test.each([
|
|
32
|
-
{ roots: ['b2'], expectedUpstreams: ['b1'], expectedDownstreams: ['b6'] },
|
|
33
|
-
{ roots: ['b4'], expectedUpstreams: ['b3'], expectedDownstreams: ['b5', 'b6'] },
|
|
34
|
-
{ roots: ['b5'], expectedUpstreams: ['b3', 'b4'], expectedDownstreams: [] },
|
|
35
|
-
{ roots: ['b6'], expectedUpstreams: ['b1', 'b2', 'b3', 'b4'], expectedDownstreams: [] }
|
|
36
|
-
])('$roots', ({ roots, expectedUpstreams, expectedDownstreams }) => {
|
|
37
|
-
const
|
|
32
|
+
{ roots: ['b2'], expectedDirectUpstreams: ['b1'], expectedDirectDownstreams: ['b6'], expectedUpstreams: ['b1'], expectedDownstreams: ['b6'] },
|
|
33
|
+
{ roots: ['b4'], expectedDirectUpstreams: ['b3'], expectedDirectDownstreams: ['b5', 'b6'], expectedUpstreams: ['b3'], expectedDownstreams: ['b5', 'b6'] },
|
|
34
|
+
{ roots: ['b5'], expectedDirectUpstreams: ['b3', 'b4'], expectedDirectDownstreams: [], expectedUpstreams: ['b3', 'b4'], expectedDownstreams: ['b6'] },
|
|
35
|
+
{ roots: ['b6'], expectedDirectUpstreams: ['b1', 'b2', 'b3', 'b4'], expectedDirectDownstreams: [], expectedUpstreams: ['b1', 'b2', 'b3', 'b4', 'b5'], expectedDownstreams: [] }
|
|
36
|
+
])('$roots', ({ roots, expectedDirectUpstreams, expectedDirectDownstreams, expectedUpstreams, expectedDownstreams }) => {
|
|
37
|
+
const directUpstreams = pGraph1.traverseIdsExcludingRoots('directUpstream', ...roots);
|
|
38
|
+
const directDownstreams = pGraph1.traverseIdsExcludingRoots('directDownstream', ...roots);
|
|
39
|
+
const upstreams = pGraph1.traverseIdsExcludingRoots('upstream', ...roots);
|
|
38
40
|
const downstreams = pGraph1.traverseIdsExcludingRoots('downstream', ...roots);
|
|
41
|
+
expect([...directUpstreams].sort()).toEqual(expectedDirectUpstreams.sort());
|
|
42
|
+
expect([...directDownstreams].sort()).toEqual(expectedDirectDownstreams.sort());
|
|
39
43
|
expect([...upstreams].sort()).toEqual(expectedUpstreams.sort());
|
|
40
44
|
expect([...downstreams].sort()).toEqual(expectedDownstreams.sort());
|
|
41
45
|
});
|
|
@@ -13,10 +13,14 @@ export function allBlocks(structure: ProjectStructure): Iterable<Block> {
|
|
|
13
13
|
export interface BlockGraphNode {
|
|
14
14
|
readonly id: string;
|
|
15
15
|
readonly missingReferences: boolean;
|
|
16
|
-
/**
|
|
16
|
+
/** Upstreams, calculated accounting for potential indirect block dependencies */
|
|
17
17
|
readonly upstream: Set<string>;
|
|
18
|
-
/** Direct
|
|
18
|
+
/** Direct upstream, listed in block args */
|
|
19
|
+
readonly directUpstream: Set<string>;
|
|
20
|
+
/** Downstreams, calculated accounting for potential indirect block dependencies */
|
|
19
21
|
readonly downstream: Set<string>;
|
|
22
|
+
/** Direct downstreams listing our block in it's args */
|
|
23
|
+
readonly directDownstream: Set<string>;
|
|
20
24
|
}
|
|
21
25
|
|
|
22
26
|
export class BlockGraph {
|
|
@@ -27,14 +31,17 @@ export class BlockGraph {
|
|
|
27
31
|
this.nodes = nodes;
|
|
28
32
|
}
|
|
29
33
|
|
|
30
|
-
public traverseIds(
|
|
34
|
+
public traverseIds(
|
|
35
|
+
direction: 'upstream' | 'downstream' | 'directUpstream' | 'directDownstream',
|
|
36
|
+
...rootBlockIds: string[]
|
|
37
|
+
): Set<string> {
|
|
31
38
|
const all = new Set<string>();
|
|
32
39
|
this.traverse(direction, rootBlockIds, (node) => all.add(node.id));
|
|
33
40
|
return all;
|
|
34
41
|
}
|
|
35
42
|
|
|
36
43
|
public traverseIdsExcludingRoots(
|
|
37
|
-
direction: 'upstream' | 'downstream',
|
|
44
|
+
direction: 'upstream' | 'downstream' | 'directUpstream' | 'directDownstream',
|
|
38
45
|
...rootBlockIds: string[]
|
|
39
46
|
): Set<string> {
|
|
40
47
|
const result = this.traverseIds(direction, ...rootBlockIds);
|
|
@@ -43,7 +50,7 @@ export class BlockGraph {
|
|
|
43
50
|
}
|
|
44
51
|
|
|
45
52
|
public traverse(
|
|
46
|
-
direction: 'upstream' | 'downstream',
|
|
53
|
+
direction: 'upstream' | 'downstream' | 'directUpstream' | 'directDownstream',
|
|
47
54
|
rootBlockIds: string[],
|
|
48
55
|
cb: (node: BlockGraphNode) => void,
|
|
49
56
|
): void {
|
|
@@ -68,7 +75,7 @@ export class BlockGraph {
|
|
|
68
75
|
}
|
|
69
76
|
|
|
70
77
|
export function stagingGraph(structure: ProjectStructure) {
|
|
71
|
-
type WNode = Optional<Writable<BlockGraphNode>, 'upstream' | 'downstream'>;
|
|
78
|
+
type WNode = Optional<Writable<BlockGraphNode>, 'upstream' | 'downstream' | 'directUpstream' | 'directDownstream'>;
|
|
72
79
|
const result = new Map<string, WNode>();
|
|
73
80
|
|
|
74
81
|
// Simple dependency graph from previous to next
|
|
@@ -84,15 +91,15 @@ export function stagingGraph(structure: ProjectStructure) {
|
|
|
84
91
|
};
|
|
85
92
|
result.set(id, current);
|
|
86
93
|
if (previous === undefined) {
|
|
87
|
-
current.upstream = new Set<string>();
|
|
94
|
+
current.directUpstream = current.upstream = new Set<string>();
|
|
88
95
|
} else {
|
|
89
|
-
current.upstream = new Set<string>([previous.id]);
|
|
90
|
-
previous.downstream = new Set<string>([current.id]);
|
|
96
|
+
current.directUpstream = current.upstream = new Set<string>([previous.id]);
|
|
97
|
+
previous.directDownstream = previous.downstream = new Set<string>([current.id]);
|
|
91
98
|
}
|
|
92
99
|
|
|
93
100
|
previous = current;
|
|
94
101
|
}
|
|
95
|
-
if (previous !== undefined) previous.downstream = new Set<string>();
|
|
102
|
+
if (previous !== undefined) previous.directDownstream = previous.downstream = new Set<string>();
|
|
96
103
|
|
|
97
104
|
return new BlockGraph(result as Map<string, BlockGraphNode>);
|
|
98
105
|
}
|
|
@@ -101,31 +108,54 @@ export function productionGraph(
|
|
|
101
108
|
structure: ProjectStructure,
|
|
102
109
|
argsProvider: (blockId: string) => unknown,
|
|
103
110
|
): BlockGraph {
|
|
104
|
-
const
|
|
111
|
+
const resultMap = new Map<string, BlockGraphNode>();
|
|
112
|
+
// result graph is constructed to be able to perform traversal on incomplete graph
|
|
113
|
+
// to calculate potentialUpstreams
|
|
114
|
+
const resultGraph = new BlockGraph(resultMap);
|
|
105
115
|
|
|
106
116
|
// traversing blocks in topological order defined by the project structure
|
|
107
117
|
// and keeping possibleUpstreams set on each step, to consider only
|
|
108
118
|
// those dependencies that are possible under current topology
|
|
109
|
-
const
|
|
119
|
+
const allAbove = new Set<string>();
|
|
110
120
|
for (const { id } of allBlocks(structure)) {
|
|
111
121
|
const args = argsProvider(id);
|
|
112
122
|
|
|
113
123
|
// skipping those blocks for which we don't have args
|
|
114
124
|
if (args === undefined) continue;
|
|
115
125
|
|
|
116
|
-
const
|
|
126
|
+
const directUpstreams = inferAllReferencedBlocks(args, allAbove);
|
|
127
|
+
|
|
128
|
+
// The algorithm here adds all downstream blocks of direct upstreams as potential upstreams.
|
|
129
|
+
// They may produce additional columns, anchored in our direct upstream, those columns might be needed by the workflow.
|
|
130
|
+
const potentialUpstreams = resultGraph.traverseIds('directDownstream', ...directUpstreams.upstreams);
|
|
131
|
+
|
|
132
|
+
// To minimize complexity of the graph, we leave only the closest upstreams, removing all their transitive dependencies,
|
|
133
|
+
// relying on the traversal mechanisms in BContexts and on UI level to connect our block with all upstreams
|
|
134
|
+
const upstreams = new Set<string>();
|
|
135
|
+
for (const { id: pId } of allBlocks(structure)) {
|
|
136
|
+
if (pId === id) break; // stopping on current block
|
|
137
|
+
if (potentialUpstreams.has(pId)) {
|
|
138
|
+
upstreams.add(pId);
|
|
139
|
+
for (const transitiveUpstream of resultGraph.traverseIdsExcludingRoots('upstream', pId))
|
|
140
|
+
upstreams.delete(transitiveUpstream);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
117
144
|
const node: BlockGraphNode = {
|
|
118
145
|
id,
|
|
119
|
-
missingReferences:
|
|
120
|
-
upstream: upstreams
|
|
146
|
+
missingReferences: directUpstreams.missingReferences,
|
|
147
|
+
upstream: upstreams,
|
|
148
|
+
directUpstream: directUpstreams.upstreams,
|
|
121
149
|
downstream: new Set<string>(), // will be populated from downstream blocks
|
|
150
|
+
directDownstream: new Set<string>(), // will be populated from downstream blocks
|
|
122
151
|
};
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
152
|
+
resultMap.set(id, node);
|
|
153
|
+
directUpstreams.upstreams.forEach((dep) => resultMap.get(dep)!.directDownstream.add(id));
|
|
154
|
+
upstreams.forEach((dep) => resultMap.get(dep)!.downstream.add(id));
|
|
155
|
+
allAbove.add(id);
|
|
126
156
|
}
|
|
127
157
|
|
|
128
|
-
return
|
|
158
|
+
return resultGraph;
|
|
129
159
|
}
|
|
130
160
|
|
|
131
161
|
function setsEqual<T>(a: Set<T>, b: Set<T>): boolean {
|
package/src/mutator/project.ts
CHANGED
|
@@ -756,8 +756,7 @@ export class ProjectMutator {
|
|
|
756
756
|
prodGraph.traverse('upstream', blockIds, (node) => {
|
|
757
757
|
blockIdsSet.add(node.id);
|
|
758
758
|
});
|
|
759
|
-
// checking that targets contain all upstreams
|
|
760
|
-
else
|
|
759
|
+
else // checking that targets contain all upstreams
|
|
761
760
|
for (const blockId of blockIdsSet) {
|
|
762
761
|
const node = prodGraph.nodes.get(blockId);
|
|
763
762
|
if (node === undefined) throw new Error(`Can't find block with id: ${blockId}`);
|