@domainlang/language 0.10.0 → 0.12.0

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.
Files changed (87) hide show
  1. package/README.md +44 -102
  2. package/out/diagram/context-map-diagram-generator.d.ts +65 -0
  3. package/out/diagram/context-map-diagram-generator.js +356 -0
  4. package/out/diagram/context-map-diagram-generator.js.map +1 -0
  5. package/out/diagram/context-map-layout-configurator.d.ts +15 -0
  6. package/out/diagram/context-map-layout-configurator.js +39 -0
  7. package/out/diagram/context-map-layout-configurator.js.map +1 -0
  8. package/out/diagram/elk-layout-factory.d.ts +43 -0
  9. package/out/diagram/elk-layout-factory.js +64 -0
  10. package/out/diagram/elk-layout-factory.js.map +1 -0
  11. package/out/domain-lang-module.d.ts +9 -2
  12. package/out/domain-lang-module.js +13 -4
  13. package/out/domain-lang-module.js.map +1 -1
  14. package/out/index.d.ts +6 -0
  15. package/out/index.js +7 -0
  16. package/out/index.js.map +1 -1
  17. package/out/lsp/domain-lang-code-lens-provider.d.ts +8 -0
  18. package/out/lsp/domain-lang-code-lens-provider.js +48 -0
  19. package/out/lsp/domain-lang-code-lens-provider.js.map +1 -0
  20. package/out/lsp/domain-lang-completion.js +1 -1
  21. package/out/lsp/domain-lang-completion.js.map +1 -1
  22. package/out/lsp/domain-lang-document-symbol-provider.js +5 -5
  23. package/out/lsp/domain-lang-document-symbol-provider.js.map +1 -1
  24. package/out/lsp/domain-lang-index-manager.d.ts +149 -5
  25. package/out/lsp/domain-lang-index-manager.js +388 -52
  26. package/out/lsp/domain-lang-index-manager.js.map +1 -1
  27. package/out/lsp/domain-lang-refresh.d.ts +35 -0
  28. package/out/lsp/domain-lang-refresh.js +129 -0
  29. package/out/lsp/domain-lang-refresh.js.map +1 -0
  30. package/out/lsp/domain-lang-workspace-manager.d.ts +10 -0
  31. package/out/lsp/domain-lang-workspace-manager.js +35 -0
  32. package/out/lsp/domain-lang-workspace-manager.js.map +1 -1
  33. package/out/lsp/tool-handlers.js +63 -57
  34. package/out/lsp/tool-handlers.js.map +1 -1
  35. package/out/main.js +30 -190
  36. package/out/main.js.map +1 -1
  37. package/out/sdk/loader-node.js +1 -1
  38. package/out/sdk/loader-node.js.map +1 -1
  39. package/out/sdk/validator.js +17 -14
  40. package/out/sdk/validator.js.map +1 -1
  41. package/out/services/import-resolver.d.ts +67 -17
  42. package/out/services/import-resolver.js +146 -65
  43. package/out/services/import-resolver.js.map +1 -1
  44. package/out/services/lsp-logger.d.ts +42 -0
  45. package/out/services/lsp-logger.js +50 -0
  46. package/out/services/lsp-logger.js.map +1 -0
  47. package/out/services/lsp-runtime-settings.d.ts +20 -0
  48. package/out/services/lsp-runtime-settings.js +20 -0
  49. package/out/services/lsp-runtime-settings.js.map +1 -0
  50. package/out/services/performance-optimizer.d.ts +9 -9
  51. package/out/services/performance-optimizer.js +17 -41
  52. package/out/services/performance-optimizer.js.map +1 -1
  53. package/out/services/workspace-manager.d.ts +22 -1
  54. package/out/services/workspace-manager.js +57 -9
  55. package/out/services/workspace-manager.js.map +1 -1
  56. package/out/utils/import-utils.js +6 -6
  57. package/out/utils/import-utils.js.map +1 -1
  58. package/out/validation/constants.d.ts +6 -0
  59. package/out/validation/constants.js +7 -0
  60. package/out/validation/constants.js.map +1 -1
  61. package/out/validation/import.d.ts +13 -3
  62. package/out/validation/import.js +54 -10
  63. package/out/validation/import.js.map +1 -1
  64. package/package.json +5 -2
  65. package/src/diagram/context-map-diagram-generator.ts +451 -0
  66. package/src/diagram/context-map-layout-configurator.ts +43 -0
  67. package/src/diagram/elk-layout-factory.ts +83 -0
  68. package/src/domain-lang-module.ts +22 -5
  69. package/src/index.ts +8 -0
  70. package/src/lsp/domain-lang-code-lens-provider.ts +54 -0
  71. package/src/lsp/domain-lang-completion.ts +3 -3
  72. package/src/lsp/domain-lang-document-symbol-provider.ts +5 -5
  73. package/src/lsp/domain-lang-index-manager.ts +438 -56
  74. package/src/lsp/domain-lang-refresh.ts +205 -0
  75. package/src/lsp/domain-lang-workspace-manager.ts +45 -0
  76. package/src/lsp/tool-handlers.ts +61 -47
  77. package/src/main.ts +36 -244
  78. package/src/sdk/loader-node.ts +1 -1
  79. package/src/sdk/validator.ts +17 -13
  80. package/src/services/import-resolver.ts +196 -89
  81. package/src/services/lsp-logger.ts +89 -0
  82. package/src/services/lsp-runtime-settings.ts +34 -0
  83. package/src/services/performance-optimizer.ts +18 -57
  84. package/src/services/workspace-manager.ts +62 -10
  85. package/src/utils/import-utils.ts +6 -6
  86. package/src/validation/constants.ts +9 -0
  87. package/src/validation/import.ts +67 -12
