@likec4/core 1.38.0 → 1.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builder/index.d.mts +6 -3
- package/dist/builder/index.mjs +55 -111
- package/dist/compute-view/index.d.mts +6 -3
- package/dist/compute-view/index.mjs +33 -34
- package/dist/compute-view/relationships-view/index.d.mts +6 -3
- package/dist/compute-view/relationships-view/index.mjs +6 -6
- package/dist/index.d.mts +8 -5
- package/dist/index.mjs +15 -24
- package/dist/model/connection/deployment/index.d.mts +8 -5
- package/dist/model/connection/deployment/index.mjs +7 -9
- package/dist/model/connection/index.d.mts +10 -7
- package/dist/model/connection/index.mjs +10 -14
- package/dist/model/connection/model/index.d.mts +8 -5
- package/dist/model/connection/model/index.mjs +7 -10
- package/dist/model/index.d.mts +13 -10
- package/dist/model/index.mjs +17 -20
- package/dist/shared/core.20m8Um0g.d.mts +253 -0
- package/dist/shared/{core.CpwrZi3D.mjs → core.4u1dVmfX.mjs} +3 -5
- package/dist/shared/{core.HUONfQfd.mjs → core.BB6zA-UU.mjs} +9 -214
- package/dist/shared/{core.C1GV0WWV.mjs → core.BVNaR17u.mjs} +1 -1
- package/dist/shared/{core.BL_xjl90.mjs → core.Be1n9a0i.mjs} +4 -5
- package/dist/shared/{core.BoyJPEen.mjs → core.Be4Jy9Qx.mjs} +2 -2
- package/dist/shared/{core.H8NbNp2X.mjs → core.BqVo8LrH.mjs} +1 -1
- package/dist/shared/{core.yaRvRnMW.mjs → core.BuoXfSMj.mjs} +1 -1
- package/dist/shared/{core.DhDo8LAz.d.mts → core.C7pZp1nR.d.mts} +3 -3
- package/dist/shared/{core.BH9nN-_I.mjs → core.CCD1ID81.mjs} +3 -4
- package/dist/shared/{core.8KM0D6va.mjs → core.CNGyqkJh.mjs} +1 -9
- package/dist/shared/{core.B0oEIXqd.mjs → core.CUw_2J9j.mjs} +1 -1
- package/dist/shared/{core.Y3j3s-oq.mjs → core.CWv15GLo.mjs} +11 -15
- package/dist/shared/{core.Bf5zKDK1.d.mts → core.CXCmvCws.d.mts} +2 -2
- package/dist/shared/core.CaT0SUUK.mjs +201 -0
- package/dist/shared/{core.Dtw1SBlz.d.mts → core.ClpXZ4Ib.d.mts} +3 -3
- package/dist/shared/{core.DyzAZvbX.mjs → core.CsbOakly.mjs} +13 -22
- package/dist/shared/{core.Btl47GOn.mjs → core.DLpidoWc.mjs} +2 -2
- package/dist/shared/{core.wwaSalox.d.mts → core.DM3vdkO_.d.mts} +1 -1
- package/dist/shared/core.DXhDWKFZ.d.mts +3 -0
- package/dist/shared/{core.O6FG0HF9.d.mts → core.DdzRtJ9d.d.mts} +1 -1
- package/dist/shared/{core.DQj9iv_y.mjs → core.DgttqsJc.mjs} +8 -11
- package/dist/shared/{core.b2BzqGz0.mjs → core.DlG1xWt2.mjs} +3 -43
- package/dist/shared/core.DnRszv-l.mjs +11982 -0
- package/dist/shared/core.DoM6aM9N.mjs +7 -0
- package/dist/shared/{core.DsznOb9G.mjs → core.DozSPE83.mjs} +43 -60
- package/dist/shared/{core.DsMrjY2q.mjs → core.GTgsmXS_.mjs} +2 -2
- package/dist/shared/core.ILwny7BV.mjs +38 -0
- package/dist/shared/core.PHwHXzkG.d.mts +213 -0
- package/dist/shared/core.T-eLZTW_.mjs +59 -0
- package/dist/shared/{core.CE_hG7EJ.d.mts → core.aWJgARyY.d.mts} +10 -486
- package/dist/shared/{core.BvlHvikl.d.mts → core.v1iEaXaR.d.mts} +5 -3
- package/dist/shared/core.yHe79zEl.mjs +98 -0
- package/dist/theme/index.d.mts +3 -126
- package/dist/theme/index.mjs +2 -3
- package/dist/types/_aux.d.mts +1 -1
- package/dist/types/expression-model.d.mts +191 -0
- package/dist/types/expression-model.mjs +112 -0
- package/dist/types/expression.d.mts +7 -0
- package/dist/types/expression.mjs +116 -0
- package/dist/types/fqnRef.d.mts +61 -0
- package/dist/types/fqnRef.mjs +46 -0
- package/dist/types/index.d.mts +6 -3
- package/dist/types/index.mjs +9 -9
- package/dist/types/scalar.mjs +2 -3
- package/dist/utils/index.d.mts +7 -429
- package/dist/utils/index.mjs +56 -15
- package/dist/utils/iterable/index.d.mts +2 -3
- package/dist/utils/iterable/index.mjs +9 -44
- package/package.json +9 -8
- package/src/index.ts +24 -1
- package/src/model/RelationModel.ts +1 -1
- package/src/model/index.ts +1 -1
- package/src/theme/element.ts +2 -2
- package/src/theme/relationships.ts +2 -2
- package/src/types/RichText.ts +1 -1
- package/src/types/expression-model.ts +3 -1
- package/src/types/expression.ts +3 -1
- package/src/types/fqnRef.ts +4 -1
- package/src/utils/compare-natural.ts +4 -2
- package/src/utils/guards.ts +0 -1
- package/src/utils/index.ts +0 -1
- package/dist/shared/core.BW8K1y6R.mjs +0 -278
- package/dist/shared/core.BgvIuGGU.mjs +0 -3
- package/dist/shared/core.BpJu1RrF.mjs +0 -5
- package/dist/shared/core.ByrmCl9I.mjs +0 -5
- package/dist/shared/core.CnIyafWn.mjs +0 -3
- package/dist/shared/core.DK6I-Nr7.mjs +0 -149
- package/dist/shared/core.DbRvwARP.mjs +0 -5
- package/dist/shared/core.YyjkRVss.mjs +0 -5236
- package/dist/shared/core.zLlww-07.mjs +0 -3
- package/src/builder/__snapshots__/Builder-style1.spec.ts.snap +0 -425
- package/src/builder/__snapshots__/Builder-style2.compute-model.json5 +0 -318
- package/src/builder/__snapshots__/Builder-style2.spec.ts.snap +0 -221
- package/src/compute-view/deployment-view/__test__/TestHelper.ts +0 -249
- package/src/compute-view/deployment-view/__test__/fixture.ts +0 -238
- package/src/compute-view/dynamic-view/__test__/fixture.ts +0 -67
- package/src/compute-view/element-view/__test__/TestHelper.ts +0 -282
- package/src/compute-view/element-view/__test__/__snapshots__/legacy.spec.ts.snap +0 -458
- package/src/compute-view/element-view/__test__/fixture.ts +0 -749
- package/src/compute-view/utils/__snapshots__/sortNodes.spec.ts.snap +0 -113
- package/src/model/__test__/fixture.ts +0 -168
- package/src/theme/__test__/theme-index.ts +0 -29
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { isString } from 'remeda';
|
|
2
|
+
import { a as GlobalFqn } from '../shared/core.Be1n9a0i.mjs';
|
|
3
|
+
import '../shared/core.D4npX2q8.mjs';
|
|
4
|
+
|
|
5
|
+
var FqnRef;
|
|
6
|
+
((FqnRef2) => {
|
|
7
|
+
function isElementRef(ref) {
|
|
8
|
+
return "model" in ref && !("project" in ref);
|
|
9
|
+
}
|
|
10
|
+
FqnRef2.isElementRef = isElementRef;
|
|
11
|
+
function isImportRef(ref) {
|
|
12
|
+
return "project" in ref && "model" in ref;
|
|
13
|
+
}
|
|
14
|
+
FqnRef2.isImportRef = isImportRef;
|
|
15
|
+
function flatten(ref) {
|
|
16
|
+
if (isString(ref)) {
|
|
17
|
+
throw new Error(`Expected FqnRef, got: "${ref}"`);
|
|
18
|
+
}
|
|
19
|
+
if (isImportRef(ref)) {
|
|
20
|
+
return GlobalFqn(ref.project, ref.model);
|
|
21
|
+
}
|
|
22
|
+
if (isElementRef(ref)) {
|
|
23
|
+
return ref.model;
|
|
24
|
+
}
|
|
25
|
+
throw new Error("Expected FqnRef.ModelRef or FqnRef.ImportRef");
|
|
26
|
+
}
|
|
27
|
+
FqnRef2.flatten = flatten;
|
|
28
|
+
function isModelRef(ref) {
|
|
29
|
+
return isElementRef(ref) || isImportRef(ref);
|
|
30
|
+
}
|
|
31
|
+
FqnRef2.isModelRef = isModelRef;
|
|
32
|
+
function isInsideInstanceRef(ref) {
|
|
33
|
+
return "deployment" in ref && "element" in ref;
|
|
34
|
+
}
|
|
35
|
+
FqnRef2.isInsideInstanceRef = isInsideInstanceRef;
|
|
36
|
+
function isDeploymentElementRef(ref) {
|
|
37
|
+
return "deployment" in ref && !("element" in ref);
|
|
38
|
+
}
|
|
39
|
+
FqnRef2.isDeploymentElementRef = isDeploymentElementRef;
|
|
40
|
+
function isDeploymentRef(ref) {
|
|
41
|
+
return isDeploymentElementRef(ref) || isInsideInstanceRef(ref);
|
|
42
|
+
}
|
|
43
|
+
FqnRef2.isDeploymentRef = isDeploymentRef;
|
|
44
|
+
})(FqnRef || (FqnRef = {}));
|
|
45
|
+
|
|
46
|
+
export { FqnRef };
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { N as NonEmptyArray } from '../shared/core.DuSLYTG6.mjs';
|
|
2
2
|
export { C as Coalesce, E as ExclusiveUnion, I as IteratorLike, K as KeysOf, L as Link, b as NTuple, a as NonEmptyReadonlyArray, P as Predicate } from '../shared/core.DuSLYTG6.mjs';
|
|
3
|
-
export { A as Any, A as AnyAux, a as Aux, E as ExtractOnStage, M as ModelStage, S as SpecAux, U as Unknown, b as UnknownComputed, c as UnknownLayouted, d as UnknownParsed, e as _stage, f as _type, _ as aux, i as isOnStage } from '../shared/core.
|
|
4
|
-
|
|
5
|
-
export {
|
|
3
|
+
export { A as Any, A as AnyAux, a as Aux, E as ExtractOnStage, M as ModelStage, S as SpecAux, U as Unknown, b as UnknownComputed, c as UnknownLayouted, d as UnknownParsed, e as _stage, f as _type, _ as aux, i as isOnStage } from '../shared/core.DdzRtJ9d.mjs';
|
|
4
|
+
export { A as AndOperator, a as EqualOperator, E as Expression, j as Filterable, F as FqnExpr, K as KindEqual, N as NotOperator, k as OperatorPredicate, O as OrOperator, c as Participant, d as ParticipantOperator, P as PredicateSelector, R as RelationExpr, T as TagEqual, W as WhereOperator, g as isAndOperator, b as isKindEqual, f as isNotOperator, h as isOrOperator, e as isParticipantOperator, i as isTagEqual, w as whereOperatorAsPredicate } from '../shared/core.20m8Um0g.mjs';
|
|
5
|
+
export { ModelExpression, ModelFqnExpr, ModelRelationExpr } from './expression-model.mjs';
|
|
6
|
+
export { FqnRef } from './fqnRef.mjs';
|
|
7
|
+
import { ar as ViewManualLayout, am as AutoLayoutDirection } from '../shared/core.aWJgARyY.mjs';
|
|
8
|
+
export { K as AbstractRelationship, ag as AnyExcludePredicate, af as AnyIncludePredicate, a2 as AnyView, ah as AnyViewRuleStyle, u as AuxFromDump, A as AuxFromLikeC4ModelData, B as BBox, au as BaseParsedViewProperties, at as BaseViewProperties, aB as ComputedDeploymentView, aC as ComputedDynamicView, az as ComputedEdge, aA as ComputedElementView, C as ComputedLikeC4ModelData, ay as ComputedNode, a0 as ComputedView, I as DefaultArrowType, w as DefaultElementShape, H as DefaultLineStyle, y as DefaultPaddingSize, J as DefaultRelationshipColor, x as DefaultShapeSize, z as DefaultTextSize, v as DefaultThemeColor, k as DeployedInstance, l as DeploymentElement, m as DeploymentElementRef, D as DeploymentElementStyle, j as DeploymentNode, q as DeploymentRelation, p as DeploymentRelationship, aJ as DeploymentViewExcludePredicate, aI as DeploymentViewIncludePredicate, aK as DeploymentViewPredicate, aM as DeploymentViewRule, aL as DeploymentViewRuleStyle, aE as DiagramEdge, aD as DiagramNode, _ as DiagramView, aS as DynamicViewIncludeRule, aP as DynamicViewParallelSteps, aT as DynamicViewRule, aO as DynamicViewStep, aR as DynamicViewStepOrParallel, F as Element, Q as ElementSpecification, E as ElementStyle, aX as ElementViewExcludePredicate, aW as ElementViewIncludePredicate, aY as ElementViewPredicate, b0 as ElementViewRule, aZ as ElementViewRuleGroup, a$ as ElementViewRuleStyle, e as GlobalDynamicPredicates, G as GlobalPredicateId, d as GlobalPredicates, f as GlobalStyleID, g as GlobalStyles, aG as LayoutedDeploymentView, aH as LayoutedDynamicView, aF as LayoutedElementView, L as LayoutedLikeC4ModelData, _ as LayoutedView, i as LikeC4ModelData, s as LikeC4ModelDump, Y as LikeC4Project, Z as LikeC4View, M as ModelGlobals, O as ModelRelation, av as NodeNotation, aN as ParsedDeploymentView, aU as ParsedDynamicView, b1 as ParsedElementView, h as ParsedLikeC4ModelData, Z as ParsedView, P as Point, a1 as ProcessedView, t as ProjectDump, c as RectBox, N as Relationship, V as RelationshipSpecification, R as RichText, a as RichTextEmpty, b as RichTextOrEmpty, r as SpecTypesFromDump, W as Specification, S as SpecificationDump, T as TagSpecification, aq as ViewAutoLayout, a3 as ViewOnStage, a5 as ViewRule, ao as ViewRuleAutoLayout, ak as ViewRuleGlobalPredicateRef, ai as ViewRuleGlobalStyle, a6 as ViewRulePredicate, as as ViewType, ax as ViewWithHash, aw as ViewWithNotation, a4 as ViewWithType, X as XYPoint, aQ as getParallelStepsPrefix, an as isAutoLayoutDirection, a9 as isComputedView, o as isDeployedInstance, n as isDeploymentNode, ad as isDeploymentView, $ as isDiagramView, ae as isDynamicView, aV as isDynamicViewParallelSteps, aa as isElementView, ac as isExtendsElementView, $ as isLayoutedView, ab as isScopedElementView, U as isTagColorSpecified, ap as isViewRuleAutoLayout, al as isViewRuleGlobalPredicateRef, aj as isViewRuleGlobalStyle, a_ as isViewRuleGroup, a7 as isViewRulePredicate, a8 as isViewRuleStyle } from '../shared/core.aWJgARyY.mjs';
|
|
6
9
|
import { F as Fqn, D as DeploymentFqn } from '../shared/core.DX-WYEPA.mjs';
|
|
7
10
|
export { A as AnyFqn, B as BuiltInIcon, b as DeploymentKind, j as EdgeId, E as ElementKind, e as GlobalFqn, G as GroupElementKind, I as Icon, a as IconUrl, M as MarkdownOrString, N as NodeId, P as ProjectId, d as RelationId, R as RelationKind, c as RelationshipKind, k as StepEdgeId, S as StepEdgeIdLiteral, m as StepEdgeKind, T as Tag, V as ViewId, o as extractStep, f as flattenMarkdownOrString, g as isGlobalFqn, i as isGroupElementKind, n as isStepEdgeId, s as scalar, h as splitGlobalFqn, l as stepEdgeId } from '../shared/core.DX-WYEPA.mjs';
|
|
8
11
|
import { b as BorderStyle, c as ElementShape, h as ThemeColor } from '../shared/core.CzdwsPmY.mjs';
|
package/dist/types/index.mjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
export { _ as aux } from './_aux.mjs';
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
2
|
+
export { _ as _stage, a as _type, h as isAndOperator, c as isDeployedInstance, b as isDeploymentNode, e as isKindEqual, g as isNotOperator, i as isOnStage, j as isOrOperator, f as isParticipantOperator, d as isTagEqual, w as whereOperatorAsPredicate } from '../shared/core.yHe79zEl.mjs';
|
|
3
|
+
export { Expression, FqnExpr, RelationExpr } from './expression.mjs';
|
|
4
|
+
export { ModelExpression, ModelFqnExpr, ModelRelationExpr } from './expression-model.mjs';
|
|
5
|
+
export { FqnRef } from './fqnRef.mjs';
|
|
4
6
|
export { B as BBox, a as BorderStyles, E as ElementShapes, R as RectBox, T as ThemeColors, i as isTagColorSpecified, b as isThemeColor } from '../shared/core.CxGKeL-L.mjs';
|
|
5
|
-
export { f as DefaultArrowType, a as DefaultElementShape, e as DefaultLineStyle, c as DefaultPaddingSize, g as DefaultRelationshipColor, b as DefaultShapeSize, d as DefaultTextSize, D as DefaultThemeColor, R as RichText } from '../shared/core.
|
|
6
|
-
export { D as DeploymentFqn, E as EdgeId, F as Fqn, a as GlobalFqn, G as GroupElementKind, N as NodeId, P as ProjectId, R as RelationId, S as StepEdgeKind, V as ViewId, g as extractStep, f as flattenMarkdownOrString, b as isGlobalFqn, i as isGroupElementKind, e as isStepEdgeId, s as scalar, c as splitGlobalFqn, d as stepEdgeId } from '../shared/core.
|
|
7
|
-
|
|
8
|
-
import '
|
|
9
|
-
import '../shared/core.BgvIuGGU.mjs';
|
|
10
|
-
import '../shared/core.DbRvwARP.mjs';
|
|
7
|
+
export { f as DefaultArrowType, a as DefaultElementShape, e as DefaultLineStyle, c as DefaultPaddingSize, g as DefaultRelationshipColor, b as DefaultShapeSize, d as DefaultTextSize, D as DefaultThemeColor, R as RichText } from '../shared/core.BqVo8LrH.mjs';
|
|
8
|
+
export { D as DeploymentFqn, E as EdgeId, F as Fqn, a as GlobalFqn, G as GroupElementKind, N as NodeId, P as ProjectId, R as RelationId, S as StepEdgeKind, V as ViewId, g as extractStep, f as flattenMarkdownOrString, b as isGlobalFqn, i as isGroupElementKind, e as isStepEdgeId, s as scalar, c as splitGlobalFqn, d as stepEdgeId } from '../shared/core.Be1n9a0i.mjs';
|
|
9
|
+
export { n as getParallelStepsPrefix, l as isAutoLayoutDirection, b as isComputedView, g as isDeploymentView, c as isDiagramView, h as isDynamicView, o as isDynamicViewParallelSteps, d as isElementView, f as isExtendsElementView, c as isLayoutedView, e as isScopedElementView, m as isViewRuleAutoLayout, k as isViewRuleGlobalPredicateRef, j as isViewRuleGlobalStyle, p as isViewRuleGroup, i as isViewRulePredicate, a as isViewRuleStyle } from '../shared/core.T-eLZTW_.mjs';
|
|
10
|
+
import 'remeda';
|
|
11
11
|
import '../shared/core.D4npX2q8.mjs';
|
|
12
|
-
import '../shared/core.
|
|
12
|
+
import '../shared/core.CUw_2J9j.mjs';
|
|
13
13
|
import 'rehype-raw';
|
|
14
14
|
import 'rehype-sanitize';
|
|
15
15
|
import 'rehype-stringify';
|
package/dist/types/scalar.mjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import '
|
|
2
|
-
import '../shared/core.zLlww-07.mjs';
|
|
1
|
+
import 'remeda';
|
|
3
2
|
import '../shared/core.D4npX2q8.mjs';
|
|
4
|
-
export { D as DeploymentFqn, E as EdgeId, F as Fqn, a as GlobalFqn, G as GroupElementKind, N as NodeId, P as ProjectId, R as RelationId, S as StepEdgeKind, V as ViewId, g as extractStep, f as flattenMarkdownOrString, b as isGlobalFqn, i as isGroupElementKind, e as isStepEdgeId, c as splitGlobalFqn, d as stepEdgeId } from '../shared/core.
|
|
3
|
+
export { D as DeploymentFqn, E as EdgeId, F as Fqn, a as GlobalFqn, G as GroupElementKind, N as NodeId, P as ProjectId, R as RelationId, S as StepEdgeKind, V as ViewId, g as extractStep, f as flattenMarkdownOrString, b as isGlobalFqn, i as isGroupElementKind, e as isStepEdgeId, c as splitGlobalFqn, d as stepEdgeId } from '../shared/core.Be1n9a0i.mjs';
|
package/dist/utils/index.d.mts
CHANGED
|
@@ -1,138 +1,11 @@
|
|
|
1
1
|
export { D as DefaultMap } from '../shared/core.CywrQs86.mjs';
|
|
2
|
-
export {
|
|
2
|
+
export { B as BiMap, D as DefaultWeakMap, L as LinkedList, M as MultiMap, Q as Queue, i as invariant, a as isNonEmptyArray, b as isString, m as memoizeProp, c as nonNullable, n as nonexhaustive } from '../shared/core.PHwHXzkG.mjs';
|
|
3
|
+
export { I as IterableContainer, R as ReorderedArray, a as ancestorsFqn, e as commonAncestor, f as compareByFqnHierarchically, g as compareFqnHierarchically, h as hierarchyDistance, j as hierarchyLevel, i as isAncestor, b as isDescendantOf, c as isSameHierarchy, n as nameFromFqn, p as parentFqn, k as sortByFqnHierarchically, s as sortNaturalByFqn, d as sortParentsFirst } from '../shared/core.DM3vdkO_.mjs';
|
|
3
4
|
import { N as NonEmptyArray } from '../shared/core.DuSLYTG6.mjs';
|
|
4
|
-
|
|
5
|
-
export {
|
|
5
|
+
export { ifilter, ifind, ifirst, iflat, ihead, imap, ireduce, isome, iunique, toArray, toSet } from './iterable/index.mjs';
|
|
6
|
+
export { i as isIterable } from '../shared/core.DXhDWKFZ.mjs';
|
|
6
7
|
import '../shared/core.DX-WYEPA.mjs';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Mnemonist DefaultWeakMap Typings
|
|
10
|
-
* ================================
|
|
11
|
-
*/
|
|
12
|
-
declare class DefaultWeakMap<K extends object, V> {
|
|
13
|
-
|
|
14
|
-
// Constructor
|
|
15
|
-
constructor(factory: (key: K) => 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
|
-
inspect(): any;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Mnemonist LinkedList Typings
|
|
29
|
-
* =============================
|
|
30
|
-
*/
|
|
31
|
-
declare class LinkedList<T> implements Iterable<T> {
|
|
32
|
-
|
|
33
|
-
// Members
|
|
34
|
-
size: number;
|
|
35
|
-
|
|
36
|
-
// Constructor
|
|
37
|
-
constructor();
|
|
38
|
-
|
|
39
|
-
// Methods
|
|
40
|
-
clear(): void;
|
|
41
|
-
first(): T | undefined;
|
|
42
|
-
last(): T | undefined;
|
|
43
|
-
peek(): T | undefined;
|
|
44
|
-
push(value: T): number;
|
|
45
|
-
shift(): T | undefined;
|
|
46
|
-
unshift(value: T): number;
|
|
47
|
-
forEach(callback: (value: T, index: number, list: this) => void, scope?: any): void;
|
|
48
|
-
toArray(): Array<T>;
|
|
49
|
-
values(): IterableIterator<T>;
|
|
50
|
-
entries(): IterableIterator<[number, T]>;
|
|
51
|
-
[Symbol.iterator](): IterableIterator<T>;
|
|
52
|
-
toString(): string;
|
|
53
|
-
toJSON(): Array<T>;
|
|
54
|
-
inspect(): any;
|
|
55
|
-
|
|
56
|
-
// Statics
|
|
57
|
-
static from<I>(iterable: Iterable<I> | {[key: string]: I}): LinkedList<I>;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Mnemonist Queue Typings
|
|
62
|
-
* ========================
|
|
63
|
-
*/
|
|
64
|
-
declare class Queue<T> implements Iterable<T> {
|
|
65
|
-
|
|
66
|
-
// Members
|
|
67
|
-
size: number;
|
|
68
|
-
|
|
69
|
-
// Constructor
|
|
70
|
-
constructor();
|
|
71
|
-
|
|
72
|
-
// Methods
|
|
73
|
-
clear(): void;
|
|
74
|
-
enqueue(item: T): number;
|
|
75
|
-
dequeue(): T | undefined;
|
|
76
|
-
peek(): T | undefined;
|
|
77
|
-
forEach(callback: (item: T, index: number, queue: this) => void, scope?: any): void;
|
|
78
|
-
toArray(): Array<T>;
|
|
79
|
-
values(): IterableIterator<T>;
|
|
80
|
-
entries(): IterableIterator<[number, T]>;
|
|
81
|
-
[Symbol.iterator](): IterableIterator<T>;
|
|
82
|
-
toString(): string;
|
|
83
|
-
toJSON(): Array<T>;
|
|
84
|
-
inspect(): any;
|
|
85
|
-
|
|
86
|
-
// Statics
|
|
87
|
-
static from<I>(iterable: Iterable<I> | {[key: string]: I}): Queue<I>;
|
|
88
|
-
static of<I>(...items: Array<I>): Queue<I>;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
interface MultiMapConstructor {
|
|
92
|
-
new <K, V>(container: SetConstructor): MultiMap<K, V, Set<V>>;
|
|
93
|
-
new <K, V>(container?: ArrayConstructor): MultiMap<K, V, V[]>;
|
|
94
|
-
|
|
95
|
-
from<K, V>(
|
|
96
|
-
iterable: Iterable<[K, V]> | {[key: string]: V},
|
|
97
|
-
Container: SetConstructor
|
|
98
|
-
): MultiMap<K, V, Set<V>>;
|
|
99
|
-
from<K, V>(
|
|
100
|
-
iterable: Iterable<[K, V]> | {[key: string]: V},
|
|
101
|
-
Container?: ArrayConstructor
|
|
102
|
-
): MultiMap<K, V, V[]>;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Mnemonist MultiMap Typings
|
|
106
|
-
* ===========================
|
|
107
|
-
*/
|
|
108
|
-
|
|
109
|
-
interface MultiMap<K, V, C extends V[] | Set<V> = V[]> extends Iterable<[K, V]> {
|
|
110
|
-
|
|
111
|
-
// Members
|
|
112
|
-
dimension: number;
|
|
113
|
-
size: number;
|
|
114
|
-
|
|
115
|
-
// Methods
|
|
116
|
-
clear(): void;
|
|
117
|
-
set(key: K, value: V): this;
|
|
118
|
-
delete(key: K): boolean;
|
|
119
|
-
remove(key: K, value: V): boolean;
|
|
120
|
-
has(key: K): boolean;
|
|
121
|
-
get(key: K): C | undefined;
|
|
122
|
-
multiplicity(key: K): number;
|
|
123
|
-
forEach(callback: (value: V, key: K, map: this) => void, scope?: any): void;
|
|
124
|
-
forEachAssociation(callback: (value: C, key: K, map: this) => void, scope?: any): void;
|
|
125
|
-
keys(): IterableIterator<K>;
|
|
126
|
-
values(): IterableIterator<V>;
|
|
127
|
-
entries(): IterableIterator<[K, V]>;
|
|
128
|
-
containers(): IterableIterator<C>;
|
|
129
|
-
associations(): IterableIterator<[K, C]>;
|
|
130
|
-
[Symbol.iterator](): IterableIterator<[K, V]>;
|
|
131
|
-
inspect(): any;
|
|
132
|
-
toJSON(): any;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
declare const MultiMap: MultiMapConstructor;
|
|
8
|
+
import 'type-fest';
|
|
136
9
|
|
|
137
10
|
/**
|
|
138
11
|
* Mnemonist Stack Typings
|
|
@@ -165,63 +38,6 @@ declare class Stack<T> implements Iterable<T> {
|
|
|
165
38
|
static of<I>(...items: Array<I>): Stack<I>;
|
|
166
39
|
}
|
|
167
40
|
|
|
168
|
-
/**
|
|
169
|
-
* Mnemonist BiMap Typings
|
|
170
|
-
* ========================
|
|
171
|
-
*/
|
|
172
|
-
declare class InverseMap<K, V> implements Iterable<[K, V]> {
|
|
173
|
-
|
|
174
|
-
// Members
|
|
175
|
-
size: number;
|
|
176
|
-
inverse: BiMap<V, K>;
|
|
177
|
-
|
|
178
|
-
// Constructor
|
|
179
|
-
constructor(original: BiMap<K, V>);
|
|
180
|
-
|
|
181
|
-
// Methods
|
|
182
|
-
clear(): void;
|
|
183
|
-
set(key: K, value: V): this;
|
|
184
|
-
delete(key: K): boolean;
|
|
185
|
-
has(key: K): boolean;
|
|
186
|
-
get(key: K): V | undefined;
|
|
187
|
-
forEach(callback: (value: V, key: K, map: this) => void, scope?: any): void;
|
|
188
|
-
keys(): IterableIterator<K>;
|
|
189
|
-
values(): IterableIterator<V>;
|
|
190
|
-
entries(): IterableIterator<[K, V]>;
|
|
191
|
-
[Symbol.iterator](): IterableIterator<[K, V]>;
|
|
192
|
-
inspect(): any;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
declare class BiMap<K, V> implements Iterable<[K, V]> {
|
|
196
|
-
|
|
197
|
-
// Members
|
|
198
|
-
size: number;
|
|
199
|
-
inverse: InverseMap<V, K>;
|
|
200
|
-
|
|
201
|
-
// Constructor
|
|
202
|
-
constructor();
|
|
203
|
-
|
|
204
|
-
// Methods
|
|
205
|
-
clear(): void;
|
|
206
|
-
set(key: K, value: V): this;
|
|
207
|
-
delete(key: K): boolean;
|
|
208
|
-
has(key: K): boolean;
|
|
209
|
-
get(key: K): V | undefined;
|
|
210
|
-
forEach(callback: (value: V, key: K, map: this) => void, scope?: any): void;
|
|
211
|
-
keys(): IterableIterator<K>;
|
|
212
|
-
values(): IterableIterator<V>;
|
|
213
|
-
entries(): IterableIterator<[K, V]>;
|
|
214
|
-
[Symbol.iterator](): IterableIterator<[K, V]>;
|
|
215
|
-
inspect(): any;
|
|
216
|
-
|
|
217
|
-
// Statics
|
|
218
|
-
static from<I, J>(iterable: Iterable<[I, J]> | {[key: string]: J}): BiMap<I, J>;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
declare function nonNullable<T>(value: T, message?: string | (() => string)): NonNullable<T>;
|
|
222
|
-
declare function invariant(condition: any, message?: string): asserts condition;
|
|
223
|
-
declare function nonexhaustive(value: never): never;
|
|
224
|
-
|
|
225
41
|
/**
|
|
226
42
|
* Common head of two arrays
|
|
227
43
|
*
|
|
@@ -247,248 +63,10 @@ declare function compareNatural(a: string | undefined, b: string | undefined): -
|
|
|
247
63
|
* // 'b.c',
|
|
248
64
|
* // ]
|
|
249
65
|
*/
|
|
250
|
-
declare function compareNaturalHierarchically(separator?: string): (a: string | undefined, b: string | undefined) => number;
|
|
66
|
+
declare function compareNaturalHierarchically(separator?: string, deepestFirst?: boolean): (a: string | undefined, b: string | undefined) => number;
|
|
251
67
|
|
|
252
68
|
declare function getOrCreate<K, V>(map: Map<K, V>, key: K, create: (key: K) => V): V;
|
|
253
69
|
|
|
254
|
-
/**
|
|
255
|
-
* This should only be used for defining generics which extend any kind of JS
|
|
256
|
-
* array under the hood, this includes arrays *AND* tuples (of the form [x, y],
|
|
257
|
-
* and of the form [x, ...y[]], etc...), and their readonly equivalent. This
|
|
258
|
-
* allows us to be more inclusive to what functions can process.
|
|
259
|
-
*
|
|
260
|
-
* @example
|
|
261
|
-
* function map<T extends IterableContainer>(items: T) { ... }
|
|
262
|
-
*
|
|
263
|
-
* We would've named this `ArrayLike`, but that's already used by typescript...
|
|
264
|
-
* @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)
|
|
265
|
-
*/
|
|
266
|
-
type IterableContainer<T = unknown> = ReadonlyArray<T> | readonly [];
|
|
267
|
-
|
|
268
|
-
declare const RemedaErrorSymbol: unique symbol;
|
|
269
|
-
type RemedaTypeErrorOptions = {
|
|
270
|
-
type?: unknown;
|
|
271
|
-
metadata?: unknown;
|
|
272
|
-
};
|
|
273
|
-
/**
|
|
274
|
-
* Used for reporting type errors in a more useful way than `never`.
|
|
275
|
-
*/
|
|
276
|
-
type RemedaTypeError<Name extends string, Message extends string, Options extends RemedaTypeErrorOptions = {}> = Tagged<Options extends {
|
|
277
|
-
type: infer T;
|
|
278
|
-
} ? T : typeof RemedaErrorSymbol, `RemedaTypeError(${Name}): ${Message}.`, Options extends {
|
|
279
|
-
metadata: infer Metadata;
|
|
280
|
-
} ? Metadata : never>;
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* Takes a tuple and returns the types that make up its parts. These parts
|
|
284
|
-
* follow TypeScript's only supported format for arrays/tuples:
|
|
285
|
-
* [<required>, <optional>, ...<rest>[], <suffix>].
|
|
286
|
-
*
|
|
287
|
-
* There are some limitations to what shapes TypeScript supports:
|
|
288
|
-
* tuples can only have a suffix if they also have a non-never rest element,
|
|
289
|
-
* **and** tuples cannot have both an optional part and a suffix; this means
|
|
290
|
-
* there are only 10 possible shapes for tuples:
|
|
291
|
-
* 1. Empty Tuples: `[]`.
|
|
292
|
-
* 2. Fixed Tuples: `[string, number]`.
|
|
293
|
-
* 3. Optional Tuples: `[string?, number?]`.
|
|
294
|
-
* 4. Mixed Tuples: `[string, number?]`.
|
|
295
|
-
* 5. Arrays: `Array<string>`.
|
|
296
|
-
* 6. Fixed-Prefix Arrays: `[string, ...Array<string>]`.
|
|
297
|
-
* 7. Optional-Prefix Arrays: `[number?, ...Array<boolean>]`.
|
|
298
|
-
* 8. Mixed-Prefix Arrays: `[string, number?, ...Array<boolean>]`.
|
|
299
|
-
* 9. Fixed-Suffix Arrays: `[...Array<string>, string]`.
|
|
300
|
-
* 10. Fixed-Elements Arrays: `[string, ...Array<string>, string]`.
|
|
301
|
-
*
|
|
302
|
-
* @example [
|
|
303
|
-
* ...TupleParts<T>["required"],
|
|
304
|
-
* ...Partial<TupleParts<T>["optional"]>,
|
|
305
|
-
* ...CoercedArray<TupleParts<T>["item"]>,
|
|
306
|
-
* ...TupleParts<T>["suffix"],
|
|
307
|
-
* ].
|
|
308
|
-
*/
|
|
309
|
-
type TupleParts<T extends IterableContainer, Prefix extends Array<unknown> = []> = T extends readonly [infer Head, ...infer Tail] ? TupleParts<Tail, [...Prefix, Head]> : Simplify<{
|
|
310
|
-
/**
|
|
311
|
-
* A fixed tuple that defines the part of the tuple where all its
|
|
312
|
-
* elements are required. This will always be the first part of the
|
|
313
|
-
* tuple and will never contain any optional or rest elements. When the
|
|
314
|
-
* array doesn't have a required part this will be an empty tuple
|
|
315
|
-
* (`[]`).
|
|
316
|
-
*/
|
|
317
|
-
required: Prefix;
|
|
318
|
-
} & TuplePartsWithoutRequired<T>>;
|
|
319
|
-
type TuplePartsWithoutRequired<T extends IterableContainer, Suffix extends Array<unknown> = []> = T extends readonly [...infer Head, infer Tail] ? TuplePartsWithoutRequired<Head, [Tail, ...Suffix]> : (Suffix extends readonly [] ? TuplePartsWithoutFixed<T> : // When the suffix is not empty we can skip the optional part and go
|
|
320
|
-
{
|
|
321
|
-
optional: [];
|
|
322
|
-
} & TuplePartsRest<T>) & {
|
|
323
|
-
/**
|
|
324
|
-
* A *fixed* tuple that defines the part of a tuple **after** a non-never
|
|
325
|
-
* rest parameter. These could never be optional elements, and could
|
|
326
|
-
* never contain another rest element. When the array doesn't have a
|
|
327
|
-
* required part this will be an empty tuple (`[]`).
|
|
328
|
-
*/
|
|
329
|
-
suffix: Suffix;
|
|
330
|
-
};
|
|
331
|
-
type TuplePartsWithoutFixed<T extends IterableContainer, Optional extends Array<unknown> = []> = T extends readonly [(infer Head)?, ...infer Tail] ? Or<T extends readonly [] ? true : false, Array<T[number]> extends Tail ? true : false> extends true ? {
|
|
332
|
-
/**
|
|
333
|
-
* A *fixed* tuple that defines the part of a tuple where all its
|
|
334
|
-
* elements are suffixed with the optional operator (`?`); but with
|
|
335
|
-
* the optional operator removed (e.g. `[string?]` would be
|
|
336
|
-
* represented as `[string]`). These elements can only follow the
|
|
337
|
-
* `required` part (which could be empty).
|
|
338
|
-
* To add optional operator back wrap the result with the built-in
|
|
339
|
-
* `Partial` type.
|
|
340
|
-
* When the array doesn't have a required part this will be an empty
|
|
341
|
-
* tuple (`[]`).
|
|
342
|
-
*
|
|
343
|
-
* @example Partial<TupleParts<T>["optional"]>
|
|
344
|
-
*/
|
|
345
|
-
optional: Optional;
|
|
346
|
-
} & TuplePartsRest<T> : TuplePartsWithoutFixed<Tail, [...Optional, Head | undefined]> : RemedaTypeError<"TupleParts", "Unexpected tuple shape", {
|
|
347
|
-
type: never;
|
|
348
|
-
metadata: T;
|
|
349
|
-
}>;
|
|
350
|
-
type TuplePartsRest<T extends IterableContainer> = {
|
|
351
|
-
/**
|
|
352
|
-
* The type for the rest parameter of the tuple, if any. Unlike the
|
|
353
|
-
* other parts of the tuple, this is a single type and not
|
|
354
|
-
* represented as an array/tuple. When a tuple doesn't have a rest
|
|
355
|
-
* element, this will be `never`. To convert this to a matching array
|
|
356
|
-
* type that could be spread into a new type use the `CoercedArray`
|
|
357
|
-
* type which handles the `never` case correctly.
|
|
358
|
-
*
|
|
359
|
-
* @example CoercedArray<TupleParts<T>["item"]>
|
|
360
|
-
*/
|
|
361
|
-
item: T extends readonly [] ? never : T[number];
|
|
362
|
-
};
|
|
363
|
-
|
|
364
|
-
/**
|
|
365
|
-
* We built our own version of Subtract instead of using type-fest's one
|
|
366
|
-
* because we needed a simpler implementation that isn't as prone to excessive
|
|
367
|
-
* recursion issues and that is clamped at 0 so that we don't need to handle
|
|
368
|
-
* negative values using even more utilities.
|
|
369
|
-
*/
|
|
370
|
-
type ClampedIntegerSubtract<Minuend, Subtrahend, SubtrahendBag extends Array<unknown> = [], ResultBag extends Array<unknown> = []> = [...SubtrahendBag, ...ResultBag]["length"] extends Minuend ? ResultBag["length"] : SubtrahendBag["length"] extends Subtrahend ? ClampedIntegerSubtract<Minuend, Subtrahend, SubtrahendBag, [
|
|
371
|
-
...ResultBag,
|
|
372
|
-
unknown
|
|
373
|
-
]> : ClampedIntegerSubtract<Minuend, Subtrahend, [
|
|
374
|
-
...SubtrahendBag,
|
|
375
|
-
unknown
|
|
376
|
-
], ResultBag>;
|
|
377
|
-
|
|
378
|
-
/**
|
|
379
|
-
* `never[]` and `[]` are not the same type, and in some cases they aren't
|
|
380
|
-
* interchangeable.
|
|
381
|
-
*
|
|
382
|
-
* This type makes it easier to use the result of TupleParts when the input is a
|
|
383
|
-
* fixed-length tuple but we still want to spread the rest of the array. e.g.
|
|
384
|
-
* `[...CoercedArray<TupleParts<T>["item"]>, ...TupleParts<T>["suffix"]]`.
|
|
385
|
-
*
|
|
386
|
-
*/
|
|
387
|
-
type CoercedArray<T> = IfNever<T, [], Array<T>>;
|
|
388
|
-
|
|
389
|
-
type ArrayRequiredPrefix<T extends IterableContainer, N extends number> = IsLiteral<N> extends true ? T extends unknown ? ClampedIntegerSubtract<N, [
|
|
390
|
-
...TupleParts<T>["required"],
|
|
391
|
-
...TupleParts<T>["suffix"]
|
|
392
|
-
]["length"]> extends infer Remainder extends number ? Remainder extends 0 ? T : And<GreaterThan<Remainder, TupleParts<T>["optional"]["length"]>, IsNever<TupleParts<T>["item"]>> extends true ? RemedaTypeError<"ArrayRequiredPrefix", "The input tuple cannot satisfy the minimum", {
|
|
393
|
-
type: never;
|
|
394
|
-
metadata: [T, N];
|
|
395
|
-
}> : WithSameReadonly<T, [
|
|
396
|
-
...TupleParts<T>["required"],
|
|
397
|
-
...OptionalTupleRequiredPrefix<TupleParts<T>["optional"], Remainder>,
|
|
398
|
-
...ReadonlyTuple<TupleParts<T>["item"], ClampedIntegerSubtract<Remainder, TupleParts<T>["optional"]["length"]>>,
|
|
399
|
-
...CoercedArray<TupleParts<T>["item"]>,
|
|
400
|
-
...TupleParts<T>["suffix"]
|
|
401
|
-
]> : RemedaTypeError<"ArrayRequiredPrefix", "Remainder didn't compute to a number?!", {
|
|
402
|
-
type: never;
|
|
403
|
-
metadata: [T, N];
|
|
404
|
-
}> : RemedaTypeError<"ArrayRequiredPrefix", "Failed to distribute union?!", {
|
|
405
|
-
type: never;
|
|
406
|
-
metadata: T;
|
|
407
|
-
}> : RemedaTypeError<"ArrayRequiredPrefix", "Only literal minimums are supported!", {
|
|
408
|
-
type: never;
|
|
409
|
-
metadata: N;
|
|
410
|
-
}>;
|
|
411
|
-
type WithSameReadonly<Source, Destination> = IsEqual<Source, Readonly<Source>> extends true ? Readonly<Destination> : Destination;
|
|
412
|
-
type OptionalTupleRequiredPrefix<T extends Array<unknown>, N, Prefix extends Array<unknown> = []> = Prefix["length"] extends N ? [
|
|
413
|
-
...Prefix,
|
|
414
|
-
...Partial<T>
|
|
415
|
-
] : T extends readonly [infer Head, ...infer Rest] ? OptionalTupleRequiredPrefix<Rest, N, [...Prefix, Head]> : Prefix;
|
|
416
|
-
|
|
417
|
-
/**
|
|
418
|
-
* Checks if the given array has at least the defined number of elements. When
|
|
419
|
-
* the minimum used is a literal (e.g. `3`) the output is refined accordingly so
|
|
420
|
-
* that those indices are defined when accessing the array even when using
|
|
421
|
-
* typescript's 'noUncheckedIndexAccess'.
|
|
422
|
-
*
|
|
423
|
-
* @param data - The input array.
|
|
424
|
-
* @param minimum - The minimum number of elements the array must have.
|
|
425
|
-
* @returns True if the array's length is *at least* `minimum`. When `minimum`
|
|
426
|
-
* is a literal value, the output is narrowed to ensure the first items are
|
|
427
|
-
* guaranteed.
|
|
428
|
-
* @signature
|
|
429
|
-
* R.hasAtLeast(data, minimum)
|
|
430
|
-
* @example
|
|
431
|
-
* R.hasAtLeast([], 4); // => false
|
|
432
|
-
*
|
|
433
|
-
* const data: number[] = [1,2,3,4];
|
|
434
|
-
* R.hasAtLeast(data, 1); // => true
|
|
435
|
-
* data[0]; // 1, with type `number`
|
|
436
|
-
* @dataFirst
|
|
437
|
-
* @category Array
|
|
438
|
-
*/
|
|
439
|
-
declare function hasAtLeast<T extends IterableContainer, N extends number>(data: IterableContainer | T, minimum: IsNumericLiteral<N> extends true ? N : never): data is ArrayRequiredPrefix<T, N>;
|
|
440
|
-
declare function hasAtLeast(data: IterableContainer, minimum: number): boolean;
|
|
441
|
-
/**
|
|
442
|
-
* Checks if the given array has at least the defined number of elements. When
|
|
443
|
-
* the minimum used is a literal (e.g. `3`) the output is refined accordingly so
|
|
444
|
-
* that those indices are defined when accessing the array even when using
|
|
445
|
-
* typescript's 'noUncheckedIndexAccess'.
|
|
446
|
-
*
|
|
447
|
-
* @param minimum - The minimum number of elements the array must have.
|
|
448
|
-
* @returns True if the array's length is *at least* `minimum`. When `minimum`
|
|
449
|
-
* is a literal value, the output is narrowed to ensure the first items are
|
|
450
|
-
* guaranteed.
|
|
451
|
-
* @signature
|
|
452
|
-
* R.hasAtLeast(minimum)(data)
|
|
453
|
-
* @example
|
|
454
|
-
* R.pipe([], R.hasAtLeast(4)); // => false
|
|
455
|
-
*
|
|
456
|
-
* const data = [[1,2], [3], [4,5]];
|
|
457
|
-
* R.pipe(
|
|
458
|
-
* data,
|
|
459
|
-
* R.filter(R.hasAtLeast(2)),
|
|
460
|
-
* R.map(([, second]) => second),
|
|
461
|
-
* ); // => [2,5], with type `number[]`
|
|
462
|
-
* @dataLast
|
|
463
|
-
* @category Array
|
|
464
|
-
*/
|
|
465
|
-
declare function hasAtLeast<N extends number>(minimum: IsNumericLiteral<N> extends true ? N : never): <T extends IterableContainer>(data: IterableContainer | T) => data is ArrayRequiredPrefix<T, N>;
|
|
466
|
-
declare function hasAtLeast(minimum: number): (data: IterableContainer) => boolean;
|
|
467
|
-
|
|
468
|
-
declare function isString(value: unknown): value is string;
|
|
469
|
-
declare function isNonEmptyArray<A>(arr: ArrayLike<A> | undefined): arr is NonEmptyArray<A>;
|
|
470
|
-
|
|
471
|
-
/**
|
|
472
|
-
* Saves the value returned by fn() in a hidden property tag of obj object, so next time memoizeProp() is called,
|
|
473
|
-
* that value will be returned, and fn won't be called.
|
|
474
|
-
*
|
|
475
|
-
* @example
|
|
476
|
-
* ```ts
|
|
477
|
-
* class Model {
|
|
478
|
-
* // using same Symbol
|
|
479
|
-
* get computed1() {
|
|
480
|
-
* return memoizeProp(this, Symbol.for('computed1'), () => doOnce())
|
|
481
|
-
* }
|
|
482
|
-
* // using string
|
|
483
|
-
* get computed2() {
|
|
484
|
-
* return memoizeProp(this, 'computed2', () => doOnce())
|
|
485
|
-
* }
|
|
486
|
-
*
|
|
487
|
-
* }
|
|
488
|
-
* ```
|
|
489
|
-
*/
|
|
490
|
-
declare function memoizeProp<Tag extends symbol | string, Res>(obj: object, tag: Tag, fn: () => Res): Res;
|
|
491
|
-
|
|
492
70
|
declare function delay(): Promise<string>;
|
|
493
71
|
declare function delay(ms: number): Promise<string>;
|
|
494
72
|
declare function delay(randomFrom: number, randomTo: number): Promise<string>;
|
|
@@ -538,4 +116,4 @@ declare function markdownToHtml(markdown: string): string;
|
|
|
538
116
|
*/
|
|
539
117
|
declare function markdownToText(markdown: string): string;
|
|
540
118
|
|
|
541
|
-
export {
|
|
119
|
+
export { Stack, commonHead, compareNatural, compareNaturalHierarchically, compareRelations, delay, difference, equals as equalsSet, getOrCreate, intersection, markdownToHtml, markdownToText, objectHash, promiseNextTick, stringHash, symmetricDifference, union };
|
package/dist/utils/index.mjs
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
export { i as invariant, a as nonNullable, n as nonexhaustive } from '../shared/core.D4npX2q8.mjs';
|
|
2
|
-
export { S as Stack, c as commonHead, o as objectHash } from '../shared/core.
|
|
3
|
-
|
|
2
|
+
export { S as Stack, c as commonHead, o as objectHash } from '../shared/core.BB6zA-UU.mjs';
|
|
3
|
+
import { g as commonAncestor, h as compareFqnHierarchically } from '../shared/core.DgttqsJc.mjs';
|
|
4
|
+
export { a as ancestorsFqn, l as compareByFqnHierarchically, j as compareNatural, k as compareNaturalHierarchically, m as hierarchyDistance, o as hierarchyLevel, i as isAncestor, b as isDescendantOf, c as isNonEmptyArray, d as isSameHierarchy, e as isString, n as nameFromFqn, p as parentFqn, q as sortByFqnHierarchically, s as sortNaturalByFqn, f as sortParentsFirst } from '../shared/core.DgttqsJc.mjs';
|
|
4
5
|
export { g as getOrCreate } from '../shared/core.DcS-0zys.mjs';
|
|
5
|
-
export {
|
|
6
|
-
|
|
7
|
-
export { d as difference, e as equalsSet, i as
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export { i as
|
|
11
|
-
export {
|
|
12
|
-
export { i as
|
|
13
|
-
export { i as
|
|
14
|
-
export { i as
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
import '../shared/core.
|
|
6
|
+
export { b as markdownToHtml, a as markdownToText, m as memoizeProp } from '../shared/core.CUw_2J9j.mjs';
|
|
7
|
+
import { randomInteger } from 'remeda';
|
|
8
|
+
export { d as difference, e as equalsSet, i as intersection, a as stringHash, s as symmetricDifference, u as union } from '../shared/core.4u1dVmfX.mjs';
|
|
9
|
+
export { b as BiMap, d as DefaultWeakMap, l as LinkedList, m as MultiMap, q as Queue } from '../shared/core.DlG1xWt2.mjs';
|
|
10
|
+
export { D as DefaultMap } from '../shared/core.BuoXfSMj.mjs';
|
|
11
|
+
export { i as ifilter } from '../shared/core.CCD1ID81.mjs';
|
|
12
|
+
export { i as ifind, a as ihead } from '../shared/core.GTgsmXS_.mjs';
|
|
13
|
+
export { i as ifirst, a as ireduce } from '../shared/core.ILwny7BV.mjs';
|
|
14
|
+
export { i as iflat, a as iunique } from '../shared/core.CNGyqkJh.mjs';
|
|
15
|
+
export { i as imap, t as toArray, a as toSet } from '../shared/core.DLpidoWc.mjs';
|
|
16
|
+
export { i as isIterable } from '../shared/core.DoM6aM9N.mjs';
|
|
17
|
+
export { i as isome } from '../shared/core.Be4Jy9Qx.mjs';
|
|
18
|
+
import '../shared/core.CaT0SUUK.mjs';
|
|
18
19
|
import 'rehype-raw';
|
|
19
20
|
import 'rehype-sanitize';
|
|
20
21
|
import 'rehype-stringify';
|
|
@@ -24,3 +25,43 @@ import 'remark-rehype';
|
|
|
24
25
|
import 'unified';
|
|
25
26
|
import 'mdast-util-from-markdown';
|
|
26
27
|
import 'mdast-util-to-string';
|
|
28
|
+
|
|
29
|
+
const DELAY = "LIKEC4_DELAY";
|
|
30
|
+
function delay(...args) {
|
|
31
|
+
let ms = 100;
|
|
32
|
+
if (args.length === 2) {
|
|
33
|
+
ms = randomInteger(args[0], args[1]);
|
|
34
|
+
} else if (args.length === 1) {
|
|
35
|
+
ms = args[0];
|
|
36
|
+
}
|
|
37
|
+
return new Promise((resolve) => {
|
|
38
|
+
setTimeout(() => {
|
|
39
|
+
resolve(DELAY);
|
|
40
|
+
}, ms ?? 100);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function promiseNextTick() {
|
|
44
|
+
return Promise.resolve().then(() => void 0);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const compareRelations = (a, b) => {
|
|
48
|
+
const parentA = commonAncestor(a.source.model, a.target.model);
|
|
49
|
+
const parentB = commonAncestor(b.source.model, b.target.model);
|
|
50
|
+
if (parentA && !parentB) {
|
|
51
|
+
return 1;
|
|
52
|
+
}
|
|
53
|
+
if (!parentA && parentB) {
|
|
54
|
+
return -1;
|
|
55
|
+
}
|
|
56
|
+
const compareParents = parentA && parentB ? compareFqnHierarchically(parentA, parentB) : 0;
|
|
57
|
+
if (compareParents !== 0) {
|
|
58
|
+
return compareParents;
|
|
59
|
+
}
|
|
60
|
+
const compareSource = compareFqnHierarchically(a.source.model, b.source.model);
|
|
61
|
+
if (compareSource !== 0) {
|
|
62
|
+
return compareSource;
|
|
63
|
+
}
|
|
64
|
+
return compareFqnHierarchically(a.target.model, b.target.model);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export { commonAncestor, compareFqnHierarchically, compareRelations, delay, promiseNextTick };
|