@likec4/core 1.19.0 → 1.19.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/builder/index.d.mts +3 -3
  2. package/dist/builder/index.d.ts +3 -3
  3. package/dist/builder/index.js +2 -2
  4. package/dist/compute-view/index.d.mts +2 -2
  5. package/dist/compute-view/index.d.ts +2 -2
  6. package/dist/compute-view/index.js +3 -3
  7. package/dist/index.d.mts +3 -3
  8. package/dist/index.d.ts +3 -3
  9. package/dist/index.js +3 -3
  10. package/dist/model/index.d.mts +8 -3
  11. package/dist/model/index.d.ts +8 -3
  12. package/dist/model/index.js +1 -1
  13. package/dist/shared/{core.BZ9Msq7w.d.mts → core.2I-l5UtM.d.mts} +5 -1
  14. package/dist/shared/{core.CmYMqgha.d.mts → core.BL1oTk7-.d.mts} +13 -3
  15. package/dist/shared/{core.BIfgabEw.d.ts → core.CqXs9Frh.d.ts} +5 -1
  16. package/dist/shared/{core.C05RDLhi.d.ts → core.DyJ41fBO.d.ts} +13 -3
  17. package/dist/shared/{index.-BdzdI2C.js → index.KOeaSlL8.js} +333 -209
  18. package/dist/shared/{view.CyZrG8BJ.js → view.DrmaOfjr.js} +3 -0
  19. package/dist/types/index.d.mts +2 -2
  20. package/dist/types/index.d.ts +2 -2
  21. package/dist/types/index.js +1 -1
  22. package/dist/utils/index.d.mts +16 -1
  23. package/dist/utils/index.d.ts +16 -1
  24. package/dist/utils/index.js +18 -1
  25. package/package.json +9 -9
  26. package/src/builder/Builder.view-common.ts +1 -0
  27. package/src/compute-view/deployment-view/__test__/fixture.ts +31 -3
  28. package/src/compute-view/deployment-view/_types.ts +2 -1
  29. package/src/compute-view/deployment-view/compute.ts +4 -36
  30. package/src/compute-view/deployment-view/predicates/index.ts +8 -0
  31. package/src/compute-view/deployment-view/predicates/relation-direct.ts +117 -88
  32. package/src/compute-view/deployment-view/predicates/relation-in-out.ts +16 -8
  33. package/src/compute-view/deployment-view/predicates/relation-incoming.ts +18 -12
  34. package/src/compute-view/deployment-view/predicates/relation-outgoing.ts +16 -9
  35. package/src/compute-view/deployment-view/predicates/relation-where.ts +18 -0
  36. package/src/compute-view/deployment-view/predicates/utils.ts +183 -0
  37. package/src/compute-view/memory/ops.ts +1 -1
  38. package/src/model/DeploymentElementModel.ts +14 -1
  39. package/src/model/RelationModel.ts +4 -0
  40. package/src/model/connection/deployment/DeploymentConnectionModel.ts +11 -1
  41. package/src/types/deployments.ts +1 -0
  42. package/src/types/expression-v2.ts +12 -0
  43. package/src/types/index.ts +1 -0
  44. package/src/types/operators.ts +5 -5
  45. package/src/utils/index.ts +1 -0
  46. package/src/utils/iterable/find.ts +36 -0
  47. package/src/utils/iterable/index.ts +1 -0
@@ -163,6 +163,9 @@ var RelationExpr;
163
163
  RelationExpr2.isInOut = (expr) => {
164
164
  return "inout" in expr;
165
165
  };
166
+ RelationExpr2.isWhere = (expr) => {
167
+ return "where" in expr;
168
+ };
166
169
  })(RelationExpr || (RelationExpr = {}));
167
170
  var ExpressionV2;
