@atolis-hq/corum 0.1.50 → 0.1.52
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/src/linter/index.js +1 -1
- package/package.json +1 -1
- package/web/graph-utils.js +6 -2
- package/web/graph-utils.test.js +7 -1
- package/web/graph.jsx +2 -2
package/dist/src/linter/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import { getTemplateSchema } from '../loader/template-props.js';
|
|
|
13
13
|
* in memory (mutations): the loader drops such edges before they ever reach
|
|
14
14
|
* a loaded Graph, so `strict` loads are unaffected in practice.
|
|
15
15
|
*
|
|
16
|
-
* Rules implemented (see
|
|
16
|
+
* Rules implemented (see project/adrs/REF-006-rules.md for the full catalogue):
|
|
17
17
|
* - T-003/T-004/T-005: node properties validated (shallow) against the
|
|
18
18
|
* owning template's JSON-schema-like `properties` block.
|
|
19
19
|
* - E-005/E-006: explicit (non-generated) edges validated against the
|
package/package.json
CHANGED
package/web/graph-utils.js
CHANGED
|
@@ -42,6 +42,10 @@ function applyEdgeTypeFilter(edges, visibleTypes) {
|
|
|
42
42
|
return edges.filter(e => visibleTypes.has(e.type));
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
function collectEdgeTypes(...edgeLists) {
|
|
46
|
+
return [...new Set(edgeLists.flatMap(edges => edges.map(edge => edge.type)))].sort();
|
|
47
|
+
}
|
|
48
|
+
|
|
45
49
|
// Weakly connected components. Edges use {from, to}; extraLinks are additional
|
|
46
50
|
// affinity pairs (e.g. group co-membership) that merge components without
|
|
47
51
|
// being real edges. Returns arrays of node ids.
|
|
@@ -108,8 +112,8 @@ function filterOwnerScope(nodes, edges, parentId) {
|
|
|
108
112
|
}
|
|
109
113
|
|
|
110
114
|
if (typeof module !== 'undefined' && module.exports) {
|
|
111
|
-
module.exports = { buildComponentMap, applyEdgeTypeFilter, getDisplayName, computeConnectedComponents, filterThreadScope, filterOwnerScope };
|
|
115
|
+
module.exports = { buildComponentMap, applyEdgeTypeFilter, collectEdgeTypes, getDisplayName, computeConnectedComponents, filterThreadScope, filterOwnerScope };
|
|
112
116
|
}
|
|
113
117
|
if (typeof window !== 'undefined') {
|
|
114
|
-
window.CorumGraphUtils = { buildComponentMap, applyEdgeTypeFilter, getDisplayName, computeConnectedComponents, filterThreadScope, filterOwnerScope };
|
|
118
|
+
window.CorumGraphUtils = { buildComponentMap, applyEdgeTypeFilter, collectEdgeTypes, getDisplayName, computeConnectedComponents, filterThreadScope, filterOwnerScope };
|
|
115
119
|
}
|
package/web/graph-utils.test.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// run with: node web/graph-utils.test.js
|
|
2
2
|
const graphUtils = require('./graph-utils.js');
|
|
3
|
-
const { buildComponentMap, applyEdgeTypeFilter, getDisplayName } = graphUtils;
|
|
3
|
+
const { buildComponentMap, applyEdgeTypeFilter, collectEdgeTypes, getDisplayName } = graphUtils;
|
|
4
4
|
|
|
5
5
|
(async () => {
|
|
6
6
|
let passed = 0, failed = 0;
|
|
@@ -43,6 +43,12 @@ const { buildComponentMap, applyEdgeTypeFilter, getDisplayName } = graphUtils;
|
|
|
43
43
|
const none = applyEdgeTypeFilter(edges, new Set([]));
|
|
44
44
|
assert(none.length === 0, 'applyEdgeTypeFilter: empty set returns nothing');
|
|
45
45
|
|
|
46
|
+
const focusOnlyEdges = [{ id: 'e4', from: 'orders.DomainModel.order', to: 'payments.DomainModel.payment', type: 'precedes' }];
|
|
47
|
+
assert(
|
|
48
|
+
JSON.stringify(collectEdgeTypes(edges, focusOnlyEdges)) === JSON.stringify(['calls', 'precedes', 'reads']),
|
|
49
|
+
'collectEdgeTypes: includes types that exist only in focus data',
|
|
50
|
+
);
|
|
51
|
+
|
|
46
52
|
const { computeConnectedComponents, filterThreadScope, filterOwnerScope } = graphUtils;
|
|
47
53
|
|
|
48
54
|
const ccAll = computeConnectedComponents(nodes, edges);
|
package/web/graph.jsx
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const { useState, useEffect, useMemo, useCallback, useRef } = React;
|
|
4
4
|
const { navigate, Icon, TemplateBadge, StateTag, StabilityTag } = window.CorumPrimitives;
|
|
5
5
|
const { buildRoute, parseRoute } = window.CorumRouter;
|
|
6
|
-
const { buildComponentMap, applyEdgeTypeFilter, getDisplayName, computeConnectedComponents, filterThreadScope, filterOwnerScope } = window.CorumGraphUtils;
|
|
6
|
+
const { buildComponentMap, applyEdgeTypeFilter, collectEdgeTypes, getDisplayName, computeConnectedComponents, filterThreadScope, filterOwnerScope } = window.CorumGraphUtils;
|
|
7
7
|
|
|
8
8
|
const RF = window.ReactFlow;
|
|
9
9
|
const ReactFlowCanvas = RF.ReactFlow || RF.default;
|
|
@@ -717,7 +717,7 @@ function GraphView({ route, viewingRef, templates }) {
|
|
|
717
717
|
}, [focalNodeId, depth, viewingRef]);
|
|
718
718
|
|
|
719
719
|
const templateMap = useMemo(() => new Map((templates ?? []).map(t => [t.name, t])), [templates]);
|
|
720
|
-
const availableEdgeTypes = useMemo(() =>
|
|
720
|
+
const availableEdgeTypes = useMemo(() => collectEdgeTypes(graphData?.edges ?? [], focusData?.edges ?? []), [graphData, focusData]);
|
|
721
721
|
const visibleEdgeTypes = useMemo(
|
|
722
722
|
() => new Set(availableEdgeTypes.filter(type => !hiddenEdgeTypes.has(type))),
|
|
723
723
|
[availableEdgeTypes, hiddenEdgeTypes],
|