@domainlang/language 0.1.20 → 0.1.82

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 (110) hide show
  1. package/out/domain-lang-module.d.ts +0 -2
  2. package/out/domain-lang-module.js +3 -11
  3. package/out/domain-lang-module.js.map +1 -1
  4. package/out/generated/ast.d.ts +19 -8
  5. package/out/generated/ast.js +10 -1
  6. package/out/generated/ast.js.map +1 -1
  7. package/out/generated/grammar.d.ts +1 -1
  8. package/out/generated/grammar.js +123 -28
  9. package/out/generated/grammar.js.map +1 -1
  10. package/out/generated/module.d.ts +1 -1
  11. package/out/generated/module.js +1 -1
  12. package/out/index.d.ts +0 -3
  13. package/out/index.js +0 -5
  14. package/out/index.js.map +1 -1
  15. package/out/lsp/hover/domain-lang-hover.js +4 -0
  16. package/out/lsp/hover/domain-lang-hover.js.map +1 -1
  17. package/out/sdk/index.d.ts +1 -1
  18. package/out/sdk/loader-node.d.ts +3 -7
  19. package/out/sdk/loader-node.js +9 -24
  20. package/out/sdk/loader-node.js.map +1 -1
  21. package/out/sdk/types.d.ts +21 -0
  22. package/out/services/dependency-analyzer.d.ts +39 -3
  23. package/out/services/dependency-analyzer.js +47 -22
  24. package/out/services/dependency-analyzer.js.map +1 -1
  25. package/out/services/dependency-resolver.d.ts +45 -68
  26. package/out/services/dependency-resolver.js +43 -243
  27. package/out/services/dependency-resolver.js.map +1 -1
  28. package/out/services/git-url-resolver.browser.d.ts +12 -4
  29. package/out/services/git-url-resolver.browser.js +1 -5
  30. package/out/services/git-url-resolver.browser.js.map +1 -1
  31. package/out/services/git-url-resolver.d.ts +56 -22
  32. package/out/services/git-url-resolver.js +36 -70
  33. package/out/services/git-url-resolver.js.map +1 -1
  34. package/out/services/governance-validator.d.ts +37 -1
  35. package/out/services/governance-validator.js +10 -4
  36. package/out/services/governance-validator.js.map +1 -1
  37. package/out/services/import-resolver.d.ts +6 -65
  38. package/out/services/import-resolver.js +5 -223
  39. package/out/services/import-resolver.js.map +1 -1
  40. package/out/services/performance-optimizer.d.ts +1 -1
  41. package/out/services/workspace-manager.d.ts +10 -57
  42. package/out/services/workspace-manager.js +21 -187
  43. package/out/services/workspace-manager.js.map +1 -1
  44. package/out/syntaxes/domain-lang.monarch.js +1 -1
  45. package/out/syntaxes/domain-lang.monarch.js.map +1 -1
  46. package/out/utils/import-utils.d.ts +12 -4
  47. package/out/utils/import-utils.js +135 -35
  48. package/out/utils/import-utils.js.map +1 -1
  49. package/out/validation/constants.d.ts +0 -103
  50. package/out/validation/constants.js +1 -140
  51. package/out/validation/constants.js.map +1 -1
  52. package/out/validation/domain.js +1 -46
  53. package/out/validation/domain.js.map +1 -1
  54. package/out/validation/import.d.ts +22 -46
  55. package/out/validation/import.js +85 -187
  56. package/out/validation/import.js.map +1 -1
  57. package/out/validation/maps.js +6 -10
  58. package/out/validation/maps.js.map +1 -1
  59. package/out/validation/metadata.js +1 -5
  60. package/out/validation/metadata.js.map +1 -1
  61. package/package.json +6 -8
  62. package/src/domain-lang-module.ts +6 -18
  63. package/src/domain-lang.langium +12 -7
  64. package/src/generated/ast.ts +20 -7
  65. package/src/generated/grammar.ts +123 -28
  66. package/src/generated/module.ts +1 -1
  67. package/src/index.ts +0 -7
  68. package/src/lsp/hover/domain-lang-hover.ts +2 -0
  69. package/src/sdk/index.ts +2 -0
  70. package/src/sdk/loader-node.ts +9 -29
  71. package/src/sdk/types.ts +23 -0
  72. package/src/services/dependency-analyzer.ts +84 -24
  73. package/src/services/dependency-resolver.ts +84 -301
  74. package/src/services/git-url-resolver.browser.ts +14 -9
  75. package/src/services/git-url-resolver.ts +93 -86
  76. package/src/services/governance-validator.ts +47 -5
  77. package/src/services/import-resolver.ts +8 -270
  78. package/src/services/performance-optimizer.ts +1 -1
  79. package/src/services/workspace-manager.ts +46 -237
  80. package/src/syntaxes/domain-lang.monarch.ts +1 -1
  81. package/src/utils/import-utils.ts +160 -38
  82. package/src/validation/constants.ts +1 -181
  83. package/src/validation/domain.ts +1 -54
  84. package/src/validation/import.ts +104 -228
  85. package/src/validation/maps.ts +6 -10
  86. package/src/validation/metadata.ts +1 -5
  87. package/out/lsp/domain-lang-code-actions.d.ts +0 -55
  88. package/out/lsp/domain-lang-code-actions.js +0 -143
  89. package/out/lsp/domain-lang-code-actions.js.map +0 -1
  90. package/out/lsp/domain-lang-workspace-manager.d.ts +0 -21
  91. package/out/lsp/domain-lang-workspace-manager.js +0 -93
  92. package/out/lsp/domain-lang-workspace-manager.js.map +0 -1
  93. package/out/lsp/manifest-diagnostics.d.ts +0 -82
  94. package/out/lsp/manifest-diagnostics.js +0 -230
  95. package/out/lsp/manifest-diagnostics.js.map +0 -1
  96. package/out/services/semver.d.ts +0 -98
  97. package/out/services/semver.js +0 -195
  98. package/out/services/semver.js.map +0 -1
  99. package/out/services/types.d.ts +0 -340
  100. package/out/services/types.js +0 -46
  101. package/out/services/types.js.map +0 -1
  102. package/out/validation/manifest.d.ts +0 -144
  103. package/out/validation/manifest.js +0 -327
  104. package/out/validation/manifest.js.map +0 -1
  105. package/src/lsp/domain-lang-code-actions.ts +0 -189
  106. package/src/lsp/domain-lang-workspace-manager.ts +0 -104
  107. package/src/lsp/manifest-diagnostics.ts +0 -290
  108. package/src/services/semver.ts +0 -213
  109. package/src/services/types.ts +0 -415
  110. package/src/validation/manifest.ts +0 -439
