likec4 1.23.1 → 1.24.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/dist/index.d.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  import * as c4 from '@likec4/core';
2
- import { Fqn, EdgeId, ComputedView, DiagramView, OverviewGraph, ViewId, invariant, ViewChange } from '@likec4/core';
2
+ import { Fqn, EdgeId, ComputedView, DiagramView, OverviewGraph, LikeC4Model, ViewId, invariant, ViewChange } from '@likec4/core';
3
3
  export { AbstractRelation, AutoLayoutDirection, BBox, Color, ComputedDeploymentView, ComputedDynamicView, ComputedEdge, ComputedElementView, ComputedLikeC4Model, ComputedNode, ComputedView, DeployedInstance, DeploymentElement, DeploymentNode, DeploymentNodeKind, DeploymentRelation, DeploymentView, DiagramEdge, DiagramNode, DiagramView, DynamicView, EdgeId, Element, ElementKind, ElementView, Fqn, HexColorLiteral, LayoutedLikeC4Model, LikeC4View, NodeId, ParsedLikeC4Model, Point, RelationExpr, RelationId, StepEdgeId, Tag, ThemeColor, ViewId, XYPoint } from '@likec4/core';
4
- import { LikeC4Model } from '@likec4/core/model';
4
+ import { LikeC4Model as LikeC4Model$1 } from '@likec4/core/model';
5
5
  export { AnyAux, Aux, LikeC4DeploymentModel, LikeC4Model, LikeC4ViewModel } from '@likec4/core/model';
6
6
  import { Tagged, ValueOf, ConditionalPick, Writable } from 'type-fest';
7
+ import { Fqn as Fqn$1 } from '@likec4/core/types';
8
+ import { DefaultWeakMap } from '@likec4/core/utils';
7
9
 
