@likec4/core 1.19.2 → 1.20.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.
Files changed (80) hide show
  1. package/dist/builder/index.cjs +881 -0
  2. package/dist/builder/index.d.cts +503 -0
  3. package/dist/builder/index.d.mts +4 -3
  4. package/dist/builder/index.d.ts +4 -3
  5. package/dist/builder/{index.js → index.mjs} +14 -4
  6. package/dist/compute-view/index.cjs +86 -0
  7. package/dist/compute-view/index.d.cts +23 -0
  8. package/dist/compute-view/index.d.mts +3 -2
  9. package/dist/compute-view/index.d.ts +3 -2
  10. package/dist/compute-view/{index.js → index.mjs} +6 -5
  11. package/dist/index.cjs +4320 -0
  12. package/dist/index.d.cts +270 -0
  13. package/dist/index.d.mts +130 -4
  14. package/dist/index.d.ts +130 -4
  15. package/dist/{index.js → index.mjs} +512 -7
  16. package/dist/model/index.cjs +40 -0
  17. package/dist/model/index.d.cts +259 -0
  18. package/dist/model/index.d.mts +3 -3
  19. package/dist/model/index.d.ts +3 -3
  20. package/dist/model/index.mjs +1 -0
  21. package/dist/shared/core.B2QYWlYe.cjs +435 -0
  22. package/dist/shared/core.B72vUaNB.d.cts +850 -0
  23. package/dist/shared/core.BGus30EM.cjs +8027 -0
  24. package/dist/shared/core.BRuJ3Wzf.d.mts +12 -0
  25. package/dist/shared/{core.CqXs9Frh.d.ts → core.BdbFkE_p.d.cts} +10 -4
  26. package/dist/shared/core.BvdNMbcA.d.cts +12 -0
  27. package/dist/shared/{object_hash.CE_oF3I3.js → core.BxvDITEI.mjs} +26 -389
  28. package/dist/shared/core.ByNgh-mC.d.cts +127 -0
  29. package/dist/shared/core.C9DCnJh8.cjs +908 -0
  30. package/dist/shared/{index.KOeaSlL8.js → core.CqCTxzMY.mjs} +787 -372
  31. package/dist/shared/core.D74xkKkG.d.cts +148 -0
  32. package/dist/shared/{core.DyJ41fBO.d.ts → core.D_Gc58Gt.d.ts} +12 -4
  33. package/dist/shared/core.Damrzla-.d.ts +12 -0
  34. package/dist/shared/{core.BL1oTk7-.d.mts → core.Dfzrh1VA.d.mts} +12 -4
  35. package/dist/shared/core.DsoCu540.cjs +26 -0
  36. package/dist/shared/{view.DrmaOfjr.js → core.DunIMHRf.mjs} +24 -1
  37. package/dist/shared/{core.2I-l5UtM.d.mts → core.ZWiGANIJ.d.ts} +10 -4
  38. package/dist/shared/core.gv1bMwCC.cjs +39 -0
  39. package/dist/shared/core.jy6z2iRn.d.mts +729 -0
  40. package/dist/shared/core.m3rCQAv6.mjs +37 -0
  41. package/dist/types/index.cjs +107 -0
  42. package/dist/types/index.d.cts +72 -0
  43. package/dist/types/index.d.mts +2 -2
  44. package/dist/types/index.d.ts +2 -2
  45. package/dist/types/{index.js → index.mjs} +1 -1
  46. package/dist/utils/index.cjs +95 -0
  47. package/dist/utils/index.d.cts +356 -0
  48. package/dist/utils/index.d.mts +1 -64
  49. package/dist/utils/index.d.ts +1 -64
  50. package/dist/utils/index.mjs +56 -0
  51. package/package.json +51 -25
  52. package/src/builder/Builder.view-common.ts +20 -1
  53. package/src/compute-view/deployment-view/predicates/relation-direct.ts +26 -29
  54. package/src/compute-view/deployment-view/predicates/relation-incoming.ts +1 -1
  55. package/src/compute-view/deployment-view/predicates/utils.ts +47 -16
  56. package/src/compute-view/element-view/__test__/fixture.ts +17 -4
  57. package/src/compute-view/element-view/compute.ts +3 -2
  58. package/src/compute-view/element-view/predicates.ts +520 -0
  59. package/src/compute-view/element-view/utils.ts +11 -7
  60. package/src/compute-view/index.ts +1 -0
  61. package/src/compute-view/relationships-view/_types.ts +16 -0
  62. package/src/compute-view/relationships-view/compute.ts +74 -0
  63. package/src/compute-view/relationships-view/layout.ts +357 -0
  64. package/src/compute-view/relationships-view/utils.ts +40 -0
  65. package/src/compute-view/utils/relationExpressionToPredicates.ts +11 -4
  66. package/src/index.ts +16 -0
  67. package/src/model/DeploymentElementModel.ts +4 -0
  68. package/src/model/ElementModel.ts +13 -0
  69. package/src/model/LikeC4Model.ts +2 -2
  70. package/src/model/RelationModel.ts +5 -0
  71. package/src/model/guards.ts +17 -1
  72. package/src/model/view/LikeC4ViewModel.ts +7 -1
  73. package/src/model/view/NodeModel.ts +5 -0
  74. package/src/types/operators.ts +42 -2
  75. package/src/types/view.ts +2 -2
  76. package/src/utils/index.ts +0 -5
  77. package/src/utils/iterable/unique.ts +1 -7
  78. package/dist/model/index.js +0 -1
  79. package/dist/utils/index.js +0 -347
  80. /package/dist/shared/{chunk-RAAYCPUM.M-JWF7SS.js → core.M-JWF7SS.mjs} +0 -0
