@likec4/language-server 1.17.0 → 1.18.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/contrib/likec4.tmLanguage.json +1 -1
- package/dist/browser.cjs +1 -1
- package/dist/browser.d.cts +2 -2
- package/dist/browser.d.mts +2 -2
- package/dist/browser.d.ts +2 -2
- package/dist/browser.mjs +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/protocol.d.cts +8 -5
- package/dist/protocol.d.mts +8 -5
- package/dist/protocol.d.ts +8 -5
- package/dist/shared/{language-server.DZRuJVSg.cjs → language-server.CO_nmHiL.cjs} +5605 -4215
- package/dist/shared/{language-server.DJo88TnT.d.cts → language-server.Da6ey08o.d.cts} +391 -110
- package/dist/shared/{language-server.PEjk7U9s.d.ts → language-server.De7S3e5Z.d.ts} +391 -110
- package/dist/shared/{language-server.BgDKnNok.d.mts → language-server.Dj4iDjtB.d.mts} +391 -110
- package/dist/shared/{language-server.B8qSDsWW.mjs → language-server.oO_9JoAG.mjs} +5594 -4215
- package/package.json +17 -31
- package/src/Rpc.ts +6 -3
- package/src/ast.ts +124 -71
- package/src/formatting/LikeC4Formatter.ts +9 -4
- package/src/generated/ast.ts +656 -40
- package/src/generated/grammar.ts +2 -2
- package/src/generated/module.ts +3 -2
- package/src/index.ts +1 -0
- package/src/like-c4.langium +170 -22
- package/src/logger.ts +7 -2
- package/src/lsp/CodeLensProvider.ts +0 -1
- package/src/lsp/CompletionProvider.ts +17 -2
- package/src/lsp/DocumentSymbolProvider.ts +5 -2
- package/src/lsp/HoverProvider.ts +34 -2
- package/src/lsp/SemanticTokenProvider.ts +58 -32
- package/src/model/deployments-index.ts +218 -0
- package/src/model/fqn-computation.ts +1 -1
- package/src/model/fqn-index.ts +0 -1
- package/src/model/index.ts +1 -0
- package/src/model/model-builder.ts +172 -37
- package/src/model/model-locator.ts +36 -7
- package/src/model/model-parser.ts +554 -92
- package/src/model-change/changeViewLayout.ts +2 -2
- package/src/module.ts +10 -4
- package/src/protocol.ts +10 -6
- package/src/references/index.ts +1 -0
- package/src/references/name-provider.ts +37 -0
- package/src/references/scope-computation.ts +130 -21
- package/src/references/scope-provider.ts +63 -36
- package/src/shared/NodeKindProvider.ts +15 -3
- package/src/utils/deploymentRef.ts +31 -0
- package/src/{elementRef.ts → utils/elementRef.ts} +1 -1
- package/src/utils/stringHash.ts +2 -2
- package/src/validation/_shared.ts +7 -5
- package/src/validation/deployment-checks.ts +144 -0
- package/src/validation/dynamic-view-step.ts +1 -1
- package/src/validation/index.ts +7 -0
- package/src/validation/relation.ts +1 -1
- package/src/validation/view-predicates/deployments.ts +56 -0
- package/src/validation/view-predicates/index.ts +1 -0
- package/src/view-utils/assignNavigateTo.ts +6 -5
- package/src/view-utils/index.ts +0 -1
- package/dist/model-graph/index.cjs +0 -10
- package/dist/model-graph/index.d.cts +0 -81
- package/dist/model-graph/index.d.mts +0 -81
- package/dist/model-graph/index.d.ts +0 -81
- package/dist/model-graph/index.mjs +0 -1
- package/dist/shared/language-server.BGGRJRnr.d.mts +0 -1338
- package/dist/shared/language-server.BXFhlTPo.mjs +0 -1953
- package/dist/shared/language-server.Bmpq16Gw.d.ts +0 -1338
- package/dist/shared/language-server.C1ZfM22X.d.cts +0 -1338
- package/dist/shared/language-server.N8HLDQqz.cjs +0 -1967
- package/src/model-graph/LikeC4ModelGraph.ts +0 -338
- package/src/model-graph/compute-view/__test__/fixture.ts +0 -630
- package/src/model-graph/compute-view/compute.ts +0 -788
- package/src/model-graph/compute-view/index.ts +0 -33
- package/src/model-graph/compute-view/predicates.ts +0 -509
- package/src/model-graph/dynamic-view/__test__/fixture.ts +0 -61
- package/src/model-graph/dynamic-view/compute.ts +0 -281
- package/src/model-graph/dynamic-view/index.ts +0 -29
- package/src/model-graph/index.ts +0 -3
- package/src/model-graph/utils/applyCustomElementProperties.ts +0 -65
- package/src/model-graph/utils/applyCustomRelationProperties.ts +0 -41
- package/src/model-graph/utils/applyViewRuleStyles.ts +0 -49
- package/src/model-graph/utils/buildComputeNodes.ts +0 -113
- package/src/model-graph/utils/buildElementNotations.ts +0 -63
- package/src/model-graph/utils/elementExpressionToPredicate.ts +0 -39
- package/src/model-graph/utils/relationExpressionToPredicates.ts +0 -43
- package/src/model-graph/utils/sortNodes.ts +0 -105
- package/src/model-graph/utils/uniqueTags.test.ts +0 -42
- package/src/model-graph/utils/uniqueTags.ts +0 -19
- package/src/utils/graphlib.ts +0 -9
- package/src/view-utils/resolve-extended-views.ts +0 -66
- package/src/view-utils/resolve-global-rules.ts +0 -88
- package/src/view-utils/view-hash.ts +0 -27
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type AstNode,
|
|
1
|
+
import { type AstNode, type ValidationAcceptor, type ValidationCheck } from 'langium'
|
|
2
|
+
import { isPromise } from 'remeda'
|
|
2
3
|
import type { CancellationToken } from 'vscode-jsonrpc'
|
|
3
4
|
import { logWarnError } from '../logger'
|
|
4
5
|
|
|
@@ -7,17 +8,18 @@ export const RESERVED_WORDS = [
|
|
|
7
8
|
'it',
|
|
8
9
|
'self',
|
|
9
10
|
'super',
|
|
11
|
+
'instance',
|
|
10
12
|
'likec4lib',
|
|
11
13
|
'global'
|
|
12
14
|
]
|
|
13
15
|
|
|
14
16
|
export function tryOrLog<T extends AstNode>(fn: ValidationCheck<T>): ValidationCheck<T> {
|
|
15
17
|
return async (node: T, accept: ValidationAcceptor, cancelToken: CancellationToken) => {
|
|
16
|
-
if (cancelToken) {
|
|
17
|
-
await interruptAndCheck(cancelToken)
|
|
18
|
-
}
|
|
19
18
|
try {
|
|
20
|
-
|
|
19
|
+
const result = fn(node, accept, cancelToken)
|
|
20
|
+
if (isPromise(result)) {
|
|
21
|
+
await result
|
|
22
|
+
}
|
|
21
23
|
} catch (e) {
|
|
22
24
|
logWarnError(e)
|
|
23
25
|
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { nonNullable } from '@likec4/core'
|
|
2
|
+
import { AstUtils, type ValidationCheck } from 'langium'
|
|
3
|
+
import { ast } from '../ast'
|
|
4
|
+
import type { LikeC4Services } from '../module'
|
|
5
|
+
import type { LikeC4NameProvider } from '../references'
|
|
6
|
+
import { RESERVED_WORDS, tryOrLog } from './_shared'
|
|
7
|
+
|
|
8
|
+
const { getDocument } = AstUtils
|
|
9
|
+
|
|
10
|
+
export const deploymentNodeChecks = (services: LikeC4Services): ValidationCheck<ast.DeploymentNode> => {
|
|
11
|
+
const DeploymentsIndex = services.likec4.DeploymentsIndex
|
|
12
|
+
const Names = services.references.NameProvider
|
|
13
|
+
return tryOrLog((el, accept) => {
|
|
14
|
+
const nodeName = Names.getName(el)
|
|
15
|
+
if (!nodeName) {
|
|
16
|
+
accept('error', 'DeploymentNode must be named', {
|
|
17
|
+
node: el
|
|
18
|
+
})
|
|
19
|
+
return
|
|
20
|
+
}
|
|
21
|
+
const range = nonNullable(Names.getNameNode(el), 'name CstNode not found').range
|
|
22
|
+
|
|
23
|
+
if (RESERVED_WORDS.includes(nodeName)) {
|
|
24
|
+
accept('error', `Reserved word: ${nodeName}`, {
|
|
25
|
+
node: el,
|
|
26
|
+
range
|
|
27
|
+
})
|
|
28
|
+
}
|
|
29
|
+
const fqnName = DeploymentsIndex.getFqnName(el)
|
|
30
|
+
|
|
31
|
+
const withSameName = DeploymentsIndex.byFqn(fqnName).limit(2).toArray()
|
|
32
|
+
if (withSameName.length > 1) {
|
|
33
|
+
accept(
|
|
34
|
+
'error',
|
|
35
|
+
`Duplicate node name "${fqnName}"`,
|
|
36
|
+
{
|
|
37
|
+
node: el,
|
|
38
|
+
range
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const deployedInstanceChecks = (services: LikeC4Services): ValidationCheck<ast.DeployedInstance> => {
|
|
46
|
+
const DeploymentsIndex = services.likec4.DeploymentsIndex
|
|
47
|
+
const Names = services.references.NameProvider as LikeC4NameProvider
|
|
48
|
+
// const Locator = services.workspace.AstNodeLocator
|
|
49
|
+
return tryOrLog((el, accept) => {
|
|
50
|
+
const artifactName = Names.getName(el)
|
|
51
|
+
if (!artifactName) {
|
|
52
|
+
accept('error', 'Deployed instance must be named, unique inside node', {
|
|
53
|
+
node: el
|
|
54
|
+
})
|
|
55
|
+
return
|
|
56
|
+
}
|
|
57
|
+
const range = nonNullable(Names.getNameNode(el), 'name CstNode not found').range
|
|
58
|
+
|
|
59
|
+
if (RESERVED_WORDS.includes(artifactName)) {
|
|
60
|
+
accept('error', `Reserved word: ${artifactName}`, {
|
|
61
|
+
node: el,
|
|
62
|
+
range
|
|
63
|
+
})
|
|
64
|
+
}
|
|
65
|
+
const fqnName = DeploymentsIndex.getFqnName(el)
|
|
66
|
+
|
|
67
|
+
const withSameName = DeploymentsIndex.byFqn(fqnName).limit(2).toArray()
|
|
68
|
+
if (withSameName.length > 1) {
|
|
69
|
+
accept(
|
|
70
|
+
'error',
|
|
71
|
+
`Duplicate instance name "${fqnName}"`,
|
|
72
|
+
{
|
|
73
|
+
node: el,
|
|
74
|
+
range
|
|
75
|
+
}
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export const deploymentRelationChecks = (services: LikeC4Services): ValidationCheck<ast.DeploymentRelation> => {
|
|
82
|
+
// const DeploymentsIndex = services.likec4.DeploymentsIndex
|
|
83
|
+
// const Names = services.references.NameProvider as LikeC4NameProvider
|
|
84
|
+
// const Locator = services.workspace.AstNodeLocator
|
|
85
|
+
// const fqnIndex = services.likec4.FqnIndex
|
|
86
|
+
return tryOrLog((el, accept) => {
|
|
87
|
+
const source = el.source?.value?.ref
|
|
88
|
+
const target = el.target?.value?.ref
|
|
89
|
+
|
|
90
|
+
if (!source || !target) {
|
|
91
|
+
return
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (
|
|
95
|
+
ast.isElement(source) && ast.isDeploymentNode(target) || ast.isElement(target) && ast.isDeploymentNode(source)
|
|
96
|
+
) {
|
|
97
|
+
const range = el.target.$cstNode?.range ?? el.source.$cstNode?.range
|
|
98
|
+
accept('error', 'Relations between deployment nodes and instance internals are not supported', {
|
|
99
|
+
node: el,
|
|
100
|
+
...range && { range }
|
|
101
|
+
})
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// const sourceEl = ast.isDeployedInstance(source)
|
|
105
|
+
// ? elementRef(source.element)
|
|
106
|
+
// : source
|
|
107
|
+
// const targetEl = ast.isDeployedInstance(target)
|
|
108
|
+
// ? elementRef(target.element)
|
|
109
|
+
// : target
|
|
110
|
+
|
|
111
|
+
// if (!sourceEl || !targetEl) {
|
|
112
|
+
// return
|
|
113
|
+
// }
|
|
114
|
+
|
|
115
|
+
// const sourceFqn = ast.isElement(sourceEl) ? fqnIndex.getFqn(sourceEl) : DeploymentsIndex.getFqnName(sourceEl) as Fqn
|
|
116
|
+
// if (!sourceFqn) {
|
|
117
|
+
// accept('error', 'Source not resolved', {
|
|
118
|
+
// node: el,
|
|
119
|
+
// property: 'source'
|
|
120
|
+
// })
|
|
121
|
+
// }
|
|
122
|
+
|
|
123
|
+
// const targetFqn = ast.isElement(targetEl) ? fqnIndex.getFqn(targetEl) : DeploymentsIndex.getFqnName(targetEl) as Fqn
|
|
124
|
+
// if (!targetFqn) {
|
|
125
|
+
// accept('error', 'Target not resolved', {
|
|
126
|
+
// node: el,
|
|
127
|
+
// property: 'target'
|
|
128
|
+
// })
|
|
129
|
+
// }
|
|
130
|
+
|
|
131
|
+
// if (!!sourceFqn && sourceFqn === targetFqn) {
|
|
132
|
+
// accept('error', 'Self-relation is not allowed', {
|
|
133
|
+
// node: el
|
|
134
|
+
// })
|
|
135
|
+
// return
|
|
136
|
+
// }
|
|
137
|
+
|
|
138
|
+
// if (sourceFqn && targetFqn && isSameHierarchy(sourceFqn, targetFqn)) {
|
|
139
|
+
// accept('error', 'Invalid parent-child relationship', {
|
|
140
|
+
// node: el
|
|
141
|
+
// })
|
|
142
|
+
// }
|
|
143
|
+
})
|
|
144
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { isAncestor } from '@likec4/core'
|
|
2
2
|
import type { ValidationCheck } from 'langium'
|
|
3
3
|
import { ast } from '../ast'
|
|
4
|
-
import { elementRef } from '../elementRef'
|
|
5
4
|
import { logError } from '../logger'
|
|
6
5
|
import type { LikeC4Services } from '../module'
|
|
6
|
+
import { elementRef } from '../utils/elementRef'
|
|
7
7
|
|
|
8
8
|
export const dynamicViewStep = (services: LikeC4Services): ValidationCheck<ast.DynamicViewStep> => {
|
|
9
9
|
const fqnIndex = services.likec4.FqnIndex
|
package/src/validation/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type ast } from '../ast'
|
|
2
2
|
import { logger } from '../logger'
|
|
3
3
|
import type { LikeC4Services } from '../module'
|
|
4
|
+
import { deployedInstanceChecks, deploymentNodeChecks, deploymentRelationChecks } from './deployment-checks'
|
|
4
5
|
import { dynamicViewRulePredicate } from './dynamic-view-rule'
|
|
5
6
|
import { dynamicViewStep } from './dynamic-view-step'
|
|
6
7
|
import { elementChecks } from './element'
|
|
@@ -18,6 +19,7 @@ import {
|
|
|
18
19
|
} from './specification'
|
|
19
20
|
import { viewChecks } from './view'
|
|
20
21
|
import {
|
|
22
|
+
deploymentRefExpressionChecks,
|
|
21
23
|
elementPredicateWithChecks,
|
|
22
24
|
expandElementExprChecks,
|
|
23
25
|
incomingExpressionChecks,
|
|
@@ -29,6 +31,11 @@ export function registerValidationChecks(services: LikeC4Services) {
|
|
|
29
31
|
logger.info('registerValidationChecks')
|
|
30
32
|
const registry = services.validation.ValidationRegistry
|
|
31
33
|
registry.register<ast.LikeC4AstType>({
|
|
34
|
+
DeployedInstance: deployedInstanceChecks(services),
|
|
35
|
+
DeploymentNode: deploymentNodeChecks(services),
|
|
36
|
+
DeploymentRelation: deploymentRelationChecks(services),
|
|
37
|
+
DeploymentRefExpression: deploymentRefExpressionChecks(services),
|
|
38
|
+
// DeploymentRelationExpression: deploymentRelationExpressionChecks(services),
|
|
32
39
|
NotesProperty: notesPropertyRuleChecks(services),
|
|
33
40
|
OpacityProperty: opacityPropertyRuleChecks(services),
|
|
34
41
|
IconProperty: iconPropertyRuleChecks(services),
|
|
@@ -2,8 +2,8 @@ import { isSameHierarchy } from '@likec4/core'
|
|
|
2
2
|
import type { ValidationCheck } from 'langium'
|
|
3
3
|
import { isDefined } from 'remeda'
|
|
4
4
|
import { ast } from '../ast'
|
|
5
|
-
import { elementRef } from '../elementRef'
|
|
6
5
|
import type { LikeC4Services } from '../module'
|
|
6
|
+
import { elementRef } from '../utils/elementRef'
|
|
7
7
|
import { tryOrLog } from './_shared'
|
|
8
8
|
|
|
9
9
|
export const relationChecks = (services: LikeC4Services): ValidationCheck<ast.Relation> => {
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { AstUtils, type ValidationCheck } from 'langium'
|
|
2
|
+
import { isNonNullish, isNullish } from 'remeda'
|
|
3
|
+
import { ast } from '../../ast'
|
|
4
|
+
import type { LikeC4Services } from '../../module'
|
|
5
|
+
import { tryOrLog } from '../_shared'
|
|
6
|
+
|
|
7
|
+
// export const deploymentRelationExpressionChecks = (
|
|
8
|
+
// services: LikeC4Services
|
|
9
|
+
// ): ValidationCheck<ast.DeploymentRelationExpression> => {
|
|
10
|
+
// return tryOrLog((node, accept) => {
|
|
11
|
+
// if (!AstUtils.hasContainerOfType(node, ast.isDirectedDeploymentRelationExpression)) {
|
|
12
|
+
// accept('warning', 'Not supported yet', {
|
|
13
|
+
// node
|
|
14
|
+
// })
|
|
15
|
+
// return
|
|
16
|
+
// }
|
|
17
|
+
// })
|
|
18
|
+
// }
|
|
19
|
+
|
|
20
|
+
export const deploymentRefExpressionChecks = (
|
|
21
|
+
services: LikeC4Services
|
|
22
|
+
): ValidationCheck<ast.DeploymentRefExpression> => {
|
|
23
|
+
// const DeploymentsIndex = services.likec4.DeploymentsIndex
|
|
24
|
+
// const Names = services.references.NameProvider as LikeC4NameProvider
|
|
25
|
+
// const Locator = services.workspace.AstNodeLocator
|
|
26
|
+
// const fqnIndex = services.likec4.FqnIndex
|
|
27
|
+
return tryOrLog((node, accept) => {
|
|
28
|
+
const referenceTo = node.ref.value.ref
|
|
29
|
+
if (isNullish(referenceTo)) {
|
|
30
|
+
accept('error', 'Invalid empty reference', {
|
|
31
|
+
node
|
|
32
|
+
})
|
|
33
|
+
return
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Ignore follwoing checks for view rule style
|
|
37
|
+
if (AstUtils.hasContainerOfType(node, ast.isDeploymentViewRuleStyle)) {
|
|
38
|
+
return
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
switch (true) {
|
|
42
|
+
case ast.isElement(referenceTo): {
|
|
43
|
+
accept('error', 'Invalid reference, deployment nodes and instances are only allowed', {
|
|
44
|
+
node
|
|
45
|
+
})
|
|
46
|
+
break
|
|
47
|
+
}
|
|
48
|
+
case ast.isDeployedInstance(referenceTo) && isNonNullish(node.selector): {
|
|
49
|
+
accept('error', 'Only deployment nodes can be expanded', {
|
|
50
|
+
node
|
|
51
|
+
})
|
|
52
|
+
break
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComputedNode, ComputedView, type Fqn, isElementView, type ViewId } from '@likec4/core'
|
|
2
2
|
import { find, isNullish } from 'remeda'
|
|
3
3
|
|
|
4
4
|
export function assignNavigateTo<R extends Iterable<ComputedView>>(views: R): R {
|
|
5
|
-
const allElementViews = new Map<Fqn,
|
|
5
|
+
const allElementViews = new Map<Fqn, ViewId[]>()
|
|
6
6
|
|
|
7
7
|
for (const v of views) {
|
|
8
|
-
if (
|
|
8
|
+
if (ComputedView.isElement(v) && v.viewOf && isNullish(v.extends)) {
|
|
9
9
|
const viewsOf = allElementViews.get(v.viewOf) ?? []
|
|
10
10
|
viewsOf.push(v.id)
|
|
11
11
|
allElementViews.set(v.viewOf, viewsOf)
|
|
@@ -15,11 +15,12 @@ export function assignNavigateTo<R extends Iterable<ComputedView>>(views: R): R
|
|
|
15
15
|
// set default navigateTo
|
|
16
16
|
for (const { id, nodes } of views) {
|
|
17
17
|
for (const node of nodes) {
|
|
18
|
-
|
|
18
|
+
const modelRef = ComputedNode.modelRef(node)
|
|
19
|
+
if (node.navigateTo || !modelRef) {
|
|
19
20
|
continue
|
|
20
21
|
}
|
|
21
22
|
// find first element view that is not the current one
|
|
22
|
-
const navigateTo = find(allElementViews.get(
|
|
23
|
+
const navigateTo = find(allElementViews.get(modelRef) ?? [], v => v !== id)
|
|
23
24
|
if (navigateTo) {
|
|
24
25
|
node.navigateTo = navigateTo
|
|
25
26
|
}
|
package/src/view-utils/index.ts
CHANGED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const LikeC4ModelGraph = require('../shared/language-server.N8HLDQqz.cjs');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
exports.LikeC4ModelGraph = LikeC4ModelGraph.LikeC4ModelGraph;
|
|
8
|
-
exports.computeDynamicView = LikeC4ModelGraph.computeDynamicView;
|
|
9
|
-
exports.computeElementView = LikeC4ModelGraph.computeElementView;
|
|
10
|
-
exports.computeView = LikeC4ModelGraph.computeView;
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { ModelGlobals, Element, Fqn, Relation, RelationID, ElementView, ComputedElementView, DynamicView, ComputedDynamicView } from '@likec4/core';
|
|
2
|
-
|
|
3
|
-
type Params = {
|
|
4
|
-
elements: Record<Fqn, Element>;
|
|
5
|
-
relations: Record<RelationID, Relation>;
|
|
6
|
-
globals?: ModelGlobals;
|
|
7
|
-
};
|
|
8
|
-
type RelationEdge = {
|
|
9
|
-
source: Element;
|
|
10
|
-
target: Element;
|
|
11
|
-
relations: Relation[];
|
|
12
|
-
};
|
|
13
|
-
type FqnOrElement = Fqn | Element;
|
|
14
|
-
type FqnsOrElements = ReadonlyArray<Fqn> | ReadonlyArray<Element>;
|
|
15
|
-
/**
|
|
16
|
-
* Used only for views calculations.
|
|
17
|
-
* Subject to change.
|
|
18
|
-
*/
|
|
19
|
-
declare class LikeC4ModelGraph {
|
|
20
|
-
#private;
|
|
21
|
-
readonly globals: ModelGlobals;
|
|
22
|
-
constructor({ elements, relations, globals }: Params);
|
|
23
|
-
get rootElements(): Element[];
|
|
24
|
-
get elements(): Element[];
|
|
25
|
-
element(id: Fqn): Element;
|
|
26
|
-
connectedRelations(id: Fqn): Relation[];
|
|
27
|
-
children(id: Fqn): Element[];
|
|
28
|
-
childrenOrElement(id: Fqn): Element[];
|
|
29
|
-
siblings(element: Fqn | Element): Element[];
|
|
30
|
-
/**
|
|
31
|
-
* Get all ancestor elements (i.e. parent, parent’s parent, etc.)
|
|
32
|
-
* (from closest to root)
|
|
33
|
-
*/
|
|
34
|
-
ancestors(element: Fqn | Element): Array<Element>;
|
|
35
|
-
/**
|
|
36
|
-
* Resolve siblings of the element and its ancestors
|
|
37
|
-
* (from closest to root)
|
|
38
|
-
*/
|
|
39
|
-
ascendingSiblings(element: Fqn | Element): Array<Element>;
|
|
40
|
-
/**
|
|
41
|
-
* Resolve all RelationEdges between element and others (any direction)
|
|
42
|
-
*/
|
|
43
|
-
anyEdgesBetween(_element: Fqn | Element, others: ReadonlyArray<Fqn> | ReadonlyArray<Element>): Array<RelationEdge>;
|
|
44
|
-
/**
|
|
45
|
-
* Resolve all RelationEdges between elements (any direction)
|
|
46
|
-
*/
|
|
47
|
-
edgesWithin<T extends Fqn[] | Element[]>(elements: T): Array<RelationEdge>;
|
|
48
|
-
/**
|
|
49
|
-
* Get directed RelationEdge between source and target if exists
|
|
50
|
-
*/
|
|
51
|
-
edgesBetween(_sources: FqnOrElement | FqnsOrElements, _targets: FqnOrElement | FqnsOrElements): RelationEdge[];
|
|
52
|
-
private addElement;
|
|
53
|
-
private addRelation;
|
|
54
|
-
private _childrenOf;
|
|
55
|
-
private _incomingTo;
|
|
56
|
-
private _outgoingFrom;
|
|
57
|
-
private _internalOf;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
declare function computeElementView(view: ElementView, graph: LikeC4ModelGraph): ComputedElementView<string, string>;
|
|
61
|
-
type ComputeViewResult$1 = {
|
|
62
|
-
isSuccess: true;
|
|
63
|
-
view: ComputedElementView;
|
|
64
|
-
} | {
|
|
65
|
-
isSuccess: false;
|
|
66
|
-
error: Error;
|
|
67
|
-
view: undefined;
|
|
68
|
-
};
|
|
69
|
-
declare function computeView(view: ElementView, graph: LikeC4ModelGraph): ComputeViewResult$1;
|
|
70
|
-
|
|
71
|
-
type ComputeViewResult = {
|
|
72
|
-
isSuccess: true;
|
|
73
|
-
view: ComputedDynamicView;
|
|
74
|
-
} | {
|
|
75
|
-
isSuccess: false;
|
|
76
|
-
error: Error;
|
|
77
|
-
view: undefined;
|
|
78
|
-
};
|
|
79
|
-
declare function computeDynamicView(view: DynamicView, graph: LikeC4ModelGraph): ComputeViewResult;
|
|
80
|
-
|
|
81
|
-
export { LikeC4ModelGraph, computeDynamicView, computeElementView, computeView };
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { ModelGlobals, Element, Fqn, Relation, RelationID, ElementView, ComputedElementView, DynamicView, ComputedDynamicView } from '@likec4/core';
|
|
2
|
-
|
|
3
|
-
type Params = {
|
|
4
|
-
elements: Record<Fqn, Element>;
|
|
5
|
-
relations: Record<RelationID, Relation>;
|
|
6
|
-
globals?: ModelGlobals;
|
|
7
|
-
};
|
|
8
|
-
type RelationEdge = {
|
|
9
|
-
source: Element;
|
|
10
|
-
target: Element;
|
|
11
|
-
relations: Relation[];
|
|
12
|
-
};
|
|
13
|
-
type FqnOrElement = Fqn | Element;
|
|
14
|
-
type FqnsOrElements = ReadonlyArray<Fqn> | ReadonlyArray<Element>;
|
|
15
|
-
/**
|
|
16
|
-
* Used only for views calculations.
|
|
17
|
-
* Subject to change.
|
|
18
|
-
*/
|
|
19
|
-
declare class LikeC4ModelGraph {
|
|
20
|
-
#private;
|
|
21
|
-
readonly globals: ModelGlobals;
|
|
22
|
-
constructor({ elements, relations, globals }: Params);
|
|
23
|
-
get rootElements(): Element[];
|
|
24
|
-
get elements(): Element[];
|
|
25
|
-
element(id: Fqn): Element;
|
|
26
|
-
connectedRelations(id: Fqn): Relation[];
|
|
27
|
-
children(id: Fqn): Element[];
|
|
28
|
-
childrenOrElement(id: Fqn): Element[];
|
|
29
|
-
siblings(element: Fqn | Element): Element[];
|
|
30
|
-
/**
|
|
31
|
-
* Get all ancestor elements (i.e. parent, parent’s parent, etc.)
|
|
32
|
-
* (from closest to root)
|
|
33
|
-
*/
|
|
34
|
-
ancestors(element: Fqn | Element): Array<Element>;
|
|
35
|
-
/**
|
|
36
|
-
* Resolve siblings of the element and its ancestors
|
|
37
|
-
* (from closest to root)
|
|
38
|
-
*/
|
|
39
|
-
ascendingSiblings(element: Fqn | Element): Array<Element>;
|
|
40
|
-
/**
|
|
41
|
-
* Resolve all RelationEdges between element and others (any direction)
|
|
42
|
-
*/
|
|
43
|
-
anyEdgesBetween(_element: Fqn | Element, others: ReadonlyArray<Fqn> | ReadonlyArray<Element>): Array<RelationEdge>;
|
|
44
|
-
/**
|
|
45
|
-
* Resolve all RelationEdges between elements (any direction)
|
|
46
|
-
*/
|
|
47
|
-
edgesWithin<T extends Fqn[] | Element[]>(elements: T): Array<RelationEdge>;
|
|
48
|
-
/**
|
|
49
|
-
* Get directed RelationEdge between source and target if exists
|
|
50
|
-
*/
|
|
51
|
-
edgesBetween(_sources: FqnOrElement | FqnsOrElements, _targets: FqnOrElement | FqnsOrElements): RelationEdge[];
|
|
52
|
-
private addElement;
|
|
53
|
-
private addRelation;
|
|
54
|
-
private _childrenOf;
|
|
55
|
-
private _incomingTo;
|
|
56
|
-
private _outgoingFrom;
|
|
57
|
-
private _internalOf;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
declare function computeElementView(view: ElementView, graph: LikeC4ModelGraph): ComputedElementView<string, string>;
|
|
61
|
-
type ComputeViewResult$1 = {
|
|
62
|
-
isSuccess: true;
|
|
63
|
-
view: ComputedElementView;
|
|
64
|
-
} | {
|
|
65
|
-
isSuccess: false;
|
|
66
|
-
error: Error;
|
|
67
|
-
view: undefined;
|
|
68
|
-
};
|
|
69
|
-
declare function computeView(view: ElementView, graph: LikeC4ModelGraph): ComputeViewResult$1;
|
|
70
|
-
|
|
71
|
-
type ComputeViewResult = {
|
|
72
|
-
isSuccess: true;
|
|
73
|
-
view: ComputedDynamicView;
|
|
74
|
-
} | {
|
|
75
|
-
isSuccess: false;
|
|
76
|
-
error: Error;
|
|
77
|
-
view: undefined;
|
|
78
|
-
};
|
|
79
|
-
declare function computeDynamicView(view: DynamicView, graph: LikeC4ModelGraph): ComputeViewResult;
|
|
80
|
-
|
|
81
|
-
export { LikeC4ModelGraph, computeDynamicView, computeElementView, computeView };
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { ModelGlobals, Element, Fqn, Relation, RelationID, ElementView, ComputedElementView, DynamicView, ComputedDynamicView } from '@likec4/core';
|
|
2
|
-
|
|
3
|
-
type Params = {
|
|
4
|
-
elements: Record<Fqn, Element>;
|
|
5
|
-
relations: Record<RelationID, Relation>;
|
|
6
|
-
globals?: ModelGlobals;
|
|
7
|
-
};
|
|
8
|
-
type RelationEdge = {
|
|
9
|
-
source: Element;
|
|
10
|
-
target: Element;
|
|
11
|
-
relations: Relation[];
|
|
12
|
-
};
|
|
13
|
-
type FqnOrElement = Fqn | Element;
|
|
14
|
-
type FqnsOrElements = ReadonlyArray<Fqn> | ReadonlyArray<Element>;
|
|
15
|
-
/**
|
|
16
|
-
* Used only for views calculations.
|
|
17
|
-
* Subject to change.
|
|
18
|
-
*/
|
|
19
|
-
declare class LikeC4ModelGraph {
|
|
20
|
-
#private;
|
|
21
|
-
readonly globals: ModelGlobals;
|
|
22
|
-
constructor({ elements, relations, globals }: Params);
|
|
23
|
-
get rootElements(): Element[];
|
|
24
|
-
get elements(): Element[];
|
|
25
|
-
element(id: Fqn): Element;
|
|
26
|
-
connectedRelations(id: Fqn): Relation[];
|
|
27
|
-
children(id: Fqn): Element[];
|
|
28
|
-
childrenOrElement(id: Fqn): Element[];
|
|
29
|
-
siblings(element: Fqn | Element): Element[];
|
|
30
|
-
/**
|
|
31
|
-
* Get all ancestor elements (i.e. parent, parent’s parent, etc.)
|
|
32
|
-
* (from closest to root)
|
|
33
|
-
*/
|
|
34
|
-
ancestors(element: Fqn | Element): Array<Element>;
|
|
35
|
-
/**
|
|
36
|
-
* Resolve siblings of the element and its ancestors
|
|
37
|
-
* (from closest to root)
|
|
38
|
-
*/
|
|
39
|
-
ascendingSiblings(element: Fqn | Element): Array<Element>;
|
|
40
|
-
/**
|
|
41
|
-
* Resolve all RelationEdges between element and others (any direction)
|
|
42
|
-
*/
|
|
43
|
-
anyEdgesBetween(_element: Fqn | Element, others: ReadonlyArray<Fqn> | ReadonlyArray<Element>): Array<RelationEdge>;
|
|
44
|
-
/**
|
|
45
|
-
* Resolve all RelationEdges between elements (any direction)
|
|
46
|
-
*/
|
|
47
|
-
edgesWithin<T extends Fqn[] | Element[]>(elements: T): Array<RelationEdge>;
|
|
48
|
-
/**
|
|
49
|
-
* Get directed RelationEdge between source and target if exists
|
|
50
|
-
*/
|
|
51
|
-
edgesBetween(_sources: FqnOrElement | FqnsOrElements, _targets: FqnOrElement | FqnsOrElements): RelationEdge[];
|
|
52
|
-
private addElement;
|
|
53
|
-
private addRelation;
|
|
54
|
-
private _childrenOf;
|
|
55
|
-
private _incomingTo;
|
|
56
|
-
private _outgoingFrom;
|
|
57
|
-
private _internalOf;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
declare function computeElementView(view: ElementView, graph: LikeC4ModelGraph): ComputedElementView<string, string>;
|
|
61
|
-
type ComputeViewResult$1 = {
|
|
62
|
-
isSuccess: true;
|
|
63
|
-
view: ComputedElementView;
|
|
64
|
-
} | {
|
|
65
|
-
isSuccess: false;
|
|
66
|
-
error: Error;
|
|
67
|
-
view: undefined;
|
|
68
|
-
};
|
|
69
|
-
declare function computeView(view: ElementView, graph: LikeC4ModelGraph): ComputeViewResult$1;
|
|
70
|
-
|
|
71
|
-
type ComputeViewResult = {
|
|
72
|
-
isSuccess: true;
|
|
73
|
-
view: ComputedDynamicView;
|
|
74
|
-
} | {
|
|
75
|
-
isSuccess: false;
|
|
76
|
-
error: Error;
|
|
77
|
-
view: undefined;
|
|
78
|
-
};
|
|
79
|
-
declare function computeDynamicView(view: DynamicView, graph: LikeC4ModelGraph): ComputeViewResult;
|
|
80
|
-
|
|
81
|
-
export { LikeC4ModelGraph, computeDynamicView, computeElementView, computeView };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { L as LikeC4ModelGraph, b as computeDynamicView, c as computeElementView, a as computeView } from '../shared/language-server.BXFhlTPo.mjs';
|