8
10
  /**
9
11
  * A tagging type for string properties that are actually document URIs.
@@ -6208,38 +6210,6 @@ declare class SimpleCache<K, V> extends DisposableCache {
6208
6210
  delete(key: K): boolean;
6209
6211
  clear(): void;
6210
6212
  }
6211
- declare class ContextCache<Context, Key, Value, ContextKey = Context> extends DisposableCache {
6212
- private readonly cache;
6213
- private readonly converter;
6214
- constructor(converter?: (input: Context) => ContextKey);
6215
- has(contextKey: Context, key: Key): boolean;
6216
- set(contextKey: Context, key: Key, value: Value): void;
6217
- get(contextKey: Context, key: Key): Value | undefined;
6218
- get(contextKey: Context, key: Key, provider: () => Value): Value;
6219
- delete(contextKey: Context, key: Key): boolean;
6220
- clear(): void;
6221
- clear(contextKey: Context): void;
6222
- protected cacheForContext(contextKey: Context): Map<Key, Value>;
6223
- }
6224
- /**
6225
- * Every key/value pair in this cache is scoped to a document.
6226
- * If this document is changed or deleted, all associated key/value pairs are deleted.
6227
- */
6228
- declare class DocumentCache<K, V> extends ContextCache<URI | string, K, V, string> {
6229
- /**
6230
- * Creates a new document cache.
6231
- *
6232
- * @param sharedServices Service container instance to hook into document lifecycle events.
6233
- * @param state Optional document state on which the cache should evict.
6234
- * If not provided, the cache will evict on `DocumentBuilder#onUpdate`.
6235
- * *Deleted* documents are considered in both cases.
6236
- *
6237
- * Providing a state here will use `DocumentBuilder#onDocumentPhase` instead,
6238
- * which triggers on all documents that have been affected by this change, assuming that the
6239
- * state is `DocumentState.Linked` or a later state.
6240
- */
6241
- constructor(sharedServices: LangiumSharedCoreServices, state?: DocumentState);
6242
- }
6243
6213
  /**
6244
6214
  * Every key/value pair in this cache is scoped to the whole workspace.
6245
6215
  * If any document in the workspace is added, changed or deleted, the whole cache is evicted.
@@ -14050,7 +14020,7 @@ declare class LikeC4DocumentHighlightProvider extends DefaultDocumentHighlightPr
14050
14020
  declare class LikeC4DocumentLinkProvider implements DocumentLinkProvider {
14051
14021
  private services;
14052
14022
  constructor(services: LikeC4Services);
14053
- getDocumentLinks(doc: LangiumDocument, _params: DocumentLinkParams): MaybePromise<DocumentLink[]>;
14023
+ getDocumentLinks(doc: LangiumDocument, _params: DocumentLinkParams, cancelToken?: CancellationToken): Promise<DocumentLink[]>;
14054
14024
  resolveLink(doc: LangiumDocument, link: string): string;
14055
14025
  relativeLink(doc: LangiumDocument, link: string): string | null;
14056
14026
  }
@@ -14090,7 +14060,7 @@ type ExtendElementProperty = LinkProperty | MetadataProperty;
14090
14060
  declare const ExtendElementProperty = "ExtendElementProperty";
14091
14061
  type FqnExpr = FqnRefExpr | WildcardExpression;
14092
14062
  declare const FqnExpr = "FqnExpr";
14093
- type FqnReferenceable = Element | ExtendElement | Referenceable;
14063
+ type FqnReferenceable = Element | ExtendDeployment | ExtendElement | Referenceable;
14094
14064
  declare const FqnReferenceable = "FqnReferenceable";
14095
14065
  type IconId = string;
14096
14066
  type Id = 'deployment' | 'element' | 'group' | 'instance' | 'model' | 'node' | ArrowType | ElementShape | LineOptions | Participant | SizeValue | ThemeColor | string;
@@ -14191,7 +14161,7 @@ interface CustomRelationProperties extends AstNode {
14191
14161
  }
14192
14162
  declare const CustomRelationProperties = "CustomRelationProperties";
14193
14163
  interface DeployedInstance extends AstNode {
14194
- readonly $container: DeploymentNodeBody;
14164
+ readonly $container: DeploymentNodeBody | ExtendDeploymentBody;
14195
14165
  readonly $type: 'DeployedInstance';
14196
14166
  body?: DeployedInstanceBody;
14197
14167
  element: ElementRef;
@@ -14207,7 +14177,7 @@ interface DeployedInstanceBody extends AstNode {
14207
14177
  }
14208
14178
  declare const DeployedInstanceBody = "DeployedInstanceBody";
14209
14179
  interface DeploymentNode extends AstNode {
14210
- readonly $container: DeploymentNodeBody | ModelDeployments;
14180
+ readonly $container: DeploymentNodeBody | ExtendDeploymentBody | ModelDeployments;
14211
14181
  readonly $type: 'DeploymentNode';
14212
14182
  body?: DeploymentNodeBody;
14213
14183
  kind: Reference<DeploymentNodeKind>;
@@ -14230,7 +14200,7 @@ interface DeploymentNodeKind extends AstNode {
14230
14200
  }
14231
14201
  declare const DeploymentNodeKind = "DeploymentNodeKind";
14232
14202
  interface DeploymentRelation extends AstNode {
14233
- readonly $container: DeploymentNodeBody | ModelDeployments;
14203
+ readonly $container: DeploymentNodeBody | ExtendDeploymentBody | ModelDeployments;
14234
14204
  readonly $type: 'DeploymentRelation';
14235
14205
  body?: DeploymentRelationBody;
14236
14206
  kind?: Reference<RelationshipKind>;
@@ -14484,6 +14454,21 @@ interface ExpandElementExpression extends AstNode {
14484
14454
  expand: ElementRef;
14485
14455
  }
14486
14456
  declare const ExpandElementExpression = "ExpandElementExpression";
14457
+ interface ExtendDeployment extends AstNode {
14458
+ readonly $container: ModelDeployments;
14459
+ readonly $type: 'ExtendDeployment';
14460
+ body: ExtendDeploymentBody;
14461
+ deploymentNode: StrictFqnRef;
14462
+ }
14463
+ declare const ExtendDeployment = "ExtendDeployment";
14464
+ interface ExtendDeploymentBody extends AstNode {
14465
+ readonly $container: ExtendDeployment;
14466
+ readonly $type: 'ExtendDeploymentBody';
14467
+ elements: Array<DeployedInstance | DeploymentNode | DeploymentRelation>;
14468
+ props: Array<ExtendElementProperty>;
14469
+ tags?: Tags;
14470
+ }
14471
+ declare const ExtendDeploymentBody = "ExtendDeploymentBody";
14487
14472
  interface ExtendElement extends AstNode {
14488
14473
  readonly $container: Model;
14489
14474
  readonly $type: 'ExtendElement';
@@ -14631,7 +14616,7 @@ interface LineProperty extends AstNode {
14631
14616
  }
14632
14617
  declare const LineProperty = "LineProperty";
14633
14618
  interface LinkProperty extends AstNode {
14634
- readonly $container: DeployedInstanceBody | DeploymentNodeBody | DeploymentRelationBody | DeploymentViewBody | DynamicViewBody | ElementBody | ElementViewBody | ExtendElementBody | RelationBody;
14619
+ readonly $container: DeployedInstanceBody | DeploymentNodeBody | DeploymentRelationBody | DeploymentViewBody | DynamicViewBody | ElementBody | ElementViewBody | ExtendDeploymentBody | ExtendElementBody | RelationBody;
14635
14620
  readonly $type: 'LinkProperty';
14636
14621
  key: 'link';
14637
14622
  title?: string;
@@ -14646,7 +14631,7 @@ interface MetadataAttribute extends AstNode {
14646
14631
  }
14647
14632
  declare const MetadataAttribute = "MetadataAttribute";
14648
14633
  interface MetadataBody extends AstNode {
14649
- readonly $container: DeployedInstanceBody | DeploymentNodeBody | DeploymentRelationBody | ElementBody | ExtendElementBody | RelationBody;
14634
+ readonly $container: DeployedInstanceBody | DeploymentNodeBody | DeploymentRelationBody | ElementBody | ExtendDeploymentBody | ExtendElementBody | RelationBody;
14650
14635
  readonly $type: 'MetadataBody';
14651
14636
  props: Array<MetadataAttribute>;
14652
14637
  }
@@ -14661,7 +14646,7 @@ declare const Model = "Model";
14661
14646
  interface ModelDeployments extends AstNode {
14662
14647
  readonly $container: LikeC4Grammar;
14663
14648
  readonly $type: 'ModelDeployments';
14664
- elements: Array<DeploymentNode | DeploymentRelation>;
14649
+ elements: Array<DeploymentNode | DeploymentRelation | ExtendDeployment>;
14665
14650
  name: 'deployment';
14666
14651
  }
14667
14652
  declare const ModelDeployments = "ModelDeployments";
@@ -14885,6 +14870,13 @@ interface StrictFqnElementRef extends AstNode {
14885
14870
  parent?: StrictFqnElementRef;
14886
14871
  }
14887
14872
  declare const StrictFqnElementRef = "StrictFqnElementRef";
14873
+ interface StrictFqnRef extends AstNode {
14874
+ readonly $container: ExtendDeployment | StrictFqnRef;
14875
+ readonly $type: 'StrictFqnRef';
14876
+ parent?: StrictFqnRef;
14877
+ value: Reference<Referenceable>;
14878
+ }
14879
+ declare const StrictFqnRef = "StrictFqnRef";
14888
14880
  interface Tag extends AstNode {
14889
14881
  readonly $container: SpecificationTag;
14890
14882
  readonly $type: 'Tag';
@@ -14892,7 +14884,7 @@ interface Tag extends AstNode {
14892
14884
  }
14893
14885
  declare const Tag = "Tag";
14894
14886
  interface Tags extends AstNode {
14895
- readonly $container: DeployedInstanceBody | DeploymentNodeBody | DeploymentRelation | DeploymentRelationBody | DeploymentViewBody | DynamicViewBody | ElementBody | ElementViewBody | ExtendElementBody | Relation | RelationBody | Tags;
14887
+ readonly $container: DeployedInstanceBody | DeploymentNodeBody | DeploymentRelation | DeploymentRelationBody | DeploymentViewBody | DynamicViewBody | ElementBody | ElementViewBody | ExtendDeploymentBody | ExtendElementBody | Relation | RelationBody | Tags;
14896
14888
  readonly $type: 'Tags';
14897
14889
  prev?: Tags;
14898
14890
  values: Array<Reference<Tag>>;
@@ -15086,6 +15078,8 @@ type LikeC4AstType = {
15086
15078
  ExcludePredicate: ExcludePredicate;
15087
15079
  ExpandElementExpression: ExpandElementExpression;
15088
15080
  ExpressionV2: ExpressionV2;
15081
+ ExtendDeployment: ExtendDeployment;
15082
+ ExtendDeploymentBody: ExtendDeploymentBody;
15089
15083
  ExtendElement: ExtendElement;
15090
15084
  ExtendElementBody: ExtendElementBody;
15091
15085
  ExtendElementProperty: ExtendElementProperty;
@@ -15157,6 +15151,7 @@ type LikeC4AstType = {
15157
15151
  SpecificationRule: SpecificationRule;
15158
15152
  SpecificationTag: SpecificationTag;
15159
15153
  StrictFqnElementRef: StrictFqnElementRef;
15154
+ StrictFqnRef: StrictFqnRef;
15160
15155
  StringProperty: StringProperty;
15161
15156
  StyleProperty: StyleProperty;
15162
15157
  Tag: Tag;
@@ -15194,7 +15189,7 @@ type LikeC4AstType = {
15194
15189
 
15195
15190
  type Guard<N extends AstNode> = (n: AstNode) => n is N;
15196
15191
  type Guarded<G> = G extends Guard<infer N> ? N : never;
15197
- declare const isValidatableAstNode: (n: AstNode) => n is DeployedInstance | DeploymentNode | DeploymentViewRulePredicate | DeploymentViewRuleStyle | ViewRuleAutoLayout | DynamicViewGlobalPredicateRef | DynamicViewIncludePredicate | ViewRuleGlobalStyle | ViewRuleStyle | ElementDescedantsExpression | ElementKindExpression | ElementRef | ElementTagExpression | ExpandElementExpression | WildcardExpression | ElementPredicateWhere | ElementPredicateWith | ElementPredicateWhereV2 | FqnRefExpr | ElementStringProperty | ElementStyleProperty | IconProperty | LinkProperty | MetadataBody | DirectedRelationExpr | InOutRelationExpr | IncomingRelationExpr | OutgoingRelationExpr | RelationPredicateWhereV2 | Element | ExtendElement | DeploymentView | DynamicView | ElementView | DirectedRelationExpression | InOutRelationExpression | IncomingRelationExpression | OutgoingRelationExpression | RelationPredicateWhere | RelationPredicateWith | RelationStringProperty | ArrowProperty | ColorProperty | LineProperty | PaddingSizeProperty | ShapeSizeProperty | TextSizeProperty | MetadataAttribute | NotationProperty | NotesProperty | SpecificationElementStringProperty | SpecificationRelationshipStringProperty | ViewStringProperty | BorderProperty | MultipleProperty | OpacityProperty | ShapeProperty | ViewRuleGlobalPredicateRef | ViewRuleGroup | ExcludePredicate | IncludePredicate | SpecificationRelationshipKind | GlobalStyle | SpecificationColor | NavigateToProperty | DynamicViewStep | Tags | DeploymentRelation | SpecificationDeploymentNodeKind | DynamicViewParallelSteps | GlobalDynamicPredicateGroup | DynamicViewPredicateIterator | Relation | SpecificationElementKind | GlobalPredicateGroup | Globals | GlobalStyleGroup | SpecificationRule | SpecificationTag;
15192
+ declare const isValidatableAstNode: (n: AstNode) => n is DeployedInstance | DeploymentNode | DeploymentViewRulePredicate | DeploymentViewRuleStyle | ViewRuleAutoLayout | DynamicViewGlobalPredicateRef | DynamicViewIncludePredicate | ViewRuleGlobalStyle | ViewRuleStyle | ElementDescedantsExpression | ElementKindExpression | ElementRef | ElementTagExpression | ExpandElementExpression | WildcardExpression | ElementPredicateWhere | ElementPredicateWith | ElementPredicateWhereV2 | FqnRefExpr | ElementStringProperty | ElementStyleProperty | IconProperty | LinkProperty | MetadataBody | DirectedRelationExpr | InOutRelationExpr | IncomingRelationExpr | OutgoingRelationExpr | RelationPredicateWhereV2 | Element | ExtendDeployment | ExtendElement | DeploymentView | DynamicView | ElementView | DirectedRelationExpression | InOutRelationExpression | IncomingRelationExpression | OutgoingRelationExpression | RelationPredicateWhere | RelationPredicateWith | RelationStringProperty | ArrowProperty | ColorProperty | LineProperty | PaddingSizeProperty | ShapeSizeProperty | TextSizeProperty | MetadataAttribute | NotationProperty | NotesProperty | SpecificationElementStringProperty | SpecificationRelationshipStringProperty | ViewStringProperty | BorderProperty | MultipleProperty | OpacityProperty | ShapeProperty | ViewRuleGlobalPredicateRef | ViewRuleGroup | ExcludePredicate | IncludePredicate | SpecificationRelationshipKind | GlobalStyle | SpecificationColor | NavigateToProperty | DynamicViewStep | Tags | DeploymentRelation | SpecificationDeploymentNodeKind | DynamicViewParallelSteps | GlobalDynamicPredicateGroup | DynamicViewPredicateIterator | Relation | SpecificationElementKind | GlobalPredicateGroup | Globals | GlobalStyleGroup | SpecificationRule | SpecificationTag;
15198
15193
  type ValidatableAstNode = Guarded<typeof isValidatableAstNode>;
15199
15194
  declare function checksFromDiagnostics(doc: LikeC4LangiumDocument): {
15200
15195
  isValid: (n: ValidatableAstNode) => boolean;
@@ -15263,17 +15258,17 @@ interface ParsedAstElement {
15263
15258
  description?: string;
15264
15259
  technology?: string;
15265
15260
  tags?: c4.NonEmptyArray<c4.Tag>;
15266
- links?: c4.NonEmptyArray<ParsedLink>;
15261
+ links?: c4.NonEmptyArray<c4.Link>;
15267
15262
  style: ParsedElementStyle;
15268
15263
  metadata?: {
15269
15264
  [key: string]: string;
15270
15265
  };
15271
15266
  }
15272
- interface ParsedAstExtendElement {
15267
+ interface ParsedAstExtend {
15273
15268
  id: c4.Fqn;
15274
15269
  astPath: string;
15275
15270
  tags?: c4.NonEmptyArray<c4.Tag>;
15276
- links?: c4.NonEmptyArray<ParsedLink>;
15271
+ links?: c4.NonEmptyArray<c4.Link>;
15277
15272
  metadata?: {
15278
15273
  [key: string]: string;
15279
15274
  };
@@ -15292,7 +15287,7 @@ interface ParsedAstRelation {
15292
15287
  line?: c4.RelationshipLineType;
15293
15288
  head?: c4.RelationshipArrowType;
15294
15289
  tail?: c4.RelationshipArrowType;
15295
- links?: c4.NonEmptyArray<ParsedLink>;
15290
+ links?: c4.NonEmptyArray<c4.Link>;
15296
15291
  navigateTo?: c4.ViewId;
15297
15292
  metadata?: {
15298
15293
  [key: string]: string;
@@ -15316,7 +15311,7 @@ interface ParsedAstElementView {
15316
15311
  title: string | null;
15317
15312
  description: string | null;
15318
15313
  tags: c4.NonEmptyArray<c4.Tag> | null;
15319
- links: c4.NonEmptyArray<ParsedLink> | null;
15314
+ links: c4.NonEmptyArray<c4.Link> | null;
15320
15315
  rules: c4.ViewRule[];
15321
15316
  manualLayout?: c4.ViewManualLayout;
15322
15317
  }
@@ -15327,7 +15322,7 @@ interface ParsedAstDynamicView {
15327
15322
  title: string | null;
15328
15323
  description: string | null;
15329
15324
  tags: c4.NonEmptyArray<c4.Tag> | null;
15330
- links: c4.NonEmptyArray<ParsedLink> | null;
15325
+ links: c4.NonEmptyArray<c4.Link> | null;
15331
15326
  steps: c4.DynamicViewStepOrParallel[];
15332
15327
  rules: Array<c4.DynamicViewRule>;
15333
15328
  manualLayout?: c4.ViewManualLayout;
@@ -15339,19 +15334,12 @@ interface ParsedAstDeploymentView {
15339
15334
  title: string | null;
15340
15335
  description: string | null;
15341
15336
  tags: c4.NonEmptyArray<c4.Tag> | null;
15342
- links: c4.NonEmptyArray<ParsedLink> | null;
15337
+ links: c4.NonEmptyArray<c4.Link> | null;
15343
15338
  rules: Array<c4.DeploymentViewRule>;
15344
15339
  }
15345
15340
  type ParsedAstView = ParsedAstElementView | ParsedAstDynamicView | ParsedAstDeploymentView;
15346
- interface ParsedLink {
15347
- title?: string;
15348
- url: string;
15349
- }
15350
- interface DocFqnIndexAstNodeDescription extends AstNodeDescription {
15351
- fqn: c4.Fqn;
15352
- }
15353
- interface DeploymentAstNodeDescription extends AstNodeDescription {
15354
- fqn: string;
15341
+ interface AstNodeDescriptionWithFqn extends AstNodeDescription {
15342
+ id: c4.Fqn;
15355
15343
  }
15356
15344
  type LikeC4AstNode = ValueOf<ConditionalPick<LikeC4AstType, AstNode>>;
15357
15345
  type LikeC4DocumentDiagnostic = Diagnostic & DiagnosticInfo<LikeC4AstNode>;
@@ -15359,13 +15347,13 @@ interface LikeC4DocumentProps {
15359
15347
  diagnostics?: Array<LikeC4DocumentDiagnostic>;
15360
15348
  c4Specification?: ParsedAstSpecification;
15361
15349
  c4Elements?: ParsedAstElement[];
15362
- c4ExtendElements?: ParsedAstExtendElement[];
15350
+ c4ExtendElements?: ParsedAstExtend[];
15351
+ c4ExtendDeployments?: ParsedAstExtend[];
15363
15352
  c4Relations?: ParsedAstRelation[];
15364
15353
  c4Globals?: ParsedAstGlobals;
15365
15354
  c4Views?: ParsedAstView[];
15366
15355
  c4Deployments?: ParsedAstDeployment[];
15367
15356
  c4DeploymentRelations?: ParsedAstDeploymentRelation[];
15368
- c4fqnIndex?: MultiMap<c4.Fqn, DocFqnIndexAstNodeDescription>;
15369
15357
  }
15370
15358
  type LikeC4GrammarDocument = Omit<LangiumDocument<LikeC4Grammar>, 'diagnostics'>;
15371
15359
  interface LikeC4LangiumDocument extends LikeC4GrammarDocument, LikeC4DocumentProps {
@@ -15382,7 +15370,7 @@ declare class LikeC4NameProvider extends DefaultNameProvider {
15382
15370
  }
15383
15371
 
15384
15372
  type ElementsContainer = Model | ElementBody | ExtendElementBody;
15385
- type DeploymentsContainer = ModelDeployments | DeploymentNodeBody;
15373
+ type DeploymentsContainer = ModelDeployments | DeploymentNodeBody | ExtendDeploymentBody;
15386
15374
  declare class LikeC4ScopeComputation extends DefaultScopeComputation {
15387
15375
  constructor(services: LikeC4Services);
15388
15376
  computeExports(document: LikeC4LangiumDocument, _cancelToken?: CancellationToken): Promise<AstNodeDescription[]>;
@@ -15401,116 +15389,121 @@ declare class LikeC4ScopeProvider extends DefaultScopeProvider {
15401
15389
  private deploymentsIndex;
15402
15390
  private fqnIndex;
15403
15391
  constructor(services: LikeC4Services);
15404
- private directChildrenOf;
15405
15392
  private uniqueDescedants;
15406
- private scopeElementRef;
15407
- private scopeExtendElement;
15408
- private scopeElementView;
15409
15393
  getScope(context: ReferenceInfo): Scope;
15394
+ private getScopeElementRef;
15395
+ private getScopeExtendElement;
15396
+ private getScopeElementView;
15397
+ private getScopeForStrictFqnRef;
15398
+ private getScopeExtendDeployment;
15410
15399
  protected getScopeForFqnRef(container: FqnRef, context: ReferenceInfo): any;
15400
+ /**
15401
+ * Computes the scope for a given reference context.
15402
+ *
15403
+ * @param context - The reference information containing the context for which the scope is being computed.
15404
+ * @param referenceType - The type of reference being resolved. Defaults to the reference type derived from the context.
15405
+ * @returns A scope containing the relevant AST node descriptions for the given reference context.
15406
+ *
15407
+ * This method first checks if there are precomputed scopes available in the document. If not, it falls back to the global scope.
15408
+ * It then iterates through the container hierarchy, collecting relevant scopes based on the reference type and container type.
15409
+ * Finally, it combines the collected scopes with the global scope to produce the final scope.
15410
+ */
15411
15411
  protected computeScope(context: ReferenceInfo, referenceType?: any): any;
