@domainlang/language 0.1.81

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 (188) hide show
  1. package/README.md +32 -0
  2. package/out/ast-augmentation.d.ts +6 -0
  3. package/out/ast-augmentation.js +2 -0
  4. package/out/ast-augmentation.js.map +1 -0
  5. package/out/domain-lang-module.d.ts +55 -0
  6. package/out/domain-lang-module.js +59 -0
  7. package/out/domain-lang-module.js.map +1 -0
  8. package/out/generated/ast.d.ts +770 -0
  9. package/out/generated/ast.js +565 -0
  10. package/out/generated/ast.js.map +1 -0
  11. package/out/generated/grammar.d.ts +6 -0
  12. package/out/generated/grammar.js +2502 -0
  13. package/out/generated/grammar.js.map +1 -0
  14. package/out/generated/module.d.ts +13 -0
  15. package/out/generated/module.js +21 -0
  16. package/out/generated/module.js.map +1 -0
  17. package/out/index.d.ts +13 -0
  18. package/out/index.js +17 -0
  19. package/out/index.js.map +1 -0
  20. package/out/lsp/domain-lang-completion.d.ts +37 -0
  21. package/out/lsp/domain-lang-completion.js +452 -0
  22. package/out/lsp/domain-lang-completion.js.map +1 -0
  23. package/out/lsp/domain-lang-formatter.d.ts +15 -0
  24. package/out/lsp/domain-lang-formatter.js +43 -0
  25. package/out/lsp/domain-lang-formatter.js.map +1 -0
  26. package/out/lsp/domain-lang-naming.d.ts +34 -0
  27. package/out/lsp/domain-lang-naming.js +49 -0
  28. package/out/lsp/domain-lang-naming.js.map +1 -0
  29. package/out/lsp/domain-lang-scope.d.ts +59 -0
  30. package/out/lsp/domain-lang-scope.js +102 -0
  31. package/out/lsp/domain-lang-scope.js.map +1 -0
  32. package/out/lsp/hover/ddd-pattern-explanations.d.ts +50 -0
  33. package/out/lsp/hover/ddd-pattern-explanations.js +196 -0
  34. package/out/lsp/hover/ddd-pattern-explanations.js.map +1 -0
  35. package/out/lsp/hover/domain-lang-hover.d.ts +19 -0
  36. package/out/lsp/hover/domain-lang-hover.js +306 -0
  37. package/out/lsp/hover/domain-lang-hover.js.map +1 -0
  38. package/out/lsp/hover/domain-lang-keywords.d.ts +13 -0
  39. package/out/lsp/hover/domain-lang-keywords.js +47 -0
  40. package/out/lsp/hover/domain-lang-keywords.js.map +1 -0
  41. package/out/main-browser.d.ts +1 -0
  42. package/out/main-browser.js +11 -0
  43. package/out/main-browser.js.map +1 -0
  44. package/out/main.d.ts +1 -0
  45. package/out/main.js +74 -0
  46. package/out/main.js.map +1 -0
  47. package/out/sdk/ast-augmentation.d.ts +136 -0
  48. package/out/sdk/ast-augmentation.js +62 -0
  49. package/out/sdk/ast-augmentation.js.map +1 -0
  50. package/out/sdk/index.d.ts +94 -0
  51. package/out/sdk/index.js +97 -0
  52. package/out/sdk/index.js.map +1 -0
  53. package/out/sdk/indexes.d.ts +16 -0
  54. package/out/sdk/indexes.js +97 -0
  55. package/out/sdk/indexes.js.map +1 -0
  56. package/out/sdk/loader-node.d.ts +47 -0
  57. package/out/sdk/loader-node.js +104 -0
  58. package/out/sdk/loader-node.js.map +1 -0
  59. package/out/sdk/loader.d.ts +49 -0
  60. package/out/sdk/loader.js +85 -0
  61. package/out/sdk/loader.js.map +1 -0
  62. package/out/sdk/patterns.d.ts +93 -0
  63. package/out/sdk/patterns.js +123 -0
  64. package/out/sdk/patterns.js.map +1 -0
  65. package/out/sdk/query.d.ts +90 -0
  66. package/out/sdk/query.js +679 -0
  67. package/out/sdk/query.js.map +1 -0
  68. package/out/sdk/resolution.d.ts +52 -0
  69. package/out/sdk/resolution.js +68 -0
  70. package/out/sdk/resolution.js.map +1 -0
  71. package/out/sdk/types.d.ts +301 -0
  72. package/out/sdk/types.js +8 -0
  73. package/out/sdk/types.js.map +1 -0
  74. package/out/services/dependency-analyzer.d.ts +94 -0
  75. package/out/services/dependency-analyzer.js +279 -0
  76. package/out/services/dependency-analyzer.js.map +1 -0
  77. package/out/services/dependency-resolver.d.ts +123 -0
  78. package/out/services/dependency-resolver.js +252 -0
  79. package/out/services/dependency-resolver.js.map +1 -0
  80. package/out/services/git-url-resolver.browser.d.ts +18 -0
  81. package/out/services/git-url-resolver.browser.js +15 -0
  82. package/out/services/git-url-resolver.browser.js.map +1 -0
  83. package/out/services/git-url-resolver.d.ts +192 -0
  84. package/out/services/git-url-resolver.js +382 -0
  85. package/out/services/git-url-resolver.js.map +1 -0
  86. package/out/services/governance-validator.d.ts +80 -0
  87. package/out/services/governance-validator.js +159 -0
  88. package/out/services/governance-validator.js.map +1 -0
  89. package/out/services/import-resolver.d.ts +18 -0
  90. package/out/services/import-resolver.js +22 -0
  91. package/out/services/import-resolver.js.map +1 -0
  92. package/out/services/performance-optimizer.d.ts +60 -0
  93. package/out/services/performance-optimizer.js +140 -0
  94. package/out/services/performance-optimizer.js.map +1 -0
  95. package/out/services/relationship-inference.d.ts +11 -0
  96. package/out/services/relationship-inference.js +98 -0
  97. package/out/services/relationship-inference.js.map +1 -0
  98. package/out/services/workspace-manager.d.ts +76 -0
  99. package/out/services/workspace-manager.js +323 -0
  100. package/out/services/workspace-manager.js.map +1 -0
  101. package/out/syntaxes/domain-lang.monarch.d.ts +76 -0
  102. package/out/syntaxes/domain-lang.monarch.js +29 -0
  103. package/out/syntaxes/domain-lang.monarch.js.map +1 -0
  104. package/out/utils/import-utils.d.ts +57 -0
  105. package/out/utils/import-utils.js +228 -0
  106. package/out/utils/import-utils.js.map +1 -0
  107. package/out/validation/bounded-context.d.ts +11 -0
  108. package/out/validation/bounded-context.js +79 -0
  109. package/out/validation/bounded-context.js.map +1 -0
  110. package/out/validation/classification.d.ts +3 -0
  111. package/out/validation/classification.js +3 -0
  112. package/out/validation/classification.js.map +1 -0
  113. package/out/validation/constants.d.ts +77 -0
  114. package/out/validation/constants.js +96 -0
  115. package/out/validation/constants.js.map +1 -0
  116. package/out/validation/domain-lang-validator.d.ts +2 -0
  117. package/out/validation/domain-lang-validator.js +27 -0
  118. package/out/validation/domain-lang-validator.js.map +1 -0
  119. package/out/validation/domain.d.ts +11 -0
  120. package/out/validation/domain.js +18 -0
  121. package/out/validation/domain.js.map +1 -0
  122. package/out/validation/import.d.ts +44 -0
  123. package/out/validation/import.js +135 -0
  124. package/out/validation/import.js.map +1 -0
  125. package/out/validation/maps.d.ts +21 -0
  126. package/out/validation/maps.js +56 -0
  127. package/out/validation/maps.js.map +1 -0
  128. package/out/validation/metadata.d.ts +7 -0
  129. package/out/validation/metadata.js +12 -0
  130. package/out/validation/metadata.js.map +1 -0
  131. package/out/validation/model.d.ts +12 -0
  132. package/out/validation/model.js +29 -0
  133. package/out/validation/model.js.map +1 -0
  134. package/out/validation/relationships.d.ts +12 -0
  135. package/out/validation/relationships.js +94 -0
  136. package/out/validation/relationships.js.map +1 -0
  137. package/out/validation/shared.d.ts +6 -0
  138. package/out/validation/shared.js +12 -0
  139. package/out/validation/shared.js.map +1 -0
  140. package/package.json +97 -0
  141. package/src/ast-augmentation.ts +5 -0
  142. package/src/domain-lang-module.ts +100 -0
  143. package/src/domain-lang.langium +356 -0
  144. package/src/generated/ast.ts +999 -0
  145. package/src/generated/grammar.ts +2504 -0
  146. package/src/generated/module.ts +25 -0
  147. package/src/index.ts +17 -0
  148. package/src/lsp/domain-lang-completion.ts +514 -0
  149. package/src/lsp/domain-lang-formatter.ts +51 -0
  150. package/src/lsp/domain-lang-naming.ts +56 -0
  151. package/src/lsp/domain-lang-scope.ts +137 -0
  152. package/src/lsp/hover/ddd-pattern-explanations.ts +237 -0
  153. package/src/lsp/hover/domain-lang-hover.ts +340 -0
  154. package/src/lsp/hover/domain-lang-keywords.ts +50 -0
  155. package/src/main-browser.ts +15 -0
  156. package/src/main.ts +85 -0
  157. package/src/sdk/README.md +297 -0
  158. package/src/sdk/ast-augmentation.ts +157 -0
  159. package/src/sdk/index.ts +128 -0
  160. package/src/sdk/indexes.ts +155 -0
  161. package/src/sdk/loader-node.ts +126 -0
  162. package/src/sdk/loader.ts +99 -0
  163. package/src/sdk/patterns.ts +147 -0
  164. package/src/sdk/query.ts +802 -0
  165. package/src/sdk/resolution.ts +78 -0
  166. package/src/sdk/types.ts +346 -0
  167. package/src/services/dependency-analyzer.ts +381 -0
  168. package/src/services/dependency-resolver.ts +334 -0
  169. package/src/services/git-url-resolver.browser.ts +31 -0
  170. package/src/services/git-url-resolver.ts +524 -0
  171. package/src/services/governance-validator.ts +219 -0
  172. package/src/services/import-resolver.ts +30 -0
  173. package/src/services/performance-optimizer.ts +170 -0
  174. package/src/services/relationship-inference.ts +121 -0
  175. package/src/services/workspace-manager.ts +416 -0
  176. package/src/syntaxes/domain-lang.monarch.ts +29 -0
  177. package/src/utils/import-utils.ts +274 -0
  178. package/src/validation/bounded-context.ts +99 -0
  179. package/src/validation/classification.ts +5 -0
  180. package/src/validation/constants.ts +124 -0
  181. package/src/validation/domain-lang-validator.ts +33 -0
  182. package/src/validation/domain.ts +24 -0
  183. package/src/validation/import.ts +171 -0
  184. package/src/validation/maps.ts +72 -0
  185. package/src/validation/metadata.ts +14 -0
  186. package/src/validation/model.ts +37 -0
  187. package/src/validation/relationships.ts +154 -0
  188. package/src/validation/shared.ts +14 -0
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Property resolution logic for SDK-augmented properties.
3
+ *
4
+ * This module provides resolution functions ONLY for properties that require
5
+ * precedence logic or transformation. Direct properties (description, vision,
6
+ * businessModel, evolution, archetype) should be accessed directly on the AST node.
7
+ *
8
+ * **Functions provided:**
9
+ * - `effectiveClassification` - Array precedence: inline `as` → body `classification:`
10
+ * - `effectiveTeam` - Array precedence: inline `by` → body `team:`
11
+ * - `metadataAsMap` - Array to Map conversion
12
+ *
13
+ * **Direct access (no resolution needed):**
14
+ * - `bc.description` - Direct string property
15
+ * - `bc.businessModel?.ref` - Direct reference
16
+ * - `bc.evolution?.ref` - Direct reference
17
+ * - `bc.archetype?.ref` - Direct reference
18
+ * - `domain.description` - Direct string property
19
+ * - `domain.vision` - Direct string property
20
+ * - `domain.type?.ref` - Direct reference
21
+ */
22
+
23
+ import type {
24
+ BoundedContext,
25
+ Classification,
26
+ Team,
27
+ } from '../generated/ast.js';
28
+
29
+ /**
30
+ * Returns the effective classification for a BoundedContext.
31
+ *
32
+ * Precedence:
33
+ * 1. Header inline (`as` keyword) - highest priority
34
+ * 2. Block property (`classification:`)
35
+ *
36
+ * @param bc - BoundedContext AST node
37
+ * @returns Classification reference or undefined
38
+ */
39
+ export function effectiveClassification(bc: BoundedContext): Classification | undefined {
40
+ // Return the first resolved classification (inline takes precedence due to grammar order)
41
+ return bc.classification?.[0]?.ref;
42
+ }
43
+
44
+ /**
45
+ * Returns the effective team for a BoundedContext.
46
+ *
47
+ * Precedence:
48
+ * 1. Header inline (`by` keyword) - highest priority
49
+ * 2. Block property (`team:`)
50
+ *
51
+ * @param bc - BoundedContext AST node
52
+ * @returns Team reference or undefined
53
+ */
54
+ export function effectiveTeam(bc: BoundedContext): Team | undefined {
55
+ // Return the first resolved team (inline takes precedence due to grammar order)
56
+ return bc.team?.[0]?.ref;
57
+ }
58
+
59
+ /**
60
+ * Returns metadata for a BoundedContext as a Map.
61
+ * Converts the metadata array to a key-value map.
62
+ *
63
+ * @param bc - BoundedContext AST node
64
+ * @returns ReadonlyMap of metadata entries
65
+ */
66
+ export function metadataAsMap(bc: BoundedContext): ReadonlyMap<string, string> {
67
+ const map = new Map<string, string>();
68
+
69
+ for (const entry of bc.metadata ?? []) {
70
+ const key = entry.key?.ref?.name;
71
+ const value = entry.value;
72
+ if (key && value) {
73
+ map.set(key, value);
74
+ }
75
+ }
76
+
77
+ return map;
78
+ }
@@ -0,0 +1,346 @@
1
+ /**
2
+ * Type definitions for the Model Query SDK.
3
+ * Provides interfaces for fluent query operations on DomainLang models.
4
+ */
5
+
6
+ import type { AstNode, URI } from 'langium';
7
+ import type {
8
+ BoundedContext,
9
+ Classification,
10
+ ContextMap,
11
+ Domain,
12
+ DomainMap,
13
+ Model,
14
+ NamespaceDeclaration,
15
+ Relationship,
16
+ Team,
17
+ } from '../generated/ast.js';
18
+ import type { DomainLangServices } from '../domain-lang-module.js';
19
+
20
+ // Import augmentation module for extended AST types
21
+ // This enables native SDK properties on BoundedContext, Domain, and Relationship
22
+ import './ast-augmentation.js';
23
+
24
+ /**
25
+ * Context returned from loadModel functions.
26
+ * Contains the parsed model, document URIs, and query API.
27
+ */
28
+ export interface QueryContext {
29
+ /** Root model node */
30
+ readonly model: Model;
31
+ /** URIs of all documents in the model (including imports) */
32
+ readonly documents: URI[];
33
+ /** Query API for model traversal */
34
+ readonly query: Query;
35
+ }
36
+
37
+ /**
38
+ * Options for loading models from files or text.
39
+ */
40
+ export interface LoadOptions {
41
+ /** Workspace directory for resolving relative imports */
42
+ workspaceDir?: string;
43
+ /** Reuse existing Langium services instead of creating new ones */
44
+ services?: DomainLangServices;
45
+ }
46
+
47
+ /**
48
+ * Main query interface for model traversal.
49
+ * Provides O(1) lookups and fluent collection queries.
50
+ */
51
+ export interface Query {
52
+ /**
53
+ * Returns all domains in the model as a chainable query.
54
+ * @returns QueryBuilder for domains
55
+ * @example
56
+ * ```typescript
57
+ * const coreDomains = query.domains()
58
+ * .where(d => d.type?.ref?.name === 'Core');
59
+ * ```
60
+ */
61
+ domains(): QueryBuilder<Domain>;
62
+
63
+ /**
64
+ * Returns all bounded contexts in the model as a chainable query.
65
+ * @returns BcQueryBuilder with context-specific filters
66
+ * @example
67
+ * ```typescript
68
+ * const contexts = query.boundedContexts()
69
+ * .withClassification('Core')
70
+ * .withTeam('PaymentTeam');
71
+ * ```
72
+ */
73
+ boundedContexts(): BcQueryBuilder;
74
+
75
+ /**
76
+ * Returns all teams in the model as a chainable query.
77
+ * @returns QueryBuilder for teams
78
+ */
79
+ teams(): QueryBuilder<Team>;
80
+
81
+ /**
82
+ * Returns all classifications in the model as a chainable query.
83
+ * @returns QueryBuilder for classifications
84
+ */
85
+ classifications(): QueryBuilder<Classification>;
86
+
87
+ /**
88
+ * Returns all relationships as a chainable query.
89
+ * Includes relationships from both BoundedContext blocks and ContextMap.
90
+ * @returns QueryBuilder for relationships
91
+ */
92
+ relationships(): QueryBuilder<RelationshipView>;
93
+
94
+ /**
95
+ * Returns all context maps in the model as a chainable query.
96
+ * @returns QueryBuilder for context maps
97
+ */
98
+ contextMaps(): QueryBuilder<ContextMap>;
99
+
100
+ /**
101
+ * Returns all domain maps in the model as a chainable query.
102
+ * @returns QueryBuilder for domain maps
103
+ */
104
+ domainMaps(): QueryBuilder<DomainMap>;
105
+
106
+ /**
107
+ * Returns all namespace declarations in the model as a chainable query.
108
+ * @returns QueryBuilder for namespaces
109
+ */
110
+ namespaces(): QueryBuilder<NamespaceDeclaration>;
111
+
112
+ /**
113
+ * Finds any AST node by its fully qualified name.
114
+ * @param fqn - Fully qualified name (e.g., 'Sales.OrderContext')
115
+ * @returns The node or undefined if not found
116
+ * @example
117
+ * ```typescript
118
+ * const bc = query.byFqn<BoundedContext>('Sales.OrderContext');
119
+ * ```
120
+ */
121
+ byFqn<T extends AstNode = AstNode>(fqn: string): T | undefined;
122
+
123
+ /**
124
+ * Finds a domain by simple name or FQN.
125
+ * @param name - Domain name
126
+ * @returns The domain or undefined if not found
127
+ */
128
+ domain(name: string): Domain | undefined;
129
+
130
+ /**
131
+ * Finds a bounded context by simple name or FQN.
132
+ * @param name - Bounded context name
133
+ * @returns The bounded context or undefined if not found
134
+ */
135
+ boundedContext(name: string): BoundedContext | undefined;
136
+
137
+ /**
138
+ * Alias for boundedContext() - shorthand for convenience.
139
+ * @param name - Bounded context name
140
+ * @returns The bounded context or undefined if not found
141
+ */
142
+ bc(name: string): BoundedContext | undefined;
143
+
144
+ /**
145
+ * Finds a team by simple name.
146
+ * @param name - Team name
147
+ * @returns The team or undefined if not found
148
+ */
149
+ team(name: string): Team | undefined;
150
+
151
+ /**
152
+ * Computes the fully qualified name for any AST node.
153
+ * @param node - AST node
154
+ * @returns Fully qualified name (e.g., 'Sales.OrderContext')
155
+ */
156
+ fqn(node: AstNode): string;
157
+ }
158
+
159
+ /**
160
+ * Fluent query builder supporting lazy iteration and chaining.
161
+ * Terminal operations materialize the results.
162
+ */
163
+ export interface QueryBuilder<T> extends Iterable<T> {
164
+ /**
165
+ * Filters items by a predicate function.
166
+ * Chains without materializing intermediate results.
167
+ * @param predicate - Function that returns true for items to include
168
+ * @returns New QueryBuilder with combined filters
169
+ * @example
170
+ * ```typescript
171
+ * query.domains()
172
+ * .where(d => d.parent !== undefined)
173
+ * .where(d => d.classification?.name === 'Core');
174
+ * ```
175
+ */
176
+ where(predicate: (item: T) => boolean): QueryBuilder<T>;
177
+
178
+ /**
179
+ * Filters by simple name or regex pattern.
180
+ * @param pattern - String or RegExp to match against name
181
+ * @returns New QueryBuilder with name filter
182
+ * @example
183
+ * ```typescript
184
+ * query.domains().withName(/^Sales/);
185
+ * ```
186
+ */
187
+ withName(pattern: string | RegExp): QueryBuilder<T>;
188
+
189
+ /**
190
+ * Filters by fully qualified name or regex pattern.
191
+ * @param pattern - String or RegExp to match against FQN
192
+ * @returns New QueryBuilder with FQN filter
193
+ * @example
194
+ * ```typescript
195
+ * query.boundedContexts().withFqn('Sales.OrderContext');
196
+ * ```
197
+ */
198
+ withFqn(pattern: string | RegExp): QueryBuilder<T>;
199
+
200
+ /**
201
+ * Returns the first item or undefined if no items match.
202
+ * Terminal operation.
203
+ * @returns First matching item or undefined
204
+ */
205
+ first(): T | undefined;
206
+
207
+ /**
208
+ * Materializes all items into an array.
209
+ * Terminal operation.
210
+ * @returns Array of all matching items
211
+ */
212
+ toArray(): T[];
213
+
214
+ /**
215
+ * Counts items without materializing.
216
+ * Terminal operation.
217
+ * @returns Number of matching items
218
+ */
219
+ count(): number;
220
+
221
+ /**
222
+ * Iterator for lazy evaluation.
223
+ * Allows use in for...of loops and spread operators.
224
+ */
225
+ [Symbol.iterator](): Iterator<T>;
226
+ }
227
+
228
+ /**
229
+ * Specialized query builder for BoundedContext with domain-specific filters.
230
+ * Extends base QueryBuilder with context-aware methods.
231
+ */
232
+ export interface BcQueryBuilder extends QueryBuilder<BoundedContext> {
233
+ /**
234
+ * Filters contexts belonging to a specific domain.
235
+ * @param domain - Domain name or Domain instance
236
+ * @returns New BcQueryBuilder with domain filter
237
+ * @example
238
+ * ```typescript
239
+ * query.boundedContexts().inDomain('Sales');
240
+ * ```
241
+ */
242
+ inDomain(domain: string | Domain): BcQueryBuilder;
243
+
244
+ /**
245
+ * Filters contexts assigned to a specific team.
246
+ * Uses SDK-resolved team property (header inline or block).
247
+ * @param team - Team name or Team instance
248
+ * @returns New BcQueryBuilder with team filter
249
+ * @example
250
+ * ```typescript
251
+ * query.boundedContexts().withTeam('PaymentTeam');
252
+ * ```
253
+ */
254
+ withTeam(team: string | Team): BcQueryBuilder;
255
+
256
+ /**
257
+ * Filters contexts with a specific strategic classification.
258
+ * Uses SDK-resolved classification precedence (header inline `as` → body `classification:`).
259
+ * @param classification - Classification name or Classification instance
260
+ * @returns New BcQueryBuilder with classification filter
261
+ * @example
262
+ * ```typescript
263
+ * query.boundedContexts().withClassification('Core');
264
+ * ```
265
+ */
266
+ withClassification(classification: string | Classification): BcQueryBuilder;
267
+
268
+ /**
269
+ * Filters contexts with specific metadata key-value pair.
270
+ * @param key - Metadata key
271
+ * @param value - Optional metadata value (if omitted, matches any value)
272
+ * @returns New BcQueryBuilder with metadata filter
273
+ * @example
274
+ * ```typescript
275
+ * query.boundedContexts()
276
+ * .withMetadata('Language', 'TypeScript')
277
+ * .withMetadata('Framework'); // Any framework
278
+ * ```
279
+ */
280
+ withMetadata(key: string, value?: string): BcQueryBuilder;
281
+ }
282
+
283
+ /**
284
+ * Unified view of a relationship between two BoundedContexts.
285
+ * Relationships can be defined in BoundedContext blocks or ContextMap.
286
+ */
287
+ export interface RelationshipView {
288
+ /** Left-hand side BoundedContext */
289
+ readonly left: BoundedContext;
290
+ /** Right-hand side BoundedContext */
291
+ readonly right: BoundedContext;
292
+ /** Relationship direction arrow */
293
+ readonly arrow: '->' | '<-' | '<->' | '><';
294
+ /** Integration patterns on left side (e.g., ['OHS', 'PL']) */
295
+ readonly leftPatterns: readonly string[];
296
+ /** Integration patterns on right side (e.g., ['CF', 'ACL']) */
297
+ readonly rightPatterns: readonly string[];
298
+ /** Explicit relationship type if specified */
299
+ readonly type?: string;
300
+ /** SDK-inferred relationship type based on patterns */
301
+ readonly inferredType?: string;
302
+ /** Source of the relationship definition */
303
+ readonly source: 'BoundedContext' | 'ContextMap';
304
+ /** Original AST relationship node */
305
+ readonly astNode: Relationship;
306
+ }
307
+
308
+ /**
309
+ * Augmented BoundedContext with SDK-resolved properties.
310
+ * These properties are computed during model loading using precedence rules.
311
+ *
312
+ * Property names follow the PRS design: natural names that "just work" with
313
+ * IDE autocomplete. Use `resolved*` prefix to avoid conflicts with existing
314
+ * AST properties while maintaining discoverability.
315
+ *
316
+ * @deprecated Since SDK now uses module augmentation in ast-augmentation.ts,
317
+ * this type alias is only kept for backwards compatibility. Use BoundedContext
318
+ * directly after importing the SDK.
319
+ */
320
+ export type AugmentedBoundedContext = BoundedContext;
321
+
322
+ /**
323
+ * Augmented Domain with SDK-resolved properties.
324
+ *
325
+ * @deprecated Since SDK now uses module augmentation in ast-augmentation.ts,
326
+ * this type alias is only kept for backwards compatibility. Use Domain
327
+ * directly after importing the SDK.
328
+ */
329
+ export type AugmentedDomain = Domain;
330
+
331
+ /**
332
+ * Internal index structure for O(1) lookups.
333
+ * Not exported from public API.
334
+ */
335
+ export interface ModelIndexes {
336
+ /** Map from FQN to AST node */
337
+ readonly byFqn: ReadonlyMap<string, AstNode>;
338
+ /** Map from simple name to AST nodes (may have duplicates) */
339
+ readonly byName: ReadonlyMap<string, AstNode[]>;
340
+ /** Map from team name to BoundedContexts */
341
+ readonly byTeam: ReadonlyMap<string, BoundedContext[]>;
342
+ /** Map from strategic classification name to BoundedContexts */
343
+ readonly byClassification: ReadonlyMap<string, BoundedContext[]>;
344
+ /** Map from metadata key to BoundedContexts */
345
+ readonly byMetadataKey: ReadonlyMap<string, BoundedContext[]>;
346
+ }