@@ -0,0 +1,356 @@
1
+ export { I as IterableContainer, R as ReorderedArray, a as ancestorsFqn, c as commonAncestor, b as compareByFqnHierarchically, d as compareFqnHierarchically, h as hierarchyDistance, e as hierarchyLevel, i as isAncestor, f as isDescendantOf, g as isSameHierarchy, n as nameFromFqn, p as parentFqn, s as sortByFqnHierarchically, j as sortNaturalByFqn, k as sortParentsFirst } from '../shared/core.ByNgh-mC.cjs';
2
+ import { N as NonEmptyArray, a as IteratorLike } from '../shared/core.D74xkKkG.cjs';
3
+ import { IsNumericLiteral } from 'type-fest';
4
+
5
+ /**
6
+ * Common head of two arrays
7
+ *
8
+ * @param equals - Equality function, defaults to `Object.is`
9
+ */
10
+ declare function commonHead<T>(sources: ReadonlyArray<T>, targets: ReadonlyArray<T>, equals?: (a: T, b: T) => boolean): T[];
11
+
12
+ declare function compareNatural(a: string | undefined, b: string | undefined): -1 | 0 | 1;
13
+
14
+ declare function getOrCreate<K, V>(map: Map<K, V>, key: K, create: (key: K) => V): V;
15
+
16
+ /**
17
+ * This should only be used for defining generics which extend any kind of JS
18
+ * array under the hood, this includes arrays *AND* tuples (of the form [x, y],
19
+ * and of the form [x, ...y[]], etc...), and their readonly equivalent. This
20
+ * allows us to be more inclusive to what functions can process.
21
+ *
22
+ * @example
23
+ * function map<T extends IterableContainer>(items: T) { ... }
24
+ *
25
+ * We would've named this `ArrayLike`, but that's already used by typescript...
26
+ * @see This was inspired by the type-definition of Promise.all (https://github.com/microsoft/TypeScript/blob/1df5717b120cddd325deab8b0f2b2c3eecaf2b01/src/lib/es2015.promise.d.ts#L21)
27
+ */
28
+ type IterableContainer<T = unknown> = ReadonlyArray<T> | readonly [];
29
+
30
+ type ArraySetRequired<T extends IterableContainer, Min extends number, Iteration extends ReadonlyArray<unknown> = []> = number extends Min ? never : Iteration["length"] extends Min ? T : T extends readonly [] ? never : T extends [infer Head, ...infer Rest] ? [
31
+ Head,
32
+ ...ArraySetRequired<Rest, Min, [unknown, ...Iteration]>
33
+ ] : T extends readonly [infer Head, ...infer Rest] ? readonly [
34
+ Head,
35
+ ...ArraySetRequired<Rest, Min, [unknown, ...Iteration]>
36
+ ] : T extends Array<infer Item> ? [
37
+ Item,
38
+ ...ArraySetRequired<T, Min, [unknown, ...Iteration]>
39
+ ] : T extends ReadonlyArray<infer Item> ? readonly [
40
+ Item,
41
+ ...ArraySetRequired<T, Min, [unknown, ...Iteration]>
42
+ ] : never;
43
+ /**
44
+ * Checks if the given array has at least the defined number of elements. When
45
+ * the minimum used is a literal (e.g. `3`) the output is refined accordingly so
46
+ * that those indices are defined when accessing the array even when using
47
+ * typescript's 'noUncheckedIndexAccess'.
48
+ *
49
+ * @param data - The input array.
50
+ * @param minimum - The minimum number of elements the array must have.
51
+ * @returns True if the array's length is *at least* `minimum`. When `minimum`
52
+ * is a literal value, the output is narrowed to ensure the first items are
53
+ * guaranteed.
54
+ * @signature
55
+ * R.hasAtLeast(data, minimum)
56
+ * @example
57
+ * R.hasAtLeast([], 4); // => false
58
+ *
59
+ * const data: number[] = [1,2,3,4];
60
+ * R.hasAtLeast(data, 1); // => true
61
+ * data[0]; // 1, with type `number`
62
+ * @dataFirst
63
+ * @category Array
64
+ */
65
+ declare function hasAtLeast<T extends IterableContainer, N extends number>(data: IterableContainer | T, minimum: IsNumericLiteral<N> extends true ? N : never): data is ArraySetRequired<T, N>;
66
+ declare function hasAtLeast(data: IterableContainer, minimum: number): boolean;
67
+ /**
68
+ * Checks if the given array has at least the defined number of elements. When
69
+ * the minimum used is a literal (e.g. `3`) the output is refined accordingly so
70
+ * that those indices are defined when accessing the array even when using
71
+ * typescript's 'noUncheckedIndexAccess'.
72
+ *
73
+ * @param minimum - The minimum number of elements the array must have.
74
+ * @returns True if the array's length is *at least* `minimum`. When `minimum`
75
+ * is a literal value, the output is narrowed to ensure the first items are
76
+ * guaranteed.
77
+ * @signature
78
+ * R.hasAtLeast(minimum)(data)
79
+ * @example
80
+ * R.pipe([], R.hasAtLeast(4)); // => false
81
+ *
82
+ * const data = [[1,2], [3], [4,5]];
83
+ * R.pipe(
84
+ * data,
85
+ * R.filter(R.hasAtLeast(2)),
86
+ * R.map(([, second]) => second),
87
+ * ); // => [2,5], with type `number[]`
88
+ * @dataLast
89
+ * @category Array
90
+ */
91
+ declare function hasAtLeast<N extends number>(minimum: IsNumericLiteral<N> extends true ? N : never): <T extends IterableContainer>(data: IterableContainer | T) => data is ArraySetRequired<T, N>;
92
+ declare function hasAtLeast(minimum: number): (data: IterableContainer) => boolean;
93
+
94
+ declare function isString(value: unknown): value is string;
95
+ declare function isNonEmptyArray<A>(arr: ArrayLike<A> | undefined): arr is NonEmptyArray<A>;
96
+
97
+ declare function isIterable<T, I extends Iterable<T>>(something: I | unknown): something is Iterable<T>;
98
+
99
+ /**
100
+ * Filters an iterable based on a predicate.
101
+ * Composabel first version of `ifilter`.
102
+ * @signature
103
+ * ifilter(predicate)(data)
104
+ */
105
+ declare function ifilter<T, S extends T>(predicate: (v: T) => v is S): (iterable: Iterable<T>) => IteratorLike<S>;
106
+ declare function ifilter<T>(predicate: (v: T) => boolean): (iterable: Iterable<T>) => IteratorLike<T>;
107
+ /**
108
+ * Filters an iterable based on a predicate.
109
+ * Data first version of `ifilter`.
110
+ * @signature
111
+ * ifilter(data, predicate)
112
+ * @example
113
+ * ifilter(new Set([1, 2, 3]), x => x % 2 === 1) // => Iterable<[1, 3]>
114
+ */
115
+ declare function ifilter<T, S extends T>(iterable: Iterable<T>, predicate: (v: T) => v is S): IteratorLike<S>;
116
+ declare function ifilter<T>(iterable: Iterable<T>, predicate: (v: T) => boolean): IteratorLike<T>;
117
+
118
+ /**
119
+ * Finds the first element in the iterable that satisfies the predicate.
120
+ * Composable first version of `find`.
121
+ * @signature
122
+ * ifind(predicate)(data)
123
+ */
124
+ declare function ifind<T>(predicate: (item: T) => boolean): (iterable: Iterable<T>) => T | undefined;
125
+ /**
126
+ * Finds the first element in the iterable that satisfies the predicate.
127
+ * Data first version of `find`.
128
+ * @signature
129
+ * ifind(data, predicate)
130
+ */
131
+ declare function ifind<T>(iterable: Iterable<T>, predicate: (item: T) => boolean): T | undefined;
132
+
133
+ declare function iflat(): <T>(iterable: Iterable<IteratorLike<T>>) => IteratorLike<T>;
134
+ declare function iflat<T>(iterable: Iterable<IteratorLike<T>>): IteratorLike<T>;
135
+
136
+ type MapFunction<T, S> = (item: T) => S;
137
+ /**
138
+ * Maps an iterable using a mapper function.
139
+ * Composable first version of `imap`.
140
+ * @signature
141
+ * imap(mapper)(data)
142
+ */
143
+ declare function imap<T, S>(mapper: MapFunction<T, S>): (iterable: Iterable<T>) => IteratorLike<S>;
144
+ /**
145
+ * Maps an iterable using a mapper function.
146
+ * Data first version of `imap`.
147
+ * @signature
148
+ * imap(data, mapper)
149
+ */
150
+ declare function imap<T, S>(iterable: Iterable<T>, mapper: MapFunction<T, S>): IteratorLike<S>;
151
+
152
+ declare function ireduce<T, R>(reducer: (acc: R, item: T) => R, initialValue: R): (iterable: Iterable<T>) => R;
153
+ declare function ireduce<T, R>(iterable: Iterable<T>, reducer: (acc: R, item: T) => R, initialValue: R): R;
154
+
155
+ /**
156
+ * Checks if at least one element in the iterable satisfies the predicate.
157
+ * Composable first version of `some`.
158
+ * @signature
159
+ * isome(predicate)(data)
160
+ */
161
+ declare function isome<T>(predicate: (item: T) => boolean): (iterable: Iterable<T>) => boolean;
162
+ /**
163
+ * Checks if at least one element in the iterable satisfies the predicate.
164
+ * Data first version of `some`.
165
+ * @signature
166
+ * isome(data, predicate)
167
+ */
168
+ declare function isome<T>(iterable: Iterable<T>, predicate: (item: T) => boolean): boolean;
169
+
170
+ declare function toArray(): <T>(iterable: Iterable<T> | ArrayLike<T>) => T[];
171
+ declare function toArray<T>(iterable: Iterable<T> | ArrayLike<T>): T[];
172
+ declare function toSet(): <T>(iterable: Iterable<T>) => Set<T>;
173
+ declare function toSet<T>(iterable: Iterable<T>): Set<T>;
174
+
175
+ /**
176
+ * Returns an iterable that yields only unique values.
177
+ * It uses a Set to keep track of the values.
178
+ */
179
+ declare function iunique(): <T>(iterable: Iterable<T>) => IteratorLike<T>;
180
+ declare function iunique<T>(iterable: Iterable<T>): IteratorLike<T>;
181
+
182
+ declare function delay(): Promise<string>;
183
+ declare function delay(ms: number): Promise<string>;
184
+ declare function delay(randomFrom: number, randomTo: number): Promise<string>;
185
+
186
+ /**
187
+ * Compares two relations hierarchically.
188
+ * From the most general (implicit) to the most specific.
189
+ */
190
+ declare const compareRelations: <T extends {
191
+ source: string;
192
+ target: string;
193
+ }>(a: T, b: T) => number;
194
+
195
+ /**
196
+ * Returns new set as a union of given sets
197
+ * Keeps order of elements
198
+ */
199
+ declare function union<T>(...sets: ReadonlySet<T>[]): Set<T>;
200
+ /**
201
+ * Returns new set as an intersection of all sets
202
+ * Keeps order from the first set
203
+ */
204
+ declare function intersection<T>(first: ReadonlySet<T>, ...sets: NonEmptyArray<ReadonlySet<NoInfer<T>>>): Set<T>;
205
+ declare function difference<T>(a: ReadonlySet<T>, b: ReadonlySet<NoInfer<T>>): Set<T>;
206
+ declare function equals<T>(a: ReadonlySet<T>, b: ReadonlySet<T>): boolean;
207
+ declare function symmetricDifference<T>(a: ReadonlySet<T>, b: ReadonlySet<T>): Set<T>;
208
+
209
+ /**
210
+ * @see https://gist.github.com/victor-homyakov/bcb7d7911e4a388b1c810f8c3ce17bcf
211
+ */
212
+ declare function stringHash(str: string): string;
213
+
214
+ declare namespace objectHash {
215
+ type NotUndefined = object | string | number | boolean | null | NotUndefined[];
216
+
217
+ /**
218
+ * @see https://github.com/puleos/object-hash#hashsha1value
219
+ */
220
+ function sha1(object: NotUndefined): string;
221
+ /**
222
+ * @see https://github.com/puleos/object-hash#hashkeysvalue
223
+ */
224
+ function keys(object: NotUndefined): string;
225
+ /**
226
+ * @see https://github.com/puleos/object-hash#hashmd5value
227
+ */
228
+ function MD5(object: NotUndefined): string;
229
+ /**
230
+ * @see https://github.com/puleos/object-hash#hashkeysmd5value
231
+ */
232
+ function keysMD5(object: NotUndefined): string;
233
+ /**
234
+ * @see https://github.com/puleos/object-hash#hashwritetostreamvalue-options-stream
235
+ */
236
+ function writeToStream(value: any, stream: Stream): void;
237
+ function writeToStream(value: any, options: Options, stream: Stream): void;
238
+
239
+ type BufferEncoding =
240
+ | "ascii"
241
+ | "base64"
242
+ | "binary"
243
+ | "hex"
244
+ | "latin1"
245
+ | "ucs-2"
246
+ | "ucs2"
247
+ | "utf-8"
248
+ | "utf16le"
249
+ | "utf8";
250
+
251
+ interface Stream {
252
+ update?(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
253
+ write?(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
254
+ }
255
+
256
+ type HashName =
257
+ | "md4"
258
+ | "md4WithRSAEncryption"
259
+ | "md5"
260
+ | "md5WithRSAEncryption"
261
+ | "ripemd"
262
+ | "ripemd160"
263
+ | "ripemd160WithRSA"
264
+ | "rmd160"
265
+ | "rsa-md4"
266
+ | "rsa-md5"
267
+ | "rsa-ripemd160"
268
+ | "rsa-sha1"
269
+ | "rsa-sha1-2"
270
+ | "rsa-sha224"
271
+ | "rsa-sha256"
272
+ | "rsa-sha3-224"
273
+ | "rsa-sha3-256"
274
+ | "rsa-sha3-384"
275
+ | "rsa-sha3-512"
276
+ | "rsa-sha384"
277
+ | "rsa-sha512"
278
+ | "sha1"
279
+ | "sha1WithRSAEncryption"
280
+ | "sha224"
281
+ | "sha224WithRSAEncryption"
282
+ | "sha256"
283
+ | "sha256WithRSAEncryption"
284
+ | "sha3-224"
285
+ | "sha3-256"
286
+ | "sha3-384"
287
+ | "sha3-512"
288
+ | "sha384"
289
+ | "sha384WithRSAEncryption"
290
+ | "sha512"
291
+ | "sha512WithRSAEncryption";
292
+
293
+ interface BaseOptions {
294
+ /**
295
+ * @default 'sha1'
296
+ */
297
+ algorithm?: HashName | "passthrough" | undefined;
298
+
299
+ excludeKeys?: ((key: string) => boolean) | undefined;
300
+ /**
301
+ * @default false
302
+ */
303
+ excludeValues?: boolean | undefined;
304
+ /**
305
+ * @default false
306
+ */
307
+ ignoreUnknown?: boolean | undefined;
308
+
309
+ replacer?: ((value: any) => any) | undefined;
310
+ /**
311
+ * @default true
312
+ */
313
+ respectFunctionNames?: boolean | undefined;
314
+ /**
315
+ * @default true
316
+ */
317
+ respectFunctionProperties?: boolean | undefined;
318
+ /**
319
+ * @default true
320
+ */
321
+ respectType?: boolean | undefined;
322
+ /**
323
+ * @default false
324
+ */
325
+ unorderedArrays?: boolean | undefined;
326
+ /**
327
+ * @default true
328
+ */
329
+ unorderedObjects?: boolean | undefined;
330
+ /**
331
+ * @default true
332
+ */
333
+ unorderedSets?: boolean | undefined;
334
+ }
335
+
336
+ interface NormalOption extends BaseOptions {
337
+ /**
338
+ * @default 'hex'
339
+ */
340
+ encoding?: "hex" | "binary" | "base64" | undefined;
341
+ }
342
+
343
+ interface WithBufferOption extends BaseOptions {
344
+ encoding: "buffer";
345
+ }
346
+
347
+ type Options = NormalOption | WithBufferOption;
348
+ }
349
+
350
+ /**
351
+ * @see https://github.com/puleos/object-hash#hashvalue-options
352
+ */
353
+ declare function objectHash(object: objectHash.NotUndefined, options?: objectHash.NormalOption): string;
354
+ declare function objectHash(object: objectHash.NotUndefined, options?: objectHash.WithBufferOption): Buffer;
355
+
356
+ export { commonHead, compareNatural, compareRelations, delay, difference, equals as equalsSet, getOrCreate, hasAtLeast, ifilter, ifind, iflat, imap, intersection, ireduce, isIterable, isNonEmptyArray, isString, isome, iunique, objectHash, stringHash, symmetricDifference, toArray, toSet, union };
@@ -2,69 +2,6 @@ export { I as IterableContainer, R as ReorderedArray, a as ancestorsFqn, c as co
2
2
  import { N as NonEmptyArray, a as IteratorLike } from '../shared/core.D74xkKkG.mjs';
3
3
  import { IsNumericLiteral } from 'type-fest';
4
4
 
5
- /**
6
- * Mnemonist DefaultMap Typings
7
- * =============================
8
- */
9
- declare class DefaultMap<K, V> implements Iterable<[K, V]> {
10
-
11
- // Members
12
- size: number;
13
-
14
- // Constructor
15
- constructor(factory: (key: K, index: number) => V);
16
-
17
- // Methods
18
- clear(): void;
19
- set(key: K, value: V): this;
20
- delete(key: K): boolean;
21
- has(key: K): boolean;
22
- get(key: K): V;
23
- peek(key: K): V | undefined;
24
- forEach(callback: (value: V, key: K, map: this) => void, scope?: any): void;
25
- keys(): IterableIterator<K>;
26
- values(): IterableIterator<V>;
27
- entries(): IterableIterator<[K, V]>;
28
- [Symbol.iterator](): IterableIterator<[K, V]>;
29
- inspect(): any;
30
-
31
- // Statics
32
- static autoIncrement(): number;
33
- }
34
-
35
- /**
36
- * Mnemonist LinkedList Typings
37
- * =============================
38
- */
39
- declare class LinkedList<T> implements Iterable<T> {
40
-
41
- // Members
42
- size: number;
43
-
44
- // Constructor
45
- constructor();
46
-
47
- // Methods
48
- clear(): void;
49
- first(): T | undefined;
50
- last(): T | undefined;
51
- peek(): T | undefined;
52
- push(value: T): number;
53
- shift(): T | undefined;
54
- unshift(value: T): number;
55
- forEach(callback: (value: T, index: number, list: this) => void, scope?: any): void;
56
- toArray(): Array<T>;
57
- values(): IterableIterator<T>;
58
- entries(): IterableIterator<[number, T]>;
59
- [Symbol.iterator](): IterableIterator<T>;
60
- toString(): string;
61
- toJSON(): Array<T>;
62
- inspect(): any;
63
-
64
- // Statics
65
- static from<I>(iterable: Iterable<I> | {[key: string]: I}): LinkedList<I>;
66
- }
67
-
68
5
  /**
69
6
  * Common head of two arrays
70
7
  *
@@ -416,4 +353,4 @@ declare namespace objectHash {
416
353
  declare function objectHash(object: objectHash.NotUndefined, options?: objectHash.NormalOption): string;
417
354
  declare function objectHash(object: objectHash.NotUndefined, options?: objectHash.WithBufferOption): Buffer;
418
355
 
419
- export { DefaultMap, LinkedList, commonHead, compareNatural, compareRelations, delay, difference, equals as equalsSet, getOrCreate, hasAtLeast, ifilter, ifind, iflat, imap, intersection, ireduce, isIterable, isNonEmptyArray, isString, isome, iunique, objectHash, stringHash, symmetricDifference, toArray, toSet, union };
356
+ export { commonHead, compareNatural, compareRelations, delay, difference, equals as equalsSet, getOrCreate, hasAtLeast, ifilter, ifind, iflat, imap, intersection, ireduce, isIterable, isNonEmptyArray, isString, isome, iunique, objectHash, stringHash, symmetricDifference, toArray, toSet, union };
@@ -2,69 +2,6 @@ export { I as IterableContainer, R as ReorderedArray, a as ancestorsFqn, c as co
2
2
  import { N as NonEmptyArray, a as IteratorLike } from '../shared/core.D74xkKkG.js';
3
3
  import { IsNumericLiteral } from 'type-fest';
4
4
 
5
- /**
6
- * Mnemonist DefaultMap Typings
7
- * =============================
8
- */
9
- declare class DefaultMap<K, V> implements Iterable<[K, V]> {
10
-
11
- // Members
12
- size: number;
13
-
14
- // Constructor
15
- constructor(factory: (key: K, index: number) => V);
16
-
17
- // Methods
18
- clear(): void;
19
- set(key: K, value: V): this;
20
- delete(key: K): boolean;
21
- has(key: K): boolean;
22
- get(key: K): V;
23
- peek(key: K): V | undefined;
24
- forEach(callback: (value: V, key: K, map: this) => void, scope?: any): void;
25
- keys(): IterableIterator<K>;
26
- values(): IterableIterator<V>;
27
- entries(): IterableIterator<[K, V]>;
28
- [Symbol.iterator](): IterableIterator<[K, V]>;
29
- inspect(): any;
30
-
31
- // Statics
32
- static autoIncrement(): number;
33
- }
34
-
35
- /**
36
- * Mnemonist LinkedList Typings
37
- * =============================
38
- */
39
- declare class LinkedList<T> implements Iterable<T> {
40
-
41
- // Members
42
- size: number;
43
-
44
- // Constructor
45
- constructor();
46
-
47
- // Methods
48
- clear(): void;
49
- first(): T | undefined;
50
- last(): T | undefined;
51
- peek(): T | undefined;
52
- push(value: T): number;
53
- shift(): T | undefined;
54
- unshift(value: T): number;
55
- forEach(callback: (value: T, index: number, list: this) => void, scope?: any): void;
56
- toArray(): Array<T>;
57
- values(): IterableIterator<T>;
58
- entries(): IterableIterator<[number, T]>;
59
- [Symbol.iterator](): IterableIterator<T>;
60
- toString(): string;
61
- toJSON(): Array<T>;
62
- inspect(): any;
63
-
64
- // Statics
65
- static from<I>(iterable: Iterable<I> | {[key: string]: I}): LinkedList<I>;
66
- }
67
-
68
5
  /**
69
6
  * Common head of two arrays
70
7
  *
@@ -416,4 +353,4 @@ declare namespace objectHash {
416
353
  declare function objectHash(object: objectHash.NotUndefined, options?: objectHash.NormalOption): string;
417
354
  declare function objectHash(object: objectHash.NotUndefined, options?: objectHash.WithBufferOption): Buffer;
418
355
 
419
- export { DefaultMap, LinkedList, commonHead, compareNatural, compareRelations, delay, difference, equals as equalsSet, getOrCreate, hasAtLeast, ifilter, ifind, iflat, imap, intersection, ireduce, isIterable, isNonEmptyArray, isString, isome, iunique, objectHash, stringHash, symmetricDifference, toArray, toSet, union };
356
+ export { commonHead, compareNatural, compareRelations, delay, difference, equals as equalsSet, getOrCreate, hasAtLeast, ifilter, ifind, iflat, imap, intersection, ireduce, isIterable, isNonEmptyArray, isString, isome, iunique, objectHash, stringHash, symmetricDifference, toArray, toSet, union };
@@ -0,0 +1,56 @@
1
+ import { d as t, U as n, j as commonAncestor, o as compareFqnHierarchically } from '../shared/core.BxvDITEI.mjs';
2
+ export { h as ancestorsFqn, e as commonHead, k as compareByFqnHierarchically, f as compareNatural, I as difference, J as equalsSet, y as getOrCreate, a as hasAtLeast, q as hierarchyDistance, r as hierarchyLevel, B as ifilter, i as ifind, C as iflat, D as imap, K as intersection, s as isAncestor, u as isDescendantOf, E as isIterable, z as isNonEmptyArray, c as isSameHierarchy, A as isString, F as isome, G as iunique, n as nameFromFqn, O as objectHash, p as parentFqn, v as sortByFqnHierarchically, w as sortNaturalByFqn, x as sortParentsFirst, N as stringHash, L as symmetricDifference, H as toArray, t as toSet, M as union } from '../shared/core.BxvDITEI.mjs';
3
+ import { i as invariant } from '../shared/core.M-JWF7SS.mjs';
4
+
5
+ function o(r,n){let e=Math.ceil(r),t=Math.floor(n);if(t<e)throw new RangeError(`randomInteger: The range [${r.toString()},${n.toString()}] contains no integer`);return Math.floor(Math.random()*(t-e+1)+e)}
6
+
7
+ function ireduce(arg1, arg2, arg3) {
8
+ const reducer = n(arg3) ? arg2 : arg1;
9
+ const initialValue = arg3 ?? arg2;
10
+ invariant(t(reducer));
11
+ function _reduce(iter) {
12
+ let acc = initialValue;
13
+ for (const value of iter) {
14
+ acc = reducer(acc, value);
15
+ }
16
+ return acc;
17
+ }
18
+ return n(arg3) ? _reduce(arg1) : _reduce;
19
+ }
20
+
21
+ const DELAY = "LIKEC4_DELAY";
22
+ function delay(...args) {
23
+ let ms = 100;
24
+ if (args.length === 2) {
25
+ ms = o(args[0], args[1]);
26
+ } else if (args.length === 1) {
27
+ ms = args[0];
28
+ }
29
+ return new Promise((resolve) => {
30
+ setTimeout(() => {
31
+ resolve(DELAY);
32
+ }, ms ?? 100);
33
+ });
34
+ }
35
+
36
+ const compareRelations = (a, b) => {
37
+ const parentA = commonAncestor(a.source, a.target);
38
+ const parentB = commonAncestor(b.source, b.target);
39
+ if (parentA && !parentB) {
40
+ return 1;
41
+ }
42
+ if (!parentA && parentB) {
43
+ return -1;
44
+ }
45
+ const compareParents = parentA && parentB ? compareFqnHierarchically(parentA, parentB) : 0;
46
+ if (compareParents !== 0) {
47
+ return compareParents;
48
+ }
49
+ const compareSource = compareFqnHierarchically(a.source, b.source);
50
+ if (compareSource !== 0) {
51
+ return compareSource;
52
+ }
53
+ return compareFqnHierarchically(a.target, b.target);
54
+ };
55
+
56
+ export { commonAncestor, compareFqnHierarchically, compareRelations, delay, ireduce };