@backstage-community/plugin-rbac-backend
Version:
40 lines (36 loc) • 964 B
JavaScript
;
var graphlib = require('@dagrejs/graphlib');
class AncestorSearchMemo {
graph;
constructor() {
this.graph = new graphlib.Graph({ directed: true });
}
isAcyclic() {
return graphlib.alg.isAcyclic(this.graph);
}
findCycles() {
return graphlib.alg.findCycles(this.graph);
}
setEdge(parentEntityRef, childEntityRef) {
this.graph.setEdge(parentEntityRef, childEntityRef);
}
setNode(entityRef) {
this.graph.setNode(entityRef);
}
hasEntityRef(groupRef) {
return this.graph.hasNode(groupRef);
}
debugNodesAndEdges(logger, userEntity) {
logger.debug(
`SubGraph edges: ${JSON.stringify(this.graph.edges())} for ${userEntity}`
);
logger.debug(
`SubGraph nodes: ${JSON.stringify(this.graph.nodes())} for ${userEntity}`
);
}
getNodes() {
return this.graph.nodes();
}
}
exports.AncestorSearchMemo = AncestorSearchMemo;
//# sourceMappingURL=ancestor-search-memo.cjs.js.map