@@ -2,9 +2,8 @@ import { type Module, inject } from 'langium';
2
2
  import type {
3
3
  DefaultSharedModuleContext,
4
4
  LangiumServices,
5
- LangiumSharedServices,
6
- PartialLangiumServices,
7
- PartialLangiumSharedServices
5
+ LangiumSharedServices,
6
+ PartialLangiumServices
8
7
  } from 'langium/lsp';
9
8
  import { createDefaultModule, createDefaultSharedModule } from 'langium/lsp';
10
9
  import { DomainLangGeneratedModule, DomainLangGeneratedSharedModule } from './generated/module.js';
@@ -14,10 +13,8 @@ import { DomainLangScopeComputation } from './lsp/domain-lang-scope.js';
14
13
  import { DomainLangFormatter } from './lsp/domain-lang-formatter.js';
15
14
  import { DomainLangHoverProvider } from './lsp/hover/domain-lang-hover.js';
16
15
  import { DomainLangCompletionProvider } from './lsp/domain-lang-completion.js';
17
- import { DomainLangCodeActionProvider } from './lsp/domain-lang-code-actions.js';
18
16
  import { ImportResolver } from './services/import-resolver.js';
19
17
  import { WorkspaceManager } from './services/workspace-manager.js';
20
- import { DomainLangWorkspaceManager } from './lsp/domain-lang-workspace-manager.js';
21
18
 
