@nio/topic-grapher
v2.0.0
Published
nio communications topic grapher
Downloads
3
Readme
Installation
$ npm install @nio/topic-grapher
Usage
import graph from '@nio/topic-grapher';
type ServiceName = string;
type Topic = string;
const services = await fetch(servicesUrl).then(r => r.json());
const blocks = await fetch(blocksUrl).then(r => r.json());
const result = graph(services, blocks)
result.nodes // => Array<ServiceName>
result.edges // => Array<[ServiceName, ServiceName, Topic]>
Trace
const result = graph(services, blocks)
const trace = result.trace('ServiceA', 'ServiceD');
trace.services // Set<ServiceName>
trace.paths // Array<Array<ServiceName>>