168
171
  ((ExpressionV22) => {
@@ -1,7 +1,7 @@
1
1
  import { X as XYPoint, N as NonEmptyArray, P as Point, h as BorderStyle, l as ElementShape, x as ThemeColor, F as Fqn } from '../shared/core.D74xkKkG.mjs';
2
2
  export { A as AsFqn, 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, g as ElementShapes, m as ElementStyle, v as ElementThemeColorValues, u as ElementThemeColors, E as ExclusiveUnion, H as HexColorLiteral, I as IconUrl, a as IteratorLike, K as KeysOf, L as LikeC4Theme, n as Link, c as NTuple, b as NonEmptyReadonlyArray, d as Predicate, w as RelationshipThemeColorValues, R as RelationshipThemeColors, o as Tag, p as TagSpec, T as ThemeColorValues, q as TypedElement, r as isThemeColor } from '../shared/core.D74xkKkG.mjs';
3
- import { bj as ViewId, aV as BBox, bk as ViewManualLayout, aS as AutoLayoutDirection } from '../shared/core.CmYMqgha.mjs';
4
- export { ar as AbstractRelation, ag as AndOperator, a5 as AnyParsedLikeC4Model, 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, 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, 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';
3
+ import { bk as ViewId, aW as BBox, bl as ViewManualLayout, aT as AutoLayoutDirection } from '../shared/core.BL1oTk7-.mjs';
4
+ export { as as AbstractRelation, ag as AndOperator, a5 as AnyParsedLikeC4Model, aU as BasicElementView, aV as BasicView, aX as ComputedDeploymentView, aY as ComputedDynamicView, aZ as ComputedEdge, a_ as ComputedElementView, a as ComputedLikeC4Model, az as ComputedNode, C as ComputedView, a$ as CustomColorDefinitions, A as CustomElementExpr, B as CustomRelationExpr, ap as DefaultArrowType, aq as DefaultLineStyle, ar 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, b0 as DeploymentView, b1 as DeploymentViewRule, b2 as DeploymentViewRulePredicate, b3 as DeploymentViewRuleStyle, b4 as DiagramEdge, aA as DiagramNode, b5 as DiagramView, E as DirectRelationExpr, b6 as DynamicView, b7 as DynamicViewIncludeRule, b8 as DynamicViewParallelSteps, b9 as DynamicViewRule, ba as DynamicViewStep, bb as DynamicViewStepOrParallel, bc as EdgeId, F as ElementExpression, G as ElementKindExpr, bw as ElementNotation, H as ElementPredicateExpression, I as ElementRefExpr, J as ElementTagExpr, bd as ElementView, K as ElementWhereExpr, ah as EqualOperator, M as ExpandedElementExpr, N as Expression, X as ExpressionV2, be 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, at as ModelRelation, bf as NodeId, R as NonWilcard, ak as NotOperator, al as OperatorPredicate, am as OrOperator, S as OutgoingExpr, a9 as ParsedLikeC4Model, P as PredicateSelector, _ as RelationExpr, T as RelationExpression, au as RelationId, U as RelationPredicateExpression, V as RelationWhereExpr, av as RelationshipArrowType, aw as RelationshipKind, ax as RelationshipKindSpecification, ay as RelationshipLineType, bg as ScopedElementView, bh as StepEdgeId, bi as StepEdgeIdLiteral, an as TagEqual, bj as ViewAutoLayout, bm as ViewRule, bn as ViewRuleAutoLayout, bo as ViewRuleGlobalPredicateRef, bp as ViewRuleGlobalStyle, bq as ViewRuleGroup, br as ViewRulePredicate, bs as ViewRuleStyle, bt as ViewRuleStyleOrGlobalRef, bu as ViewWithHash, bv as ViewWithNotation, ao as WhereOperator, W as WildcardExpr, aB as extractStep, aC as getBBoxCenter, aD as getParallelStepsPrefix, aa as isAndOperator, aE as isAutoLayoutDirection, j as isCustomElement, k as isCustomRelationExpr, aF as isDeploymentView, aG as isDynamicView, aH as isDynamicViewParallelSteps, l as isElement, m as isElementKindExpr, n as isElementPredicateExpr, o as isElementRef, p as isElementTagExpr, aI as isElementView, q as isElementWhere, r as isExpandedElementExpr, aJ 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, aK as isScopedElementView, aL as isStepEdgeId, ae as isTagEqual, aM as isViewRuleAutoLayout, aN as isViewRuleGlobalPredicateRef, aO as isViewRuleGlobalStyle, aP as isViewRuleGroup, aQ as isViewRulePredicate, aR as isViewRuleStyle, z as isWildcard, aS as stepEdgeId, af as whereOperatorAsPredicate } from '../shared/core.BL1oTk7-.mjs';
5
5
  import 'type-fest';
6
6
 
7
7
  /**
@@ -1,7 +1,7 @@
1
1
  import { X as XYPoint, N as NonEmptyArray, P as Point, h as BorderStyle, l as ElementShape, x as ThemeColor, F as Fqn } from '../shared/core.D74xkKkG.js';
2
2
  export { A as AsFqn, 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, g as ElementShapes, m as ElementStyle, v as ElementThemeColorValues, u as ElementThemeColors, E as ExclusiveUnion, H as HexColorLiteral, I as IconUrl, a as IteratorLike, K as KeysOf, L as LikeC4Theme, n as Link, c as NTuple, b as NonEmptyReadonlyArray, d as Predicate, w as RelationshipThemeColorValues, R as RelationshipThemeColors, o as Tag, p as TagSpec, T as ThemeColorValues, q as TypedElement, r as isThemeColor } from '../shared/core.D74xkKkG.js';
3
- import { bj as ViewId, aV as BBox, bk as ViewManualLayout, aS as AutoLayoutDirection } from '../shared/core.C05RDLhi.js';
4
- export { ar as AbstractRelation, ag as AndOperator, a5 as AnyParsedLikeC4Model, 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, 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, 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';
3
+ import { bk as ViewId, aW as BBox, bl as ViewManualLayout, aT as AutoLayoutDirection } from '../shared/core.DyJ41fBO.js';
4
+ export { as as AbstractRelation, ag as AndOperator, a5 as AnyParsedLikeC4Model, aU as BasicElementView, aV as BasicView, aX as ComputedDeploymentView, aY as ComputedDynamicView, aZ as ComputedEdge, a_ as ComputedElementView, a as ComputedLikeC4Model, az as ComputedNode, C as ComputedView, a$ as CustomColorDefinitions, A as CustomElementExpr, B as CustomRelationExpr, ap as DefaultArrowType, aq as DefaultLineStyle, ar 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, b0 as DeploymentView, b1 as DeploymentViewRule, b2 as DeploymentViewRulePredicate, b3 as DeploymentViewRuleStyle, b4 as DiagramEdge, aA as DiagramNode, b5 as DiagramView, E as DirectRelationExpr, b6 as DynamicView, b7 as DynamicViewIncludeRule, b8 as DynamicViewParallelSteps, b9 as DynamicViewRule, ba as DynamicViewStep, bb as DynamicViewStepOrParallel, bc as EdgeId, F as ElementExpression, G as ElementKindExpr, bw as ElementNotation, H as ElementPredicateExpression, I as ElementRefExpr, J as ElementTagExpr, bd as ElementView, K as ElementWhereExpr, ah as EqualOperator, M as ExpandedElementExpr, N as Expression, X as ExpressionV2, be 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, at as ModelRelation, bf as NodeId, R as NonWilcard, ak as NotOperator, al as OperatorPredicate, am as OrOperator, S as OutgoingExpr, a9 as ParsedLikeC4Model, P as PredicateSelector, _ as RelationExpr, T as RelationExpression, au as RelationId, U as RelationPredicateExpression, V as RelationWhereExpr, av as RelationshipArrowType, aw as RelationshipKind, ax as RelationshipKindSpecification, ay as RelationshipLineType, bg as ScopedElementView, bh as StepEdgeId, bi as StepEdgeIdLiteral, an as TagEqual, bj as ViewAutoLayout, bm as ViewRule, bn as ViewRuleAutoLayout, bo as ViewRuleGlobalPredicateRef, bp as ViewRuleGlobalStyle, bq as ViewRuleGroup, br as ViewRulePredicate, bs as ViewRuleStyle, bt as ViewRuleStyleOrGlobalRef, bu as ViewWithHash, bv as ViewWithNotation, ao as WhereOperator, W as WildcardExpr, aB as extractStep, aC as getBBoxCenter, aD as getParallelStepsPrefix, aa as isAndOperator, aE as isAutoLayoutDirection, j as isCustomElement, k as isCustomRelationExpr, aF as isDeploymentView, aG as isDynamicView, aH as isDynamicViewParallelSteps, l as isElement, m as isElementKindExpr, n as isElementPredicateExpr, o as isElementRef, p as isElementTagExpr, aI as isElementView, q as isElementWhere, r as isExpandedElementExpr, aJ 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, aK as isScopedElementView, aL as isStepEdgeId, ae as isTagEqual, aM as isViewRuleAutoLayout, aN as isViewRuleGlobalPredicateRef, aO as isViewRuleGlobalStyle, aP as isViewRuleGroup, aQ as isViewRulePredicate, aR as isViewRuleStyle, z as isWildcard, aS as stepEdgeId, af as whereOperatorAsPredicate } from '../shared/core.DyJ41fBO.js';
5
5
  import 'type-fest';
6
6
 
7
7
  /**
@@ -1,4 +1,4 @@
1
- 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, 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';
1
+ 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, 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.DrmaOfjr.js';
2
2
 
3
3
  const ThemeColors = [
4
4
  "amber",
@@ -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 };
@@ -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 };
@@ -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.0",
3
+ "version": "1.19.2",
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
- "development": "./src/index.ts",
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
- "development": "./src/builder/index.ts",
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
- "development": "./src/compute-view/index.ts",
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
- "development": "./src/model/index.ts",
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
- "development": "./src/utils/index.ts",
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
- "development": "./src/types/index.ts",
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.0",
88
+ "@likec4/tsconfig": "1.19.2",
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",
@@ -104,5 +104,5 @@
104
104
  "unbuild": "^3.1.0",
105
105
  "vitest": "^2.1.8"
106
106
  },
107
- "packageManager": "yarn@4.5.3"
107
+ "packageManager": "yarn@4.6.0"
108
108
  }
@@ -189,6 +189,7 @@ function $exclude<B extends LikeC4ViewBuilder<AnyTypes, any, any>>(
189
189
  | [B['Expr']]
190
190
  | [B['TypedExpr']]
191
191
  | [B['Expr'], ViewPredicate.Custom<B['Types']>]
192
+ | [B['TypedExpr'], ViewPredicate.Custom<B['Types']>]
192
193
  ): (b: B) => B {
193
194
  return (b) => {
194
195
  let expr = b.$expr(args[0]) as C4Expression
@@ -57,6 +57,8 @@ const {
57
57
  zone: {},
58
58
  node: {},
59
59
  },
60
+ tags: ['old', 'next', 'temp'],
61
+ relationships: { 'https': {} },
60
62
  })
61
63
 
62
64
  export const builder = b
@@ -91,13 +93,22 @@ export const builder = b
91
93
  model(
92
94
  $m.rel('customer', 'cloud', 'uses services'),
93
95
  $m.rel('customer', 'cloud.frontend.mobile', 'opens mobile app'),
94
- $m.rel('customer', 'cloud.frontend.dashboard', 'opens in browser'),
96
+ $m.rel('customer', 'cloud.frontend.dashboard', {
97
+ title: 'opens in browser',
98
+ tags: ['old'],
99
+ }),
95
100
  $m.rel('cloud.frontend.dashboard', 'cloud.auth', {
96
101
  title: 'authenticates',
97
102
  color: 'green',
98
103
  }),
99
- $m.rel('cloud.frontend.dashboard', 'cloud.backend.api', 'fetches data'),
100
- $m.rel('cloud.frontend.dashboard', 'cloud.media', 'fetches media'),
104
+ $m.rel('cloud.frontend.dashboard', 'cloud.backend.api', {
105
+ title: 'fetches data',
106
+ tags: ['old'],
107
+ }),
108
+ $m.rel('cloud.frontend.dashboard', 'cloud.media', {
109
+ title: 'fetches media',
110
+ tags: ['temp'],
111
+ }),
101
112
  $m.rel('cloud.frontend.mobile', 'cloud.auth', {
102
113
  title: 'authenticates',
103
114
  color: 'amber',
@@ -137,6 +148,14 @@ export const builder = b
137
148
  instanceOf('db', 'aws.rds'),
138
149
  ),
139
150
  ),
151
+ env('dev').with(
152
+ node('devCustomer').with(
153
+ instanceOf('instance', 'customer'),
154
+ ),
155
+ node('devCloud').with(
156
+ instanceOf('instance', 'cloud'),
157
+ ),
158
+ ),
140
159
  env('acc').with(
141
160
  node('testCustomer').with(
142
161
  instanceOf('instance', 'customer'),
@@ -196,3 +215,12 @@ export function computeNodesAndEdges(...rules: DeploymentRulesBuilderOp<Types>[]
196
215
  edges: edgeIds,
197
216
  }
198
217
  }
218
+
219
+ export function createModel() {
220
+ const modelsource = builder.build()
221
+
222
+ return LikeC4Model.create({
223
+ ...modelsource,
224
+ views: {},
225
+ })
226
+ }
@@ -1,6 +1,6 @@
1
1
  import { LikeC4DeploymentModel } from '../../model'
2
2
  import type { RelationshipModel } from '../../model/RelationModel'
3
- import type { ExpressionV2 } from '../../types'
3
+ import type { ExpressionV2, Filterable, OperatorPredicate } from '../../types'
4
4
  import type { Ctx, Memory, Stage, StageExclude, StageInclude } from './memory'
5
5
 
6
6
  export { Memory, type Stage } from './memory'
@@ -23,6 +23,7 @@ export interface PredicateCtx<Expr extends ExpressionV2 = ExpressionV2> {
23
23
  stage: Stage
24
24
  model: LikeC4DeploymentModel
25
25
  memory: Memory
26
+ where: OperatorPredicate<Filterable> | null
26
27
  }
27
28
  export interface IncludePredicateCtx<Expr extends ExpressionV2 = ExpressionV2> extends PredicateCtx<Expr> {
28
29
  stage: StageInclude
@@ -1,27 +1,19 @@
1
1
  import { findLast, map } from 'remeda'
2
- import { nonexhaustive } from '../../errors'
3
2
  import { type LikeC4DeploymentModel, LikeC4Model } from '../../model'
4
3
  import type { AnyAux } from '../../model/types'
5
4
  import type { DeploymentViewRule } from '../../types'
6
5
  import {
7
6
  type ComputedDeploymentView,
8
7
  type DeploymentView,
9
- FqnExpr,
10
8
  isViewRuleAutoLayout,
11
9
  isViewRulePredicate,
12
10
  } from '../../types'
13
- import { RelationExpr } from '../../types/expression-v2'
14
11
  import { buildElementNotations } from '../utils/buildElementNotations'
15
12
  import { linkNodesWithEdges } from '../utils/link-nodes-with-edges'
16
13
  import { topologicalSort } from '../utils/topological-sort'
17
14
  import { calcViewLayoutHash } from '../utils/view-hash'
18
15
  import { Memory } from './memory'
19
- import { DeploymentRefPredicate } from './predicates/elements'
20
- import { DirectRelationPredicate } from './predicates/relation-direct'
21
- import { InOutRelationPredicate } from './predicates/relation-in-out'
22
- import { IncomingRelationPredicate } from './predicates/relation-incoming'
23
- import { OutgoingRelationPredicate } from './predicates/relation-outgoing'
24
- import { WildcardPredicate } from './predicates/wildcard'
16
+ import { predicateToPatch } from './predicates'
25
17
  import { StageFinal } from './stages/stage-final'
26
18
  import { applyDeploymentViewRuleStyles, buildNodes, toComputedEdges } from './utils'
27
19
 
@@ -37,32 +29,8 @@ export function processPredicates<M extends AnyAux>(
37
29
  const exprs = rule.include ?? rule.exclude
38
30
  for (const expr of exprs) {
39
31
  let stage = op === 'include' ? memory.stageInclude(expr) : memory.stageExclude(expr)
40
- const ctx = { model, stage, memory }
41
- switch (true) {
42
- case FqnExpr.isModelRef(expr):
43
- // Ignore model refs in deployment view
44
- break
45
- case FqnExpr.isDeploymentRef(expr):
46
- stage = DeploymentRefPredicate[op]({ ...ctx, expr } as any) ?? stage
47
- break
48
- case FqnExpr.isWildcard(expr):
49
- stage = WildcardPredicate[op]({ ...ctx, expr } as any) ?? stage
50
- break
51
- case RelationExpr.isDirect(expr):
52
- stage = DirectRelationPredicate[op]({ ...ctx, expr } as any) ?? stage
53
- break
54
- case RelationExpr.isInOut(expr):
55
- stage = InOutRelationPredicate[op]({ ...ctx, expr } as any) ?? stage
56
- break
57
- case RelationExpr.isOutgoing(expr):
58
- stage = OutgoingRelationPredicate[op]({ ...ctx, expr } as any) ?? stage
59
- break
60
- case RelationExpr.isIncoming(expr):
61
- stage = IncomingRelationPredicate[op]({ ...ctx, expr } as any) ?? stage
62
- break
63
- default:
64
- nonexhaustive(expr)
65
- }
32
+ const ctx = { expr, model, stage, memory, where: null }
33
+ stage = predicateToPatch(op, ctx) ?? stage
66
34
  memory = stage.commit()
67
35
  }
68
36
  }
@@ -78,7 +46,7 @@ export function computeDeploymentView<M extends AnyAux>(
78
46
  ...view
79
47
  }: DeploymentView,
80
48
  ): ComputedDeploymentView<M['ViewId']> {
81
- let memory = processPredicates<M>(likec4model.deployment, rules)
49
+ const memory = processPredicates<M>(likec4model.deployment, rules)
82
50
 
83
51
  const nodesMap = buildNodes(memory)
84
52
 
@@ -0,0 +1,8 @@
1
+ export * from './elements'
2
+ export * from './relation-direct'
3
+ export * from './relation-in-out'
4
+ export * from './relation-incoming'
5
+ export * from './relation-outgoing'
6
+ export * from './relation-where'
7
+ export * from './utils'
8
+ export * from './wildcard'