Skip to content

Commit cd30f8a

Browse files
committed
feat(query-generation): made some things parallel
1 parent 77abce8 commit cd30f8a

31 files changed

Lines changed: 962 additions & 646 deletions

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ mochawesome-report
66
commitlint.config.js
77
.czferc.js
88
/migrations
9+
/scripts

scripts/visualize-graph.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/**
2+
* Run with: npx ts-node scripts/visualize-graph.ts
3+
* Outputs a Mermaid diagram of the DbQuery graph to stdout.
4+
* Paste the output into https://mermaid.live to visualize.
5+
*/
6+
import {Context} from '@loopback/core';
7+
import {DbQueryGraph, DbQueryNodes} from '../src/components';
8+
import {GRAPH_NODE_NAME} from '../src/constant';
9+
10+
async function main() {
11+
const context = new Context('visualize');
12+
context.bind('DbQueryGraph').toClass(DbQueryGraph);
13+
14+
// Register dummy nodes for all enum values
15+
for (const key of Object.values(DbQueryNodes)) {
16+
context
17+
.bind(`services.${key}`)
18+
.to({execute: async (state: unknown) => state})
19+
.tag({[GRAPH_NODE_NAME]: key});
20+
}
21+
22+
const graphBuilder = await context.get<DbQueryGraph>('DbQueryGraph');
23+
const compiled = await graphBuilder.build();
24+
const graph = compiled.getGraph();
25+
const mermaid = graph.drawMermaid();
26+
27+
console.log(mermaid);
28+
}
29+
30+
main().catch(console.error);

0 commit comments

Comments
 (0)