15412
15412
  }
15413
15413
 
15414
- declare class DeploymentsIndex {
15415
- private services;
15416
- protected Names: LikeC4NameProvider;
15414
+ declare abstract class ADisposable implements Disposable {
15415
+ protected toDispose: Disposable[];
15416
+ protected isDisposed: boolean;
15417
+ onDispose(...disposable: Disposable[]): void;
15418
+ dispose(): void;
15419
+ protected throwIfDisposed(): void;
15420
+ }
15421
+
15422
+ declare class FqnIndex extends ADisposable {
15423
+ protected services: LikeC4Services;
15417
15424
  protected langiumDocuments: LangiumDocuments;
15418
- protected documentCache: DocumentCache<string, DocumentDeploymentsIndex>;
15425
+ protected documentCache: DefaultWeakMap<LikeC4LangiumDocument, DocumentFqnIndex>;
15426
+ protected cachePrefix: string;
15419
15427
  constructor(services: LikeC4Services);
15420
15428
  private documents;
15421
- get(document: LikeC4LangiumDocument): DocumentDeploymentsIndex;
15429
+ get(document: LikeC4LangiumDocument): DocumentFqnIndex;
15430
+ getFqn(el: Element | DeploymentElement): Fqn$1;
15431
+ byFqn(fqn: Fqn$1): Stream<AstNodeDescriptionWithFqn>;
15432
+ directChildrenOf(parent: Fqn$1): Stream<AstNodeDescriptionWithFqn>;
15422
15433
  /**
15423
- * Nested elements (nodes/artifacts) of the node
15424
- * @param nodeName Name of the deployment node
15425
- * @returns Stream of artifacts
15434
+ * Returns descedant elements with unique names in the scope
15426
15435
  */
15427
- nested(node: DeploymentNode): Stream<DeploymentAstNodeDescription>;
15428
- byFqn(fqnName: string): Stream<DeploymentAstNodeDescription>;
15429
- getFqn(node: DeploymentElement): Fqn;
15430
- createDocumentIndex(document: LikeC4LangiumDocument): DocumentDeploymentsIndex;
15436
+ uniqueDescedants(parent: Fqn$1): Stream<AstNodeDescriptionWithFqn>;
15437
+ protected createDocumentIndex(document: LikeC4LangiumDocument): DocumentFqnIndex;
15431
15438
  }
15432
- /**
15433
- * Index of deployment elements in the document
15434
- */
15435
- declare class DocumentDeploymentsIndex {
15436
- private _rootNodes;
15439
+ declare class DocumentFqnIndex {
15440
+ private _rootElements;
15437
15441
  /**
15438
- * Nested of a deployment node
15442
+ * direct children of elements
15439
15443
  */
15440
- private _nested;
15444
+ private _children;
15441
15445
  /**
15442
- * All elements by FQN
15446
+ * All descendants of an element (unique by name)
15443
15447
  */
15444
- private _byfqn;
15445
- static readonly EMPTY: DocumentDeploymentsIndex;
15446
- constructor(_rootNodes: Array<DeploymentAstNodeDescription>,
15448
+ private _descendants;
15447
15449
  /**
15448
- * Nested of a deployment node
15450
+ * All elements by FQN
15449
15451
  */
15450
- _nested: MultiMap<string, DeploymentAstNodeDescription>,
15452
+ private _byfqn;
15453
+ static readonly EMPTY: DocumentFqnIndex;
15454
+ constructor(_rootElements: Array<AstNodeDescriptionWithFqn>,
15451
15455
  /**
15452
- * All elements by FQN
15456
+ * direct children of elements
15453
15457
  */
15454
- _byfqn: MultiMap<string, DeploymentAstNodeDescription>);
15455
- rootNodes(): readonly DeploymentAstNodeDescription[];
15456
- byFqn(fqnName: string): readonly DeploymentAstNodeDescription[];
15458
+ _children: MultiMap<Fqn$1, AstNodeDescriptionWithFqn>,
15457
15459
  /**
15458
- * Returns artifacts of a deployment node
15459
- * @param nodeName Name of the deployment node
15460
- * @returns Stream of artifacts
15460
+ * All descendants of an element (unique by name)
15461
15461
  */
15462
- nested(nodeName: string): readonly DeploymentAstNodeDescription[];
15462
+ _descendants: MultiMap<Fqn$1, AstNodeDescriptionWithFqn>,
15463
15463
  /**
15464
- * Returns all deployment elements in the document,
15465
- * with unique combination "type and name"
15464
+ * All elements by FQN
15466
15465
  */
15467
- unique(): readonly DeploymentAstNodeDescription[];
15468
- }
15469
-
15470
- declare abstract class ADisposable implements Disposable {
15471
- protected toDispose: Disposable[];
15472
- protected isDisposed: boolean;
15473
- onDispose(...disposable: Disposable[]): void;
15474
- dispose(): void;
15475
- protected throwIfDisposed(): void;
15466
+ _byfqn: MultiMap<Fqn$1, AstNodeDescriptionWithFqn>);
15467
+ rootElements(): readonly AstNodeDescriptionWithFqn[];
15468
+ byFqn(fqn: Fqn$1): readonly AstNodeDescriptionWithFqn[];
15469
+ children(parent: Fqn$1): readonly AstNodeDescriptionWithFqn[];
15470
+ descendants(nodeName: Fqn$1): readonly AstNodeDescriptionWithFqn[];
15476
15471
  }
15477
15472
 
15478
- declare class FqnIndex extends ADisposable {
15479
- private services;
15480
- protected langiumDocuments: LangiumDocuments;
15473
+ declare class DeploymentsIndex extends FqnIndex {
15474
+ protected services: LikeC4Services;
15475
+ protected Names: LikeC4NameProvider;
15476
+ protected cachePrefix: string;
15481
15477
  constructor(services: LikeC4Services);
15482
- get documents(): any;
15483
- private entries;
15484
- getFqn(el: Element): Fqn | null;
15485
- byFqn(fqn: Fqn): Stream<AstNodeDescription>;
15486
- directChildrenOf(parent: Fqn): Stream<AstNodeDescription>;
15487
- /**
15488
- * Returns descedant elements with unique names in the scope
15489
- */
15490
- uniqueDescedants(parent: Fqn): Stream<AstNodeDescription>;
15478
+ protected createDocumentIndex(document: LikeC4LangiumDocument): DocumentFqnIndex;
15491
15479
  }
15492
15480
 
15493
15481
  type ModelParsedListener = (docs: URI[]) => void;
15482
+ type ParseModelResult = {
15483
+ model: c4.ParsedLikeC4Model;
15484
+ computeView: (view: c4.LikeC4View) => c4.ComputeViewResult;
15485
+ };
15494
15486
  declare class LikeC4ModelBuilder extends ADisposable {
15495
- private services;
15496
- private langiumDocuments;
15487
+ private parser;
15497
15488
  private listeners;
15489
+ private cache;
15490
+ private DocumentBuilder;
15498
15491
  constructor(services: LikeC4Services);
15499
15492
  /**
15500
15493
  * WARNING:
15501
15494
  * This method is internal and should to be called only when all documents are known to be parsed.
15502
15495
  * Otherwise, the model may be incomplete.
15503
15496
  */
15504
- unsafeSyncBuildModel(): c4.ParsedLikeC4Model | null;
15505
- buildModel(cancelToken?: CancellationToken): Promise<c4.ParsedLikeC4Model | null>;
15497
+ private unsafeSyncParseModel;
15498
+ parseModel(cancelToken?: CancellationToken): Promise<ParseModelResult | null>;
15506
15499
  private previousViews;
15507
15500
  /**
15508
15501
  * WARNING:
15509
15502
  * This method is internal and should to be called only when all documents are known to be parsed.
15510
15503
  * Otherwise, the model may be incomplete.
15511
15504
  */
15512
- unsafeSyncBuildComputedModel(model: c4.ParsedLikeC4Model): c4.ComputedLikeC4Model;
15513
- buildComputedModel(cancelToken?: CancellationToken): Promise<c4.ComputedLikeC4Model | null>;
15505
+ unsafeSyncBuildModel(): LikeC4Model.Computed;
15506
+ buildLikeC4Model(cancelToken?: CancellationToken): Promise<LikeC4Model.Computed>;
15514
15507
  computeView(viewId: ViewId, cancelToken?: CancellationToken): Promise<c4.ComputedView | null>;
15515
15508
  onModelParsed(callback: ModelParsedListener): Disposable;
15516
15509
  private documents;
@@ -15522,6 +15515,7 @@ declare class LikeC4ModelLocator {
15522
15515
  private fqnIndex;
15523
15516
  private deploymentsIndex;
15524
15517
  private langiumDocuments;
15518
+ private parser;
15525
15519
  constructor(services: LikeC4Services);
15526
15520
  private documents;
15527
15521
  getParsedElement(astNodeOrFqn: Element | c4.Fqn): ParsedAstElement | null;
@@ -15552,8 +15546,8 @@ declare class BaseParser {
15552
15546
  parseTags<E extends {
15553
15547
  tags?: Tags;
15554
15548
  }>(withTags?: E): c4.NonEmptyArray<c4.Tag> | null;
15555
- convertLinks(source?: LinkProperty['$container']): ParsedLink[] | undefined;
15556
- parseLinks(source?: LinkProperty['$container']): ParsedLink[] | undefined;
15549
+ convertLinks(source?: LinkProperty['$container']): c4.Link[] | undefined;
15550
+ parseLinks(source?: LinkProperty['$container']): c4.Link[] | undefined;
15557
15551
  }
15558
15552
 
15559
15553
  declare const DocumentParserFromMixins: {
@@ -15602,8 +15596,8 @@ declare const DocumentParserFromMixins: {
15602
15596
  parseTags<E extends {
15603
15597
  tags?: Tags;
15604
15598
  }>(withTags?: E): invariant<invariant> | null;
15605
- convertLinks(source?: LinkProperty["$container"]): ParsedLink[] | undefined;
15606
- parseLinks(source?: LinkProperty["$container"]): ParsedLink[] | undefined;
15599
+ convertLinks(source?: LinkProperty["$container"]): invariant[] | undefined;
15600
+ parseLinks(source?: LinkProperty["$container"]): invariant[] | undefined;
15607
15601
  parseDeploymentView(astNode: DeploymentView): ParsedAstDeploymentView;
15608
15602
  parseDeploymentViewRule(astRule: DeploymentViewRule): invariant;
15609
15603
  parseDeploymentViewRulePredicate(astRule: DeploymentViewRulePredicate): invariant;
@@ -15618,6 +15612,7 @@ declare const DocumentParserFromMixins: {
15618
15612
  parseDeployment(): void;
15619
15613
  parseDeploymentNode(astNode: DeploymentNode): ParsedAstDeployment.Node;
15620
15614
  parseDeployedInstance(astNode: DeployedInstance): ParsedAstDeployment.Instance;
15615
+ parseExtendDeployment(astNode: ExtendDeployment): ParsedAstExtend | null;
15621
15616
  parseDeploymentRelation(astNode: DeploymentRelation): ParsedAstDeploymentRelation;
15622
15617
  };
15623
15618
  } & {
@@ -15661,8 +15656,8 @@ declare const DocumentParserFromMixins: {
15661
15656
  parseTags<E extends {
15662
15657
  tags?: Tags;
15663
15658
  }>(withTags?: E): invariant<invariant> | null;
15664
- convertLinks(source?: LinkProperty["$container"]): ParsedLink[] | undefined;
15665
- parseLinks(source?: LinkProperty["$container"]): ParsedLink[] | undefined;
15659
+ convertLinks(source?: LinkProperty["$container"]): invariant[] | undefined;
15660
+ parseLinks(source?: LinkProperty["$container"]): invariant[] | undefined;
15666
15661
  parseDeploymentView(astNode: DeploymentView): ParsedAstDeploymentView;
15667
15662
  parseDeploymentViewRule(astRule: DeploymentViewRule): invariant;
15668
15663
  parseDeploymentViewRulePredicate(astRule: DeploymentViewRulePredicate): invariant;
@@ -15677,6 +15672,7 @@ declare const DocumentParserFromMixins: {
15677
15672
  parseDeployment(): void;
15678
15673
  parseDeploymentNode(astNode: DeploymentNode): ParsedAstDeployment.Node;
15679
15674
  parseDeployedInstance(astNode: DeployedInstance): ParsedAstDeployment.Instance;
15675
+ parseExtendDeployment(astNode: ExtendDeployment): ParsedAstExtend | null;
15680
15676
  parseDeploymentRelation(astNode: DeploymentRelation): ParsedAstDeploymentRelation;
15681
15677
  };
15682
15678
  } & {
@@ -15697,8 +15693,8 @@ declare const DocumentParserFromMixins: {
15697
15693
  parseTags<E extends {
15698
15694
  tags?: Tags;
15699
15695
  }>(withTags?: E): invariant<invariant> | null;
15700
- convertLinks(source?: LinkProperty["$container"]): ParsedLink[] | undefined;
15701
- parseLinks(source?: LinkProperty["$container"]): ParsedLink[] | undefined;
15696
+ convertLinks(source?: LinkProperty["$container"]): invariant[] | undefined;
15697
+ parseLinks(source?: LinkProperty["$container"]): invariant[] | undefined;
15702
15698
  };
15703
15699
  } & {
15704
15700
  new (...args: any[]): {
@@ -15726,8 +15722,8 @@ declare const DocumentParserFromMixins: {
15726
15722
  parseTags<E extends {
15727
15723
  tags?: Tags;
15728
15724
  }>(withTags?: E): invariant<invariant> | null;
15729
- convertLinks(source?: LinkProperty["$container"]): ParsedLink[] | undefined;
15730
- parseLinks(source?: LinkProperty["$container"]): ParsedLink[] | undefined;
15725
+ convertLinks(source?: LinkProperty["$container"]): invariant[] | undefined;
15726
+ parseLinks(source?: LinkProperty["$container"]): invariant[] | undefined;
15731
15727
  };
15732
15728
  } & {
15733
15729
  new (...args: any[]): {
@@ -15756,11 +15752,12 @@ declare const DocumentParserFromMixins: {
15756
15752
  parseTags<E extends {
15757
15753
  tags?: Tags;
15758
15754
  }>(withTags?: E): invariant<invariant> | null;
15759
- convertLinks(source?: LinkProperty["$container"]): ParsedLink[] | undefined;
15760
- parseLinks(source?: LinkProperty["$container"]): ParsedLink[] | undefined;
15755
+ convertLinks(source?: LinkProperty["$container"]): invariant[] | undefined;
15756
+ parseLinks(source?: LinkProperty["$container"]): invariant[] | undefined;
15761
15757
  parseDeployment(): void;
15762
15758
  parseDeploymentNode(astNode: DeploymentNode): ParsedAstDeployment.Node;
15763
15759
  parseDeployedInstance(astNode: DeployedInstance): ParsedAstDeployment.Instance;
15760
+ parseExtendDeployment(astNode: ExtendDeployment): ParsedAstExtend | null;
15764
15761
  parseDeploymentRelation(astNode: DeploymentRelation): ParsedAstDeploymentRelation;
15765
15762
  };
15766
15763
  } & {
@@ -15768,6 +15765,7 @@ declare const DocumentParserFromMixins: {
15768
15765
  parseDeployment(): void;
15769
15766
  parseDeploymentNode(astNode: DeploymentNode): ParsedAstDeployment.Node;
15770
15767
  parseDeployedInstance(astNode: DeployedInstance): ParsedAstDeployment.Instance;
15768
+ parseExtendDeployment(astNode: ExtendDeployment): ParsedAstExtend | null;
15771
15769
  parseDeploymentRelation(astNode: DeploymentRelation): ParsedAstDeploymentRelation;
15772
15770
  parseFqnRef(astNode: FqnRef): invariant;
15773
15771
  parseFqnExpr(astNode: FqnExpr): invariant;
@@ -15790,14 +15788,14 @@ declare const DocumentParserFromMixins: {
15790
15788
  parseTags<E extends {
15791
15789
  tags?: Tags;
15792
15790
  }>(withTags?: E): invariant<invariant> | null;
15793
- convertLinks(source?: LinkProperty["$container"]): ParsedLink[] | undefined;
15794
- parseLinks(source?: LinkProperty["$container"]): ParsedLink[] | undefined;
15791
+ convertLinks(source?: LinkProperty["$container"]): invariant[] | undefined;
15792
+ parseLinks(source?: LinkProperty["$container"]): invariant[] | undefined;
15795
15793
  };
15796
15794
  } & {
15797
15795
  new (...args: any[]): {
15798
15796
  parseModel(): void;
15799
15797
  parseElement(astNode: Element): ParsedAstElement;
15800
- parseExtendElement(astNode: ExtendElement): ParsedAstExtendElement | null;
15798
+ parseExtendElement(astNode: ExtendElement): ParsedAstExtend | null;
15801
15799
  parseRelation(astNode: Relation): ParsedAstRelation;
15802
15800
  isValid: IsValidFn;
15803
15801
  readonly services: LikeC4Services;
@@ -15813,8 +15811,8 @@ declare const DocumentParserFromMixins: {
15813
15811
  parseTags<E extends {
15814
15812
  tags?: Tags;
15815
15813
  }>(withTags?: E): invariant<invariant> | null;
15816
- convertLinks(source?: LinkProperty["$container"]): ParsedLink[] | undefined;
15817
- parseLinks(source?: LinkProperty["$container"]): ParsedLink[] | undefined;
15814
+ convertLinks(source?: LinkProperty["$container"]): invariant[] | undefined;
15815
+ parseLinks(source?: LinkProperty["$container"]): invariant[] | undefined;
15818
15816
  };
15819
15817
  } & {
15820
15818
  new (...args: any[]): {
@@ -15839,8 +15837,8 @@ declare const DocumentParserFromMixins: {
15839
15837
  parseTags<E extends {
15840
15838
  tags?: Tags;
15841
15839
  }>(withTags?: E): invariant<invariant> | null;
15842
- convertLinks(source?: LinkProperty["$container"]): ParsedLink[] | undefined;
15843
- parseLinks(source?: LinkProperty["$container"]): ParsedLink[] | undefined;
15840
+ convertLinks(source?: LinkProperty["$container"]): invariant[] | undefined;
15841
+ parseLinks(source?: LinkProperty["$container"]): invariant[] | undefined;
15844
15842
  };
15845
15843
  } & typeof BaseParser;
15846
15844
  declare class DocumentParser extends DocumentParserFromMixins {
@@ -15849,8 +15847,10 @@ declare class LikeC4ModelParser {
15849
15847
  private services;
15850
15848
  private cachedParsers;
15851
15849
  constructor(services: LikeC4Services);
15850
+ documents(): Stream<ParsedLikeC4LangiumDocument>;
15852
15851
  parse(doc: LangiumDocument): ParsedLikeC4LangiumDocument;
15853
15852
  forDocument(doc: LangiumDocument): DocumentParser;
15853
+ private createParser;
15854
15854
  }
15855
15855
 
15856
15856
  declare class LikeC4DocumentSymbolProvider implements DocumentSymbolProvider {
@@ -15873,7 +15873,7 @@ declare class LikeC4DocumentSymbolProvider implements DocumentSymbolProvider {
15873
15873
  protected getTagSymbol(astTag: SpecificationTag): DocumentSymbol | null;
15874
15874
  protected getLibIconSymbol(astTag: LibIcon): DocumentSymbol | null;
15875
15875
  protected getViewSymbol(astView: LikeC4View): DocumentSymbol[];
15876
- protected getDeploymentElementSymbol(el: DeploymentElement | DeploymentRelation): DocumentSymbol[];
15876
+ protected getDeploymentElementSymbol(el: DeploymentElement | DeploymentRelation | ExtendDeployment): DocumentSymbol[];
15877
15877
  protected getDeploymentNodeSymbol(astElement: DeploymentNode): DocumentSymbol[];
15878
15878
  protected getDeployedInstanceSymbol(astElement: DeployedInstance): DocumentSymbol[];
15879
15879
  protected symbolKind(node: AstNode): SymbolKind;
@@ -15958,6 +15958,7 @@ declare class LikeC4Views {
15958
15958
  private services;
15959
15959
  private cache;
15960
15960
  private viewsWithReportedErrors;
15961
+ private ModelBuilder;
15961
15962
  constructor(services: LikeC4Services);
15962
15963
  get layouter(): GraphvizLayouter;
15963
15964
  computedViews(cancelToken?: CancellationToken): Promise<ComputedView[]>;
@@ -15985,8 +15986,7 @@ interface LikeC4AddedServices {
15985
15986
  documentation: {
15986
15987
  DocumentationProvider: LikeC4DocumentationProvider;
15987
15988
  };
15988
- WorkspaceCache: WorkspaceCache<string, any>;
15989
- DocumentCache: DocumentCache<string, any>;
15989
+ ValidatedWorkspaceCache: WorkspaceCache<string, any>;
15990
15990
  Rpc: Rpc;
15991
15991
  likec4: {
15992
15992
  Views: LikeC4Views;
@@ -16062,7 +16062,6 @@ declare class LikeC4 {
16062
16062
  * By default in current folder
16063
16063
  */
16064
16064
  static fromWorkspace(path?: string, opts?: LikeC4Options): Promise<LikeC4>;
16065
- private modelComputedRef;
16066
16065
  private modelLayoutedRef;
16067
16066
  private logger;
16068
16067
  private constructor();
@@ -16074,16 +16073,16 @@ declare class LikeC4 {
16074
16073
  */
16075
16074
  diagrams(): Promise<DiagramView[]>;
16076
16075
  /**
16077
- * Synchronously builds architecture model
16078
- * Only compute views predicates {@link ComputedView} - i.e. no layout
16076
+ * Builds LikeC4Model from all documents
16077
+ * Only computes view predicates {@link ComputedView} - i.e. no layout
16079
16078
  * Not ready for rendering, but enough to traverse
16080
16079
  */
16081
- computedModel(): LikeC4Model.Computed;
16080
+ computedModel(): LikeC4Model$1.Computed;
16082
16081
  /**
16083
- * Same as {@link computedModel()}, after applies layout
16082
+ * Same as {@link computedModel()}, but also applies layout
16084
16083
  * Ready for rendering
16085
16084
  */
16086
- layoutedModel(): Promise<LikeC4Model.Layouted>;
16085
+ layoutedModel(): Promise<LikeC4Model$1.Layouted>;
16087
16086
  getErrors(): {
16088
16087
  message: string;
16089
16088
  line: number;