@domainlang/language 0.11.0 → 0.13.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/out/ast-augmentation.d.ts +7 -2
- package/out/diagram/context-map-diagram-generator.d.ts +72 -0
- package/out/diagram/context-map-diagram-generator.js +405 -0
- package/out/diagram/context-map-diagram-generator.js.map +1 -0
- package/out/diagram/context-map-layout-configurator.d.ts +15 -0
- package/out/diagram/context-map-layout-configurator.js +39 -0
- package/out/diagram/context-map-layout-configurator.js.map +1 -0
- package/out/diagram/elk-layout-factory.d.ts +43 -0
- package/out/diagram/elk-layout-factory.js +64 -0
- package/out/diagram/elk-layout-factory.js.map +1 -0
- package/out/domain-lang-module.d.ts +7 -0
- package/out/domain-lang-module.js +11 -2
- package/out/domain-lang-module.js.map +1 -1
- package/out/generated/ast.d.ts +323 -51
- package/out/generated/ast.js +194 -33
- package/out/generated/ast.js.map +1 -1
- package/out/generated/grammar.js +418 -172
- package/out/generated/grammar.js.map +1 -1
- package/out/index.d.ts +3 -0
- package/out/index.js +4 -0
- package/out/index.js.map +1 -1
- package/out/lsp/domain-lang-code-lens-provider.d.ts +8 -0
- package/out/lsp/domain-lang-code-lens-provider.js +48 -0
- package/out/lsp/domain-lang-code-lens-provider.js.map +1 -0
- package/out/lsp/domain-lang-completion.js +39 -15
- package/out/lsp/domain-lang-completion.js.map +1 -1
- package/out/lsp/domain-lang-document-symbol-provider.js +5 -5
- package/out/lsp/domain-lang-document-symbol-provider.js.map +1 -1
- package/out/lsp/domain-lang-formatter.js +32 -0
- package/out/lsp/domain-lang-formatter.js.map +1 -1
- package/out/lsp/domain-lang-index-manager.d.ts +2 -3
- package/out/lsp/domain-lang-index-manager.js +5 -8
- package/out/lsp/domain-lang-index-manager.js.map +1 -1
- package/out/lsp/domain-lang-workspace-manager.d.ts +1 -1
- package/out/lsp/domain-lang-workspace-manager.js +2 -26
- package/out/lsp/domain-lang-workspace-manager.js.map +1 -1
- package/out/lsp/explain.js +9 -3
- package/out/lsp/explain.js.map +1 -1
- package/out/lsp/hover/domain-lang-hover.js +13 -11
- package/out/lsp/hover/domain-lang-hover.js.map +1 -1
- package/out/lsp/hover/domain-lang-keywords.js +29 -26
- package/out/lsp/hover/domain-lang-keywords.js.map +1 -1
- package/out/lsp/tool-handlers.js +63 -57
- package/out/lsp/tool-handlers.js.map +1 -1
- package/out/sdk/ast-augmentation.d.ts +29 -21
- package/out/sdk/ast-augmentation.js +11 -7
- package/out/sdk/ast-augmentation.js.map +1 -1
- package/out/sdk/index.d.ts +2 -2
- package/out/sdk/index.js +1 -1
- package/out/sdk/index.js.map +1 -1
- package/out/sdk/loader-node.js +2 -2
- package/out/sdk/loader-node.js.map +1 -1
- package/out/sdk/patterns.d.ts +50 -61
- package/out/sdk/patterns.js +92 -62
- package/out/sdk/patterns.js.map +1 -1
- package/out/sdk/query.js +54 -43
- package/out/sdk/query.js.map +1 -1
- package/out/sdk/serializers.js +20 -7
- package/out/sdk/serializers.js.map +1 -1
- package/out/sdk/types.d.ts +87 -18
- package/out/sdk/types.js.map +1 -1
- package/out/sdk/validator.js +48 -64
- package/out/sdk/validator.js.map +1 -1
- package/out/services/performance-optimizer.d.ts +3 -3
- package/out/services/performance-optimizer.js +1 -3
- package/out/services/performance-optimizer.js.map +1 -1
- package/out/services/relationship-inference.d.ts +4 -4
- package/out/services/relationship-inference.js +34 -46
- package/out/services/relationship-inference.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 +6 -20
- package/out/utils/import-utils.js +3 -63
- package/out/utils/import-utils.js.map +1 -1
- package/out/validation/constants.d.ts +23 -6
- package/out/validation/constants.js +24 -7
- package/out/validation/constants.js.map +1 -1
- package/out/validation/maps.js +10 -4
- package/out/validation/maps.js.map +1 -1
- package/out/validation/relationships.d.ts +4 -8
- package/out/validation/relationships.js +96 -48
- package/out/validation/relationships.js.map +1 -1
- package/package.json +5 -2
- package/src/ast-augmentation.ts +7 -2
- package/src/diagram/context-map-diagram-generator.ts +513 -0
- package/src/diagram/context-map-layout-configurator.ts +43 -0
- package/src/diagram/elk-layout-factory.ts +83 -0
- package/src/domain-lang-module.ts +19 -2
- package/src/domain-lang.langium +62 -26
- package/src/generated/ast.ts +413 -63
- package/src/generated/grammar.ts +418 -172
- package/src/index.ts +5 -0
- package/src/lsp/domain-lang-code-lens-provider.ts +54 -0
- package/src/lsp/domain-lang-completion.ts +42 -15
- package/src/lsp/domain-lang-document-symbol-provider.ts +5 -5
- package/src/lsp/domain-lang-formatter.ts +34 -0
- package/src/lsp/domain-lang-index-manager.ts +6 -9
- package/src/lsp/domain-lang-workspace-manager.ts +3 -29
- package/src/lsp/explain.ts +10 -2
- package/src/lsp/hover/domain-lang-hover.ts +10 -8
- package/src/lsp/hover/domain-lang-keywords.ts +27 -24
- package/src/lsp/tool-handlers.ts +61 -47
- package/src/sdk/ast-augmentation.ts +30 -21
- package/src/sdk/index.ts +11 -1
- package/src/sdk/loader-node.ts +2 -2
- package/src/sdk/patterns.ts +114 -76
- package/src/sdk/query.ts +57 -48
- package/src/sdk/serializers.ts +20 -7
- package/src/sdk/types.ts +92 -17
- package/src/sdk/validator.ts +52 -69
- package/src/services/performance-optimizer.ts +4 -6
- package/src/services/relationship-inference.ts +43 -54
- package/src/utils/import-utils.ts +9 -74
- package/src/validation/constants.ts +32 -9
- package/src/validation/maps.ts +12 -4
- package/src/validation/relationships.ts +150 -71
|
@@ -46,15 +46,19 @@
|
|
|
46
46
|
* - `fqn` - Computed fully qualified name
|
|
47
47
|
* - `hasType(name)` - Check type matches
|
|
48
48
|
*
|
|
49
|
-
* **Properties added to
|
|
50
|
-
* - `
|
|
51
|
-
* - `
|
|
52
|
-
* - `
|
|
49
|
+
* **Properties added to DirectionalRelationship:**
|
|
50
|
+
* - `isBidirectional` - Check if relationship is bidirectional (`<->`)
|
|
51
|
+
* - `leftContextName` - Resolved name of left context (handles `this`)
|
|
52
|
+
* - `rightContextName` - Resolved name of right context (handles `this`)
|
|
53
|
+
* - `hasPattern(patternType)` - Check if pattern exists on either side
|
|
54
|
+
* - `hasLeftPattern(patternType)` - Check left patterns
|
|
55
|
+
* - `hasRightPattern(patternType)` - Check right patterns
|
|
53
56
|
* - `isUpstream(side)` - Check if side is upstream
|
|
54
57
|
* - `isDownstream(side)` - Check if side is downstream
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* - `
|
|
58
|
+
*
|
|
59
|
+
* **Properties added to SymmetricRelationship:**
|
|
60
|
+
* - `leftContextName` - Resolved name of left context (handles `this`)
|
|
61
|
+
* - `rightContextName` - Resolved name of right context (handles `this`)
|
|
58
62
|
*
|
|
59
63
|
* @module sdk/ast-augmentation
|
|
60
64
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ast-augmentation.js","sourceRoot":"","sources":["../../src/sdk/ast-augmentation.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ast-augmentation.js","sourceRoot":"","sources":["../../src/sdk/ast-augmentation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG"}
|
package/out/sdk/index.d.ts
CHANGED
|
@@ -106,9 +106,9 @@
|
|
|
106
106
|
export { loadModelFromText, createModelLoader } from './loader.js';
|
|
107
107
|
export type { ModelLoader } from './loader.js';
|
|
108
108
|
export { fromModel, fromDocument, fromServices, augmentModel } from './query.js';
|
|
109
|
-
export { Pattern, PatternFullName, PatternAliases, matchesPattern, isUpstreamPattern, isDownstreamPattern, isMutualPattern, UpstreamPatterns, DownstreamPatterns,
|
|
109
|
+
export { Pattern, PatternFullName, PatternAbbreviation, PatternAliases, matchesPattern, isUpstreamPattern, isDownstreamPattern, isMutualPattern, isUpstreamSidePattern, isDownstreamSidePattern, isBBoMSidePattern, getPatternAbbreviation, UpstreamPatterns, DownstreamPatterns, SymmetricPatterns, } from './patterns.js';
|
|
110
110
|
export type { IntegrationPattern } from './patterns.js';
|
|
111
|
-
export type { Query, QueryBuilder, QueryContext, LoadOptions, BcQueryBuilder, RelationshipView, } from './types.js';
|
|
111
|
+
export type { Query, QueryBuilder, QueryContext, LoadOptions, BcQueryBuilder, RelationshipView, RelationshipSide, DirectionalRelationshipView, DirectionalKind, SymmetricRelationshipView, SymmetricKind, } from './types.js';
|
|
112
112
|
export { serializeNode, serializeRelationship, resolveName, resolveMultiReference, normalizeEntityType, ENTITY_ALIASES, } from './serializers.js';
|
|
113
113
|
export type { QueryEntityType, QueryEntityInput, QueryFilters } from './serializers.js';
|
|
114
114
|
export { loadModel } from './loader-node.js';
|
package/out/sdk/index.js
CHANGED
|
@@ -109,7 +109,7 @@ export { fromModel, fromDocument, fromServices, augmentModel } from './query.js'
|
|
|
109
109
|
// Note: loadModel() is NOT exported here - it requires Node.js filesystem
|
|
110
110
|
// For CLI/Node.js usage: import { loadModel } from '@domainlang/language/sdk/loader-node';
|
|
111
111
|
// Integration patterns for type-safe pattern matching (no magic strings)
|
|
112
|
-
export { Pattern, PatternFullName, PatternAliases, matchesPattern, isUpstreamPattern, isDownstreamPattern, isMutualPattern, UpstreamPatterns, DownstreamPatterns,
|
|
112
|
+
export { Pattern, PatternFullName, PatternAbbreviation, PatternAliases, matchesPattern, isUpstreamPattern, isDownstreamPattern, isMutualPattern, isUpstreamSidePattern, isDownstreamSidePattern, isBBoMSidePattern, getPatternAbbreviation, UpstreamPatterns, DownstreamPatterns, SymmetricPatterns, } from './patterns.js';
|
|
113
113
|
// Serializers for tool responses (browser-safe)
|
|
114
114
|
export { serializeNode, serializeRelationship, resolveName, resolveMultiReference, normalizeEntityType, ENTITY_ALIASES, } from './serializers.js';
|
|
115
115
|
// Node.js-specific exports (will fail in browser environments)
|
package/out/sdk/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sdk/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwGG;AAEH,4BAA4B;AAC5B,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEnE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAEjF,0EAA0E;AAC1E,2FAA2F;AAE3F,yEAAyE;AACzE,OAAO,EACH,OAAO,EACP,eAAe,EACf,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sdk/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwGG;AAEH,4BAA4B;AAC5B,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEnE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAEjF,0EAA0E;AAC1E,2FAA2F;AAE3F,yEAAyE;AACzE,OAAO,EACH,OAAO,EACP,eAAe,EACf,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,iBAAiB,EACjB,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,GACpB,MAAM,eAAe,CAAC;AAuBvB,gDAAgD;AAChD,OAAO,EACH,aAAa,EACb,qBAAqB,EACrB,WAAW,EACX,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,GACjB,MAAM,kBAAkB,CAAC;AAG1B,+DAA+D;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC"}
|
package/out/sdk/loader-node.js
CHANGED
|
@@ -55,7 +55,7 @@ import { ensureImportGraphFromDocument } from '../utils/import-utils.js';
|
|
|
55
55
|
*/
|
|
56
56
|
export async function loadModel(entryFile, options) {
|
|
57
57
|
// Resolve absolute path
|
|
58
|
-
const path = await import('path');
|
|
58
|
+
const path = await import('node:path');
|
|
59
59
|
const absolutePath = path.isAbsolute(entryFile)
|
|
60
60
|
? entryFile
|
|
61
61
|
: path.resolve(options?.workspaceDir ?? process.cwd(), entryFile);
|
|
@@ -71,7 +71,7 @@ export async function loadModel(entryFile, options) {
|
|
|
71
71
|
await workspaceManager.initialize(options.workspaceDir);
|
|
72
72
|
}
|
|
73
73
|
// Read file content and create document
|
|
74
|
-
const fs = await import('fs/promises');
|
|
74
|
+
const fs = await import('node:fs/promises');
|
|
75
75
|
const fileContent = await fs.readFile(absolutePath, 'utf-8');
|
|
76
76
|
const uri = URI.file(absolutePath);
|
|
77
77
|
// Use proper Langium document creation
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader-node.js","sourceRoot":"","sources":["../../src/sdk/loader-node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAEpE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AACrD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CAAC,EAAE,CAAC;YACpB,YAAY,CAAC,QAAQ,CAAC,CAAC;QAC3B,CAAC;IACL,CAAC;IAED,kDAAkD;IAClD,MAAM,YAAY,GAAU,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAEtF,OAAO;QACH,KAAK;QACL,SAAS,EAAE,YAAY;QACvB,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC;KAC1B,CAAC;AACN,CAAC;AAED,iCAAiC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
package/out/sdk/patterns.d.ts
CHANGED
|
@@ -1,93 +1,82 @@
|
|
|
1
|
+
import type { SidePattern, SymmetricPattern } from '../generated/ast.js';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* Use these constants instead of magic strings when checking relationship patterns.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```typescript
|
|
8
|
-
* import { Pattern } from '../sdk/patterns.js';
|
|
9
|
-
*
|
|
10
|
-
* // Instead of: hasPattern('SK') or hasPattern('SharedKernel')
|
|
11
|
-
* // Use:
|
|
12
|
-
* if (relationship.hasPattern(Pattern.SharedKernel)) {
|
|
13
|
-
* // ...
|
|
14
|
-
* }
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
/**
|
|
18
|
-
* Integration pattern abbreviations as used in the grammar.
|
|
19
|
-
* These are the canonical abbreviations recognized by DomainLang.
|
|
3
|
+
* Pattern constants for programmatic use.
|
|
4
|
+
* Values match the AST $type names.
|
|
20
5
|
*/
|
|
21
6
|
export declare const Pattern: {
|
|
22
|
-
/** Open Host Service - exposes a clean API for consumers */
|
|
23
|
-
readonly OHS: "OHS";
|
|
24
|
-
/** Published Language - shared data format/protocol */
|
|
25
|
-
readonly PL: "PL";
|
|
26
|
-
/** Conformist - accepts upstream model without translation */
|
|
27
|
-
readonly CF: "CF";
|
|
28
|
-
/** Anti-Corruption Layer - translates upstream model */
|
|
29
|
-
readonly ACL: "ACL";
|
|
30
|
-
/** Shared Kernel - shared code/model ownership */
|
|
31
|
-
readonly SK: "SK";
|
|
32
|
-
/** Partnership - coordinated development */
|
|
33
|
-
readonly P: "P";
|
|
34
|
-
/** Customer/Supplier - negotiated contract */
|
|
35
|
-
readonly CustomerSupplier: "Customer/Supplier";
|
|
36
|
-
/** Separate Ways - no integration */
|
|
37
|
-
readonly SeparateWays: "Separate Ways";
|
|
38
|
-
/** Big Ball of Mud - legacy or unstructured */
|
|
39
|
-
readonly BigBallOfMud: "Big Ball of Mud";
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* Full names for integration patterns.
|
|
43
|
-
* Used when patterns are spelled out in documentation blocks.
|
|
44
|
-
*/
|
|
45
|
-
export declare const PatternFullName: {
|
|
46
7
|
readonly OHS: "OpenHostService";
|
|
47
8
|
readonly PL: "PublishedLanguage";
|
|
48
9
|
readonly CF: "Conformist";
|
|
49
10
|
readonly ACL: "AntiCorruptionLayer";
|
|
11
|
+
readonly S: "Supplier";
|
|
12
|
+
readonly C: "Customer";
|
|
13
|
+
readonly BBoM: "BigBallOfMud";
|
|
50
14
|
readonly SK: "SharedKernel";
|
|
51
15
|
readonly P: "Partnership";
|
|
16
|
+
readonly SW: "SeparateWays";
|
|
52
17
|
};
|
|
53
18
|
/**
|
|
54
|
-
* Mapping from
|
|
19
|
+
* Mapping from short abbreviation to full $type name.
|
|
55
20
|
*/
|
|
56
|
-
export declare const
|
|
21
|
+
export declare const PatternFullName: Record<string, string>;
|
|
57
22
|
/**
|
|
58
|
-
*
|
|
23
|
+
* Mapping from $type name to short abbreviation.
|
|
59
24
|
*/
|
|
60
|
-
export
|
|
25
|
+
export declare const PatternAbbreviation: Record<string, string>;
|
|
61
26
|
/**
|
|
62
|
-
*
|
|
63
|
-
* Handles both abbreviations and full names case-insensitively.
|
|
64
|
-
*
|
|
65
|
-
* @param actual - Pattern string from the AST
|
|
66
|
-
* @param expected - Pattern to match (abbreviation or full name)
|
|
67
|
-
* @returns true if patterns match
|
|
27
|
+
* All short+long forms that map to a given canonical $type name.
|
|
68
28
|
*/
|
|
69
|
-
export declare
|
|
29
|
+
export declare const PatternAliases: Record<string, readonly string[]>;
|
|
30
|
+
/** Union of all pattern type names */
|
|
31
|
+
export type IntegrationPattern = typeof Pattern[keyof typeof Pattern];
|
|
70
32
|
/**
|
|
71
|
-
*
|
|
33
|
+
* Checks if a pattern name matches an expected pattern.
|
|
34
|
+
* Works with both $type names and short abbreviations.
|
|
72
35
|
*/
|
|
36
|
+
export declare function matchesPattern(actual: string, expected: string): boolean;
|
|
37
|
+
/** Side patterns that belong on the upstream side */
|
|
73
38
|
export declare const UpstreamPatterns: readonly string[];
|
|
39
|
+
/** Side patterns that belong on the downstream side */
|
|
40
|
+
export declare const DownstreamPatterns: readonly string[];
|
|
41
|
+
/** Symmetric patterns (mutual) */
|
|
42
|
+
export declare const SymmetricPatterns: readonly string[];
|
|
74
43
|
/**
|
|
75
|
-
*
|
|
44
|
+
* Checks if a side pattern AST node is an upstream pattern.
|
|
76
45
|
*/
|
|
77
|
-
export declare
|
|
46
|
+
export declare function isUpstreamSidePattern(pattern: SidePattern): boolean;
|
|
78
47
|
/**
|
|
79
|
-
*
|
|
48
|
+
* Checks if a side pattern AST node is a downstream pattern.
|
|
80
49
|
*/
|
|
81
|
-
export declare
|
|
50
|
+
export declare function isDownstreamSidePattern(pattern: SidePattern): boolean;
|
|
82
51
|
/**
|
|
83
|
-
* Checks if a pattern is
|
|
52
|
+
* Checks if a side pattern AST node is a Big Ball of Mud.
|
|
53
|
+
*/
|
|
54
|
+
export declare function isBBoMSidePattern(pattern: SidePattern): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Checks if a pattern string name is an upstream pattern.
|
|
84
57
|
*/
|
|
85
58
|
export declare function isUpstreamPattern(pattern: string): boolean;
|
|
86
59
|
/**
|
|
87
|
-
* Checks if a pattern is
|
|
60
|
+
* Checks if a pattern string name is a downstream pattern.
|
|
88
61
|
*/
|
|
89
62
|
export declare function isDownstreamPattern(pattern: string): boolean;
|
|
90
63
|
/**
|
|
91
|
-
* Checks if a pattern
|
|
64
|
+
* Checks if a pattern string name is a mutual/symmetric pattern.
|
|
92
65
|
*/
|
|
93
66
|
export declare function isMutualPattern(pattern: string): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Gets the short abbreviation for a pattern $type name.
|
|
69
|
+
*/
|
|
70
|
+
export declare function getPatternAbbreviation(typeName: string): string;
|
|
71
|
+
/**
|
|
72
|
+
* Checks if a symmetric pattern is a Shared Kernel.
|
|
73
|
+
*/
|
|
74
|
+
export declare function isSharedKernelPattern(pattern: SymmetricPattern): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Checks if a symmetric pattern is a Partnership.
|
|
77
|
+
*/
|
|
78
|
+
export declare function isPartnershipPattern(pattern: SymmetricPattern): boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Checks if a symmetric pattern is Separate Ways.
|
|
81
|
+
*/
|
|
82
|
+
export declare function isSeparateWaysPattern(pattern: SymmetricPattern): boolean;
|
package/out/sdk/patterns.js
CHANGED
|
@@ -1,85 +1,80 @@
|
|
|
1
|
+
import { isOpenHostService, isPublishedLanguage, isConformist, isAntiCorruptionLayer, isSupplier, isCustomer, isBigBallOfMud, isSharedKernel, isPartnership, isSeparateWays, } from '../generated/ast.js';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* Use these constants instead of magic strings when checking relationship patterns.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```typescript
|
|
8
|
-
* import { Pattern } from '../sdk/patterns.js';
|
|
9
|
-
*
|
|
10
|
-
* // Instead of: hasPattern('SK') or hasPattern('SharedKernel')
|
|
11
|
-
* // Use:
|
|
12
|
-
* if (relationship.hasPattern(Pattern.SharedKernel)) {
|
|
13
|
-
* // ...
|
|
14
|
-
* }
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
/**
|
|
18
|
-
* Integration pattern abbreviations as used in the grammar.
|
|
19
|
-
* These are the canonical abbreviations recognized by DomainLang.
|
|
3
|
+
* Pattern constants for programmatic use.
|
|
4
|
+
* Values match the AST $type names.
|
|
20
5
|
*/
|
|
21
6
|
export const Pattern = {
|
|
22
|
-
//
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
SK: 'SK',
|
|
35
|
-
/** Partnership - coordinated development */
|
|
36
|
-
P: 'P',
|
|
37
|
-
// Relationship types
|
|
38
|
-
/** Customer/Supplier - negotiated contract */
|
|
39
|
-
CustomerSupplier: 'Customer/Supplier',
|
|
40
|
-
/** Separate Ways - no integration */
|
|
41
|
-
SeparateWays: 'Separate Ways',
|
|
42
|
-
/** Big Ball of Mud - legacy or unstructured */
|
|
43
|
-
BigBallOfMud: 'Big Ball of Mud',
|
|
7
|
+
// Side patterns (directional)
|
|
8
|
+
OHS: 'OpenHostService',
|
|
9
|
+
PL: 'PublishedLanguage',
|
|
10
|
+
CF: 'Conformist',
|
|
11
|
+
ACL: 'AntiCorruptionLayer',
|
|
12
|
+
S: 'Supplier',
|
|
13
|
+
C: 'Customer',
|
|
14
|
+
BBoM: 'BigBallOfMud',
|
|
15
|
+
// Symmetric patterns
|
|
16
|
+
SK: 'SharedKernel',
|
|
17
|
+
P: 'Partnership',
|
|
18
|
+
SW: 'SeparateWays',
|
|
44
19
|
};
|
|
45
20
|
/**
|
|
46
|
-
*
|
|
47
|
-
* Used when patterns are spelled out in documentation blocks.
|
|
21
|
+
* Mapping from short abbreviation to full $type name.
|
|
48
22
|
*/
|
|
49
23
|
export const PatternFullName = {
|
|
50
24
|
OHS: 'OpenHostService',
|
|
51
25
|
PL: 'PublishedLanguage',
|
|
52
26
|
CF: 'Conformist',
|
|
53
27
|
ACL: 'AntiCorruptionLayer',
|
|
28
|
+
S: 'Supplier',
|
|
29
|
+
C: 'Customer',
|
|
30
|
+
BBoM: 'BigBallOfMud',
|
|
54
31
|
SK: 'SharedKernel',
|
|
55
32
|
P: 'Partnership',
|
|
33
|
+
SW: 'SeparateWays',
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Mapping from $type name to short abbreviation.
|
|
37
|
+
*/
|
|
38
|
+
export const PatternAbbreviation = {
|
|
39
|
+
OpenHostService: 'OHS',
|
|
40
|
+
PublishedLanguage: 'PL',
|
|
41
|
+
Conformist: 'CF',
|
|
42
|
+
AntiCorruptionLayer: 'ACL',
|
|
43
|
+
Supplier: 'S',
|
|
44
|
+
Customer: 'C',
|
|
45
|
+
BigBallOfMud: 'BBoM',
|
|
46
|
+
SharedKernel: 'SK',
|
|
47
|
+
Partnership: 'P',
|
|
48
|
+
SeparateWays: 'SW',
|
|
56
49
|
};
|
|
57
50
|
/**
|
|
58
|
-
*
|
|
51
|
+
* All short+long forms that map to a given canonical $type name.
|
|
59
52
|
*/
|
|
60
53
|
export const PatternAliases = {
|
|
61
|
-
// Abbreviation -> [abbreviation, fullName]
|
|
62
54
|
OHS: ['OHS', 'OpenHostService'],
|
|
63
55
|
PL: ['PL', 'PublishedLanguage'],
|
|
64
56
|
CF: ['CF', 'Conformist'],
|
|
65
57
|
ACL: ['ACL', 'AntiCorruptionLayer'],
|
|
58
|
+
S: ['S', 'Supplier'],
|
|
59
|
+
C: ['C', 'Customer'],
|
|
60
|
+
BBoM: ['BBoM', 'BigBallOfMud'],
|
|
66
61
|
SK: ['SK', 'SharedKernel'],
|
|
67
62
|
P: ['P', 'Partnership'],
|
|
68
|
-
|
|
63
|
+
SW: ['SW', 'SeparateWays'],
|
|
69
64
|
OpenHostService: ['OHS', 'OpenHostService'],
|
|
70
65
|
PublishedLanguage: ['PL', 'PublishedLanguage'],
|
|
71
66
|
Conformist: ['CF', 'Conformist'],
|
|
72
67
|
AntiCorruptionLayer: ['ACL', 'AntiCorruptionLayer'],
|
|
68
|
+
Supplier: ['S', 'Supplier'],
|
|
69
|
+
Customer: ['C', 'Customer'],
|
|
70
|
+
BigBallOfMud: ['BBoM', 'BigBallOfMud'],
|
|
73
71
|
SharedKernel: ['SK', 'SharedKernel'],
|
|
74
72
|
Partnership: ['P', 'Partnership'],
|
|
73
|
+
SeparateWays: ['SW', 'SeparateWays'],
|
|
75
74
|
};
|
|
76
75
|
/**
|
|
77
|
-
* Checks if a pattern
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
* @param actual - Pattern string from the AST
|
|
81
|
-
* @param expected - Pattern to match (abbreviation or full name)
|
|
82
|
-
* @returns true if patterns match
|
|
76
|
+
* Checks if a pattern name matches an expected pattern.
|
|
77
|
+
* Works with both $type names and short abbreviations.
|
|
83
78
|
*/
|
|
84
79
|
export function matchesPattern(actual, expected) {
|
|
85
80
|
const normalizedActual = actual.trim();
|
|
@@ -87,37 +82,72 @@ export function matchesPattern(actual, expected) {
|
|
|
87
82
|
if (aliases) {
|
|
88
83
|
return aliases.some(alias => alias.toLowerCase() === normalizedActual.toLowerCase());
|
|
89
84
|
}
|
|
90
|
-
// Fallback: direct comparison
|
|
91
85
|
return normalizedActual.toLowerCase() === expected.toLowerCase();
|
|
92
86
|
}
|
|
87
|
+
/** Side patterns that belong on the upstream side */
|
|
88
|
+
export const UpstreamPatterns = ['OpenHostService', 'PublishedLanguage', 'Supplier'];
|
|
89
|
+
/** Side patterns that belong on the downstream side */
|
|
90
|
+
export const DownstreamPatterns = ['Conformist', 'AntiCorruptionLayer', 'Customer'];
|
|
91
|
+
/** Symmetric patterns (mutual) */
|
|
92
|
+
export const SymmetricPatterns = ['SharedKernel', 'Partnership', 'SeparateWays'];
|
|
93
93
|
/**
|
|
94
|
-
*
|
|
94
|
+
* Checks if a side pattern AST node is an upstream pattern.
|
|
95
95
|
*/
|
|
96
|
-
export
|
|
96
|
+
export function isUpstreamSidePattern(pattern) {
|
|
97
|
+
return isOpenHostService(pattern) || isPublishedLanguage(pattern) || isSupplier(pattern);
|
|
98
|
+
}
|
|
97
99
|
/**
|
|
98
|
-
*
|
|
100
|
+
* Checks if a side pattern AST node is a downstream pattern.
|
|
99
101
|
*/
|
|
100
|
-
export
|
|
102
|
+
export function isDownstreamSidePattern(pattern) {
|
|
103
|
+
return isConformist(pattern) || isAntiCorruptionLayer(pattern) || isCustomer(pattern);
|
|
104
|
+
}
|
|
101
105
|
/**
|
|
102
|
-
*
|
|
106
|
+
* Checks if a side pattern AST node is a Big Ball of Mud.
|
|
103
107
|
*/
|
|
104
|
-
export
|
|
108
|
+
export function isBBoMSidePattern(pattern) {
|
|
109
|
+
return isBigBallOfMud(pattern);
|
|
110
|
+
}
|
|
105
111
|
/**
|
|
106
|
-
* Checks if a pattern is
|
|
112
|
+
* Checks if a pattern string name is an upstream pattern.
|
|
107
113
|
*/
|
|
108
114
|
export function isUpstreamPattern(pattern) {
|
|
109
115
|
return UpstreamPatterns.some(p => matchesPattern(pattern, p));
|
|
110
116
|
}
|
|
111
117
|
/**
|
|
112
|
-
* Checks if a pattern is
|
|
118
|
+
* Checks if a pattern string name is a downstream pattern.
|
|
113
119
|
*/
|
|
114
120
|
export function isDownstreamPattern(pattern) {
|
|
115
121
|
return DownstreamPatterns.some(p => matchesPattern(pattern, p));
|
|
116
122
|
}
|
|
117
123
|
/**
|
|
118
|
-
* Checks if a pattern
|
|
124
|
+
* Checks if a pattern string name is a mutual/symmetric pattern.
|
|
119
125
|
*/
|
|
120
126
|
export function isMutualPattern(pattern) {
|
|
121
|
-
return
|
|
127
|
+
return SymmetricPatterns.some(p => matchesPattern(pattern, p));
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Gets the short abbreviation for a pattern $type name.
|
|
131
|
+
*/
|
|
132
|
+
export function getPatternAbbreviation(typeName) {
|
|
133
|
+
return PatternAbbreviation[typeName] ?? typeName;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Checks if a symmetric pattern is a Shared Kernel.
|
|
137
|
+
*/
|
|
138
|
+
export function isSharedKernelPattern(pattern) {
|
|
139
|
+
return isSharedKernel(pattern);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Checks if a symmetric pattern is a Partnership.
|
|
143
|
+
*/
|
|
144
|
+
export function isPartnershipPattern(pattern) {
|
|
145
|
+
return isPartnership(pattern);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Checks if a symmetric pattern is Separate Ways.
|
|
149
|
+
*/
|
|
150
|
+
export function isSeparateWaysPattern(pattern) {
|
|
151
|
+
return isSeparateWays(pattern);
|
|
122
152
|
}
|
|
123
153
|
//# sourceMappingURL=patterns.js.map
|
package/out/sdk/patterns.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patterns.js","sourceRoot":"","sources":["../../src/sdk/patterns.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"patterns.js","sourceRoot":"","sources":["../../src/sdk/patterns.ts"],"names":[],"mappings":"AACA,OAAO,EACH,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,qBAAqB,EACrB,UAAU,EACV,UAAU,EACV,cAAc,EACd,cAAc,EACd,aAAa,EACb,cAAc,GACjB,MAAM,qBAAqB,CAAC;AAE7B;;;GAGG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG;IACnB,8BAA8B;IAC9B,GAAG,EAAE,iBAAiB;IACtB,EAAE,EAAE,mBAAmB;IACvB,EAAE,EAAE,YAAY;IAChB,GAAG,EAAE,qBAAqB;IAC1B,CAAC,EAAE,UAAU;IACb,CAAC,EAAE,UAAU;IACb,IAAI,EAAE,cAAc;IACpB,qBAAqB;IACrB,EAAE,EAAE,cAAc;IAClB,CAAC,EAAE,aAAa;IAChB,EAAE,EAAE,cAAc;CACZ,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,MA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AACH,MAAM,UAAU,qBAAqB,CAAC,OAAyB;IAC3D,OAAO,cAAc,CAAC,OAAO,CAAC,CAAC;AACnC,CAAC"}
|
package/out/sdk/query.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Provides fluent, lazy evaluation of model queries.
|
|
4
4
|
*/
|
|
5
5
|
import { AstUtils } from 'langium';
|
|
6
|
-
import { isBoundedContext, isClassification, isContextMap, isDomain, isDomainMap, isModel, isNamespaceDeclaration, isTeam, isThisRef, } from '../generated/ast.js';
|
|
6
|
+
import { isBoundedContext, isClassification, isContextMap, isDirectionalRelationship, isDomain, isDomainMap, isModel, isNamespaceDeclaration, isSymmetricRelationship, isTeam, isThisRef, isSupplier, isCustomer, } from '../generated/ast.js';
|
|
7
7
|
import { QualifiedNameProvider } from '../lsp/domain-lang-naming.js';
|
|
8
8
|
import { buildIndexes } from './indexes.js';
|
|
9
9
|
import { metadataAsMap, effectiveClassification, effectiveTeam, } from './resolution.js';
|
|
@@ -256,14 +256,38 @@ class QueryImpl {
|
|
|
256
256
|
if (!left || !right) {
|
|
257
257
|
return undefined;
|
|
258
258
|
}
|
|
259
|
+
if (isSymmetricRelationship(rel)) {
|
|
260
|
+
// Grammar invariant: either `arrow === '><'` (SeparateWays shorthand, pattern undefined)
|
|
261
|
+
// OR `pattern` is set (explicit [SK]/[P]/[SW] brackets). Never both; never neither
|
|
262
|
+
// (validation rejects a bare "A B" without pattern or arrow).
|
|
263
|
+
// The fallback to 'SeparateWays' correctly handles the `><` case.
|
|
264
|
+
return {
|
|
265
|
+
type: 'symmetric',
|
|
266
|
+
kind: (rel.pattern?.$type ?? 'SeparateWays'),
|
|
267
|
+
left: { context: left, patterns: [] },
|
|
268
|
+
right: { context: right, patterns: [] },
|
|
269
|
+
source,
|
|
270
|
+
astNode: rel,
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
const arrow = rel.arrow;
|
|
274
|
+
const leftSide = { context: left, patterns: rel.leftPatterns };
|
|
275
|
+
const rightSide = { context: right, patterns: rel.rightPatterns };
|
|
276
|
+
const hasSupplier = rel.leftPatterns.some(isSupplier) || rel.rightPatterns.some(isSupplier);
|
|
277
|
+
const hasCustomer = rel.leftPatterns.some(isCustomer) || rel.rightPatterns.some(isCustomer);
|
|
278
|
+
const kind = arrow === '<->'
|
|
279
|
+
? 'Bidirectional'
|
|
280
|
+
: (hasSupplier || hasCustomer) ? 'CustomerSupplier' : 'UpstreamDownstream';
|
|
281
|
+
const upstreamSide = arrow === '->' ? leftSide : arrow === '<-' ? rightSide : undefined;
|
|
282
|
+
const downstreamSide = arrow === '->' ? rightSide : arrow === '<-' ? leftSide : undefined;
|
|
259
283
|
return {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
arrow
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
284
|
+
type: 'directional',
|
|
285
|
+
kind,
|
|
286
|
+
arrow,
|
|
287
|
+
left: leftSide,
|
|
288
|
+
right: rightSide,
|
|
289
|
+
upstream: upstreamSide,
|
|
290
|
+
downstream: downstreamSide,
|
|
267
291
|
source,
|
|
268
292
|
astNode: rel,
|
|
269
293
|
};
|
|
@@ -278,35 +302,6 @@ class QueryImpl {
|
|
|
278
302
|
}
|
|
279
303
|
return ref.link?.ref;
|
|
280
304
|
}
|
|
281
|
-
/**
|
|
282
|
-
* Infers relationship type from integration patterns.
|
|
283
|
-
* Simple heuristic based on common DDD pattern combinations.
|
|
284
|
-
*/
|
|
285
|
-
inferRelationshipType(rel) {
|
|
286
|
-
const leftPatterns = rel.leftPatterns;
|
|
287
|
-
const rightPatterns = rel.rightPatterns;
|
|
288
|
-
// Partnership: Bidirectional with P or SK
|
|
289
|
-
if (rel.arrow === '<->' && (leftPatterns.includes('P') || leftPatterns.includes('SK'))) {
|
|
290
|
-
return 'Partnership';
|
|
291
|
-
}
|
|
292
|
-
// Shared Kernel: SK pattern
|
|
293
|
-
if (leftPatterns.includes('SK') || rightPatterns.includes('SK')) {
|
|
294
|
-
return 'SharedKernel';
|
|
295
|
-
}
|
|
296
|
-
// Customer-Supplier: OHS + CF
|
|
297
|
-
if (leftPatterns.includes('OHS') && rightPatterns.includes('CF')) {
|
|
298
|
-
return 'CustomerSupplier';
|
|
299
|
-
}
|
|
300
|
-
// Upstream-Downstream: directional arrow
|
|
301
|
-
if (rel.arrow === '->') {
|
|
302
|
-
return 'UpstreamDownstream';
|
|
303
|
-
}
|
|
304
|
-
// Separate Ways
|
|
305
|
-
if (rel.arrow === '><') {
|
|
306
|
-
return 'SeparateWays';
|
|
307
|
-
}
|
|
308
|
-
return undefined;
|
|
309
|
-
}
|
|
310
305
|
}
|
|
311
306
|
/**
|
|
312
307
|
* Base implementation of QueryBuilder with lazy iteration.
|
|
@@ -601,38 +596,54 @@ export function augmentRelationship(rel, containingBc) {
|
|
|
601
596
|
// Helper methods for pattern matching (type-safe, no magic strings)
|
|
602
597
|
hasPattern: {
|
|
603
598
|
value: (pattern) => {
|
|
604
|
-
|
|
605
|
-
rel.
|
|
599
|
+
if (isDirectionalRelationship(rel)) {
|
|
600
|
+
return rel.leftPatterns.some(p => matchesPattern(p.$type, pattern)) ||
|
|
601
|
+
rel.rightPatterns.some(p => matchesPattern(p.$type, pattern));
|
|
602
|
+
}
|
|
603
|
+
if (isSymmetricRelationship(rel) && rel.pattern) {
|
|
604
|
+
return matchesPattern(rel.pattern.$type, pattern);
|
|
605
|
+
}
|
|
606
|
+
return false;
|
|
606
607
|
},
|
|
607
608
|
enumerable: false,
|
|
608
609
|
configurable: true,
|
|
609
610
|
},
|
|
610
611
|
hasLeftPattern: {
|
|
611
612
|
value: (pattern) => {
|
|
612
|
-
|
|
613
|
+
if (isDirectionalRelationship(rel)) {
|
|
614
|
+
return rel.leftPatterns.some(p => matchesPattern(p.$type, pattern));
|
|
615
|
+
}
|
|
616
|
+
return false;
|
|
613
617
|
},
|
|
614
618
|
enumerable: false,
|
|
615
619
|
configurable: true,
|
|
616
620
|
},
|
|
617
621
|
hasRightPattern: {
|
|
618
622
|
value: (pattern) => {
|
|
619
|
-
|
|
623
|
+
if (isDirectionalRelationship(rel)) {
|
|
624
|
+
return rel.rightPatterns.some(p => matchesPattern(p.$type, pattern));
|
|
625
|
+
}
|
|
626
|
+
return false;
|
|
620
627
|
},
|
|
621
628
|
enumerable: false,
|
|
622
629
|
configurable: true,
|
|
623
630
|
},
|
|
624
631
|
isUpstream: {
|
|
625
632
|
value: (side) => {
|
|
633
|
+
if (!isDirectionalRelationship(rel))
|
|
634
|
+
return false;
|
|
626
635
|
const patterns = side === 'left' ? rel.leftPatterns : rel.rightPatterns;
|
|
627
|
-
return patterns.some(p => isUpstreamPattern(p));
|
|
636
|
+
return patterns.some(p => isUpstreamPattern(p.$type));
|
|
628
637
|
},
|
|
629
638
|
enumerable: false,
|
|
630
639
|
configurable: true,
|
|
631
640
|
},
|
|
632
641
|
isDownstream: {
|
|
633
642
|
value: (side) => {
|
|
643
|
+
if (!isDirectionalRelationship(rel))
|
|
644
|
+
return false;
|
|
634
645
|
const patterns = side === 'left' ? rel.leftPatterns : rel.rightPatterns;
|
|
635
|
-
return patterns.some(p => isDownstreamPattern(p));
|
|
646
|
+
return patterns.some(p => isDownstreamPattern(p.$type));
|
|
636
647
|
},
|
|
637
648
|
enumerable: false,
|
|
638
649
|
configurable: true,
|