package/README.md CHANGED
@@ -1,19 +1,11 @@
1
1
  # @domainlang/language
2
2
 
3
- [![npm version](https://img.shields.io/npm/v/@domainlang/language.svg)](https://www.npmjs.com/package/@domainlang/language)[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=DomainLang_DomainLang&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=DomainLang_DomainLang)[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=DomainLang_DomainLang&metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=DomainLang_DomainLang)
3
+ [![npm version](https://img.shields.io/npm/v/@domainlang/language.svg)](https://www.npmjs.com/package/@domainlang/language)
4
4
  [![License](https://img.shields.io/npm/l/@domainlang/language.svg)](https://github.com/DomainLang/DomainLang/blob/main/LICENSE)
5
5
 
6
- Core language library for [DomainLang](https://github.com/DomainLang/DomainLang) - a Domain-Driven Design modeling language built with [Langium](https://langium.org/).
6
+ Parse, validate, and query Domain-Driven Design models written in the `.dlang` language. This package is the foundation that the [CLI](https://www.npmjs.com/package/@domainlang/cli) and [VS Code extension](https://marketplace.visualstudio.com/items?itemName=DomainLang.vscode-domainlang) are built on — and you can build on it too.
7
7
 
8
- ## Features
9
-
10
- - 🔤 **Parser** - Full DomainLang grammar with error recovery
11
- - ✅ **Validation** - Semantic validation for DDD best practices
12
- - 🔗 **Linking** - Cross-reference resolution across files and packages
13
- - 🔍 **Model Query SDK** - Programmatic access to DDD models with fluent queries
14
- - 🌐 **Browser Support** - Works in Node.js and browser environments
15
-
16
- ## Installation
8
+ ## Install
17
9
 
18
10
  ```bash
19
11
  npm install @domainlang/language
@@ -21,8 +13,6 @@ npm install @domainlang/language
21
13
 
22
14
  ## Quick start
23
15
 
24
- ### Parse and query models
25
-
26
16
  ```typescript
27
17
  import { loadModelFromText } from '@domainlang/language/sdk';
28
18
 
@@ -30,133 +20,85 @@ const { query } = await loadModelFromText(`
30
20
  Domain Sales {
31
21
  vision: "Enable seamless commerce"
32
22
  }
33
-
23
+
24
+ Team SalesTeam
25
+ Classification Core
26
+
34
27
  bc OrderContext for Sales as Core by SalesTeam {
35
- description: "Handles order lifecycle"
28
+ description: "Handles the order lifecycle"
36
29
  }
37
30
  `);
38
31
 
39
- // Query bounded contexts
40
32
  const coreContexts = query.boundedContexts()
41
33
  .withClassification('Core')
42
34
  .toArray();
43
35
 
44
- console.log(coreContexts[0].name); // 'OrderContext'
36
+ console.log(coreContexts.map(ctx => ctx.name)); // ['OrderContext']
45
37
  ```
46
38
 
47
- ### Load from file (Node.js)
39
+ That's it five lines to parse a model and start querying. The SDK works in the browser, in Node.js, and inside Langium LSP integrations.
48
40
 
49
- ```typescript
50
- import { loadModel } from '@domainlang/language/sdk/loader-node';
41
+ ## What you can do with it
51
42
 
52
- const { model, query } = await loadModel('./my-model.dlang');
43
+ **Validate models programmatically.** Run the same validation the VS Code extension uses, from Node.js scripts or CI pipelines.
53
44
 
54
- // Access domains
55
- for (const domain of query.domains()) {
56
- console.log(`${domain.name}: ${domain.vision}`);
57
- }
58
- ```
45
+ **Query anything in the model.** The fluent query builder lets you filter bounded contexts by team, classification, or domain — with lazy evaluation and full type safety.
59
46
 
60
- ## API overview
47
+ **Build custom automation.** Generate architecture reports, enforce naming conventions, sync models to wikis, or feed model data into dashboards.
61
48
 
62
- ### Entry points
49
+ ## API at a glance
63
50
 
64
- | Function | Environment | Use Case |
65
- | -------- | ----------- | -------- |
66
- | `loadModelFromText(text)` | Browser & Node | Parse inline DSL text |
67
- | `loadModel(file)` | Node.js only | Load from file system |
68
- | `fromDocument(doc)` | LSP integration | Zero-copy from Langium document |
69
- | `fromModel(model)` | Advanced | Direct AST wrapping |
51
+ | Function | Runtime | Purpose |
52
+ | --- | --- | --- |
53
+ | `loadModelFromText(text)` | Browser + Node.js | Parse DomainLang text in memory |
54
+ | `loadModel(path, options?)` | Node.js | Load and parse `.dlang` files |
55
+ | `validateFile(path, options?)` | Node.js | Validate a single file |
56
+ | `validateWorkspace(dir)` | Node.js | Validate an entire workspace |
57
+ | `fromModel(model)` | Browser + Node.js | Wrap an existing AST with query methods |
58
+ | `fromDocument(document)` | Browser + Node.js | Zero-copy wrapping for Langium documents |
70
59
 
71
- ### Query builder
72
-
73
- The SDK provides fluent query builders with lazy evaluation:
60
+ ## Query examples
74
61
 
75
62
  ```typescript
76
- // Find all bounded contexts owned by a team
77
- const teamContexts = query.boundedContexts()
63
+ // Find all Core bounded contexts owned by a specific team
64
+ const contexts = query.boundedContexts()
78
65
  .withTeam('PaymentsTeam')
66
+ .withClassification('Core')
79
67
  .toArray();
80
68
 
81
- // Get context maps containing specific contexts
69
+ // Find context maps that include a specific bounded context
82
70
  const maps = query.contextMaps()
83
71
  .containing('OrderContext')
84
72
  .toArray();
85
73
  ```
86
74
 
87
- ### Direct property access
75
+ ## Node.js file loading and validation
88
76
 
89
77
  ```typescript
90
- // Direct AST properties
91
- const desc = boundedContext.description;
92
- const vision = domain.vision;
93
-
94
- // SDK-augmented properties (with precedence resolution)
95
- const classification = boundedContext.effectiveClassification; // Header 'as' wins over body 'classification:'
96
- const team = boundedContext.effectiveTeam; // Header 'by' wins over body 'team:'
97
- ```
98
-
99
- ## DomainLang syntax
100
-
101
- DomainLang models Domain-Driven Design concepts:
102
-
103
- ```dlang
104
- // Define domains with vision
105
- Domain Sales {
106
- vision: "Drive revenue through great customer experience"
107
- }
108
-
109
- // Bounded contexts with ownership
110
- bc OrderContext for Sales as Core by SalesTeam {
111
- description: "Order lifecycle management"
112
- }
78
+ import { loadModel, validateFile } from '@domainlang/language/sdk';
113
79
 
114
- bc PaymentContext for Sales as Supporting by PaymentsTeam
80
+ const { query } = await loadModel('./model.dlang', { workspaceDir: process.cwd() });
81
+ const result = await validateFile('./model.dlang', { workspaceDir: process.cwd() });
115
82
 
116
- // Context maps showing integrations
117
- ContextMap SalesIntegration {
118
- contains OrderContext, PaymentContext
119
-
120
- [OHS,PL] OrderContext -> [CF] PaymentContext
83
+ if (!result.valid) {
84
+ for (const err of result.errors) {
85
+ console.error(`${err.file}:${err.line}: ${err.message}`);
86
+ }
87
+ process.exit(1);
121
88
  }
122
89
  ```
123
90
 
124
- ## Package structure
125
-
126
- | Path | Purpose |
127
- | ---- | ------- |
128
- | `src/domain-lang.langium` | Grammar definition |
129
- | `src/generated/` | Auto-generated AST (do not edit) |
130
- | `src/validation/` | Semantic validation rules |
131
- | `src/lsp/` | LSP features (hover, completion, formatting) |
132
- | `src/sdk/` | Model Query SDK |
133
-
134
- ## Related packages
135
-
136
- - [@domainlang/cli](https://www.npmjs.com/package/@domainlang/cli) - Command-line interface
137
- - [DomainLang VS Code Extension](https://marketplace.visualstudio.com/items?itemName=DomainLang.vscode-domainlang) - IDE support
138
-
139
91
  ## Documentation
140
92
 
141
- - [Getting Started](https://domainlang.net/guide/getting-started)
142
- - [Language Reference](https://domainlang.net/reference/language)
143
- - [Quick Reference](https://domainlang.net/reference/quick-reference)
144
- - [SDK Documentation](https://github.com/DomainLang/DomainLang/blob/main/dsl/domain-lang/packages/language/src/sdk/README.md)
145
-
146
- ## Development
93
+ - [Getting started](https://domainlang.net/guide/getting-started)
94
+ - [SDK guide](https://domainlang.net/guide/sdk)
95
+ - [Language reference](https://domainlang.net/reference/language)
96
+ - [Quick reference card](https://domainlang.net/reference/quick-reference)
147
97
 
148
- From the workspace root (`dsl/domain-lang/`):
149
-
150
- ```bash
151
- # After editing the grammar
152
- npm run langium:generate
153
-
154
- # Build this package
155
- npm run build --workspace packages/language
98
+ ## Related packages
156
99
 
157
- # Run tests
158
- npm test --workspace packages/language
159
- ```
100
+ - [@domainlang/cli](https://www.npmjs.com/package/@domainlang/cli) — terminal validation, queries, and dependency management.
101
+ - [DomainLang for VS Code](https://marketplace.visualstudio.com/items?itemName=DomainLang.vscode-domainlang) — syntax highlighting, IntelliSense, and real-time validation.
160
102
 
161
103
  ## License
162
104
 
@@ -0,0 +1,65 @@
1
+ import type { SModelRoot } from 'sprotty-protocol';
2
+ import { LangiumDiagramGenerator, type GeneratorContext } from 'langium-sprotty';
3
+ /**
4
+ * Generates context map diagrams in the **DDD community notation** style.
5
+ *
6
+ * Bounded contexts are rendered as ellipses. Relationships are rendered as edges
7
+ * with U/D (upstream/downstream) annotations and integration pattern labels at
8
+ * each end, matching the notation used in Eric Evans' "Domain-Driven Design" and
9
+ * Vaughn Vernon's "Implementing Domain-Driven Design".
10
+ *
11
+ * Edge label convention:
12
+ * - Position 0.1 (near source): `U [OHS, PL]` or `D [ACL]`
13
+ * - Position 0.9 (near target): `D [CF]` or `U [OHS]`
14
+ * - Position 0.5 (center): relationship type (e.g., "Customer/Supplier")
15
+ */
16
+ export declare class DomainLangContextMapDiagramGenerator extends LangiumDiagramGenerator {
17
+ protected generateRoot(args: GeneratorContext): SModelRoot;
18
+ /**
19
+ * Creates an edge with DDD community notation labels.
20
+ *
21
+ * For `->`: left = Upstream (U), right = Downstream (D)
22
+ * For `<-`: left = Downstream (D), right = Upstream (U)
23
+ * For `<->`: Partnership (bidirectional)
24
+ * For `><`: Separate Ways
25
+ *
26
+ * U/D labels are rendered as DDD notation badges with optional
27
+ * pattern boxes (e.g., `U [OHS, PL]`).
28
+ */
29
+ private createRelationshipEdge;
30
+ /**
31
+ * Adds a U/D badge label at the source or target end of an edge.
32
+ *
33
+ * Patterns are normalised to their short abbreviations (e.g. `OpenHostService` →
34
+ * `OHS`) and `BBoM`/`BigBallOfMud` is excluded — BBoM is surfaced visually as a
35
+ * cloud node shape rather than a text annotation.
36
+ *
37
+ * Badge text format: `ROLE|PATTERNS` (e.g. `U|OHS, PL` or `D|ACL`).
38
+ * The webview `UDBadgeLabelView` renders this as a bordered box.
39
+ */
40
+ private addUDBadge;
41
+ /**
42
+ * Formats the relationship type for the center edge label.
43
+ *
44
+ * Maps DomainLang keywords to DDD community notation display names:
45
+ * CustomerSupplier → Customer/Supplier
46
+ * SharedKernel → Shared Kernel
47
+ * UpstreamDownstream → Upstream/Downstream
48
+ * Partnership → Partnership
49
+ *
50
+ * For `<->` without explicit type, defaults to "Partnership".
51
+ * For `><`, defaults to "Separate Ways".
52
+ */
53
+ private formatRelationshipType;
54
+ private displayRelationshipType;
55
+ private collectContextMapNodes;
56
+ private ensureNodeForContextMapItem;
57
+ private createNode;
58
+ private createNodeLabel;
59
+ private ensureNode;
60
+ private ensureUnresolvedNode;
61
+ private getNodeKey;
62
+ private getSelection;
63
+ private getStringOption;
64
+ private selectContextMap;
65
+ }
@@ -0,0 +1,356 @@
1
+ import { LangiumDiagramGenerator } from 'langium-sprotty';
2
+ import { fromDocument } from '../sdk/query.js';
3
+ /** Ellipse sizing for bounded context nodes — sized for long names like "CustomerManagementContext" */
4
+ const NODE_WIDTH = 280;
5
+ const NODE_HEIGHT = 100;
6
+ /**
7
+ * Maps long-form DomainLang integration pattern keywords to their standard
8
+ * DDD abbreviations for display in U/D badges.
9
+ */
10
+ const PATTERN_ABBREVIATIONS = {
11
+ OpenHostService: 'OHS',
12
+ PublishedLanguage: 'PL',
13
+ AntiCorruptionLayer: 'ACL',
14
+ Conformist: 'CF',
15
+ Partnership: 'P',
16
+ SharedKernel: 'SK',
17
+ BigBallOfMud: 'BBoM',
18
+ };
19
+ /**
20
+ * Returns the abbreviated form of an integration pattern keyword.
21
+ *
22
+ * Short forms (e.g. `OHS`, `ACL`) are returned unchanged. Long forms (e.g.
23
+ * `OpenHostService`, `AntiCorruptionLayer`) are mapped to their abbreviation.
24
+ */
25
+ function normalizePattern(pattern) {
26
+ return PATTERN_ABBREVIATIONS[pattern] ?? pattern;
27
+ }
28
+ /**
29
+ * Returns `true` when the pattern identifies a Big Ball of Mud participant.
30
+ *
31
+ * BBoM is surfaced as a cloud node shape on the bounded context itself, not as
32
+ * a text annotation in the edge badge, so it should be excluded from badge text.
33
+ */
34
+ function isBBoMPattern(pattern) {
35
+ return pattern === 'BBoM' || pattern === 'BigBallOfMud';
36
+ }
37
+ /**
38
+ * Generates context map diagrams in the **DDD community notation** style.
39
+ *
40
+ * Bounded contexts are rendered as ellipses. Relationships are rendered as edges
41
+ * with U/D (upstream/downstream) annotations and integration pattern labels at
42
+ * each end, matching the notation used in Eric Evans' "Domain-Driven Design" and
43
+ * Vaughn Vernon's "Implementing Domain-Driven Design".
44
+ *
45
+ * Edge label convention:
46
+ * - Position 0.1 (near source): `U [OHS, PL]` or `D [ACL]`
47
+ * - Position 0.9 (near target): `D [CF]` or `U [OHS]`
48
+ * - Position 0.5 (center): relationship type (e.g., "Customer/Supplier")
49
+ */
50
+ export class DomainLangContextMapDiagramGenerator extends LangiumDiagramGenerator {
51
+ generateRoot(args) {
52
+ const document = args.document;
53
+ const query = fromDocument(document);
54
+ const selection = this.getSelection(args);
55
+ const contextMaps = query.contextMaps().toArray();
56
+ const selectedMap = this.selectContextMap(contextMaps, query, selection);
57
+ if (!selectedMap) {
58
+ return {
59
+ type: 'graph',
60
+ id: args.idCache.uniqueId('context-map:empty'),
61
+ children: [],
62
+ };
63
+ }
64
+ // Fetch relationships first so the BBoM pre-pass can identify which BCs
65
+ // need the cloud node shape before any nodes are created.
66
+ const relationships = query.relationships()
67
+ .where((relationship) => relationship.source === 'ContextMap' && relationship.astNode.$container === selectedMap)
68
+ .toArray();
69
+ // BBoM pre-pass: collect the node keys of every bounded context that
70
+ // appears on a side annotated with the BigBallOfMud pattern. These get
71
+ // the `node:bbom` Sprotty type so the webview renders them as clouds.
72
+ const bboMNodeKeys = new Set();
73
+ for (const rel of relationships) {
74
+ if (rel.leftPatterns.some(isBBoMPattern)) {
75
+ bboMNodeKeys.add(this.getNodeKey(query, rel.left));
76
+ }
77
+ if (rel.rightPatterns.some(isBBoMPattern)) {
78
+ bboMNodeKeys.add(this.getNodeKey(query, rel.right));
79
+ }
80
+ }
81
+ const nodeMap = new Map();
82
+ this.collectContextMapNodes(selectedMap, query, nodeMap, bboMNodeKeys, args);
83
+ for (const relationship of relationships) {
84
+ this.ensureNode(nodeMap, query, relationship.left, bboMNodeKeys, args);
85
+ this.ensureNode(nodeMap, query, relationship.right, bboMNodeKeys, args);
86
+ }
87
+ const edges = relationships.flatMap((relationship) => {
88
+ const leftKey = this.getNodeKey(query, relationship.left);
89
+ const rightKey = this.getNodeKey(query, relationship.right);
90
+ const leftNode = nodeMap.get(leftKey);
91
+ const rightNode = nodeMap.get(rightKey);
92
+ if (!leftNode || !rightNode) {
93
+ return [];
94
+ }
95
+ return this.createRelationshipEdge({
96
+ leftNode,
97
+ rightNode,
98
+ arrow: relationship.arrow,
99
+ leftPatterns: relationship.leftPatterns,
100
+ rightPatterns: relationship.rightPatterns,
101
+ type: relationship.type,
102
+ astNode: relationship.astNode,
103
+ }, args);
104
+ });
105
+ return {
106
+ type: 'graph',
107
+ id: args.idCache.uniqueId(`context-map:${selectedMap.name}`, selectedMap),
108
+ children: [...nodeMap.values(), ...edges],
109
+ };
110
+ }
111
+ // ── Relationship edges (DDD community notation) ──
112
+ /**
113
+ * Creates an edge with DDD community notation labels.
114
+ *
115
+ * For `->`: left = Upstream (U), right = Downstream (D)
116
+ * For `<-`: left = Downstream (D), right = Upstream (U)
117
+ * For `<->`: Partnership (bidirectional)
118
+ * For `><`: Separate Ways
119
+ *
120
+ * U/D labels are rendered as DDD notation badges with optional
121
+ * pattern boxes (e.g., `U [OHS, PL]`).
122
+ */
123
+ createRelationshipEdge(params, args) {
124
+ const { leftNode, rightNode, arrow, leftPatterns, rightPatterns, type, astNode } = params;
125
+ // Determine source/target based on arrow direction
126
+ const sourceId = arrow === '<-' ? rightNode.id : leftNode.id;
127
+ const targetId = arrow === '<-' ? leftNode.id : rightNode.id;
128
+ const edgeId = args.idCache.uniqueId(`edge:${sourceId}:${targetId}`, astNode);
129
+ const children = [];
130
+ if (arrow === '<->') {
131
+ // Partnership / bidirectional — no U/D roles
132
+ this.addUDBadge(children, edgeId, 'source', leftPatterns, undefined, args);
133
+ this.addUDBadge(children, edgeId, 'target', rightPatterns, undefined, args);
134
+ }
135
+ else if (arrow === '><') {
136
+ // Separate Ways — no U/D, no patterns
137
+ }
138
+ else {
139
+ // Unidirectional: -> or <-
140
+ const sourcePatterns = arrow === '<-' ? rightPatterns : leftPatterns;
141
+ const targetPatterns = arrow === '<-' ? leftPatterns : rightPatterns;
142
+ this.addUDBadge(children, edgeId, 'source', sourcePatterns, 'U', args);
143
+ this.addUDBadge(children, edgeId, 'target', targetPatterns, 'D', args);
144
+ }
145
+ // Center label: relationship type
146
+ const centerLabel = this.formatRelationshipType(type, arrow);
147
+ if (centerLabel) {
148
+ children.push({
149
+ type: 'label:edge',
150
+ id: args.idCache.uniqueId(`${edgeId}:type`),
151
+ text: centerLabel,
152
+ edgePlacement: {
153
+ side: 'on',
154
+ position: 0.5,
155
+ rotate: false,
156
+ offset: 10,
157
+ },
158
+ });
159
+ }
160
+ let edgeCssClasses;
161
+ if (arrow === '><') {
162
+ edgeCssClasses = ['separate-ways'];
163
+ }
164
+ else if (arrow === '<->') {
165
+ edgeCssClasses = ['partnership'];
166
+ }
167
+ const edge = {
168
+ type: 'edge',
169
+ id: edgeId,
170
+ sourceId,
171
+ targetId,
172
+ cssClasses: edgeCssClasses,
173
+ children: children.length > 0 ? children : undefined,
174
+ };
175
+ this.traceProvider.trace(edge, astNode);
176
+ return [edge];
177
+ }
178
+ /**
179
+ * Adds a U/D badge label at the source or target end of an edge.
180
+ *
181
+ * Patterns are normalised to their short abbreviations (e.g. `OpenHostService` →
182
+ * `OHS`) and `BBoM`/`BigBallOfMud` is excluded — BBoM is surfaced visually as a
183
+ * cloud node shape rather than a text annotation.
184
+ *
185
+ * Badge text format: `ROLE|PATTERNS` (e.g. `U|OHS, PL` or `D|ACL`).
186
+ * The webview `UDBadgeLabelView` renders this as a bordered box.
187
+ */
188
+ addUDBadge(children, edgeId, placement, patterns, role, args) {
189
+ // Normalise pattern names and strip BBoM (shown on node, not in badge)
190
+ const badgePatterns = patterns
191
+ .filter((p) => !isBBoMPattern(p))
192
+ .map(normalizePattern);
193
+ if (!role && badgePatterns.length === 0) {
194
+ return;
195
+ }
196
+ // Encode as ROLE|PATTERNS for UDBadgeLabelView parsing
197
+ const rolePart = role ?? '';
198
+ const patternPart = badgePatterns.length > 0 ? badgePatterns.join(', ') : '';
199
+ const badgeText = `${rolePart}|${patternPart}`;
200
+ children.push({
201
+ type: 'label:ud-badge',
202
+ id: args.idCache.uniqueId(`${edgeId}:${placement}`),
203
+ text: badgeText,
204
+ edgePlacement: {
205
+ side: 'on',
206
+ position: placement === 'source' ? 0.1 : 0.9,
207
+ rotate: false,
208
+ offset: 0,
209
+ },
210
+ });
211
+ }
212
+ /**
213
+ * Formats the relationship type for the center edge label.
214
+ *
215
+ * Maps DomainLang keywords to DDD community notation display names:
216
+ * CustomerSupplier → Customer/Supplier
217
+ * SharedKernel → Shared Kernel
218
+ * UpstreamDownstream → Upstream/Downstream
219
+ * Partnership → Partnership
220
+ *
221
+ * For `<->` without explicit type, defaults to "Partnership".
222
+ * For `><`, defaults to "Separate Ways".
223
+ */
224
+ formatRelationshipType(type, arrow) {
225
+ if (type) {
226
+ return this.displayRelationshipType(type);
227
+ }
228
+ if (arrow === '<->') {
229
+ return 'Partnership';
230
+ }
231
+ if (arrow === '><') {
232
+ return 'Separate Ways';
233
+ }
234
+ return undefined;
235
+ }
236
+ displayRelationshipType(type) {
237
+ switch (type) {
238
+ case 'CustomerSupplier': return 'Customer/Supplier';
239
+ case 'SharedKernel': return 'Shared Kernel';
240
+ case 'UpstreamDownstream': return 'Upstream/Downstream';
241
+ default: return type;
242
+ }
243
+ }
244
+ // ── Node generation ──
245
+ collectContextMapNodes(selectedMap, query, nodeMap, bboMNodeKeys, args) {
246
+ for (const boundedContextRef of selectedMap.boundedContexts) {
247
+ for (const item of boundedContextRef.items) {
248
+ this.ensureNodeForContextMapItem(item, query, nodeMap, bboMNodeKeys, args);
249
+ }
250
+ if (boundedContextRef.items.length === 0 && boundedContextRef.$refText) {
251
+ this.ensureUnresolvedNode(nodeMap, boundedContextRef.$refText, args);
252
+ }
253
+ }
254
+ }
255
+ ensureNodeForContextMapItem(item, query, nodeMap, bboMNodeKeys, args) {
256
+ const boundedContext = item.ref;
257
+ if (!boundedContext) {
258
+ if (item.$refText) {
259
+ this.ensureUnresolvedNode(nodeMap, item.$refText, args);
260
+ }
261
+ return;
262
+ }
263
+ const nodeKey = this.getNodeKey(query, boundedContext);
264
+ if (nodeMap.has(nodeKey)) {
265
+ return;
266
+ }
267
+ const nodeId = args.idCache.uniqueId(`node:${nodeKey}`, boundedContext);
268
+ const node = this.createNode(nodeId, boundedContext.name, bboMNodeKeys.has(nodeKey));
269
+ this.traceProvider.trace(node, boundedContext);
270
+ nodeMap.set(nodeKey, node);
271
+ }
272
+ createNode(id, label, isBBoM = false) {
273
+ return {
274
+ type: isBBoM ? 'node:bbom' : 'node',
275
+ id,
276
+ position: { x: 0, y: 0 },
277
+ size: {
278
+ width: NODE_WIDTH,
279
+ height: NODE_HEIGHT,
280
+ },
281
+ layout: 'vbox',
282
+ layoutOptions: {
283
+ hAlign: 'center',
284
+ vAlign: 'center',
285
+ resizeContainer: false,
286
+ paddingTop: 10,
287
+ paddingBottom: 10,
288
+ paddingLeft: 20,
289
+ paddingRight: 20,
290
+ },
291
+ children: [this.createNodeLabel(id, label)],
292
+ };
293
+ }
294
+ createNodeLabel(nodeId, label) {
295
+ return {
296
+ type: 'label',
297
+ id: `${nodeId}:label`,
298
+ text: label,
299
+ };
300
+ }
301
+ ensureNode(nodeMap, query, boundedContext, bboMNodeKeys, args) {
302
+ const nodeKey = this.getNodeKey(query, boundedContext);
303
+ if (nodeMap.has(nodeKey)) {
304
+ return;
305
+ }
306
+ const nodeId = args.idCache.uniqueId(`node:${nodeKey}`, boundedContext);
307
+ const node = this.createNode(nodeId, boundedContext.name, bboMNodeKeys.has(nodeKey));
308
+ this.traceProvider.trace(node, boundedContext);
309
+ nodeMap.set(nodeKey, node);
310
+ }
311
+ ensureUnresolvedNode(nodeMap, label, args) {
312
+ const key = `unresolved:${label}`;
313
+ if (nodeMap.has(key)) {
314
+ return;
315
+ }
316
+ const nodeId = args.idCache.uniqueId(`node:${key}`);
317
+ nodeMap.set(key, this.createNode(nodeId, label));
318
+ }
319
+ getNodeKey(query, boundedContext) {
320
+ const fqn = query.fqn(boundedContext);
321
+ return fqn ?? boundedContext.name;
322
+ }
323
+ // ── Selection helpers ──
324
+ getSelection(args) {
325
+ const options = args.options;
326
+ if (typeof options !== 'object' || options === null) {
327
+ return {};
328
+ }
329
+ const selectedContextMapFqn = this.getStringOption(options, 'selectedContextMapFqn');
330
+ const selectedContextMapName = this.getStringOption(options, 'selectedContextMapName');
331
+ return {
332
+ selectedContextMapFqn,
333
+ selectedContextMapName,
334
+ };
335
+ }
336
+ getStringOption(options, key) {
337
+ const value = Reflect.get(options, key);
338
+ return typeof value === 'string' && value.trim().length > 0 ? value.trim() : undefined;
339
+ }
340
+ selectContextMap(contextMaps, query, selection) {
341
+ if (selection.selectedContextMapFqn) {
342
+ const byFqn = contextMaps.find((contextMap) => query.fqn(contextMap) === selection.selectedContextMapFqn);
343
+ if (byFqn) {
344
+ return byFqn;
345
+ }
346
+ }
347
+ if (selection.selectedContextMapName) {
348
+ const byName = contextMaps.find((contextMap) => contextMap.name === selection.selectedContextMapName);
349
+ if (byName) {
350
+ return byName;
351
+ }
352
+ }
353
+ return contextMaps[0];
354
+ }
355
+ }
356
+ //# sourceMappingURL=context-map-diagram-generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-map-diagram-generator.js","sourceRoot":"","sources":["../../src/diagram/context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OAAO,WAAW,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC;CACJ"}
@@ -0,0 +1,15 @@
1
+ import type { LayoutOptions } from 'elkjs/lib/elk-api.js';
2
+ import { DefaultLayoutConfigurator } from 'sprotty-elk/lib/elk-layout.js';
3
+ import type { SGraph, SNode, SModelIndex, SEdge } from 'sprotty-protocol';
4
+ /**
5
+ * ELK layout configurator for DomainLang context map diagrams.
6
+ *
7
+ * Uses the `layered` algorithm with **DOWN** direction (top-to-bottom) so
8
+ * upstream contexts appear above downstream contexts, matching the conventional
9
+ * DDD Context Map layout direction.
10
+ */
11
+ export declare class ContextMapLayoutConfigurator extends DefaultLayoutConfigurator {
12
+ protected graphOptions(_graph: SGraph, _index: SModelIndex): LayoutOptions;
13
+ protected nodeOptions(_node: SNode, _index: SModelIndex): LayoutOptions;
14
+ protected edgeOptions(_edge: SEdge, _index: SModelIndex): LayoutOptions;
15
+ }