likec4 1.19.0 → 1.19.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.
@@ -0,0 +1 @@
1
+ "use strict";const index_DafVOuVd=require("../shared/likec4.D81G5JV4.cjs");function createLikeC4Model(e){return index_DafVOuVd.j.create(e)}Object.defineProperty(exports,"ComputedNode",{enumerable:!0,get:function(){return index_DafVOuVd.h}}),Object.defineProperty(exports,"ComputedView",{enumerable:!0,get:function(){return index_DafVOuVd.v}}),Object.defineProperty(exports,"Connection",{enumerable:!0,get:function(){return index_DafVOuVd.a}}),exports.ConnectionModel=index_DafVOuVd.Z,exports.DeployedInstanceModel=index_DafVOuVd.$,exports.DeploymentConnectionModel=index_DafVOuVd.G,exports.DeploymentNodeModel=index_DafVOuVd._,exports.DeploymentRelationModel=index_DafVOuVd.f,Object.defineProperty(exports,"DiagramNode",{enumerable:!0,get:function(){return index_DafVOuVd.W}}),exports.EdgeModel=index_DafVOuVd.T,exports.ElementModel=index_DafVOuVd.m,exports.LikeC4DeploymentModel=index_DafVOuVd.M,exports.LikeC4Model=index_DafVOuVd.j,exports.LikeC4ViewModel=index_DafVOuVd.P,exports.NodeModel=index_DafVOuVd.z,exports.RelationshipModel=index_DafVOuVd.L,exports.deploymentConnection=index_DafVOuVd.R,exports.differenceConnections=index_DafVOuVd.b,exports.findAscendingConnections=index_DafVOuVd.c,exports.findDeepestNestedConnection=index_DafVOuVd.I,exports.findDescendantConnections=index_DafVOuVd.y,exports.hasSameSource=index_DafVOuVd.A,exports.hasSameSourceTarget=index_DafVOuVd.d,exports.hasSameTarget=index_DafVOuVd.O,exports.isAnyInOut=index_DafVOuVd.F,exports.isIncoming=index_DafVOuVd.e,exports.isNestedConnection=index_DafVOuVd.o,exports.isOutgoing=index_DafVOuVd.D,exports.mergeConnections=index_DafVOuVd.s,exports.modelConnection=index_DafVOuVd.C,exports.sortConnectionsByBoundaryHierarchy=index_DafVOuVd.p,exports.sortDeepestFirst=index_DafVOuVd.g,exports.createLikeC4Model=createLikeC4Model;
@@ -0,0 +1,258 @@
1
+ import { E as ElementModel, D as DeploymentElementModel, F as Fqn, A as AnyAux, a as DeploymentNodeModel, b as DeployedInstanceModel, R as RelationshipsAccum, I as IteratorLike, c as RelationshipModel, d as DeploymentRelationModel, L as LikeC4Model } from '../shared/likec4.DCwaTTuF.cjs';
2
+ export { k as AbstractRelation, l as AutoLayoutDirection, e as Aux, B as BBox, m as Color, n as ComputedDeploymentView, o as ComputedDynamicView, p as ComputedEdge, q as ComputedElementView, r as ComputedLikeC4Model, C as ComputedNode, i as ComputedView, s as DeployedInstance, t as DeploymentElement, u as DeploymentNode, v as DeploymentNodeKind, w as DeploymentRelation, x as DeploymentView, y as DiagramEdge, j as DiagramNode, z as DiagramView, G as DynamicView, H as EdgeId, f as EdgeModel, J as Element, K as ElementKind, M as ElementView, O as HexColorLiteral, P as LayoutedLikeC4Model, g as LikeC4DeploymentModel, Q as LikeC4View, h as LikeC4ViewModel, S as NodeId, N as NodeModel, T as OverviewGraph, U as ParsedLikeC4Model, V as Point, W as RelationExpr, X as RelationId, Y as StepEdgeId, Z as Tag, _ as ThemeColor, $ as ViewId, a0 as WhereOperator, a1 as XYPoint } from '../shared/likec4.DCwaTTuF.cjs';
3
+ import 'type-fest';
4
+
5
+ type IterableContainer<T = unknown> = ReadonlyArray<T> | readonly [];
6
+ type ReorderedArray<T extends IterableContainer> = {
7
+ -readonly [P in keyof T]: T[number];
8
+ };
9
+
10
+ interface Connection<Elem = ElementModel | DeploymentElementModel, Id = string> {
11
+ readonly id: Id;
12
+ readonly source: Elem;
13
+ readonly target: Elem;
14
+ /**
15
+ * Common ancestor of the source and target elements.
16
+ * Represents the boundary of the connection.
17
+ */
18
+ readonly boundary: Elem | null;
19
+ /**
20
+ * Human readable expression of the connection
21
+ * Mostly used for testing and debugging
22
+ */
23
+ readonly expression: string;
24
+ mergeWith(this: Connection<Elem, Id>, other: typeof this): typeof this;
25
+ nonEmpty(): boolean;
26
+ difference(this: Connection<Elem, Id>, other: typeof this): typeof this;
27
+ intersect(this: Connection<Elem, Id>, other: typeof this): typeof this;
28
+ equals(other: Connection): boolean;
29
+ }
30
+ declare namespace Connection {
31
+ type ConnectionPredicate = <C extends Connection<{
32
+ id: string;
33
+ }, any>>(connection: C) => boolean;
34
+ type ElementId = Fqn | string;
35
+ export const isInside: (fqn: ElementId) => ConnectionPredicate;
36
+ export const isDirectedBetween: (source: ElementId, target: ElementId) => ConnectionPredicate;
37
+ export const isAnyBetween: (source: ElementId, target: ElementId) => ConnectionPredicate;
38
+ export const isIncoming: (target: ElementId) => ConnectionPredicate;
39
+ export const isOutgoing: (source: ElementId) => ConnectionPredicate;
40
+ export const isAnyInOut: (source: ElementId) => ConnectionPredicate;
41
+ export { };
42
+ }
43
+
44
+ declare const customInspectSymbol: unique symbol;
45
+
46
+ /**
47
+ * Connection is ephemeral entity, result of a resolving relationships between source and target.
48
+ * Includes direct relationships and/or between their nested elements.
49
+ */
50
+ declare class DeploymentConnectionModel<M extends AnyAux = AnyAux> implements Connection<DeploymentElementModel<M>, M['EdgeId']> {
51
+ readonly source: DeploymentNodeModel<M> | DeployedInstanceModel<M>;
52
+ readonly target: DeploymentNodeModel<M> | DeployedInstanceModel<M>;
53
+ readonly relations: RelationshipsAccum<M>;
54
+ constructor(source: DeploymentNodeModel<M> | DeployedInstanceModel<M>, target: DeploymentNodeModel<M> | DeployedInstanceModel<M>, relations: RelationshipsAccum<M>);
55
+ readonly id: M['EdgeId'];
56
+ /**
57
+ * Human readable expression of the connection
58
+ * Mostly used for testing and debugging
59
+ */
60
+ get expression(): string;
61
+ private _boundary;
62
+ /**
63
+ * Common ancestor of the source and target elements.
64
+ * Represents the boundary of the connection.
65
+ */
66
+ get boundary(): DeploymentNodeModel<M> | null;
67
+ nonEmpty(): boolean;
68
+ [customInspectSymbol](depth: any, inspectOptions: any, inspect: any): string;
69
+ toString(): string;
70
+ /**
71
+ * Check if connection contains deployment relation,
72
+ * that is directly connected to source or target.
73
+ */
74
+ hasDirectDeploymentRelation(): boolean;
75
+ values(): IteratorLike<RelationshipModel<M> | DeploymentRelationModel<M>>;
76
+ /**
77
+ * Merge with another connection, if it has the same source and target.
78
+ * Returns new connection with union of relationships.
79
+ */
80
+ mergeWith(other: DeploymentConnectionModel<M>): DeploymentConnectionModel<M>;
81
+ difference(other: DeploymentConnectionModel<M>): DeploymentConnectionModel<M>;
82
+ intersect(other: DeploymentConnectionModel<M>): DeploymentConnectionModel<M>;
83
+ equals(other: Connection): boolean;
84
+ /**
85
+ * Creates a clone of the current `DeploymentConnectionModel` instance with optional overrides.
86
+ * if `null` is provided in overrides, the corresponding relation set will be empty.
87
+ */
88
+ update(overrides?: {
89
+ model?: ReadonlySet<RelationshipModel<M>> | null;
90
+ deployment?: ReadonlySet<DeploymentRelationModel<M>> | null;
91
+ }): DeploymentConnectionModel<M>;
92
+ }
93
+
94
+ /**
95
+ * Connection refers to any relationships between two elements,
96
+ * both direct and implicit ones (between their nested elements).
97
+ *
98
+ * Merges relationships together to an single edge on the diagram.
99
+ */
100
+ declare class ConnectionModel<M extends AnyAux = AnyAux> implements Connection<ElementModel<M>, M['EdgeId']> {
101
+ readonly source: ElementModel<M>;
102
+ readonly target: ElementModel<M>;
103
+ readonly relations: ReadonlySet<RelationshipModel<M>>;
104
+ readonly id: M['EdgeId'];
105
+ constructor(source: ElementModel<M>, target: ElementModel<M>, relations?: ReadonlySet<RelationshipModel<M>>);
106
+ private _boundary;
107
+ /**
108
+ * Common ancestor of the source and target elements.
109
+ * Represents the boundary of the connection.
110
+ */
111
+ get boundary(): ElementModel<M> | null;
112
+ /**
113
+ * Human readable expression of the connection
114
+ * Mostly used for testing and debugging
115
+ */
116
+ get expression(): string;
117
+ /**
118
+ * Returns true if only includes relations between the source and target elements.
119
+ */
120
+ get isDirect(): boolean;
121
+ /**
122
+ * Returns true if includes relations between nested elements of the source and target elements.
123
+ */
124
+ get isImplicit(): boolean;
125
+ get directRelations(): ReadonlySet<RelationshipModel<M>>;
126
+ nonEmpty(): boolean;
127
+ mergeWith(other: ConnectionModel<M>): ConnectionModel<M>;
128
+ difference(other: ConnectionModel<M>): ConnectionModel<M>;
129
+ intersect(other: ConnectionModel<M>): ConnectionModel<M>;
130
+ equals(other: Connection): boolean;
131
+ /**
132
+ * Returns a new instance with the updated relations.
133
+ *
134
+ * @param relations - A readonly set of `RelationshipModel` instances representing the new relations.
135
+ * @returns A new `ConnectionModel` instance with the updated relations.
136
+ */
137
+ update(relations: ReadonlySet<RelationshipModel<M>>): ConnectionModel<M>;
138
+ [customInspectSymbol](depth: any, inspectOptions: any, inspect: any): string;
139
+ toString(): string;
140
+ /**
141
+ * Creates a new connection with reversed direction (target becomes source and vice versa)
142
+ * @param search - When true, attempts to find an existing connection between the reversed nodes
143
+ */
144
+ reversed(search?: boolean): ConnectionModel<M>;
145
+ }
146
+
147
+ /**
148
+ * Check if connection is nested inside another connection
149
+ * (i.e. between descendants)
150
+ */
151
+ declare function isNestedConnection<T extends {
152
+ id: string;
153
+ }>(parent: WithSourceTarget<NoInfer<T>>): (nested: WithSourceTarget<T>) => boolean;
154
+ declare function isNestedConnection<T extends {
155
+ id: string;
156
+ }>(nested: WithSourceTarget<T>, parent: WithSourceTarget<T>): boolean;
157
+ type ConnectionElemId = Connection<{
158
+ readonly id: string;
159
+ }, any>;
160
+ declare function findDeepestNestedConnection<C extends ConnectionElemId>(connections: ReadonlyArray<C>, connection: C): C | null;
161
+ declare function sortDeepestFirst<C extends ConnectionElemId>(connections: ReadonlyArray<C>): C[];
162
+ type WithBoundary = {
163
+ boundary: null | {
164
+ id: string;
165
+ };
166
+ };
167
+ declare function sortConnectionsByBoundaryHierarchy(sort?: 'asc' | 'desc'): <T extends WithBoundary, A extends IterableContainer<T>>(array: A) => ReorderedArray<A>;
168
+ declare function sortConnectionsByBoundaryHierarchy<T extends WithBoundary, A extends IterableContainer<T>>(array: A, sort?: 'asc' | 'desc'): ReorderedArray<A>;
169
+ /**
170
+ * Find connections that includes given connection (i.e between it's ancestors)
171
+ */
172
+ declare function findAscendingConnections<C extends ConnectionElemId>(connections: ReadonlyArray<C>, connection: C): Array<C>;
173
+ /**
174
+ * Find connections that includes given connection (i.e between it's descendants)
175
+ */
176
+ declare function findDescendantConnections<C extends ConnectionElemId>(connections: ReadonlyArray<C>, connection: C): Array<C>;
177
+ declare function mergeConnections<C extends Connection>(connections: ReadonlyArray<C>): C[];
178
+ /**
179
+ * Excludes the values existing in `other` array.
180
+ * The output maintains the same order as the input.
181
+ */
182
+ declare function differenceConnections<C extends Connection>(source: Iterable<C>, exclude: Iterable<C>): C[];
183
+ type WithSourceTarget<T = unknown> = {
184
+ source: T;
185
+ target: T;
186
+ };
187
+ declare function hasSameSourceTarget<T>(a: WithSourceTarget<NoInfer<T>>): (b: WithSourceTarget<T>) => boolean;
188
+ declare function hasSameSourceTarget<T>(a: WithSourceTarget<T>, b: WithSourceTarget<T>): boolean;
189
+ declare function hasSameSource<T>(a: WithSourceTarget<NoInfer<T>>): (b: WithSourceTarget<T>) => boolean;
190
+ declare function hasSameSource<T>(a: WithSourceTarget<T>, b: WithSourceTarget<T>): boolean;
191
+ declare function hasSameTarget<T>(a: WithSourceTarget<NoInfer<T>>): (b: WithSourceTarget<T>) => boolean;
192
+ declare function hasSameTarget<T>(a: WithSourceTarget<T>, b: WithSourceTarget<T>): boolean;
193
+ type WithId<T> = {
194
+ id: T;
195
+ };
196
+ declare function isOutgoing<T extends string>(source: WithId<NoInfer<T>>): (a: WithSourceTarget<WithId<T>>) => boolean;
197
+ declare function isOutgoing<T extends string>(a: WithSourceTarget<WithId<T>>, source: WithId<T>): boolean;
198
+ declare function isIncoming<T extends string>(target: WithId<NoInfer<T>>): (a: WithSourceTarget<WithId<T>>) => boolean;
199
+ declare function isIncoming<T extends string>(a: WithSourceTarget<WithId<T>>, target: WithId<T>): boolean;
200
+ declare function isAnyInOut<T extends string>(source: WithId<NoInfer<T>>): (a: WithSourceTarget<WithId<T>>) => boolean;
201
+ declare function isAnyInOut<T extends string>(a: WithSourceTarget<WithId<T>>, source: WithId<T>): boolean;
202
+
203
+ /**
204
+ * Resolve connection from source to target
205
+ * If direction is `both`, also look for reverse connection
206
+ *
207
+ * @default direction directed
208
+ */
209
+ declare function findConnection$1<M extends AnyAux>(source: DeploymentElementModel<M>, target: DeploymentElementModel<NoInfer<M>>, direction: 'directed'): readonly [DeploymentConnectionModel<M>] | readonly [];
210
+ declare function findConnection$1<M extends AnyAux>(source: DeploymentElementModel<M>, target: DeploymentElementModel<NoInfer<M>>, direction: 'both'): readonly [DeploymentConnectionModel<M>, DeploymentConnectionModel<M>] | readonly [DeploymentConnectionModel<M>] | readonly [];
211
+ declare function findConnection$1<M extends AnyAux>(source: DeploymentElementModel<M>, target: DeploymentElementModel<NoInfer<M>>, direction?: 'directed' | 'both'): readonly [DeploymentConnectionModel<M>, DeploymentConnectionModel<M>] | readonly [DeploymentConnectionModel<M>] | readonly [];
212
+ /**
213
+ * Resolve all connections between element and others
214
+ * By default, look for both directions.
215
+ *
216
+ * @default direction both
217
+ */
218
+ declare function findConnectionsBetween$1<M extends AnyAux>(element: DeploymentElementModel<M>, others: Iterable<DeploymentElementModel<NoInfer<M>>>, direction?: 'directed' | 'both'): readonly DeploymentConnectionModel<M>[];
219
+ /**
220
+ * Resolve all connections within a given set of elements
221
+ */
222
+ declare function findConnectionsWithin$1<M extends AnyAux>(elements: Iterable<DeploymentElementModel<M>>): readonly DeploymentConnectionModel<M>[];
223
+
224
+ declare namespace find$1 {
225
+ export { findConnection$1 as findConnection, findConnectionsBetween$1 as findConnectionsBetween, findConnectionsWithin$1 as findConnectionsWithin };
226
+ }
227
+
228
+ /**
229
+ * Resolve connection from source to target
230
+ *
231
+ * @param direction - if 'both', also returns connection from target to source
232
+ * @default `directed`
233
+ */
234
+ declare function findConnection<M extends AnyAux>(source: ElementModel<M>, target: ElementModel<M>, direction?: 'directed' | 'both'): [ConnectionModel<M>, ConnectionModel<M>] | [ConnectionModel<M>] | [];
235
+ /**
236
+ * Resolve all connections between element and others
237
+ * @param direction - if 'directed', only look for outgoing connections from the element to others
238
+ * @default `both`
239
+ */
240
+ declare function findConnectionsBetween<M extends AnyAux>(element: ElementModel<M>, others: Iterable<ElementModel<NoInfer<M>>>, direction?: 'directed' | 'both'): readonly ConnectionModel<M>[];
241
+ /**
242
+ * Resolve all connections within a given set of elements
243
+ */
244
+ declare function findConnectionsWithin<M extends AnyAux>(elements: Iterable<ElementModel<M>>): readonly ConnectionModel<M>[];
245
+
246
+ declare const find_findConnection: typeof findConnection;
247
+ declare const find_findConnectionsBetween: typeof findConnectionsBetween;
248
+ declare const find_findConnectionsWithin: typeof findConnectionsWithin;
249
+ declare namespace find {
250
+ export { find_findConnection as findConnection, find_findConnectionsBetween as findConnectionsBetween, find_findConnectionsWithin as findConnectionsWithin };
251
+ }
252
+
253
+ /**
254
+ * Used by vite plugin to generate `virtual:likec4/model`
255
+ */
256
+ declare function createLikeC4Model(model: any): LikeC4Model;
257
+
258
+ export { AnyAux, Connection, ConnectionModel, DeployedInstanceModel, DeploymentConnectionModel, DeploymentElementModel, DeploymentNodeModel, DeploymentRelationModel, ElementModel, Fqn, LikeC4Model, RelationshipModel, createLikeC4Model, find$1 as deploymentConnection, differenceConnections, findAscendingConnections, findDeepestNestedConnection, findDescendantConnections, hasSameSource, hasSameSourceTarget, hasSameTarget, isAnyInOut, isIncoming, isNestedConnection, isOutgoing, mergeConnections, find as modelConnection, sortConnectionsByBoundaryHierarchy, sortDeepestFirst };
@@ -1 +1 @@
1
- import{j as e}from"../shared/likec4.LktBLTET.mjs";export{h as ComputedNode,v as ComputedView,a as Connection,Z as ConnectionModel,$ as DeployedInstanceModel,G as DeploymentConnectionModel,_ as DeploymentNodeModel,f as DeploymentRelationModel,W as DiagramNode,T as EdgeModel,m as ElementModel,M as LikeC4DeploymentModel,P as LikeC4ViewModel,z as NodeModel,L as RelationshipModel,R as deploymentConnection,b as differenceConnections,c as findAscendingConnections,I as findDeepestNestedConnection,y as findDescendantConnections,A as hasSameSource,d as hasSameSourceTarget,O as hasSameTarget,F as isAnyInOut,e as isIncoming,o as isNestedConnection,D as isOutgoing,s as mergeConnections,C as modelConnection,p as sortConnectionsByBoundaryHierarchy,g as sortDeepestFirst}from"../shared/likec4.LktBLTET.mjs";function n(o){return e.create(o)}export{e as LikeC4Model,n as createLikeC4Model};
1
+ import{j as e}from"../shared/likec4.1r1CQuHw.mjs";export{h as ComputedNode,v as ComputedView,a as Connection,Z as ConnectionModel,$ as DeployedInstanceModel,G as DeploymentConnectionModel,_ as DeploymentNodeModel,f as DeploymentRelationModel,W as DiagramNode,T as EdgeModel,m as ElementModel,M as LikeC4DeploymentModel,P as LikeC4ViewModel,z as NodeModel,L as RelationshipModel,R as deploymentConnection,b as differenceConnections,c as findAscendingConnections,I as findDeepestNestedConnection,y as findDescendantConnections,A as hasSameSource,d as hasSameSourceTarget,O as hasSameTarget,F as isAnyInOut,e as isIncoming,o as isNestedConnection,D as isOutgoing,s as mergeConnections,C as modelConnection,p as sortConnectionsByBoundaryHierarchy,g as sortDeepestFirst}from"../shared/likec4.1r1CQuHw.mjs";function n(o){return e.create(o)}export{e as LikeC4Model,n as createLikeC4Model};