22
19
  /**
23
20
  * Declaration of custom services - add your own service classes here.
@@ -33,8 +30,7 @@ export type DomainLangAddedServices = {
33
30
  lsp: {
34
31
  Formatter: DomainLangFormatter,
35
32
  HoverProvider: DomainLangHoverProvider,
36
- CompletionProvider: DomainLangCompletionProvider,
37
- CodeActionProvider: DomainLangCodeActionProvider
33
+ CompletionProvider: DomainLangCompletionProvider
38
34
  }
39
35
  }
40
36
 
@@ -44,12 +40,6 @@ export type DomainLangAddedServices = {
44
40
  */
45
41
  export type DomainLangServices = LangiumServices & DomainLangAddedServices
46
42
 
47
- const DomainLangSharedModule: Module<LangiumSharedServices, PartialLangiumSharedServices> = {
48
- workspace: {
49
- WorkspaceManager: (services: LangiumSharedServices) => new DomainLangWorkspaceManager(services)
50
- }
51
- };
52
-
53
43
  /**
54
44
  * Dependency injection module that overrides Langium default services and contributes the
55
45
  * declared custom services. The Langium defaults can be partially specified to override only
@@ -58,7 +48,7 @@ const DomainLangSharedModule: Module<LangiumSharedServices, PartialLangiumShared
58
48
  export const DomainLangModule: Module<DomainLangServices, PartialLangiumServices & DomainLangAddedServices> = {
59
49
  imports: {
60
50
  ImportResolver: (services) => new ImportResolver(services),
61
- WorkspaceManager: () => new WorkspaceManager({ autoResolve: false, allowNetwork: false })
51
+ WorkspaceManager: () => new WorkspaceManager()
62
52
  },
63
53
  references: {
64
54
  ScopeComputation: (services) => new DomainLangScopeComputation(services),
@@ -67,8 +57,7 @@ export const DomainLangModule: Module<DomainLangServices, PartialLangiumServices
67
57
  lsp: {
68
58
  Formatter: () => new DomainLangFormatter(),
69
59
  HoverProvider: (services) => new DomainLangHoverProvider(services),
70
- CompletionProvider: (services) => new DomainLangCompletionProvider(services),
71
- CodeActionProvider: () => new DomainLangCodeActionProvider()
60
+ CompletionProvider: (services) => new DomainLangCompletionProvider(services)
72
61
  },
73
62
  };
74
63
 
@@ -93,8 +82,7 @@ export function createDomainLangServices(context: DefaultSharedModuleContext): {
93
82
  } {
94
83
  const shared = inject(
95
84
  createDefaultSharedModule(context),
96
- DomainLangGeneratedSharedModule,
97
- DomainLangSharedModule
85
+ DomainLangGeneratedSharedModule
98
86
  );
99
87
  const DomainLang = inject(
100
88
  createDefaultModule({ shared }),
@@ -292,18 +292,23 @@ BusinessRule:
292
292
  // ============================================================================
293
293
 
294
294
  /**
295
- * Import Statement - Manifest-centric import system per PRS-010.
295
+ * Import Statement - Git-native import system inspired by Go modules and Deno.
296
296
  *
297
- * Simplified syntax where import statements use short specifiers:
298
- * - External dependencies (from manifest): import "core" as Core
297
+ * Supported formats:
299
298
  * - Local files: import "./shared/types.dlang"
300
299
  * - Workspace-relative: import "~/contexts/sales.dlang"
301
- *
302
- * All resolution details (source, version, integrity) live in model.yaml manifest.
303
- * Named imports and inline integrity checks have been removed per PRS-010.
300
+ * - GitHub packages: import "owner/repo@v1.0.0"
301
+ * - GitLab/Git URLs: import "https://gitlab.com/owner/repo@v1.0.0"
302
+ * - With aliases: import "ddd-patterns/core@v2.1.0" as DDD
303
+ * - Named imports: import { OrderContext } from "./contexts.dlang"
304
304
  */
305
305
  ImportStatement:
