@likec4/core 1.26.2 → 1.27.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/builder/index.d.mts +3 -1
- package/dist/builder/index.mjs +6 -4
- package/dist/compute-view/index.d.mts +1 -2
- package/dist/compute-view/index.mjs +6 -6
- package/dist/compute-view/relationships-view/index.d.mts +42 -0
- package/dist/compute-view/relationships-view/index.mjs +181 -0
- package/dist/index.d.mts +3 -5
- package/dist/index.mjs +5 -5
- package/dist/model/index.d.mts +3 -3
- package/dist/model/index.mjs +1 -1
- package/dist/shared/{core.yND74qFI.mjs → core.BMep80lJ.mjs} +2 -1
- package/dist/shared/{core.DRxv3HIl.mjs → core.C-YXI-43.mjs} +1 -5
- package/dist/shared/core.CQXU9DF7.mjs +477 -0
- package/dist/shared/{core.Brmu7VBL.d.mts → core.CtloVwbo.d.mts} +3 -1
- package/dist/shared/{core.DvRnF4Sc.mjs → core.Cu-UdkSl.mjs} +16 -477
- package/dist/shared/core.DbRvwARP.mjs +5 -0
- package/dist/shared/{core.oI7caxVx.d.mts → core.Uz54YXx0.d.mts} +1 -1
- package/dist/shared/{core.NNojPYtn.mjs → core.zj2huD5x.mjs} +12 -8
- package/dist/types/index.mjs +1 -1
- package/dist/utils/index.d.mts +3 -2
- package/dist/utils/index.mjs +5 -3
- package/package.json +19 -9
- package/src/builder/Builder.model.ts +74 -0
- package/src/compute-view/deployment-view/_types.ts +1 -1
- package/src/compute-view/deployment-view/predicates/relation-direct.ts +6 -7
- package/src/compute-view/deployment-view/predicates/relation-incoming.ts +2 -1
- package/src/compute-view/deployment-view/predicates/relation-outgoing.ts +1 -1
- package/src/compute-view/index.ts +0 -1
- package/src/compute-view/relationships-view/_types.ts +7 -6
- package/src/compute-view/relationships-view/compute.ts +140 -52
- package/src/compute-view/relationships-view/index.ts +3 -0
- package/src/compute-view/relationships-view/utils.ts +44 -11
- package/src/compute-view/utils/view-hash.ts +1 -4
- package/src/index.ts +1 -1
- package/src/model/ElementModel.ts +2 -0
- package/src/model/view/NodeModel.ts +5 -0
- package/src/utils/object-hash.ts +13 -2
- package/dist/builder/index.d.ts +0 -509
- package/dist/compute-view/index.d.ts +0 -23
- package/dist/index.d.ts +0 -147
- package/dist/model/index.d.ts +0 -118
- package/dist/shared/core.-qjOvsEL.d.ts +0 -146
- package/dist/shared/core.30yYKXcZ.d.ts +0 -186
- package/dist/shared/core.BH59D8Ji.d.ts +0 -858
- package/dist/shared/core.C8xqv5sq.mjs +0 -37
- package/dist/shared/core.CIbWBWW3.d.ts +0 -127
- package/dist/shared/core.Cpd5mZgF.d.ts +0 -732
- package/dist/shared/core.Dd1nCiNx.d.mts +0 -12
- package/dist/shared/core.mD0TIdz_.d.ts +0 -12
- package/dist/types/index.d.ts +0 -72
- package/dist/utils/index.d.ts +0 -458
|
@@ -0,0 +1,477 @@
|
|
|
1
|
+
import { i as invariant } from './core.C-YXI-43.mjs';
|
|
2
|
+
|
|
3
|
+
var e={done:true,hasNext:false},s={done:false,hasNext:false},a=()=>e;
|
|
4
|
+
|
|
5
|
+
function C(t,...o){let n=t,u=o.map(e=>"lazy"in e?y(e):void 0),p=0;for(;p<o.length;){if(u[p]===void 0||!B(n)){let i=o[p];n=i(n),p+=1;continue}let r=[];for(let i=p;i<o.length;i++){let l=u[i];if(l===void 0||(r.push(l),l.isSingle))break}let a=[];for(let i of n)if(f(i,a,r))break;let{isSingle:s}=r.at(-1);n=s?a[0]:a,p+=r.length;}return n}function f(t,o,n){if(n.length===0)return o.push(t),false;let u=t,p=s,e=false;for(let[r,a]of n.entries()){let{index:s,items:i}=a;if(i.push(u),p=a(u,s,i),a.index+=1,p.hasNext){if(p.hasMany??false){for(let l of p.next)if(f(l,o,n.slice(r+1)))return true;return e}u=p.next;}if(!p.hasNext)break;p.done&&(e=true);}return p.hasNext&&o.push(u),e}function y(t){let{lazy:o,lazyArgs:n}=t,u=o(...n);return Object.assign(u,{isSingle:o.single??false,index:0,items:[]})}function B(t){return typeof t=="string"||typeof t=="object"&&t!==null&&Symbol.iterator in t}
|
|
6
|
+
|
|
7
|
+
function t$1(r){return typeof r=="string"}
|
|
8
|
+
|
|
9
|
+
function t(n){return typeof n=="function"}
|
|
10
|
+
|
|
11
|
+
function getDefaultExportFromCjs (x) {
|
|
12
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Mnemonist DefaultMap
|
|
17
|
+
* =====================
|
|
18
|
+
*
|
|
19
|
+
* JavaScript implementation of a default map that will return a constructed
|
|
20
|
+
* value any time one tries to access an inexisting key. It's quite similar
|
|
21
|
+
* to python's defaultdict.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
var defaultMap;
|
|
25
|
+
var hasRequiredDefaultMap;
|
|
26
|
+
|
|
27
|
+
function requireDefaultMap () {
|
|
28
|
+
if (hasRequiredDefaultMap) return defaultMap;
|
|
29
|
+
hasRequiredDefaultMap = 1;
|
|
30
|
+
/**
|
|
31
|
+
* DefaultMap.
|
|
32
|
+
*
|
|
33
|
+
* @constructor
|
|
34
|
+
*/
|
|
35
|
+
function DefaultMap(factory) {
|
|
36
|
+
if (typeof factory !== 'function')
|
|
37
|
+
throw new Error('mnemonist/DefaultMap.constructor: expecting a function.');
|
|
38
|
+
|
|
39
|
+
this.items = new Map();
|
|
40
|
+
this.factory = factory;
|
|
41
|
+
this.size = 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Method used to clear the structure.
|
|
46
|
+
*
|
|
47
|
+
* @return {undefined}
|
|
48
|
+
*/
|
|
49
|
+
DefaultMap.prototype.clear = function() {
|
|
50
|
+
|
|
51
|
+
// Properties
|
|
52
|
+
this.items.clear();
|
|
53
|
+
this.size = 0;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Method used to get the value set for given key. If the key does not exist,
|
|
58
|
+
* the value will be created using the provided factory.
|
|
59
|
+
*
|
|
60
|
+
* @param {any} key - Target key.
|
|
61
|
+
* @return {any}
|
|
62
|
+
*/
|
|
63
|
+
DefaultMap.prototype.get = function(key) {
|
|
64
|
+
var value = this.items.get(key);
|
|
65
|
+
|
|
66
|
+
if (typeof value === 'undefined') {
|
|
67
|
+
value = this.factory(key, this.size);
|
|
68
|
+
this.items.set(key, value);
|
|
69
|
+
this.size++;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return value;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Method used to get the value set for given key. If the key does not exist,
|
|
77
|
+
* a value won't be created.
|
|
78
|
+
*
|
|
79
|
+
* @param {any} key - Target key.
|
|
80
|
+
* @return {any}
|
|
81
|
+
*/
|
|
82
|
+
DefaultMap.prototype.peek = function(key) {
|
|
83
|
+
return this.items.get(key);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Method used to set a value for given key.
|
|
88
|
+
*
|
|
89
|
+
* @param {any} key - Target key.
|
|
90
|
+
* @param {any} value - Value.
|
|
91
|
+
* @return {DefaultMap}
|
|
92
|
+
*/
|
|
93
|
+
DefaultMap.prototype.set = function(key, value) {
|
|
94
|
+
this.items.set(key, value);
|
|
95
|
+
this.size = this.items.size;
|
|
96
|
+
|
|
97
|
+
return this;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Method used to test the existence of a key in the map.
|
|
102
|
+
*
|
|
103
|
+
* @param {any} key - Target key.
|
|
104
|
+
* @return {boolean}
|
|
105
|
+
*/
|
|
106
|
+
DefaultMap.prototype.has = function(key) {
|
|
107
|
+
return this.items.has(key);
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Method used to delete target key.
|
|
112
|
+
*
|
|
113
|
+
* @param {any} key - Target key.
|
|
114
|
+
* @return {boolean}
|
|
115
|
+
*/
|
|
116
|
+
DefaultMap.prototype.delete = function(key) {
|
|
117
|
+
var deleted = this.items.delete(key);
|
|
118
|
+
|
|
119
|
+
this.size = this.items.size;
|
|
120
|
+
|
|
121
|
+
return deleted;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Method used to iterate over each of the key/value pairs.
|
|
126
|
+
*
|
|
127
|
+
* @param {function} callback - Function to call for each item.
|
|
128
|
+
* @param {object} scope - Optional scope.
|
|
129
|
+
* @return {undefined}
|
|
130
|
+
*/
|
|
131
|
+
DefaultMap.prototype.forEach = function(callback, scope) {
|
|
132
|
+
scope = arguments.length > 1 ? scope : this;
|
|
133
|
+
|
|
134
|
+
this.items.forEach(callback, scope);
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Iterators.
|
|
139
|
+
*/
|
|
140
|
+
DefaultMap.prototype.entries = function() {
|
|
141
|
+
return this.items.entries();
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
DefaultMap.prototype.keys = function() {
|
|
145
|
+
return this.items.keys();
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
DefaultMap.prototype.values = function() {
|
|
149
|
+
return this.items.values();
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Attaching the #.entries method to Symbol.iterator if possible.
|
|
154
|
+
*/
|
|
155
|
+
if (typeof Symbol !== 'undefined')
|
|
156
|
+
DefaultMap.prototype[Symbol.iterator] = DefaultMap.prototype.entries;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Convenience known methods.
|
|
160
|
+
*/
|
|
161
|
+
DefaultMap.prototype.inspect = function() {
|
|
162
|
+
return this.items;
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
if (typeof Symbol !== 'undefined')
|
|
166
|
+
DefaultMap.prototype[Symbol.for('nodejs.util.inspect.custom')] = DefaultMap.prototype.inspect;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Typical factories.
|
|
170
|
+
*/
|
|
171
|
+
DefaultMap.autoIncrement = function() {
|
|
172
|
+
var i = 0;
|
|
173
|
+
|
|
174
|
+
return function() {
|
|
175
|
+
return i++;
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Exporting.
|
|
181
|
+
*/
|
|
182
|
+
defaultMap = DefaultMap;
|
|
183
|
+
return defaultMap;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
var defaultMapExports = /*@__PURE__*/ requireDefaultMap();
|
|
187
|
+
const DefaultMap = /*@__PURE__*/getDefaultExportFromCjs(defaultMapExports);
|
|
188
|
+
|
|
189
|
+
var naturalCompareLite = {exports: {}};
|
|
190
|
+
|
|
191
|
+
var hasRequiredNaturalCompareLite;
|
|
192
|
+
|
|
193
|
+
function requireNaturalCompareLite () {
|
|
194
|
+
if (hasRequiredNaturalCompareLite) return naturalCompareLite.exports;
|
|
195
|
+
hasRequiredNaturalCompareLite = 1;
|
|
196
|
+
/*
|
|
197
|
+
* @version 1.4.0
|
|
198
|
+
* @date 2015-10-26
|
|
199
|
+
* @stability 3 - Stable
|
|
200
|
+
* @author Lauri Rooden (https://github.com/litejs/natural-compare-lite)
|
|
201
|
+
* @license MIT License
|
|
202
|
+
*/
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
var naturalCompare = function(a, b) {
|
|
206
|
+
var i, codeA
|
|
207
|
+
, codeB = 1
|
|
208
|
+
, posA = 0
|
|
209
|
+
, posB = 0
|
|
210
|
+
, alphabet = String.alphabet;
|
|
211
|
+
|
|
212
|
+
function getCode(str, pos, code) {
|
|
213
|
+
if (code) {
|
|
214
|
+
for (i = pos; code = getCode(str, i), code < 76 && code > 65;) ++i;
|
|
215
|
+
return +str.slice(pos - 1, i)
|
|
216
|
+
}
|
|
217
|
+
code = alphabet && alphabet.indexOf(str.charAt(pos));
|
|
218
|
+
return code > -1 ? code + 76 : ((code = str.charCodeAt(pos) || 0), code < 45 || code > 127) ? code
|
|
219
|
+
: code < 46 ? 65 // -
|
|
220
|
+
: code < 48 ? code - 1
|
|
221
|
+
: code < 58 ? code + 18 // 0-9
|
|
222
|
+
: code < 65 ? code - 11
|
|
223
|
+
: code < 91 ? code + 11 // A-Z
|
|
224
|
+
: code < 97 ? code - 37
|
|
225
|
+
: code < 123 ? code + 5 // a-z
|
|
226
|
+
: code - 63
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
if ((a+="") != (b+="")) for (;codeB;) {
|
|
231
|
+
codeA = getCode(a, posA++);
|
|
232
|
+
codeB = getCode(b, posB++);
|
|
233
|
+
|
|
234
|
+
if (codeA < 76 && codeB < 76 && codeA > 66 && codeB > 66) {
|
|
235
|
+
codeA = getCode(a, posA, posA);
|
|
236
|
+
codeB = getCode(b, posB, posA = i);
|
|
237
|
+
posB = i;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
if (codeA != codeB) return (codeA < codeB) ? -1 : 1
|
|
241
|
+
}
|
|
242
|
+
return 0
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
try {
|
|
246
|
+
naturalCompareLite.exports = naturalCompare;
|
|
247
|
+
} catch (e) {
|
|
248
|
+
String.naturalCompare = naturalCompare;
|
|
249
|
+
}
|
|
250
|
+
return naturalCompareLite.exports;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
var naturalCompareLiteExports = requireNaturalCompareLite();
|
|
254
|
+
const compare = /*@__PURE__*/getDefaultExportFromCjs(naturalCompareLiteExports);
|
|
255
|
+
|
|
256
|
+
function compareNatural(a, b) {
|
|
257
|
+
if (a === b) return 0;
|
|
258
|
+
if (t$1(a)) {
|
|
259
|
+
if (t$1(b)) {
|
|
260
|
+
return compare(a, b);
|
|
261
|
+
}
|
|
262
|
+
return 1;
|
|
263
|
+
}
|
|
264
|
+
return t$1(b) ? -1 : 0;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
function isString(value) {
|
|
268
|
+
return value != null && typeof value === "string";
|
|
269
|
+
}
|
|
270
|
+
function isNonEmptyArray(arr) {
|
|
271
|
+
return !!arr && Array.isArray(arr) && arr.length > 0;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
function parentFqn(fqn) {
|
|
275
|
+
const lastDot = fqn.lastIndexOf(".");
|
|
276
|
+
if (lastDot > 0) {
|
|
277
|
+
return fqn.slice(0, lastDot);
|
|
278
|
+
}
|
|
279
|
+
return null;
|
|
280
|
+
}
|
|
281
|
+
function nameFromFqn(fqn) {
|
|
282
|
+
const lastDot = fqn.lastIndexOf(".");
|
|
283
|
+
if (lastDot > 0) {
|
|
284
|
+
return fqn.slice(lastDot + 1);
|
|
285
|
+
} else {
|
|
286
|
+
return fqn;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
const asString = (e) => isString(e) ? e : e.id;
|
|
290
|
+
function isAncestor(arg1, arg2) {
|
|
291
|
+
const arg1Id = asString(arg1);
|
|
292
|
+
if (arg2) {
|
|
293
|
+
const arg2Id = asString(arg2);
|
|
294
|
+
return arg2Id.startsWith(arg1Id + ".");
|
|
295
|
+
}
|
|
296
|
+
return (ancestor) => {
|
|
297
|
+
const ancestorId = asString(ancestor);
|
|
298
|
+
return arg1Id.startsWith(ancestorId + ".");
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
function isSameHierarchy(one, another) {
|
|
302
|
+
if (!another) {
|
|
303
|
+
return (b) => isSameHierarchy(one, b);
|
|
304
|
+
}
|
|
305
|
+
const first = asString(one);
|
|
306
|
+
const second = asString(another);
|
|
307
|
+
return first === second || second.startsWith(first + ".") || first.startsWith(second + ".");
|
|
308
|
+
}
|
|
309
|
+
function isDescendantOf(descedant, ancestor) {
|
|
310
|
+
if (!ancestor) {
|
|
311
|
+
return (d) => isAncestor(descedant, d);
|
|
312
|
+
}
|
|
313
|
+
return isAncestor(ancestor, descedant);
|
|
314
|
+
}
|
|
315
|
+
function hierarchyLevel(elementOfFqn) {
|
|
316
|
+
const first = isString(elementOfFqn) ? elementOfFqn : elementOfFqn.id;
|
|
317
|
+
return first.split(".").length;
|
|
318
|
+
}
|
|
319
|
+
function hierarchyDistance(one, another) {
|
|
320
|
+
const first = isString(one) ? one : one.id;
|
|
321
|
+
const second = isString(another) ? another : another.id;
|
|
322
|
+
if (first === second) {
|
|
323
|
+
return 0;
|
|
324
|
+
}
|
|
325
|
+
const firstDepth = hierarchyLevel(first);
|
|
326
|
+
const secondDepth = hierarchyLevel(second);
|
|
327
|
+
if (isSameHierarchy(first, second)) {
|
|
328
|
+
return Math.abs(firstDepth - secondDepth);
|
|
329
|
+
}
|
|
330
|
+
const ancestor = commonAncestor(first, second);
|
|
331
|
+
const ancestorDepth = ancestor ? hierarchyLevel(ancestor) : 0;
|
|
332
|
+
return firstDepth + secondDepth - (2 * ancestorDepth + 1);
|
|
333
|
+
}
|
|
334
|
+
function commonAncestor(first, second) {
|
|
335
|
+
const a = first.split(".");
|
|
336
|
+
if (a.length < 2) {
|
|
337
|
+
return null;
|
|
338
|
+
}
|
|
339
|
+
const b = second.split(".");
|
|
340
|
+
if (b.length < 2) {
|
|
341
|
+
return null;
|
|
342
|
+
}
|
|
343
|
+
let ancestor = [];
|
|
344
|
+
for (let i = 0; i < Math.min(a.length, b.length) - 1 && a[i] === b[i]; i++) {
|
|
345
|
+
ancestor.push(a[i]);
|
|
346
|
+
}
|
|
347
|
+
if (ancestor.length === 0) {
|
|
348
|
+
return null;
|
|
349
|
+
}
|
|
350
|
+
return ancestor.join(".");
|
|
351
|
+
}
|
|
352
|
+
function ancestorsFqn(fqn) {
|
|
353
|
+
const path = fqn.split(".");
|
|
354
|
+
path.pop();
|
|
355
|
+
if (path.length === 0) {
|
|
356
|
+
return [];
|
|
357
|
+
}
|
|
358
|
+
return path.reduce((acc, part, idx) => {
|
|
359
|
+
if (idx === 0) {
|
|
360
|
+
acc.push(part);
|
|
361
|
+
return acc;
|
|
362
|
+
}
|
|
363
|
+
acc.unshift(`${acc[0]}.${part}`);
|
|
364
|
+
return acc;
|
|
365
|
+
}, []);
|
|
366
|
+
}
|
|
367
|
+
function compareFqnHierarchically(a, b) {
|
|
368
|
+
const depthA = a.split(".").length;
|
|
369
|
+
const depthB = b.split(".").length;
|
|
370
|
+
switch (true) {
|
|
371
|
+
case depthA > depthB: {
|
|
372
|
+
return 1;
|
|
373
|
+
}
|
|
374
|
+
case depthA < depthB: {
|
|
375
|
+
return -1;
|
|
376
|
+
}
|
|
377
|
+
default: {
|
|
378
|
+
return 0;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
function compareByFqnHierarchically(a, b) {
|
|
383
|
+
return compareFqnHierarchically(a.id, b.id);
|
|
384
|
+
}
|
|
385
|
+
function sortByFqnHierarchically(array) {
|
|
386
|
+
return array.map((item) => ({ item, fqn: item.id.split(".") })).sort((a, b) => {
|
|
387
|
+
return a.fqn.length - b.fqn.length;
|
|
388
|
+
}).map(({ item }) => item);
|
|
389
|
+
}
|
|
390
|
+
function findTopAncestor(items, item) {
|
|
391
|
+
let parent = item;
|
|
392
|
+
for (const e of items) {
|
|
393
|
+
if (isAncestor(e, parent)) {
|
|
394
|
+
parent = e;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
return parent !== item ? parent : null;
|
|
398
|
+
}
|
|
399
|
+
function sortParentsFirst(array) {
|
|
400
|
+
const result = [];
|
|
401
|
+
const items = [...array];
|
|
402
|
+
let item;
|
|
403
|
+
while (item = items.shift()) {
|
|
404
|
+
let parent;
|
|
405
|
+
while (parent = findTopAncestor(items, item)) {
|
|
406
|
+
result.push(items.splice(items.indexOf(parent), 1)[0]);
|
|
407
|
+
}
|
|
408
|
+
result.push(item);
|
|
409
|
+
}
|
|
410
|
+
return result;
|
|
411
|
+
}
|
|
412
|
+
function sortNaturalByFqn(array, sort) {
|
|
413
|
+
if (!array || isString(array)) {
|
|
414
|
+
const dir2 = array ?? "asc";
|
|
415
|
+
return (arr) => sortNaturalByFqn(arr, dir2);
|
|
416
|
+
}
|
|
417
|
+
const dir = sort === "desc" ? -1 : 1;
|
|
418
|
+
return array.map((item) => ({ item, fqn: item.id.split(".") })).sort((a, b) => {
|
|
419
|
+
if (a.fqn.length !== b.fqn.length) {
|
|
420
|
+
return (a.fqn.length - b.fqn.length) * dir;
|
|
421
|
+
}
|
|
422
|
+
for (let i = 0; i < a.fqn.length; i++) {
|
|
423
|
+
const compare = compareNatural(a.fqn[i], b.fqn[i]);
|
|
424
|
+
if (compare !== 0) {
|
|
425
|
+
return compare;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
return 0;
|
|
429
|
+
}).map(({ item }) => item);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
function ifilter(arg1, arg2) {
|
|
433
|
+
const pred = arg2 ?? arg1;
|
|
434
|
+
invariant(t(pred));
|
|
435
|
+
function* _filter(iter) {
|
|
436
|
+
for (const value of iter) {
|
|
437
|
+
if (pred(value)) {
|
|
438
|
+
yield value;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
if (!arg2) {
|
|
444
|
+
return _filter;
|
|
445
|
+
}
|
|
446
|
+
return _filter(arg1);
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
function imap(arg1, arg2) {
|
|
450
|
+
const mapper = arg2 ?? arg1;
|
|
451
|
+
invariant(t(mapper));
|
|
452
|
+
function* _map(iter) {
|
|
453
|
+
for (const value of iter) {
|
|
454
|
+
yield mapper(value);
|
|
455
|
+
}
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
if (!arg2) {
|
|
459
|
+
return _map;
|
|
460
|
+
}
|
|
461
|
+
return _map(arg1);
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
function toArray(iterable) {
|
|
465
|
+
if (iterable) {
|
|
466
|
+
return Array.from(iterable);
|
|
467
|
+
}
|
|
468
|
+
return (it) => Array.from(it);
|
|
469
|
+
}
|
|
470
|
+
function toSet(iterable) {
|
|
471
|
+
if (iterable) {
|
|
472
|
+
return new Set(iterable);
|
|
473
|
+
}
|
|
474
|
+
return (it) => new Set(it);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
export { C, DefaultMap as D, isAncestor as a, toArray as b, ifilter as c, imap as d, isNonEmptyArray as e, t$1 as f, isSameHierarchy as g, t as h, isDescendantOf as i, getDefaultExportFromCjs as j, compareNatural as k, ancestorsFqn as l, commonAncestor as m, nameFromFqn as n, compareByFqnHierarchically as o, parentFqn as p, compareFqnHierarchically as q, hierarchyDistance as r, sortParentsFirst as s, toSet as t, hierarchyLevel as u, sortByFqnHierarchically as v, sortNaturalByFqn as w, isString as x, s as y, a as z };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IsStringLiteral, LiteralUnion, Simplify, SetRequired } from 'type-fest';
|
|
2
2
|
import { a as ComputedView, L as LikeC4View, a9 as ParsedLikeC4ModelData, C as ComputedLikeC4ModelData, bo as ViewId, ay as RelationId, bj as NodeId, bg as EdgeId, a6 as GenericLikeC4ModelData, a7 as LayoutedLikeC4ModelData, b9 as DiagramView, a8 as LikeC4ModelDump, f as DeploymentNodeKind, b0 as ComputedDynamicView, bl as StepEdgeId, b2 as ComputedElementView, a$ as ComputedDeploymentView, ax as ModelRelation, a5 as AnyParsedLikeC4ModelData, a4 as ModelGlobals, h as DeploymentRef, d as DeploymentNode, b as DeployedInstance, c as DeploymentElementStyle, i as DeploymentRelation, aA as RelationshipKind } from './core.z6g06scf.mjs';
|
|
3
|
-
import { F as Fqn, K as KeysOf, a as IteratorLike, j as ElementKind, p as ElementShape, x as Color, I as IconUrl, s as Tag, r as Link,
|
|
3
|
+
import { F as Fqn, K as KeysOf, a as IteratorLike, j as ElementKind, p as ElementShape, x as Color, I as IconUrl, s as Tag, r as Link, q as ElementStyle, Q as ThemeColor, m as Element } from './core.30yYKXcZ.mjs';
|
|
4
4
|
|
|
5
5
|
type ComputeViewResult<V extends ComputedView = ComputedView> = {
|
|
6
6
|
isSuccess: true;
|
|
@@ -94,6 +94,7 @@ declare class NodeModel<M extends AnyAux, V extends ComputedView | DiagramView =
|
|
|
94
94
|
get tags(): ReadonlyArray<Tag>;
|
|
95
95
|
get links(): ReadonlyArray<Link>;
|
|
96
96
|
get navigateTo(): LikeC4ViewModel<M> | null;
|
|
97
|
+
get style(): ElementStyle;
|
|
97
98
|
/**
|
|
98
99
|
* Get all ancestor elements (i.e. parent, parent’s parent, etc.)
|
|
99
100
|
* (from closest to root)
|
|
@@ -660,6 +661,7 @@ declare class ElementModel<M extends AnyAux = AnyAux> {
|
|
|
660
661
|
readonly $model: LikeC4Model<M>;
|
|
661
662
|
readonly $element: Element;
|
|
662
663
|
readonly id: M['Fqn'];
|
|
664
|
+
readonly _literalId: M['Element'];
|
|
663
665
|
readonly hierarchyLevel: number;
|
|
664
666
|
constructor($model: LikeC4Model<M>, $element: Element);
|
|
665
667
|
get parent(): ElementModel<M> | null;
|