@cobol-ts/graph_utils 0.0.0-stage → 0.0.20

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/README.md CHANGED
@@ -1,3 +1,23 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
1
+ # @cobol-ts/graph_utils
2
+
3
+ Pure display-only graph augmentation. `createDisplayGraph` accepts existing
4
+ canonical nodes and a `DisplayGraphTC` adapter. It uses the supplied computational
5
+ edges and dependency paths to add one `input` node per distinct `input.*` or
6
+ `variables.*` reference. Input nodes expose their full `path`, `source` and
7
+ `fieldName`, and calculations gain `displayDependsOn` edges without changing their
8
+ original `dependsOn` or `mustBeBefore` properties.
9
+
10
+ `sortDisplayGraph` uses the existing `topologicalSort`, including temporal
11
+ ordering-only edges. `planDisplayGraph` uses the existing `makePlannedGraph` with
12
+ computational edges only. Neither API feeds production execution or storage.
13
+
14
+ The original graph nodes and their dependency arrays are never mutated.
15
+
16
+ `upstreamDependencyClosure(roots, tc, filter)` visits selected roots and their
17
+ transitive dependencies. `downstreamDependencyClosure(nodes, roots, tc, filter)`
18
+ visits the selected roots and their transitive dependents (consumers), building
19
+ an inverse index from the supplied node universe. Both use the same injected
20
+ `DependsOnTC<Node>` with `dependsOn(node)`; neither inspects concrete node
21
+ properties, CEL, or graph storage. A filter controls returned nodes without
22
+ pruning traversal, and duplicate or cyclic paths terminate correctly.
23
+ Ordering-only `mustBeBefore` links are not inferred by either helper.
@@ -0,0 +1,3 @@
1
+ export * from './src/graph.display';
2
+ export * from './src/dependency.closure';
3
+ export * from './src/graph.neighbourhood';
package/dist/index.js ADDED
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./src/graph.display"), exports);
18
+ __exportStar(require("./src/dependency.closure"), exports);
19
+ __exportStar(require("./src/graph.neighbourhood"), exports);
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAmC;AACnC,2DAAwC;AACxC,4DAAyC"}
@@ -0,0 +1,16 @@
1
+ /** Only the caller knows which links constitute computational dependencies.
2
+ * An implementation can obtain these from compiled nodes, a display graph,
3
+ * or a different representation. Ordering-only constraints are not implicit.
4
+ */
5
+ export interface DependsOnTC<Node> {
6
+ dependsOn(node: Node): readonly Node[];
7
+ }
8
+ /** Visit roots and all transitive upstream dependencies. Only the injected
9
+ * typeclass determines the dependency edges; mustBeBefore is never inferred.
10
+ */
11
+ export declare function upstreamDependencyClosure<Node>(roots: readonly Node[], tc: DependsOnTC<Node>, filter: (node: Node) => boolean): Node[];
12
+ /** Visit roots and all transitive downstream dependents (consumers).
13
+ * The complete node set is necessary to invert the injected dependsOn relation.
14
+ * Only nodes supplied in `nodes` can be discovered as dependents.
15
+ */
16
+ export declare function downstreamDependencyClosure<Node>(nodes: readonly Node[], roots: readonly Node[], tc: DependsOnTC<Node>, filter: (node: Node) => boolean): Node[];
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.upstreamDependencyClosure = upstreamDependencyClosure;
4
+ exports.downstreamDependencyClosure = downstreamDependencyClosure;
5
+ /** Inclusive, iterative closure. The filter affects returned nodes, never
6
+ * traversal, so dependencies remain reachable through nonmatching nodes.
7
+ */
8
+ function closure(roots, neighbours, filter) {
9
+ const visited = new Set();
10
+ const matched = [];
11
+ const pending = [...roots].reverse();
12
+ while (pending.length) {
13
+ const node = pending.pop();
14
+ if (visited.has(node))
15
+ continue;
16
+ visited.add(node);
17
+ if (filter(node))
18
+ matched.push(node);
19
+ const next = neighbours(node);
20
+ for (let i = next.length - 1; i >= 0; i--)
21
+ pending.push(next[i]);
22
+ }
23
+ return matched;
24
+ }
25
+ /** Visit roots and all transitive upstream dependencies. Only the injected
26
+ * typeclass determines the dependency edges; mustBeBefore is never inferred.
27
+ */
28
+ function upstreamDependencyClosure(roots, tc, filter) {
29
+ return closure(roots, node => tc.dependsOn(node), filter);
30
+ }
31
+ /** Visit roots and all transitive downstream dependents (consumers).
32
+ * The complete node set is necessary to invert the injected dependsOn relation.
33
+ * Only nodes supplied in `nodes` can be discovered as dependents.
34
+ */
35
+ function downstreamDependencyClosure(nodes, roots, tc, filter) {
36
+ const downstream = new Map();
37
+ for (const node of nodes) {
38
+ for (const dependency of tc.dependsOn(node)) {
39
+ const dependents = downstream.get(dependency) ?? [];
40
+ dependents.push(node);
41
+ downstream.set(dependency, dependents);
42
+ }
43
+ }
44
+ return closure(roots, node => downstream.get(node) ?? [], filter);
45
+ }
46
+ //# sourceMappingURL=dependency.closure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dependency.closure.js","sourceRoot":"","sources":["../../src/dependency.closure.ts"],"names":[],"mappings":";;AAmCA,8DAMC;AAMD,kEAeC;AAtDD;;GAEG;AACH,SAAS,OAAO,CACZ,KAAsB,EACtB,UAA2C,EAC3C,MAA+B;IAE/B,MAAM,OAAO,GAAG,IAAI,GAAG,EAAQ,CAAA;IAC/B,MAAM,OAAO,GAAW,EAAE,CAAA;IAC1B,MAAM,OAAO,GAAG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GAAG,CAAC,UAAU,EAAE,UAAU,CAAC,CAAA;QAC1C,CAAC;IACL,CAAC;IACD,OAAO,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,MAAM,CAAC,CAAA;AACrE,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const dependency_closure_1 = require("./dependency.closure");
4
+ const input = { id: 'input' };
5
+ const window = { id: 'window' };
6
+ const minimum = { id: 'minimum', dependsOn: ['bogus'], mustBeBefore: ['unrelated'] };
7
+ const maximum = { id: 'maximum' };
8
+ const output = { id: 'output' };
9
+ const unrelated = { id: 'unrelated' };
10
+ const nodes = [input, window, minimum, maximum, output, unrelated];
11
+ const edges = new Map([
12
+ [input, []], [window, [input]], [minimum, [window]],
13
+ [maximum, [window]], [output, [minimum, maximum]], [unrelated, []]
14
+ ]);
15
+ const tc = { dependsOn: (node) => edges.get(node) ?? [] };
16
+ describe('upstreamDependencyClosure', () => {
17
+ it('uses only injected dependsOn and finds transitive dependencies', () => {
18
+ expect((0, dependency_closure_1.upstreamDependencyClosure)([output], tc, () => true)).toEqual([
19
+ output, minimum, window, input, maximum
20
+ ]);
21
+ });
22
+ it('traverses through nonmatching nodes and includes matching roots', () => {
23
+ expect((0, dependency_closure_1.upstreamDependencyClosure)([output], tc, node => node === input)).toEqual([input]);
24
+ expect((0, dependency_closure_1.upstreamDependencyClosure)([minimum], tc, node => node === minimum)).toEqual([minimum]);
25
+ expect((0, dependency_closure_1.upstreamDependencyClosure)([], tc, () => true)).toEqual([]);
26
+ });
27
+ });
28
+ describe('downstreamDependencyClosure', () => {
29
+ it('finds consumers rather than the dependencies of a selected calculation', () => {
30
+ expect((0, dependency_closure_1.downstreamDependencyClosure)(nodes, [minimum], tc, () => true)).toEqual([minimum, output]);
31
+ expect((0, dependency_closure_1.downstreamDependencyClosure)(nodes, [output], tc, () => true)).toEqual([output]);
32
+ });
33
+ it('finds every transitive consumer of a source, including across branches', () => {
34
+ expect((0, dependency_closure_1.downstreamDependencyClosure)(nodes, [input], tc, () => true)).toEqual([
35
+ input, window, minimum, output, maximum
36
+ ]);
37
+ });
38
+ it('filters the result but still traverses through unmatched intermediates', () => {
39
+ expect((0, dependency_closure_1.downstreamDependencyClosure)(nodes, [input], tc, node => node === output)).toEqual([output]);
40
+ });
41
+ it('uses only injected edges, ignores authored dependsOn and mustBeBefore', () => {
42
+ expect((0, dependency_closure_1.downstreamDependencyClosure)(nodes, [unrelated], tc, () => true)).toEqual([unrelated]);
43
+ });
44
+ it('deduplicates shared descendants, multiple roots and cycles', () => {
45
+ const cyclicTC = { dependsOn: (node) => node === input ? [output] : tc.dependsOn(node) };
46
+ expect((0, dependency_closure_1.downstreamDependencyClosure)(nodes, [minimum, maximum], cyclicTC, () => true)).toEqual([
47
+ minimum, output, input, window, maximum
48
+ ]);
49
+ });
50
+ it('handles empty roots and does not discover nodes omitted from the universe', () => {
51
+ expect((0, dependency_closure_1.downstreamDependencyClosure)(nodes, [], tc, () => true)).toEqual([]);
52
+ expect((0, dependency_closure_1.downstreamDependencyClosure)([input, window], [input], tc, () => true)).toEqual([input, window]);
53
+ });
54
+ });
55
+ //# sourceMappingURL=dependency.closure.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dependency.closure.spec.js","sourceRoot":"","sources":["../../src/dependency.closure.spec.ts"],"names":[],"mappings":";;AAAA,6DAA2F;AAG3F,MAAM,KAAK,GAAS,EAAC,EAAE,EAAE,OAAO,EAAC,CAAA;AACjC,MAAM,MAAM,GAAS,EAAC,EAAE,EAAE,QAAQ,EAAC,CAAA;AACnC,MAAM,OAAO,GAAS,EAAC,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC,WAAW,CAAC,EAAC,CAAA;AACxF,MAAM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E,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAA;IAC1G,CAAC,CAAC,CAAA;AACN,CAAC,CAAC,CAAA"}
@@ -0,0 +1,51 @@
1
+ import { type ErrorsOr } from '@cobol-ts/errors';
2
+ import type { GraphTC } from '@cobol-ts/graph';
3
+ export type DependencyPath = readonly string[];
4
+ /** A display-only graph interpretation. No parser, executor or accumulator is involved.
5
+ * The existing GraphTC supplies real computational edges; the extra operations
6
+ * identify the external fields and temporal ordering constraints.
7
+ */
8
+ export interface DisplayGraphTC<Node> extends GraphTC<Node> {
9
+ name(node: Node): string;
10
+ dependencyPaths(node: Node): readonly DependencyPath[];
11
+ mustBeBefore(node: Node): readonly DependencyPath[];
12
+ source(path: DependencyPath): string;
13
+ fieldName(path: DependencyPath): string;
14
+ }
15
+ export interface InputDisplayNode {
16
+ readonly type: 'input';
17
+ readonly path: readonly string[];
18
+ readonly source: string;
19
+ readonly fieldName: string;
20
+ readonly metadata: {
21
+ readonly name: string;
22
+ readonly source: string;
23
+ readonly fieldName: string;
24
+ };
25
+ readonly dependsOn: readonly [];
26
+ readonly displayDependsOn: readonly [];
27
+ }
28
+ /** Original nodes retain their authored dependency paths; the additional
29
+ * displayDependsOn is a list of graph edges, including external inputs.
30
+ */
31
+ export type DisplayCalculationNode<Node> = Node & {
32
+ readonly displayDependsOn: readonly DependencyPath[];
33
+ };
34
+ export type DisplayNode<Node> = DisplayCalculationNode<Node> | InputDisplayNode;
35
+ export interface DisplayGraph<Node> {
36
+ readonly nodes: readonly DisplayNode<Node>[];
37
+ readonly inputs: readonly InputDisplayNode[];
38
+ /** Computational dependencies, including input fields; never ordering-only edges. */
39
+ readonly graph: GraphTC<DisplayNode<Node>> & {
40
+ name(node: DisplayNode<Node>): string;
41
+ };
42
+ /** Dependencies plus the previous-value ordering constraints used when sorting. */
43
+ readonly sortingGraph: GraphTC<DisplayNode<Node>>;
44
+ }
45
+ export declare function createDisplayGraph<Node extends object>(originals: readonly Node[], tc: DisplayGraphTC<Node>): ErrorsOr<DisplayGraph<Node>>;
46
+ export declare function sortDisplayGraph<Node extends object>(graph: DisplayGraph<Node>): ErrorsOr<DisplayNode<Node>[][]>;
47
+ export declare function planDisplayGraph<Node extends object>(graph: DisplayGraph<Node>, generations: readonly (readonly DisplayNode<Node>[])[]): ErrorsOr<{
48
+ index: number;
49
+ node: DisplayNode<Node>;
50
+ downstream: readonly number[];
51
+ }[][]>;
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createDisplayGraph = createDisplayGraph;
4
+ exports.sortDisplayGraph = sortDisplayGraph;
5
+ exports.planDisplayGraph = planDisplayGraph;
6
+ const errors_1 = require("@cobol-ts/errors");
7
+ const topological_sort_1 = require("@cobol-ts/topological-sort");
8
+ const planned_graph_1 = require("@cobol-ts/planned_graph");
9
+ function isInput(node) {
10
+ return node.type === 'input';
11
+ }
12
+ /** External roots belong in the display graph. A now/prev reference refers to
13
+ * an existing computation or its prior state, not to a new input field.
14
+ */
15
+ function isExternal(path) {
16
+ return path[0] === 'input' || path[0] === 'variables';
17
+ }
18
+ function createDisplayGraph(originals, tc) {
19
+ const originalNames = new Set();
20
+ const diagnostics = [];
21
+ for (const node of originals) {
22
+ const name = tc.name(node);
23
+ if (originalNames.has(name))
24
+ diagnostics.push(`Duplicate display graph node: ${name}`);
25
+ originalNames.add(name);
26
+ }
27
+ const inputs = new Map();
28
+ for (const node of originals)
29
+ for (const path of tc.dependencyPaths(node)) {
30
+ if (!isExternal(path))
31
+ continue;
32
+ const name = path.join('.');
33
+ if (!inputs.has(name)) {
34
+ const source = tc.source(path);
35
+ const fieldName = tc.fieldName(path);
36
+ inputs.set(name, {
37
+ type: 'input', path: [...path], source, fieldName,
38
+ metadata: { name, source, fieldName },
39
+ dependsOn: [], displayDependsOn: []
40
+ });
41
+ }
42
+ }
43
+ for (const name of inputs.keys())
44
+ if (originalNames.has(name))
45
+ diagnostics.push(`Input ${name}: conflicts with an authored graph node`);
46
+ for (const node of originals)
47
+ for (const dependency of tc.children(node))
48
+ if (!originalNames.has(tc.name(dependency)))
49
+ diagnostics.push(`${tc.name(node)}: unknown display dependency ${tc.name(dependency)}`);
50
+ if (diagnostics.length)
51
+ return { errors: diagnostics };
52
+ const calculations = originals.map(node => {
53
+ const dependencies = [
54
+ ...tc.children(node).map(other => ['now', tc.name(other)]),
55
+ ...tc.dependencyPaths(node).filter(isExternal).map(path => ['now', path.join('.')])
56
+ ];
57
+ const unique = new Map(dependencies.map(path => [JSON.stringify(path), path]));
58
+ return { ...node, displayDependsOn: [...unique.values()] };
59
+ });
60
+ const nodes = [...inputs.values(), ...calculations];
61
+ const byName = new Map(nodes.map(node => [
62
+ isInput(node) ? node.metadata.name : tc.name(node), node
63
+ ]));
64
+ const name = (node) => isInput(node) ? node.metadata.name : tc.name(node);
65
+ const children = (node) => {
66
+ if (isInput(node))
67
+ return [];
68
+ return node.displayDependsOn.flatMap(path => {
69
+ const dependency = byName.get(path[1]);
70
+ return dependency ? [dependency] : [];
71
+ });
72
+ };
73
+ const graph = { name, displayString: name, children };
74
+ // The normal graph sort already distinguishes ordering-only prev reads
75
+ // from propagation. Apply the same distinction to the display graph.
76
+ const earlierReaders = new Map();
77
+ for (const node of calculations)
78
+ for (const path of tc.mustBeBefore(node)) {
79
+ if (path[0] !== 'prev' || path.length !== 2 || path[1] === tc.name(node))
80
+ continue;
81
+ const target = byName.get(path[1]);
82
+ if (!target)
83
+ continue; // Original graph validation diagnoses missing previous-value targets.
84
+ const existing = earlierReaders.get(path[1]) ?? [];
85
+ existing.push(node);
86
+ earlierReaders.set(path[1], existing);
87
+ }
88
+ const sortingGraph = {
89
+ ...graph,
90
+ children: (node) => [
91
+ ...children(node), ...(earlierReaders.get(name(node)) ?? [])
92
+ ]
93
+ };
94
+ return (0, errors_1.value)({ nodes, inputs: [...inputs.values()], graph, sortingGraph });
95
+ }
96
+ function sortDisplayGraph(graph) {
97
+ return (0, topological_sort_1.topologicalSort)(graph.sortingGraph, [...graph.nodes]);
98
+ }
99
+ function planDisplayGraph(graph, generations) {
100
+ let index = 0;
101
+ return (0, planned_graph_1.makePlannedGraph)(generations, graph.graph, (node, downstream) => ({ index: index++, node, downstream }));
102
+ }
103
+ //# sourceMappingURL=graph.display.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph.display.js","sourceRoot":"","sources":["../../src/graph.display.ts"],"names":[],"mappings":";;AA6DA,gDA0EC;AAED,4CAEC;AAED,4CAMC;AAnJD,6CAAqD;AAErD,iEAA0D;AAC1D,2DAAwD;AA+CxD,SAAS,OAAO,CAAO,IAAuB;IAC1C,OAAQ,IAAyB,CAAC,IAAI,KAAK,OAAO,CAAA;AACtD,CAAC;AAED;;GAEG;AACH,SAAS,UAAU,CAAC,IAAoB;IACpC,OAAO,IAAI,CAAC,CAAC,CAAC,KAAK,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,WAAW,CAAA;AACzD,CAAC;AAED,SAAgB,kBAAkB,CAC9B,SAA0B,EAAE,EAAwB;IAEpD,MAAM,aAAa,GAAG,IAAI,GAAG,EAAU,CAAA;IACvC,MAAM,WAAW,GAAa,EAAE,CAAA;IAChC,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE,CAAC;QAC3B,MAAM,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC1B,IAAI,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,WAAW,CAAC,IAAI,CAAC,iCAAiC,IAAI,EAAE,CAAC,CAAA;QACtF,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IAC3B,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,GAAG,EAA4B,CAAA;IAClD,KAAK,MAAM,IAAI,IAAI,SAAS;QAAE,KAAK,MAAM,IAAI,IAAI,EAAE,CAAC,eAAe,CAAC,IAAI,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A;QACzC,CAAC;IACD,MAAM,YAAY,GAAG;QACjB,GAAG,KAAK;QACR,QAAQ,EAAE,CAAC,IAAuB,EAAuB,EAAE,CAAC;YACxD,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;SAC/D;KACJ,CAAA;IACD,OAAO,IAAA,cAAK,EAAC,EAAC,KAAK,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,YAAY,EAAC,CAAC,CAAA;AAC5E,CAAC;AAED,SAAgB,gBAAgB,CAAsB,KAAyB;IAC3E,OAAO,IAAA,kCAAe,EAAC,KAAK,CAAC,YAAY,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAA;AAChE,CAAC;AAED,SAAgB,gBAAgB,CAC5B,KAAyB,EAAE,WAAsD;IAEjF,IAAI,KAAK,GAAG,CAAC,CAAA;IACb,OAAO,IAAA,gCAAgB,EAAC,WAAW,EAAE,KAAK,CAAC,KAAK,EAC5C,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC,EAAC,KAAK,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,UAAU,EAAC,CAAC,CAAC,CAAA;AACnE,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const graph_display_1 = require("./graph.display");
4
+ const errors_1 = require("@cobol-ts/errors");
5
+ const graph = (...nodes) => {
6
+ const byName = new Map(nodes.map(node => [node.metadata.name, node]));
7
+ return (0, graph_display_1.createDisplayGraph)(nodes, {
8
+ name: node => node.metadata.name,
9
+ displayString: node => node.metadata.name,
10
+ children: node => node.dependsOn.flatMap(path => path[0] === 'now' && byName.has(path[1])
11
+ ? [byName.get(path[1])] : []),
12
+ dependencyPaths: node => node.dependsOn,
13
+ mustBeBefore: node => node.mustBeBefore ?? [],
14
+ source: path => path[0] === 'input' && path.length > 2 ? path[1] : path[0],
15
+ fieldName: path => (path[0] === 'input' && path.length > 2
16
+ ? path.slice(2) : path.slice(1)).join('.')
17
+ });
18
+ };
19
+ const node = (name, ...dependsOn) => ({ type: 'cel', metadata: { name }, dependsOn });
20
+ const names = (generations) => generations.map(generation => generation.map(n => n.metadata.name));
21
+ describe('display graph input augmentation', () => {
22
+ it('creates one input per external path and preserves every original node', () => {
23
+ const a = node('A', ['input', 'customers', 'orderCount']);
24
+ const b = node('B', ['input', 'customers', 'orderCount'], ['input', 'customers', 'profile', 'region'], ['now', 'A']);
25
+ const original = JSON.stringify([a, b]);
26
+ const display = (0, errors_1.valueOrThrow)(graph(a, b));
27
+ expect(display.inputs).toEqual([
28
+ { type: 'input', path: ['input', 'customers', 'orderCount'], source: 'customers', fieldName: 'orderCount',
29
+ metadata: { name: 'input.customers.orderCount', source: 'customers', fieldName: 'orderCount' },
30
+ dependsOn: [], displayDependsOn: [] },
31
+ { type: 'input', path: ['input', 'customers', 'profile', 'region'], source: 'customers', fieldName: 'profile.region',
32
+ metadata: { name: 'input.customers.profile.region', source: 'customers', fieldName: 'profile.region' },
33
+ dependsOn: [], displayDependsOn: [] }
34
+ ]);
35
+ expect(display.nodes.slice(2)).toEqual([
36
+ { ...a, displayDependsOn: [['now', 'input.customers.orderCount']] },
37
+ { ...b, displayDependsOn: [
38
+ ['now', 'A'], ['now', 'input.customers.orderCount'], ['now', 'input.customers.profile.region']
39
+ ] }
40
+ ]);
41
+ expect(JSON.stringify([a, b])).toBe(original);
42
+ });
43
+ it('sorts real edges through shared inputs and plans downstream propagation', () => {
44
+ const display = (0, errors_1.valueOrThrow)(graph(node('A', ['input', 'customers', 'id']), node('B', ['input', 'customers', 'id']), node('C', ['now', 'A'], ['now', 'B'])));
45
+ const sorted = (0, errors_1.valueOrThrow)((0, graph_display_1.sortDisplayGraph)(display));
46
+ expect(names(sorted)).toEqual([
47
+ ['input.customers.id'], ['A', 'B'], ['C']
48
+ ]);
49
+ const planned = (0, errors_1.valueOrThrow)((0, graph_display_1.planDisplayGraph)(display, sorted));
50
+ expect(planned.map(generation => generation.map(item => ({
51
+ index: item.index, name: item.node.metadata.name, downstream: item.downstream
52
+ })))).toEqual([
53
+ [{ index: 0, name: 'input.customers.id', downstream: [1, 2] }],
54
+ [{ index: 1, name: 'A', downstream: [3] }, { index: 2, name: 'B', downstream: [3] }],
55
+ [{ index: 3, name: 'C', downstream: [] }]
56
+ ]);
57
+ });
58
+ it('preserves mustBeBefore ordering without turning it into propagation', () => {
59
+ const a = { ...node('A'), mustBeBefore: [['prev', 'B']] };
60
+ const display = (0, errors_1.valueOrThrow)(graph(node('B'), a));
61
+ const sorted = (0, errors_1.valueOrThrow)((0, graph_display_1.sortDisplayGraph)(display));
62
+ expect(names(sorted)).toEqual([['A'], ['B']]);
63
+ const planned = (0, errors_1.valueOrThrow)((0, graph_display_1.planDisplayGraph)(display, sorted));
64
+ expect(planned.map(generation => generation.map(item => item.downstream))).toEqual([[[]], [[]]]);
65
+ });
66
+ it('treats variables and unqualified input fields as distinct external nodes', () => {
67
+ const display = (0, errors_1.valueOrThrow)(graph(node('A', ['variables', 'periodicity'], ['input', 'amount'])));
68
+ expect(display.inputs.map(input => ({ name: input.metadata.name, source: input.source, fieldName: input.fieldName })))
69
+ .toEqual([
70
+ { name: 'variables.periodicity', source: 'variables', fieldName: 'periodicity' },
71
+ { name: 'input.amount', source: 'input', fieldName: 'amount' }
72
+ ]);
73
+ });
74
+ it('rejects unresolved computational references', () => {
75
+ const a = node('A', ['now', 'B']);
76
+ const result = (0, graph_display_1.createDisplayGraph)([a], {
77
+ name: node => node.metadata.name,
78
+ displayString: node => node.metadata.name,
79
+ children: () => [node('B')],
80
+ dependencyPaths: node => node.dependsOn,
81
+ mustBeBefore: node => node.mustBeBefore ?? [],
82
+ source: () => 'input', fieldName: () => 'field'
83
+ });
84
+ expect(result).toEqual({ errors: ['A: unknown display dependency B'] });
85
+ });
86
+ it('reports an external field identity colliding with a calculation', () => {
87
+ expect(graph(node('input.amount'), node('A', ['input', 'amount']))).toEqual({ errors: [
88
+ 'Input input.amount: conflicts with an authored graph node'
89
+ ] });
90
+ });
91
+ });
92
+ //# sourceMappingURL=graph.display.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph.display.spec.js","sourceRoot":"","sources":["../../src/graph.display.spec.ts"],"names":[],"mappings":";;AAAA,mDAA2G;AAC3G,6CAA6C;AAQ7C,MAAM,KAAK,GAAG,CAAC,GAAG,KAAiB,EAAE,EAAE;IACnC,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;IACrE,OAAO,IAAA,kCAAkB,EAAC,KAAK,EAAE;QAC7B,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI;QAChC,aAAa,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI;QACzC,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,KAAK,IAAI,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACrF,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAClC,eAAe,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS;QACvC,YAAY,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,YAAY,IAAI,EAAE;QAC7C,MAAM,EAAE,IAAI,CAAC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SAAS;YACvC,YAAY,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,YAAY,IAAI,EAAE;YAC7C,MAAM,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,OAAO;SAClD,CAAC,CAAA;QACF,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAC,MAAM,EAAE,CAAC,iCAAiC,CAAC,EAAC,CAAC,CAAA;IACzE,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,iEAAiE,EAAE,GAAG,EAAE;QACvE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAC,MAAM,EAAE;gBACjF,2DAA2D;aAC9D,EAAC,CAAC,CAAA;IACP,CAAC,CAAC,CAAA;AACN,CAAC,CAAC,CAAA"}
@@ -0,0 +1,23 @@
1
+ import { type DependsOnTC } from './dependency.closure';
2
+ export declare function graphNeighbourhood<Node>(nodes: readonly Node[], roots: readonly Node[], tc: DependsOnTC<Node>): {
3
+ upstream: Node[];
4
+ downstream: Node[];
5
+ nodes: Node[];
6
+ };
7
+ /** The canonical display representation deliberately separates computational edges
8
+ * from authored paths and temporal ordering constraints. */
9
+ export interface NeighbourhoodDisplayNode {
10
+ readonly metadata: {
11
+ readonly name: string;
12
+ };
13
+ readonly displayDependsOn: readonly (readonly string[])[];
14
+ }
15
+ export declare function displayNeighbourhood<Node extends NeighbourhoodDisplayNode>(nodes: readonly Node[], names: readonly string[]): {
16
+ roots: string[];
17
+ missing: string[];
18
+ upstream: string[];
19
+ downstream: string[];
20
+ nodes: (Node & {
21
+ displayDependsOn: (readonly string[])[];
22
+ })[];
23
+ };
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.graphNeighbourhood = graphNeighbourhood;
4
+ exports.displayNeighbourhood = displayNeighbourhood;
5
+ const dependency_closure_1 = require("./dependency.closure");
6
+ function graphNeighbourhood(nodes, roots, tc) {
7
+ const upstream = new Set((0, dependency_closure_1.upstreamDependencyClosure)(roots, tc, () => true));
8
+ const downstream = new Set((0, dependency_closure_1.downstreamDependencyClosure)(nodes, roots, tc, () => true));
9
+ return {
10
+ upstream: nodes.filter(node => upstream.has(node)),
11
+ downstream: nodes.filter(node => downstream.has(node)),
12
+ nodes: nodes.filter(node => upstream.has(node) || downstream.has(node))
13
+ };
14
+ }
15
+ function displayNeighbourhood(nodes, names) {
16
+ const byName = new Map(nodes.map(node => [node.metadata.name, node]));
17
+ const roots = [...new Set(names)].filter(name => byName.has(name));
18
+ const missing = [...new Set(names)].filter(name => !byName.has(name));
19
+ const dependencyName = (path) => path.length === 2 && path[0] === 'now' ? path[1] : undefined;
20
+ const tc = { dependsOn: node => node.displayDependsOn.flatMap(path => {
21
+ const name = dependencyName(path);
22
+ const dependency = name === undefined ? undefined : byName.get(name);
23
+ return dependency ? [dependency] : [];
24
+ }) };
25
+ const result = graphNeighbourhood(nodes, roots.map(name => byName.get(name)), tc);
26
+ const included = new Set(result.nodes.map(node => node.metadata.name));
27
+ return {
28
+ roots, missing,
29
+ upstream: result.upstream.map(node => node.metadata.name),
30
+ downstream: result.downstream.map(node => node.metadata.name),
31
+ nodes: result.nodes.map(node => ({ ...node, displayDependsOn: node.displayDependsOn.filter(path => {
32
+ const name = dependencyName(path);
33
+ return name !== undefined && included.has(name);
34
+ }) }))
35
+ };
36
+ }
37
+ //# sourceMappingURL=graph.neighbourhood.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph.neighbourhood.js","sourceRoot":"","sources":["../../src/graph.neighbourhood.ts"],"names":[],"mappings":";;AAEA,gDAQC;AASD,oDAqBC;AAxCD,6DAA6G;AAE7G,SAAgB,kBAAkB,CAAO,KAAsB,EAAE,KAAsB,EAAE,EAAqB;IAC1G,MAAM,QAAQ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,CAAC,EAAE,CAAC,CAAC,EAAC,GAAG,IAAI,EAAE,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;gBAC7F,MAAM,IAAI,GAAG,cAAc,CAAC,IAAI,CAAC,CAAA;gBACjC,OAAO,IAAI,KAAK,SAAS,IAAI,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;YACnD,CAAC,CAAC,EAAC,CAAC,CAAC;KACR,CAAA;AACL,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const graph_neighbourhood_1 = require("./graph.neighbourhood");
4
+ const node = (name, ...dependencies) => ({ metadata: { name }, displayDependsOn: dependencies.map(d => ['now', d]), mustBeBefore: [['prev', 'isolated']] });
5
+ const input = node('input.customers.orderCount');
6
+ const a = node('A', input.metadata.name);
7
+ const other = node('other');
8
+ const b = node('B', 'A', 'other');
9
+ const isolated = node('isolated');
10
+ const nodes = [input, a, other, b, isolated];
11
+ it('returns inclusive closures in source order and removes dangling display edges only', () => {
12
+ expect((0, graph_neighbourhood_1.displayNeighbourhood)(nodes, ['A'])).toEqual({
13
+ roots: ['A'], missing: [], upstream: [input.metadata.name, 'A'], downstream: ['A', 'B'],
14
+ nodes: [input, a, { ...b, displayDependsOn: [['now', 'A']] }]
15
+ });
16
+ });
17
+ it('unions multiple roots without duplicating shared dependencies', () => {
18
+ expect((0, graph_neighbourhood_1.displayNeighbourhood)(nodes, ['A', 'B', 'A', 'missing'])).toEqual({
19
+ roots: ['A', 'B'], missing: ['missing'], upstream: [input.metadata.name, 'A', 'other', 'B'],
20
+ downstream: ['A', 'B'], nodes: [input, a, other, b]
21
+ });
22
+ });
23
+ it('handles isolated, missing and empty selections', () => {
24
+ expect((0, graph_neighbourhood_1.displayNeighbourhood)(nodes, ['isolated'])).toEqual({ roots: ['isolated'], missing: [], upstream: ['isolated'], downstream: ['isolated'], nodes: [isolated] });
25
+ expect((0, graph_neighbourhood_1.displayNeighbourhood)(nodes, ['missing'])).toEqual({ roots: [], missing: ['missing'], upstream: [], downstream: [], nodes: [] });
26
+ expect((0, graph_neighbourhood_1.displayNeighbourhood)(nodes, [])).toEqual({ roots: [], missing: [], upstream: [], downstream: [], nodes: [] });
27
+ });
28
+ //# sourceMappingURL=graph.neighbourhood.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph.neighbourhood.spec.js","sourceRoot":"","sources":["../../src/graph.neighbourhood.spec.ts"],"names":[],"mappings":";;AAAA,+DAA0D;AAE1D,MAAM,IAAI,GAAG,CAAC,IAAY,EAAE,GAAG,YAAsB,EAAE,EAAE,CAAC,CAAC,EAAC,QAAQ,EAAE,EAAC,IAAI,EAAC,EAAE,gBAAgB,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,EAAC,CAAC,CAAA;AACzK,MAAM,KAAK,GAAG,IAAI,CAAC,4BAA4B,CAAC,CAAA;AAChD,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;AACxC,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,CAAA;AAC3B,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,CAAA;AACjC,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,CAAA;AACjC,MAAM,KAAK,GAAG,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAA;AAE5C,EAAE,CAAC,oFAAoF,EAAE,GAAG,EAAE;IAC1F,MAAM,CAAC,IAAA,0CAAoB,EAAC,KAAK,EAAE,CAAC,GAAG,CAAC,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,EAAC,CAAC,CAAA;IAClK,MAAM,CAAC,IAAA,0CAAoB,EAAC,KAAK,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAC,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAC,CAAC,CAAA;IACpI,MAAM,CAAC,IAAA,0CAAoB,EAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,EAAC,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAC,CAAC,CAAA;AACtH,CAAC,CAAC,CAAA"}
package/index.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from './src/graph.display'
2
+ export * from './src/dependency.closure'
3
+ export * from './src/graph.neighbourhood'
package/package.json CHANGED
@@ -1,6 +1,66 @@
1
1
  {
2
2
  "name": "@cobol-ts/graph_utils",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "description": "Display-only graph augmentation with external input nodes, topological ordering and downstream planning",
4
+ "version": "0.0.20",
5
+ "main": "dist/index",
6
+ "types": "dist/index",
7
+ "browserslist": {
8
+ "development": [
9
+ "last 1 chrome version",
10
+ "last 1 firefox version",
11
+ "last 1 safari version"
12
+ ],
13
+ "production": [
14
+ ">0.2%",
15
+ "not dead",
16
+ "not op_mini all"
17
+ ]
18
+ },
19
+ "dependencies": {
20
+ "@cobol-ts/errors": "0.0.20",
21
+ "@cobol-ts/graph": "0.0.20",
22
+ "@cobol-ts/topological-sort": "0.0.20",
23
+ "@cobol-ts/planned_graph": "0.0.20"
24
+ },
25
+ "devDependencies": {
26
+ "typescript": "^5.2.2",
27
+ "@testing-library/jest-dom": "^6.1.4",
28
+ "@types/jest": "^29.0.0",
29
+ "@types/node": "^14.0.0",
30
+ "jest": "^29.0.0",
31
+ "ts-jest": "^29.0.0"
32
+ },
33
+ "eslintConfig": {
34
+ "extends": [
35
+ "react-app",
36
+ "react-app/jest"
37
+ ],
38
+ "overrides": [
39
+ {
40
+ "files": [
41
+ "**/*.stories.*"
42
+ ],
43
+ "rules": {
44
+ "import/no-anonymous-default-export": "off"
45
+ }
46
+ }
47
+ ]
48
+ },
49
+ "files": [
50
+ "dist/index.js",
51
+ "dist/index.d.ts",
52
+ "dist/src/",
53
+ "build/",
54
+ "dist/**/*"
55
+ ],
56
+ "keywords": [
57
+ "indexing"
58
+ ],
59
+ "license": "MIT",
60
+ "module": "./index.ts",
61
+ "repository": "git@github.com:intellimaintain/intellimaintain.git",
62
+ "scripts": {
63
+ "test": "jest --config jest.config.json --env node",
64
+ "test:watch": "npm run test -- --watch"
65
+ }
6
66
  }