306
- /** Imports types or namespaces from another file or module, enabling reuse and modularity. */ ('Import' | 'import') uri=STRING ('as' alias=ID)?
306
+ /** Imports types or namespaces from another file or module, enabling reuse and modularity. */ ('Import' | 'import') (
307
+ '{' symbols+=ID (',' symbols+=ID)* '}' 'from' uri=STRING
308
+ | uri=STRING
309
+ ('integrity' integrity=STRING)?
310
+ ('as' alias=ID)?
311
+ )
307
312
  ;
308
313
 
309
314
  /**
@@ -1,5 +1,5 @@
1
1
  /******************************************************************************
2
- * This file was generated by langium-cli 4.2.0.
2
+ * This file was generated by langium-cli 4.1.0.
3
3
  * DO NOT EDIT MANUALLY!
4
4
  ******************************************************************************/
5
5
 
@@ -74,10 +74,12 @@ export type DomainLangKeywordNames =
74
74
  | "evolution"
75
75
  | "examples"
76
76
  | "for"
77
+ | "from"
77
78
  | "glossary"
78
79
  | "import"
79
80
  | "in"
80
81
  | "integrations"
82
+ | "integrity"
81
83
  | "is"
82
84
  | "meta"
83
85
  | "metadata"
@@ -350,26 +352,30 @@ export function isDomainTerm(item: unknown): item is DomainTerm {
350
352
  }
351
353
 
352
354
  /**
353
- * Import Statement - Manifest-centric import system per PRS-010.
355
+ * Import Statement - Git-native import system inspired by Go modules and Deno.
354
356
  *
355
- * Simplified syntax where import statements use short specifiers:
356
- * - External dependencies (from manifest): import "core" as Core
357
+ * Supported formats:
357
358
  * - Local files: import "./shared/types.dlang"
358
359
  * - Workspace-relative: import "~/contexts/sales.dlang"
359
- *
360
- * All resolution details (source, version, integrity) live in model.yaml manifest.
361
- * Named imports and inline integrity checks have been removed per PRS-010.
360
+ * - GitHub packages: import "owner/repo@v1.0.0"
361
+ * - GitLab/Git URLs: import "https://gitlab.com/owner/repo@v1.0.0"
362
+ * - With aliases: import "ddd-patterns/core@v2.1.0" as DDD
363
+ * - Named imports: import { OrderContext } from "./contexts.dlang"
362
364
  */
363
365
  export interface ImportStatement extends langium.AstNode {
364
366
  readonly $container: Model;
365
367
  readonly $type: 'ImportStatement';
366
368
  alias?: string;
369
+ integrity?: string;
370
+ symbols: Array<string>;
367
371
  uri: string;
368
372
  }
369
373
 
370
374
  export const ImportStatement = {
371
375
  $type: 'ImportStatement',
372
376
  alias: 'alias',
377
+ integrity: 'integrity',
378
+ symbols: 'symbols',
373
379
  uri: 'uri'
374
380
  } as const;
375
381
 
