@likec4/core 1.19.0 → 1.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builder/index.js +1 -1
- package/dist/compute-view/index.js +2 -2
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/model/index.js +1 -1
- package/dist/shared/{index.-BdzdI2C.js → index.DafVOuVd.js} +1 -1
- package/dist/utils/index.d.mts +16 -1
- package/dist/utils/index.d.ts +16 -1
- package/dist/utils/index.js +18 -1
- package/package.json +8 -8
- package/src/compute-view/memory/ops.ts +1 -1
- package/src/utils/index.ts +1 -0
- package/src/utils/iterable/find.ts +36 -0
- package/src/utils/iterable/index.ts +1 -0
package/dist/builder/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l, L as LikeC4Model, i, d } from '../shared/index
|
|
1
|
+
import { l, L as LikeC4Model, i, d } from '../shared/index.DafVOuVd.js';
|
|
2
2
|
import { t, m, p as parentFqn, a as isSameHierarchy, n as nameFromFqn, i as i$1, l as l$1, b as t$1 } from '../shared/object_hash.CE_oF3I3.js';
|
|
3
3
|
import { b as isElementPredicateExpr, o, c as isScopedElementView, D as DeploymentElement, n as n$1, d as DefaultThemeColor, e as DefaultElementShape } from '../shared/view.CyZrG8BJ.js';
|
|
4
4
|
import { u, i as invariant } from '../shared/chunk-RAAYCPUM.M-JWF7SS.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { G as Graph, r, w as willCreateCycle, t as topologicalSortExports, l, i as i$1 } from '../shared/index
|
|
2
|
-
export { c as computeView, a as computeViews, u as unsafeComputeView } from '../shared/index
|
|
1
|
+
import { G as Graph, r, w as willCreateCycle, t as topologicalSortExports, l, i as i$1 } from '../shared/index.DafVOuVd.js';
|
|
2
|
+
export { c as computeView, a as computeViews, u as unsafeComputeView } from '../shared/index.DafVOuVd.js';
|
|
3
3
|
import { i as isExtendsElementView, a as isElementView } from '../shared/view.CyZrG8BJ.js';
|
|
4
4
|
import { i, m } from '../shared/object_hash.CE_oF3I3.js';
|
|
5
5
|
import { u } from '../shared/chunk-RAAYCPUM.M-JWF7SS.js';
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { L as LikeC4Theme, H as HexColorLiteral, T as ThemeColorValues } from './shared/core.D74xkKkG.mjs';
|
|
2
2
|
export { A as AsFqn, h as BorderStyle, B as BorderStyles, s as Color, t as ColorLiteral, C as CustomColor, D as DefaultElementShape, e as DefaultThemeColor, i as Element, f as ElementKind, j as ElementKindSpecification, k as ElementKindSpecificationStyle, l as ElementShape, g as ElementShapes, m as ElementStyle, v as ElementThemeColorValues, u as ElementThemeColors, E as ExclusiveUnion, F as Fqn, I as IconUrl, a as IteratorLike, K as KeysOf, n as Link, c as NTuple, N as NonEmptyArray, b as NonEmptyReadonlyArray, P as Point, d as Predicate, w as RelationshipThemeColorValues, R as RelationshipThemeColors, o as Tag, p as TagSpec, x as ThemeColor, q as TypedElement, X as XYPoint, r as isThemeColor } from './shared/core.D74xkKkG.mjs';
|
|
3
3
|
export { ar as AbstractRelation, ag as AndOperator, a5 as AnyParsedLikeC4Model, aS as AutoLayoutDirection, aV as BBox, aT as BasicElementView, aU as BasicView, aW as ComputedDeploymentView, aX as ComputedDynamicView, aY as ComputedEdge, aZ as ComputedElementView, a as ComputedLikeC4Model, ay as ComputedNode, C as ComputedView, a_ as CustomColorDefinitions, A as CustomElementExpr, B as CustomRelationExpr, ao as DefaultArrowType, ap as DefaultLineStyle, aq 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, a$ as DeploymentView, b0 as DeploymentViewRule, b1 as DeploymentViewRulePredicate, b2 as DeploymentViewRuleStyle, b3 as DiagramEdge, az as DiagramNode, b4 as DiagramView, E as DirectRelationExpr, b5 as DynamicView, b6 as DynamicViewIncludeRule, b7 as DynamicViewParallelSteps, b8 as DynamicViewRule, b9 as DynamicViewStep, ba as DynamicViewStepOrParallel, bb as EdgeId, F as ElementExpression, G as ElementKindExpr, bv as ElementNotation, H as ElementPredicateExpression, I as ElementRefExpr, J as ElementTagExpr, bc as ElementView, K as ElementWhereExpr, ah as EqualOperator, M as ExpandedElementExpr, e as Expr, N as Expression, X as ExpressionV2, bd as ExtendsElementView, ai as Filterable, Y as FqnExpr, Z as FqnRef, a6 as GenericLikeC4Model, $ as GlobalDynamicPredicates, a0 as GlobalPredicateId, a1 as GlobalPredicates, a2 as GlobalStyleID, a3 as GlobalStyles, Q as InOutExpr, O as IncomingExpr, aj as KindEqual, a7 as LayoutedLikeC4Model, a8 as LikeC4ModelDump, L as LikeC4View, a4 as ModelGlobals, as as ModelRelation, be as NodeId, R as NonWilcard, ak as NotOperator, al as OrOperator, S as OutgoingExpr, a9 as ParsedLikeC4Model, P as PredicateSelector, _ as RelationExpr, T as RelationExpression, at as RelationId, U as RelationPredicateExpression, V as RelationWhereExpr, au as RelationshipArrowType, av as RelationshipKind, aw as RelationshipKindSpecification, ax as RelationshipLineType, bf as ScopedElementView, bg as StepEdgeId, bh as StepEdgeIdLiteral, am as TagEqual, bi as ViewAutoLayout, bj as ViewId, bk as ViewManualLayout, bl as ViewRule, bm as ViewRuleAutoLayout, bn as ViewRuleGlobalPredicateRef, bo as ViewRuleGlobalStyle, bp as ViewRuleGroup, bq as ViewRulePredicate, br as ViewRuleStyle, bs as ViewRuleStyleOrGlobalRef, bt as ViewWithHash, bu as ViewWithNotation, an as WhereOperator, W as WildcardExpr, aA as extractStep, aB as getBBoxCenter, aC as getParallelStepsPrefix, aa as isAndOperator, aD as isAutoLayoutDirection, j as isCustomElement, k as isCustomRelationExpr, aE as isDeploymentView, aF as isDynamicView, aG as isDynamicViewParallelSteps, l as isElement, m as isElementKindExpr, n as isElementPredicateExpr, o as isElementRef, p as isElementTagExpr, aH as isElementView, q as isElementWhere, r as isExpandedElementExpr, aI as isExtendsElementView, t as isInOut, s as isIncoming, ab as isKindEqual, ac as isNotOperator, ad as isOrOperator, u as isOutgoing, v as isRelation, w as isRelationExpression, x as isRelationPredicateExpr, y as isRelationWhere, aJ as isScopedElementView, aK as isStepEdgeId, ae as isTagEqual, aL as isViewRuleAutoLayout, aM as isViewRuleGlobalPredicateRef, aN as isViewRuleGlobalStyle, aO as isViewRuleGroup, aP as isViewRulePredicate, aQ as isViewRuleStyle, z as isWildcard, aR as stepEdgeId, af as whereOperatorAsPredicate } from './shared/core.CmYMqgha.mjs';
|
|
4
|
-
export { DefaultMap, LinkedList, commonHead, compareNatural, compareRelations, delay, difference, equalsSet, getOrCreate, hasAtLeast, ifilter, iflat, imap, intersection, ireduce, isIterable, isNonEmptyArray, isString, isome, iunique, objectHash, stringHash, symmetricDifference, toArray, toSet, union } from './utils/index.mjs';
|
|
4
|
+
export { DefaultMap, LinkedList, commonHead, compareNatural, compareRelations, delay, difference, equalsSet, getOrCreate, hasAtLeast, ifilter, ifind, iflat, imap, intersection, ireduce, isIterable, isNonEmptyArray, isString, isome, iunique, objectHash, stringHash, symmetricDifference, toArray, toSet, union } from './utils/index.mjs';
|
|
5
5
|
export { A as AnyAux, b as Aux, L as LikeC4DeploymentModel, d as LikeC4Model, e as LikeC4ViewModel } from './shared/core.BZ9Msq7w.mjs';
|
|
6
6
|
export { OverviewGraph, ViewChange } from './types/index.mjs';
|
|
7
7
|
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.sLaWHBjR.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { L as LikeC4Theme, H as HexColorLiteral, T as ThemeColorValues } from './shared/core.D74xkKkG.js';
|
|
2
2
|
export { A as AsFqn, h as BorderStyle, B as BorderStyles, s as Color, t as ColorLiteral, C as CustomColor, D as DefaultElementShape, e as DefaultThemeColor, i as Element, f as ElementKind, j as ElementKindSpecification, k as ElementKindSpecificationStyle, l as ElementShape, g as ElementShapes, m as ElementStyle, v as ElementThemeColorValues, u as ElementThemeColors, E as ExclusiveUnion, F as Fqn, I as IconUrl, a as IteratorLike, K as KeysOf, n as Link, c as NTuple, N as NonEmptyArray, b as NonEmptyReadonlyArray, P as Point, d as Predicate, w as RelationshipThemeColorValues, R as RelationshipThemeColors, o as Tag, p as TagSpec, x as ThemeColor, q as TypedElement, X as XYPoint, r as isThemeColor } from './shared/core.D74xkKkG.js';
|
|
3
3
|
export { ar as AbstractRelation, ag as AndOperator, a5 as AnyParsedLikeC4Model, aS as AutoLayoutDirection, aV as BBox, aT as BasicElementView, aU as BasicView, aW as ComputedDeploymentView, aX as ComputedDynamicView, aY as ComputedEdge, aZ as ComputedElementView, a as ComputedLikeC4Model, ay as ComputedNode, C as ComputedView, a_ as CustomColorDefinitions, A as CustomElementExpr, B as CustomRelationExpr, ao as DefaultArrowType, ap as DefaultLineStyle, aq 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, a$ as DeploymentView, b0 as DeploymentViewRule, b1 as DeploymentViewRulePredicate, b2 as DeploymentViewRuleStyle, b3 as DiagramEdge, az as DiagramNode, b4 as DiagramView, E as DirectRelationExpr, b5 as DynamicView, b6 as DynamicViewIncludeRule, b7 as DynamicViewParallelSteps, b8 as DynamicViewRule, b9 as DynamicViewStep, ba as DynamicViewStepOrParallel, bb as EdgeId, F as ElementExpression, G as ElementKindExpr, bv as ElementNotation, H as ElementPredicateExpression, I as ElementRefExpr, J as ElementTagExpr, bc as ElementView, K as ElementWhereExpr, ah as EqualOperator, M as ExpandedElementExpr, e as Expr, N as Expression, X as ExpressionV2, bd as ExtendsElementView, ai as Filterable, Y as FqnExpr, Z as FqnRef, a6 as GenericLikeC4Model, $ as GlobalDynamicPredicates, a0 as GlobalPredicateId, a1 as GlobalPredicates, a2 as GlobalStyleID, a3 as GlobalStyles, Q as InOutExpr, O as IncomingExpr, aj as KindEqual, a7 as LayoutedLikeC4Model, a8 as LikeC4ModelDump, L as LikeC4View, a4 as ModelGlobals, as as ModelRelation, be as NodeId, R as NonWilcard, ak as NotOperator, al as OrOperator, S as OutgoingExpr, a9 as ParsedLikeC4Model, P as PredicateSelector, _ as RelationExpr, T as RelationExpression, at as RelationId, U as RelationPredicateExpression, V as RelationWhereExpr, au as RelationshipArrowType, av as RelationshipKind, aw as RelationshipKindSpecification, ax as RelationshipLineType, bf as ScopedElementView, bg as StepEdgeId, bh as StepEdgeIdLiteral, am as TagEqual, bi as ViewAutoLayout, bj as ViewId, bk as ViewManualLayout, bl as ViewRule, bm as ViewRuleAutoLayout, bn as ViewRuleGlobalPredicateRef, bo as ViewRuleGlobalStyle, bp as ViewRuleGroup, bq as ViewRulePredicate, br as ViewRuleStyle, bs as ViewRuleStyleOrGlobalRef, bt as ViewWithHash, bu as ViewWithNotation, an as WhereOperator, W as WildcardExpr, aA as extractStep, aB as getBBoxCenter, aC as getParallelStepsPrefix, aa as isAndOperator, aD as isAutoLayoutDirection, j as isCustomElement, k as isCustomRelationExpr, aE as isDeploymentView, aF as isDynamicView, aG as isDynamicViewParallelSteps, l as isElement, m as isElementKindExpr, n as isElementPredicateExpr, o as isElementRef, p as isElementTagExpr, aH as isElementView, q as isElementWhere, r as isExpandedElementExpr, aI as isExtendsElementView, t as isInOut, s as isIncoming, ab as isKindEqual, ac as isNotOperator, ad as isOrOperator, u as isOutgoing, v as isRelation, w as isRelationExpression, x as isRelationPredicateExpr, y as isRelationWhere, aJ as isScopedElementView, aK as isStepEdgeId, ae as isTagEqual, aL as isViewRuleAutoLayout, aM as isViewRuleGlobalPredicateRef, aN as isViewRuleGlobalStyle, aO as isViewRuleGroup, aP as isViewRulePredicate, aQ as isViewRuleStyle, z as isWildcard, aR as stepEdgeId, af as whereOperatorAsPredicate } from './shared/core.C05RDLhi.js';
|
|
4
|
-
export { DefaultMap, LinkedList, commonHead, compareNatural, compareRelations, delay, difference, equalsSet, getOrCreate, hasAtLeast, ifilter, iflat, imap, intersection, ireduce, isIterable, isNonEmptyArray, isString, isome, iunique, objectHash, stringHash, symmetricDifference, toArray, toSet, union } from './utils/index.js';
|
|
4
|
+
export { DefaultMap, LinkedList, commonHead, compareNatural, compareRelations, delay, difference, equalsSet, getOrCreate, hasAtLeast, ifilter, ifind, iflat, imap, intersection, ireduce, isIterable, isNonEmptyArray, isString, isome, iunique, objectHash, stringHash, symmetricDifference, toArray, toSet, union } from './utils/index.js';
|
|
5
5
|
export { A as AnyAux, b as Aux, L as LikeC4DeploymentModel, d as LikeC4Model, e as LikeC4ViewModel } from './shared/core.BIfgabEw.js';
|
|
6
6
|
export { OverviewGraph, ViewChange } from './types/index.js';
|
|
7
7
|
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.D6-fWbM3.js';
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { i as invariant, a as nonNullable, n as nonexhaustive } from './shared/chunk-RAAYCPUM.M-JWF7SS.js';
|
|
2
2
|
export { A as AsFqn, B as BorderStyles, Q as ComputedNode, S as ComputedView, N as DefaultArrowType, e as DefaultElementShape, O as DefaultLineStyle, P as DefaultRelationshipColor, d as DefaultThemeColor, D as DeploymentElement, T as DiagramNode, E as ElementKind, g as ElementShapes, f as Expr, C as ExpressionV2, F as FqnExpr, G as FqnRef, R as RelationExpr, U as extractStep, V as getBBoxCenter, W as getParallelStepsPrefix, H as isAndOperator, X as isAutoLayoutDirection, h as isCustomElement, j as isCustomRelationExpr, Y as isDeploymentView, Z as isDynamicView, _ as isDynamicViewParallelSteps, k as isElement, l as isElementKindExpr, b as isElementPredicateExpr, m as isElementRef, p as isElementTagExpr, a as isElementView, q as isElementWhere, r as isExpandedElementExpr, i as isExtendsElementView, t as isInOut, s as isIncoming, I as isKindEqual, J as isNotOperator, K as isOrOperator, u as isOutgoing, v as isRelation, w as isRelationExpression, x as isRelationPredicateExpr, y as isRelationWhere, c as isScopedElementView, $ as isStepEdgeId, L as isTagEqual, a0 as isViewRuleAutoLayout, a1 as isViewRuleGlobalPredicateRef, a2 as isViewRuleGlobalStyle, a3 as isViewRuleGroup, a4 as isViewRulePredicate, a5 as isViewRuleStyle, z as isWildcard, a6 as stepEdgeId, M as whereOperatorAsPredicate } from './shared/view.CyZrG8BJ.js';
|
|
3
|
-
export { b as LikeC4DeploymentModel, L as LikeC4Model, e as LikeC4ViewModel } from './shared/index
|
|
3
|
+
export { b as LikeC4DeploymentModel, L as LikeC4Model, e as LikeC4ViewModel } from './shared/index.DafVOuVd.js';
|
|
4
4
|
export { isThemeColor } from './types/index.js';
|
|
5
5
|
export { D as DefaultMap, e as ancestorsFqn, f as commonAncestor, c as commonHead, g as compareByFqnHierarchically, h as compareFqnHierarchically, d as compareNatural, H as difference, I as equalsSet, v as getOrCreate, i as hasAtLeast, j as hierarchyDistance, k as hierarchyLevel, y as ifilter, z as iflat, A as imap, J as intersection, o as isAncestor, q as isDescendantOf, B as isIterable, w as isNonEmptyArray, a as isSameHierarchy, x as isString, C as isome, E as iunique, n as nameFromFqn, N as objectHash, p as parentFqn, s as sortByFqnHierarchically, r as sortNaturalByFqn, u as sortParentsFirst, M as stringHash, K as symmetricDifference, F as toArray, G as toSet, L as union } from './shared/object_hash.CE_oF3I3.js';
|
|
6
|
-
export { LinkedList, compareRelations, delay, ireduce } from './utils/index.js';
|
|
6
|
+
export { LinkedList, compareRelations, delay, ifind, ireduce } from './utils/index.js';
|
|
7
7
|
|
|
8
8
|
const { min: min$4, max: max$4 } = Math;
|
|
9
9
|
|
package/dist/model/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { C as Connection, f as ConnectionModel, F as DeployedInstanceModel, D as DeploymentConnectionModel, H as DeploymentNodeModel, I as DeploymentRelationModel, J as EdgeModel, E as ElementModel, b as LikeC4DeploymentModel, L as LikeC4Model, e as LikeC4ViewModel, N as NodeModel, R as RelationshipModel, g as deploymentConnection, h as differenceConnections, j as findAscendingConnections, k as findDeepestNestedConnection, m as findDescendantConnections, n as hasSameSource, o as hasSameSourceTarget, p as hasSameTarget, q as isAnyInOut, K as isDeployedInstance, M as isDeploymentNode, s as isIncoming, v as isNestedConnection, x as isOutgoing, y as mergeConnections, z as modelConnection, A as sortConnectionsByBoundaryHierarchy, B as sortDeepestFirst } from '../shared/index
|
|
1
|
+
export { C as Connection, f as ConnectionModel, F as DeployedInstanceModel, D as DeploymentConnectionModel, H as DeploymentNodeModel, I as DeploymentRelationModel, J as EdgeModel, E as ElementModel, b as LikeC4DeploymentModel, L as LikeC4Model, e as LikeC4ViewModel, N as NodeModel, R as RelationshipModel, g as deploymentConnection, h as differenceConnections, j as findAscendingConnections, k as findDeepestNestedConnection, m as findDescendantConnections, n as hasSameSource, o as hasSameSourceTarget, p as hasSameTarget, q as isAnyInOut, K as isDeployedInstance, M as isDeploymentNode, s as isIncoming, v as isNestedConnection, x as isOutgoing, y as mergeConnections, z as modelConnection, A as sortConnectionsByBoundaryHierarchy, B as sortDeepestFirst } from '../shared/index.DafVOuVd.js';
|
|
@@ -2840,7 +2840,7 @@ function treeFromMemoryState(memory, filter = "final") {
|
|
|
2840
2840
|
root,
|
|
2841
2841
|
connected,
|
|
2842
2842
|
hasInOut: (el) => memory.connections.some(Connection.isAnyInOut(el.id)),
|
|
2843
|
-
|
|
2843
|
+
parent: (el) => parents.get(el),
|
|
2844
2844
|
children: (el) => children.get(el)
|
|
2845
2845
|
};
|
|
2846
2846
|
}
|
package/dist/utils/index.d.mts
CHANGED
|
@@ -178,6 +178,21 @@ declare function ifilter<T>(predicate: (v: T) => boolean): (iterable: Iterable<T
|
|
|
178
178
|
declare function ifilter<T, S extends T>(iterable: Iterable<T>, predicate: (v: T) => v is S): IteratorLike<S>;
|
|
179
179
|
declare function ifilter<T>(iterable: Iterable<T>, predicate: (v: T) => boolean): IteratorLike<T>;
|
|
180
180
|
|
|
181
|
+
/**
|
|
182
|
+
* Finds the first element in the iterable that satisfies the predicate.
|
|
183
|
+
* Composable first version of `find`.
|
|
184
|
+
* @signature
|
|
185
|
+
* ifind(predicate)(data)
|
|
186
|
+
*/
|
|
187
|
+
declare function ifind<T>(predicate: (item: T) => boolean): (iterable: Iterable<T>) => T | undefined;
|
|
188
|
+
/**
|
|
189
|
+
* Finds the first element in the iterable that satisfies the predicate.
|
|
190
|
+
* Data first version of `find`.
|
|
191
|
+
* @signature
|
|
192
|
+
* ifind(data, predicate)
|
|
193
|
+
*/
|
|
194
|
+
declare function ifind<T>(iterable: Iterable<T>, predicate: (item: T) => boolean): T | undefined;
|
|
195
|
+
|
|
181
196
|
declare function iflat(): <T>(iterable: Iterable<IteratorLike<T>>) => IteratorLike<T>;
|
|
182
197
|
declare function iflat<T>(iterable: Iterable<IteratorLike<T>>): IteratorLike<T>;
|
|
183
198
|
|
|
@@ -401,4 +416,4 @@ declare namespace objectHash {
|
|
|
401
416
|
declare function objectHash(object: objectHash.NotUndefined, options?: objectHash.NormalOption): string;
|
|
402
417
|
declare function objectHash(object: objectHash.NotUndefined, options?: objectHash.WithBufferOption): Buffer;
|
|
403
418
|
|
|
404
|
-
export { DefaultMap, LinkedList, commonHead, compareNatural, compareRelations, delay, difference, equals as equalsSet, getOrCreate, hasAtLeast, ifilter, iflat, imap, intersection, ireduce, isIterable, isNonEmptyArray, isString, isome, iunique, objectHash, stringHash, symmetricDifference, toArray, toSet, union };
|
|
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 };
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -178,6 +178,21 @@ declare function ifilter<T>(predicate: (v: T) => boolean): (iterable: Iterable<T
|
|
|
178
178
|
declare function ifilter<T, S extends T>(iterable: Iterable<T>, predicate: (v: T) => v is S): IteratorLike<S>;
|
|
179
179
|
declare function ifilter<T>(iterable: Iterable<T>, predicate: (v: T) => boolean): IteratorLike<T>;
|
|
180
180
|
|
|
181
|
+
/**
|
|
182
|
+
* Finds the first element in the iterable that satisfies the predicate.
|
|
183
|
+
* Composable first version of `find`.
|
|
184
|
+
* @signature
|
|
185
|
+
* ifind(predicate)(data)
|
|
186
|
+
*/
|
|
187
|
+
declare function ifind<T>(predicate: (item: T) => boolean): (iterable: Iterable<T>) => T | undefined;
|
|
188
|
+
/**
|
|
189
|
+
* Finds the first element in the iterable that satisfies the predicate.
|
|
190
|
+
* Data first version of `find`.
|
|
191
|
+
* @signature
|
|
192
|
+
* ifind(data, predicate)
|
|
193
|
+
*/
|
|
194
|
+
declare function ifind<T>(iterable: Iterable<T>, predicate: (item: T) => boolean): T | undefined;
|
|
195
|
+
|
|
181
196
|
declare function iflat(): <T>(iterable: Iterable<IteratorLike<T>>) => IteratorLike<T>;
|
|
182
197
|
declare function iflat<T>(iterable: Iterable<IteratorLike<T>>): IteratorLike<T>;
|
|
183
198
|
|
|
@@ -401,4 +416,4 @@ declare namespace objectHash {
|
|
|
401
416
|
declare function objectHash(object: objectHash.NotUndefined, options?: objectHash.NormalOption): string;
|
|
402
417
|
declare function objectHash(object: objectHash.NotUndefined, options?: objectHash.WithBufferOption): Buffer;
|
|
403
418
|
|
|
404
|
-
export { DefaultMap, LinkedList, commonHead, compareNatural, compareRelations, delay, difference, equals as equalsSet, getOrCreate, hasAtLeast, ifilter, iflat, imap, intersection, ireduce, isIterable, isNonEmptyArray, isString, isome, iunique, objectHash, stringHash, symmetricDifference, toArray, toSet, union };
|
|
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 };
|
package/dist/utils/index.js
CHANGED
|
@@ -278,6 +278,23 @@ function requireLinkedList () {
|
|
|
278
278
|
var linkedListExports = requireLinkedList();
|
|
279
279
|
const linkedList = /*@__PURE__*/getDefaultExportFromCjs(linkedListExports);
|
|
280
280
|
|
|
281
|
+
function ifind(arg1, arg2) {
|
|
282
|
+
const pred = arg2 ?? arg1;
|
|
283
|
+
invariant(t(pred));
|
|
284
|
+
function _find(iter) {
|
|
285
|
+
for (const value of iter) {
|
|
286
|
+
if (pred(value)) {
|
|
287
|
+
return value;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
if (!arg2) {
|
|
293
|
+
return _find;
|
|
294
|
+
}
|
|
295
|
+
return _find(arg1);
|
|
296
|
+
}
|
|
297
|
+
|
|
281
298
|
function ireduce(arg1, arg2, arg3) {
|
|
282
299
|
const reducer = n(arg3) ? arg2 : arg1;
|
|
283
300
|
const initialValue = arg3 ?? arg2;
|
|
@@ -327,4 +344,4 @@ const compareRelations = (a, b) => {
|
|
|
327
344
|
return compareFqnHierarchically(a.target, b.target);
|
|
328
345
|
};
|
|
329
346
|
|
|
330
|
-
export { linkedList as LinkedList, commonAncestor, compareFqnHierarchically, compareRelations, delay, ireduce };
|
|
347
|
+
export { linkedList as LinkedList, commonAncestor, compareFqnHierarchically, compareRelations, delay, ifind, ireduce };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@likec4/core",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://likec4.dev",
|
|
6
6
|
"author": "Denis Davydkov <denis@davydkov.com>",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"sideEffects": false,
|
|
30
30
|
"exports": {
|
|
31
31
|
".": {
|
|
32
|
-
"
|
|
32
|
+
"sources": "./src/index.ts",
|
|
33
33
|
"default": {
|
|
34
34
|
"types": "./dist/index.d.ts",
|
|
35
35
|
"import": "./dist/index.js",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
"./builder": {
|
|
40
|
-
"
|
|
40
|
+
"sources": "./src/builder/index.ts",
|
|
41
41
|
"default": {
|
|
42
42
|
"types": "./dist/builder/index.d.ts",
|
|
43
43
|
"import": "./dist/builder/index.js",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
"./compute-view": {
|
|
48
|
-
"
|
|
48
|
+
"sources": "./src/compute-view/index.ts",
|
|
49
49
|
"default": {
|
|
50
50
|
"types": "./dist/compute-view/index.d.ts",
|
|
51
51
|
"import": "./dist/compute-view/index.js",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
"./model": {
|
|
56
|
-
"
|
|
56
|
+
"sources": "./src/model/index.ts",
|
|
57
57
|
"default": {
|
|
58
58
|
"types": "./dist/model/index.d.ts",
|
|
59
59
|
"import": "./dist/model/index.js",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
}
|
|
62
62
|
},
|
|
63
63
|
"./utils": {
|
|
64
|
-
"
|
|
64
|
+
"sources": "./src/utils/index.ts",
|
|
65
65
|
"default": {
|
|
66
66
|
"types": "./dist/utils/index.d.ts",
|
|
67
67
|
"import": "./dist/utils/index.js",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
71
|
"./types": {
|
|
72
|
-
"
|
|
72
|
+
"sources": "./src/types/index.ts",
|
|
73
73
|
"default": {
|
|
74
74
|
"types": "./dist/types/index.d.ts",
|
|
75
75
|
"import": "./dist/types/index.js",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"type-fest": "4.28.1"
|
|
86
86
|
},
|
|
87
87
|
"devDependencies": {
|
|
88
|
-
"@likec4/tsconfig": "1.19.
|
|
88
|
+
"@likec4/tsconfig": "1.19.1",
|
|
89
89
|
"@mantine/colors-generator": "7.15.2",
|
|
90
90
|
"@types/natural-compare-lite": "^1.4.2",
|
|
91
91
|
"@types/object-hash": "^3.0.6",
|
|
@@ -37,7 +37,7 @@ export function treeFromMemoryState<T extends AnyCtx, M extends ComputeMemory<T>
|
|
|
37
37
|
root: root as ReadonlySet<CtxElement<T>>,
|
|
38
38
|
connected: connected as ReadonlySet<CtxElement<T>>,
|
|
39
39
|
hasInOut: (el: CtxElement<T>) => memory.connections.some(Connection.isAnyInOut(el.id)),
|
|
40
|
-
|
|
40
|
+
parent: (el: CtxElement<T>) => parents.get(el),
|
|
41
41
|
children: (el: CtxElement<T>) => children.get(el),
|
|
42
42
|
}
|
|
43
43
|
}
|
package/src/utils/index.ts
CHANGED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { isFunction } from 'remeda'
|
|
2
|
+
import { invariant } from '../../errors'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Finds the first element in the iterable that satisfies the predicate.
|
|
6
|
+
* Composable first version of `find`.
|
|
7
|
+
* @signature
|
|
8
|
+
* ifind(predicate)(data)
|
|
9
|
+
*/
|
|
10
|
+
export function ifind<T>(predicate: (item: T) => boolean): (iterable: Iterable<T>) => T | undefined
|
|
11
|
+
/**
|
|
12
|
+
* Finds the first element in the iterable that satisfies the predicate.
|
|
13
|
+
* Data first version of `find`.
|
|
14
|
+
* @signature
|
|
15
|
+
* ifind(data, predicate)
|
|
16
|
+
*/
|
|
17
|
+
export function ifind<T>(iterable: Iterable<T>, predicate: (item: T) => boolean): T | undefined
|
|
18
|
+
|
|
19
|
+
export function ifind(arg1: unknown, arg2?: unknown) {
|
|
20
|
+
const pred = (arg2 ?? arg1) as (v: any) => boolean
|
|
21
|
+
invariant(isFunction(pred))
|
|
22
|
+
|
|
23
|
+
function _find(iter: Iterable<unknown>) {
|
|
24
|
+
for (const value of iter) {
|
|
25
|
+
if (pred(value)) {
|
|
26
|
+
return value
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (!arg2) {
|
|
33
|
+
return _find
|
|
34
|
+
}
|
|
35
|
+
return _find(arg1 as Iterable<unknown>)
|
|
36
|
+
}
|