@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
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { L as LikeC4Model, E as ElementModel, R as RelationshipModel } from './core.Brmu7VBL.mjs';
|
|
2
|
-
import { F as Fqn } from './core.30yYKXcZ.mjs';
|
|
3
|
-
|
|
4
|
-
declare function computeRelationshipsView(subjectId: Fqn, likec4model: LikeC4Model): {
|
|
5
|
-
incomers: Set<ElementModel<LikeC4Model.Any>>;
|
|
6
|
-
incoming: Set<RelationshipModel<LikeC4Model.Any>>;
|
|
7
|
-
subjects: Set<ElementModel<LikeC4Model.Any>>;
|
|
8
|
-
outgoing: Set<RelationshipModel<LikeC4Model.Any>>;
|
|
9
|
-
outgoers: Set<ElementModel<LikeC4Model.Any>>;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export { computeRelationshipsView as c };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { L as LikeC4Model, E as ElementModel, R as RelationshipModel } from './core.Cpd5mZgF.js';
|
|
2
|
-
import { F as Fqn } from './core.30yYKXcZ.js';
|
|
3
|
-
|
|
4
|
-
declare function computeRelationshipsView(subjectId: Fqn, likec4model: LikeC4Model): {
|
|
5
|
-
incomers: Set<ElementModel<LikeC4Model.Any>>;
|
|
6
|
-
incoming: Set<RelationshipModel<LikeC4Model.Any>>;
|
|
7
|
-
subjects: Set<ElementModel<LikeC4Model.Any>>;
|
|
8
|
-
outgoing: Set<RelationshipModel<LikeC4Model.Any>>;
|
|
9
|
-
outgoers: Set<ElementModel<LikeC4Model.Any>>;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export { computeRelationshipsView as c };
|
package/dist/types/index.d.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { X as XYPoint, N as NonEmptyArray, P as Point, l as BorderStyle, p as ElementShape, Q as ThemeColor, F as Fqn } from '../shared/core.30yYKXcZ.js';
|
|
2
|
-
export { A as AsFqn, B as BorderStyles, x as Color, y as ColorLiteral, C as CustomColor, D as DefaultElementShape, f as DefaultPaddingSize, g as DefaultShapeSize, h as DefaultTextSize, i as DefaultThemeColor, m as Element, j as ElementKind, n as ElementKindSpecification, o as ElementKindSpecificationStyle, k as ElementShapes, q as ElementStyle, G as ElementThemeColorValues, z as ElementThemeColors, E as ExclusiveUnion, H as HexColorLiteral, I as IconUrl, a as IteratorLike, K as KeysOf, L as LikeC4Theme, r as Link, c as NTuple, b as NonEmptyReadonlyArray, d as Predicate, e as ProjectId, J as RelationshipThemeColorValues, R as RelationshipThemeColors, S as ShapeSize, M as SpacingSize, s as Tag, t as TagSpec, O as TextSize, T as ThemeColorValues, w as ThemeColors, u as TypedElement, v as isThemeColor } from '../shared/core.30yYKXcZ.js';
|
|
3
|
-
import { bo as ViewId, a_ as BBox, bp as ViewManualLayout, aX as AutoLayoutDirection } from '../shared/core.BH59D8Ji.js';
|
|
4
|
-
export { aw as AbstractRelation, ah as AllNever, ai as AndOperator, a5 as AnyParsedLikeC4ModelData, aY as BasicElementView, aZ as BasicView, a$ as ComputedDeploymentView, b0 as ComputedDynamicView, b1 as ComputedEdge, b2 as ComputedElementView, C as ComputedLikeC4ModelData, aD as ComputedNode, a as ComputedView, b3 as CustomColorDefinitions, A as CustomElementExpr, B as CustomRelationExpr, at as DefaultArrowType, au as DefaultLineStyle, av as DefaultRelationshipColor, b as DeployedInstance, D as DeploymentElement, c as DeploymentElementStyle, d as DeploymentNode, f as DeploymentNodeKind, g as DeploymentNodeKindSpecification, h as DeploymentRef, i as DeploymentRelation, b4 as DeploymentView, b5 as DeploymentViewRule, b6 as DeploymentViewRulePredicate, b7 as DeploymentViewRuleStyle, b8 as DiagramEdge, aE as DiagramNode, b9 as DiagramView, E as DirectRelationExpr, ba as DynamicView, bb as DynamicViewIncludeRule, bc as DynamicViewParallelSteps, bd as DynamicViewRule, be as DynamicViewStep, bf as DynamicViewStepOrParallel, bg as EdgeId, F as ElementExpression, G as ElementKindExpr, bA as ElementNotation, H as ElementPredicateExpression, I as ElementRefExpr, J as ElementTagExpr, bh as ElementView, K as ElementWhereExpr, aj as EqualOperator, M as ExpandedElementExpr, N as Expression, X as ExpressionV2, bi as ExtendsElementView, ak as Filterable, Y as FqnExpr, Z as FqnRef, a6 as GenericLikeC4ModelData, $ as GlobalDynamicPredicates, a0 as GlobalPredicateId, a1 as GlobalPredicates, a2 as GlobalStyleID, a3 as GlobalStyles, Q as InOutExpr, O as IncomingExpr, al as KindEqual, a7 as LayoutedLikeC4ModelData, a8 as LikeC4ModelDump, L as LikeC4View, a4 as ModelGlobals, ax as ModelRelation, bj as NodeId, R as NonWilcard, am as NotOperator, an as OperatorPredicate, ao as OrOperator, S as OutgoingExpr, a9 as ParsedLikeC4ModelData, ap as Participant, aq as ParticipantOperator, P as PredicateSelector, _ as RelationExpr, T as RelationExpression, ay as RelationId, U as RelationPredicateExpression, V as RelationWhereExpr, az as RelationshipArrowType, aA as RelationshipKind, aB as RelationshipKindSpecification, aC as RelationshipLineType, bk as ScopedElementView, bl as StepEdgeId, bm as StepEdgeIdLiteral, ar as TagEqual, bn as ViewAutoLayout, bq as ViewRule, br as ViewRuleAutoLayout, bs as ViewRuleGlobalPredicateRef, bt as ViewRuleGlobalStyle, bu as ViewRuleGroup, bv as ViewRulePredicate, bw as ViewRuleStyle, bx as ViewRuleStyleOrGlobalRef, by as ViewWithHash, bz as ViewWithNotation, as as WhereOperator, W as WildcardExpr, aF as extractStep, aG as getBBoxCenter, aH as getParallelStepsPrefix, aa as isAndOperator, aI as isAutoLayoutDirection, j as isCustomElement, k as isCustomRelationExpr, aJ as isDeploymentView, aK as isDynamicView, aL as isDynamicViewParallelSteps, l as isElement, m as isElementKindExpr, n as isElementPredicateExpr, o as isElementRef, p as isElementTagExpr, aM as isElementView, q as isElementWhere, r as isExpandedElementExpr, aN as isExtendsElementView, t as isInOut, s as isIncoming, ab as isKindEqual, ac as isNotOperator, ad as isOrOperator, u as isOutgoing, ae as isParticipantOperator, v as isRelation, w as isRelationExpression, x as isRelationPredicateExpr, y as isRelationWhere, aO as isScopedElementView, aP as isStepEdgeId, af as isTagEqual, aQ as isViewRuleAutoLayout, aR as isViewRuleGlobalPredicateRef, aS as isViewRuleGlobalStyle, aT as isViewRuleGroup, aU as isViewRulePredicate, aV as isViewRuleStyle, z as isWildcard, aW as stepEdgeId, ag as whereOperatorAsPredicate } from '../shared/core.BH59D8Ji.js';
|
|
5
|
-
import 'type-fest';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* OverviewGraph is a graph representation of all views in a model
|
|
9
|
-
*/
|
|
10
|
-
declare namespace OverviewGraph {
|
|
11
|
-
type Node = {
|
|
12
|
-
id: string;
|
|
13
|
-
type: 'folder' | 'file';
|
|
14
|
-
path: string;
|
|
15
|
-
label: string;
|
|
16
|
-
parentId: string | null;
|
|
17
|
-
position: XYPoint;
|
|
18
|
-
width: number;
|
|
19
|
-
height: number;
|
|
20
|
-
} | {
|
|
21
|
-
id: string;
|
|
22
|
-
type: 'view';
|
|
23
|
-
viewId: ViewId;
|
|
24
|
-
label: string;
|
|
25
|
-
parentId: string | null;
|
|
26
|
-
position: XYPoint;
|
|
27
|
-
width: number;
|
|
28
|
-
height: number;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Edge represents a navigational link from one view to another
|
|
32
|
-
*/
|
|
33
|
-
type Edge = {
|
|
34
|
-
id: string;
|
|
35
|
-
source: string;
|
|
36
|
-
target: string;
|
|
37
|
-
points: NonEmptyArray<Point>;
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
interface OverviewGraph {
|
|
41
|
-
nodes: OverviewGraph.Node[];
|
|
42
|
-
edges: OverviewGraph.Edge[];
|
|
43
|
-
bounds: BBox;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
declare namespace ViewChange {
|
|
47
|
-
interface ChangeElementStyle {
|
|
48
|
-
op: 'change-element-style';
|
|
49
|
-
style: {
|
|
50
|
-
border?: BorderStyle;
|
|
51
|
-
opacity?: number;
|
|
52
|
-
shape?: ElementShape;
|
|
53
|
-
color?: ThemeColor;
|
|
54
|
-
};
|
|
55
|
-
targets: NonEmptyArray<Fqn>;
|
|
56
|
-
}
|
|
57
|
-
interface SaveManualLayout {
|
|
58
|
-
op: 'save-manual-layout';
|
|
59
|
-
layout: ViewManualLayout;
|
|
60
|
-
}
|
|
61
|
-
interface ChangeAutoLayout {
|
|
62
|
-
op: 'change-autolayout';
|
|
63
|
-
layout: {
|
|
64
|
-
direction: AutoLayoutDirection;
|
|
65
|
-
nodeSep?: number | null;
|
|
66
|
-
rankSep?: number | null;
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
type ViewChange = ViewChange.ChangeElementStyle | ViewChange.SaveManualLayout | ViewChange.ChangeAutoLayout;
|
|
71
|
-
|
|
72
|
-
export { AutoLayoutDirection, BBox, BorderStyle, ElementShape, Fqn, NonEmptyArray, OverviewGraph, Point, ThemeColor, ViewChange, ViewId, ViewManualLayout, XYPoint };
|
package/dist/utils/index.d.ts
DELETED
|
@@ -1,458 +0,0 @@
|
|
|
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.CIbWBWW3.js';
|
|
2
|
-
import { N as NonEmptyArray, a as IteratorLike } from '../shared/core.30yYKXcZ.js';
|
|
3
|
-
export { default as objectHash } from '/home/runner/work/likec4/likec4/node_modules/.pnpm/@types+object-hash@3.0.6/node_modules/@types/object-hash/index.d.ts';
|
|
4
|
-
import { IsNumericLiteral } from 'type-fest';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Mnemonist DefaultMap Typings
|
|
8
|
-
* =============================
|
|
9
|
-
*/
|
|
10
|
-
declare class DefaultMap<K, V> implements Iterable<[K, V]> {
|
|
11
|
-
|
|
12
|
-
// Members
|
|
13
|
-
size: number;
|
|
14
|
-
|
|
15
|
-
// Constructor
|
|
16
|
-
constructor(factory: (key: K, index: number) => V);
|
|
17
|
-
|
|
18
|
-
// Methods
|
|
19
|
-
clear(): void;
|
|
20
|
-
set(key: K, value: V): this;
|
|
21
|
-
delete(key: K): boolean;
|
|
22
|
-
has(key: K): boolean;
|
|
23
|
-
get(key: K): V;
|
|
24
|
-
peek(key: K): V | undefined;
|
|
25
|
-
forEach(callback: (value: V, key: K, map: this) => void, scope?: any): void;
|
|
26
|
-
keys(): IterableIterator<K>;
|
|
27
|
-
values(): IterableIterator<V>;
|
|
28
|
-
entries(): IterableIterator<[K, V]>;
|
|
29
|
-
[Symbol.iterator](): IterableIterator<[K, V]>;
|
|
30
|
-
inspect(): any;
|
|
31
|
-
|
|
32
|
-
// Statics
|
|
33
|
-
static autoIncrement(): number;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Mnemonist DefaultWeakMap Typings
|
|
38
|
-
* ================================
|
|
39
|
-
*/
|
|
40
|
-
declare class DefaultWeakMap<K extends object, V> {
|
|
41
|
-
|
|
42
|
-
// Constructor
|
|
43
|
-
constructor(factory: (key: K) => V);
|
|
44
|
-
|
|
45
|
-
// Methods
|
|
46
|
-
clear(): void;
|
|
47
|
-
set(key: K, value: V): this;
|
|
48
|
-
delete(key: K): boolean;
|
|
49
|
-
has(key: K): boolean;
|
|
50
|
-
get(key: K): V;
|
|
51
|
-
peek(key: K): V | undefined;
|
|
52
|
-
inspect(): any;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Mnemonist LinkedList Typings
|
|
57
|
-
* =============================
|
|
58
|
-
*/
|
|
59
|
-
declare class LinkedList<T> implements Iterable<T> {
|
|
60
|
-
|
|
61
|
-
// Members
|
|
62
|
-
size: number;
|
|
63
|
-
|
|
64
|
-
// Constructor
|
|
65
|
-
constructor();
|
|
66
|
-
|
|
67
|
-
// Methods
|
|
68
|
-
clear(): void;
|
|
69
|
-
first(): T | undefined;
|
|
70
|
-
last(): T | undefined;
|
|
71
|
-
peek(): T | undefined;
|
|
72
|
-
push(value: T): number;
|
|
73
|
-
shift(): T | undefined;
|
|
74
|
-
unshift(value: T): number;
|
|
75
|
-
forEach(callback: (value: T, index: number, list: this) => void, scope?: any): void;
|
|
76
|
-
toArray(): Array<T>;
|
|
77
|
-
values(): IterableIterator<T>;
|
|
78
|
-
entries(): IterableIterator<[number, T]>;
|
|
79
|
-
[Symbol.iterator](): IterableIterator<T>;
|
|
80
|
-
toString(): string;
|
|
81
|
-
toJSON(): Array<T>;
|
|
82
|
-
inspect(): any;
|
|
83
|
-
|
|
84
|
-
// Statics
|
|
85
|
-
static from<I>(iterable: Iterable<I> | {[key: string]: I}): LinkedList<I>;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Mnemonist Queue Typings
|
|
90
|
-
* ========================
|
|
91
|
-
*/
|
|
92
|
-
declare class Queue<T> implements Iterable<T> {
|
|
93
|
-
|
|
94
|
-
// Members
|
|
95
|
-
size: number;
|
|
96
|
-
|
|
97
|
-
// Constructor
|
|
98
|
-
constructor();
|
|
99
|
-
|
|
100
|
-
// Methods
|
|
101
|
-
clear(): void;
|
|
102
|
-
enqueue(item: T): number;
|
|
103
|
-
dequeue(): T | undefined;
|
|
104
|
-
peek(): T | undefined;
|
|
105
|
-
forEach(callback: (item: T, index: number, queue: this) => void, scope?: any): void;
|
|
106
|
-
toArray(): Array<T>;
|
|
107
|
-
values(): IterableIterator<T>;
|
|
108
|
-
entries(): IterableIterator<[number, T]>;
|
|
109
|
-
[Symbol.iterator](): IterableIterator<T>;
|
|
110
|
-
toString(): string;
|
|
111
|
-
toJSON(): Array<T>;
|
|
112
|
-
inspect(): any;
|
|
113
|
-
|
|
114
|
-
// Statics
|
|
115
|
-
static from<I>(iterable: Iterable<I> | {[key: string]: I}): Queue<I>;
|
|
116
|
-
static of<I>(...items: Array<I>): Queue<I>;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
interface MultiMapConstructor {
|
|
120
|
-
new <K, V>(container: SetConstructor): MultiMap<K, V, Set<V>>;
|
|
121
|
-
new <K, V>(container?: ArrayConstructor): MultiMap<K, V, V[]>;
|
|
122
|
-
|
|
123
|
-
from<K, V>(
|
|
124
|
-
iterable: Iterable<[K, V]> | {[key: string]: V},
|
|
125
|
-
Container: SetConstructor
|
|
126
|
-
): MultiMap<K, V, Set<V>>;
|
|
127
|
-
from<K, V>(
|
|
128
|
-
iterable: Iterable<[K, V]> | {[key: string]: V},
|
|
129
|
-
Container?: ArrayConstructor
|
|
130
|
-
): MultiMap<K, V, V[]>;
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Mnemonist MultiMap Typings
|
|
134
|
-
* ===========================
|
|
135
|
-
*/
|
|
136
|
-
|
|
137
|
-
interface MultiMap<K, V, C extends V[] | Set<V> = V[]> extends Iterable<[K, V]> {
|
|
138
|
-
|
|
139
|
-
// Members
|
|
140
|
-
dimension: number;
|
|
141
|
-
size: number;
|
|
142
|
-
|
|
143
|
-
// Methods
|
|
144
|
-
clear(): void;
|
|
145
|
-
set(key: K, value: V): this;
|
|
146
|
-
delete(key: K): boolean;
|
|
147
|
-
remove(key: K, value: V): boolean;
|
|
148
|
-
has(key: K): boolean;
|
|
149
|
-
get(key: K): C | undefined;
|
|
150
|
-
multiplicity(key: K): number;
|
|
151
|
-
forEach(callback: (value: V, key: K, map: this) => void, scope?: any): void;
|
|
152
|
-
forEachAssociation(callback: (value: C, key: K, map: this) => void, scope?: any): void;
|
|
153
|
-
keys(): IterableIterator<K>;
|
|
154
|
-
values(): IterableIterator<V>;
|
|
155
|
-
entries(): IterableIterator<[K, V]>;
|
|
156
|
-
containers(): IterableIterator<C>;
|
|
157
|
-
associations(): IterableIterator<[K, C]>;
|
|
158
|
-
[Symbol.iterator](): IterableIterator<[K, V]>;
|
|
159
|
-
inspect(): any;
|
|
160
|
-
toJSON(): any;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
declare const MultiMap: MultiMapConstructor;
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* Mnemonist Stack Typings
|
|
167
|
-
* ========================
|
|
168
|
-
*/
|
|
169
|
-
declare class Stack<T> implements Iterable<T> {
|
|
170
|
-
|
|
171
|
-
// Members
|
|
172
|
-
size: number;
|
|
173
|
-
|
|
174
|
-
// Constructor
|
|
175
|
-
constructor();
|
|
176
|
-
|
|
177
|
-
// Methods
|
|
178
|
-
clear(): void;
|
|
179
|
-
push(item: T): number;
|
|
180
|
-
pop(): T | undefined;
|
|
181
|
-
peek(): T | undefined;
|
|
182
|
-
forEach(callback: (item: T, index: number, stack: this) => void, scope?: any): void;
|
|
183
|
-
toArray(): Array<T>;
|
|
184
|
-
values(): IterableIterator<T>;
|
|
185
|
-
entries(): IterableIterator<[number, T]>;
|
|
186
|
-
[Symbol.iterator](): IterableIterator<T>;
|
|
187
|
-
toString(): string;
|
|
188
|
-
toJSON(): Array<T>;
|
|
189
|
-
inspect(): any;
|
|
190
|
-
|
|
191
|
-
// Statics
|
|
192
|
-
static from<I>(iterable: Iterable<I> | {[key: string]: I}): Stack<I>;
|
|
193
|
-
static of<I>(...items: Array<I>): Stack<I>;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* Mnemonist BiMap Typings
|
|
198
|
-
* ========================
|
|
199
|
-
*/
|
|
200
|
-
declare class InverseMap<K, V> implements Iterable<[K, V]> {
|
|
201
|
-
|
|
202
|
-
// Members
|
|
203
|
-
size: number;
|
|
204
|
-
inverse: BiMap<V, K>;
|
|
205
|
-
|
|
206
|
-
// Constructor
|
|
207
|
-
constructor(original: BiMap<K, V>);
|
|
208
|
-
|
|
209
|
-
// Methods
|
|
210
|
-
clear(): void;
|
|
211
|
-
set(key: K, value: V): this;
|
|
212
|
-
delete(key: K): boolean;
|
|
213
|
-
has(key: K): boolean;
|
|
214
|
-
get(key: K): V | undefined;
|
|
215
|
-
forEach(callback: (value: V, key: K, map: this) => void, scope?: any): void;
|
|
216
|
-
keys(): IterableIterator<K>;
|
|
217
|
-
values(): IterableIterator<V>;
|
|
218
|
-
entries(): IterableIterator<[K, V]>;
|
|
219
|
-
[Symbol.iterator](): IterableIterator<[K, V]>;
|
|
220
|
-
inspect(): any;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
declare class BiMap<K, V> implements Iterable<[K, V]> {
|
|
224
|
-
|
|
225
|
-
// Members
|
|
226
|
-
size: number;
|
|
227
|
-
inverse: InverseMap<V, K>;
|
|
228
|
-
|
|
229
|
-
// Constructor
|
|
230
|
-
constructor();
|
|
231
|
-
|
|
232
|
-
// Methods
|
|
233
|
-
clear(): void;
|
|
234
|
-
set(key: K, value: V): this;
|
|
235
|
-
delete(key: K): boolean;
|
|
236
|
-
has(key: K): boolean;
|
|
237
|
-
get(key: K): V | undefined;
|
|
238
|
-
forEach(callback: (value: V, key: K, map: this) => void, scope?: any): void;
|
|
239
|
-
keys(): IterableIterator<K>;
|
|
240
|
-
values(): IterableIterator<V>;
|
|
241
|
-
entries(): IterableIterator<[K, V]>;
|
|
242
|
-
[Symbol.iterator](): IterableIterator<[K, V]>;
|
|
243
|
-
inspect(): any;
|
|
244
|
-
|
|
245
|
-
// Statics
|
|
246
|
-
static from<I, J>(iterable: Iterable<[I, J]> | {[key: string]: J}): BiMap<I, J>;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
/**
|
|
250
|
-
* Common head of two arrays
|
|
251
|
-
*
|
|
252
|
-
* @param equals - Equality function, defaults to `Object.is`
|
|
253
|
-
*/
|
|
254
|
-
declare function commonHead<T>(sources: ReadonlyArray<T>, targets: ReadonlyArray<T>, equals?: (a: T, b: T) => boolean): T[];
|
|
255
|
-
|
|
256
|
-
declare function compareNatural(a: string | undefined, b: string | undefined): -1 | 0 | 1;
|
|
257
|
-
|
|
258
|
-
declare function getOrCreate<K, V>(map: Map<K, V>, key: K, create: (key: K) => V): V;
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
* This should only be used for defining generics which extend any kind of JS
|
|
262
|
-
* array under the hood, this includes arrays *AND* tuples (of the form [x, y],
|
|
263
|
-
* and of the form [x, ...y[]], etc...), and their readonly equivalent. This
|
|
264
|
-
* allows us to be more inclusive to what functions can process.
|
|
265
|
-
*
|
|
266
|
-
* @example
|
|
267
|
-
* function map<T extends IterableContainer>(items: T) { ... }
|
|
268
|
-
*
|
|
269
|
-
* We would've named this `ArrayLike`, but that's already used by typescript...
|
|
270
|
-
* @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)
|
|
271
|
-
*/
|
|
272
|
-
type IterableContainer<T = unknown> = ReadonlyArray<T> | readonly [];
|
|
273
|
-
|
|
274
|
-
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] ? [
|
|
275
|
-
Head,
|
|
276
|
-
...ArraySetRequired<Rest, Min, [unknown, ...Iteration]>
|
|
277
|
-
] : T extends readonly [infer Head, ...infer Rest] ? readonly [
|
|
278
|
-
Head,
|
|
279
|
-
...ArraySetRequired<Rest, Min, [unknown, ...Iteration]>
|
|
280
|
-
] : T extends Array<infer Item> ? [
|
|
281
|
-
Item,
|
|
282
|
-
...ArraySetRequired<T, Min, [unknown, ...Iteration]>
|
|
283
|
-
] : T extends ReadonlyArray<infer Item> ? readonly [
|
|
284
|
-
Item,
|
|
285
|
-
...ArraySetRequired<T, Min, [unknown, ...Iteration]>
|
|
286
|
-
] : never;
|
|
287
|
-
/**
|
|
288
|
-
* Checks if the given array has at least the defined number of elements. When
|
|
289
|
-
* the minimum used is a literal (e.g. `3`) the output is refined accordingly so
|
|
290
|
-
* that those indices are defined when accessing the array even when using
|
|
291
|
-
* typescript's 'noUncheckedIndexAccess'.
|
|
292
|
-
*
|
|
293
|
-
* @param data - The input array.
|
|
294
|
-
* @param minimum - The minimum number of elements the array must have.
|
|
295
|
-
* @returns True if the array's length is *at least* `minimum`. When `minimum`
|
|
296
|
-
* is a literal value, the output is narrowed to ensure the first items are
|
|
297
|
-
* guaranteed.
|
|
298
|
-
* @signature
|
|
299
|
-
* R.hasAtLeast(data, minimum)
|
|
300
|
-
* @example
|
|
301
|
-
* R.hasAtLeast([], 4); // => false
|
|
302
|
-
*
|
|
303
|
-
* const data: number[] = [1,2,3,4];
|
|
304
|
-
* R.hasAtLeast(data, 1); // => true
|
|
305
|
-
* data[0]; // 1, with type `number`
|
|
306
|
-
* @dataFirst
|
|
307
|
-
* @category Array
|
|
308
|
-
*/
|
|
309
|
-
declare function hasAtLeast<T extends IterableContainer, N extends number>(data: IterableContainer | T, minimum: IsNumericLiteral<N> extends true ? N : never): data is ArraySetRequired<T, N>;
|
|
310
|
-
declare function hasAtLeast(data: IterableContainer, minimum: number): boolean;
|
|
311
|
-
/**
|
|
312
|
-
* Checks if the given array has at least the defined number of elements. When
|
|
313
|
-
* the minimum used is a literal (e.g. `3`) the output is refined accordingly so
|
|
314
|
-
* that those indices are defined when accessing the array even when using
|
|
315
|
-
* typescript's 'noUncheckedIndexAccess'.
|
|
316
|
-
*
|
|
317
|
-
* @param minimum - The minimum number of elements the array must have.
|
|
318
|
-
* @returns True if the array's length is *at least* `minimum`. When `minimum`
|
|
319
|
-
* is a literal value, the output is narrowed to ensure the first items are
|
|
320
|
-
* guaranteed.
|
|
321
|
-
* @signature
|
|
322
|
-
* R.hasAtLeast(minimum)(data)
|
|
323
|
-
* @example
|
|
324
|
-
* R.pipe([], R.hasAtLeast(4)); // => false
|
|
325
|
-
*
|
|
326
|
-
* const data = [[1,2], [3], [4,5]];
|
|
327
|
-
* R.pipe(
|
|
328
|
-
* data,
|
|
329
|
-
* R.filter(R.hasAtLeast(2)),
|
|
330
|
-
* R.map(([, second]) => second),
|
|
331
|
-
* ); // => [2,5], with type `number[]`
|
|
332
|
-
* @dataLast
|
|
333
|
-
* @category Array
|
|
334
|
-
*/
|
|
335
|
-
declare function hasAtLeast<N extends number>(minimum: IsNumericLiteral<N> extends true ? N : never): <T extends IterableContainer>(data: IterableContainer | T) => data is ArraySetRequired<T, N>;
|
|
336
|
-
declare function hasAtLeast(minimum: number): (data: IterableContainer) => boolean;
|
|
337
|
-
|
|
338
|
-
declare function isString(value: unknown): value is string;
|
|
339
|
-
declare function isNonEmptyArray<A>(arr: ArrayLike<A> | undefined): arr is NonEmptyArray<A>;
|
|
340
|
-
|
|
341
|
-
declare function isIterable<T, I extends Iterable<T>>(something: I | unknown): something is Iterable<T>;
|
|
342
|
-
|
|
343
|
-
/**
|
|
344
|
-
* Filters an iterable based on a predicate.
|
|
345
|
-
* Composabel first version of `ifilter`.
|
|
346
|
-
* @signature
|
|
347
|
-
* ifilter(predicate)(data)
|
|
348
|
-
*/
|
|
349
|
-
declare function ifilter<T, S extends T>(predicate: (v: T) => v is S): (iterable: Iterable<T>) => IteratorLike<S>;
|
|
350
|
-
declare function ifilter<T>(predicate: (v: T) => boolean): (iterable: Iterable<T>) => IteratorLike<T>;
|
|
351
|
-
/**
|
|
352
|
-
* Filters an iterable based on a predicate.
|
|
353
|
-
* Data first version of `ifilter`.
|
|
354
|
-
* @signature
|
|
355
|
-
* ifilter(data, predicate)
|
|
356
|
-
* @example
|
|
357
|
-
* ifilter(new Set([1, 2, 3]), x => x % 2 === 1) // => Iterable<[1, 3]>
|
|
358
|
-
*/
|
|
359
|
-
declare function ifilter<T, S extends T>(iterable: Iterable<T>, predicate: (v: T) => v is S): IteratorLike<S>;
|
|
360
|
-
declare function ifilter<T>(iterable: Iterable<T>, predicate: (v: T) => boolean): IteratorLike<T>;
|
|
361
|
-
|
|
362
|
-
/**
|
|
363
|
-
* Finds the first element in the iterable that satisfies the predicate.
|
|
364
|
-
* Composable first version of `find`.
|
|
365
|
-
* @signature
|
|
366
|
-
* ifind(predicate)(data)
|
|
367
|
-
*/
|
|
368
|
-
declare function ifind<T>(predicate: (item: T) => boolean): (iterable: Iterable<T>) => T | undefined;
|
|
369
|
-
/**
|
|
370
|
-
* Finds the first element in the iterable that satisfies the predicate.
|
|
371
|
-
* Data first version of `find`.
|
|
372
|
-
* @signature
|
|
373
|
-
* ifind(data, predicate)
|
|
374
|
-
*/
|
|
375
|
-
declare function ifind<T>(iterable: Iterable<T>, predicate: (item: T) => boolean): T | undefined;
|
|
376
|
-
|
|
377
|
-
declare function iflat(): <T>(iterable: Iterable<IteratorLike<T>>) => IteratorLike<T>;
|
|
378
|
-
declare function iflat<T>(iterable: Iterable<IteratorLike<T>>): IteratorLike<T>;
|
|
379
|
-
|
|
380
|
-
type MapFunction<T, S> = (item: T) => S;
|
|
381
|
-
/**
|
|
382
|
-
* Maps an iterable using a mapper function.
|
|
383
|
-
* Composable first version of `imap`.
|
|
384
|
-
* @signature
|
|
385
|
-
* imap(mapper)(data)
|
|
386
|
-
*/
|
|
387
|
-
declare function imap<T, S>(mapper: MapFunction<T, S>): (iterable: Iterable<T>) => IteratorLike<S>;
|
|
388
|
-
/**
|
|
389
|
-
* Maps an iterable using a mapper function.
|
|
390
|
-
* Data first version of `imap`.
|
|
391
|
-
* @signature
|
|
392
|
-
* imap(data, mapper)
|
|
393
|
-
*/
|
|
394
|
-
declare function imap<T, S>(iterable: Iterable<T>, mapper: MapFunction<T, S>): IteratorLike<S>;
|
|
395
|
-
|
|
396
|
-
declare function ireduce<T, R>(reducer: (acc: R, item: T) => R, initialValue: R): (iterable: Iterable<T>) => R;
|
|
397
|
-
declare function ireduce<T, R>(iterable: Iterable<T>, reducer: (acc: R, item: T) => R, initialValue: R): R;
|
|
398
|
-
|
|
399
|
-
/**
|
|
400
|
-
* Checks if at least one element in the iterable satisfies the predicate.
|
|
401
|
-
* Composable first version of `some`.
|
|
402
|
-
* @signature
|
|
403
|
-
* isome(predicate)(data)
|
|
404
|
-
*/
|
|
405
|
-
declare function isome<T>(predicate: (item: T) => boolean): (iterable: Iterable<T>) => boolean;
|
|
406
|
-
/**
|
|
407
|
-
* Checks if at least one element in the iterable satisfies the predicate.
|
|
408
|
-
* Data first version of `some`.
|
|
409
|
-
* @signature
|
|
410
|
-
* isome(data, predicate)
|
|
411
|
-
*/
|
|
412
|
-
declare function isome<T>(iterable: Iterable<T>, predicate: (item: T) => boolean): boolean;
|
|
413
|
-
|
|
414
|
-
declare function toArray(): <T>(iterable: Iterable<T> | ArrayLike<T>) => T[];
|
|
415
|
-
declare function toArray<T>(iterable: Iterable<T> | ArrayLike<T>): T[];
|
|
416
|
-
declare function toSet(): <T>(iterable: Iterable<T>) => Set<T>;
|
|
417
|
-
declare function toSet<T>(iterable: Iterable<T>): Set<T>;
|
|
418
|
-
|
|
419
|
-
/**
|
|
420
|
-
* Returns an iterable that yields only unique values.
|
|
421
|
-
* It uses a Set to keep track of the values.
|
|
422
|
-
*/
|
|
423
|
-
declare function iunique(): <T>(iterable: Iterable<T>) => IteratorLike<T>;
|
|
424
|
-
declare function iunique<T>(iterable: Iterable<T>): IteratorLike<T>;
|
|
425
|
-
|
|
426
|
-
declare function delay(): Promise<string>;
|
|
427
|
-
declare function delay(ms: number): Promise<string>;
|
|
428
|
-
declare function delay(randomFrom: number, randomTo: number): Promise<string>;
|
|
429
|
-
|
|
430
|
-
/**
|
|
431
|
-
* Compares two relations hierarchically.
|
|
432
|
-
* From the most general (implicit) to the most specific.
|
|
433
|
-
*/
|
|
434
|
-
declare const compareRelations: <T extends {
|
|
435
|
-
source: string;
|
|
436
|
-
target: string;
|
|
437
|
-
}>(a: T, b: T) => number;
|
|
438
|
-
|
|
439
|
-
/**
|
|
440
|
-
* Returns new set as a union of given sets
|
|
441
|
-
* Keeps order of elements
|
|
442
|
-
*/
|
|
443
|
-
declare function union<T>(...sets: ReadonlySet<T>[]): Set<T>;
|
|
444
|
-
/**
|
|
445
|
-
* Returns new set as an intersection of all sets
|
|
446
|
-
* Keeps order from the first set
|
|
447
|
-
*/
|
|
448
|
-
declare function intersection<T>(first: ReadonlySet<T>, ...sets: NonEmptyArray<ReadonlySet<NoInfer<T>>>): Set<T>;
|
|
449
|
-
declare function difference<T>(a: ReadonlySet<T>, b: ReadonlySet<NoInfer<T>>): Set<T>;
|
|
450
|
-
declare function equals<T>(a: ReadonlySet<T>, b: ReadonlySet<T>): boolean;
|
|
451
|
-
declare function symmetricDifference<T>(a: ReadonlySet<T>, b: ReadonlySet<T>): Set<T>;
|
|
452
|
-
|
|
453
|
-
/**
|
|
454
|
-
* @see https://gist.github.com/victor-homyakov/bcb7d7911e4a388b1c810f8c3ce17bcf
|
|
455
|
-
*/
|
|
456
|
-
declare function stringHash(str: string): string;
|
|
457
|
-
|
|
458
|
-
export { BiMap, DefaultMap, DefaultWeakMap, LinkedList, MultiMap, Queue, Stack, commonHead, compareNatural, compareRelations, delay, difference, equals as equalsSet, getOrCreate, hasAtLeast, ifilter, ifind, iflat, imap, intersection, ireduce, isIterable, isNonEmptyArray, isString, isome, iunique, stringHash, symmetricDifference, toArray, toSet, union };
|