@@ -846,6 +852,13 @@ export class DomainLangAstReflection extends langium.AbstractAstReflection {
846
852
  alias: {
847
853
  name: ImportStatement.alias
848
854
  },
855
+ integrity: {
856
+ name: ImportStatement.integrity
857
+ },
858
+ symbols: {
859
+ name: ImportStatement.symbols,
860
+ defaultValue: []
861
+ },
849
862
  uri: {
850
863
  name: ImportStatement.uri
851
864
  }
@@ -1,5 +1,5 @@
1
1
  /******************************************************************************
2
- * This file was generated by langium-cli 4.2.0.
2
+ * This file was generated by langium-cli 4.1.0.
3
3
  * DO NOT EDIT MANUALLY!
4
4
  ******************************************************************************/
5
5
 
@@ -2160,38 +2160,133 @@ export const DomainLangGrammar = (): Grammar => loadedDomainLangGrammar ?? (load
2160
2160
  "$comment": "/** Imports types or namespaces from another file or module, enabling reuse and modularity. */"
2161
2161
  },
2162
2162
  {
2163
- "$type": "Assignment",
2164
- "feature": "uri",
2165
- "operator": "=",
2166
- "terminal": {
2167
- "$type": "RuleCall",
2168
- "rule": {
2169
- "$ref": "#/rules@28"
2170
- },
2171
- "arguments": []
2172
- }
2173
- },
2174
- {
2175
- "$type": "Group",
2163
+ "$type": "Alternatives",
2176
2164
  "elements": [
2177
2165
  {
2178
- "$type": "Keyword",
2179
- "value": "as"
2166
+ "$type": "Group",
2167
+ "elements": [
2168
+ {
2169
+ "$type": "Keyword",
2170
+ "value": "{"
2171
+ },
2172
+ {
2173
+ "$type": "Assignment",
2174
+ "feature": "symbols",
2175
+ "operator": "+=",
2176
+ "terminal": {
2177
+ "$type": "RuleCall",
2178
+ "rule": {
2179
+ "$ref": "#/rules@27"
2180
+ },
2181
+ "arguments": []
2182
+ }
2183
+ },
2184
+ {
2185
+ "$type": "Group",
2186
+ "elements": [
2187
+ {
2188
+ "$type": "Keyword",
2189
+ "value": ","
2190
+ },
2191
+ {
2192
+ "$type": "Assignment",
2193
+ "feature": "symbols",
2194
+ "operator": "+=",
2195
+ "terminal": {
2196
+ "$type": "RuleCall",
2197
+ "rule": {
2198
+ "$ref": "#/rules@27"
2199
+ },
2200
+ "arguments": []
2201
+ }
2202
+ }
2203
+ ],
2204
+ "cardinality": "*"
2205
+ },
2206
+ {
2207
+ "$type": "Keyword",
2208
+ "value": "}"
2209
+ },
2210
+ {
2211
+ "$type": "Keyword",
2212
+ "value": "from"
2213
+ },
2214
+ {
2215
+ "$type": "Assignment",
2216
+ "feature": "uri",
2217
+ "operator": "=",
2218
+ "terminal": {
2219
+ "$type": "RuleCall",
2220
+ "rule": {
2221
+ "$ref": "#/rules@28"
2222
+ },
2223
+ "arguments": []
2224
+ }
2225
+ }
2226
+ ]
2180
2227
  },
2181
2228
  {
2182
- "$type": "Assignment",
2183
- "feature": "alias",
2184
- "operator": "=",
2185
- "terminal": {
2186
- "$type": "RuleCall",
2187
- "rule": {
2188
- "$ref": "#/rules@27"
2229
+ "$type": "Group",
2230
+ "elements": [
2231
+ {
2232
+ "$type": "Assignment",
2233
+ "feature": "uri",
2234
+ "operator": "=",
2235
+ "terminal": {
2236
+ "$type": "RuleCall",
2237
+ "rule": {
2238
+ "$ref": "#/rules@28"
2239
+ },
2240
+ "arguments": []
2241
+ }
2189
2242
  },
2190
- "arguments": []
2191
- }
2243
+ {
2244
+ "$type": "Group",
2245
+ "elements": [
2246
+ {
2247
+ "$type": "Keyword",
2248
+ "value": "integrity"
2249
+ },
2250
+ {
2251
+ "$type": "Assignment",
2252
+ "feature": "integrity",
2253
+ "operator": "=",
2254
+ "terminal": {
2255
+ "$type": "RuleCall",
2256
+ "rule": {
2257
+ "$ref": "#/rules@28"
2258
+ },
2259
+ "arguments": []
2260
+ }
2261
+ }
2262
+ ],
2263
+ "cardinality": "?"
2264
+ },
2265
+ {
2266
+ "$type": "Group",
2267
+ "elements": [
2268
+ {
2269
+ "$type": "Keyword",
2270
+ "value": "as"
2271
+ },
2272
+ {
2273
+ "$type": "Assignment",
2274
+ "feature": "alias",
2275
+ "operator": "=",
2276
+ "terminal": {
2277
+ "$type": "RuleCall",
2278
+ "rule": {
2279
+ "$ref": "#/rules@27"
2280
+ },
2281
+ "arguments": []
2282
+ }
2283
+ }
2284
+ ],
2285
+ "cardinality": "?"
2286
+ }
2287
+ ]
2192
2288
  }
2193
- ],
2194
- "cardinality": "?"
2289
+ ]
2195
2290
  }
2196
2291
  ],
