@webpieces/nx-webpieces-rules 0.4.847 → 0.4.848
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/README.md +28 -15
- package/executors.json +1 -66
- package/package.json +9 -9
- package/src/executors/validate-architecture-unchanged/executor.d.ts +8 -0
- package/src/executors/validate-architecture-unchanged/executor.js +20 -18
- package/src/executors/validate-architecture-unchanged/executor.js.map +1 -1
- package/src/executors/validate-code/executor.d.ts +2 -7
- package/src/executors/validate-code/executor.js +31 -2
- package/src/executors/validate-code/executor.js.map +1 -1
- package/src/executors/validate-code/schema.json +6 -281
- package/src/executors/validate-runtime-architecture/schema.json +1 -1
- package/src/lib/api-usage/wire-closure.d.ts +3 -3
- package/src/lib/api-usage/wire-closure.js +5 -5
- package/src/lib/api-usage/wire-closure.js.map +1 -1
- package/src/lib/api-usage/wire-suffix-entry.d.ts +5 -0
- package/src/lib/api-usage/wire-suffix-entry.js +10 -0
- package/src/lib/api-usage/wire-suffix-entry.js.map +1 -0
- package/src/lib/rule-gate.d.ts +1 -2
- package/src/lib/rule-gate.js +3 -4
- package/src/lib/rule-gate.js.map +1 -1
- package/src/lib/runtime-visualizer.d.ts +4 -4
- package/src/lib/runtime-visualizer.js +2 -2
- package/src/lib/runtime-visualizer.js.map +1 -1
- package/src/native-actions.d.ts +23 -0
- package/src/native-actions.js +69 -0
- package/src/native-actions.js.map +1 -0
- package/src/nx-policy-registry.d.ts +8 -0
- package/src/nx-policy-registry.js +40 -0
- package/src/nx-policy-registry.js.map +1 -0
- package/src/pack-build-runner.d.ts +6 -0
- package/src/pack-build-runner.js +46 -0
- package/src/pack-build-runner.js.map +1 -0
- package/src/plugin.js +6 -40
- package/src/plugin.js.map +1 -1
- package/src/rule-help.d.ts +3 -0
- package/src/rule-help.js +24 -0
- package/src/rule-help.js.map +1 -0
- package/src/rule-pack.js +5 -28
- package/src/rule-pack.js.map +1 -1
- package/src/rule-runtime.d.ts +5 -0
- package/src/rule-runtime.js +94 -0
- package/src/rule-runtime.js.map +1 -0
- package/src/validation-targets.js +21 -5
- package/src/validation-targets.js.map +1 -1
- package/src/executors/validate-catch-error-pattern/executor.d.ts +0 -4
- package/src/executors/validate-catch-error-pattern/executor.js +0 -8
- package/src/executors/validate-catch-error-pattern/executor.js.map +0 -1
- package/src/executors/validate-catch-error-pattern/schema.json +0 -24
- package/src/executors/validate-dtos/executor.d.ts +0 -4
- package/src/executors/validate-dtos/executor.js +0 -8
- package/src/executors/validate-dtos/executor.js.map +0 -1
- package/src/executors/validate-dtos/schema.json +0 -33
- package/src/executors/validate-modified-files/executor.d.ts +0 -4
- package/src/executors/validate-modified-files/executor.js +0 -8
- package/src/executors/validate-modified-files/executor.js.map +0 -1
- package/src/executors/validate-modified-files/schema.json +0 -25
- package/src/executors/validate-modified-methods/executor.d.ts +0 -4
- package/src/executors/validate-modified-methods/executor.js +0 -8
- package/src/executors/validate-modified-methods/executor.js.map +0 -1
- package/src/executors/validate-modified-methods/schema.json +0 -25
- package/src/executors/validate-new-methods/executor.d.ts +0 -4
- package/src/executors/validate-new-methods/executor.js +0 -8
- package/src/executors/validate-new-methods/executor.js.map +0 -1
- package/src/executors/validate-new-methods/schema.json +0 -25
- package/src/executors/validate-no-any-unknown/executor.d.ts +0 -4
- package/src/executors/validate-no-any-unknown/executor.js +0 -8
- package/src/executors/validate-no-any-unknown/executor.js.map +0 -1
- package/src/executors/validate-no-any-unknown/schema.json +0 -24
- package/src/executors/validate-no-destructure/executor.d.ts +0 -4
- package/src/executors/validate-no-destructure/executor.js +0 -8
- package/src/executors/validate-no-destructure/executor.js.map +0 -1
- package/src/executors/validate-no-destructure/schema.json +0 -24
- package/src/executors/validate-no-direct-api-resolver/executor.d.ts +0 -4
- package/src/executors/validate-no-direct-api-resolver/executor.js +0 -8
- package/src/executors/validate-no-direct-api-resolver/executor.js.map +0 -1
- package/src/executors/validate-no-direct-api-resolver/schema.json +0 -29
- package/src/executors/validate-no-implicit-any/executor.d.ts +0 -4
- package/src/executors/validate-no-implicit-any/executor.js +0 -8
- package/src/executors/validate-no-implicit-any/executor.js.map +0 -1
- package/src/executors/validate-no-implicit-any/schema.json +0 -24
- package/src/executors/validate-no-inline-types/executor.d.ts +0 -4
- package/src/executors/validate-no-inline-types/executor.js +0 -8
- package/src/executors/validate-no-inline-types/executor.js.map +0 -1
- package/src/executors/validate-no-inline-types/schema.json +0 -24
- package/src/executors/validate-no-unmanaged-exceptions/executor.d.ts +0 -4
- package/src/executors/validate-no-unmanaged-exceptions/executor.js +0 -8
- package/src/executors/validate-no-unmanaged-exceptions/executor.js.map +0 -1
- package/src/executors/validate-no-unmanaged-exceptions/schema.json +0 -24
- package/src/executors/validate-prisma-converters/executor.d.ts +0 -4
- package/src/executors/validate-prisma-converters/executor.js +0 -8
- package/src/executors/validate-prisma-converters/executor.js.map +0 -1
- package/src/executors/validate-prisma-converters/schema.json +0 -38
- package/src/executors/validate-return-types/executor.d.ts +0 -4
- package/src/executors/validate-return-types/executor.js +0 -8
- package/src/executors/validate-return-types/executor.js.map +0 -1
- package/src/executors/validate-return-types/schema.json +0 -24
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-visualizer.js","sourceRoot":"","sources":["../../../../../../packages/tooling/nx-webpieces-rules/src/lib/runtime-visualizer.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;;;AAudH,gDAkDC;AAQD,8DAiBC;;AAhiBD,+CAAyB;AACzB,mDAA6B;AAQ7B,6CAAqE;AACrE,2DAAsD;AACtD,2DAa6B;AAE7B,+FAA+F;AAC/F,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAE9B,iGAAiG;AACjG,MAAM,QAAQ,GAAG,GAAG,CAAC;AAErB,4CAA4C;AAC5C,MAAa,iBAAiB;IAON;IANpB;IACI;;;;OAIG;IACa,oBAA6B,IAAI;QAAjC,sBAAiB,GAAjB,iBAAiB,CAAg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E,OAAO,CAAC,CAAC;IACtD,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,GAAG,EAAE,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC;IAE9E,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;AACjC,CAAC","sourcesContent":["/**\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). Its only item is Lock/Unlock: locking dims every\n * other node and every edge and lights the locked box alone. 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. This page has no lock dropdown, so the menu is the one and only lock control.\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 { RuntimeHtmlPage } from './runtime-html-page';\nimport {\n LEVEL_COLORS,\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} 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\n/** Render options for the runtime graph. */\nexport class RuntimeVizOptions {\n constructor(\n /**\n * Draw the dashed terminal nodes for contracts nothing in-repo implements. On by default;\n * a repo whose external surface is noisy can turn them off in webpieces.config.json\n * (runtime-architecture.showExternalNodes).\n */\n public readonly showExternalNodes: boolean = true,\n ) {}\n}\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 * The implemented-api entries for a node label. An api served through an EMBEDDED LIBRARY is\n * annotated with that library, because \"who implements WarmupApi?\" otherwise requires knowing that\n * the derivation walks the dependsOn closure and then walking it by hand.\n */\n// webpieces-disable no-function-outside-class -- DOT label builder, matching getShortName in this file\nfunction implementsEntries(svc: RuntimeService): string[] {\n return svc.implements.map((api: string) => {\n const via = svc.implementsVia?.[api];\n return via === undefined ? api : `${api} (via ${getShortName(via)})`;\n });\n}\n\n/**\n * The full node label: name, role/level/declared service name, then the contracts it SERVES.\n *\n * What a service USES is deliberately absent. Every `uses` entry already draws an outgoing arrow —\n * to the implementing service, to a queue, or to an external node — and the arrow carries the same\n * contract name as its label, so listing them in the box restated the picture and made every box\n * wider than it needed to be. `implements` stays because it has no such arrow: an api a service\n * serves but nothing in-repo calls is invisible otherwise.\n *\n * The one case this loses information is `showExternalNodes:false`, where an outbound call draws no\n * node and therefore no arrow. That is precisely what that opt-out asks for, and the legend says so.\n */\n// webpieces-disable no-function-outside-class -- DOT label builder, matching getShortName in this file\nfunction nodeLabel(name: string, svc: RuntimeService): string {\n // The DECLARED role when the graph carries one; the old inference only as a fallback for a\n // runtime-dependencies.json committed before `role` existed. Inferring it labelled every server\n // with no implements as a \"client\", which is exactly wrong for a queue-driven service.\n const role = svc.role ?? (svc.implements.length > 0 ? 'server' : 'client');\n // The declared name is quoted for the reader — those quotes MUST be DOT-escaped, or they end\n // the label string and the whole graph stops parsing.\n const declared = svc.serviceName === undefined ? '' : `, \\\\\"${dotValue(svc.serviceName)}\\\\\"`;\n let label = `${dotValue(getShortName(name))}\\\\n(${role}, L${svc.level}${declared})`;\n if (svc.implements.length > 0) label += `\\\\nimplements: ${labelList(implementsEntries(svc))}`;\n return label;\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 = 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. Names arrive pre-escaped. */\n// webpieces-disable no-function-outside-class -- DOT string builder, matching getShortName in this file\nfunction queueBoxDot(id: string, body: string, producers: string[], consumers: string[]): 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 =\n ` \"${id}\" [shape=${QUEUE_SHAPE}, style=\"filled\", fillcolor=\"${QUEUE_FILL}\", ` +\n `class=\"${QUEUE_CLASS}\", label=\"${QUEUE_LABEL_PREFIX}${body}\"];\\n`;\n for (const producer of producers)\n dot += ` \"${producer}\" -> \"${id}\" [label=\"enqueue\", style=dashed];\\n`;\n for (const consumer of consumers)\n dot += ` \"${id}\" -> \"${consumer}\" [label=\"deliver\", style=dashed];\\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 * 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>): 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 // A contract with no method table (no architecture/apis/<Api>.json for it) has no\n // per-method queue at all, so it keeps the historical unnamed per-pair box.\n const byQueue = new Map<string, QueueEndpoints>();\n for (const edge of queued) {\n const from = serviceNodeId(edge.from);\n const to = serviceNodeId(edge.to);\n if (edge.queue === undefined) {\n // Kept RAW: recordValue already applies dotValue, so escaping here would double it.\n const viaRaw = edge.via.map((v: string) => getShortName(v)).join(', ');\n dot += queueBoxDot(\n `queue__${dotId(edge.from)}__${dotId(edge.to)}`,\n `${recordValue(viaRaw)}\\\\nqueue`,\n [from],\n [to],\n );\n continue;\n }\n if (!byQueue.has(edge.queue)) byQueue.set(edge.queue, new QueueEndpoints());\n byQueue.get(edge.queue)!.producers.add(from);\n byQueue.get(edge.queue)!.consumers.add(to);\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 );\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): 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 (\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(graph: RuntimeGraph, hidden: Set<string>, options: RuntimeVizOptions): 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 ` \"${id}\" [shape=circle, style=\"filled\", fillcolor=\"${CRON_FILL}\", ` +\n `color=\"${CRON_BORDER}\", label=\"⏰\\\\ncron\"];\\n` +\n ` \"${id}\" -> \"${service}\" [label=\"${label}\\\\n${schedule}\", color=\"${CRON_BORDER}\"];\\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 ? ` \"${id}\" [shape=box, style=\"dotted,filled\", fillcolor=\"${EXTERNAL_FILL}\", ` +\n `color=\"${EXTERNAL_BORDER}\", label=\"${dotValue(trigger.api)}\\\\n? unknown caller\"];\\n`\n : externalSystemNodeDot(\n caller.label,\n caller.kind,\n caller.label,\n 'external caller',\n );\n }\n dot += ` \"${id}\" -> \"${service}\" [label=\"${label}\", style=dashed, color=\"${EXTERNAL_BORDER}\"];\\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(graph: RuntimeGraph, hidden: Set<string>): 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 );\n }\n for (const id of ids) {\n const system = systems[id];\n const via =\n system.apis.length === 0 ? '' : ` [label=\"${labelList([...system.apis].sort())}\"]`;\n for (const service of [...system.usedBy].sort()) {\n if (hidden.has(service)) continue;\n dot += ` \"${serviceNodeId(service)}\" -> \"system__${dotId(id)}\"${via};\\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>): 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 +=\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 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 via = labelList(apisByPair.get(key)!.sort());\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 +=\n ` \"${serviceNodeId(service)}\" -> \"external__${dotValue(external)}\" ` +\n `[label=\"${via}\", color=\"${EXTERNAL_BORDER}\"];\\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 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=10];\\n\\n';\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 const color = LEVEL_COLORS[svc.level] || '#F5F5F5';\n dot += ` \"${serviceNodeId(name)}\" [fillcolor=\"${color}\", label=\"${nodeLabel(name, svc)}\"];\\n`;\n }\n\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 += edgeDot(edge);\n }\n\n dot += queuesDot(graph, hidden);\n dot += triggerDot(graph, hidden, options);\n\n if (options.showExternalNodes) {\n dot += externalSystemsDot(graph, hidden);\n dot += externalDot(graph, hidden);\n }\n\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 return dot;\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 dot = generateRuntimeDot(graph, title, options);\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(dot, title), 'utf-8');\n\n return { dotPath, htmlPath };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"runtime-visualizer.js","sourceRoot":"","sources":["../../../../../../packages/tooling/nx-webpieces-rules/src/lib/runtime-visualizer.ts"],"names":[],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D,yDAAyD;AACzD,SAAgB,yBAAyB,CACrC,KAAmB,EACnB,aAAqB,EACrB,QAAgB,gCAAgC,EAChD,UAA6B,IAAI,iBAAiB,EAAE;IAEpD,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;IAC/D,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC;QAAE,EAAE,CAAC,SAAS,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAE5E,MAAM,GAAG,GAAG,kBAAkB,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACtD,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,GAAG,EAAE,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC;IAE9E,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;AACjC,CAAC","sourcesContent":["/**\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). Its only item is Lock/Unlock: locking dims every\n * other node and every edge and lights the locked box alone. 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. This page has no lock dropdown, so the menu is the one and only lock control.\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 { RuntimeHtmlPage } from './runtime-html-page';\nimport {\n LEVEL_COLORS,\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} 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\n/** Render options for the runtime graph. */\nexport class RuntimeVizOptions {\n constructor(\n /**\n * Draw the dashed terminal nodes for contracts nothing in-repo implements. On by default;\n * a repo whose external surface is noisy can turn them off in the declared Nx owner file's\n * direct policy-ID map (runtime-architecture.showExternalNodes).\n */\n public readonly showExternalNodes: boolean = true,\n ) {}\n}\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 * The implemented-api entries for a node label. An api served through an EMBEDDED LIBRARY is\n * annotated with that library, because \"who implements WarmupApi?\" otherwise requires knowing that\n * the derivation walks the dependsOn closure and then walking it by hand.\n */\n// webpieces-disable no-function-outside-class -- DOT label builder, matching getShortName in this file\nfunction implementsEntries(svc: RuntimeService): string[] {\n return svc.implements.map((api: string) => {\n const via = svc.implementsVia?.[api];\n return via === undefined ? api : `${api} (via ${getShortName(via)})`;\n });\n}\n\n/**\n * The full node label: name, role/level/declared service name, then the contracts it SERVES.\n *\n * What a service USES is deliberately absent. Every `uses` entry already draws an outgoing arrow —\n * to the implementing service, to a queue, or to an external node — and the arrow carries the same\n * contract name as its label, so listing them in the box restated the picture and made every box\n * wider than it needed to be. `implements` stays because it has no such arrow: an api a service\n * serves but nothing in-repo calls is invisible otherwise.\n *\n * The one case this loses information is `showExternalNodes:false`, where an outbound call draws no\n * node and therefore no arrow. That is precisely what that opt-out asks for, and the legend says so.\n */\n// webpieces-disable no-function-outside-class -- DOT label builder, matching getShortName in this file\nfunction nodeLabel(name: string, svc: RuntimeService): string {\n // The DECLARED role when the graph carries one; the old inference only as a fallback for a\n // runtime-dependencies.json committed before `role` existed. Inferring it labelled every server\n // with no implements as a \"client\", which is exactly wrong for a queue-driven service.\n const role = svc.role ?? (svc.implements.length > 0 ? 'server' : 'client');\n // The declared name is quoted for the reader — those quotes MUST be DOT-escaped, or they end\n // the label string and the whole graph stops parsing.\n const declared = svc.serviceName === undefined ? '' : `, \\\\\"${dotValue(svc.serviceName)}\\\\\"`;\n let label = `${dotValue(getShortName(name))}\\\\n(${role}, L${svc.level}${declared})`;\n if (svc.implements.length > 0) label += `\\\\nimplements: ${labelList(implementsEntries(svc))}`;\n return label;\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 = 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. Names arrive pre-escaped. */\n// webpieces-disable no-function-outside-class -- DOT string builder, matching getShortName in this file\nfunction queueBoxDot(id: string, body: string, producers: string[], consumers: string[]): 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 =\n ` \"${id}\" [shape=${QUEUE_SHAPE}, style=\"filled\", fillcolor=\"${QUEUE_FILL}\", ` +\n `class=\"${QUEUE_CLASS}\", label=\"${QUEUE_LABEL_PREFIX}${body}\"];\\n`;\n for (const producer of producers)\n dot += ` \"${producer}\" -> \"${id}\" [label=\"enqueue\", style=dashed];\\n`;\n for (const consumer of consumers)\n dot += ` \"${id}\" -> \"${consumer}\" [label=\"deliver\", style=dashed];\\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 * 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>): 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 // A contract with no method table (no architecture/apis/<Api>.json for it) has no\n // per-method queue at all, so it keeps the historical unnamed per-pair box.\n const byQueue = new Map<string, QueueEndpoints>();\n for (const edge of queued) {\n const from = serviceNodeId(edge.from);\n const to = serviceNodeId(edge.to);\n if (edge.queue === undefined) {\n // Kept RAW: recordValue already applies dotValue, so escaping here would double it.\n const viaRaw = edge.via.map((v: string) => getShortName(v)).join(', ');\n dot += queueBoxDot(\n `queue__${dotId(edge.from)}__${dotId(edge.to)}`,\n `${recordValue(viaRaw)}\\\\nqueue`,\n [from],\n [to],\n );\n continue;\n }\n if (!byQueue.has(edge.queue)) byQueue.set(edge.queue, new QueueEndpoints());\n byQueue.get(edge.queue)!.producers.add(from);\n byQueue.get(edge.queue)!.consumers.add(to);\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 );\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): 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 (\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(graph: RuntimeGraph, hidden: Set<string>, options: RuntimeVizOptions): 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 ` \"${id}\" [shape=circle, style=\"filled\", fillcolor=\"${CRON_FILL}\", ` +\n `color=\"${CRON_BORDER}\", label=\"⏰\\\\ncron\"];\\n` +\n ` \"${id}\" -> \"${service}\" [label=\"${label}\\\\n${schedule}\", color=\"${CRON_BORDER}\"];\\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 ? ` \"${id}\" [shape=box, style=\"dotted,filled\", fillcolor=\"${EXTERNAL_FILL}\", ` +\n `color=\"${EXTERNAL_BORDER}\", label=\"${dotValue(trigger.api)}\\\\n? unknown caller\"];\\n`\n : externalSystemNodeDot(\n caller.label,\n caller.kind,\n caller.label,\n 'external caller',\n );\n }\n dot += ` \"${id}\" -> \"${service}\" [label=\"${label}\", style=dashed, color=\"${EXTERNAL_BORDER}\"];\\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(graph: RuntimeGraph, hidden: Set<string>): 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 );\n }\n for (const id of ids) {\n const system = systems[id];\n const via =\n system.apis.length === 0 ? '' : ` [label=\"${labelList([...system.apis].sort())}\"]`;\n for (const service of [...system.usedBy].sort()) {\n if (hidden.has(service)) continue;\n dot += ` \"${serviceNodeId(service)}\" -> \"system__${dotId(id)}\"${via};\\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>): 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 +=\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 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 via = labelList(apisByPair.get(key)!.sort());\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 +=\n ` \"${serviceNodeId(service)}\" -> \"external__${dotValue(external)}\" ` +\n `[label=\"${via}\", color=\"${EXTERNAL_BORDER}\"];\\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 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=10];\\n\\n';\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 const color = LEVEL_COLORS[svc.level] || '#F5F5F5';\n dot += ` \"${serviceNodeId(name)}\" [fillcolor=\"${color}\", label=\"${nodeLabel(name, svc)}\"];\\n`;\n }\n\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 += edgeDot(edge);\n }\n\n dot += queuesDot(graph, hidden);\n dot += triggerDot(graph, hidden, options);\n\n if (options.showExternalNodes) {\n dot += externalSystemsDot(graph, hidden);\n dot += externalDot(graph, hidden);\n }\n\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 return dot;\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 dot = generateRuntimeDot(graph, title, options);\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(dot, title), 'utf-8');\n\n return { dotPath, htmlPath };\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ExecutorContext } from '@nx/devkit';
|
|
2
|
+
import { BuildPolicyResult } from '@webpieces/rules-sdk';
|
|
3
|
+
/** Native owner actions are shared where one existing scan enforces several configured policies. */
|
|
4
|
+
export declare class NativeAction {
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly scope: 'workspace' | 'projects';
|
|
7
|
+
readonly execute: (context: ExecutorContext) => Promise<BuildPolicyResult>;
|
|
8
|
+
constructor(name: string, scope: 'workspace' | 'projects', execute: (context: ExecutorContext) => Promise<BuildPolicyResult>);
|
|
9
|
+
}
|
|
10
|
+
/** Metadata holds lazy imports only; importing the pack never imports an executor or the Nx runtime. */
|
|
11
|
+
export declare class NativeActions {
|
|
12
|
+
readonly fileCycles: NativeAction;
|
|
13
|
+
readonly runtime: NativeAction;
|
|
14
|
+
readonly wiring: NativeAction;
|
|
15
|
+
readonly design: NativeAction;
|
|
16
|
+
readonly architecture: NativeAction;
|
|
17
|
+
readonly cycles: NativeAction;
|
|
18
|
+
readonly packageJson: NativeAction;
|
|
19
|
+
readonly versions: NativeAction;
|
|
20
|
+
readonly eslintSync: NativeAction;
|
|
21
|
+
readonly tsInSrc: NativeAction;
|
|
22
|
+
readonly graphPolicies: NativeAction;
|
|
23
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.NativeActions = exports.NativeAction = void 0;
|
|
37
|
+
const rules_sdk_1 = require("@webpieces/rules-sdk");
|
|
38
|
+
/** Native owner actions are shared where one existing scan enforces several configured policies. */
|
|
39
|
+
class NativeAction {
|
|
40
|
+
name;
|
|
41
|
+
scope;
|
|
42
|
+
execute;
|
|
43
|
+
constructor(name, scope, execute) {
|
|
44
|
+
this.name = name;
|
|
45
|
+
this.scope = scope;
|
|
46
|
+
this.execute = execute;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.NativeAction = NativeAction;
|
|
50
|
+
/** Metadata holds lazy imports only; importing the pack never imports an executor or the Nx runtime. */
|
|
51
|
+
class NativeActions {
|
|
52
|
+
fileCycles = new NativeAction('file-cycles', 'projects', async (context) => (await Promise.resolve().then(() => __importStar(require('./executors/validate-no-file-import-cycles/executor')))).default({}, context));
|
|
53
|
+
runtime = new NativeAction('runtime', 'workspace', async (context) => (await Promise.resolve().then(() => __importStar(require('./executors/validate-runtime-architecture/executor')))).default({}, context));
|
|
54
|
+
wiring = new NativeAction('wiring', 'workspace', async (context) => (await Promise.resolve().then(() => __importStar(require('./executors/validate-nx-wiring/executor')))).default({}, context));
|
|
55
|
+
design = new NativeAction('design', 'projects', async (context) => (await Promise.resolve().then(() => __importStar(require('./executors/di-graph-generate/executor')))).default({}, context));
|
|
56
|
+
architecture = new NativeAction('architecture', 'workspace', async (context) => (await Promise.resolve().then(() => __importStar(require('./executors/validate-architecture-unchanged/executor')))).default({}, context));
|
|
57
|
+
cycles = new NativeAction('cycles', 'workspace', async (context) => (await Promise.resolve().then(() => __importStar(require('./executors/validate-no-architecture-cycles/executor')))).default({}, context));
|
|
58
|
+
packageJson = new NativeAction('package-json', 'workspace', async (context) => (await Promise.resolve().then(() => __importStar(require('./executors/validate-packagejson/executor')))).default({}, context));
|
|
59
|
+
versions = new NativeAction('versions', 'workspace', async (context) => (await Promise.resolve().then(() => __importStar(require('./executors/validate-versions-locked/executor')))).default({}, context));
|
|
60
|
+
eslintSync = new NativeAction('eslint-sync', 'workspace', async (context) => (await Promise.resolve().then(() => __importStar(require('./executors/validate-eslint-sync/executor')))).default({}, context));
|
|
61
|
+
tsInSrc = new NativeAction('ts-in-src', 'workspace', async (context) => (await Promise.resolve().then(() => __importStar(require('./executors/validate-ts-in-src/executor')))).default({}, context));
|
|
62
|
+
graphPolicies = new NativeAction('graph-policies', 'workspace', async (context) => {
|
|
63
|
+
const graph = await Promise.resolve().then(() => __importStar(require('./executors/validate-architecture-unchanged/executor')));
|
|
64
|
+
await new graph.CurrentGraphBuilder().build(context.root);
|
|
65
|
+
return new rules_sdk_1.BuildPolicyResult(true);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
exports.NativeActions = NativeActions;
|
|
69
|
+
//# sourceMappingURL=native-actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-actions.js","sourceRoot":"","sources":["../../../../../packages/tooling/nx-webpieces-rules/src/native-actions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,oDAAyD;AAEzD,oGAAoG;AACpG,MAAa,YAAY;IAER;IACA;IACA;IAHb,YACa,IAAY,EACZ,KAA+B,EAC/B,OAAiE;QAFjE,SAAI,GAAJ,IAAI,CAAQ;QACZ,UAAK,GAAL,KAAK,CAA0B;QAC/B,YAAO,GAAP,OAAO,CAA0D;IAC3E,CAAC;CACP;AAND,oCAMC;AAED,wGAAwG;AACxG,MAAa,aAAa;IACb,UAAU,GAAG,IAAI,YAAY,CAClC,aAAa,EACb,UAAU,EACV,KAAK,EAAE,OAAwB,EAAE,EAAE,CAC/B,CAAC,wDAAa,qDAAqD,GAAC,CAAC,CAAC,OAAO,CACzE,EAAE,EACF,OAAO,CACV,CACR,CAAC;IACO,OAAO,GAAG,IAAI,YAAY,CAAC,SAAS,EAAE,WAAW,EAAE,KAAK,EAAE,OAAwB,EAAE,EAAE,CAC3F,CAAC,wDAAa,oDAAoD,GAAC,CAAC,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,CAC5F,CAAC;IACO,MAAM,GAAG,IAAI,YAAY,CAAC,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,OAAwB,EAAE,EAAE,CACzF,CAAC,wDAAa,yCAAyC,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,EAAE,OAAwB,EAAE,EAAE,CAC/B,CAAC,wDAAa,yCAAyC,GAAC,CAAC,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,CACrF,CAAC;IACO,aAAa,GAAG,IAAI,YAAY,CACrC,gBAAgB,EAChB,WAAW,EACX,KAAK,EAAE,OAAwB,EAAE,EAAE;QAC/B,MAAM,KAAK,GAAG,wDAAa,sDAAsD,GAAC,CAAC;QACnF,MAAM,IAAI,KAAK,CAAC,mBAAmB,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC1D,OAAO,IAAI,6BAAiB,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC,CACJ,CAAC;CACL;AAhED,sCAgEC","sourcesContent":["import type { ExecutorContext } from '@nx/devkit';\nimport { BuildPolicyResult } from '@webpieces/rules-sdk';\n\n/** Native owner actions are shared where one existing scan enforces several configured policies. */\nexport class NativeAction {\n constructor(\n readonly name: string,\n readonly scope: 'workspace' | 'projects',\n readonly execute: (context: ExecutorContext) => Promise<BuildPolicyResult>,\n ) {}\n}\n\n/** Metadata holds lazy imports only; importing the pack never imports an executor or the Nx runtime. */\nexport class NativeActions {\n readonly fileCycles = new NativeAction(\n 'file-cycles',\n 'projects',\n async (context: ExecutorContext) =>\n (await import('./executors/validate-no-file-import-cycles/executor')).default(\n {},\n context,\n ),\n );\n readonly runtime = new NativeAction('runtime', 'workspace', async (context: ExecutorContext) =>\n (await import('./executors/validate-runtime-architecture/executor')).default({}, context),\n );\n readonly wiring = new NativeAction('wiring', 'workspace', async (context: ExecutorContext) =>\n (await import('./executors/validate-nx-wiring/executor')).default({}, context),\n );\n readonly design = new NativeAction('design', 'projects', async (context: ExecutorContext) =>\n (await import('./executors/di-graph-generate/executor')).default({}, context),\n );\n readonly architecture = new NativeAction(\n 'architecture',\n 'workspace',\n async (context: ExecutorContext) =>\n (await import('./executors/validate-architecture-unchanged/executor')).default(\n {},\n context,\n ),\n );\n readonly cycles = new NativeAction('cycles', 'workspace', async (context: ExecutorContext) =>\n (await import('./executors/validate-no-architecture-cycles/executor')).default({}, context),\n );\n readonly packageJson = new NativeAction(\n 'package-json',\n 'workspace',\n async (context: ExecutorContext) =>\n (await import('./executors/validate-packagejson/executor')).default({}, context),\n );\n readonly versions = new NativeAction(\n 'versions',\n 'workspace',\n async (context: ExecutorContext) =>\n (await import('./executors/validate-versions-locked/executor')).default({}, context),\n );\n readonly eslintSync = new NativeAction(\n 'eslint-sync',\n 'workspace',\n async (context: ExecutorContext) =>\n (await import('./executors/validate-eslint-sync/executor')).default({}, context),\n );\n readonly tsInSrc = new NativeAction(\n 'ts-in-src',\n 'workspace',\n async (context: ExecutorContext) =>\n (await import('./executors/validate-ts-in-src/executor')).default({}, context),\n );\n readonly graphPolicies = new NativeAction(\n 'graph-policies',\n 'workspace',\n async (context: ExecutorContext) => {\n const graph = await import('./executors/validate-architecture-unchanged/executor');\n await new graph.CurrentGraphBuilder().build(context.root);\n return new BuildPolicyResult(true);\n },\n );\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { OwnedRuleDefinition } from '@webpieces/rules-sdk';
|
|
2
|
+
import { NativeAction } from './native-actions';
|
|
3
|
+
export declare class NxPolicy {
|
|
4
|
+
readonly definition: OwnedRuleDefinition;
|
|
5
|
+
readonly action: NativeAction;
|
|
6
|
+
constructor(definition: OwnedRuleDefinition, action: NativeAction);
|
|
7
|
+
}
|
|
8
|
+
export declare const NX_POLICIES: readonly NxPolicy[];
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NX_POLICIES = exports.NxPolicy = void 0;
|
|
4
|
+
const rule_help_1 = require("./rule-help");
|
|
5
|
+
const rule_settings_1 = require("./rule-settings");
|
|
6
|
+
const rules_sdk_1 = require("@webpieces/rules-sdk");
|
|
7
|
+
const rule_configs_1 = require("./configs/rule-configs");
|
|
8
|
+
const no_root_union_config_1 = require("./configs/no-root-union-config");
|
|
9
|
+
const api_doc_rules_config_1 = require("./configs/api-doc-rules-config");
|
|
10
|
+
const tag_truth_configs_1 = require("./configs/tag-truth-configs");
|
|
11
|
+
const native_actions_1 = require("./native-actions");
|
|
12
|
+
class NxPolicy {
|
|
13
|
+
definition;
|
|
14
|
+
action;
|
|
15
|
+
constructor(definition, action) {
|
|
16
|
+
this.definition = definition;
|
|
17
|
+
this.action = action;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.NxPolicy = NxPolicy;
|
|
21
|
+
const actions = new native_actions_1.NativeActions();
|
|
22
|
+
exports.NX_POLICIES = [
|
|
23
|
+
new NxPolicy(new rules_sdk_1.OwnedRuleDefinition('no-file-import-cycles', rule_configs_1.NoFileImportCyclesConfig.SCHEMA, rules_sdk_1.RULE_SCHEMA_API_VERSION, rule_settings_1.optionalTuning['no-file-import-cycles'], rule_settings_1.recommendedSeeds['no-file-import-cycles'], 'rules', rule_help_1.ruleHelp['no-file-import-cycles']), actions.fileCycles),
|
|
24
|
+
new NxPolicy(new rules_sdk_1.OwnedRuleDefinition('runtime-architecture', rule_configs_1.RuntimeArchitectureConfig.SCHEMA, rules_sdk_1.RULE_SCHEMA_API_VERSION, rule_settings_1.optionalTuning['runtime-architecture'], rule_settings_1.recommendedSeeds['runtime-architecture'], 'rules', rule_help_1.ruleHelp['runtime-architecture']), actions.runtime),
|
|
25
|
+
new NxPolicy(new rules_sdk_1.OwnedRuleDefinition('nx-wiring', rule_configs_1.NxWiringConfig.SCHEMA, rules_sdk_1.RULE_SCHEMA_API_VERSION, rule_settings_1.optionalTuning['nx-wiring'], rule_settings_1.recommendedSeeds['nx-wiring'], 'rules', rule_help_1.ruleHelp['nx-wiring']), actions.wiring),
|
|
26
|
+
new NxPolicy(new rules_sdk_1.OwnedRuleDefinition('di-graph', rule_configs_1.DiGraphConfig.SCHEMA, rules_sdk_1.RULE_SCHEMA_API_VERSION, rule_settings_1.optionalTuning['di-graph'], rule_settings_1.recommendedSeeds['di-graph'], 'rules', rule_help_1.ruleHelp['di-graph']), actions.design),
|
|
27
|
+
new NxPolicy(new rules_sdk_1.OwnedRuleDefinition('missing-design-annotation', rule_configs_1.MissingDesignAnnotationConfig.SCHEMA, rules_sdk_1.RULE_SCHEMA_API_VERSION, rule_settings_1.optionalTuning['missing-design-annotation'], rule_settings_1.recommendedSeeds['missing-design-annotation'], 'rules', rule_help_1.ruleHelp['missing-design-annotation']), actions.design),
|
|
28
|
+
new NxPolicy(new rules_sdk_1.OwnedRuleDefinition('validate-architecture-unchanged', rule_configs_1.ValidateArchitectureUnchangedConfig.SCHEMA, rules_sdk_1.RULE_SCHEMA_API_VERSION, rule_settings_1.optionalTuning['validate-architecture-unchanged'], rule_settings_1.recommendedSeeds['validate-architecture-unchanged'], 'rules', rule_help_1.ruleHelp['validate-architecture-unchanged']), actions.architecture),
|
|
29
|
+
new NxPolicy(new rules_sdk_1.OwnedRuleDefinition('validate-no-architecture-cycles', rule_configs_1.ValidateNoArchitectureCyclesConfig.SCHEMA, rules_sdk_1.RULE_SCHEMA_API_VERSION, rule_settings_1.optionalTuning['validate-no-architecture-cycles'], rule_settings_1.recommendedSeeds['validate-no-architecture-cycles'], 'rules', rule_help_1.ruleHelp['validate-no-architecture-cycles']), actions.cycles),
|
|
30
|
+
new NxPolicy(new rules_sdk_1.OwnedRuleDefinition('validate-packagejson', rule_configs_1.ValidatePackageJsonConfig.SCHEMA, rules_sdk_1.RULE_SCHEMA_API_VERSION, rule_settings_1.optionalTuning['validate-packagejson'], rule_settings_1.recommendedSeeds['validate-packagejson'], 'rules', rule_help_1.ruleHelp['validate-packagejson']), actions.packageJson),
|
|
31
|
+
new NxPolicy(new rules_sdk_1.OwnedRuleDefinition('validate-versions-locked', rule_configs_1.ValidateVersionsLockedConfig.SCHEMA, rules_sdk_1.RULE_SCHEMA_API_VERSION, rule_settings_1.optionalTuning['validate-versions-locked'], rule_settings_1.recommendedSeeds['validate-versions-locked'], 'rules', rule_help_1.ruleHelp['validate-versions-locked']), actions.versions),
|
|
32
|
+
new NxPolicy(new rules_sdk_1.OwnedRuleDefinition('validate-eslint-sync', rule_configs_1.ValidateEslintSyncConfig.SCHEMA, rules_sdk_1.RULE_SCHEMA_API_VERSION, rule_settings_1.optionalTuning['validate-eslint-sync'], rule_settings_1.recommendedSeeds['validate-eslint-sync'], 'rules', rule_help_1.ruleHelp['validate-eslint-sync']), actions.eslintSync),
|
|
33
|
+
new NxPolicy(new rules_sdk_1.OwnedRuleDefinition('no-root-union-api-type', no_root_union_config_1.NoRootUnionApiTypeConfig.SCHEMA, rules_sdk_1.RULE_SCHEMA_API_VERSION, rule_settings_1.optionalTuning['no-root-union-api-type'], rule_settings_1.recommendedSeeds['no-root-union-api-type'], 'rules', rule_help_1.ruleHelp['no-root-union-api-type']), actions.graphPolicies),
|
|
34
|
+
new NxPolicy(new rules_sdk_1.OwnedRuleDefinition('api-rules-for-openapi', api_doc_rules_config_1.ApiRulesForOpenApiConfig.SCHEMA, rules_sdk_1.RULE_SCHEMA_API_VERSION, rule_settings_1.optionalTuning['api-rules-for-openapi'], rule_settings_1.recommendedSeeds['api-rules-for-openapi'], 'rules', rule_help_1.ruleHelp['api-rules-for-openapi']), actions.graphPolicies),
|
|
35
|
+
new NxPolicy(new rules_sdk_1.OwnedRuleDefinition('api-rules-for-mcp', api_doc_rules_config_1.ApiRulesForMcpConfig.SCHEMA, rules_sdk_1.RULE_SCHEMA_API_VERSION, rule_settings_1.optionalTuning['api-rules-for-mcp'], rule_settings_1.recommendedSeeds['api-rules-for-mcp'], 'rules', rule_help_1.ruleHelp['api-rules-for-mcp']), actions.graphPolicies),
|
|
36
|
+
new NxPolicy(new rules_sdk_1.OwnedRuleDefinition('api-lib-dependencies', tag_truth_configs_1.ApiLibDependenciesConfig.SCHEMA, rules_sdk_1.RULE_SCHEMA_API_VERSION, rule_settings_1.optionalTuning['api-lib-dependencies'], rule_settings_1.recommendedSeeds['api-lib-dependencies'], 'rules', rule_help_1.ruleHelp['api-lib-dependencies']), actions.graphPolicies),
|
|
37
|
+
new NxPolicy(new rules_sdk_1.OwnedRuleDefinition('api-lib-path', tag_truth_configs_1.ApiLibPathConfig.SCHEMA, rules_sdk_1.RULE_SCHEMA_API_VERSION, rule_settings_1.optionalTuning['api-lib-path'], rule_settings_1.recommendedSeeds['api-lib-path'], 'rules', rule_help_1.ruleHelp['api-lib-path']), actions.graphPolicies),
|
|
38
|
+
new NxPolicy(new rules_sdk_1.OwnedRuleDefinition('framework-folder', tag_truth_configs_1.FrameworkFolderConfig.SCHEMA, rules_sdk_1.RULE_SCHEMA_API_VERSION, rule_settings_1.optionalTuning['framework-folder'], rule_settings_1.recommendedSeeds['framework-folder'], 'rules', rule_help_1.ruleHelp['framework-folder']), actions.graphPolicies),
|
|
39
|
+
];
|
|
40
|
+
//# sourceMappingURL=nx-policy-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nx-policy-registry.js","sourceRoot":"","sources":["../../../../../packages/tooling/nx-webpieces-rules/src/nx-policy-registry.ts"],"names":[],"mappings":";;;AAAA,2CAAuC;AACvC,mDAAmE;AACnE,oDAAoF;AACpF,yDAWgC;AAChC,yEAA0E;AAC1E,yEAAgG;AAChG,mEAIqC;AACrC,qDAA+D;AAE/D,MAAa,QAAQ;IAEJ;IACA;IAFb,YACa,UAA+B,EAC/B,MAAoB;QADpB,eAAU,GAAV,UAAU,CAAqB;QAC/B,WAAM,GAAN,MAAM,CAAc;IAC9B,CAAC;CACP;AALD,4BAKC;AAED,MAAM,OAAO,GAAG,IAAI,8BAAa,EAAE,CAAC;AACvB,QAAA,WAAW,GAAwB;IAC5C,IAAI,QAAQ,CACR,IAAI,+BAAmB,CACnB,uBAAuB,EACvB,uCAAwB,CAAC,MAAM,EAC/B,mCAAuB,EACvB,8BAAc,CAAC,uBAAuB,CAAC,EACvC,gCAAgB,CAAC,uBAAuB,CAAC,EACzC,OAAO,EACP,oBAAQ,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":["import { ruleHelp } from './rule-help';\nimport { optionalTuning, recommendedSeeds } from './rule-settings';\nimport { OwnedRuleDefinition, RULE_SCHEMA_API_VERSION } from '@webpieces/rules-sdk';\nimport {\n NoFileImportCyclesConfig,\n RuntimeArchitectureConfig,\n NxWiringConfig,\n DiGraphConfig,\n MissingDesignAnnotationConfig,\n ValidateArchitectureUnchangedConfig,\n ValidateNoArchitectureCyclesConfig,\n ValidatePackageJsonConfig,\n ValidateVersionsLockedConfig,\n ValidateEslintSyncConfig,\n} from './configs/rule-configs';\nimport { NoRootUnionApiTypeConfig } from './configs/no-root-union-config';\nimport { ApiRulesForOpenApiConfig, ApiRulesForMcpConfig } from './configs/api-doc-rules-config';\nimport {\n ApiLibDependenciesConfig,\n ApiLibPathConfig,\n FrameworkFolderConfig,\n} from './configs/tag-truth-configs';\nimport { NativeActions, NativeAction } from './native-actions';\n\nexport class NxPolicy {\n constructor(\n readonly definition: OwnedRuleDefinition,\n readonly action: NativeAction,\n ) {}\n}\n\nconst actions = new NativeActions();\nexport const NX_POLICIES: readonly NxPolicy[] = [\n new NxPolicy(\n new OwnedRuleDefinition(\n 'no-file-import-cycles',\n NoFileImportCyclesConfig.SCHEMA,\n RULE_SCHEMA_API_VERSION,\n optionalTuning['no-file-import-cycles'],\n recommendedSeeds['no-file-import-cycles'],\n 'rules',\n ruleHelp['no-file-import-cycles'],\n ),\n actions.fileCycles,\n ),\n new NxPolicy(\n new OwnedRuleDefinition(\n 'runtime-architecture',\n RuntimeArchitectureConfig.SCHEMA,\n RULE_SCHEMA_API_VERSION,\n optionalTuning['runtime-architecture'],\n recommendedSeeds['runtime-architecture'],\n 'rules',\n ruleHelp['runtime-architecture'],\n ),\n actions.runtime,\n ),\n new NxPolicy(\n new OwnedRuleDefinition(\n 'nx-wiring',\n NxWiringConfig.SCHEMA,\n RULE_SCHEMA_API_VERSION,\n optionalTuning['nx-wiring'],\n recommendedSeeds['nx-wiring'],\n 'rules',\n ruleHelp['nx-wiring'],\n ),\n actions.wiring,\n ),\n new NxPolicy(\n new OwnedRuleDefinition(\n 'di-graph',\n DiGraphConfig.SCHEMA,\n RULE_SCHEMA_API_VERSION,\n optionalTuning['di-graph'],\n recommendedSeeds['di-graph'],\n 'rules',\n ruleHelp['di-graph'],\n ),\n actions.design,\n ),\n new NxPolicy(\n new OwnedRuleDefinition(\n 'missing-design-annotation',\n MissingDesignAnnotationConfig.SCHEMA,\n RULE_SCHEMA_API_VERSION,\n optionalTuning['missing-design-annotation'],\n recommendedSeeds['missing-design-annotation'],\n 'rules',\n ruleHelp['missing-design-annotation'],\n ),\n actions.design,\n ),\n new NxPolicy(\n new OwnedRuleDefinition(\n 'validate-architecture-unchanged',\n ValidateArchitectureUnchangedConfig.SCHEMA,\n RULE_SCHEMA_API_VERSION,\n optionalTuning['validate-architecture-unchanged'],\n recommendedSeeds['validate-architecture-unchanged'],\n 'rules',\n ruleHelp['validate-architecture-unchanged'],\n ),\n actions.architecture,\n ),\n new NxPolicy(\n new OwnedRuleDefinition(\n 'validate-no-architecture-cycles',\n ValidateNoArchitectureCyclesConfig.SCHEMA,\n RULE_SCHEMA_API_VERSION,\n optionalTuning['validate-no-architecture-cycles'],\n recommendedSeeds['validate-no-architecture-cycles'],\n 'rules',\n ruleHelp['validate-no-architecture-cycles'],\n ),\n actions.cycles,\n ),\n new NxPolicy(\n new OwnedRuleDefinition(\n 'validate-packagejson',\n ValidatePackageJsonConfig.SCHEMA,\n RULE_SCHEMA_API_VERSION,\n optionalTuning['validate-packagejson'],\n recommendedSeeds['validate-packagejson'],\n 'rules',\n ruleHelp['validate-packagejson'],\n ),\n actions.packageJson,\n ),\n new NxPolicy(\n new OwnedRuleDefinition(\n 'validate-versions-locked',\n ValidateVersionsLockedConfig.SCHEMA,\n RULE_SCHEMA_API_VERSION,\n optionalTuning['validate-versions-locked'],\n recommendedSeeds['validate-versions-locked'],\n 'rules',\n ruleHelp['validate-versions-locked'],\n ),\n actions.versions,\n ),\n new NxPolicy(\n new OwnedRuleDefinition(\n 'validate-eslint-sync',\n ValidateEslintSyncConfig.SCHEMA,\n RULE_SCHEMA_API_VERSION,\n optionalTuning['validate-eslint-sync'],\n recommendedSeeds['validate-eslint-sync'],\n 'rules',\n ruleHelp['validate-eslint-sync'],\n ),\n actions.eslintSync,\n ),\n new NxPolicy(\n new OwnedRuleDefinition(\n 'no-root-union-api-type',\n NoRootUnionApiTypeConfig.SCHEMA,\n RULE_SCHEMA_API_VERSION,\n optionalTuning['no-root-union-api-type'],\n recommendedSeeds['no-root-union-api-type'],\n 'rules',\n ruleHelp['no-root-union-api-type'],\n ),\n actions.graphPolicies,\n ),\n new NxPolicy(\n new OwnedRuleDefinition(\n 'api-rules-for-openapi',\n ApiRulesForOpenApiConfig.SCHEMA,\n RULE_SCHEMA_API_VERSION,\n optionalTuning['api-rules-for-openapi'],\n recommendedSeeds['api-rules-for-openapi'],\n 'rules',\n ruleHelp['api-rules-for-openapi'],\n ),\n actions.graphPolicies,\n ),\n new NxPolicy(\n new OwnedRuleDefinition(\n 'api-rules-for-mcp',\n ApiRulesForMcpConfig.SCHEMA,\n RULE_SCHEMA_API_VERSION,\n optionalTuning['api-rules-for-mcp'],\n recommendedSeeds['api-rules-for-mcp'],\n 'rules',\n ruleHelp['api-rules-for-mcp'],\n ),\n actions.graphPolicies,\n ),\n new NxPolicy(\n new OwnedRuleDefinition(\n 'api-lib-dependencies',\n ApiLibDependenciesConfig.SCHEMA,\n RULE_SCHEMA_API_VERSION,\n optionalTuning['api-lib-dependencies'],\n recommendedSeeds['api-lib-dependencies'],\n 'rules',\n ruleHelp['api-lib-dependencies'],\n ),\n actions.graphPolicies,\n ),\n new NxPolicy(\n new OwnedRuleDefinition(\n 'api-lib-path',\n ApiLibPathConfig.SCHEMA,\n RULE_SCHEMA_API_VERSION,\n optionalTuning['api-lib-path'],\n recommendedSeeds['api-lib-path'],\n 'rules',\n ruleHelp['api-lib-path'],\n ),\n actions.graphPolicies,\n ),\n new NxPolicy(\n new OwnedRuleDefinition(\n 'framework-folder',\n FrameworkFolderConfig.SCHEMA,\n RULE_SCHEMA_API_VERSION,\n optionalTuning['framework-folder'],\n recommendedSeeds['framework-folder'],\n 'rules',\n ruleHelp['framework-folder'],\n ),\n actions.graphPolicies,\n ),\n];\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BuildPolicyResult } from '@webpieces/rules-sdk';
|
|
2
|
+
import { LoadedConfig } from '@webpieces/rules-config';
|
|
3
|
+
/** Native checks retain their targets; one generic target runs other declared build providers. */
|
|
4
|
+
export declare class PackBuildRunner {
|
|
5
|
+
run(root: string, loaded: LoadedConfig): Promise<BuildPolicyResult>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PackBuildRunner = void 0;
|
|
4
|
+
const rules_sdk_1 = require("@webpieces/rules-sdk");
|
|
5
|
+
const rules_config_1 = require("@webpieces/rules-config");
|
|
6
|
+
const toError_1 = require("./toError");
|
|
7
|
+
const rule_pack_1 = require("./rule-pack");
|
|
8
|
+
class BuildActivation extends rules_config_1.AbstractRule {
|
|
9
|
+
}
|
|
10
|
+
/** Native checks retain their targets; one generic target runs other declared build providers. */
|
|
11
|
+
class PackBuildRunner {
|
|
12
|
+
async run(root, loaded) {
|
|
13
|
+
const modules = new rules_config_1.RuleRuntimeModules(), loader = new rules_config_1.NodeRuleRuntimeModuleLoader(root);
|
|
14
|
+
let success = true;
|
|
15
|
+
const groups = modules
|
|
16
|
+
.groups(loaded.ruleRegistry, 'build')
|
|
17
|
+
.filter((group) => group.providerPack !== rule_pack_1.rulePackManifest.packageName);
|
|
18
|
+
for (const group of groups) {
|
|
19
|
+
const request = modules.request(root, loaded.rulesConfig, group);
|
|
20
|
+
const exports = modules.load(group, loaded.ruleRegistry.manifestModules, loader);
|
|
21
|
+
const checks = await modules.createBuildPolicies(exports, request);
|
|
22
|
+
for (const check of checks) {
|
|
23
|
+
const activation = new BuildActivation(request.configs[check.configKey], check.name, check.configKey);
|
|
24
|
+
if (!activation.shouldRun() || !check.shouldRun())
|
|
25
|
+
continue;
|
|
26
|
+
// eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- isolate checks and preserve human-facing policy failures
|
|
27
|
+
try {
|
|
28
|
+
const result = await check.run(root);
|
|
29
|
+
if (!result || result.success !== true)
|
|
30
|
+
success = false;
|
|
31
|
+
// webpieces-disable no-any-unknown -- external JSON or runtime exports are validated before policy execution
|
|
32
|
+
}
|
|
33
|
+
catch (err) {
|
|
34
|
+
const error = (0, toError_1.toError)(err);
|
|
35
|
+
console.error(error instanceof rules_config_1.RuleFailError
|
|
36
|
+
? (0, rules_config_1.renderRuleFailForHuman)(error)
|
|
37
|
+
: `Build policy ${check.name} failed: ${error.message}`);
|
|
38
|
+
success = false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return new rules_sdk_1.BuildPolicyResult(success);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.PackBuildRunner = PackBuildRunner;
|
|
46
|
+
//# sourceMappingURL=pack-build-runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pack-build-runner.js","sourceRoot":"","sources":["../../../../../packages/tooling/nx-webpieces-rules/src/pack-build-runner.ts"],"names":[],"mappings":";;;AAAA,oDAAuF;AACvF,0DAQiC;AACjC,uCAAoC;AACpC,2CAA+C;AAE/C,MAAM,eAAgB,SAAQ,2BAA4B;CAAG;AAE7D,kGAAkG;AAClG,MAAa,eAAe;IACxB,KAAK,CAAC,GAAG,CAAC,IAAY,EAAE,MAAoB;QACxC,MAAM,OAAO,GAAG,IAAI,iCAAkB,EAAE,EACpC,MAAM,GAAG,IAAI,0CAA2B,CAAC,IAAI,CAAC,CAAC;QACnD,IAAI,OAAO,GAAG,IAAI,CAAC;QACnB,MAAM,MAAM,GAAG,OAAO;aACjB,MAAM,CAAC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AC,gBAAgB,KAAK,CAAC,IAAI,YAAY,KAAK,CAAC,OAAO,EAAE,CAC9D,CAAC;oBACF,OAAO,GAAG,KAAK,CAAC;gBACpB,CAAC;YACL,CAAC;QACL,CAAC;QACD,OAAO,IAAI,6BAAiB,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;CACJ;AA5CD,0CA4CC","sourcesContent":["import { BaseRuleConfig, ConfigObject, BuildPolicyResult } from '@webpieces/rules-sdk';\nimport {\n AbstractRule,\n LoadedConfig,\n NodeRuleRuntimeModuleLoader,\n RuleRuntimeModules,\n RuntimeContributionGroup,\n renderRuleFailForHuman,\n RuleFailError,\n} from '@webpieces/rules-config';\nimport { toError } from './toError';\nimport { rulePackManifest } from './rule-pack';\n\nclass BuildActivation extends AbstractRule<BaseRuleConfig> {}\n\n/** Native checks retain their targets; one generic target runs other declared build providers. */\nexport class PackBuildRunner {\n async run(root: string, loaded: LoadedConfig): Promise<BuildPolicyResult> {\n const modules = new RuleRuntimeModules(),\n loader = new NodeRuleRuntimeModuleLoader(root);\n let success = true;\n const groups = modules\n .groups(loaded.ruleRegistry, 'build')\n .filter(\n (group: RuntimeContributionGroup) =>\n group.providerPack !== rulePackManifest.packageName,\n );\n for (const group of groups) {\n const request = modules.request(\n root,\n loaded.rulesConfig as Record<string, ConfigObject>,\n group,\n );\n const exports = modules.load(group, loaded.ruleRegistry.manifestModules, loader);\n const checks = await modules.createBuildPolicies(exports, request);\n for (const check of checks) {\n const activation = new BuildActivation(\n request.configs[check.configKey] as BaseRuleConfig,\n check.name,\n check.configKey,\n );\n if (!activation.shouldRun() || !check.shouldRun()) continue;\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- isolate checks and preserve human-facing policy failures\n try {\n const result = await check.run(root);\n if (!result || result.success !== true) success = false;\n // webpieces-disable no-any-unknown -- external JSON or runtime exports are validated before policy execution\n } catch (err: unknown) {\n const error = toError(err);\n console.error(\n error instanceof RuleFailError\n ? renderRuleFailForHuman(error)\n : `Build policy ${check.name} failed: ${error.message}`,\n );\n success = false;\n }\n }\n }\n return new BuildPolicyResult(success);\n }\n}\n"]}
|
package/src/plugin.js
CHANGED
|
@@ -177,7 +177,9 @@ function addPerProjectTargets(results, projectFiles, opts, context) {
|
|
|
177
177
|
processedRoots.add(projectRoot);
|
|
178
178
|
const architectureEnabled = opts.workspace.enabled === true &&
|
|
179
179
|
(0, fs_1.existsSync)((0, path_1.join)(context.workspaceRoot, 'architecture'));
|
|
180
|
-
const targets = buildPerProjectTargets(isProjectJson, projectRoot, opts, architectureEnabled, isProjectJson
|
|
180
|
+
const targets = buildPerProjectTargets(isProjectJson, projectRoot, opts, architectureEnabled, isProjectJson
|
|
181
|
+
? new generate_targets_1.RawProjectJsonReader().read(context.workspaceRoot, projectFile, projectRoot)
|
|
182
|
+
: undefined);
|
|
181
183
|
if (Object.keys(targets).length === 0)
|
|
182
184
|
continue;
|
|
183
185
|
const result = {
|
|
@@ -311,8 +313,8 @@ function createWorkspaceTargetsWithoutPrefix(opts) {
|
|
|
311
313
|
// ci aggregate so it does not change existing gate behavior — consumers point a required check at it.
|
|
312
314
|
targets['validate-checklist-docs'] = targetFactory.checklistDocs();
|
|
313
315
|
// Use combined validate-code instead of 3 separate targets
|
|
314
|
-
// Options come from
|
|
315
|
-
//
|
|
316
|
+
// Options come from declared owner files' direct policy-ID maps, resolved by
|
|
317
|
+
// @webpieces/rules-config from the root rulePacks declaration.
|
|
316
318
|
if (validations.validateNewMethods ||
|
|
317
319
|
validations.validateModifiedMethods ||
|
|
318
320
|
validations.validateModifiedFiles) {
|
|
@@ -383,42 +385,6 @@ function createValidateUnchangedTarget(graphPath) {
|
|
|
383
385
|
},
|
|
384
386
|
};
|
|
385
387
|
}
|
|
386
|
-
function createValidateNewMethodsTarget(maxLines, mode) {
|
|
387
|
-
return {
|
|
388
|
-
executor: '@webpieces/nx-webpieces-rules:validate-new-methods',
|
|
389
|
-
cache: false, // Don't cache - depends on git state
|
|
390
|
-
inputs: ['default'],
|
|
391
|
-
options: { max: maxLines, mode },
|
|
392
|
-
metadata: {
|
|
393
|
-
technologies: ['nx'],
|
|
394
|
-
description: `Validate new methods do not exceed ${maxLines} lines (only runs in affected mode)`,
|
|
395
|
-
},
|
|
396
|
-
};
|
|
397
|
-
}
|
|
398
|
-
function createValidateModifiedMethodsTarget(maxLines, mode) {
|
|
399
|
-
return {
|
|
400
|
-
executor: '@webpieces/nx-webpieces-rules:validate-modified-methods',
|
|
401
|
-
cache: false, // Don't cache - depends on git state
|
|
402
|
-
inputs: ['default'],
|
|
403
|
-
options: { max: maxLines, mode },
|
|
404
|
-
metadata: {
|
|
405
|
-
technologies: ['nx'],
|
|
406
|
-
description: `Validate new and modified methods do not exceed ${maxLines} lines (encourages gradual cleanup)`,
|
|
407
|
-
},
|
|
408
|
-
};
|
|
409
|
-
}
|
|
410
|
-
function createValidateModifiedFilesTarget(maxLines, mode) {
|
|
411
|
-
return {
|
|
412
|
-
executor: '@webpieces/nx-webpieces-rules:validate-modified-files',
|
|
413
|
-
cache: false, // Don't cache - depends on git state
|
|
414
|
-
inputs: ['default'],
|
|
415
|
-
options: { max: maxLines, mode },
|
|
416
|
-
metadata: {
|
|
417
|
-
technologies: ['nx'],
|
|
418
|
-
description: `Validate modified files do not exceed ${maxLines} lines (encourages keeping files small)`,
|
|
419
|
-
},
|
|
420
|
-
};
|
|
421
|
-
}
|
|
422
388
|
function createValidateCompleteTarget(validationTargets) {
|
|
423
389
|
return {
|
|
424
390
|
executor: 'nx:noop',
|
|
@@ -493,7 +459,7 @@ function createHelpTarget() {
|
|
|
493
459
|
*
|
|
494
460
|
* Uses the `validate-no-file-import-cycles` executor (which bundles madge as a
|
|
495
461
|
* dependency) rather than a runtime `npx madge` fetch. The executor reads
|
|
496
|
-
*
|
|
462
|
+
* the declared Nx owner file's direct policy-ID map to turn the gate on/off (`mode`) and
|
|
497
463
|
* time-boxed (`turnOffRuleUntilEpoch`) like every other webpieces rule.
|
|
498
464
|
*
|
|
499
465
|
* Note `projectRoot` is intentionally unused now — the executor derives the
|