@domainlang/language 0.1.82 → 0.4.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.
- package/README.md +18 -18
- package/out/domain-lang-module.d.ts +2 -0
- package/out/domain-lang-module.js +11 -3
- package/out/domain-lang-module.js.map +1 -1
- package/out/generated/ast.d.ts +8 -19
- package/out/generated/ast.js +1 -10
- package/out/generated/ast.js.map +1 -1
- package/out/generated/grammar.d.ts +1 -1
- package/out/generated/grammar.js +28 -123
- package/out/generated/grammar.js.map +1 -1
- package/out/generated/module.d.ts +1 -1
- package/out/generated/module.js +1 -1
- package/out/index.d.ts +3 -0
- package/out/index.js +5 -0
- package/out/index.js.map +1 -1
- package/out/lsp/domain-lang-code-actions.d.ts +55 -0
- package/out/lsp/domain-lang-code-actions.js +143 -0
- package/out/lsp/domain-lang-code-actions.js.map +1 -0
- package/out/lsp/domain-lang-workspace-manager.d.ts +21 -0
- package/out/lsp/domain-lang-workspace-manager.js +93 -0
- package/out/lsp/domain-lang-workspace-manager.js.map +1 -0
- package/out/lsp/hover/domain-lang-hover.js +0 -4
- package/out/lsp/hover/domain-lang-hover.js.map +1 -1
- package/out/lsp/manifest-diagnostics.d.ts +82 -0
- package/out/lsp/manifest-diagnostics.js +230 -0
- package/out/lsp/manifest-diagnostics.js.map +1 -0
- package/out/sdk/index.d.ts +1 -1
- package/out/sdk/loader-node.d.ts +7 -3
- package/out/sdk/loader-node.js +24 -9
- package/out/sdk/loader-node.js.map +1 -1
- package/out/sdk/types.d.ts +0 -21
- package/out/services/dependency-analyzer.d.ts +3 -39
- package/out/services/dependency-analyzer.js +22 -47
- package/out/services/dependency-analyzer.js.map +1 -1
- package/out/services/dependency-resolver.d.ts +68 -45
- package/out/services/dependency-resolver.js +243 -43
- package/out/services/dependency-resolver.js.map +1 -1
- package/out/services/git-url-resolver.browser.d.ts +4 -12
- package/out/services/git-url-resolver.browser.js +5 -1
- package/out/services/git-url-resolver.browser.js.map +1 -1
- package/out/services/git-url-resolver.d.ts +22 -56
- package/out/services/git-url-resolver.js +70 -36
- package/out/services/git-url-resolver.js.map +1 -1
- package/out/services/governance-validator.d.ts +1 -37
- package/out/services/governance-validator.js +4 -10
- package/out/services/governance-validator.js.map +1 -1
- package/out/services/import-resolver.d.ts +65 -6
- package/out/services/import-resolver.js +223 -5
- package/out/services/import-resolver.js.map +1 -1
- package/out/services/performance-optimizer.d.ts +1 -1
- package/out/services/semver.d.ts +98 -0
- package/out/services/semver.js +195 -0
- package/out/services/semver.js.map +1 -0
- package/out/services/types.d.ts +340 -0
- package/out/services/types.js +46 -0
- package/out/services/types.js.map +1 -0
- package/out/services/workspace-manager.d.ts +57 -10
- package/out/services/workspace-manager.js +187 -21
- package/out/services/workspace-manager.js.map +1 -1
- package/out/syntaxes/domain-lang.monarch.js +1 -1
- package/out/syntaxes/domain-lang.monarch.js.map +1 -1
- package/out/utils/import-utils.d.ts +4 -12
- package/out/utils/import-utils.js +35 -135
- package/out/utils/import-utils.js.map +1 -1
- package/out/validation/constants.d.ts +103 -0
- package/out/validation/constants.js +141 -2
- package/out/validation/constants.js.map +1 -1
- package/out/validation/domain.js +46 -1
- package/out/validation/domain.js.map +1 -1
- package/out/validation/import.d.ts +46 -22
- package/out/validation/import.js +187 -85
- package/out/validation/import.js.map +1 -1
- package/out/validation/manifest.d.ts +144 -0
- package/out/validation/manifest.js +327 -0
- package/out/validation/manifest.js.map +1 -0
- package/out/validation/maps.js +10 -6
- package/out/validation/maps.js.map +1 -1
- package/out/validation/metadata.js +5 -1
- package/out/validation/metadata.js.map +1 -1
- package/package.json +8 -6
- package/src/domain-lang-module.ts +18 -6
- package/src/domain-lang.langium +7 -12
- package/src/generated/ast.ts +7 -20
- package/src/generated/grammar.ts +28 -123
- package/src/generated/module.ts +1 -1
- package/src/index.ts +7 -0
- package/src/lsp/domain-lang-code-actions.ts +189 -0
- package/src/lsp/domain-lang-workspace-manager.ts +104 -0
- package/src/lsp/hover/domain-lang-hover.ts +0 -2
- package/src/lsp/manifest-diagnostics.ts +290 -0
- package/src/sdk/index.ts +0 -2
- package/src/sdk/loader-node.ts +29 -9
- package/src/sdk/types.ts +0 -23
- package/src/services/dependency-analyzer.ts +24 -84
- package/src/services/dependency-resolver.ts +301 -84
- package/src/services/git-url-resolver.browser.ts +9 -14
- package/src/services/git-url-resolver.ts +86 -93
- package/src/services/governance-validator.ts +5 -47
- package/src/services/import-resolver.ts +270 -8
- package/src/services/performance-optimizer.ts +1 -1
- package/src/services/semver.ts +213 -0
- package/src/services/types.ts +415 -0
- package/src/services/workspace-manager.ts +237 -46
- package/src/syntaxes/domain-lang.monarch.ts +1 -1
- package/src/utils/import-utils.ts +38 -160
- package/src/validation/constants.ts +182 -2
- package/src/validation/domain.ts +54 -1
- package/src/validation/import.ts +228 -104
- package/src/validation/manifest.ts +439 -0
- package/src/validation/maps.ts +10 -6
- package/src/validation/metadata.ts +5 -1
|
@@ -11,6 +11,39 @@
|
|
|
11
11
|
* - Clickable documentation link via CodeDescription
|
|
12
12
|
*/
|
|
13
13
|
import type { CodeDescription } from 'vscode-languageserver-types';
|
|
14
|
+
/**
|
|
15
|
+
* Diagnostic codes used to identify validation issues.
|
|
16
|
+
* Code actions match on these codes to provide quick fixes.
|
|
17
|
+
*
|
|
18
|
+
* Naming convention: CATEGORY_SPECIFIC_ISSUE
|
|
19
|
+
*/
|
|
20
|
+
export declare const IssueCodes: {
|
|
21
|
+
readonly ImportMissingUri: "import-missing-uri";
|
|
22
|
+
readonly ImportRequiresManifest: "import-requires-manifest";
|
|
23
|
+
readonly ImportNotInManifest: "import-not-in-manifest";
|
|
24
|
+
readonly ImportNotInstalled: "import-not-installed";
|
|
25
|
+
readonly ImportConflictingSourcePath: "import-conflicting-source-path";
|
|
26
|
+
readonly ImportMissingSourceOrPath: "import-missing-source-or-path";
|
|
27
|
+
readonly ImportMissingRef: "import-missing-ref";
|
|
28
|
+
readonly ImportAbsolutePath: "import-absolute-path";
|
|
29
|
+
readonly ImportEscapesWorkspace: "import-escapes-workspace";
|
|
30
|
+
readonly DomainNoVision: "domain-no-vision";
|
|
31
|
+
readonly DomainCircularHierarchy: "domain-circular-hierarchy";
|
|
32
|
+
readonly BoundedContextNoDescription: "bounded-context-no-description";
|
|
33
|
+
readonly BoundedContextNoDomain: "bounded-context-no-domain";
|
|
34
|
+
readonly BoundedContextClassificationConflict: "bounded-context-classification-conflict";
|
|
35
|
+
readonly BoundedContextTeamConflict: "bounded-context-team-conflict";
|
|
36
|
+
readonly SharedKernelNotBidirectional: "shared-kernel-not-bidirectional";
|
|
37
|
+
readonly AclOnWrongSide: "acl-on-wrong-side";
|
|
38
|
+
readonly ConformistOnWrongSide: "conformist-on-wrong-side";
|
|
39
|
+
readonly TooManyPatterns: "too-many-patterns";
|
|
40
|
+
readonly ContextMapNoContexts: "context-map-no-contexts";
|
|
41
|
+
readonly ContextMapNoRelationships: "context-map-no-relationships";
|
|
42
|
+
readonly DomainMapNoDomains: "domain-map-no-domains";
|
|
43
|
+
readonly MetadataMissingName: "metadata-missing-name";
|
|
44
|
+
readonly DuplicateElement: "duplicate-element";
|
|
45
|
+
};
|
|
46
|
+
export type IssueCode = typeof IssueCodes[keyof typeof IssueCodes];
|
|
14
47
|
/**
|
|
15
48
|
* Creates a CodeDescription for clickable documentation links in VS Code.
|
|
16
49
|
* @param docPath - Relative path from docs/ folder
|
|
@@ -23,6 +56,11 @@ export declare const ValidationMessages: {
|
|
|
23
56
|
* @param name - The name of the domain
|
|
24
57
|
*/
|
|
25
58
|
readonly DOMAIN_NO_VISION: (name: string) => string;
|
|
59
|
+
/**
|
|
60
|
+
* Error message when a circular domain hierarchy is detected.
|
|
61
|
+
* @param cycle - Array of domain names forming the cycle
|
|
62
|
+
*/
|
|
63
|
+
readonly DOMAIN_CIRCULAR_HIERARCHY: (cycle: string[]) => string;
|
|
26
64
|
/**
|
|
27
65
|
* Warning message when a bounded context lacks a description.
|
|
28
66
|
* @param name - The name of the bounded context
|
|
@@ -74,4 +112,69 @@ export declare const ValidationMessages: {
|
|
|
74
112
|
* Suggests possible syntax confusion.
|
|
75
113
|
*/
|
|
76
114
|
readonly TOO_MANY_PATTERNS: (count: number, side: "left" | "right") => string;
|
|
115
|
+
/**
|
|
116
|
+
* Error when import statement has no URI.
|
|
117
|
+
*/
|
|
118
|
+
readonly IMPORT_MISSING_URI: () => string;
|
|
119
|
+
/**
|
|
120
|
+
* Error when external dependency requires model.yaml but none exists.
|
|
121
|
+
* @param specifier - The import specifier (e.g., "core", "domainlang/patterns")
|
|
122
|
+
*/
|
|
123
|
+
readonly IMPORT_REQUIRES_MANIFEST: (specifier: string) => string;
|
|
124
|
+
/**
|
|
125
|
+
* Error when import specifier not found in manifest dependencies.
|
|
126
|
+
* @param alias - The dependency alias/specifier
|
|
127
|
+
*/
|
|
128
|
+
readonly IMPORT_NOT_IN_MANIFEST: (alias: string) => string;
|
|
129
|
+
/**
|
|
130
|
+
* Error when dependency not installed (no lock file entry).
|
|
131
|
+
* @param alias - The dependency alias
|
|
132
|
+
*/
|
|
133
|
+
readonly IMPORT_NOT_INSTALLED: (alias: string) => string;
|
|
134
|
+
/**
|
|
135
|
+
* Error when dependency has conflicting source and path definitions.
|
|
136
|
+
* @param alias - The dependency alias
|
|
137
|
+
*/
|
|
138
|
+
readonly IMPORT_CONFLICTING_SOURCE_PATH: (alias: string) => string;
|
|
139
|
+
/**
|
|
140
|
+
* Error when dependency is missing both source and path.
|
|
141
|
+
* @param alias - The dependency alias
|
|
142
|
+
*/
|
|
143
|
+
readonly IMPORT_MISSING_SOURCE_OR_PATH: (alias: string) => string;
|
|
144
|
+
/**
|
|
145
|
+
* Error when git dependency is missing ref (tag, branch, or commit).
|
|
146
|
+
* @param alias - The dependency alias
|
|
147
|
+
*/
|
|
148
|
+
readonly IMPORT_MISSING_REF: (alias: string) => string;
|
|
149
|
+
/**
|
|
150
|
+
* Error when local path uses absolute path.
|
|
151
|
+
* @param alias - The dependency alias
|
|
152
|
+
* @param absolutePath - The absolute path that was specified
|
|
153
|
+
*/
|
|
154
|
+
readonly IMPORT_ABSOLUTE_PATH: (alias: string, absolutePath: string) => string;
|
|
155
|
+
/**
|
|
156
|
+
* Error when local path escapes workspace boundary.
|
|
157
|
+
* @param alias - The dependency alias
|
|
158
|
+
*/
|
|
159
|
+
readonly IMPORT_ESCAPES_WORKSPACE: (alias: string) => string;
|
|
160
|
+
/**
|
|
161
|
+
* Warning when context map contains no bounded contexts.
|
|
162
|
+
* @param name - The context map name
|
|
163
|
+
*/
|
|
164
|
+
readonly CONTEXT_MAP_NO_CONTEXTS: (name: string) => string;
|
|
165
|
+
/**
|
|
166
|
+
* Info when context map has multiple contexts but no relationships.
|
|
167
|
+
* @param name - The context map name
|
|
168
|
+
* @param count - Number of contexts
|
|
169
|
+
*/
|
|
170
|
+
readonly CONTEXT_MAP_NO_RELATIONSHIPS: (name: string, count: number) => string;
|
|
171
|
+
/**
|
|
172
|
+
* Warning when domain map contains no domains.
|
|
173
|
+
* @param name - The domain map name
|
|
174
|
+
*/
|
|
175
|
+
readonly DOMAIN_MAP_NO_DOMAINS: (name: string) => string;
|
|
176
|
+
/**
|
|
177
|
+
* Error when metadata is missing a name.
|
|
178
|
+
*/
|
|
179
|
+
readonly METADATA_MISSING_NAME: () => string;
|
|
77
180
|
};
|
|
@@ -11,9 +11,51 @@
|
|
|
11
11
|
* - Clickable documentation link via CodeDescription
|
|
12
12
|
*/
|
|
13
13
|
// ============================================================================
|
|
14
|
+
// Issue Codes for Code Actions
|
|
15
|
+
// ============================================================================
|
|
16
|
+
/**
|
|
17
|
+
* Diagnostic codes used to identify validation issues.
|
|
18
|
+
* Code actions match on these codes to provide quick fixes.
|
|
19
|
+
*
|
|
20
|
+
* Naming convention: CATEGORY_SPECIFIC_ISSUE
|
|
21
|
+
*/
|
|
22
|
+
export const IssueCodes = {
|
|
23
|
+
// Import & Dependency Issues
|
|
24
|
+
ImportMissingUri: 'import-missing-uri',
|
|
25
|
+
ImportRequiresManifest: 'import-requires-manifest',
|
|
26
|
+
ImportNotInManifest: 'import-not-in-manifest',
|
|
27
|
+
ImportNotInstalled: 'import-not-installed',
|
|
28
|
+
ImportConflictingSourcePath: 'import-conflicting-source-path',
|
|
29
|
+
ImportMissingSourceOrPath: 'import-missing-source-or-path',
|
|
30
|
+
ImportMissingRef: 'import-missing-ref',
|
|
31
|
+
ImportAbsolutePath: 'import-absolute-path',
|
|
32
|
+
ImportEscapesWorkspace: 'import-escapes-workspace',
|
|
33
|
+
// Domain Issues
|
|
34
|
+
DomainNoVision: 'domain-no-vision',
|
|
35
|
+
DomainCircularHierarchy: 'domain-circular-hierarchy',
|
|
36
|
+
// Bounded Context Issues
|
|
37
|
+
BoundedContextNoDescription: 'bounded-context-no-description',
|
|
38
|
+
BoundedContextNoDomain: 'bounded-context-no-domain',
|
|
39
|
+
BoundedContextClassificationConflict: 'bounded-context-classification-conflict',
|
|
40
|
+
BoundedContextTeamConflict: 'bounded-context-team-conflict',
|
|
41
|
+
// Integration Pattern Issues
|
|
42
|
+
SharedKernelNotBidirectional: 'shared-kernel-not-bidirectional',
|
|
43
|
+
AclOnWrongSide: 'acl-on-wrong-side',
|
|
44
|
+
ConformistOnWrongSide: 'conformist-on-wrong-side',
|
|
45
|
+
TooManyPatterns: 'too-many-patterns',
|
|
46
|
+
// Context/Domain Map Issues
|
|
47
|
+
ContextMapNoContexts: 'context-map-no-contexts',
|
|
48
|
+
ContextMapNoRelationships: 'context-map-no-relationships',
|
|
49
|
+
DomainMapNoDomains: 'domain-map-no-domains',
|
|
50
|
+
// Metadata Issues
|
|
51
|
+
MetadataMissingName: 'metadata-missing-name',
|
|
52
|
+
// General Issues
|
|
53
|
+
DuplicateElement: 'duplicate-element'
|
|
54
|
+
};
|
|
55
|
+
// ============================================================================
|
|
14
56
|
// Documentation Link Utilities
|
|
15
57
|
// ============================================================================
|
|
16
|
-
const REPO_BASE = 'https://github.com/
|
|
58
|
+
const REPO_BASE = 'https://github.com/DomainLang/DomainLang/blob/main';
|
|
17
59
|
const DOCS_BASE = `${REPO_BASE}/dsl/domain-lang/docs`;
|
|
18
60
|
/**
|
|
19
61
|
* Builds a documentation URL for error messages.
|
|
@@ -38,6 +80,11 @@ export const ValidationMessages = {
|
|
|
38
80
|
* @param name - The name of the domain
|
|
39
81
|
*/
|
|
40
82
|
DOMAIN_NO_VISION: (name) => `Domain '${name}' is missing a vision statement.`,
|
|
83
|
+
/**
|
|
84
|
+
* Error message when a circular domain hierarchy is detected.
|
|
85
|
+
* @param cycle - Array of domain names forming the cycle
|
|
86
|
+
*/
|
|
87
|
+
DOMAIN_CIRCULAR_HIERARCHY: (cycle) => `Circular domain hierarchy detected: ${cycle.join(' → ')}.`,
|
|
41
88
|
/**
|
|
42
89
|
* Warning message when a bounded context lacks a description.
|
|
43
90
|
* @param name - The name of the bounded context
|
|
@@ -91,6 +138,98 @@ export const ValidationMessages = {
|
|
|
91
138
|
* Info message when relationship has too many integration patterns.
|
|
92
139
|
* Suggests possible syntax confusion.
|
|
93
140
|
*/
|
|
94
|
-
TOO_MANY_PATTERNS: (count, side) => `Too many integration patterns (${count}) on ${side} side. Typically use 1-2 patterns per side
|
|
141
|
+
TOO_MANY_PATTERNS: (count, side) => `Too many integration patterns (${count}) on ${side} side. Typically use 1-2 patterns per side.`,
|
|
142
|
+
// ========================================================================
|
|
143
|
+
// Import & Dependency Validation (PRS-010 Phase 8)
|
|
144
|
+
// ========================================================================
|
|
145
|
+
/**
|
|
146
|
+
* Error when import statement has no URI.
|
|
147
|
+
*/
|
|
148
|
+
IMPORT_MISSING_URI: () => `Import statement must have a URI. Use: import "package" or import "./local-path"`,
|
|
149
|
+
/**
|
|
150
|
+
* Error when external dependency requires model.yaml but none exists.
|
|
151
|
+
* @param specifier - The import specifier (e.g., "core", "domainlang/patterns")
|
|
152
|
+
*/
|
|
153
|
+
IMPORT_REQUIRES_MANIFEST: (specifier) => `External dependency '${specifier}' requires model.yaml.\n` +
|
|
154
|
+
`Hint: Create model.yaml and add the dependency:\n` +
|
|
155
|
+
` dependencies:\n` +
|
|
156
|
+
` ${specifier}:\n` +
|
|
157
|
+
` ref: v1.0.0`,
|
|
158
|
+
/**
|
|
159
|
+
* Error when import specifier not found in manifest dependencies.
|
|
160
|
+
* @param alias - The dependency alias/specifier
|
|
161
|
+
*/
|
|
162
|
+
IMPORT_NOT_IN_MANIFEST: (alias) => `Import '${alias}' not found in model.yaml dependencies.\n` +
|
|
163
|
+
`Hint: Run 'dlang add ${alias} <source>@<ref>' to add it, or manually add to model.yaml:\n` +
|
|
164
|
+
` dependencies:\n` +
|
|
165
|
+
` ${alias}:\n` +
|
|
166
|
+
` ref: v1.0.0`,
|
|
167
|
+
/**
|
|
168
|
+
* Error when dependency not installed (no lock file entry).
|
|
169
|
+
* @param alias - The dependency alias
|
|
170
|
+
*/
|
|
171
|
+
IMPORT_NOT_INSTALLED: (alias) => `Dependency '${alias}' not installed.\n` +
|
|
172
|
+
`Hint: Run 'dlang install' to fetch dependencies and generate model.lock.`,
|
|
173
|
+
/**
|
|
174
|
+
* Error when dependency has conflicting source and path definitions.
|
|
175
|
+
* @param alias - The dependency alias
|
|
176
|
+
*/
|
|
177
|
+
IMPORT_CONFLICTING_SOURCE_PATH: (alias) => `Dependency '${alias}' cannot define both 'source' and 'path' in model.yaml.\n` +
|
|
178
|
+
`Hint: Use 'source' for git-based packages or 'path' for local workspace packages.`,
|
|
179
|
+
/**
|
|
180
|
+
* Error when dependency is missing both source and path.
|
|
181
|
+
* @param alias - The dependency alias
|
|
182
|
+
*/
|
|
183
|
+
IMPORT_MISSING_SOURCE_OR_PATH: (alias) => `Dependency '${alias}' must define either 'source' or 'path' in model.yaml.\n` +
|
|
184
|
+
`Hint: Add 'source: owner/repo' for git packages, or 'path: ./local/path' for local packages.`,
|
|
185
|
+
/**
|
|
186
|
+
* Error when git dependency is missing ref (tag, branch, or commit).
|
|
187
|
+
* @param alias - The dependency alias
|
|
188
|
+
*/
|
|
189
|
+
IMPORT_MISSING_REF: (alias) => `Dependency '${alias}' must specify a git ref in model.yaml.\n` +
|
|
190
|
+
`Hint: Add a git ref: 'ref: v1.0.0' (tag), 'ref: main' (branch), or a commit SHA.`,
|
|
191
|
+
/**
|
|
192
|
+
* Error when local path uses absolute path.
|
|
193
|
+
* @param alias - The dependency alias
|
|
194
|
+
* @param absolutePath - The absolute path that was specified
|
|
195
|
+
*/
|
|
196
|
+
IMPORT_ABSOLUTE_PATH: (alias, absolutePath) => `Local path dependency '${alias}' cannot use absolute path '${absolutePath}'.\n` +
|
|
197
|
+
`Hint: Use a relative path from the workspace root, e.g., 'path: ./packages/shared'.`,
|
|
198
|
+
/**
|
|
199
|
+
* Error when local path escapes workspace boundary.
|
|
200
|
+
* @param alias - The dependency alias
|
|
201
|
+
*/
|
|
202
|
+
IMPORT_ESCAPES_WORKSPACE: (alias) => `Local path dependency '${alias}' escapes workspace boundary.\n` +
|
|
203
|
+
`Hint: Local dependencies must be within the workspace. Consider moving the dependency or using a git-based source.`,
|
|
204
|
+
// ========================================================================
|
|
205
|
+
// Context Map & Domain Map Validation
|
|
206
|
+
// ========================================================================
|
|
207
|
+
/**
|
|
208
|
+
* Warning when context map contains no bounded contexts.
|
|
209
|
+
* @param name - The context map name
|
|
210
|
+
*/
|
|
211
|
+
CONTEXT_MAP_NO_CONTEXTS: (name) => `Context Map '${name}' contains no bounded contexts.\n` +
|
|
212
|
+
`Hint: Use 'contains ContextA, ContextB' to specify which contexts are in the map.`,
|
|
213
|
+
/**
|
|
214
|
+
* Info when context map has multiple contexts but no relationships.
|
|
215
|
+
* @param name - The context map name
|
|
216
|
+
* @param count - Number of contexts
|
|
217
|
+
*/
|
|
218
|
+
CONTEXT_MAP_NO_RELATIONSHIPS: (name, count) => `Context Map '${name}' contains ${count} contexts but no documented relationships.\n` +
|
|
219
|
+
`Hint: Add relationships to show how contexts integrate (e.g., '[OHS] A -> [CF] B').`,
|
|
220
|
+
/**
|
|
221
|
+
* Warning when domain map contains no domains.
|
|
222
|
+
* @param name - The domain map name
|
|
223
|
+
*/
|
|
224
|
+
DOMAIN_MAP_NO_DOMAINS: (name) => `Domain Map '${name}' contains no domains.\n` +
|
|
225
|
+
`Hint: Use 'contains DomainA, DomainB' to specify which domains are in the map.`,
|
|
226
|
+
// ========================================================================
|
|
227
|
+
// Metadata Validation
|
|
228
|
+
// ========================================================================
|
|
229
|
+
/**
|
|
230
|
+
* Error when metadata is missing a name.
|
|
231
|
+
*/
|
|
232
|
+
METADATA_MISSING_NAME: () => `Metadata must have a name.\n` +
|
|
233
|
+
`Hint: Define metadata with: Metadata MyMetadata { ... }`
|
|
95
234
|
};
|
|
96
235
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/validation/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,+EAA+E;AAC/E,+BAA+B;AAC/B,+EAA+E;AAE/E,MAAM,SAAS,GAAG,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/validation/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,+EAA+E;AAC/E,+BAA+B;AAC/B,+EAA+E;AAE/E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACtB,6BAA6B;IAC7B,gBAAgB,EAAE,oBAAoB;IACtC,sBAAsB,EAAE,0BAA0B;IAClD,mBAAmB,EAAE,wBAAwB;IAC7C,kBAAkB,EAAE,sBAAsB;IAC1C,2BAA2B,EAAE,gCAAgC;IAC7D,yBAAyB,EAAE,+BAA+B;IAC1D,gBAAgB,EAAE,oBAAoB;IACtC,kBAAkB,EAAE,sBAAsB;IAC1C,sBAAsB,EAAE,0BAA0B;IAElD,gBAAgB;IAChB,cAAc,EAAE,kBAAkB;IAClC,uBAAuB,EAAE,2BAA2B;IAEpD,yBAAyB;IACzB,2BAA2B,EAAE,gCAAgC;IAC7D,sBAAsB,EAAE,2B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,mCAAmC;QACvD,mFAAmF;IAEvF;;;;OAIG;IACH,4BAA4B,EAAE,CAAC,IAAY,EAAE,KAAa,EAAE,EAAE,CAC1D,gBAAgB,IAAI,cAAc,KAAK,8CAA8C;QACrF,qFAAqF;IAEzF;;;OAGG;IACH,qBAAqB,EAAE,CAAC,IAAY,EAAE,EAAE,CACpC,eAAe,IAAI,0BAA0B;QAC7C,gFAAgF;IAEpF,2EAA2E;IAC3E,sBAAsB;IACtB,2EAA2E;IAE3E;;OAEG;IACH,qBAAqB,EAAE,GAAG,EAAE,CACxB,8BAA8B;QAC9B,yDAAyD;CACvD,CAAC"}
|
package/out/validation/domain.js
CHANGED
|
@@ -14,5 +14,50 @@ function validateDomainHasVision(domain, accept) {
|
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Validates that a domain hierarchy does not contain circular references.
|
|
19
|
+
*
|
|
20
|
+
* The `Domain A in B` syntax expresses subdomain containment.
|
|
21
|
+
* Circular containment (A in B, B in C, C in A) is semantically invalid
|
|
22
|
+
* because it violates the fundamental concept of domain decomposition.
|
|
23
|
+
*
|
|
24
|
+
* @param domain - The domain to validate
|
|
25
|
+
* @param accept - The validation acceptor for reporting issues
|
|
26
|
+
*/
|
|
27
|
+
function validateNoCyclicDomainHierarchy(domain, accept) {
|
|
28
|
+
// Only check if this domain has a parent
|
|
29
|
+
if (!domain.parent?.ref) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const visited = new Set();
|
|
33
|
+
const path = [domain.name];
|
|
34
|
+
let current = domain.parent.ref;
|
|
35
|
+
while (current) {
|
|
36
|
+
// Check if we've encountered this domain before (cycle detected)
|
|
37
|
+
if (visited.has(current)) {
|
|
38
|
+
// We found a cycle - report it
|
|
39
|
+
path.push(current.name);
|
|
40
|
+
accept('error', ValidationMessages.DOMAIN_CIRCULAR_HIERARCHY(path), {
|
|
41
|
+
node: domain,
|
|
42
|
+
property: 'parent',
|
|
43
|
+
codeDescription: buildCodeDescription('language.md', 'domain-hierarchy')
|
|
44
|
+
});
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
// Check if we've looped back to the starting domain
|
|
48
|
+
if (current === domain) {
|
|
49
|
+
path.push(domain.name);
|
|
50
|
+
accept('error', ValidationMessages.DOMAIN_CIRCULAR_HIERARCHY(path), {
|
|
51
|
+
node: domain,
|
|
52
|
+
property: 'parent',
|
|
53
|
+
codeDescription: buildCodeDescription('language.md', 'domain-hierarchy')
|
|
54
|
+
});
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
visited.add(current);
|
|
58
|
+
path.push(current.name);
|
|
59
|
+
current = current.parent?.ref;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
export const domainChecks = [validateDomainHasVision, validateNoCyclicDomainHierarchy];
|
|
18
63
|
//# sourceMappingURL=domain.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domain.js","sourceRoot":"","sources":["../../src/validation/domain.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE1E;;;;;GAKG;AACH,SAAS,uBAAuB,CAC5B,MAAc,EACd,MAA0B;IAE1B,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QACjB,MAAM,CAAC,SAAS,EAAE,kBAAkB,CAAC,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;YAChE,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,QAAQ;YACjB,eAAe,EAAE,oBAAoB,CAAC,aAAa,EAAE,eAAe,CAAC;SACxE,CAAC,CAAC;IACP,CAAC;AACL,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,uBAAuB,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"domain.js","sourceRoot":"","sources":["../../src/validation/domain.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE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AC,IAAI,CAAC,CAAC;YACvB,MAAM,CAAC,OAAO,EAAE,kBAAkB,CAAC,yBAAyB,CAAC,IAAI,CAAC,EAAE;gBAChE,IAAI,EAAE,MAAM;gBACZ,QAAQ,EAAE,QAAQ;gBAClB,eAAe,EAAE,oBAAoB,CAAC,aAAa,EAAE,kBAAkB,CAAC;aAC3E,CAAC,CAAC;YACH,OAAO;QACX,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACrB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACxB,OAAO,GAAG,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;IAClC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,uBAAuB,EAAE,+BAA+B,CAAC,CAAC"}
|
|
@@ -1,44 +1,68 @@
|
|
|
1
1
|
import type { ValidationAcceptor, ValidationChecks } from 'langium';
|
|
2
|
-
import
|
|
2
|
+
import { Cancellation } from 'langium';
|
|
3
|
+
import type { DomainLangAstType, ImportStatement } from '../generated/ast.js';
|
|
3
4
|
import type { DomainLangServices } from '../domain-lang-module.js';
|
|
4
5
|
import type { LangiumDocument } from 'langium';
|
|
5
6
|
/**
|
|
6
7
|
* Validates import statements in DomainLang.
|
|
7
8
|
*
|
|
9
|
+
* Uses async validators (Langium 4.x supports MaybePromise<void>) to leverage
|
|
10
|
+
* the shared WorkspaceManager service with its cached manifest/lock file reading.
|
|
11
|
+
*
|
|
8
12
|
* Checks:
|
|
9
|
-
* -
|
|
10
|
-
* -
|
|
11
|
-
* -
|
|
13
|
+
* - External imports require manifest + alias
|
|
14
|
+
* - Local path dependencies stay inside workspace
|
|
15
|
+
* - Lock file exists for external dependencies
|
|
12
16
|
*/
|
|
13
17
|
export declare class ImportValidator {
|
|
14
|
-
private readonly
|
|
18
|
+
private readonly workspaceManager;
|
|
15
19
|
constructor(services: DomainLangServices);
|
|
16
20
|
/**
|
|
17
|
-
* Validates
|
|
21
|
+
* Validates an import statement asynchronously.
|
|
22
|
+
*
|
|
23
|
+
* Langium validators can return MaybePromise<void>, enabling async operations
|
|
24
|
+
* like reading manifests via the shared, cached WorkspaceManager.
|
|
18
25
|
*/
|
|
19
|
-
checkImportPath(imp: ImportStatement, accept: ValidationAcceptor, document: LangiumDocument): Promise<void>;
|
|
26
|
+
checkImportPath(imp: ImportStatement, accept: ValidationAcceptor, document: LangiumDocument, _cancelToken: Cancellation.CancellationToken): Promise<void>;
|
|
20
27
|
/**
|
|
21
|
-
*
|
|
28
|
+
* Determines if an import URI is external (requires manifest).
|
|
29
|
+
*
|
|
30
|
+
* Per PRS-010:
|
|
31
|
+
* - Local relative: ./path, ../path
|
|
32
|
+
* - Path aliases: @/path, @alias/path (resolved via manifest paths section)
|
|
33
|
+
* - External: owner/package (requires manifest dependencies)
|
|
22
34
|
*/
|
|
23
|
-
|
|
35
|
+
private isExternalImport;
|
|
24
36
|
/**
|
|
25
|
-
* Gets
|
|
26
|
-
*
|
|
27
|
-
* In DomainLang, top-level declarations are implicitly exported:
|
|
28
|
-
* - Domains
|
|
29
|
-
* - BoundedContexts
|
|
30
|
-
* - Classifications
|
|
31
|
-
* - Groups
|
|
37
|
+
* Gets the normalized dependency configuration for an alias.
|
|
32
38
|
*/
|
|
33
|
-
private
|
|
39
|
+
private getDependency;
|
|
34
40
|
/**
|
|
35
|
-
*
|
|
36
|
-
|
|
37
|
-
|
|
41
|
+
* Validates dependency configuration.
|
|
42
|
+
*/
|
|
43
|
+
private validateDependencyConfig;
|
|
44
|
+
/**
|
|
45
|
+
* Validates local path dependencies stay within workspace.
|
|
38
46
|
*/
|
|
39
|
-
|
|
47
|
+
private validateLocalPathDependency;
|
|
48
|
+
/**
|
|
49
|
+
* Validates that external dependency is in lock file and cached.
|
|
50
|
+
*/
|
|
51
|
+
private validateCachedPackage;
|
|
52
|
+
/**
|
|
53
|
+
* Gets the cache directory for a dependency.
|
|
54
|
+
* Per PRS-010: Project-local cache at .dlang/packages/{owner}/{repo}/{commit}/
|
|
55
|
+
*/
|
|
56
|
+
private getCacheDirectory;
|
|
57
|
+
/**
|
|
58
|
+
* Checks if a directory exists (async).
|
|
59
|
+
*/
|
|
60
|
+
private directoryExists;
|
|
40
61
|
}
|
|
41
62
|
/**
|
|
42
63
|
* Creates validation checks for import statements.
|
|
64
|
+
*
|
|
65
|
+
* Returns async validators that leverage the shared WorkspaceManager
|
|
66
|
+
* for cached manifest/lock file reading.
|
|
43
67
|
*/
|
|
44
|
-
export declare function createImportChecks(
|
|
68
|
+
export declare function createImportChecks(services: DomainLangServices): ValidationChecks<DomainLangAstType>;
|