@likec4/language-server 1.31.0 → 1.32.1
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/dist/LikeC4LanguageServices.d.ts +2 -1
- package/dist/LikeC4LanguageServices.js +4 -3
- package/dist/Rpc.js +11 -4
- package/dist/ast.d.ts +12 -15
- package/dist/ast.js +4 -1
- package/dist/bundled.mjs +2545 -2476
- package/dist/formatting/LikeC4Formatter.js +7 -6
- package/dist/generated/ast.d.ts +60 -19
- package/dist/generated/ast.js +79 -24
- package/dist/generated/grammar.js +1 -1
- package/dist/lsp/CompletionProvider.js +1 -1
- package/dist/lsp/DocumentLinkProvider.js +4 -3
- package/dist/lsp/HoverProvider.js +9 -1
- package/dist/lsp/SemanticTokenProvider.js +18 -4
- package/dist/mcp/LikeC4MCPServerFactory.d.ts +5 -2
- package/dist/mcp/LikeC4MCPServerFactory.js +2 -72
- package/dist/mcp/LikeC4MCPTools.js +5 -3
- package/dist/mcp/sseserver/MCPServerFactory.d.ts +8 -0
- package/dist/mcp/sseserver/MCPServerFactory.js +78 -0
- package/dist/mcp/sseserver/with-mcp-server.d.ts +2 -0
- package/dist/mcp/sseserver/with-mcp-server.js +5 -1
- package/dist/mcp/utils.d.ts +5 -4
- package/dist/mcp/utils.js +2 -2
- package/dist/model/builder/MergedExtends.d.ts +4 -4
- package/dist/model/builder/MergedExtends.js +1 -1
- package/dist/model/builder/MergedSpecification.d.ts +4 -3
- package/dist/model/builder/MergedSpecification.js +9 -8
- package/dist/model/builder/assignTagColors.d.ts +7 -0
- package/dist/model/builder/assignTagColors.js +51 -0
- package/dist/model/builder/buildModel.d.ts +2 -2
- package/dist/model/builder/buildModel.js +40 -18
- package/dist/model/deployments-index.js +2 -2
- package/dist/model/fqn-index.d.ts +1 -1
- package/dist/model/fqn-index.js +6 -6
- package/dist/model/model-builder.d.ts +10 -4
- package/dist/model/model-builder.js +22 -19
- package/dist/model/model-locator.d.ts +10 -2
- package/dist/model/model-locator.js +65 -9
- package/dist/model/model-parser-where.d.ts +1 -1
- package/dist/model/model-parser-where.js +1 -1
- package/dist/model/model-parser.d.ts +19 -11
- package/dist/model/model-parser.js +11 -7
- package/dist/model/parser/Base.d.ts +1 -0
- package/dist/model/parser/Base.js +24 -3
- package/dist/model/parser/DeploymentModelParser.d.ts +2 -1
- package/dist/model/parser/DeploymentModelParser.js +7 -5
- package/dist/model/parser/DeploymentViewParser.d.ts +4 -3
- package/dist/model/parser/DeploymentViewParser.js +2 -1
- package/dist/model/parser/FqnRefParser.d.ts +2 -1
- package/dist/model/parser/FqnRefParser.js +2 -5
- package/dist/model/parser/GlobalsParser.d.ts +24 -24
- package/dist/model/parser/GlobalsParser.js +4 -4
- package/dist/model/parser/ImportsParser.d.ts +1 -0
- package/dist/model/parser/ModelParser.d.ts +2 -1
- package/dist/model/parser/ModelParser.js +1 -1
- package/dist/model/parser/PredicatesParser.d.ts +13 -12
- package/dist/model/parser/SpecificationParser.d.ts +6 -2
- package/dist/model/parser/SpecificationParser.js +21 -31
- package/dist/model/parser/ViewsParser.d.ts +24 -23
- package/dist/model/parser/ViewsParser.js +12 -19
- package/dist/model-change/changeElementStyle.d.ts +2 -2
- package/dist/model-change/changeElementStyle.js +6 -2
- package/dist/module.d.ts +1 -1
- package/dist/module.js +5 -2
- package/dist/protocol.d.ts +24 -3
- package/dist/protocol.js +4 -0
- package/dist/references/scope-computation.js +2 -3
- package/dist/test/testServices.d.ts +15 -0
- package/dist/test/testServices.js +1 -1
- package/dist/validation/index.d.ts +1 -1
- package/dist/validation/index.js +10 -3
- package/dist/validation/property-checks.d.ts +1 -0
- package/dist/validation/property-checks.js +62 -0
- package/dist/validation/relation.js +1 -1
- package/dist/validation/specification.js +1 -1
- package/dist/view-utils/assignNavigateTo.d.ts +1 -1
- package/dist/view-utils/assignNavigateTo.js +3 -3
- package/dist/views/likec4-views.d.ts +1 -3
- package/dist/views/likec4-views.js +68 -44
- package/package.json +23 -21
- /package/dist/mcp/sseserver/{SSELikeC4MCPServer.d.ts → MCPServer.d.ts} +0 -0
- /package/dist/mcp/sseserver/{SSELikeC4MCPServer.js → MCPServer.js} +0 -0
|
@@ -12,16 +12,15 @@ declare const DocumentParserFromMixins: {
|
|
|
12
12
|
parseGlobalDynamicPredicateGroup(astRule: import("../generated/ast").GlobalDynamicPredicateGroup): ProjectId[];
|
|
13
13
|
parseGlobalStyleOrGroup(astRule: import("../generated/ast").GlobalStyle | import("../generated/ast").GlobalStyleGroup): ProjectId[];
|
|
14
14
|
parseViews(): void;
|
|
15
|
-
parseElementView(astNode: import("../generated/ast").ElementView, additionalStyles:
|
|
16
|
-
|
|
15
|
+
parseElementView(astNode: import("../generated/ast").ElementView, additionalStyles: any[]): import("../ast").ParsedAstElementView;
|
|
16
|
+
parseElementViewRule(astRule: import("../generated/ast").ViewRule): ProjectId;
|
|
17
17
|
parseViewRulePredicate(astNode: import("../generated/ast").ViewRulePredicate): ProjectId;
|
|
18
18
|
parseViewRuleGlobalPredicateRef(astRule: import("../generated/ast").ViewRuleGlobalPredicateRef | import("../generated/ast").DynamicViewGlobalPredicateRef): ProjectId;
|
|
19
|
-
parseViewRuleStyleOrGlobalRef(astRule: import("../generated/ast").ViewRuleStyleOrGlobalRef):
|
|
19
|
+
parseViewRuleStyleOrGlobalRef(astRule: import("../generated/ast").ViewRuleStyleOrGlobalRef): any;
|
|
20
20
|
parseViewRuleGroup(astNode: import("../generated/ast").ViewRuleGroup): ProjectId;
|
|
21
21
|
parseViewRuleStyle(astRule: import("../generated/ast").ViewRuleStyle | import("../generated/ast").GlobalStyle): ProjectId;
|
|
22
|
-
parseRuleStyle(styleProperties: import("../generated/ast").StyleProperty[], elementExpressionsIterator: import("../generated/ast").FqnExpressions, notationProperty?: import("../generated/ast").NotationProperty): ProjectId;
|
|
23
22
|
parseViewRuleGlobalStyle(astRule: import("../generated/ast").ViewRuleGlobalStyle): ProjectId;
|
|
24
|
-
parseDynamicElementView(astNode: import("../generated/ast").DynamicView, additionalStyles:
|
|
23
|
+
parseDynamicElementView(astNode: import("../generated/ast").DynamicView, additionalStyles: any[]): import("../ast").ParsedAstDynamicView;
|
|
25
24
|
parseDynamicViewRule(astRule: import("../generated/ast").DynamicViewRule): ProjectId;
|
|
26
25
|
parseDynamicViewIncludePredicate(astRule: import("../generated/ast").DynamicViewIncludePredicate): ProjectId;
|
|
27
26
|
parseDynamicParallelSteps(node: import("../generated/ast").DynamicViewParallelSteps): ProjectId;
|
|
@@ -73,6 +72,7 @@ declare const DocumentParserFromMixins: {
|
|
|
73
72
|
convertLinks(source?: import("../generated/ast").LinkProperty["$container"]): ProjectId[] | undefined;
|
|
74
73
|
parseLinks(source?: import("../generated/ast").LinkProperty["$container"]): ProjectId[] | undefined;
|
|
75
74
|
parseIconProperty(prop: import("../generated/ast").IconProperty | undefined): ProjectId | undefined;
|
|
75
|
+
parseColorLiteral(astNode: import("../generated/ast").ColorLiteral): ProjectId | undefined;
|
|
76
76
|
parseElementStyle(elementProps: Array<import("../generated/ast").ElementProperty> | import("../generated/ast").ElementStyleProperty | undefined): import("../ast").ParsedElementStyle;
|
|
77
77
|
parseStyleProps(styleProps: Array<import("../generated/ast").StyleProperty> | undefined): import("../ast").ParsedElementStyle;
|
|
78
78
|
parseDeploymentView(astNode: import("../generated/ast").DeploymentView): import("../ast").ParsedAstDeploymentView;
|
|
@@ -89,16 +89,15 @@ declare const DocumentParserFromMixins: {
|
|
|
89
89
|
} & {
|
|
90
90
|
new (...args: any[]): {
|
|
91
91
|
parseViews(): void;
|
|
92
|
-
parseElementView(astNode: import("../generated/ast").ElementView, additionalStyles:
|
|
93
|
-
|
|
92
|
+
parseElementView(astNode: import("../generated/ast").ElementView, additionalStyles: any[]): import("../ast").ParsedAstElementView;
|
|
93
|
+
parseElementViewRule(astRule: import("../generated/ast").ViewRule): ProjectId;
|
|
94
94
|
parseViewRulePredicate(astNode: import("../generated/ast").ViewRulePredicate): ProjectId;
|
|
95
95
|
parseViewRuleGlobalPredicateRef(astRule: import("../generated/ast").ViewRuleGlobalPredicateRef | import("../generated/ast").DynamicViewGlobalPredicateRef): ProjectId;
|
|
96
|
-
parseViewRuleStyleOrGlobalRef(astRule: import("../generated/ast").ViewRuleStyleOrGlobalRef):
|
|
96
|
+
parseViewRuleStyleOrGlobalRef(astRule: import("../generated/ast").ViewRuleStyleOrGlobalRef): any;
|
|
97
97
|
parseViewRuleGroup(astNode: import("../generated/ast").ViewRuleGroup): ProjectId;
|
|
98
98
|
parseViewRuleStyle(astRule: import("../generated/ast").ViewRuleStyle | import("../generated/ast").GlobalStyle): ProjectId;
|
|
99
|
-
parseRuleStyle(styleProperties: import("../generated/ast").StyleProperty[], elementExpressionsIterator: import("../generated/ast").FqnExpressions, notationProperty?: import("../generated/ast").NotationProperty): ProjectId;
|
|
100
99
|
parseViewRuleGlobalStyle(astRule: import("../generated/ast").ViewRuleGlobalStyle): ProjectId;
|
|
101
|
-
parseDynamicElementView(astNode: import("../generated/ast").DynamicView, additionalStyles:
|
|
100
|
+
parseDynamicElementView(astNode: import("../generated/ast").DynamicView, additionalStyles: any[]): import("../ast").ParsedAstDynamicView;
|
|
102
101
|
parseDynamicViewRule(astRule: import("../generated/ast").DynamicViewRule): ProjectId;
|
|
103
102
|
parseDynamicViewIncludePredicate(astRule: import("../generated/ast").DynamicViewIncludePredicate): ProjectId;
|
|
104
103
|
parseDynamicParallelSteps(node: import("../generated/ast").DynamicViewParallelSteps): ProjectId;
|
|
@@ -150,6 +149,7 @@ declare const DocumentParserFromMixins: {
|
|
|
150
149
|
convertLinks(source?: import("../generated/ast").LinkProperty["$container"]): ProjectId[] | undefined;
|
|
151
150
|
parseLinks(source?: import("../generated/ast").LinkProperty["$container"]): ProjectId[] | undefined;
|
|
152
151
|
parseIconProperty(prop: import("../generated/ast").IconProperty | undefined): ProjectId | undefined;
|
|
152
|
+
parseColorLiteral(astNode: import("../generated/ast").ColorLiteral): ProjectId | undefined;
|
|
153
153
|
parseElementStyle(elementProps: Array<import("../generated/ast").ElementProperty> | import("../generated/ast").ElementStyleProperty | undefined): import("../ast").ParsedElementStyle;
|
|
154
154
|
parseStyleProps(styleProps: Array<import("../generated/ast").StyleProperty> | undefined): import("../ast").ParsedElementStyle;
|
|
155
155
|
parseDeploymentView(astNode: import("../generated/ast").DeploymentView): import("../ast").ParsedAstDeploymentView;
|
|
@@ -166,7 +166,8 @@ declare const DocumentParserFromMixins: {
|
|
|
166
166
|
} & {
|
|
167
167
|
new (...args: any[]): {
|
|
168
168
|
parseSpecification(): void;
|
|
169
|
-
|
|
169
|
+
parseElementSpecificationNode(specAst: import("../generated/ast").SpecificationElementKind): {};
|
|
170
|
+
parseElementSpecificationNode(specAst: import("../generated/ast").SpecificationDeploymentNodeKind): {};
|
|
170
171
|
isValid: import("../validation").IsValidFn;
|
|
171
172
|
readonly services: LikeC4Services;
|
|
172
173
|
readonly doc: ParsedLikeC4LangiumDocument;
|
|
@@ -189,6 +190,7 @@ declare const DocumentParserFromMixins: {
|
|
|
189
190
|
convertLinks(source?: import("../generated/ast").LinkProperty["$container"]): ProjectId[] | undefined;
|
|
190
191
|
parseLinks(source?: import("../generated/ast").LinkProperty["$container"]): ProjectId[] | undefined;
|
|
191
192
|
parseIconProperty(prop: import("../generated/ast").IconProperty | undefined): ProjectId | undefined;
|
|
193
|
+
parseColorLiteral(astNode: import("../generated/ast").ColorLiteral): ProjectId | undefined;
|
|
192
194
|
parseElementStyle(elementProps: Array<import("../generated/ast").ElementProperty> | import("../generated/ast").ElementStyleProperty | undefined): import("../ast").ParsedElementStyle;
|
|
193
195
|
parseStyleProps(styleProps: Array<import("../generated/ast").StyleProperty> | undefined): import("../ast").ParsedElementStyle;
|
|
194
196
|
};
|
|
@@ -241,6 +243,7 @@ declare const DocumentParserFromMixins: {
|
|
|
241
243
|
convertLinks(source?: import("../generated/ast").LinkProperty["$container"]): ProjectId[] | undefined;
|
|
242
244
|
parseLinks(source?: import("../generated/ast").LinkProperty["$container"]): ProjectId[] | undefined;
|
|
243
245
|
parseIconProperty(prop: import("../generated/ast").IconProperty | undefined): ProjectId | undefined;
|
|
246
|
+
parseColorLiteral(astNode: import("../generated/ast").ColorLiteral): ProjectId | undefined;
|
|
244
247
|
parseElementStyle(elementProps: Array<import("../generated/ast").ElementProperty> | import("../generated/ast").ElementStyleProperty | undefined): import("../ast").ParsedElementStyle;
|
|
245
248
|
parseStyleProps(styleProps: Array<import("../generated/ast").StyleProperty> | undefined): import("../ast").ParsedElementStyle;
|
|
246
249
|
};
|
|
@@ -286,6 +289,7 @@ declare const DocumentParserFromMixins: {
|
|
|
286
289
|
convertLinks(source?: import("../generated/ast").LinkProperty["$container"]): ProjectId[] | undefined;
|
|
287
290
|
parseLinks(source?: import("../generated/ast").LinkProperty["$container"]): ProjectId[] | undefined;
|
|
288
291
|
parseIconProperty(prop: import("../generated/ast").IconProperty | undefined): ProjectId | undefined;
|
|
292
|
+
parseColorLiteral(astNode: import("../generated/ast").ColorLiteral): ProjectId | undefined;
|
|
289
293
|
parseElementStyle(elementProps: Array<import("../generated/ast").ElementProperty> | import("../generated/ast").ElementStyleProperty | undefined): import("../ast").ParsedElementStyle;
|
|
290
294
|
parseStyleProps(styleProps: Array<import("../generated/ast").StyleProperty> | undefined): import("../ast").ParsedElementStyle;
|
|
291
295
|
parseDeployment(): void;
|
|
@@ -339,6 +343,7 @@ declare const DocumentParserFromMixins: {
|
|
|
339
343
|
convertLinks(source?: import("../generated/ast").LinkProperty["$container"]): ProjectId[] | undefined;
|
|
340
344
|
parseLinks(source?: import("../generated/ast").LinkProperty["$container"]): ProjectId[] | undefined;
|
|
341
345
|
parseIconProperty(prop: import("../generated/ast").IconProperty | undefined): ProjectId | undefined;
|
|
346
|
+
parseColorLiteral(astNode: import("../generated/ast").ColorLiteral): ProjectId | undefined;
|
|
342
347
|
parseElementStyle(elementProps: Array<import("../generated/ast").ElementProperty> | import("../generated/ast").ElementStyleProperty | undefined): import("../ast").ParsedElementStyle;
|
|
343
348
|
parseStyleProps(styleProps: Array<import("../generated/ast").StyleProperty> | undefined): import("../ast").ParsedElementStyle;
|
|
344
349
|
};
|
|
@@ -385,6 +390,7 @@ declare const DocumentParserFromMixins: {
|
|
|
385
390
|
convertLinks(source?: import("../generated/ast").LinkProperty["$container"]): ProjectId[] | undefined;
|
|
386
391
|
parseLinks(source?: import("../generated/ast").LinkProperty["$container"]): ProjectId[] | undefined;
|
|
387
392
|
parseIconProperty(prop: import("../generated/ast").IconProperty | undefined): ProjectId | undefined;
|
|
393
|
+
parseColorLiteral(astNode: import("../generated/ast").ColorLiteral): ProjectId | undefined;
|
|
388
394
|
parseElementStyle(elementProps: Array<import("../generated/ast").ElementProperty> | import("../generated/ast").ElementStyleProperty | undefined): import("../ast").ParsedElementStyle;
|
|
389
395
|
parseStyleProps(styleProps: Array<import("../generated/ast").StyleProperty> | undefined): import("../ast").ParsedElementStyle;
|
|
390
396
|
};
|
|
@@ -413,6 +419,7 @@ declare const DocumentParserFromMixins: {
|
|
|
413
419
|
convertLinks(source?: import("../generated/ast").LinkProperty["$container"]): ProjectId[] | undefined;
|
|
414
420
|
parseLinks(source?: import("../generated/ast").LinkProperty["$container"]): ProjectId[] | undefined;
|
|
415
421
|
parseIconProperty(prop: import("../generated/ast").IconProperty | undefined): ProjectId | undefined;
|
|
422
|
+
parseColorLiteral(astNode: import("../generated/ast").ColorLiteral): ProjectId | undefined;
|
|
416
423
|
parseElementStyle(elementProps: Array<import("../generated/ast").ElementProperty> | import("../generated/ast").ElementStyleProperty | undefined): import("../ast").ParsedElementStyle;
|
|
417
424
|
parseStyleProps(styleProps: Array<import("../generated/ast").StyleProperty> | undefined): import("../ast").ParsedElementStyle;
|
|
418
425
|
};
|
|
@@ -454,6 +461,7 @@ declare const DocumentParserFromMixins: {
|
|
|
454
461
|
convertLinks(source?: import("../generated/ast").LinkProperty["$container"]): ProjectId[] | undefined;
|
|
455
462
|
parseLinks(source?: import("../generated/ast").LinkProperty["$container"]): ProjectId[] | undefined;
|
|
456
463
|
parseIconProperty(prop: import("../generated/ast").IconProperty | undefined): ProjectId | undefined;
|
|
464
|
+
parseColorLiteral(astNode: import("../generated/ast").ColorLiteral): ProjectId | undefined;
|
|
457
465
|
parseElementStyle(elementProps: Array<import("../generated/ast").ElementProperty> | import("../generated/ast").ElementStyleProperty | undefined): import("../ast").ParsedElementStyle;
|
|
458
466
|
parseStyleProps(styleProps: Array<import("../generated/ast").StyleProperty> | undefined): import("../ast").ParsedElementStyle;
|
|
459
467
|
};
|
|
@@ -77,7 +77,7 @@ export class LikeC4ModelParser {
|
|
|
77
77
|
createParser(doc) {
|
|
78
78
|
const props = {
|
|
79
79
|
c4Specification: {
|
|
80
|
-
tags:
|
|
80
|
+
tags: {},
|
|
81
81
|
elements: {},
|
|
82
82
|
relationships: {},
|
|
83
83
|
colors: {},
|
|
@@ -99,12 +99,16 @@ export class LikeC4ModelParser {
|
|
|
99
99
|
};
|
|
100
100
|
doc = Object.assign(doc, props);
|
|
101
101
|
const parser = new DocumentParser(this.services, doc);
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
102
|
+
try {
|
|
103
|
+
parser.parseSpecification();
|
|
104
|
+
parser.parseImports();
|
|
105
|
+
parser.parseModel();
|
|
106
|
+
parser.parseGlobals();
|
|
107
|
+
parser.parseDeployment();
|
|
108
|
+
parser.parseViews();
|
|
109
|
+
} catch (e) {
|
|
110
|
+
logger.error(`Error parsing document ${doc.uri.toString()}`, { cause: e });
|
|
111
|
+
}
|
|
108
112
|
return parser;
|
|
109
113
|
}
|
|
110
114
|
}
|
|
@@ -32,6 +32,7 @@ export declare class BaseParser {
|
|
|
32
32
|
convertLinks(source?: ast.LinkProperty['$container']): c4.Link[] | undefined;
|
|
33
33
|
parseLinks(source?: ast.LinkProperty['$container']): c4.Link[] | undefined;
|
|
34
34
|
parseIconProperty(prop: ast.IconProperty | undefined): c4.IconUrl | undefined;
|
|
35
|
+
parseColorLiteral(astNode: ast.ColorLiteral): c4.ColorLiteral | undefined;
|
|
35
36
|
parseElementStyle(elementProps: Array<ast.ElementProperty> | ast.ElementStyleProperty | undefined): ParsedElementStyle;
|
|
36
37
|
parseStyleProps(styleProps: Array<ast.StyleProperty> | undefined): ParsedElementStyle;
|
|
37
38
|
}
|
|
@@ -7,6 +7,8 @@ import {
|
|
|
7
7
|
isBoolean,
|
|
8
8
|
isEmpty,
|
|
9
9
|
isNonNullish,
|
|
10
|
+
isNumber,
|
|
11
|
+
isString,
|
|
10
12
|
isTruthy,
|
|
11
13
|
map,
|
|
12
14
|
pipe,
|
|
@@ -17,6 +19,7 @@ import { hasLeadingSlash, hasProtocol, isRelative, joinRelativeURL, joinURL } fr
|
|
|
17
19
|
import {
|
|
18
20
|
ast,
|
|
19
21
|
parseAstOpacityProperty,
|
|
22
|
+
parseAstPercent,
|
|
20
23
|
parseAstSizeValue,
|
|
21
24
|
toColor
|
|
22
25
|
} from "../../ast.js";
|
|
@@ -86,7 +89,7 @@ export class BaseParser {
|
|
|
86
89
|
while (iter) {
|
|
87
90
|
try {
|
|
88
91
|
if (this.isValid(iter)) {
|
|
89
|
-
const values = iter.values.map((t) => t.ref?.name).filter(isTruthy);
|
|
92
|
+
const values = iter.values.map((t) => t.tag.ref?.name).filter(isTruthy);
|
|
90
93
|
if (values.length > 0) {
|
|
91
94
|
tags.push(...values);
|
|
92
95
|
}
|
|
@@ -95,8 +98,7 @@ export class BaseParser {
|
|
|
95
98
|
}
|
|
96
99
|
iter = iter.prev;
|
|
97
100
|
}
|
|
98
|
-
tags
|
|
99
|
-
return isNonEmptyArray(tags) ? tags : null;
|
|
101
|
+
return isNonEmptyArray(tags) ? unique(tags) : null;
|
|
100
102
|
}
|
|
101
103
|
convertLinks(source) {
|
|
102
104
|
return this.parseLinks(source);
|
|
@@ -155,6 +157,25 @@ export class BaseParser {
|
|
|
155
157
|
}
|
|
156
158
|
}
|
|
157
159
|
}
|
|
160
|
+
parseColorLiteral(astNode) {
|
|
161
|
+
if (!this.isValid(astNode)) {
|
|
162
|
+
return void 0;
|
|
163
|
+
}
|
|
164
|
+
if (ast.isHexColor(astNode)) {
|
|
165
|
+
return `#${astNode.hex}`;
|
|
166
|
+
}
|
|
167
|
+
if (ast.isRGBAColor(astNode)) {
|
|
168
|
+
let alpha = isNumber(astNode.alpha) ? astNode.alpha : void 0;
|
|
169
|
+
if (isString(astNode.alpha)) {
|
|
170
|
+
alpha = parseAstPercent(astNode.alpha) / 100;
|
|
171
|
+
}
|
|
172
|
+
if (alpha !== void 0) {
|
|
173
|
+
return `rgba(${astNode.red},${astNode.green},${astNode.blue},${alpha})`;
|
|
174
|
+
}
|
|
175
|
+
return `rgb(${astNode.red},${astNode.green},${astNode.blue})`;
|
|
176
|
+
}
|
|
177
|
+
nonexhaustive(astNode);
|
|
178
|
+
}
|
|
158
179
|
parseElementStyle(elementProps) {
|
|
159
180
|
if (!elementProps) {
|
|
160
181
|
return {};
|
|
@@ -12,7 +12,7 @@ export declare function DeploymentModelParser<TBase extends WithExpressionV2>(B:
|
|
|
12
12
|
_resolveDeploymentRelationSource(node: ast.DeploymentRelation): FqnRef;
|
|
13
13
|
parseDeploymentRelation(astNode: ast.DeploymentRelation): ParsedAstDeploymentRelation;
|
|
14
14
|
parseFqnRef(astNode: ast.FqnRef): c4.FqnRef;
|
|
15
|
-
parseExpressionV2(astNode: ast.ExpressionV2): c4.
|
|
15
|
+
parseExpressionV2(astNode: ast.ExpressionV2): c4.Expression;
|
|
16
16
|
parseFqnExprOrWith(astNode: ast.FqnExprOrWith): c4.FqnExpr.Any;
|
|
17
17
|
parseFqnExprWith(astNode: ast.FqnExprWith): c4.FqnExpr.Custom;
|
|
18
18
|
parseFqnExprOrWhere(astNode: ast.FqnExprOrWhere): c4.FqnExpr.OrWhere;
|
|
@@ -47,6 +47,7 @@ export declare function DeploymentModelParser<TBase extends WithExpressionV2>(B:
|
|
|
47
47
|
convertLinks(source?: ast.LinkProperty["$container"]): c4.Link[] | undefined;
|
|
48
48
|
parseLinks(source?: ast.LinkProperty["$container"]): c4.Link[] | undefined;
|
|
49
49
|
parseIconProperty(prop: ast.IconProperty | undefined): c4.IconUrl | undefined;
|
|
50
|
+
parseColorLiteral(astNode: ast.ColorLiteral): c4.ColorLiteral | undefined;
|
|
50
51
|
parseElementStyle(elementProps: Array<ast.ElementProperty> | ast.ElementStyleProperty | undefined): import("../../ast").ParsedElementStyle;
|
|
51
52
|
parseStyleProps(styleProps: Array<ast.StyleProperty> | undefined): import("../../ast").ParsedElementStyle;
|
|
52
53
|
};
|
|
@@ -156,11 +156,13 @@ export function DeploymentModelParser(B) {
|
|
|
156
156
|
parseDeploymentRelation(astNode) {
|
|
157
157
|
const isValid = this.isValid;
|
|
158
158
|
const astPath = this.getAstNodePath(astNode);
|
|
159
|
-
const source =
|
|
160
|
-
|
|
159
|
+
const source = this._resolveDeploymentRelationSource(astNode);
|
|
160
|
+
invariant(FqnRef.isDeploymentRef(source), "Invalid source for deployment relation");
|
|
161
|
+
const target = this.parseFqnRef(astNode.target);
|
|
162
|
+
invariant(FqnRef.isDeploymentRef(target), "Invalid target for deployment relation");
|
|
161
163
|
const tags = this.convertTags(astNode) ?? this.convertTags(astNode.body);
|
|
162
164
|
const links = this.convertLinks(astNode.body);
|
|
163
|
-
const kind = astNode.kind?.ref?.name;
|
|
165
|
+
const kind = (astNode.kind ?? astNode.dotKind?.kind)?.ref?.name;
|
|
164
166
|
const metadata = this.getMetadata(astNode.body?.props.find(ast.isMetadataProperty));
|
|
165
167
|
const bodyProps = mapToObj(
|
|
166
168
|
astNode.body?.props.filter(ast.isRelationStringProperty) ?? [],
|
|
@@ -180,8 +182,8 @@ export function DeploymentModelParser(B) {
|
|
|
180
182
|
const id = stringHash(
|
|
181
183
|
"deployment",
|
|
182
184
|
astPath,
|
|
183
|
-
source.
|
|
184
|
-
target.
|
|
185
|
+
source.deployment,
|
|
186
|
+
target.deployment
|
|
185
187
|
);
|
|
186
188
|
return {
|
|
187
189
|
id,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as c4 from '@likec4/core';
|
|
2
2
|
import { type ParsedAstDeploymentView, ast } from '../../ast';
|
|
3
3
|
import type { WithDeploymentModel } from './DeploymentModelParser';
|
|
4
4
|
import type { WithExpressionV2 } from './FqnRefParser';
|
|
@@ -7,10 +7,10 @@ export declare function DeploymentViewParser<TBase extends WithExpressionV2 & Wi
|
|
|
7
7
|
new (...args: any[]): {
|
|
8
8
|
parseDeploymentView(astNode: ast.DeploymentView): ParsedAstDeploymentView;
|
|
9
9
|
parseDeploymentViewRule(astRule: ast.DeploymentViewRule): c4.DeploymentViewRule;
|
|
10
|
-
parseDeploymentViewRulePredicate(astRule: ast.DeploymentViewRulePredicate): c4.
|
|
10
|
+
parseDeploymentViewRulePredicate(astRule: ast.DeploymentViewRulePredicate): c4.DeploymentViewPredicate;
|
|
11
11
|
parseDeploymentViewRuleStyle(astRule: ast.DeploymentViewRuleStyle): c4.DeploymentViewRuleStyle;
|
|
12
12
|
parseFqnRef(astNode: ast.FqnRef): c4.FqnRef;
|
|
13
|
-
parseExpressionV2(astNode: ast.ExpressionV2): c4.
|
|
13
|
+
parseExpressionV2(astNode: ast.ExpressionV2): c4.Expression;
|
|
14
14
|
parseFqnExprOrWith(astNode: ast.FqnExprOrWith): c4.FqnExpr.Any;
|
|
15
15
|
parseFqnExprWith(astNode: ast.FqnExprWith): c4.FqnExpr.Custom;
|
|
16
16
|
parseFqnExprOrWhere(astNode: ast.FqnExprOrWhere): c4.FqnExpr.OrWhere;
|
|
@@ -45,6 +45,7 @@ export declare function DeploymentViewParser<TBase extends WithExpressionV2 & Wi
|
|
|
45
45
|
convertLinks(source?: ast.LinkProperty["$container"]): c4.Link[] | undefined;
|
|
46
46
|
parseLinks(source?: ast.LinkProperty["$container"]): c4.Link[] | undefined;
|
|
47
47
|
parseIconProperty(prop: ast.IconProperty | undefined): c4.IconUrl | undefined;
|
|
48
|
+
parseColorLiteral(astNode: ast.ColorLiteral): c4.ColorLiteral | undefined;
|
|
48
49
|
parseElementStyle(elementProps: Array<ast.ElementProperty> | ast.ElementStyleProperty | undefined): import("../../ast").ParsedElementStyle;
|
|
49
50
|
parseStyleProps(styleProps: Array<ast.StyleProperty> | undefined): import("../../ast").ParsedElementStyle;
|
|
50
51
|
parseDeployment(): void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as c4 from "@likec4/core";
|
|
1
2
|
import { invariant, isNonEmptyArray, nonexhaustive } from "@likec4/core";
|
|
2
3
|
import { isNonNullish } from "remeda";
|
|
3
4
|
import { ast, toAutoLayout, ViewOps } from "../../ast.js";
|
|
@@ -26,7 +27,7 @@ export function DeploymentViewParser(B) {
|
|
|
26
27
|
ViewOps.writeId(astNode, id);
|
|
27
28
|
const manualLayout = parseViewManualLayout(astNode);
|
|
28
29
|
return {
|
|
29
|
-
|
|
30
|
+
[c4._type]: "deployment",
|
|
30
31
|
id,
|
|
31
32
|
astPath,
|
|
32
33
|
title,
|
|
@@ -5,7 +5,7 @@ export type WithExpressionV2 = ReturnType<typeof ExpressionV2Parser>;
|
|
|
5
5
|
export declare function ExpressionV2Parser<TBase extends Base>(B: TBase): {
|
|
6
6
|
new (...args: any[]): {
|
|
7
7
|
parseFqnRef(astNode: ast.FqnRef): c4.FqnRef;
|
|
8
|
-
parseExpressionV2(astNode: ast.ExpressionV2): c4.
|
|
8
|
+
parseExpressionV2(astNode: ast.ExpressionV2): c4.Expression;
|
|
9
9
|
parseFqnExprOrWith(astNode: ast.FqnExprOrWith): c4.FqnExpr.Any;
|
|
10
10
|
parseFqnExprWith(astNode: ast.FqnExprWith): c4.FqnExpr.Custom;
|
|
11
11
|
parseFqnExprOrWhere(astNode: ast.FqnExprOrWhere): c4.FqnExpr.OrWhere;
|
|
@@ -40,6 +40,7 @@ export declare function ExpressionV2Parser<TBase extends Base>(B: TBase): {
|
|
|
40
40
|
convertLinks(source?: ast.LinkProperty["$container"]): c4.Link[] | undefined;
|
|
41
41
|
parseLinks(source?: ast.LinkProperty["$container"]): c4.Link[] | undefined;
|
|
42
42
|
parseIconProperty(prop: ast.IconProperty | undefined): c4.IconUrl | undefined;
|
|
43
|
+
parseColorLiteral(astNode: ast.ColorLiteral): c4.ColorLiteral | undefined;
|
|
43
44
|
parseElementStyle(elementProps: Array<ast.ElementProperty> | ast.ElementStyleProperty | undefined): import("../../ast").ParsedElementStyle;
|
|
44
45
|
parseStyleProps(styleProps: Array<ast.StyleProperty> | undefined): import("../../ast").ParsedElementStyle;
|
|
45
46
|
};
|
|
@@ -197,11 +197,8 @@ export function ExpressionV2Parser(B) {
|
|
|
197
197
|
};
|
|
198
198
|
}
|
|
199
199
|
if (ast.isElementTagExpression(astNode)) {
|
|
200
|
-
invariant(astNode.tag
|
|
201
|
-
let elementTag = astNode.tag.$refText;
|
|
202
|
-
if (elementTag.startsWith("#")) {
|
|
203
|
-
elementTag = elementTag.slice(1);
|
|
204
|
-
}
|
|
200
|
+
invariant(astNode.tag.tag.ref, "ElementTagExpr tag is not resolved: " + astNode.$cstNode?.text);
|
|
201
|
+
let elementTag = astNode.tag.tag.$refText;
|
|
205
202
|
return {
|
|
206
203
|
elementTag,
|
|
207
204
|
isEqual: astNode.isEqual
|
|
@@ -1,41 +1,40 @@
|
|
|
1
1
|
import type * as c4 from '@likec4/core';
|
|
2
|
-
import {
|
|
2
|
+
import { type ParsedAstGlobals, ast } from '../../ast';
|
|
3
3
|
import type { WithViewsParser } from './ViewsParser';
|
|
4
4
|
export declare function GlobalsParser<TBase extends WithViewsParser>(B: TBase): {
|
|
5
5
|
new (...args: any[]): {
|
|
6
6
|
parseGlobals(): void;
|
|
7
7
|
parseAndStoreGlobalPredicateGroupOrDynamic(astRule: ast.GlobalPredicateGroup | ast.GlobalDynamicPredicateGroup, id: c4.GlobalPredicateId, c4Globals: ParsedAstGlobals): void;
|
|
8
|
-
parseGlobalPredicateGroup(astRule: ast.GlobalPredicateGroup): c4.
|
|
8
|
+
parseGlobalPredicateGroup(astRule: ast.GlobalPredicateGroup): c4.ElementViewPredicate[];
|
|
9
9
|
parseGlobalDynamicPredicateGroup(astRule: ast.GlobalDynamicPredicateGroup): c4.DynamicViewIncludeRule[];
|
|
10
|
-
parseGlobalStyleOrGroup(astRule: ast.GlobalStyle | ast.GlobalStyleGroup): c4.
|
|
10
|
+
parseGlobalStyleOrGroup(astRule: ast.GlobalStyle | ast.GlobalStyleGroup): c4.ElementViewRuleStyle[];
|
|
11
11
|
parseViews(): void;
|
|
12
|
-
parseElementView(astNode: ast.ElementView, additionalStyles:
|
|
13
|
-
|
|
14
|
-
parseViewRulePredicate(astNode: ast.ViewRulePredicate): c4.
|
|
12
|
+
parseElementView(astNode: ast.ElementView, additionalStyles: any[]): import("../../ast").ParsedAstElementView;
|
|
13
|
+
parseElementViewRule(astRule: ast.ViewRule): c4.ElementViewRule;
|
|
14
|
+
parseViewRulePredicate(astNode: ast.ViewRulePredicate): c4.ElementViewPredicate;
|
|
15
15
|
parseViewRuleGlobalPredicateRef(astRule: ast.ViewRuleGlobalPredicateRef | ast.DynamicViewGlobalPredicateRef): c4.ViewRuleGlobalPredicateRef;
|
|
16
|
-
parseViewRuleStyleOrGlobalRef(astRule: ast.ViewRuleStyleOrGlobalRef):
|
|
17
|
-
parseViewRuleGroup(astNode: ast.ViewRuleGroup): c4.
|
|
18
|
-
parseViewRuleStyle(astRule: ast.ViewRuleStyle | ast.GlobalStyle): c4.
|
|
19
|
-
parseRuleStyle(styleProperties: ast.StyleProperty[], elementExpressionsIterator: ast.FqnExpressions, notationProperty?: ast.NotationProperty): c4.ViewRuleStyle;
|
|
16
|
+
parseViewRuleStyleOrGlobalRef(astRule: ast.ViewRuleStyleOrGlobalRef): any;
|
|
17
|
+
parseViewRuleGroup(astNode: ast.ViewRuleGroup): c4.ElementViewRuleGroup;
|
|
18
|
+
parseViewRuleStyle(astRule: ast.ViewRuleStyle | ast.GlobalStyle): c4.ElementViewRuleStyle;
|
|
20
19
|
parseViewRuleGlobalStyle(astRule: ast.ViewRuleGlobalStyle): c4.ViewRuleGlobalStyle;
|
|
21
|
-
parseDynamicElementView(astNode: ast.DynamicView, additionalStyles:
|
|
20
|
+
parseDynamicElementView(astNode: ast.DynamicView, additionalStyles: any[]): import("../../ast").ParsedAstDynamicView;
|
|
22
21
|
parseDynamicViewRule(astRule: ast.DynamicViewRule): c4.DynamicViewRule;
|
|
23
22
|
parseDynamicViewIncludePredicate(astRule: ast.DynamicViewIncludePredicate): c4.DynamicViewIncludeRule;
|
|
24
23
|
parseDynamicParallelSteps(node: ast.DynamicViewParallelSteps): c4.DynamicViewParallelSteps;
|
|
25
24
|
parseDynamicStep(node: ast.DynamicViewStep): c4.DynamicViewStep;
|
|
26
|
-
parsePredicate(astNode: ast.ExpressionV2): c4.
|
|
27
|
-
parseElementPredicate(astNode: ast.FqnExprOrWith): c4.
|
|
28
|
-
parseElementPredicateOrWhere(astNode: ast.FqnExprOrWhere): c4.
|
|
29
|
-
parseElementExpression(astNode: ast.FqnExpr): c4.
|
|
30
|
-
parseElementPredicateWhere(astNode: ast.FqnExprWhere): c4.
|
|
31
|
-
parseElementPredicateWith(astNode: ast.FqnExprWith): c4.
|
|
32
|
-
parseRelationPredicate(astNode: ast.RelationExprOrWith): c4.
|
|
33
|
-
parseRelationPredicateOrWhere(astNode: ast.RelationExprOrWhere): c4.
|
|
34
|
-
parseRelationPredicateWhere(astNode: ast.RelationExprWhere): c4.
|
|
35
|
-
parseRelationPredicateWith(astNode: ast.RelationExprWith): c4.
|
|
36
|
-
parseRelationExpression(astNode: ast.RelationExpr): c4.
|
|
25
|
+
parsePredicate(astNode: ast.ExpressionV2): c4.ModelExpression;
|
|
26
|
+
parseElementPredicate(astNode: ast.FqnExprOrWith): c4.ModelFqnExpr.Any;
|
|
27
|
+
parseElementPredicateOrWhere(astNode: ast.FqnExprOrWhere): c4.ModelFqnExpr.OrWhere;
|
|
28
|
+
parseElementExpression(astNode: ast.FqnExpr): c4.ModelFqnExpr;
|
|
29
|
+
parseElementPredicateWhere(astNode: ast.FqnExprWhere): c4.ModelFqnExpr.Where;
|
|
30
|
+
parseElementPredicateWith(astNode: ast.FqnExprWith): c4.ModelFqnExpr.Custom;
|
|
31
|
+
parseRelationPredicate(astNode: ast.RelationExprOrWith): c4.ModelRelationExpr.Any;
|
|
32
|
+
parseRelationPredicateOrWhere(astNode: ast.RelationExprOrWhere): c4.ModelRelationExpr.OrWhere;
|
|
33
|
+
parseRelationPredicateWhere(astNode: ast.RelationExprWhere): c4.ModelRelationExpr.Where;
|
|
34
|
+
parseRelationPredicateWith(astNode: ast.RelationExprWith): c4.ModelRelationExpr.Custom;
|
|
35
|
+
parseRelationExpression(astNode: ast.RelationExpr): c4.ModelRelationExpr;
|
|
37
36
|
parseFqnRef(astNode: ast.FqnRef): c4.FqnRef;
|
|
38
|
-
parseExpressionV2(astNode: ast.ExpressionV2): c4.
|
|
37
|
+
parseExpressionV2(astNode: ast.ExpressionV2): c4.Expression;
|
|
39
38
|
parseFqnExprOrWith(astNode: ast.FqnExprOrWith): c4.FqnExpr.Any;
|
|
40
39
|
parseFqnExprWith(astNode: ast.FqnExprWith): c4.FqnExpr.Custom;
|
|
41
40
|
parseFqnExprOrWhere(astNode: ast.FqnExprOrWhere): c4.FqnExpr.OrWhere;
|
|
@@ -70,11 +69,12 @@ export declare function GlobalsParser<TBase extends WithViewsParser>(B: TBase):
|
|
|
70
69
|
convertLinks(source?: ast.LinkProperty["$container"]): c4.Link[] | undefined;
|
|
71
70
|
parseLinks(source?: ast.LinkProperty["$container"]): c4.Link[] | undefined;
|
|
72
71
|
parseIconProperty(prop: ast.IconProperty | undefined): c4.IconUrl | undefined;
|
|
72
|
+
parseColorLiteral(astNode: ast.ColorLiteral): c4.ColorLiteral | undefined;
|
|
73
73
|
parseElementStyle(elementProps: Array<ast.ElementProperty> | ast.ElementStyleProperty | undefined): import("../../ast").ParsedElementStyle;
|
|
74
74
|
parseStyleProps(styleProps: Array<ast.StyleProperty> | undefined): import("../../ast").ParsedElementStyle;
|
|
75
75
|
parseDeploymentView(astNode: ast.DeploymentView): import("../../ast").ParsedAstDeploymentView;
|
|
76
76
|
parseDeploymentViewRule(astRule: ast.DeploymentViewRule): c4.DeploymentViewRule;
|
|
77
|
-
parseDeploymentViewRulePredicate(astRule: ast.DeploymentViewRulePredicate): c4.
|
|
77
|
+
parseDeploymentViewRulePredicate(astRule: ast.DeploymentViewRulePredicate): c4.DeploymentViewPredicate;
|
|
78
78
|
parseDeploymentViewRuleStyle(astRule: ast.DeploymentViewRuleStyle): c4.DeploymentViewRuleStyle;
|
|
79
79
|
parseDeployment(): void;
|
|
80
80
|
parseDeploymentNode(astNode: ast.DeploymentNode): import("../../ast").ParsedAstDeployment.Node;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { nonexhaustive } from "@likec4/core";
|
|
2
|
-
import { isTruthy } from "remeda";
|
|
2
|
+
import { hasAtLeast, isTruthy } from "remeda";
|
|
3
3
|
import { ast } from "../../ast.js";
|
|
4
4
|
import { logger, logWarnError } from "../../logger.js";
|
|
5
5
|
export function GlobalsParser(B) {
|
|
@@ -36,7 +36,7 @@ export function GlobalsParser(B) {
|
|
|
36
36
|
continue;
|
|
37
37
|
}
|
|
38
38
|
const styles2 = this.parseGlobalStyleOrGroup(style);
|
|
39
|
-
if (styles2
|
|
39
|
+
if (hasAtLeast(styles2, 1)) {
|
|
40
40
|
c4Globals.styles[globalStyleId] = styles2;
|
|
41
41
|
}
|
|
42
42
|
} catch (e) {
|
|
@@ -47,14 +47,14 @@ export function GlobalsParser(B) {
|
|
|
47
47
|
parseAndStoreGlobalPredicateGroupOrDynamic(astRule, id, c4Globals) {
|
|
48
48
|
if (ast.isGlobalPredicateGroup(astRule)) {
|
|
49
49
|
const predicates = this.parseGlobalPredicateGroup(astRule);
|
|
50
|
-
if (predicates
|
|
50
|
+
if (hasAtLeast(predicates, 1)) {
|
|
51
51
|
c4Globals.predicates[id] = predicates;
|
|
52
52
|
}
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
55
|
if (ast.isGlobalDynamicPredicateGroup(astRule)) {
|
|
56
56
|
const predicates = this.parseGlobalDynamicPredicateGroup(astRule);
|
|
57
|
-
if (predicates
|
|
57
|
+
if (hasAtLeast(predicates, 1)) {
|
|
58
58
|
c4Globals.dynamicPredicates[id] = predicates;
|
|
59
59
|
}
|
|
60
60
|
return;
|
|
@@ -26,6 +26,7 @@ export declare function ImportsParser<TBase extends Base>(B: TBase): {
|
|
|
26
26
|
convertLinks(source?: ast.LinkProperty["$container"]): ProjectId[] | undefined;
|
|
27
27
|
parseLinks(source?: ast.LinkProperty["$container"]): ProjectId[] | undefined;
|
|
28
28
|
parseIconProperty(prop: ast.IconProperty | undefined): ProjectId | undefined;
|
|
29
|
+
parseColorLiteral(astNode: ast.ColorLiteral): ProjectId | undefined;
|
|
29
30
|
parseElementStyle(elementProps: Array<ast.ElementProperty> | ast.ElementStyleProperty | undefined): import("../../ast").ParsedElementStyle;
|
|
30
31
|
parseStyleProps(styleProps: Array<ast.StyleProperty> | undefined): import("../../ast").ParsedElementStyle;
|
|
31
32
|
};
|
|
@@ -11,7 +11,7 @@ export declare function ModelParser<TBase extends WithExpressionV2>(B: TBase): {
|
|
|
11
11
|
_resolveRelationSource(node: ast.Relation): FqnRef.ModelRef | FqnRef.ImportRef;
|
|
12
12
|
parseRelation(astNode: ast.Relation): ParsedAstRelation;
|
|
13
13
|
parseFqnRef(astNode: ast.FqnRef): c4.FqnRef;
|
|
14
|
-
parseExpressionV2(astNode: ast.ExpressionV2): c4.
|
|
14
|
+
parseExpressionV2(astNode: ast.ExpressionV2): c4.Expression;
|
|
15
15
|
parseFqnExprOrWith(astNode: ast.FqnExprOrWith): c4.FqnExpr.Any;
|
|
16
16
|
parseFqnExprWith(astNode: ast.FqnExprWith): c4.FqnExpr.Custom;
|
|
17
17
|
parseFqnExprOrWhere(astNode: ast.FqnExprOrWhere): c4.FqnExpr.OrWhere;
|
|
@@ -46,6 +46,7 @@ export declare function ModelParser<TBase extends WithExpressionV2>(B: TBase): {
|
|
|
46
46
|
convertLinks(source?: ast.LinkProperty["$container"]): c4.Link[] | undefined;
|
|
47
47
|
parseLinks(source?: ast.LinkProperty["$container"]): c4.Link[] | undefined;
|
|
48
48
|
parseIconProperty(prop: ast.IconProperty | undefined): c4.IconUrl | undefined;
|
|
49
|
+
parseColorLiteral(astNode: ast.ColorLiteral): c4.ColorLiteral | undefined;
|
|
49
50
|
parseElementStyle(elementProps: Array<ast.ElementProperty> | ast.ElementStyleProperty | undefined): import("../../ast").ParsedElementStyle;
|
|
50
51
|
parseStyleProps(styleProps: Array<ast.StyleProperty> | undefined): import("../../ast").ParsedElementStyle;
|
|
51
52
|
};
|
|
@@ -137,7 +137,7 @@ ${error}`, {
|
|
|
137
137
|
invariant(FqnRef.isModelRef(target) || FqnRef.isImportRef(target), "Target must be a model reference");
|
|
138
138
|
const tags = this.parseTags(astNode) ?? this.parseTags(astNode.body);
|
|
139
139
|
const links = this.parseLinks(astNode.body);
|
|
140
|
-
const kind = astNode.kind?.ref?.name;
|
|
140
|
+
const kind = (astNode.kind ?? astNode.dotKind?.kind)?.ref?.name;
|
|
141
141
|
const metadata = this.getMetadata(astNode.body?.props.find(ast.isMetadataProperty));
|
|
142
142
|
const astPath = this.getAstNodePath(astNode);
|
|
143
143
|
const bodyProps = mapToObj(
|
|
@@ -4,19 +4,19 @@ import type { WithExpressionV2 } from './FqnRefParser';
|
|
|
4
4
|
export type WithPredicates = ReturnType<typeof PredicatesParser>;
|
|
5
5
|
export declare function PredicatesParser<TBase extends WithExpressionV2>(B: TBase): {
|
|
6
6
|
new (...args: any[]): {
|
|
7
|
-
parsePredicate(astNode: ast.ExpressionV2): c4.
|
|
8
|
-
parseElementPredicate(astNode: ast.FqnExprOrWith): c4.
|
|
9
|
-
parseElementPredicateOrWhere(astNode: ast.FqnExprOrWhere): c4.
|
|
10
|
-
parseElementExpression(astNode: ast.FqnExpr): c4.
|
|
11
|
-
parseElementPredicateWhere(astNode: ast.FqnExprWhere): c4.
|
|
12
|
-
parseElementPredicateWith(astNode: ast.FqnExprWith): c4.
|
|
13
|
-
parseRelationPredicate(astNode: ast.RelationExprOrWith): c4.
|
|
14
|
-
parseRelationPredicateOrWhere(astNode: ast.RelationExprOrWhere): c4.
|
|
15
|
-
parseRelationPredicateWhere(astNode: ast.RelationExprWhere): c4.
|
|
16
|
-
parseRelationPredicateWith(astNode: ast.RelationExprWith): c4.
|
|
17
|
-
parseRelationExpression(astNode: ast.RelationExpr): c4.
|
|
7
|
+
parsePredicate(astNode: ast.ExpressionV2): c4.ModelExpression;
|
|
8
|
+
parseElementPredicate(astNode: ast.FqnExprOrWith): c4.ModelFqnExpr.Any;
|
|
9
|
+
parseElementPredicateOrWhere(astNode: ast.FqnExprOrWhere): c4.ModelFqnExpr.OrWhere;
|
|
10
|
+
parseElementExpression(astNode: ast.FqnExpr): c4.ModelFqnExpr;
|
|
11
|
+
parseElementPredicateWhere(astNode: ast.FqnExprWhere): c4.ModelFqnExpr.Where;
|
|
12
|
+
parseElementPredicateWith(astNode: ast.FqnExprWith): c4.ModelFqnExpr.Custom;
|
|
13
|
+
parseRelationPredicate(astNode: ast.RelationExprOrWith): c4.ModelRelationExpr.Any;
|
|
14
|
+
parseRelationPredicateOrWhere(astNode: ast.RelationExprOrWhere): c4.ModelRelationExpr.OrWhere;
|
|
15
|
+
parseRelationPredicateWhere(astNode: ast.RelationExprWhere): c4.ModelRelationExpr.Where;
|
|
16
|
+
parseRelationPredicateWith(astNode: ast.RelationExprWith): c4.ModelRelationExpr.Custom;
|
|
17
|
+
parseRelationExpression(astNode: ast.RelationExpr): c4.ModelRelationExpr;
|
|
18
18
|
parseFqnRef(astNode: ast.FqnRef): c4.FqnRef;
|
|
19
|
-
parseExpressionV2(astNode: ast.ExpressionV2): c4.
|
|
19
|
+
parseExpressionV2(astNode: ast.ExpressionV2): c4.Expression;
|
|
20
20
|
parseFqnExprOrWith(astNode: ast.FqnExprOrWith): c4.FqnExpr.Any;
|
|
21
21
|
parseFqnExprWith(astNode: ast.FqnExprWith): c4.FqnExpr.Custom;
|
|
22
22
|
parseFqnExprOrWhere(astNode: ast.FqnExprOrWhere): c4.FqnExpr.OrWhere;
|
|
@@ -51,6 +51,7 @@ export declare function PredicatesParser<TBase extends WithExpressionV2>(B: TBas
|
|
|
51
51
|
convertLinks(source?: ast.LinkProperty["$container"]): c4.Link[] | undefined;
|
|
52
52
|
parseLinks(source?: ast.LinkProperty["$container"]): c4.Link[] | undefined;
|
|
53
53
|
parseIconProperty(prop: ast.IconProperty | undefined): c4.IconUrl | undefined;
|
|
54
|
+
parseColorLiteral(astNode: ast.ColorLiteral): c4.ColorLiteral | undefined;
|
|
54
55
|
parseElementStyle(elementProps: Array<ast.ElementProperty> | ast.ElementStyleProperty | undefined): import("../../ast").ParsedElementStyle;
|
|
55
56
|
parseStyleProps(styleProps: Array<ast.StyleProperty> | undefined): import("../../ast").ParsedElementStyle;
|
|
56
57
|
};
|
|
@@ -4,8 +4,11 @@ import { type Base } from './Base';
|
|
|
4
4
|
export declare function SpecificationParser<TBase extends Base>(B: TBase): {
|
|
5
5
|
new (...args: any[]): {
|
|
6
6
|
parseSpecification(): void;
|
|
7
|
-
|
|
8
|
-
[key: c4.
|
|
7
|
+
parseElementSpecificationNode(specAst: ast.SpecificationElementKind): {
|
|
8
|
+
[key: c4.ElementKind]: c4.ElementSpecification;
|
|
9
|
+
};
|
|
10
|
+
parseElementSpecificationNode(specAst: ast.SpecificationDeploymentNodeKind): {
|
|
11
|
+
[key: c4.DeploymentKind]: c4.ElementSpecification;
|
|
9
12
|
};
|
|
10
13
|
isValid: import("../../validation").IsValidFn;
|
|
11
14
|
readonly services: import("../..").LikeC4Services;
|
|
@@ -29,6 +32,7 @@ export declare function SpecificationParser<TBase extends Base>(B: TBase): {
|
|
|
29
32
|
convertLinks(source?: ast.LinkProperty["$container"]): c4.Link[] | undefined;
|
|
30
33
|
parseLinks(source?: ast.LinkProperty["$container"]): c4.Link[] | undefined;
|
|
31
34
|
parseIconProperty(prop: ast.IconProperty | undefined): c4.IconUrl | undefined;
|
|
35
|
+
parseColorLiteral(astNode: ast.ColorLiteral): c4.ColorLiteral | undefined;
|
|
32
36
|
parseElementStyle(elementProps: Array<ast.ElementProperty> | ast.ElementStyleProperty | undefined): import("../../ast").ParsedElementStyle;
|
|
33
37
|
parseStyleProps(styleProps: Array<ast.StyleProperty> | undefined): import("../../ast").ParsedElementStyle;
|
|
34
38
|
};
|