@webpieces/nx-webpieces-rules 0.4.907 → 0.4.908
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/package.json +7 -7
- package/src/lib/runtime-details.js +7 -1
- package/src/lib/runtime-details.js.map +1 -1
- package/src/lib/runtime-external-triggers.d.ts +14 -0
- package/src/lib/runtime-external-triggers.js +45 -0
- package/src/lib/runtime-external-triggers.js.map +1 -0
- package/src/lib/runtime-visualizer.js +23 -22
- package/src/lib/runtime-visualizer.js.map +1 -1
- package/src/lib/runtime-viz-theme.js +2 -2
- package/src/lib/runtime-viz-theme.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webpieces/nx-webpieces-rules",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.908",
|
|
4
4
|
"description": "Nx-specific webpieces validation rules, graph tooling, executors, and inference plugin.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
"README.md"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@webpieces/api-doc-model": "0.4.
|
|
24
|
-
"@webpieces/core-util": "0.4.
|
|
25
|
-
"@webpieces/eslint-rules": "0.4.
|
|
26
|
-
"@webpieces/rules-config": "0.4.
|
|
23
|
+
"@webpieces/api-doc-model": "0.4.908",
|
|
24
|
+
"@webpieces/core-util": "0.4.908",
|
|
25
|
+
"@webpieces/eslint-rules": "0.4.908",
|
|
26
|
+
"@webpieces/rules-config": "0.4.908",
|
|
27
27
|
"madge": "8.0.0",
|
|
28
|
-
"@webpieces/rules-sdk": "0.4.
|
|
28
|
+
"@webpieces/rules-sdk": "0.4.908"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"@nx/devkit": ">=18.0.0"
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@webpieces/tooling-testkit": "0.4.
|
|
44
|
+
"@webpieces/tooling-testkit": "0.4.908"
|
|
45
45
|
},
|
|
46
46
|
"types": "./src/index.d.ts",
|
|
47
47
|
"bin": {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RuntimeDetails = exports.RuntimeNodeDetails = void 0;
|
|
4
|
+
const runtime_external_triggers_1 = require("./runtime-external-triggers");
|
|
4
5
|
const remote_service_node_id_1 = require("./remote-service-node-id");
|
|
5
6
|
class RuntimeNodeDetails {
|
|
6
7
|
implemented;
|
|
@@ -55,6 +56,11 @@ class RuntimeDetails {
|
|
|
55
56
|
}
|
|
56
57
|
this.nodes[name] = new RuntimeNodeDetails(implemented, [...new Set(used)]);
|
|
57
58
|
}
|
|
59
|
+
for (const group of new runtime_external_triggers_1.RuntimeExternalTriggers(graph.triggers).groups) {
|
|
60
|
+
this.edges[`${group.from}->${group.to}`] = group
|
|
61
|
+
.apis()
|
|
62
|
+
.map((api) => `${graph.apis[api]?.owner ?? '?'}#${api}`);
|
|
63
|
+
}
|
|
58
64
|
this.remoteNodes(graph);
|
|
59
65
|
if (model !== null)
|
|
60
66
|
this.renderEdges(graph, model);
|
|
@@ -203,7 +209,7 @@ class RuntimeDetailsController {
|
|
|
203
209
|
for (const group of Array.from(this.host?.querySelectorAll('g.edge') ?? [])) {
|
|
204
210
|
const identity = group.querySelector('title')?.textContent ?? '';
|
|
205
211
|
const entries = this.data.edges[identity];
|
|
206
|
-
if (entries === undefined || entries.length
|
|
212
|
+
if (entries === undefined || entries.length < 2)
|
|
207
213
|
continue;
|
|
208
214
|
const element = group.querySelector('text');
|
|
209
215
|
if (element !== null && element.dataset['wpDetails'] !== 'true')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-details.js","source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AAK,EAAE,EAAE;YAC1C,IAAI,KAAK,CAAC,GAAG,KAAK,OAAO,IAAI,KAAK,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;gBAC7C,KAAK,CAAC,cAAc,EAAE,CAAC;gBACvB,KAAK,CAAC,eAAe,EAAE,CAAC;gBACxB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;YACjD,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ","sourcesContent":["import type { GraphRenderModel } from './graph-render-model';\nimport type { RuntimeGraph, RuntimeRemoteCall } from './runtime-graph-model';\nimport { RemoteServiceNodeId } from './remote-service-node-id';\n\nexport class RuntimeNodeDetails {\n constructor(\n public readonly implemented: string[],\n public readonly used: string[],\n ) {}\n}\n\n/** View data stays complete even when external destinations are hidden from DOT. */\nexport class RuntimeDetails {\n readonly nodes: Record<string, RuntimeNodeDetails> = {};\n readonly edges: Record<string, string[]> = {};\n\n constructor(\n graph: RuntimeGraph,\n showExternalNodes: boolean,\n model: GraphRenderModel | null = null,\n ) {\n for (const [name, service] of Object.entries(graph.services)) {\n // implements is the complete derived API list; wiringImplements is provenance only.\n const implemented = [...new Set(service.implements)].map(\n (api) => `${graph.apis[api]?.owner ?? '?'}#${api}`,\n );\n const used: string[] = [];\n for (const edge of graph.runtimeEdges.filter((edge) => edge.from === name)) {\n const entries = edge.via.map(\n (api) =>\n `${graph.apis[api]?.owner ?? '?'}#${api} → ${edge.to} (${edge.type ?? 'rpc'})` +\n (edge.queue === undefined ? '' : ` via ${edge.queue}`),\n );\n if (service.wiringUses === undefined) used.push(...entries);\n if (edge.type !== 'pubsub')\n this.edges[`${edge.from}->${edge.to}`] = edge.via.map(\n (api) => `${graph.apis[api]?.owner ?? '?'}#${api}`,\n );\n }\n const remoteApis = this.remoteCalls(\n graph,\n name,\n service.wiringUses === undefined ? used : [],\n );\n for (const api of service.wiringUses === undefined ? service.uses : []) {\n if (graph.runtimeEdges.some((edge) => edge.from === name && edge.via.includes(api)))\n continue;\n if (remoteApis.has(api)) continue;\n const contract = graph.apis[api];\n const external =\n contract?.type === 'external' || contract?.implementedBy.length === 0;\n used.push(\n `${contract?.owner ?? '?'}#${api} → ${external ? (contract?.externalSystem?.label ?? contract?.owner ?? 'unknown external') : 'unknown / inferred target'}` +\n ` (${contract?.type ?? 'rpc'})${external && !showExternalNodes ? ' — destination hidden' : ''}`,\n );\n }\n used.push(...this.wiringUses(graph, name));\n for (const [identity, system] of Object.entries(graph.externalSystems ?? {})) {\n if (!system.usedBy.includes(name)) continue;\n this.edges[`${name}->system__${identity.replace(/[^a-zA-Z0-9_]/g, '_')}`] =\n system.apis.map((api) => `${graph.apis[api]?.owner ?? '?'}#${api}`);\n }\n for (const use of graph.unresolvedUses.filter((use) => use.service === name)) {\n if (graph.apis[use.api]?.externalSystem !== undefined) continue;\n const owner = graph.apis[use.api]?.owner ?? use.api;\n const key = `${name}->external__${owner}`;\n (this.edges[key] ??= []).push(`${owner}#${use.api}`);\n }\n this.nodes[name] = new RuntimeNodeDetails(implemented, [...new Set(used)]);\n }\n this.remoteNodes(graph);\n if (model !== null) this.renderEdges(graph, model);\n }\n\n private wiringUses(graph: RuntimeGraph, name: string): string[] {\n return (graph.services[name].wiringUses ?? []).map(\n (ref) =>\n `${graph.apis[ref.api]?.owner ?? '?'}#${ref.api} → ${ref.targetService ?? 'unknown external target'} (${ref.type})` +\n (ref.conditional === undefined ? '' : ` conditional on ${ref.conditional}`),\n );\n }\n\n /** A reviewed remote service's node details: the contracts its declaration says it implements. */\n private remoteNodes(graph: RuntimeGraph): void {\n for (const [name, remote] of Object.entries(graph.remoteServices ?? {}))\n this.nodes[new RemoteServiceNodeId().of(name)] = new RuntimeNodeDetails(\n [...new Set(remote.implements)],\n [],\n );\n }\n\n /**\n * The edge details for `name`'s calls into reviewed remote services (#1203), also appended to\n * `used`; returns the contracts covered so they are not reported as an unknown target.\n */\n private remoteCalls(graph: RuntimeGraph, name: string, used: string[]): Set<string> {\n const covered = new Set<string>();\n for (const [remoteName, remote] of Object.entries(graph.remoteServices ?? {}))\n for (const call of remote.calledBy.filter(\n (entry: RuntimeRemoteCall) => entry.from === name,\n )) {\n const entries = call.via.map(\n (api: string) =>\n `${graph.apis[api]?.owner ?? '?'}#${api} → ${remoteName} (remote service, ${call.type})`,\n );\n for (const api of call.via) covered.add(api);\n used.push(...entries);\n const key = `${name}->${new RemoteServiceNodeId().of(remoteName)}`;\n this.edges[key] = [\n ...(this.edges[key] ?? []),\n ...call.via.map((api) => `${graph.apis[api]?.owner ?? '?'}#${api}`),\n ];\n }\n return covered;\n }\n\n /** Bind detail facts to renderer-owned identities, including grouped queue hops. */\n private renderEdges(graph: RuntimeGraph, model: GraphRenderModel): void {\n for (const edge of model.edges) {\n const identity = `${edge.from}->${edge.to}`;\n const service = graph.services[edge.from] === undefined ? edge.to : edge.from;\n const queue = model.nodes.find(\n (node) => node.id === (edge.from.startsWith('queue__') ? edge.from : edge.to),\n );\n const via = graph.runtimeEdges.filter((call) => {\n if (call.type !== 'pubsub') return call.from === edge.from && call.to === edge.to;\n if (call.from !== service && call.to !== service) return false;\n return (\n queue !== undefined &&\n (call.queue === undefined\n ? call.via.some((api) => queue.queueKeys.includes(`queue:${api}`))\n : queue.queueKeys.includes(call.queue))\n );\n });\n const entries = [...(this.edges[identity] ?? [])];\n for (const call of via) {\n for (const api of call.via) {\n if (\n call.queue === undefined &&\n call.type === 'pubsub' &&\n !queue?.queueKeys.includes(`queue:${api}`)\n )\n continue;\n entries.push(`${graph.apis[api]?.owner ?? '?'}#${api}`);\n }\n }\n this.edges[identity] = [...new Set(entries)];\n }\n }\n\n script(): string {\n const encoded = JSON.stringify(this).replace(/</g, '\\\\u003c');\n return `new (${RuntimeDetailsController.toString()})(${encoded});`;\n }\n}\n\n/** Explicit click controller; redraws rebind edge controls and dismiss stale anchors. */\nclass RuntimeDetailsController {\n private readonly host = document.getElementById('graph');\n private readonly panel = document.createElement('div');\n private anchor: SVGElement | null = null;\n private identity = '';\n private implemented = false;\n\n constructor(private readonly data: RuntimeDetails) {\n if (this.host === null) return;\n this.panel.className = 'wp-graph-details';\n this.panel.hidden = true;\n this.panel.setAttribute('role', 'dialog');\n this.panel.setAttribute('aria-label', 'API relationships');\n document.body.append(this.panel);\n new MutationObserver(() => this.attach()).observe(this.host, { childList: true });\n this.attach();\n document.addEventListener('wp-runtime-implements', (event) => {\n const detail = (event as CustomEvent<RuntimeImplementsPayload>).detail;\n this.open(\n detail.node,\n this.data.nodes[detail.name]?.implemented ?? [],\n detail.name,\n true,\n );\n });\n document.addEventListener('keydown', (event) => {\n if (event.key === 'Escape' && !this.panel.hidden) {\n event.stopPropagation();\n this.close();\n }\n });\n document.addEventListener('click', (event) => {\n if (\n event.target instanceof Node &&\n !this.panel.contains(event.target) &&\n !this.anchor?.contains(event.target)\n )\n this.close();\n });\n document.addEventListener('wp-graph-transform', () => this.position());\n this.host.addEventListener('scroll', () => this.position());\n window.addEventListener('resize', () => this.position());\n }\n\n private position(): void {\n if (this.anchor === null || this.panel.hidden) return;\n const rect = this.anchor.getBoundingClientRect();\n this.panel.style.left = `${Math.max(12, Math.min(rect.left, innerWidth - this.panel.offsetWidth - 12))}px`;\n this.panel.style.top = `${Math.max(12, Math.min(rect.bottom + 6, innerHeight - this.panel.offsetHeight - 12))}px`;\n }\n\n private close(): void {\n if (this.panel.hidden) return;\n const old = this.anchor;\n this.panel.hidden = true;\n this.anchor = null;\n if (old?.isConnected) old.focus();\n }\n\n private open(\n element: SVGElement,\n entries: string[],\n identity: string,\n implemented: boolean,\n ): void {\n this.anchor = element;\n this.identity = identity;\n this.implemented = implemented;\n const close = document.createElement('button');\n close.type = 'button';\n close.textContent = 'Close';\n close.onclick = () => this.close();\n const list = document.createElement('ul');\n for (const entry of entries.length === 0\n ? ['No implemented contracts recorded in this saved snapshot.']\n : entries) {\n const item = document.createElement('li');\n item.textContent = entry;\n list.append(item);\n }\n this.panel.replaceChildren(close, list);\n this.panel.hidden = false;\n this.position();\n close.focus({ preventScroll: true });\n }\n\n private attach(): void {\n for (const group of Array.from(this.host?.querySelectorAll<SVGGElement>('g.edge') ?? [])) {\n const identity = group.querySelector('title')?.textContent ?? '';\n const entries = this.data.edges[identity];\n if (entries === undefined || entries.length === 0) continue;\n const element = group.querySelector('text');\n if (element !== null && element.dataset['wpDetails'] !== 'true')\n this.attachElement(element, entries, identity);\n }\n if (this.panel.hidden || this.anchor?.isConnected) return;\n const groups = Array.from(\n this.host?.querySelectorAll<SVGGElement>(this.implemented ? 'g.node' : 'g.edge') ?? [],\n );\n const group = groups.find(\n (node) => node.querySelector('title')?.textContent === this.identity,\n );\n const replacement = this.implemented ? group : group?.querySelector('text');\n if (replacement) {\n this.anchor = replacement;\n this.position();\n } else this.close();\n }\n\n private attachElement(element: SVGTextElement, entries: string[], identity: string): void {\n element.dataset['wpDetails'] = 'true';\n element.classList.add('wp-api-detail');\n element.setAttribute('tabindex', '0');\n element.setAttribute('role', 'button');\n element.setAttribute('aria-label', `Uses: ${identity}`);\n element.setAttribute('aria-haspopup', 'dialog');\n element.addEventListener('click', (event) => {\n event.stopPropagation();\n this.open(element, entries, identity, false);\n });\n element.addEventListener('keydown', (event) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n event.stopPropagation();\n this.open(element, entries, identity, false);\n }\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"runtime-details.js","sourceRoot":"","sources":["../../../../../../packages/tooling/nx-webpieces-rules/src/lib/runtime-details.ts"],"names":[],"mappings":";;;AAEA,2EAAsE;AACtE,qEAA+D;AAE/D,MAAa,kBAAkB;IAEP;IACA;IAFpB,YACoB,WAAqB,EACrB,IAAc;QADd,gBAAW,GAAX,WAAW,CAAU;QACrB,SAAI,GAAJ,IAAI,CAAU;IAC/B,CAAC;CACP;AALD,gDAKC;AAED,oFAAoF;AACpF,MAAa,cAAc;IACd,KAAK,GAAuC,EAAE,CAAC;IAC/C,K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CAAC,CAAC;QACH,OAAO,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;YAC1C,IAAI,KAAK,CAAC,GAAG,KAAK,OAAO,IAAI,KAAK,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;gBAC7C,KAAK,CAAC,cAAc,EAAE,CAAC;gBACvB,KAAK,CAAC,eAAe,EAAE,CAAC;gBACxB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;YACjD,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ","sourcesContent":["import type { GraphRenderModel } from './graph-render-model';\nimport type { RuntimeGraph, RuntimeRemoteCall } from './runtime-graph-model';\nimport { RuntimeExternalTriggers } from './runtime-external-triggers';\nimport { RemoteServiceNodeId } from './remote-service-node-id';\n\nexport class RuntimeNodeDetails {\n constructor(\n public readonly implemented: string[],\n public readonly used: string[],\n ) {}\n}\n\n/** View data stays complete even when external destinations are hidden from DOT. */\nexport class RuntimeDetails {\n readonly nodes: Record<string, RuntimeNodeDetails> = {};\n readonly edges: Record<string, string[]> = {};\n\n constructor(\n graph: RuntimeGraph,\n showExternalNodes: boolean,\n model: GraphRenderModel | null = null,\n ) {\n for (const [name, service] of Object.entries(graph.services)) {\n // implements is the complete derived API list; wiringImplements is provenance only.\n const implemented = [...new Set(service.implements)].map(\n (api) => `${graph.apis[api]?.owner ?? '?'}#${api}`,\n );\n const used: string[] = [];\n for (const edge of graph.runtimeEdges.filter((edge) => edge.from === name)) {\n const entries = edge.via.map(\n (api) =>\n `${graph.apis[api]?.owner ?? '?'}#${api} → ${edge.to} (${edge.type ?? 'rpc'})` +\n (edge.queue === undefined ? '' : ` via ${edge.queue}`),\n );\n if (service.wiringUses === undefined) used.push(...entries);\n if (edge.type !== 'pubsub')\n this.edges[`${edge.from}->${edge.to}`] = edge.via.map(\n (api) => `${graph.apis[api]?.owner ?? '?'}#${api}`,\n );\n }\n const remoteApis = this.remoteCalls(\n graph,\n name,\n service.wiringUses === undefined ? used : [],\n );\n for (const api of service.wiringUses === undefined ? service.uses : []) {\n if (graph.runtimeEdges.some((edge) => edge.from === name && edge.via.includes(api)))\n continue;\n if (remoteApis.has(api)) continue;\n const contract = graph.apis[api];\n const external =\n contract?.type === 'external' || contract?.implementedBy.length === 0;\n used.push(\n `${contract?.owner ?? '?'}#${api} → ${external ? (contract?.externalSystem?.label ?? contract?.owner ?? 'unknown external') : 'unknown / inferred target'}` +\n ` (${contract?.type ?? 'rpc'})${external && !showExternalNodes ? ' — destination hidden' : ''}`,\n );\n }\n used.push(...this.wiringUses(graph, name));\n for (const [identity, system] of Object.entries(graph.externalSystems ?? {})) {\n if (!system.usedBy.includes(name)) continue;\n this.edges[`${name}->system__${identity.replace(/[^a-zA-Z0-9_]/g, '_')}`] =\n system.apis.map((api) => `${graph.apis[api]?.owner ?? '?'}#${api}`);\n }\n for (const use of graph.unresolvedUses.filter((use) => use.service === name)) {\n if (graph.apis[use.api]?.externalSystem !== undefined) continue;\n const owner = graph.apis[use.api]?.owner ?? use.api;\n const key = `${name}->external__${owner}`;\n (this.edges[key] ??= []).push(`${owner}#${use.api}`);\n }\n this.nodes[name] = new RuntimeNodeDetails(implemented, [...new Set(used)]);\n }\n for (const group of new RuntimeExternalTriggers(graph.triggers).groups) {\n this.edges[`${group.from}->${group.to}`] = group\n .apis()\n .map((api: string) => `${graph.apis[api]?.owner ?? '?'}#${api}`);\n }\n this.remoteNodes(graph);\n if (model !== null) this.renderEdges(graph, model);\n }\n\n private wiringUses(graph: RuntimeGraph, name: string): string[] {\n return (graph.services[name].wiringUses ?? []).map(\n (ref) =>\n `${graph.apis[ref.api]?.owner ?? '?'}#${ref.api} → ${ref.targetService ?? 'unknown external target'} (${ref.type})` +\n (ref.conditional === undefined ? '' : ` conditional on ${ref.conditional}`),\n );\n }\n\n /** A reviewed remote service's node details: the contracts its declaration says it implements. */\n private remoteNodes(graph: RuntimeGraph): void {\n for (const [name, remote] of Object.entries(graph.remoteServices ?? {}))\n this.nodes[new RemoteServiceNodeId().of(name)] = new RuntimeNodeDetails(\n [...new Set(remote.implements)],\n [],\n );\n }\n\n /**\n * The edge details for `name`'s calls into reviewed remote services (#1203), also appended to\n * `used`; returns the contracts covered so they are not reported as an unknown target.\n */\n private remoteCalls(graph: RuntimeGraph, name: string, used: string[]): Set<string> {\n const covered = new Set<string>();\n for (const [remoteName, remote] of Object.entries(graph.remoteServices ?? {}))\n for (const call of remote.calledBy.filter(\n (entry: RuntimeRemoteCall) => entry.from === name,\n )) {\n const entries = call.via.map(\n (api: string) =>\n `${graph.apis[api]?.owner ?? '?'}#${api} → ${remoteName} (remote service, ${call.type})`,\n );\n for (const api of call.via) covered.add(api);\n used.push(...entries);\n const key = `${name}->${new RemoteServiceNodeId().of(remoteName)}`;\n this.edges[key] = [\n ...(this.edges[key] ?? []),\n ...call.via.map((api) => `${graph.apis[api]?.owner ?? '?'}#${api}`),\n ];\n }\n return covered;\n }\n\n /** Bind detail facts to renderer-owned identities, including grouped queue hops. */\n private renderEdges(graph: RuntimeGraph, model: GraphRenderModel): void {\n for (const edge of model.edges) {\n const identity = `${edge.from}->${edge.to}`;\n const service = graph.services[edge.from] === undefined ? edge.to : edge.from;\n const queue = model.nodes.find(\n (node) => node.id === (edge.from.startsWith('queue__') ? edge.from : edge.to),\n );\n const via = graph.runtimeEdges.filter((call) => {\n if (call.type !== 'pubsub') return call.from === edge.from && call.to === edge.to;\n if (call.from !== service && call.to !== service) return false;\n return (\n queue !== undefined &&\n (call.queue === undefined\n ? call.via.some((api) => queue.queueKeys.includes(`queue:${api}`))\n : queue.queueKeys.includes(call.queue))\n );\n });\n const entries = [...(this.edges[identity] ?? [])];\n for (const call of via) {\n for (const api of call.via) {\n if (\n call.queue === undefined &&\n call.type === 'pubsub' &&\n !queue?.queueKeys.includes(`queue:${api}`)\n )\n continue;\n entries.push(`${graph.apis[api]?.owner ?? '?'}#${api}`);\n }\n }\n this.edges[identity] = [...new Set(entries)];\n }\n }\n\n script(): string {\n const encoded = JSON.stringify(this).replace(/</g, '\\\\u003c');\n return `new (${RuntimeDetailsController.toString()})(${encoded});`;\n }\n}\n\n/** Explicit click controller; redraws rebind edge controls and dismiss stale anchors. */\nclass RuntimeDetailsController {\n private readonly host = document.getElementById('graph');\n private readonly panel = document.createElement('div');\n private anchor: SVGElement | null = null;\n private identity = '';\n private implemented = false;\n\n constructor(private readonly data: RuntimeDetails) {\n if (this.host === null) return;\n this.panel.className = 'wp-graph-details';\n this.panel.hidden = true;\n this.panel.setAttribute('role', 'dialog');\n this.panel.setAttribute('aria-label', 'API relationships');\n document.body.append(this.panel);\n new MutationObserver(() => this.attach()).observe(this.host, { childList: true });\n this.attach();\n document.addEventListener('wp-runtime-implements', (event) => {\n const detail = (event as CustomEvent<RuntimeImplementsPayload>).detail;\n this.open(\n detail.node,\n this.data.nodes[detail.name]?.implemented ?? [],\n detail.name,\n true,\n );\n });\n document.addEventListener('keydown', (event) => {\n if (event.key === 'Escape' && !this.panel.hidden) {\n event.stopPropagation();\n this.close();\n }\n });\n document.addEventListener('click', (event) => {\n if (\n event.target instanceof Node &&\n !this.panel.contains(event.target) &&\n !this.anchor?.contains(event.target)\n )\n this.close();\n });\n document.addEventListener('wp-graph-transform', () => this.position());\n this.host.addEventListener('scroll', () => this.position());\n window.addEventListener('resize', () => this.position());\n }\n\n private position(): void {\n if (this.anchor === null || this.panel.hidden) return;\n const rect = this.anchor.getBoundingClientRect();\n this.panel.style.left = `${Math.max(12, Math.min(rect.left, innerWidth - this.panel.offsetWidth - 12))}px`;\n this.panel.style.top = `${Math.max(12, Math.min(rect.bottom + 6, innerHeight - this.panel.offsetHeight - 12))}px`;\n }\n\n private close(): void {\n if (this.panel.hidden) return;\n const old = this.anchor;\n this.panel.hidden = true;\n this.anchor = null;\n if (old?.isConnected) old.focus();\n }\n\n private open(\n element: SVGElement,\n entries: string[],\n identity: string,\n implemented: boolean,\n ): void {\n this.anchor = element;\n this.identity = identity;\n this.implemented = implemented;\n const close = document.createElement('button');\n close.type = 'button';\n close.textContent = 'Close';\n close.onclick = () => this.close();\n const list = document.createElement('ul');\n for (const entry of entries.length === 0\n ? ['No implemented contracts recorded in this saved snapshot.']\n : entries) {\n const item = document.createElement('li');\n item.textContent = entry;\n list.append(item);\n }\n this.panel.replaceChildren(close, list);\n this.panel.hidden = false;\n this.position();\n close.focus({ preventScroll: true });\n }\n\n private attach(): void {\n for (const group of Array.from(this.host?.querySelectorAll<SVGGElement>('g.edge') ?? [])) {\n const identity = group.querySelector('title')?.textContent ?? '';\n const entries = this.data.edges[identity];\n if (entries === undefined || entries.length < 2) continue;\n const element = group.querySelector('text');\n if (element !== null && element.dataset['wpDetails'] !== 'true')\n this.attachElement(element, entries, identity);\n }\n if (this.panel.hidden || this.anchor?.isConnected) return;\n const groups = Array.from(\n this.host?.querySelectorAll<SVGGElement>(this.implemented ? 'g.node' : 'g.edge') ?? [],\n );\n const group = groups.find(\n (node) => node.querySelector('title')?.textContent === this.identity,\n );\n const replacement = this.implemented ? group : group?.querySelector('text');\n if (replacement) {\n this.anchor = replacement;\n this.position();\n } else this.close();\n }\n\n private attachElement(element: SVGTextElement, entries: string[], identity: string): void {\n element.dataset['wpDetails'] = 'true';\n element.classList.add('wp-api-detail');\n element.setAttribute('tabindex', '0');\n element.setAttribute('role', 'button');\n element.setAttribute('aria-label', `Uses: ${identity}`);\n element.setAttribute('aria-haspopup', 'dialog');\n element.addEventListener('click', (event) => {\n event.stopPropagation();\n this.open(element, entries, identity, false);\n });\n element.addEventListener('keydown', (event) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n event.stopPropagation();\n this.open(element, entries, identity, false);\n }\n });\n }\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { RuntimeTrigger } from './runtime-graph-model';
|
|
2
|
+
/** One external caller/service pair, shared by DOT emission and popup data. */
|
|
3
|
+
export declare class RuntimeExternalTriggerGroup {
|
|
4
|
+
readonly from: string;
|
|
5
|
+
readonly to: string;
|
|
6
|
+
readonly triggers: RuntimeTrigger[];
|
|
7
|
+
constructor(from: string, to: string);
|
|
8
|
+
apis(): string[];
|
|
9
|
+
label(): string;
|
|
10
|
+
}
|
|
11
|
+
export declare class RuntimeExternalTriggers {
|
|
12
|
+
readonly groups: RuntimeExternalTriggerGroup[];
|
|
13
|
+
constructor(triggers: RuntimeTrigger[]);
|
|
14
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RuntimeExternalTriggers = exports.RuntimeExternalTriggerGroup = void 0;
|
|
4
|
+
/** One external caller/service pair, shared by DOT emission and popup data. */
|
|
5
|
+
class RuntimeExternalTriggerGroup {
|
|
6
|
+
from;
|
|
7
|
+
to;
|
|
8
|
+
triggers = [];
|
|
9
|
+
constructor(from, to) {
|
|
10
|
+
this.from = from;
|
|
11
|
+
this.to = to;
|
|
12
|
+
}
|
|
13
|
+
apis() {
|
|
14
|
+
return [...new Set(this.triggers.map((trigger) => trigger.api))].sort();
|
|
15
|
+
}
|
|
16
|
+
label() {
|
|
17
|
+
const apis = this.apis();
|
|
18
|
+
if (apis.length > 1)
|
|
19
|
+
return `Uses (${apis.length}) ▾`;
|
|
20
|
+
const methods = new Set(this.triggers.map((trigger) => trigger.method));
|
|
21
|
+
return methods.size === 1 ? `${apis[0]}.${this.triggers[0].method}` : apis[0];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.RuntimeExternalTriggerGroup = RuntimeExternalTriggerGroup;
|
|
25
|
+
class RuntimeExternalTriggers {
|
|
26
|
+
groups;
|
|
27
|
+
constructor(triggers) {
|
|
28
|
+
const groups = new Map();
|
|
29
|
+
for (const trigger of triggers) {
|
|
30
|
+
if (trigger.kind !== 'external')
|
|
31
|
+
continue;
|
|
32
|
+
const caller = trigger.caller;
|
|
33
|
+
const from = caller === undefined
|
|
34
|
+
? `inbound__${trigger.api.replace(/[^A-Za-z0-9_]/g, '_')}`
|
|
35
|
+
: `system__${caller.label.replace(/[^A-Za-z0-9_]/g, '_')}`;
|
|
36
|
+
const key = JSON.stringify([from, trigger.service]);
|
|
37
|
+
if (!groups.has(key))
|
|
38
|
+
groups.set(key, new RuntimeExternalTriggerGroup(from, trigger.service));
|
|
39
|
+
groups.get(key).triggers.push(trigger);
|
|
40
|
+
}
|
|
41
|
+
this.groups = [...groups.values()];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.RuntimeExternalTriggers = RuntimeExternalTriggers;
|
|
45
|
+
//# sourceMappingURL=runtime-external-triggers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-external-triggers.js","sourceRoot":"","sources":["../../../../../../packages/tooling/nx-webpieces-rules/src/lib/runtime-external-triggers.ts"],"names":[],"mappings":";;;AAEA,+EAA+E;AAC/E,MAAa,2BAA2B;IAIvB;IACA;IAJJ,QAAQ,GAAqB,EAAE,CAAC;IAEzC,YACa,IAAY,EACZ,EAAU;QADV,SAAI,GAAJ,IAAI,CAAQ;QACZ,OAAE,GAAF,EAAE,CAAQ;IACpB,CAAC;IAEJ,IAAI;QACA,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAuB,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC5F,CAAC;IAED,KAAK;QACD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,SAAS,IAAI,CAAC,MAAM,KAAK,CAAC;QACtD,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAuB,EAAE,EAAE,CAAC,OAAO,CAA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AnBD,0DAmBC","sourcesContent":["import type { RuntimeTrigger } from './runtime-graph-model';\n\n/** One external caller/service pair, shared by DOT emission and popup data. */\nexport class RuntimeExternalTriggerGroup {\n readonly triggers: RuntimeTrigger[] = [];\n\n constructor(\n readonly from: string,\n readonly to: string,\n ) {}\n\n apis(): string[] {\n return [...new Set(this.triggers.map((trigger: RuntimeTrigger) => trigger.api))].sort();\n }\n\n label(): string {\n const apis = this.apis();\n if (apis.length > 1) return `Uses (${apis.length}) ▾`;\n const methods = new Set(this.triggers.map((trigger: RuntimeTrigger) => trigger.method));\n return methods.size === 1 ? `${apis[0]}.${this.triggers[0].method}` : apis[0];\n }\n}\n\nexport class RuntimeExternalTriggers {\n readonly groups: RuntimeExternalTriggerGroup[];\n\n constructor(triggers: RuntimeTrigger[]) {\n const groups = new Map<string, RuntimeExternalTriggerGroup>();\n for (const trigger of triggers) {\n if (trigger.kind !== 'external') continue;\n const caller = trigger.caller;\n const from =\n caller === undefined\n ? `inbound__${trigger.api.replace(/[^A-Za-z0-9_]/g, '_')}`\n : `system__${caller.label.replace(/[^A-Za-z0-9_]/g, '_')}`;\n const key = JSON.stringify([from, trigger.service]);\n if (!groups.has(key))\n groups.set(key, new RuntimeExternalTriggerGroup(from, trigger.service));\n groups.get(key)!.triggers.push(trigger);\n }\n this.groups = [...groups.values()];\n }\n}\n"]}
|
|
@@ -57,6 +57,7 @@ const dot_syntax_1 = require("./dot-syntax");
|
|
|
57
57
|
const graph_render_model_1 = require("./graph-render-model");
|
|
58
58
|
const runtime_viewer_adapter_1 = require("./runtime-viewer-adapter");
|
|
59
59
|
const runtime_html_page_1 = require("./runtime-html-page");
|
|
60
|
+
const runtime_external_triggers_1 = require("./runtime-external-triggers");
|
|
60
61
|
const remote_service_node_id_1 = require("./remote-service-node-id");
|
|
61
62
|
const runtime_viz_theme_1 = require("./runtime-viz-theme");
|
|
62
63
|
/** Apis per line inside a node label — beyond this the box grows wider than it is readable. */
|
|
@@ -105,7 +106,7 @@ function labelList(entries) {
|
|
|
105
106
|
function edgeDot(edge) {
|
|
106
107
|
const from = serviceNodeId(edge.from);
|
|
107
108
|
const to = serviceNodeId(edge.to);
|
|
108
|
-
const viaRaw = edge.via.length >
|
|
109
|
+
const viaRaw = edge.via.length > 1
|
|
109
110
|
? `Uses (${edge.via.length}) ▾`
|
|
110
111
|
: edge.via.map((v) => getShortName(v)).join(', ');
|
|
111
112
|
const cut = edge.cutLegacyCycle === true;
|
|
@@ -152,14 +153,14 @@ function queueLine(key, queue) {
|
|
|
152
153
|
}
|
|
153
154
|
/** The node statement + enqueue/deliver arrows for one queue box. Service identities remain raw; only emitted DOT is escaped. */
|
|
154
155
|
// webpieces-disable no-function-outside-class -- DOT string builder, matching getShortName in this file
|
|
155
|
-
function queueBoxDot(id, body, producers, consumers, model,
|
|
156
|
+
function queueBoxDot(id, body, producers, consumers, model, queueKeys) {
|
|
156
157
|
// Record-mode label: the text must clear recordValue(), and QUEUE_LABEL_PREFIX supplies the
|
|
157
158
|
// empty leading field that draws the cylinder's end cap. Drop it and the node silently
|
|
158
159
|
// degrades to a plain box.
|
|
159
160
|
let dot = model.node(id, ` "${id}" [shape=${runtime_viz_theme_1.QUEUE_SHAPE}, style="filled", fillcolor="${runtime_viz_theme_1.QUEUE_FILL}", ` +
|
|
160
161
|
`class="${runtime_viz_theme_1.QUEUE_CLASS}", label="${runtime_viz_theme_1.QUEUE_LABEL_PREFIX}${body}"];\n`, [], queueKeys);
|
|
161
162
|
for (const producer of producers)
|
|
162
|
-
dot += model.edge(producer, id, ` "${serviceNodeId(producer)}" -> "${id}" [label="
|
|
163
|
+
dot += model.edge(producer, id, ` "${serviceNodeId(producer)}" -> "${id}" [label="enqueue", style=dashed];\n`);
|
|
163
164
|
for (const consumer of consumers)
|
|
164
165
|
dot += model.edge(id, consumer, ` "${id}" -> "${serviceNodeId(consumer)}" [style=dashed];\n`);
|
|
165
166
|
return dot;
|
|
@@ -225,13 +226,13 @@ function queuesDot(graph, hidden, model) {
|
|
|
225
226
|
}
|
|
226
227
|
for (const api of [...byContract.keys()].sort()) {
|
|
227
228
|
const ends = byContract.get(api);
|
|
228
|
-
dot += queueBoxDot(`queue__${dotId(api)}`, `${(0, dot_syntax_1.recordValue)(getShortName(api))} queue`, [...ends.producers].sort(), [...ends.consumers].sort(), model,
|
|
229
|
+
dot += queueBoxDot(`queue__${dotId(api)}`, `${(0, dot_syntax_1.recordValue)(getShortName(api))} queue`, [...ends.producers].sort(), [...ends.consumers].sort(), model, [`queue:${api}`]);
|
|
229
230
|
}
|
|
230
231
|
for (const group of groupQueues(byQueue, graph)) {
|
|
231
232
|
const body = group.members
|
|
232
233
|
.map((key) => queueLine(key, graph.queues[key]))
|
|
233
234
|
.join('\\n');
|
|
234
|
-
dot += queueBoxDot(`queue__${dotId(group.members[0])}`, body, group.producers, group.consumers, model,
|
|
235
|
+
dot += queueBoxDot(`queue__${dotId(group.members[0])}`, body, group.producers, group.consumers, model, group.members);
|
|
235
236
|
}
|
|
236
237
|
return dot;
|
|
237
238
|
}
|
|
@@ -280,7 +281,7 @@ function externalSystemNodeDot(identity, kind, label, subtitle, model) {
|
|
|
280
281
|
*
|
|
281
282
|
* Identity is the caller's label in the SAME `system__` space {@link externalSystemsDot} uses, which
|
|
282
283
|
* buys three things at once: two vendors hitting one contract are two boxes, one vendor hitting three
|
|
283
|
-
* methods is one box with
|
|
284
|
+
* methods is one box with one arrow per service, and a vendor this repo also CALLS is that same single box.
|
|
284
285
|
* `options` is passed in for the last of those — when that outbound half will be drawn, this half
|
|
285
286
|
* must not restate the node statement.
|
|
286
287
|
*/
|
|
@@ -293,25 +294,25 @@ function triggerDot(graph, hidden, options, model) {
|
|
|
293
294
|
const drawnOutbound = new Set(options.showExternalNodes ? Object.keys(graph.externalSystems ?? {}) : []);
|
|
294
295
|
const emitted = new Set();
|
|
295
296
|
let dot = '\n // Entry points nothing in this repo calls: a clock, or a system outside the repo.\n';
|
|
296
|
-
for (const trigger of triggers) {
|
|
297
|
+
for (const trigger of triggers.filter((trigger) => trigger.kind === 'cron')) {
|
|
297
298
|
const service = serviceNodeId(trigger.service);
|
|
298
299
|
const label = (0, dot_syntax_1.dotValue)(`${trigger.api}.${trigger.method}`);
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
300
|
+
const id = `cron__${dotId(`${trigger.api}_${trigger.method}`)}`;
|
|
301
|
+
const schedule = (0, dot_syntax_1.dotValue)(trigger.queueName ?? `${trigger.api}-${trigger.method}`);
|
|
302
|
+
dot +=
|
|
303
|
+
model.node(id, ` "${id}" [shape=circle, style="filled", fillcolor="${runtime_viz_theme_1.CRON_FILL}", ` +
|
|
304
|
+
`color="${runtime_viz_theme_1.CRON_BORDER}", label="⏰\\ncron"];\n`) +
|
|
305
|
+
model.edge(id, trigger.service, ` "${id}" -> "${service}" [label="${label}\\n${schedule}", color="${runtime_viz_theme_1.CRON_BORDER}"];\n`);
|
|
306
|
+
}
|
|
307
|
+
for (const group of new runtime_external_triggers_1.RuntimeExternalTriggers(triggers).groups) {
|
|
308
|
+
const trigger = group.triggers[0];
|
|
309
|
+
const service = serviceNodeId(group.to);
|
|
310
|
+
const label = (0, dot_syntax_1.dotValue)(group.label());
|
|
308
311
|
const caller = trigger.caller;
|
|
309
312
|
// Undeclared: only possible for a graph generated BEFORE the caller was required (generation
|
|
310
313
|
// now fails instead). DOTTED and question-marked, so "we were never told who this is" cannot
|
|
311
314
|
// be mistaken for a named vendor.
|
|
312
|
-
const id =
|
|
313
|
-
? `inbound__${dotId(trigger.api)}`
|
|
314
|
-
: `system__${dotId(caller.label)}`;
|
|
315
|
+
const id = group.from;
|
|
315
316
|
if (!emitted.has(id) && !(caller !== undefined && drawnOutbound.has(caller.label))) {
|
|
316
317
|
emitted.add(id);
|
|
317
318
|
dot +=
|
|
@@ -349,7 +350,7 @@ function externalSystemsDot(graph, hidden, model) {
|
|
|
349
350
|
const system = systems[id];
|
|
350
351
|
const via = system.apis.length === 0
|
|
351
352
|
? ''
|
|
352
|
-
: ` [label="${system.apis.length >
|
|
353
|
+
: ` [label="${system.apis.length > 1 ? `Uses (${system.apis.length}) ▾` : labelList([...system.apis].sort())}"]`;
|
|
353
354
|
for (const service of [...system.usedBy].sort()) {
|
|
354
355
|
if (hidden.has(service))
|
|
355
356
|
continue;
|
|
@@ -403,7 +404,7 @@ function externalDot(graph, hidden, model) {
|
|
|
403
404
|
const service = parts[0];
|
|
404
405
|
const external = parts[1];
|
|
405
406
|
const apis = apisByPair.get(key).sort();
|
|
406
|
-
const via = apis.length >
|
|
407
|
+
const via = apis.length > 1 ? `Uses (${apis.length}) ▾` : labelList(apis);
|
|
407
408
|
// SOLID: this is a synchronous call that returns a value. Dashed is reserved for events, and
|
|
408
409
|
// "outside the repo" is already said by the node's dashed border.
|
|
409
410
|
dot += model.edge(service, `external__${external}`, ` "${serviceNodeId(service)}" -> "external__${(0, dot_syntax_1.dotValue)(external)}" ` +
|
|
@@ -442,7 +443,7 @@ function remoteServicesDot(graph, hidden, model) {
|
|
|
442
443
|
for (const call of remotes[name].calledBy) {
|
|
443
444
|
if (hidden.has(call.from))
|
|
444
445
|
continue;
|
|
445
|
-
const via = call.via.length >
|
|
446
|
+
const via = call.via.length > 1 ? `Uses (${call.via.length}) ▾` : labelList(call.via);
|
|
446
447
|
const label = call.type === 'pubsub' ? `${via}\\nenqueue` : via;
|
|
447
448
|
const style = call.type === 'pubsub' ? ', style=dashed' : '';
|
|
448
449
|
dot += model.edge(call.from, id, ` "${serviceNodeId(call.from)}" -> "${id}" [label="${label}", color="${runtime_viz_theme_1.REMOTE_SERVICE_BORDER}"${style}];\n`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-visualizer.js","sourceRoot":"","sources":["../../../../../../packages/tooling/nx-webpieces-rules/src/lib/runtime-visualizer.ts"],"names":[],"mappings":";;;AAilBA,gDAMC;AAID,gEAg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IAC1B,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,0BAA0B,CAAC,CAAC;IACjE,EAAE,CAAC,aAAa,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IAExC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,2BAA2B,CAAC,CAAC;IACnE,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,mCAAe,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;IAEhG,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;AACjC,CAAC","sourcesContent":["import { LevelBandLayout } from './graph-level-bands';\n/**\n * Runtime Visualizer\n *\n * Renders the runtime microservice graph (services + inferred Z -> X edges,\n * each labeled with the api(s) they flow over) to DOT + interactive HTML in\n * tmp/webpieces/runtime-architecture.{dot,html}.\n *\n * Each service node names the contracts it IMPLEMENTS. That list used to be\n * collapsed into a server/client boolean and thrown away — leaving an api that a\n * server serves but nothing in-repo calls completely invisible, and making a\n * correct api design look like a detection failure. What a service USES is NOT\n * listed: every use already draws an outgoing arrow labeled with the same\n * contract, so repeating it in the box only made every box wider.\n *\n * Shape says what a node IS and line style says what a call IS. Solid = rpc: the\n * request follows the arrow and the response flows back. Dashed = event: it flows\n * in the arrow's direction and returns once it is queued. A queue is a sideways\n * cylinder, a datastore an upright one. A queue box lists ONE LINE PER QUEUE: the\n * unit underneath is still the METHOD (what Terraform creates, and what\n * runtime-dependencies.json records), but queues of one contract sharing the same\n * producers and consumers are drawn together instead of as adjacent near-identical\n * boxes — every queue is still named, only the node count drops.\n *\n * Calls that leave the repo (a contract NOTHING in-repo implements — firestore,\n * gmail, ...) are drawn as terminal nodes, so the vendor systems that actually\n * page you at 3am stop being missing from the picture. One that DECLARES what it\n * is, via an `@externalSystem` JSDoc tag or an `external:` nx tag, gets the shape\n * of the thing it is; the rest stay generic dashed boxes. They are RENDER-ONLY:\n * derivation, levels and cycle detection never see them.\n *\n * The same is true in the other direction for endpoints nothing in-repo CALLS: a\n * `cron` method hangs off a clock and an `external` method off a box naming the\n * CALLER that posts to it (`twilio`), in the same id space as the outbound\n * systems, so a vendor we both call and are called by is ONE box. Those are the\n * entry points that wake a service up at 3am, and a graph built only from in-repo\n * callers cannot show them at all.\n *\n * EVERY node on the rendered page is clickable and opens the SHARED floating menu\n * (graph-node-menu.ts — one implementation, also used by architecture/dependencies.html\n * and every project's design.html). Lock/Unlock pins separate complete incoming/outgoing chains, with hover adding a temporary chain. There is no \"View Design\"\n * item here — a node is a running service, queue, datastore or third-party system, not\n * an nx project, so no design.html exists to point at and the item is absent rather than\n * dead. Filter Unconnected follows separate incoming/outgoing chains and compacts the rendered\n * topology; Turn off Filter restores the full picture. Lock remains independent of Filter.\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport type {\n RuntimeGraph,\n RuntimeEdge,\n RuntimeQueue,\n RuntimeService,\n RuntimeTrigger,\n} from './runtime-graph';\nimport { dotValue, recordValue, assertValidDot } from './dot-syntax';\nimport { GraphRenderModel } from './graph-render-model';\nimport { RuntimeViewerAdapter } from './runtime-viewer-adapter';\nimport { RuntimeHtmlPage } from './runtime-html-page';\nimport { RemoteServiceNodeId } from './remote-service-node-id';\nimport {\n QUEUE_FILL,\n QUEUE_SHAPE,\n QUEUE_LABEL_PREFIX,\n QUEUE_CLASS,\n EXTERNAL_SHAPES,\n EXTERNAL_FILLS,\n EXTERNAL_FILL,\n EXTERNAL_BORDER,\n CRON_FILL,\n CRON_BORDER,\n CUT_CYCLE_EDGE_ATTRS,\n REMOTE_SERVICE_FILL,\n REMOTE_SERVICE_BORDER,\n} from './runtime-viz-theme';\n\n/** Apis per line inside a node label — beyond this the box grows wider than it is readable. */\nconst APIS_PER_LABEL_LINE = 3;\n\n/** Separator for the (service, external-library) grouping key; illegal in both project names. */\nconst PAIR_SEP = '|';\n\nimport { RuntimeVizOptions } from './runtime-viz-options';\nexport { RuntimeVizOptions } from './runtime-viz-options';\n\n/**\n * The DISPLAY name of a project/service: scope stripped. LABELS ONLY.\n *\n * Never an identity. `@scope/public-api` and `public-api` are two distinct projects that strip to\n * the same string, and keying nodes or edges on that fuses them into one box (and draws the edge\n * between them as a self-loop). See {@link serviceNodeId} and lib/graph-names.ts.\n */\nfunction getShortName(name: string): string {\n return name.includes('/') ? name.split('/').pop()! : name;\n}\n\n/** The DOT identity of a runtime service: its project key, escaped — never the display name. */\n// webpieces-disable no-function-outside-class -- DOT id builder, matching getShortName in this file\nfunction serviceNodeId(name: string): string {\n return dotValue(name);\n}\n\n/** Chunk a list into `\\n`-separated label lines of at most APIS_PER_LABEL_LINE entries. */\n// webpieces-disable no-function-outside-class -- DOT label builder, matching getShortName in this file\nfunction labelList(entries: string[]): string {\n const lines: string[] = [];\n const safe = entries.map((entry: string) => dotValue(entry));\n for (let i = 0; i < safe.length; i += APIS_PER_LABEL_LINE) {\n lines.push(safe.slice(i, i + APIS_PER_LABEL_LINE).join(', '));\n }\n return lines.join('\\\\n');\n}\n\n/**\n * DOT for ONE NON-QUEUED runtime edge: a direct labeled SOLID arrow (producer calls consumer, the\n * response comes back). Queued (pubsub) hops are drawn by {@link queuesDot} instead, because they\n * are merged across methods and therefore cannot be emitted one edge at a time.\n *\n * Dashed is the graph's one line-level distinction, and it now says one of two things: an event that\n * returns as soon as it is queued, or (in red, labelled \"legacy cycle\") an edge a `cutLegacyCycle:`\n * tag holds out of leveling. A cut edge is still DRAWN — erasing the arrow would erase exactly the\n * debt the tag records — it is only drawn as the debt it is. See lib/cut-legacy-cycle-resolver.ts.\n */\n// webpieces-disable no-function-outside-class -- DOT string builder, matching getShortName in this file\nfunction edgeDot(edge: RuntimeEdge): string {\n const from = serviceNodeId(edge.from);\n const to = serviceNodeId(edge.to);\n const viaRaw =\n edge.via.length > 2\n ? `Uses (${edge.via.length}) ▾`\n : edge.via.map((v: string) => getShortName(v)).join(', ');\n const cut = edge.cutLegacyCycle === true;\n const label = cut ? `${dotValue(viaRaw)}\\\\nlegacy cycle` : dotValue(viaRaw);\n return ` \"${from}\" -> \"${to}\" [label=\"${label}\"${cut ? CUT_CYCLE_EDGE_ATTRS : ''}];\\n`;\n}\n\n/** The VISIBLE producers and consumers of one queue, gathered from the edges that survived hiding. */\nclass QueueEndpoints {\n readonly producers = new Set<string>();\n readonly consumers = new Set<string>();\n}\n\n/**\n * One drawn queue BOX: the queue keys (`Api.method`) it shows, and the endpoints they all share.\n * Several keys land in one box only when they agree on all three of contract, producers and\n * consumers — see {@link queuesDot}.\n */\nclass QueueGroup {\n constructor(\n public readonly members: string[],\n public readonly producers: string[],\n public readonly consumers: string[],\n ) {}\n}\n\n/**\n * The label line for ONE queue inside a box: `Api.method`, and the Terraform queue name ONLY when it\n * is not the derived `${Api}-${method}`.\n *\n * Printing a derived name was pure restatement — the line above it already said `Api.method`, so\n * every queue box carried a second line that added nothing and doubled its height. A `@Queue(...)`\n * OVERRIDE is the opposite: that string appears nowhere else on the graph, and it is the one string\n * Terraform must match, so it stays.\n */\n// webpieces-disable no-function-outside-class -- DOT label builder, matching getShortName in this file\nfunction queueLine(key: string, queue: RuntimeQueue | undefined): string {\n const line = recordValue(key);\n if (queue === undefined) return line;\n if (queue.queueName === `${queue.api}-${queue.method}`) return line;\n return `${line}\\\\nqueue: ${recordValue(queue.queueName)}`;\n}\n\n/** The node statement + enqueue/deliver arrows for one queue box. Service identities remain raw; only emitted DOT is escaped. */\n// webpieces-disable no-function-outside-class -- DOT string builder, matching getShortName in this file\nfunction queueBoxDot(\n id: string,\n body: string,\n producers: string[],\n consumers: string[],\n model: GraphRenderModel,\n contractCount: number,\n queueKeys: string[],\n): string {\n // Record-mode label: the text must clear recordValue(), and QUEUE_LABEL_PREFIX supplies the\n // empty leading field that draws the cylinder's end cap. Drop it and the node silently\n // degrades to a plain box.\n let dot = model.node(\n id,\n ` \"${id}\" [shape=${QUEUE_SHAPE}, style=\"filled\", fillcolor=\"${QUEUE_FILL}\", ` +\n `class=\"${QUEUE_CLASS}\", label=\"${QUEUE_LABEL_PREFIX}${body}\"];\\n`,\n [],\n queueKeys,\n );\n for (const producer of producers)\n dot += model.edge(\n producer,\n id,\n ` \"${serviceNodeId(producer)}\" -> \"${id}\" [label=\"Uses (${contractCount}) ▾\\\\nenqueue\", style=dashed];\\n`,\n );\n for (const consumer of consumers)\n dot += model.edge(\n id,\n consumer,\n ` \"${id}\" -> \"${serviceNodeId(consumer)}\" [style=dashed];\\n`,\n );\n return dot;\n}\n\n/**\n * Group the queued hops into boxes. The key is (contract, producer SET, consumer SET) — NOT the\n * (from,to) pair of some edge.\n *\n * A queue node converges EVERY producer and consumer of its method onto one box, so keying by a\n * service PAIR would re-split a two-producer queue into two boxes and invent topology nobody wrote.\n * Only queues of the same contract whose producer and consumer sets are IDENTICAL may share a box;\n * anything else stays separate, because merging it would assert a routing that does not exist.\n */\n// webpieces-disable no-function-outside-class -- DOT string builder, matching getShortName in this file\nfunction groupQueues(byQueue: Map<string, QueueEndpoints>, graph: RuntimeGraph): QueueGroup[] {\n const groups = new Map<string, QueueGroup>();\n // Sorted keys → the first member of every group, and therefore its node id, is deterministic.\n for (const key of [...byQueue.keys()].sort()) {\n const ends = byQueue.get(key)!;\n const producers = [...ends.producers].sort();\n const consumers = [...ends.consumers].sort();\n const api = graph.queues[key]?.api ?? key.split('.')[0];\n const mergeKey = [api, producers.join(','), consumers.join(',')].join(PAIR_SEP);\n const existing = groups.get(mergeKey);\n if (existing === undefined)\n groups.set(mergeKey, new QueueGroup([key], producers, consumers));\n else existing.members.push(key);\n }\n return [...groups.values()];\n}\n\n/**\n * The queued half of the graph: producer → QUEUE → consumer, drawn with a sideways-cylinder node and\n * DASHED arrows (an event returns as soon as it is queued).\n *\n * Contract-only edges converge on one box per API across all producers and consumers.\n * For exact method declarations, one BOX may list several queues, one per line. The unit Cloud Tasks and Terraform create is still\n * the METHOD — that is what runtime-dependencies.json records and this render never changes it — but\n * two methods of one contract flowing between exactly the same producers and consumers drew two\n * adjacent boxes whose only difference was the method name, and each carried a `queue:` line that\n * merely restated it. Listing them inside ONE box keeps every queue named (you can still see which\n * one is stuck) at a fraction of the node count.\n */\n// webpieces-disable no-function-outside-class -- DOT string builder, matching getShortName in this file\nfunction queuesDot(graph: RuntimeGraph, hidden: Set<string>, model: GraphRenderModel): string {\n const queued = graph.runtimeEdges.filter(\n (e: RuntimeEdge) => e.type === 'pubsub' && !hidden.has(e.from) && !hidden.has(e.to),\n );\n if (queued.length === 0) return '';\n\n let dot =\n '\\n // Queued hops. Each LINE in a box is one Cloud Tasks queue; queues of one contract\\n' +\n ' // sharing the same producers AND consumers are drawn in a single box.\\n';\n\n // Contract-only declarations converge by API, independently of the enqueuer/consumer pair.\n const byContract = new Map<string, QueueEndpoints>();\n const byQueue = new Map<string, QueueEndpoints>();\n for (const edge of queued) {\n const keys = edge.queue === undefined ? edge.via : [edge.queue];\n const endpoints = edge.queue === undefined ? byContract : byQueue;\n for (const key of keys) {\n if (!endpoints.has(key)) endpoints.set(key, new QueueEndpoints());\n endpoints.get(key)!.producers.add(edge.from);\n endpoints.get(key)!.consumers.add(edge.to);\n }\n }\n for (const api of [...byContract.keys()].sort()) {\n const ends = byContract.get(api)!;\n dot += queueBoxDot(\n `queue__${dotId(api)}`,\n `${recordValue(getShortName(api))} queue`,\n [...ends.producers].sort(),\n [...ends.consumers].sort(),\n model,\n 1,\n [`queue:${api}`],\n );\n }\n\n for (const group of groupQueues(byQueue, graph)) {\n const body = group.members\n .map((key: string) => queueLine(key, graph.queues[key]))\n .join('\\\\n');\n dot += queueBoxDot(\n `queue__${dotId(group.members[0])}`,\n body,\n group.producers,\n group.consumers,\n model,\n 1,\n group.members,\n );\n }\n return dot;\n}\n\n/** A DOT-safe node-id fragment: anything but letters, digits and `_` becomes `_`. */\n// webpieces-disable no-function-outside-class -- DOT id builder, matching getShortName in this file\nfunction dotId(raw: string): string {\n return raw.replace(/[^A-Za-z0-9_]/g, '_');\n}\n\n/**\n * ONE external-system node statement: the shape/fill of what the system IS, its label, and a\n * parenthesised subtitle saying which way it faces.\n *\n * Shared by the OUTBOUND systems ({@link externalSystemsDot}) and the INBOUND callers\n * ({@link triggerDot}) on purpose. They emit into the SAME `system__<identity>` id space, so a\n * vendor this repo both calls and is called by is one box with arrows in both directions — and a\n * copy-pasted attribute string would have let the two drift until they stopped being one box.\n */\n// webpieces-disable no-function-outside-class -- DOT string builder, matching getShortName in this file\nfunction externalSystemNodeDot(\n identity: string,\n kind: string,\n label: string,\n subtitle: string,\n model: GraphRenderModel,\n): string {\n const shape = EXTERNAL_SHAPES[kind] ?? 'box';\n const fill = EXTERNAL_FILLS[kind] ?? EXTERNAL_FILL;\n // An Mrecord-shaped system needs the same empty leading field as a queue node, or it renders as\n // a plain box and silently loses the sideways-cylinder read.\n const isQueue = shape === QUEUE_SHAPE;\n const prefix = isQueue ? QUEUE_LABEL_PREFIX : '';\n const text = isQueue ? recordValue(label) : dotValue(label);\n // Only a queue-kind system is marked: a database here is an UPRIGHT cylinder and must not be\n // caught by the browser-side reshaping that lays queues on their side.\n const marker = isQueue ? `class=\"${QUEUE_CLASS}\", ` : '';\n return model.node(\n `system__${dotId(identity)}`,\n ` \"system__${dotId(identity)}\" [shape=${shape}, style=\"filled\", fillcolor=\"${fill}\", ` +\n `${marker}label=\"${prefix}${text}\\\\n(${subtitle})\"];\\n`,\n );\n}\n\n/**\n * The clock and outside-system nodes for endpoints NOTHING in-repo calls.\n *\n * A cron sweep and a GCP push subscription are real runtime entry points with real Terraform behind\n * them, but they produce no runtime EDGE (there is no in-repo caller), so until now they were simply\n * absent — a server's most operationally interesting endpoint could be invisible on its own graph.\n * Both are drawn pointing INTO the service that serves them, the opposite direction from\n * {@link externalDot}'s outbound vendor calls.\n *\n * The inbound box names the CALLER (`twilio`), never the contract. Naming the contract was the whole\n * bug: it restated what the service box directly below already says, while the one fact the box\n * exists to convey — which vendor is posting to us — appeared nowhere. The contract keeps its place\n * on the EDGE label, where `WhatsAppApi.inbound` reads as \"…posts to this method\".\n *\n * Identity is the caller's label in the SAME `system__` space {@link externalSystemsDot} uses, which\n * buys three things at once: two vendors hitting one contract are two boxes, one vendor hitting three\n * methods is one box with three arrows, and a vendor this repo also CALLS is that same single box.\n * `options` is passed in for the last of those — when that outbound half will be drawn, this half\n * must not restate the node statement.\n */\n// webpieces-disable no-function-outside-class -- DOT string builder, matching getShortName in this file\nfunction triggerDot(\n graph: RuntimeGraph,\n hidden: Set<string>,\n options: RuntimeVizOptions,\n model: GraphRenderModel,\n): string {\n const triggers = graph.triggers.filter((t: RuntimeTrigger) => !hidden.has(t.service));\n if (triggers.length === 0) return '';\n\n // Identities externalSystemsDot is about to draw; skipped here so the node is stated ONCE.\n const drawnOutbound = new Set(\n options.showExternalNodes ? Object.keys(graph.externalSystems ?? {}) : [],\n );\n const emitted = new Set<string>();\n let dot =\n '\\n // Entry points nothing in this repo calls: a clock, or a system outside the repo.\\n';\n for (const trigger of triggers) {\n const service = serviceNodeId(trigger.service);\n const label = dotValue(`${trigger.api}.${trigger.method}`);\n if (trigger.kind === 'cron') {\n const id = `cron__${dotId(`${trigger.api}_${trigger.method}`)}`;\n const schedule = dotValue(trigger.queueName ?? `${trigger.api}-${trigger.method}`);\n dot +=\n model.node(\n id,\n ` \"${id}\" [shape=circle, style=\"filled\", fillcolor=\"${CRON_FILL}\", ` +\n `color=\"${CRON_BORDER}\", label=\"⏰\\\\ncron\"];\\n`,\n ) +\n model.edge(\n id,\n trigger.service,\n ` \"${id}\" -> \"${service}\" [label=\"${label}\\\\n${schedule}\", color=\"${CRON_BORDER}\"];\\n`,\n );\n continue;\n }\n const caller = trigger.caller;\n // Undeclared: only possible for a graph generated BEFORE the caller was required (generation\n // now fails instead). DOTTED and question-marked, so \"we were never told who this is\" cannot\n // be mistaken for a named vendor.\n const id =\n caller === undefined\n ? `inbound__${dotId(trigger.api)}`\n : `system__${dotId(caller.label)}`;\n if (!emitted.has(id) && !(caller !== undefined && drawnOutbound.has(caller.label))) {\n emitted.add(id);\n dot +=\n caller === undefined\n ? model.node(\n id,\n ` \"${id}\" [shape=box, style=\"dotted,filled\", fillcolor=\"${EXTERNAL_FILL}\", ` +\n `color=\"${EXTERNAL_BORDER}\", label=\"${dotValue(trigger.api)}\\\\n? unknown caller\"];\\n`,\n )\n : externalSystemNodeDot(\n caller.label,\n caller.kind,\n caller.label,\n 'external caller',\n model,\n );\n }\n dot += model.edge(\n id,\n trigger.service,\n ` \"${id}\" -> \"${service}\" [label=\"${label}\", style=dashed, color=\"${EXTERNAL_BORDER}\"];\\n`,\n );\n }\n return dot;\n}\n\n/**\n * The DECLARED external systems — the ones that said what they are, so they get a shape that says\n * it: a cylinder for a database, a folder for a bucket. Everything undeclared falls through to\n * {@link externalDot}'s generic grey box, which is why adding this broke nothing existing.\n *\n * The arrows are SOLID. A call to firestore or postgres is synchronous — it returns a value — and\n * the graph's rule is that solid means \"response comes back\". Being outside the repo is carried by\n * the node's shape, never by the line style; conflating the two is what made a blocking database\n * read look like an event.\n */\n// webpieces-disable no-function-outside-class -- DOT string builder, matching getShortName in this file\nfunction externalSystemsDot(\n graph: RuntimeGraph,\n hidden: Set<string>,\n model: GraphRenderModel,\n): string {\n const systems = graph.externalSystems ?? {};\n const ids = Object.keys(systems).sort();\n if (ids.length === 0) return '';\n\n let dot =\n '\\n // Declared external systems — drawn with the shape of what they actually are.\\n';\n for (const id of ids) {\n const system = systems[id];\n dot += externalSystemNodeDot(\n id,\n system.kind,\n system.label,\n `external ${dotValue(system.kind)}`,\n model,\n );\n }\n for (const id of ids) {\n const system = systems[id];\n const via =\n system.apis.length === 0\n ? ''\n : ` [label=\"${system.apis.length > 2 ? `Uses (${system.apis.length}) ▾` : labelList([...system.apis].sort())}\"]`;\n for (const service of [...system.usedBy].sort()) {\n if (hidden.has(service)) continue;\n dot += model.edge(\n service,\n `system__${dotId(id)}`,\n ` \"${serviceNodeId(service)}\" -> \"system__${dotId(id)}\"${via};\\n`,\n );\n }\n }\n return dot;\n}\n\n/**\n * The dashed terminal nodes + edges for calls that LEAVE the repo. Built from `unresolvedUses` —\n * a contract used by a node and implemented by nobody in-repo — which the derivation already\n * computes and which was, until now, only ever printed as a warning.\n *\n * Grouped by the api-lib that owns the contracts, so a service reaching three firestore contracts\n * draws ONE `lib-firestore (external)` box rather than three. These are drawn, never derived: they\n * are absent from levels, cycle detection and the transitive implements attribution.\n *\n * A contract carrying an `@externalSystem` declaration is skipped here — {@link externalSystemsDot}\n * has already drawn it with a real shape, and rendering it in both places would double the node.\n */\n// webpieces-disable no-function-outside-class -- DOT string builder, matching getShortName in this file\nfunction externalDot(graph: RuntimeGraph, hidden: Set<string>, model: GraphRenderModel): string {\n // \"service|externalName\" -> the apis flowing over it.\n const apisByPair = new Map<string, string[]>();\n for (const use of graph.unresolvedUses) {\n if (hidden.has(use.service)) continue;\n if (graph.apis[use.api]?.externalSystem !== undefined) continue;\n // Keyed on the OWNER's full name, never its short name: two scoped api-libs whose short\n // names match are two external systems, and fusing them draws one box for both.\n const external = graph.apis[use.api]?.owner ?? use.api;\n const key = `${use.service}${PAIR_SEP}${external}`;\n if (!apisByPair.has(key)) apisByPair.set(key, []);\n apisByPair.get(key)!.push(use.api);\n }\n if (apisByPair.size === 0) return '';\n\n let dot = '\\n // Systems outside this repo — no in-repo service implements these contracts.\\n';\n // The node ID is prefixed so an external library can never collide with a service, and built\n // from the owner's FULL name so two same-short-named owners stay two boxes; only the label\n // carries the bare name.\n const externals = new Set([...apisByPair.keys()].map((key: string) => key.split(PAIR_SEP)[1]));\n for (const external of [...externals].sort()) {\n dot += model.node(\n `external__${external}`,\n ` \"external__${dotValue(external)}\" [shape=box, style=\"dashed,filled\", fillcolor=\"${EXTERNAL_FILL}\", ` +\n `color=\"${EXTERNAL_BORDER}\", label=\"${dotValue(getShortName(external))}\\\\n(external)\"];\\n`,\n );\n }\n for (const key of [...apisByPair.keys()].sort()) {\n const parts = key.split(PAIR_SEP);\n const service = parts[0];\n const external = parts[1];\n const apis = apisByPair.get(key)!.sort();\n const via = apis.length > 2 ? `Uses (${apis.length}) ▾` : labelList(apis);\n // SOLID: this is a synchronous call that returns a value. Dashed is reserved for events, and\n // \"outside the repo\" is already said by the node's dashed border.\n dot += model.edge(\n service,\n `external__${external}`,\n ` \"${serviceNodeId(service)}\" -> \"external__${dotValue(external)}\" ` +\n `[label=\"${via}\", color=\"${EXTERNAL_BORDER}\"];\\n`,\n );\n }\n return dot;\n}\n\n/**\n * The reviewed out-of-workspace services (#1203): service-shaped nodes (rounded, teal, bold outline,\n * \"(remote service)\"), with an arrow from every workspace service that targets one. An rpc call is a\n * solid arrow and a queued call a dashed \"enqueue\" arrow, exactly as between two in-repo services.\n *\n * Drawn whatever `showExternalNodes` says: these are OUR services, not vendor systems, and hiding them\n * would hide calls the reviewed graph asserts exist.\n */\n// webpieces-disable no-function-outside-class -- DOT string builder, matching getShortName in this file\nfunction remoteServicesDot(\n graph: RuntimeGraph,\n hidden: Set<string>,\n model: GraphRenderModel,\n): string {\n const remotes = graph.remoteServices ?? {};\n const names = Object.keys(remotes).sort();\n if (names.length === 0) return '';\n\n let dot =\n '\\n // Remote services — ours, but outside this workspace (reviewed remoteServices).\\n';\n for (const name of names) {\n const remote = remotes[name];\n const id = new RemoteServiceNodeId().of(name);\n // The label is display text; the service name stays visible because it is what `uses` target.\n const title =\n remote.label === undefined\n ? dotValue(name)\n : `${dotValue(remote.label)}\\\\n${dotValue(name)}`;\n dot += model.node(\n id,\n ` \"${id}\" [shape=box, style=\"filled,rounded,bold\", fillcolor=\"${REMOTE_SERVICE_FILL}\", ` +\n `color=\"${REMOTE_SERVICE_BORDER}\", label=\"${title}\\\\n(remote service)\\\\n` +\n `Implements (${remote.implements.length})\"];\\n`,\n );\n }\n for (const name of names) {\n const id = new RemoteServiceNodeId().of(name);\n for (const call of remotes[name].calledBy) {\n if (hidden.has(call.from)) continue;\n const via = call.via.length > 2 ? `Uses (${call.via.length}) ▾` : labelList(call.via);\n const label = call.type === 'pubsub' ? `${via}\\\\nenqueue` : via;\n const style = call.type === 'pubsub' ? ', style=dashed' : '';\n dot += model.edge(\n call.from,\n id,\n ` \"${serviceNodeId(call.from)}\" -> \"${id}\" [label=\"${label}\", color=\"${REMOTE_SERVICE_BORDER}\"${style}];\\n`,\n );\n }\n }\n return dot;\n}\n\n/** Build the Graphviz DOT for the runtime service graph. */\n// webpieces-disable no-function-outside-class -- module entry point, matching the sibling builders here\nexport function generateRuntimeDot(\n graph: RuntimeGraph,\n title: string = 'WebPieces Runtime Architecture',\n options: RuntimeVizOptions = new RuntimeVizOptions(),\n): string {\n return generateRuntimeRenderModel(graph, title, options).fullDot;\n}\n\n/** Capture synthetic drawable nodes and edges at their original emission sites. */\n// webpieces-disable no-function-outside-class -- renderer entry point matching generateRuntimeDot\nexport function generateRuntimeRenderModel(\n graph: RuntimeGraph,\n title: string = 'WebPieces Runtime Architecture',\n options: RuntimeVizOptions = new RuntimeVizOptions(),\n): GraphRenderModel {\n const model = new GraphRenderModel();\n model.viewer = 'runtime';\n const adapter = new RuntimeViewerAdapter(graph, options.projects);\n let dot = 'digraph RuntimeArchitecture {\\n';\n dot += ' rankdir=TB;\\n';\n dot += ' node [shape=box, style=\"filled,rounded\", fontname=\"Arial\"];\\n';\n dot += ' edge [fontname=\"Arial\", fontsize=12];\\n\\n';\n\n model.header = dot;\n\n // Services tagged drawOnGraph:false stay in the JSON but are omitted here —\n // both their node and any edge touching them are dropped from the render.\n const hidden = new Set(\n Object.keys(graph.services).filter(\n (name: string) => graph.services[name].drawOnGraph === false,\n ),\n );\n\n for (const name of Object.keys(graph.services)) {\n if (hidden.has(name)) continue;\n const svc = graph.services[name];\n dot += adapter.service(model, name, svc);\n }\n\n model.bands = adapter.levelBands(model);\n dot += new LevelBandLayout().dot(model.bands);\n dot += '\\n';\n\n for (const edge of graph.runtimeEdges) {\n if (hidden.has(edge.from) || hidden.has(edge.to)) continue;\n // Queued hops are merged across methods, so they cannot be emitted one edge at a time.\n if (edge.type === 'pubsub') continue;\n dot += model.edge(edge.from, edge.to, edgeDot(edge));\n }\n\n dot += queuesDot(graph, hidden, model);\n dot += remoteServicesDot(graph, hidden, model);\n dot += triggerDot(graph, hidden, options, model);\n\n if (options.showExternalNodes) {\n dot += externalSystemsDot(graph, hidden, model);\n dot += externalDot(graph, hidden, model);\n }\n\n const footerStart = dot.length;\n dot += '\\n labelloc=\"t\";\\n';\n dot += ` label=\"${dotValue(title)}\\\\n(from architecture/runtime-dependencies.json)\";\\n`;\n dot += ' fontsize=20;\\n';\n dot += '}\\n';\n // Nothing downstream parses this DOT until a human opens the page, so parse-shape is checked\n // HERE — a graph that cannot render is a generation failure, not a blank page to discover later.\n assertValidDot(dot, 'runtime-architecture.dot');\n model.footer = dot.slice(footerStart);\n model.completeEndpoints();\n // #1179: a queue, trigger or external system belongs to the products of the services it touches.\n model.attachProducts((id: string): boolean => graph.services[id] !== undefined);\n adapter.contextModes(model);\n model.fullDot = dot;\n return model;\n}\n\nexport interface RuntimeVisualizationPaths {\n dotPath: string;\n htmlPath: string;\n}\n\n/** Write the DOT + HTML renderings to tmp/webpieces/. */\nexport function writeRuntimeVisualization(\n graph: RuntimeGraph,\n workspaceRoot: string,\n title: string = 'WebPieces Runtime Architecture',\n options: RuntimeVizOptions = new RuntimeVizOptions(),\n): RuntimeVisualizationPaths {\n const outputDir = path.join(workspaceRoot, 'tmp', 'webpieces');\n if (!fs.existsSync(outputDir)) fs.mkdirSync(outputDir, { recursive: true });\n\n const model = generateRuntimeRenderModel(graph, title, options);\n const dot = model.fullDot;\n const dotPath = path.join(outputDir, 'runtime-architecture.dot');\n fs.writeFileSync(dotPath, dot, 'utf-8');\n\n const htmlPath = path.join(outputDir, 'runtime-architecture.html');\n fs.writeFileSync(htmlPath, new RuntimeHtmlPage().render(model, title, graph, options), 'utf-8');\n\n return { dotPath, htmlPath };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"runtime-visualizer.js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AAI,CAAC,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC;QAAE,EAAE,CAAC,SAAS,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAE5E,MAAM,KAAK,GAAG,0BAA0B,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAChE,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC;IAC1B,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,0BAA0B,CAAC,CAAC;IACjE,EAAE,CAAC,aAAa,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IAExC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,2BAA2B,CAAC,CAAC;IACnE,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,mCAAe,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;IAEhG,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;AACjC,CAAC","sourcesContent":["import { LevelBandLayout } from './graph-level-bands';\n/**\n * Runtime Visualizer\n *\n * Renders the runtime microservice graph (services + inferred Z -> X edges,\n * each labeled with the api(s) they flow over) to DOT + interactive HTML in\n * tmp/webpieces/runtime-architecture.{dot,html}.\n *\n * Each service node names the contracts it IMPLEMENTS. That list used to be\n * collapsed into a server/client boolean and thrown away — leaving an api that a\n * server serves but nothing in-repo calls completely invisible, and making a\n * correct api design look like a detection failure. What a service USES is NOT\n * listed: every use already draws an outgoing arrow labeled with the same\n * contract, so repeating it in the box only made every box wider.\n *\n * Shape says what a node IS and line style says what a call IS. Solid = rpc: the\n * request follows the arrow and the response flows back. Dashed = event: it flows\n * in the arrow's direction and returns once it is queued. A queue is a sideways\n * cylinder, a datastore an upright one. A queue box lists ONE LINE PER QUEUE: the\n * unit underneath is still the METHOD (what Terraform creates, and what\n * runtime-dependencies.json records), but queues of one contract sharing the same\n * producers and consumers are drawn together instead of as adjacent near-identical\n * boxes — every queue is still named, only the node count drops.\n *\n * Calls that leave the repo (a contract NOTHING in-repo implements — firestore,\n * gmail, ...) are drawn as terminal nodes, so the vendor systems that actually\n * page you at 3am stop being missing from the picture. One that DECLARES what it\n * is, via an `@externalSystem` JSDoc tag or an `external:` nx tag, gets the shape\n * of the thing it is; the rest stay generic dashed boxes. They are RENDER-ONLY:\n * derivation, levels and cycle detection never see them.\n *\n * The same is true in the other direction for endpoints nothing in-repo CALLS: a\n * `cron` method hangs off a clock and an `external` method off a box naming the\n * CALLER that posts to it (`twilio`), in the same id space as the outbound\n * systems, so a vendor we both call and are called by is ONE box. Those are the\n * entry points that wake a service up at 3am, and a graph built only from in-repo\n * callers cannot show them at all.\n *\n * EVERY node on the rendered page is clickable and opens the SHARED floating menu\n * (graph-node-menu.ts — one implementation, also used by architecture/dependencies.html\n * and every project's design.html). Lock/Unlock pins separate complete incoming/outgoing chains, with hover adding a temporary chain. There is no \"View Design\"\n * item here — a node is a running service, queue, datastore or third-party system, not\n * an nx project, so no design.html exists to point at and the item is absent rather than\n * dead. Filter Unconnected follows separate incoming/outgoing chains and compacts the rendered\n * topology; Turn off Filter restores the full picture. Lock remains independent of Filter.\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport type {\n RuntimeGraph,\n RuntimeEdge,\n RuntimeQueue,\n RuntimeService,\n RuntimeTrigger,\n} from './runtime-graph';\nimport { dotValue, recordValue, assertValidDot } from './dot-syntax';\nimport { GraphRenderModel } from './graph-render-model';\nimport { RuntimeViewerAdapter } from './runtime-viewer-adapter';\nimport { RuntimeHtmlPage } from './runtime-html-page';\nimport { RuntimeExternalTriggers } from './runtime-external-triggers';\nimport { RemoteServiceNodeId } from './remote-service-node-id';\nimport {\n QUEUE_FILL,\n QUEUE_SHAPE,\n QUEUE_LABEL_PREFIX,\n QUEUE_CLASS,\n EXTERNAL_SHAPES,\n EXTERNAL_FILLS,\n EXTERNAL_FILL,\n EXTERNAL_BORDER,\n CRON_FILL,\n CRON_BORDER,\n CUT_CYCLE_EDGE_ATTRS,\n REMOTE_SERVICE_FILL,\n REMOTE_SERVICE_BORDER,\n} from './runtime-viz-theme';\n\n/** Apis per line inside a node label — beyond this the box grows wider than it is readable. */\nconst APIS_PER_LABEL_LINE = 3;\n\n/** Separator for the (service, external-library) grouping key; illegal in both project names. */\nconst PAIR_SEP = '|';\n\nimport { RuntimeVizOptions } from './runtime-viz-options';\nexport { RuntimeVizOptions } from './runtime-viz-options';\n\n/**\n * The DISPLAY name of a project/service: scope stripped. LABELS ONLY.\n *\n * Never an identity. `@scope/public-api` and `public-api` are two distinct projects that strip to\n * the same string, and keying nodes or edges on that fuses them into one box (and draws the edge\n * between them as a self-loop). See {@link serviceNodeId} and lib/graph-names.ts.\n */\nfunction getShortName(name: string): string {\n return name.includes('/') ? name.split('/').pop()! : name;\n}\n\n/** The DOT identity of a runtime service: its project key, escaped — never the display name. */\n// webpieces-disable no-function-outside-class -- DOT id builder, matching getShortName in this file\nfunction serviceNodeId(name: string): string {\n return dotValue(name);\n}\n\n/** Chunk a list into `\\n`-separated label lines of at most APIS_PER_LABEL_LINE entries. */\n// webpieces-disable no-function-outside-class -- DOT label builder, matching getShortName in this file\nfunction labelList(entries: string[]): string {\n const lines: string[] = [];\n const safe = entries.map((entry: string) => dotValue(entry));\n for (let i = 0; i < safe.length; i += APIS_PER_LABEL_LINE) {\n lines.push(safe.slice(i, i + APIS_PER_LABEL_LINE).join(', '));\n }\n return lines.join('\\\\n');\n}\n\n/**\n * DOT for ONE NON-QUEUED runtime edge: a direct labeled SOLID arrow (producer calls consumer, the\n * response comes back). Queued (pubsub) hops are drawn by {@link queuesDot} instead, because they\n * are merged across methods and therefore cannot be emitted one edge at a time.\n *\n * Dashed is the graph's one line-level distinction, and it now says one of two things: an event that\n * returns as soon as it is queued, or (in red, labelled \"legacy cycle\") an edge a `cutLegacyCycle:`\n * tag holds out of leveling. A cut edge is still DRAWN — erasing the arrow would erase exactly the\n * debt the tag records — it is only drawn as the debt it is. See lib/cut-legacy-cycle-resolver.ts.\n */\n// webpieces-disable no-function-outside-class -- DOT string builder, matching getShortName in this file\nfunction edgeDot(edge: RuntimeEdge): string {\n const from = serviceNodeId(edge.from);\n const to = serviceNodeId(edge.to);\n const viaRaw =\n edge.via.length > 1\n ? `Uses (${edge.via.length}) ▾`\n : edge.via.map((v: string) => getShortName(v)).join(', ');\n const cut = edge.cutLegacyCycle === true;\n const label = cut ? `${dotValue(viaRaw)}\\\\nlegacy cycle` : dotValue(viaRaw);\n return ` \"${from}\" -> \"${to}\" [label=\"${label}\"${cut ? CUT_CYCLE_EDGE_ATTRS : ''}];\\n`;\n}\n\n/** The VISIBLE producers and consumers of one queue, gathered from the edges that survived hiding. */\nclass QueueEndpoints {\n readonly producers = new Set<string>();\n readonly consumers = new Set<string>();\n}\n\n/**\n * One drawn queue BOX: the queue keys (`Api.method`) it shows, and the endpoints they all share.\n * Several keys land in one box only when they agree on all three of contract, producers and\n * consumers — see {@link queuesDot}.\n */\nclass QueueGroup {\n constructor(\n public readonly members: string[],\n public readonly producers: string[],\n public readonly consumers: string[],\n ) {}\n}\n\n/**\n * The label line for ONE queue inside a box: `Api.method`, and the Terraform queue name ONLY when it\n * is not the derived `${Api}-${method}`.\n *\n * Printing a derived name was pure restatement — the line above it already said `Api.method`, so\n * every queue box carried a second line that added nothing and doubled its height. A `@Queue(...)`\n * OVERRIDE is the opposite: that string appears nowhere else on the graph, and it is the one string\n * Terraform must match, so it stays.\n */\n// webpieces-disable no-function-outside-class -- DOT label builder, matching getShortName in this file\nfunction queueLine(key: string, queue: RuntimeQueue | undefined): string {\n const line = recordValue(key);\n if (queue === undefined) return line;\n if (queue.queueName === `${queue.api}-${queue.method}`) return line;\n return `${line}\\\\nqueue: ${recordValue(queue.queueName)}`;\n}\n\n/** The node statement + enqueue/deliver arrows for one queue box. Service identities remain raw; only emitted DOT is escaped. */\n// webpieces-disable no-function-outside-class -- DOT string builder, matching getShortName in this file\nfunction queueBoxDot(\n id: string,\n body: string,\n producers: string[],\n consumers: string[],\n model: GraphRenderModel,\n queueKeys: string[],\n): string {\n // Record-mode label: the text must clear recordValue(), and QUEUE_LABEL_PREFIX supplies the\n // empty leading field that draws the cylinder's end cap. Drop it and the node silently\n // degrades to a plain box.\n let dot = model.node(\n id,\n ` \"${id}\" [shape=${QUEUE_SHAPE}, style=\"filled\", fillcolor=\"${QUEUE_FILL}\", ` +\n `class=\"${QUEUE_CLASS}\", label=\"${QUEUE_LABEL_PREFIX}${body}\"];\\n`,\n [],\n queueKeys,\n );\n for (const producer of producers)\n dot += model.edge(\n producer,\n id,\n ` \"${serviceNodeId(producer)}\" -> \"${id}\" [label=\"enqueue\", style=dashed];\\n`,\n );\n for (const consumer of consumers)\n dot += model.edge(\n id,\n consumer,\n ` \"${id}\" -> \"${serviceNodeId(consumer)}\" [style=dashed];\\n`,\n );\n return dot;\n}\n\n/**\n * Group the queued hops into boxes. The key is (contract, producer SET, consumer SET) — NOT the\n * (from,to) pair of some edge.\n *\n * A queue node converges EVERY producer and consumer of its method onto one box, so keying by a\n * service PAIR would re-split a two-producer queue into two boxes and invent topology nobody wrote.\n * Only queues of the same contract whose producer and consumer sets are IDENTICAL may share a box;\n * anything else stays separate, because merging it would assert a routing that does not exist.\n */\n// webpieces-disable no-function-outside-class -- DOT string builder, matching getShortName in this file\nfunction groupQueues(byQueue: Map<string, QueueEndpoints>, graph: RuntimeGraph): QueueGroup[] {\n const groups = new Map<string, QueueGroup>();\n // Sorted keys → the first member of every group, and therefore its node id, is deterministic.\n for (const key of [...byQueue.keys()].sort()) {\n const ends = byQueue.get(key)!;\n const producers = [...ends.producers].sort();\n const consumers = [...ends.consumers].sort();\n const api = graph.queues[key]?.api ?? key.split('.')[0];\n const mergeKey = [api, producers.join(','), consumers.join(',')].join(PAIR_SEP);\n const existing = groups.get(mergeKey);\n if (existing === undefined)\n groups.set(mergeKey, new QueueGroup([key], producers, consumers));\n else existing.members.push(key);\n }\n return [...groups.values()];\n}\n\n/**\n * The queued half of the graph: producer → QUEUE → consumer, drawn with a sideways-cylinder node and\n * DASHED arrows (an event returns as soon as it is queued).\n *\n * Contract-only edges converge on one box per API across all producers and consumers.\n * For exact method declarations, one BOX may list several queues, one per line. The unit Cloud Tasks and Terraform create is still\n * the METHOD — that is what runtime-dependencies.json records and this render never changes it — but\n * two methods of one contract flowing between exactly the same producers and consumers drew two\n * adjacent boxes whose only difference was the method name, and each carried a `queue:` line that\n * merely restated it. Listing them inside ONE box keeps every queue named (you can still see which\n * one is stuck) at a fraction of the node count.\n */\n// webpieces-disable no-function-outside-class -- DOT string builder, matching getShortName in this file\nfunction queuesDot(graph: RuntimeGraph, hidden: Set<string>, model: GraphRenderModel): string {\n const queued = graph.runtimeEdges.filter(\n (e: RuntimeEdge) => e.type === 'pubsub' && !hidden.has(e.from) && !hidden.has(e.to),\n );\n if (queued.length === 0) return '';\n\n let dot =\n '\\n // Queued hops. Each LINE in a box is one Cloud Tasks queue; queues of one contract\\n' +\n ' // sharing the same producers AND consumers are drawn in a single box.\\n';\n\n // Contract-only declarations converge by API, independently of the enqueuer/consumer pair.\n const byContract = new Map<string, QueueEndpoints>();\n const byQueue = new Map<string, QueueEndpoints>();\n for (const edge of queued) {\n const keys = edge.queue === undefined ? edge.via : [edge.queue];\n const endpoints = edge.queue === undefined ? byContract : byQueue;\n for (const key of keys) {\n if (!endpoints.has(key)) endpoints.set(key, new QueueEndpoints());\n endpoints.get(key)!.producers.add(edge.from);\n endpoints.get(key)!.consumers.add(edge.to);\n }\n }\n for (const api of [...byContract.keys()].sort()) {\n const ends = byContract.get(api)!;\n dot += queueBoxDot(\n `queue__${dotId(api)}`,\n `${recordValue(getShortName(api))} queue`,\n [...ends.producers].sort(),\n [...ends.consumers].sort(),\n model,\n [`queue:${api}`],\n );\n }\n\n for (const group of groupQueues(byQueue, graph)) {\n const body = group.members\n .map((key: string) => queueLine(key, graph.queues[key]))\n .join('\\\\n');\n dot += queueBoxDot(\n `queue__${dotId(group.members[0])}`,\n body,\n group.producers,\n group.consumers,\n model,\n group.members,\n );\n }\n return dot;\n}\n\n/** A DOT-safe node-id fragment: anything but letters, digits and `_` becomes `_`. */\n// webpieces-disable no-function-outside-class -- DOT id builder, matching getShortName in this file\nfunction dotId(raw: string): string {\n return raw.replace(/[^A-Za-z0-9_]/g, '_');\n}\n\n/**\n * ONE external-system node statement: the shape/fill of what the system IS, its label, and a\n * parenthesised subtitle saying which way it faces.\n *\n * Shared by the OUTBOUND systems ({@link externalSystemsDot}) and the INBOUND callers\n * ({@link triggerDot}) on purpose. They emit into the SAME `system__<identity>` id space, so a\n * vendor this repo both calls and is called by is one box with arrows in both directions — and a\n * copy-pasted attribute string would have let the two drift until they stopped being one box.\n */\n// webpieces-disable no-function-outside-class -- DOT string builder, matching getShortName in this file\nfunction externalSystemNodeDot(\n identity: string,\n kind: string,\n label: string,\n subtitle: string,\n model: GraphRenderModel,\n): string {\n const shape = EXTERNAL_SHAPES[kind] ?? 'box';\n const fill = EXTERNAL_FILLS[kind] ?? EXTERNAL_FILL;\n // An Mrecord-shaped system needs the same empty leading field as a queue node, or it renders as\n // a plain box and silently loses the sideways-cylinder read.\n const isQueue = shape === QUEUE_SHAPE;\n const prefix = isQueue ? QUEUE_LABEL_PREFIX : '';\n const text = isQueue ? recordValue(label) : dotValue(label);\n // Only a queue-kind system is marked: a database here is an UPRIGHT cylinder and must not be\n // caught by the browser-side reshaping that lays queues on their side.\n const marker = isQueue ? `class=\"${QUEUE_CLASS}\", ` : '';\n return model.node(\n `system__${dotId(identity)}`,\n ` \"system__${dotId(identity)}\" [shape=${shape}, style=\"filled\", fillcolor=\"${fill}\", ` +\n `${marker}label=\"${prefix}${text}\\\\n(${subtitle})\"];\\n`,\n );\n}\n\n/**\n * The clock and outside-system nodes for endpoints NOTHING in-repo calls.\n *\n * A cron sweep and a GCP push subscription are real runtime entry points with real Terraform behind\n * them, but they produce no runtime EDGE (there is no in-repo caller), so until now they were simply\n * absent — a server's most operationally interesting endpoint could be invisible on its own graph.\n * Both are drawn pointing INTO the service that serves them, the opposite direction from\n * {@link externalDot}'s outbound vendor calls.\n *\n * The inbound box names the CALLER (`twilio`), never the contract. Naming the contract was the whole\n * bug: it restated what the service box directly below already says, while the one fact the box\n * exists to convey — which vendor is posting to us — appeared nowhere. The contract keeps its place\n * on the EDGE label, where `WhatsAppApi.inbound` reads as \"…posts to this method\".\n *\n * Identity is the caller's label in the SAME `system__` space {@link externalSystemsDot} uses, which\n * buys three things at once: two vendors hitting one contract are two boxes, one vendor hitting three\n * methods is one box with one arrow per service, and a vendor this repo also CALLS is that same single box.\n * `options` is passed in for the last of those — when that outbound half will be drawn, this half\n * must not restate the node statement.\n */\n// webpieces-disable no-function-outside-class -- DOT string builder, matching getShortName in this file\nfunction triggerDot(\n graph: RuntimeGraph,\n hidden: Set<string>,\n options: RuntimeVizOptions,\n model: GraphRenderModel,\n): string {\n const triggers = graph.triggers.filter((t: RuntimeTrigger) => !hidden.has(t.service));\n if (triggers.length === 0) return '';\n\n // Identities externalSystemsDot is about to draw; skipped here so the node is stated ONCE.\n const drawnOutbound = new Set(\n options.showExternalNodes ? Object.keys(graph.externalSystems ?? {}) : [],\n );\n const emitted = new Set<string>();\n let dot =\n '\\n // Entry points nothing in this repo calls: a clock, or a system outside the repo.\\n';\n for (const trigger of triggers.filter((trigger: RuntimeTrigger) => trigger.kind === 'cron')) {\n const service = serviceNodeId(trigger.service);\n const label = dotValue(`${trigger.api}.${trigger.method}`);\n const id = `cron__${dotId(`${trigger.api}_${trigger.method}`)}`;\n const schedule = dotValue(trigger.queueName ?? `${trigger.api}-${trigger.method}`);\n dot +=\n model.node(\n id,\n ` \"${id}\" [shape=circle, style=\"filled\", fillcolor=\"${CRON_FILL}\", ` +\n `color=\"${CRON_BORDER}\", label=\"⏰\\\\ncron\"];\\n`,\n ) +\n model.edge(\n id,\n trigger.service,\n ` \"${id}\" -> \"${service}\" [label=\"${label}\\\\n${schedule}\", color=\"${CRON_BORDER}\"];\\n`,\n );\n }\n for (const group of new RuntimeExternalTriggers(triggers).groups) {\n const trigger = group.triggers[0];\n const service = serviceNodeId(group.to);\n const label = dotValue(group.label());\n const caller = trigger.caller;\n // Undeclared: only possible for a graph generated BEFORE the caller was required (generation\n // now fails instead). DOTTED and question-marked, so \"we were never told who this is\" cannot\n // be mistaken for a named vendor.\n const id = group.from;\n if (!emitted.has(id) && !(caller !== undefined && drawnOutbound.has(caller.label))) {\n emitted.add(id);\n dot +=\n caller === undefined\n ? model.node(\n id,\n ` \"${id}\" [shape=box, style=\"dotted,filled\", fillcolor=\"${EXTERNAL_FILL}\", ` +\n `color=\"${EXTERNAL_BORDER}\", label=\"${dotValue(trigger.api)}\\\\n? unknown caller\"];\\n`,\n )\n : externalSystemNodeDot(\n caller.label,\n caller.kind,\n caller.label,\n 'external caller',\n model,\n );\n }\n dot += model.edge(\n id,\n trigger.service,\n ` \"${id}\" -> \"${service}\" [label=\"${label}\", style=dashed, color=\"${EXTERNAL_BORDER}\"];\\n`,\n );\n }\n return dot;\n}\n\n/**\n * The DECLARED external systems — the ones that said what they are, so they get a shape that says\n * it: a cylinder for a database, a folder for a bucket. Everything undeclared falls through to\n * {@link externalDot}'s generic grey box, which is why adding this broke nothing existing.\n *\n * The arrows are SOLID. A call to firestore or postgres is synchronous — it returns a value — and\n * the graph's rule is that solid means \"response comes back\". Being outside the repo is carried by\n * the node's shape, never by the line style; conflating the two is what made a blocking database\n * read look like an event.\n */\n// webpieces-disable no-function-outside-class -- DOT string builder, matching getShortName in this file\nfunction externalSystemsDot(\n graph: RuntimeGraph,\n hidden: Set<string>,\n model: GraphRenderModel,\n): string {\n const systems = graph.externalSystems ?? {};\n const ids = Object.keys(systems).sort();\n if (ids.length === 0) return '';\n\n let dot =\n '\\n // Declared external systems — drawn with the shape of what they actually are.\\n';\n for (const id of ids) {\n const system = systems[id];\n dot += externalSystemNodeDot(\n id,\n system.kind,\n system.label,\n `external ${dotValue(system.kind)}`,\n model,\n );\n }\n for (const id of ids) {\n const system = systems[id];\n const via =\n system.apis.length === 0\n ? ''\n : ` [label=\"${system.apis.length > 1 ? `Uses (${system.apis.length}) ▾` : labelList([...system.apis].sort())}\"]`;\n for (const service of [...system.usedBy].sort()) {\n if (hidden.has(service)) continue;\n dot += model.edge(\n service,\n `system__${dotId(id)}`,\n ` \"${serviceNodeId(service)}\" -> \"system__${dotId(id)}\"${via};\\n`,\n );\n }\n }\n return dot;\n}\n\n/**\n * The dashed terminal nodes + edges for calls that LEAVE the repo. Built from `unresolvedUses` —\n * a contract used by a node and implemented by nobody in-repo — which the derivation already\n * computes and which was, until now, only ever printed as a warning.\n *\n * Grouped by the api-lib that owns the contracts, so a service reaching three firestore contracts\n * draws ONE `lib-firestore (external)` box rather than three. These are drawn, never derived: they\n * are absent from levels, cycle detection and the transitive implements attribution.\n *\n * A contract carrying an `@externalSystem` declaration is skipped here — {@link externalSystemsDot}\n * has already drawn it with a real shape, and rendering it in both places would double the node.\n */\n// webpieces-disable no-function-outside-class -- DOT string builder, matching getShortName in this file\nfunction externalDot(graph: RuntimeGraph, hidden: Set<string>, model: GraphRenderModel): string {\n // \"service|externalName\" -> the apis flowing over it.\n const apisByPair = new Map<string, string[]>();\n for (const use of graph.unresolvedUses) {\n if (hidden.has(use.service)) continue;\n if (graph.apis[use.api]?.externalSystem !== undefined) continue;\n // Keyed on the OWNER's full name, never its short name: two scoped api-libs whose short\n // names match are two external systems, and fusing them draws one box for both.\n const external = graph.apis[use.api]?.owner ?? use.api;\n const key = `${use.service}${PAIR_SEP}${external}`;\n if (!apisByPair.has(key)) apisByPair.set(key, []);\n apisByPair.get(key)!.push(use.api);\n }\n if (apisByPair.size === 0) return '';\n\n let dot = '\\n // Systems outside this repo — no in-repo service implements these contracts.\\n';\n // The node ID is prefixed so an external library can never collide with a service, and built\n // from the owner's FULL name so two same-short-named owners stay two boxes; only the label\n // carries the bare name.\n const externals = new Set([...apisByPair.keys()].map((key: string) => key.split(PAIR_SEP)[1]));\n for (const external of [...externals].sort()) {\n dot += model.node(\n `external__${external}`,\n ` \"external__${dotValue(external)}\" [shape=box, style=\"dashed,filled\", fillcolor=\"${EXTERNAL_FILL}\", ` +\n `color=\"${EXTERNAL_BORDER}\", label=\"${dotValue(getShortName(external))}\\\\n(external)\"];\\n`,\n );\n }\n for (const key of [...apisByPair.keys()].sort()) {\n const parts = key.split(PAIR_SEP);\n const service = parts[0];\n const external = parts[1];\n const apis = apisByPair.get(key)!.sort();\n const via = apis.length > 1 ? `Uses (${apis.length}) ▾` : labelList(apis);\n // SOLID: this is a synchronous call that returns a value. Dashed is reserved for events, and\n // \"outside the repo\" is already said by the node's dashed border.\n dot += model.edge(\n service,\n `external__${external}`,\n ` \"${serviceNodeId(service)}\" -> \"external__${dotValue(external)}\" ` +\n `[label=\"${via}\", color=\"${EXTERNAL_BORDER}\"];\\n`,\n );\n }\n return dot;\n}\n\n/**\n * The reviewed out-of-workspace services (#1203): service-shaped nodes (rounded, teal, bold outline,\n * \"(remote service)\"), with an arrow from every workspace service that targets one. An rpc call is a\n * solid arrow and a queued call a dashed \"enqueue\" arrow, exactly as between two in-repo services.\n *\n * Drawn whatever `showExternalNodes` says: these are OUR services, not vendor systems, and hiding them\n * would hide calls the reviewed graph asserts exist.\n */\n// webpieces-disable no-function-outside-class -- DOT string builder, matching getShortName in this file\nfunction remoteServicesDot(\n graph: RuntimeGraph,\n hidden: Set<string>,\n model: GraphRenderModel,\n): string {\n const remotes = graph.remoteServices ?? {};\n const names = Object.keys(remotes).sort();\n if (names.length === 0) return '';\n\n let dot =\n '\\n // Remote services — ours, but outside this workspace (reviewed remoteServices).\\n';\n for (const name of names) {\n const remote = remotes[name];\n const id = new RemoteServiceNodeId().of(name);\n // The label is display text; the service name stays visible because it is what `uses` target.\n const title =\n remote.label === undefined\n ? dotValue(name)\n : `${dotValue(remote.label)}\\\\n${dotValue(name)}`;\n dot += model.node(\n id,\n ` \"${id}\" [shape=box, style=\"filled,rounded,bold\", fillcolor=\"${REMOTE_SERVICE_FILL}\", ` +\n `color=\"${REMOTE_SERVICE_BORDER}\", label=\"${title}\\\\n(remote service)\\\\n` +\n `Implements (${remote.implements.length})\"];\\n`,\n );\n }\n for (const name of names) {\n const id = new RemoteServiceNodeId().of(name);\n for (const call of remotes[name].calledBy) {\n if (hidden.has(call.from)) continue;\n const via = call.via.length > 1 ? `Uses (${call.via.length}) ▾` : labelList(call.via);\n const label = call.type === 'pubsub' ? `${via}\\\\nenqueue` : via;\n const style = call.type === 'pubsub' ? ', style=dashed' : '';\n dot += model.edge(\n call.from,\n id,\n ` \"${serviceNodeId(call.from)}\" -> \"${id}\" [label=\"${label}\", color=\"${REMOTE_SERVICE_BORDER}\"${style}];\\n`,\n );\n }\n }\n return dot;\n}\n\n/** Build the Graphviz DOT for the runtime service graph. */\n// webpieces-disable no-function-outside-class -- module entry point, matching the sibling builders here\nexport function generateRuntimeDot(\n graph: RuntimeGraph,\n title: string = 'WebPieces Runtime Architecture',\n options: RuntimeVizOptions = new RuntimeVizOptions(),\n): string {\n return generateRuntimeRenderModel(graph, title, options).fullDot;\n}\n\n/** Capture synthetic drawable nodes and edges at their original emission sites. */\n// webpieces-disable no-function-outside-class -- renderer entry point matching generateRuntimeDot\nexport function generateRuntimeRenderModel(\n graph: RuntimeGraph,\n title: string = 'WebPieces Runtime Architecture',\n options: RuntimeVizOptions = new RuntimeVizOptions(),\n): GraphRenderModel {\n const model = new GraphRenderModel();\n model.viewer = 'runtime';\n const adapter = new RuntimeViewerAdapter(graph, options.projects);\n let dot = 'digraph RuntimeArchitecture {\\n';\n dot += ' rankdir=TB;\\n';\n dot += ' node [shape=box, style=\"filled,rounded\", fontname=\"Arial\"];\\n';\n dot += ' edge [fontname=\"Arial\", fontsize=12];\\n\\n';\n\n model.header = dot;\n\n // Services tagged drawOnGraph:false stay in the JSON but are omitted here —\n // both their node and any edge touching them are dropped from the render.\n const hidden = new Set(\n Object.keys(graph.services).filter(\n (name: string) => graph.services[name].drawOnGraph === false,\n ),\n );\n\n for (const name of Object.keys(graph.services)) {\n if (hidden.has(name)) continue;\n const svc = graph.services[name];\n dot += adapter.service(model, name, svc);\n }\n\n model.bands = adapter.levelBands(model);\n dot += new LevelBandLayout().dot(model.bands);\n dot += '\\n';\n\n for (const edge of graph.runtimeEdges) {\n if (hidden.has(edge.from) || hidden.has(edge.to)) continue;\n // Queued hops are merged across methods, so they cannot be emitted one edge at a time.\n if (edge.type === 'pubsub') continue;\n dot += model.edge(edge.from, edge.to, edgeDot(edge));\n }\n\n dot += queuesDot(graph, hidden, model);\n dot += remoteServicesDot(graph, hidden, model);\n dot += triggerDot(graph, hidden, options, model);\n\n if (options.showExternalNodes) {\n dot += externalSystemsDot(graph, hidden, model);\n dot += externalDot(graph, hidden, model);\n }\n\n const footerStart = dot.length;\n dot += '\\n labelloc=\"t\";\\n';\n dot += ` label=\"${dotValue(title)}\\\\n(from architecture/runtime-dependencies.json)\";\\n`;\n dot += ' fontsize=20;\\n';\n dot += '}\\n';\n // Nothing downstream parses this DOT until a human opens the page, so parse-shape is checked\n // HERE — a graph that cannot render is a generation failure, not a blank page to discover later.\n assertValidDot(dot, 'runtime-architecture.dot');\n model.footer = dot.slice(footerStart);\n model.completeEndpoints();\n // #1179: a queue, trigger or external system belongs to the products of the services it touches.\n model.attachProducts((id: string): boolean => graph.services[id] !== undefined);\n adapter.contextModes(model);\n model.fullDot = dot;\n return model;\n}\n\nexport interface RuntimeVisualizationPaths {\n dotPath: string;\n htmlPath: string;\n}\n\n/** Write the DOT + HTML renderings to tmp/webpieces/. */\nexport function writeRuntimeVisualization(\n graph: RuntimeGraph,\n workspaceRoot: string,\n title: string = 'WebPieces Runtime Architecture',\n options: RuntimeVizOptions = new RuntimeVizOptions(),\n): RuntimeVisualizationPaths {\n const outputDir = path.join(workspaceRoot, 'tmp', 'webpieces');\n if (!fs.existsSync(outputDir)) fs.mkdirSync(outputDir, { recursive: true });\n\n const model = generateRuntimeRenderModel(graph, title, options);\n const dot = model.fullDot;\n const dotPath = path.join(outputDir, 'runtime-architecture.dot');\n fs.writeFileSync(dotPath, dot, 'utf-8');\n\n const htmlPath = path.join(outputDir, 'runtime-architecture.html');\n fs.writeFileSync(htmlPath, new RuntimeHtmlPage().render(model, title, graph, options), 'utf-8');\n\n return { dotPath, htmlPath };\n}\n"]}
|
|
@@ -139,7 +139,7 @@ function legendHtml() {
|
|
|
139
139
|
${item(sw.queue, '<strong>queue</strong> — each <em>line</em> in the box is one Cloud Tasks queue, the unit Terraform actually creates. Queues of one contract that flow between the <em>same</em> producer and consumer share a box; every one is still named, so you can always see <em>which</em> queue is stuck.')}
|
|
140
140
|
${item(sw.database, '<strong>database</strong> — a datastore outside this repo')}
|
|
141
141
|
${item(sw.storage, '<strong>object storage</strong> — a bucket outside this repo')}
|
|
142
|
-
${item(sw.external, '<strong>external system</strong> — outside this repo; nothing here implements it. Pointing <strong>OUT</strong> = a system this repo calls (firestore, gmail). Pointing <strong>IN</strong> = an endpoint driven from outside, and the box names the <strong>CALLER</strong> (<code>twilio</code>), not our contract — the
|
|
142
|
+
${item(sw.external, '<strong>external system</strong> — outside this repo; nothing here implements it. Pointing <strong>OUT</strong> = a system this repo calls (firestore, gmail). Pointing <strong>IN</strong> = an endpoint driven from outside, and the box names the <strong>CALLER</strong> (<code>twilio</code>), not our contract — the arrow names a single contract/method or groups multiple APIs in a Uses dropdown. One vendor is ONE box however many endpoints it posts to, and the same box whether we call it or it calls us. A dotted box labelled <code>? unknown caller</code> means the endpoint never declared one.')}
|
|
143
143
|
${item(sw.cron, '<strong>cron</strong> — a scheduler fires this endpoint')}
|
|
144
144
|
</div>
|
|
145
145
|
<div class="legend-col">
|
|
@@ -156,7 +156,7 @@ function legendHtml() {
|
|
|
156
156
|
Implements (N)
|
|
157
157
|
Uses (N)
|
|
158
158
|
</pre>
|
|
159
|
-
<div class="legend-note">
|
|
159
|
+
<div class="legend-note">Click <strong>Implements</strong> in the node menu or a <strong>Uses</strong> dropdown for complete qualified lists. A single API is named inline; two or more APIs have a Uses dropdown. Single-API queue arrows say enqueue; their box names the contract.</div>
|
|
160
160
|
<div class="legend-note"><code>(via <lib>)</code> = served through an embedded library, not its own source.</div>
|
|
161
161
|
</div>
|
|
162
162
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-viz-theme.js","sourceRoot":"","sources":["../../../../../../packages/tooling/nx-webpieces-rules/src/lib/runtime-viz-theme.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AA0IH,gCAoCC;AA5KY,QAAA,YAAY,GAA2B;IAChD,CAAC,EAAE,SAAS;IACZ,CAAC,EAAE,SAAS;IACZ,CAAC,EAAE,SAAS;IACZ,CAAC,EAAE,SAAS;CACf,CAAC;AAEW,QAAA,UAAU,GAAG,SAAS,CAAC;AAEpC;;;;;;;;;;;;;;;;GAgBG;AACU,QAAA,WAAW,GAAG,SAAS,CAAC;AACxB,QAAA,kBAAkB,GAAG,IAAI,CAAC;AAEvC;;;;;;;;GAQG;AACU,QAAA,WAAW,GAAG,UAAU,CAAC;AAEtC,mGAAmG;AACtF,QAAA,aAAa,GAAG,SAAS,CAAC;AAEvC;;;;GAIG;AACU,QAAA,iBAAiB,GAAG,SAAS,CAAC;AAE3C,kGAAkG;AACrF,QAAA,eAAe,GAA2B;IACnD,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,UAAU;IACjB,KAAK,EAAE,SAAS;IAChB,OAAO,EAAE,QAAQ;IACjB,8FAA8F;IAC9F,yEAAyE;IACzE,OAAO,EAAE,eAAe;CAC3B,CAAC;AAEF,0EAA0E;AAC7D,QAAA,cAAc,GAA2B;IAClD,QAAQ,EAAE,qBAAa;IACvB,KAAK,EAAE,qBAAa;IACpB,KAAK,EAAE,kBAAU;IACjB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,yBAAiB;CAC7B,CAAC;AAEF,0F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OAAO;;;;;kBAKO,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,0FAA0F,CAAC;kBAC5G,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,+RAA+R,CAAC;kBAChT,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,0SAA0S,CAAC;kBAC1T,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,iEAAiE,CAAC;kBACpF,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,oEAAoE,CAAC;kBACtF,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,ujBAAujB,CAAC;kBAC1kB,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,+DAA+D,CAAC;;;;kBAI9E,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,6FAA6F,CAAC;kBAC7G,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,yIAAyI,CAAC;kBAC1J,IAAI,CAAC,EAAE,CAAC,SAAS,EAAE,sDAAsD,CAAC;;;;;;;;;;;;;;WAcjF,CAAC;AACZ,CAAC","sourcesContent":["/**\n * The runtime graph's VISUAL VOCABULARY, and the legend that explains it.\n *\n * Every colour, shape and fill the drawing uses lives here, next to the legend swatches that teach\n * the reader what each one means. They are one unit on purpose: the legend's job is to be a true\n * account of the picture, and the fastest way for a legend to start lying is for it to sit in a\n * different file from the constants it describes and drift as those change.\n *\n * Imported by runtime-visualizer.ts, which owns the DRAWING (which nodes and edges to emit). This\n * module knows nothing about the graph model, which is what keeps the dependency one-way and\n * cycle-free.\n */\n\nexport const LEVEL_COLORS: Record<number, string> = {\n 0: '#E8F5E9',\n 1: '#E3F2FD',\n 2: '#FFF3E0',\n 3: '#FCE4EC',\n};\n\nexport const QUEUE_FILL = '#FFF3E0';\n\n/**\n * The queue node is an `Mrecord` whose FIRST field is empty, which draws a rounded outline with a\n * vertical cap line near one end — a cylinder lying on its side, distinguishing a queue from the\n * upright cylinder that now means a database.\n *\n * Two things here are load-bearing and easy to break:\n *\n * 1. NO surrounding `{}`. Record fields lay out along the rank direction, and this graph is\n * `rankdir=TB` (see {@link generateRuntimeDot}), where the default is horizontal — which is what\n * we want. Adding braces TOGGLES that, turning the cap line into a band across the top.\n * 2. The leading space is the empty field. The record parser trims it to nothing, which is the\n * point; it must survive as its own field, so the `|` cannot be dropped.\n *\n * Graphviz has no sideways cylinder and never has: `orientation=` is documented as rotating POLYGON\n * shapes, and `cylinder` is drawn with beziers, so it silently ignores the attribute (graphviz issue\n * #2244, open since 2022 and still reproducible on 13.0.0). This is the closest native shape.\n */\nexport const QUEUE_SHAPE = 'Mrecord';\nexport const QUEUE_LABEL_PREFIX = ' |';\n\n/**\n * Marker class stamped on every queue node. Graphviz copies `class` straight into the rendered\n * `<g class=\"node wp_queue\">`, which is how runtime-visualizer.client.ts finds these nodes and\n * redraws them as true horizontal cylinders in the browser.\n *\n * A CLASS rather than an id prefix, because queue-kind EXTERNAL systems are queues too and share the\n * `system__` id space with databases — which must stay upright. Underscored, not hyphenated: DOT\n * emits a hyphen as `-`, which is harmless but needlessly surprising to anyone reading the SVG.\n */\nexport const QUEUE_CLASS = 'wp_queue';\n\n/** Fill for the upright cylinder standing for an external DATASTORE (firestore, postgres, ...). */\nexport const DATABASE_FILL = '#E1F5FE';\n\n/**\n * Fill for a destination whose ADDRESS arrives at runtime (a partner-registered webhook URL). Amber\n * rather than the neutral external grey on purpose: this is the one outbound hop where the address\n * itself is attacker-influenced data, and the graph exists to make it findable.\n */\nexport const RUNTIME_HOST_FILL = '#FFE0B2';\n\n/** Shape per external-system kind. Anything unrecognised falls back to the generic dashed box. */\nexport const EXTERNAL_SHAPES: Record<string, string> = {\n database: 'cylinder',\n cache: 'cylinder',\n queue: 'Mrecord',\n storage: 'folder',\n // A destination dialled by address rather than by name: a doubled outline, because what is on\n // the far side is not one system we can name but whatever the data said.\n runtime: 'doubleoctagon',\n};\n\n/** Fill per external-system kind, paired with {@link EXTERNAL_SHAPES}. */\nexport const EXTERNAL_FILLS: Record<string, string> = {\n database: DATABASE_FILL,\n cache: DATABASE_FILL,\n queue: QUEUE_FILL,\n storage: '#F3E5F5',\n runtime: RUNTIME_HOST_FILL,\n};\n\n/** Fill + border for the dashed terminal node standing for a system outside this repo. */\nexport const EXTERNAL_FILL = '#FAFAFA';\nexport const EXTERNAL_BORDER = '#9E9E9E';\n\n/**\n * Fill + border for a REMOTE SERVICE (#1203): one of OUR services that lives outside this workspace\n * (another repo, a VM). Rounded like an in-repo service, because it is one — it implements our\n * contracts — but teal with a bold outline, so it never reads as a vendor box or as a deployable here.\n */\nexport const REMOTE_SERVICE_FILL = '#E0F2F1';\nexport const REMOTE_SERVICE_BORDER = '#00796B';\n\n/** Fill + border for the clock node standing for a scheduler-driven endpoint. */\n/** The colour of a `cutLegacyCycle` edge — red, because it is drawing DEBT, not a design. */\nexport const CUT_CYCLE_COLOR = '#D32F2F';\n\n/**\n * DOT attributes appended to a `cutLegacyCycle` edge: dashed and red so it reads as debt, and\n * `constraint=false` so it does not pull on a ranking it was deliberately excluded from.\n */\nexport const CUT_CYCLE_EDGE_ATTRS = `, style=dashed, color=\"${CUT_CYCLE_COLOR}\", fontcolor=\"${CUT_CYCLE_COLOR}\", constraint=false`;\n\nexport const CRON_FILL = '#FFF9C4';\nexport const CRON_BORDER = '#F9A825';\n\nclass LegendSwatches {\n readonly service =\n '<svg width=\"46\" height=\"26\"><rect x=\"1\" y=\"3\" width=\"44\" height=\"20\" rx=\"7\" fill=\"#E8F5E9\" stroke=\"#333\"/></svg>';\n /**\n * A cylinder on its side — the SAME geometry runtime-visualizer.client.ts draws on the real\n * node, so the legend cannot drift from the picture it explains.\n */\n readonly queue =\n `<svg width=\"46\" height=\"26\"><path d=\"M9,5 H37 A8,8 0 0 1 37,21 H9 A8,8 0 0 1 9,5 Z\" fill=\"${QUEUE_FILL}\" stroke=\"#333\"/>` +\n '<path d=\"M9,5 A8,8 0 0 1 9,21\" fill=\"none\" stroke=\"#333\"/></svg>';\n readonly database =\n `<svg width=\"46\" height=\"26\"><path d=\"M8,7 a15,4 0 0 1 30,0 v12 a15,4 0 0 1 -30,0 z\" fill=\"${DATABASE_FILL}\" stroke=\"#333\"/>` +\n '<path d=\"M8,7 a15,4 0 0 0 30,0\" fill=\"none\" stroke=\"#333\"/></svg>';\n readonly storage =\n '<svg width=\"46\" height=\"26\"><path d=\"M2,22 V6 H16 l3,3 H44 V22 Z\" fill=\"#F3E5F5\" stroke=\"#333\"/></svg>';\n readonly external =\n `<svg width=\"46\" height=\"26\"><rect x=\"1\" y=\"3\" width=\"44\" height=\"20\" fill=\"${EXTERNAL_FILL}\" ` +\n `stroke=\"${EXTERNAL_BORDER}\" stroke-dasharray=\"4,3\"/></svg>`;\n readonly remote =\n `<svg width=\"46\" height=\"26\"><rect x=\"1\" y=\"3\" width=\"44\" height=\"20\" rx=\"7\" fill=\"${REMOTE_SERVICE_FILL}\" ` +\n `stroke=\"${REMOTE_SERVICE_BORDER}\" stroke-width=\"2\"/></svg>`;\n readonly cron =\n `<svg width=\"46\" height=\"26\"><circle cx=\"23\" cy=\"13\" r=\"11\" fill=\"${CRON_FILL}\" stroke=\"${CRON_BORDER}\"/>` +\n '<text x=\"23\" y=\"18\" font-size=\"12\" text-anchor=\"middle\">⏰</text></svg>';\n readonly solid =\n '<svg width=\"60\" height=\"20\"><line x1=\"2\" y1=\"10\" x2=\"48\" y2=\"10\" stroke=\"#333\" stroke-width=\"1.5\"/>' +\n '<path d=\"M48,6 L57,10 L48,14 Z\" fill=\"#333\"/></svg>';\n readonly dashed =\n '<svg width=\"60\" height=\"20\"><line x1=\"2\" y1=\"10\" x2=\"48\" y2=\"10\" stroke=\"#333\" stroke-width=\"1.5\" ' +\n 'stroke-dasharray=\"5,4\"/><path d=\"M48,6 L57,10 L48,14 Z\" fill=\"#333\"/></svg>';\n readonly scheduled =\n `<svg width=\"60\" height=\"20\"><line x1=\"2\" y1=\"10\" x2=\"48\" y2=\"10\" stroke=\"${CRON_BORDER}\" stroke-width=\"1.5\"/>` +\n `<path d=\"M48,6 L57,10 L48,14 Z\" fill=\"${CRON_BORDER}\"/></svg>`;\n}\n\n/**\n * The legend. Three columns — what a box IS, what a line MEANS, how to read a box — replacing the\n * three paragraphs of prose that used to restate the picture in words. Styled after\n * {@link GraphVisualizer}'s legend so the two graphs in this repo look like one tool.\n */\n// webpieces-disable no-function-outside-class -- HTML builder, matching the sibling builders in this file\nexport function legendHtml(): string {\n const sw = new LegendSwatches();\n const item = (swatch: string, text: string): string =>\n `<div class=\"legend-item\"><span class=\"sw\">${swatch}</span><span>${text}</span></div>`;\n return `<div class=\"legend\">\n <h2>Legend</h2>\n <div class=\"legend-columns\">\n <div class=\"legend-col\">\n <h3>Node shapes — <em>what a box is</em></h3>\n ${item(sw.service, '<strong>service</strong> — a deployable in this repo; fill is its dependency level')}\n ${item(sw.remote, '<strong>remote service</strong> — one of our services that lives OUTSIDE this workspace (another repo, a VM, partner endpoints), declared in the reviewed <code>remoteServices</code> table of dependencies.json. It implements our contracts, so it is a service, not a vendor system.')}\n ${item(sw.queue, '<strong>queue</strong> — each <em>line</em> in the box is one Cloud Tasks queue, the unit Terraform actually creates. Queues of one contract that flow between the <em>same</em> producer and consumer share a box; every one is still named, so you can always see <em>which</em> queue is stuck.')}\n ${item(sw.database, '<strong>database</strong> — a datastore outside this repo')}\n ${item(sw.storage, '<strong>object storage</strong> — a bucket outside this repo')}\n ${item(sw.external, '<strong>external system</strong> — outside this repo; nothing here implements it. Pointing <strong>OUT</strong> = a system this repo calls (firestore, gmail). Pointing <strong>IN</strong> = an endpoint driven from outside, and the box names the <strong>CALLER</strong> (<code>twilio</code>), not our contract — the contract and method are on the arrow. One vendor is ONE box however many endpoints it posts to, and the same box whether we call it or it calls us. A dotted box labelled <code>? unknown caller</code> means the endpoint never declared one.')}\n ${item(sw.cron, '<strong>cron</strong> — a scheduler fires this endpoint')}\n </div>\n <div class=\"legend-col\">\n <h3>Lines — <em>what a call is</em></h3>\n ${item(sw.solid, '<strong>solid = rpc</strong> — the request follows the arrow, the response flows back')}\n ${item(sw.dashed, '<strong>dashed = event</strong> — asynchronous: the event flows in the direction of the arrow and returns once it is in the queue')}\n ${item(sw.scheduled, '<strong>scheduled</strong> — a cron invocation')}\n <div class=\"legend-note\"><em>Calls name their contracts inline or expose them in a Uses dropdown. Queue delivery arrows are unlabelled; the queue box names the contract. A service that enqueues to itself loops through its own queue — a queue decouples the two sides, so it is not a dependency cycle.</em></div>\n </div>\n <div class=\"legend-col\">\n <h3>Reading a box</h3>\n <pre class=\"legend-box-anatomy\">name\n(server|client, L#)\nImplements (N)\nUses (N)\n</pre>\n <div class=\"legend-note\">Hover, focus, or click <strong>Implements</strong> and <strong>Uses</strong> for complete qualified lists. One/two API arrows show names; larger groups have a Uses dropdown.</div>\n <div class=\"legend-note\"><code>(via <lib>)</code> = served through an embedded library, not its own source.</div>\n </div>\n </div>\n </div>`;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"runtime-viz-theme.js","sourceRoot":"","sources":["../../../../../../packages/tooling/nx-webpieces-rules/src/lib/runtime-viz-theme.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AA0IH,gCAoCC;AA5KY,QAAA,YAAY,GAA2B;IAChD,CAAC,EAAE,SAAS;IACZ,CAAC,EAAE,SAAS;IACZ,CAAC,EAAE,SAAS;IACZ,CAAC,EAAE,SAAS;CACf,CAAC;AAEW,QAAA,UAAU,GAAG,SAAS,CAAC;AAEpC;;;;;;;;;;;;;;;;GAgBG;AACU,QAAA,WAAW,GAAG,SAAS,CAAC;AACxB,QAAA,kBAAkB,GAAG,IAAI,CAAC;AAEvC;;;;;;;;GAQG;AACU,QAAA,WAAW,GAAG,UAAU,CAAC;AAEtC,mGAAmG;AACtF,QAAA,aAAa,GAAG,SAAS,CAAC;AAEvC;;;;GAIG;AACU,QAAA,iBAAiB,GAAG,SAAS,CAAC;AAE3C,kGAAkG;AACrF,QAAA,eAAe,GAA2B;IACnD,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,UA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pG,6EAA6E,CAAC;IACzE,SAAS,GACd,4EAA4E,mBAAW,wBAAwB;QAC/G,yCAAyC,mBAAW,WAAW,CAAC;CACvE;AAED;;;;GAIG;AACH,0GAA0G;AAC1G,SAAgB,UAAU;IACtB,MAAM,EAAE,GAAG,IAAI,cAAc,EAAE,CAAC;IAChC,MAAM,IAAI,GAAG,CAAC,MAAc,EAAE,IAAY,EAAU,EAAE,CAClD,6CAA6C,MAAM,gBAAgB,IAAI,eAAe,CAAC;IAC3F,OAAO;;;;;kBAKO,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,0FAA0F,CAAC;kBAC5G,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,+RAA+R,CAAC;kBAChT,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,0SAA0S,CAAC;kBAC1T,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,iEAAiE,CAAC;kBACpF,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,oEAAoE,CAAC;kBACtF,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,kmBAAkmB,CAAC;kBACrnB,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,+DAA+D,CAAC;;;;kBAI9E,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,6FAA6F,CAAC;kBAC7G,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,yIAAyI,CAAC;kBAC1J,IAAI,CAAC,EAAE,CAAC,SAAS,EAAE,sDAAsD,CAAC;;;;;;;;;;;;;;WAcjF,CAAC;AACZ,CAAC","sourcesContent":["/**\n * The runtime graph's VISUAL VOCABULARY, and the legend that explains it.\n *\n * Every colour, shape and fill the drawing uses lives here, next to the legend swatches that teach\n * the reader what each one means. They are one unit on purpose: the legend's job is to be a true\n * account of the picture, and the fastest way for a legend to start lying is for it to sit in a\n * different file from the constants it describes and drift as those change.\n *\n * Imported by runtime-visualizer.ts, which owns the DRAWING (which nodes and edges to emit). This\n * module knows nothing about the graph model, which is what keeps the dependency one-way and\n * cycle-free.\n */\n\nexport const LEVEL_COLORS: Record<number, string> = {\n 0: '#E8F5E9',\n 1: '#E3F2FD',\n 2: '#FFF3E0',\n 3: '#FCE4EC',\n};\n\nexport const QUEUE_FILL = '#FFF3E0';\n\n/**\n * The queue node is an `Mrecord` whose FIRST field is empty, which draws a rounded outline with a\n * vertical cap line near one end — a cylinder lying on its side, distinguishing a queue from the\n * upright cylinder that now means a database.\n *\n * Two things here are load-bearing and easy to break:\n *\n * 1. NO surrounding `{}`. Record fields lay out along the rank direction, and this graph is\n * `rankdir=TB` (see {@link generateRuntimeDot}), where the default is horizontal — which is what\n * we want. Adding braces TOGGLES that, turning the cap line into a band across the top.\n * 2. The leading space is the empty field. The record parser trims it to nothing, which is the\n * point; it must survive as its own field, so the `|` cannot be dropped.\n *\n * Graphviz has no sideways cylinder and never has: `orientation=` is documented as rotating POLYGON\n * shapes, and `cylinder` is drawn with beziers, so it silently ignores the attribute (graphviz issue\n * #2244, open since 2022 and still reproducible on 13.0.0). This is the closest native shape.\n */\nexport const QUEUE_SHAPE = 'Mrecord';\nexport const QUEUE_LABEL_PREFIX = ' |';\n\n/**\n * Marker class stamped on every queue node. Graphviz copies `class` straight into the rendered\n * `<g class=\"node wp_queue\">`, which is how runtime-visualizer.client.ts finds these nodes and\n * redraws them as true horizontal cylinders in the browser.\n *\n * A CLASS rather than an id prefix, because queue-kind EXTERNAL systems are queues too and share the\n * `system__` id space with databases — which must stay upright. Underscored, not hyphenated: DOT\n * emits a hyphen as `-`, which is harmless but needlessly surprising to anyone reading the SVG.\n */\nexport const QUEUE_CLASS = 'wp_queue';\n\n/** Fill for the upright cylinder standing for an external DATASTORE (firestore, postgres, ...). */\nexport const DATABASE_FILL = '#E1F5FE';\n\n/**\n * Fill for a destination whose ADDRESS arrives at runtime (a partner-registered webhook URL). Amber\n * rather than the neutral external grey on purpose: this is the one outbound hop where the address\n * itself is attacker-influenced data, and the graph exists to make it findable.\n */\nexport const RUNTIME_HOST_FILL = '#FFE0B2';\n\n/** Shape per external-system kind. Anything unrecognised falls back to the generic dashed box. */\nexport const EXTERNAL_SHAPES: Record<string, string> = {\n database: 'cylinder',\n cache: 'cylinder',\n queue: 'Mrecord',\n storage: 'folder',\n // A destination dialled by address rather than by name: a doubled outline, because what is on\n // the far side is not one system we can name but whatever the data said.\n runtime: 'doubleoctagon',\n};\n\n/** Fill per external-system kind, paired with {@link EXTERNAL_SHAPES}. */\nexport const EXTERNAL_FILLS: Record<string, string> = {\n database: DATABASE_FILL,\n cache: DATABASE_FILL,\n queue: QUEUE_FILL,\n storage: '#F3E5F5',\n runtime: RUNTIME_HOST_FILL,\n};\n\n/** Fill + border for the dashed terminal node standing for a system outside this repo. */\nexport const EXTERNAL_FILL = '#FAFAFA';\nexport const EXTERNAL_BORDER = '#9E9E9E';\n\n/**\n * Fill + border for a REMOTE SERVICE (#1203): one of OUR services that lives outside this workspace\n * (another repo, a VM). Rounded like an in-repo service, because it is one — it implements our\n * contracts — but teal with a bold outline, so it never reads as a vendor box or as a deployable here.\n */\nexport const REMOTE_SERVICE_FILL = '#E0F2F1';\nexport const REMOTE_SERVICE_BORDER = '#00796B';\n\n/** Fill + border for the clock node standing for a scheduler-driven endpoint. */\n/** The colour of a `cutLegacyCycle` edge — red, because it is drawing DEBT, not a design. */\nexport const CUT_CYCLE_COLOR = '#D32F2F';\n\n/**\n * DOT attributes appended to a `cutLegacyCycle` edge: dashed and red so it reads as debt, and\n * `constraint=false` so it does not pull on a ranking it was deliberately excluded from.\n */\nexport const CUT_CYCLE_EDGE_ATTRS = `, style=dashed, color=\"${CUT_CYCLE_COLOR}\", fontcolor=\"${CUT_CYCLE_COLOR}\", constraint=false`;\n\nexport const CRON_FILL = '#FFF9C4';\nexport const CRON_BORDER = '#F9A825';\n\nclass LegendSwatches {\n readonly service =\n '<svg width=\"46\" height=\"26\"><rect x=\"1\" y=\"3\" width=\"44\" height=\"20\" rx=\"7\" fill=\"#E8F5E9\" stroke=\"#333\"/></svg>';\n /**\n * A cylinder on its side — the SAME geometry runtime-visualizer.client.ts draws on the real\n * node, so the legend cannot drift from the picture it explains.\n */\n readonly queue =\n `<svg width=\"46\" height=\"26\"><path d=\"M9,5 H37 A8,8 0 0 1 37,21 H9 A8,8 0 0 1 9,5 Z\" fill=\"${QUEUE_FILL}\" stroke=\"#333\"/>` +\n '<path d=\"M9,5 A8,8 0 0 1 9,21\" fill=\"none\" stroke=\"#333\"/></svg>';\n readonly database =\n `<svg width=\"46\" height=\"26\"><path d=\"M8,7 a15,4 0 0 1 30,0 v12 a15,4 0 0 1 -30,0 z\" fill=\"${DATABASE_FILL}\" stroke=\"#333\"/>` +\n '<path d=\"M8,7 a15,4 0 0 0 30,0\" fill=\"none\" stroke=\"#333\"/></svg>';\n readonly storage =\n '<svg width=\"46\" height=\"26\"><path d=\"M2,22 V6 H16 l3,3 H44 V22 Z\" fill=\"#F3E5F5\" stroke=\"#333\"/></svg>';\n readonly external =\n `<svg width=\"46\" height=\"26\"><rect x=\"1\" y=\"3\" width=\"44\" height=\"20\" fill=\"${EXTERNAL_FILL}\" ` +\n `stroke=\"${EXTERNAL_BORDER}\" stroke-dasharray=\"4,3\"/></svg>`;\n readonly remote =\n `<svg width=\"46\" height=\"26\"><rect x=\"1\" y=\"3\" width=\"44\" height=\"20\" rx=\"7\" fill=\"${REMOTE_SERVICE_FILL}\" ` +\n `stroke=\"${REMOTE_SERVICE_BORDER}\" stroke-width=\"2\"/></svg>`;\n readonly cron =\n `<svg width=\"46\" height=\"26\"><circle cx=\"23\" cy=\"13\" r=\"11\" fill=\"${CRON_FILL}\" stroke=\"${CRON_BORDER}\"/>` +\n '<text x=\"23\" y=\"18\" font-size=\"12\" text-anchor=\"middle\">⏰</text></svg>';\n readonly solid =\n '<svg width=\"60\" height=\"20\"><line x1=\"2\" y1=\"10\" x2=\"48\" y2=\"10\" stroke=\"#333\" stroke-width=\"1.5\"/>' +\n '<path d=\"M48,6 L57,10 L48,14 Z\" fill=\"#333\"/></svg>';\n readonly dashed =\n '<svg width=\"60\" height=\"20\"><line x1=\"2\" y1=\"10\" x2=\"48\" y2=\"10\" stroke=\"#333\" stroke-width=\"1.5\" ' +\n 'stroke-dasharray=\"5,4\"/><path d=\"M48,6 L57,10 L48,14 Z\" fill=\"#333\"/></svg>';\n readonly scheduled =\n `<svg width=\"60\" height=\"20\"><line x1=\"2\" y1=\"10\" x2=\"48\" y2=\"10\" stroke=\"${CRON_BORDER}\" stroke-width=\"1.5\"/>` +\n `<path d=\"M48,6 L57,10 L48,14 Z\" fill=\"${CRON_BORDER}\"/></svg>`;\n}\n\n/**\n * The legend. Three columns — what a box IS, what a line MEANS, how to read a box — replacing the\n * three paragraphs of prose that used to restate the picture in words. Styled after\n * {@link GraphVisualizer}'s legend so the two graphs in this repo look like one tool.\n */\n// webpieces-disable no-function-outside-class -- HTML builder, matching the sibling builders in this file\nexport function legendHtml(): string {\n const sw = new LegendSwatches();\n const item = (swatch: string, text: string): string =>\n `<div class=\"legend-item\"><span class=\"sw\">${swatch}</span><span>${text}</span></div>`;\n return `<div class=\"legend\">\n <h2>Legend</h2>\n <div class=\"legend-columns\">\n <div class=\"legend-col\">\n <h3>Node shapes — <em>what a box is</em></h3>\n ${item(sw.service, '<strong>service</strong> — a deployable in this repo; fill is its dependency level')}\n ${item(sw.remote, '<strong>remote service</strong> — one of our services that lives OUTSIDE this workspace (another repo, a VM, partner endpoints), declared in the reviewed <code>remoteServices</code> table of dependencies.json. It implements our contracts, so it is a service, not a vendor system.')}\n ${item(sw.queue, '<strong>queue</strong> — each <em>line</em> in the box is one Cloud Tasks queue, the unit Terraform actually creates. Queues of one contract that flow between the <em>same</em> producer and consumer share a box; every one is still named, so you can always see <em>which</em> queue is stuck.')}\n ${item(sw.database, '<strong>database</strong> — a datastore outside this repo')}\n ${item(sw.storage, '<strong>object storage</strong> — a bucket outside this repo')}\n ${item(sw.external, '<strong>external system</strong> — outside this repo; nothing here implements it. Pointing <strong>OUT</strong> = a system this repo calls (firestore, gmail). Pointing <strong>IN</strong> = an endpoint driven from outside, and the box names the <strong>CALLER</strong> (<code>twilio</code>), not our contract — the arrow names a single contract/method or groups multiple APIs in a Uses dropdown. One vendor is ONE box however many endpoints it posts to, and the same box whether we call it or it calls us. A dotted box labelled <code>? unknown caller</code> means the endpoint never declared one.')}\n ${item(sw.cron, '<strong>cron</strong> — a scheduler fires this endpoint')}\n </div>\n <div class=\"legend-col\">\n <h3>Lines — <em>what a call is</em></h3>\n ${item(sw.solid, '<strong>solid = rpc</strong> — the request follows the arrow, the response flows back')}\n ${item(sw.dashed, '<strong>dashed = event</strong> — asynchronous: the event flows in the direction of the arrow and returns once it is in the queue')}\n ${item(sw.scheduled, '<strong>scheduled</strong> — a cron invocation')}\n <div class=\"legend-note\"><em>Calls name their contracts inline or expose them in a Uses dropdown. Queue delivery arrows are unlabelled; the queue box names the contract. A service that enqueues to itself loops through its own queue — a queue decouples the two sides, so it is not a dependency cycle.</em></div>\n </div>\n <div class=\"legend-col\">\n <h3>Reading a box</h3>\n <pre class=\"legend-box-anatomy\">name\n(server|client, L#)\nImplements (N)\nUses (N)\n</pre>\n <div class=\"legend-note\">Click <strong>Implements</strong> in the node menu or a <strong>Uses</strong> dropdown for complete qualified lists. A single API is named inline; two or more APIs have a Uses dropdown. Single-API queue arrows say enqueue; their box names the contract.</div>\n <div class=\"legend-note\"><code>(via <lib>)</code> = served through an embedded library, not its own source.</div>\n </div>\n </div>\n </div>`;\n}\n"]}
|