2197
2292
  "$comment": "/** Imports types or namespaces from another file or module, enabling reuse and modularity. */"
@@ -2199,7 +2294,7 @@ export const DomainLangGrammar = (): Grammar => loadedDomainLangGrammar ?? (load
2199
2294
  "entry": false,
2200
2295
  "fragment": false,
2201
2296
  "parameters": [],
2202
- "$comment": "/**\\n * Import Statement - Manifest-centric import system per PRS-010.\\n * \\n * Simplified syntax where import statements use short specifiers:\\n * - External dependencies (from manifest): import \\"core\\" as Core\\n * - Local files: import \\"./shared/types.dlang\\"\\n * - Workspace-relative: import \\"~/contexts/sales.dlang\\"\\n * \\n * All resolution details (source, version, integrity) live in model.yaml manifest.\\n * Named imports and inline integrity checks have been removed per PRS-010.\\n */"
2297
+ "$comment": "/**\\n * Import Statement - Git-native import system inspired by Go modules and Deno.\\n * \\n * Supported formats:\\n * - Local files: import \\"./shared/types.dlang\\"\\n * - Workspace-relative: import \\"~/contexts/sales.dlang\\"\\n * - GitHub packages: import \\"owner/repo@v1.0.0\\"\\n * - GitLab/Git URLs: import \\"https://gitlab.com/owner/repo@v1.0.0\\"\\n * - With aliases: import \\"ddd-patterns/core@v2.1.0\\" as DDD\\n * - Named imports: import { OrderContext } from \\"./contexts.dlang\\"\\n */"
2203
2298
  },
2204
2299
  {
2205
2300
  "$type": "ParserRule",
@@ -1,5 +1,5 @@
1
1
  /******************************************************************************
2
- * This file was generated by langium-cli 4.2.0.
2
+ * This file was generated by langium-cli 4.1.0.
3
3
  * DO NOT EDIT MANUALLY!
4
4
  ******************************************************************************/
5
5
 
package/src/index.ts CHANGED
@@ -6,9 +6,6 @@ export * from './generated/module.js';
6
6
  // and creates a connection when imported, which breaks CLI/SDK standalone usage
7
7
  export * from './ast-augmentation.js';
8
8
 
9
- // Export centralized types (canonical source for all service types)
10
- export * from './services/types.js';
11
-
12
9
  // Export services
13
10
  export * from './services/workspace-manager.js';
14
11
  export * from './services/dependency-resolver.js';
@@ -18,7 +15,3 @@ export * from './services/import-resolver.js';
18
15
  export * from './services/relationship-inference.js';
19
16
  export * from './services/git-url-resolver.js';
20
17
  export * from './services/performance-optimizer.js';
21
- export * from './services/semver.js';
22
-
23
- // Export LSP services
24
- export * from './lsp/manifest-diagnostics.js';
@@ -276,7 +276,9 @@ export class DomainLangHoverProvider extends AstNodeHoverProvider {
276
276
  if (ast.isImportStatement && ast.isImportStatement(node)) {
277
277
  const fields: string[] = [];
278
278
  fields.push(`**URI:** \`${node.uri}\``);
279
+ if (node.symbols.length) fields.push(`**Imports:** ${node.symbols.map(s => `\`${s}\``).join(', ')}`);
279
280
  if (node.alias) fields.push(`**Alias:** \`${node.alias}\``);
281
+ if (node.integrity) fields.push(`**Integrity:** \`${node.integrity}\``);
280
282
  return (commentBlock ? `${commentBlock}\n\n---\n\n` : '') +
281
283
  `📦 **\`(import)\`**\n\n` +
282
284
  fields.join('\n\n');
package/src/sdk/index.ts CHANGED
@@ -123,4 +123,6 @@ export type {
123
123
  LoadOptions,
124
124
  BcQueryBuilder,
125
125
  RelationshipView,
126
+ AugmentedBoundedContext,
127
+ AugmentedDomain,
126
128
  } from './types.js';
@@ -25,16 +25,14 @@ import { isModel } from '../generated/ast.js';
25
25
  import { createDomainLangServices } from '../domain-lang-module.js';
26
26
  import type { LoadOptions, QueryContext } from './types.js';
27
27
  import { fromModel, augmentModel } from './query.js';
28
- import { ensureImportGraphFromDocument } from '../utils/import-utils.js';
29
28
 
30
29
  /**
31
30
  * Loads a DomainLang model from a file on disk.
32
31
  *
33
32
  * **Node.js only** - uses file system APIs.
34
33
  *
35
- * Supports multi-file models with imports: all imported files are
36
- * automatically loaded and linked. Use `documents` in the result
37
- * to see all loaded files.
34
+ * Note: This loads a single file. For multi-file models with imports,
35
+ * consider using the WorkspaceManager or hosting an LSP server.
38
36
  *
39
37
  * @param entryFile - Path to the entry .dlang file
40
38
  * @param options - Optional load configuration
@@ -45,16 +43,13 @@ import { ensureImportGraphFromDocument } from '../utils/import-utils.js';
45
43
  * ```typescript
46
44
  * import { loadModel } from '@domainlang/language/sdk/loader-node';
47
45
  *
48
- * const { query, model, documents } = await loadModel('./domains.dlang', {
46
+ * const { query, model } = await loadModel('./domains.dlang', {
49
47
  * workspaceDir: process.cwd()
50
48
  * });
51
49
  *
52
- * // Query spans all imported files
53
50
  * for (const bc of query.boundedContexts()) {
54
51
  * console.log(bc.name);
55
52
  * }
56
- *
57
- * console.log(`Loaded ${documents.length} files`);
58
53
  * ```
59
54
  */
60
55
  export async function loadModel(
@@ -94,19 +89,9 @@ export async function loadModel(
94
89
 
95
90
  // Register document and build it
96
91
  shared.workspace.LangiumDocuments.addDocument(document);
97
- await shared.workspace.DocumentBuilder.build([document], { validation: false });
98
-
99
- // Traverse import graph to load all imported files
100
- const importedUris = await ensureImportGraphFromDocument(
101
- document,
102
- shared.workspace.LangiumDocuments
103
- );
92
+ await shared.workspace.DocumentBuilder.build([document], { validation: true });
104
93
 
105
- // Build all imported documents with validation
106
- const allDocuments = Array.from(shared.workspace.LangiumDocuments.all);
107
- await shared.workspace.DocumentBuilder.build(allDocuments, { validation: true });
108
-
109
- // Wait for entry document to be fully processed
94
+ // Wait for document to be fully processed
110
95
  if (document.state < DocumentState.Validated) {
111
96
  throw new Error(`Document not fully processed: ${absolutePath}`);
112
97
  }
@@ -127,16 +112,11 @@ export async function loadModel(
127
112
  throw new Error(`Document root is not a Model: ${entryFile}`);
128
113
  }
129
114
 
130
- // Augment AST nodes with SDK properties for all loaded models
131
- for (const doc of allDocuments) {
132
- const docModel = doc.parseResult.value;
133
- if (isModel(docModel)) {
134
- augmentModel(docModel);
135
- }
136
- }
115
+ // Augment AST nodes with SDK properties
116
+ augmentModel(model);
137
117
 
138
- // Collect all document URIs from the import graph
139
- const documentUris: URI[] = Array.from(importedUris).map(uriStr => URI.parse(uriStr));
118
+ // Collect all document URIs
119
+ const documentUris: URI[] = Array.from(shared.workspace.LangiumDocuments.all).map(doc => doc.uri);
140
120
 
141
121
  return {
142
122
  model,
package/src/sdk/types.ts CHANGED
@@ -305,6 +305,29 @@ export interface RelationshipView {
305
305
  readonly astNode: Relationship;
306
306
  }
307
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
+
308
331
  /**
309
332
  * Internal index structure for O(1) lookups.
310
333
  * Not exported from public API.