@finos/legend-application-query 5.2.6 → 5.2.7

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 (231) hide show
  1. package/lib/components/QueryBuilder.d.ts.map +1 -1
  2. package/lib/components/QueryBuilder.js +22 -11
  3. package/lib/components/QueryBuilder.js.map +1 -1
  4. package/lib/components/QueryBuilderResultPanel.d.ts.map +1 -1
  5. package/lib/components/QueryBuilderResultPanel.js +12 -7
  6. package/lib/components/QueryBuilderResultPanel.js.map +1 -1
  7. package/lib/components/QueryBuilderSetupPanel.js +1 -1
  8. package/lib/components/QueryBuilderSetupPanel.js.map +1 -1
  9. package/lib/components/explorer/QueryBuilderExplorerPanel.d.ts +1 -2
  10. package/lib/components/explorer/QueryBuilderExplorerPanel.d.ts.map +1 -1
  11. package/lib/components/explorer/QueryBuilderExplorerPanel.js +14 -16
  12. package/lib/components/explorer/QueryBuilderExplorerPanel.js.map +1 -1
  13. package/lib/components/explorer/QueryBuilderPropertySearchPanel.js +2 -2
  14. package/lib/components/explorer/QueryBuilderPropertySearchPanel.js.map +1 -1
  15. package/lib/components/fetch-structure/QueryBuilderFetchStructurePanel.d.ts.map +1 -1
  16. package/lib/components/fetch-structure/QueryBuilderFetchStructurePanel.js +22 -105
  17. package/lib/components/fetch-structure/QueryBuilderFetchStructurePanel.js.map +1 -1
  18. package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.d.ts +1 -2
  19. package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.d.ts.map +1 -1
  20. package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.js +8 -10
  21. package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.js.map +1 -1
  22. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.d.ts.map +1 -1
  23. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js +23 -17
  24. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js.map +1 -1
  25. package/lib/components/fetch-structure/QueryBuilderProjectionPanel.d.ts +2 -2
  26. package/lib/components/fetch-structure/QueryBuilderProjectionPanel.d.ts.map +1 -1
  27. package/lib/components/fetch-structure/QueryBuilderProjectionPanel.js +15 -12
  28. package/lib/components/fetch-structure/QueryBuilderProjectionPanel.js.map +1 -1
  29. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.d.ts +2 -2
  30. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.d.ts.map +1 -1
  31. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js +23 -28
  32. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js.map +1 -1
  33. package/lib/components/filter/QueryBuilderFilterPanel.js +7 -7
  34. package/lib/components/filter/QueryBuilderFilterPanel.js.map +1 -1
  35. package/lib/components/shared/QueryBuilderPanelIssueCountBadge.d.ts.map +1 -1
  36. package/lib/components/shared/QueryBuilderPanelIssueCountBadge.js +1 -1
  37. package/lib/components/shared/QueryBuilderPanelIssueCountBadge.js.map +1 -1
  38. package/lib/graphManager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.d.ts.map +1 -1
  39. package/lib/graphManager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.js +5 -3
  40. package/lib/graphManager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.js.map +1 -1
  41. package/lib/index.css +2 -2
  42. package/lib/index.css.map +1 -1
  43. package/lib/package.json +7 -7
  44. package/lib/stores/QueryBuilderPreviewDataHelper.d.ts.map +1 -1
  45. package/lib/stores/QueryBuilderPreviewDataHelper.js +17 -14
  46. package/lib/stores/QueryBuilderPreviewDataHelper.js.map +1 -1
  47. package/lib/stores/QueryBuilderPropertyEditorState.d.ts.map +1 -1
  48. package/lib/stores/QueryBuilderPropertyEditorState.js +34 -24
  49. package/lib/stores/QueryBuilderPropertyEditorState.js.map +1 -1
  50. package/lib/stores/QueryBuilderState.d.ts +1 -2
  51. package/lib/stores/QueryBuilderState.d.ts.map +1 -1
  52. package/lib/stores/QueryBuilderState.js +17 -26
  53. package/lib/stores/QueryBuilderState.js.map +1 -1
  54. package/lib/stores/QueryBuilderStateBuilder.d.ts +124 -0
  55. package/lib/stores/QueryBuilderStateBuilder.d.ts.map +1 -0
  56. package/lib/stores/QueryBuilderStateBuilder.js +310 -0
  57. package/lib/stores/QueryBuilderStateBuilder.js.map +1 -0
  58. package/lib/stores/{QueryBuilderTestUtils.d.ts → QueryBuilderStateTestUtils.d.ts} +2 -2
  59. package/lib/stores/QueryBuilderStateTestUtils.d.ts.map +1 -0
  60. package/lib/stores/{QueryBuilderTestUtils.js → QueryBuilderStateTestUtils.js} +2 -2
  61. package/lib/stores/QueryBuilderStateTestUtils.js.map +1 -0
  62. package/lib/stores/QueryBuilderTypeaheadHelper.d.ts.map +1 -1
  63. package/lib/stores/QueryBuilderTypeaheadHelper.js +14 -12
  64. package/lib/stores/QueryBuilderTypeaheadHelper.js.map +1 -1
  65. package/lib/stores/QueryBuilderValueSpecificationBuilder.d.ts +3 -11
  66. package/lib/stores/QueryBuilderValueSpecificationBuilder.d.ts.map +1 -1
  67. package/lib/stores/QueryBuilderValueSpecificationBuilder.js +10 -319
  68. package/lib/stores/QueryBuilderValueSpecificationBuilder.js.map +1 -1
  69. package/lib/stores/QueryBuilderValueSpecificationBuilderHelper.d.ts +27 -0
  70. package/lib/stores/QueryBuilderValueSpecificationBuilderHelper.d.ts.map +1 -0
  71. package/lib/stores/QueryBuilderValueSpecificationBuilderHelper.js +153 -0
  72. package/lib/stores/QueryBuilderValueSpecificationBuilderHelper.js.map +1 -0
  73. package/lib/stores/QueryBuilderValueSpecificationHelper.d.ts +37 -1
  74. package/lib/stores/QueryBuilderValueSpecificationHelper.d.ts.map +1 -1
  75. package/lib/stores/QueryBuilderValueSpecificationHelper.js +79 -2
  76. package/lib/stores/QueryBuilderValueSpecificationHelper.js.map +1 -1
  77. package/lib/stores/explorer/QueryBuilderExplorerState.d.ts +12 -11
  78. package/lib/stores/explorer/QueryBuilderExplorerState.d.ts.map +1 -1
  79. package/lib/stores/explorer/QueryBuilderExplorerState.js +53 -20
  80. package/lib/stores/explorer/QueryBuilderExplorerState.js.map +1 -1
  81. package/lib/stores/explorer/QueryBuilderPropertySearchPanelState.d.ts +1 -1
  82. package/lib/stores/explorer/QueryBuilderPropertySearchPanelState.d.ts.map +1 -1
  83. package/lib/stores/explorer/QueryBuilderPropertySearchPanelState.js +3 -1
  84. package/lib/stores/explorer/QueryBuilderPropertySearchPanelState.js.map +1 -1
  85. package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.d.ts +17 -0
  86. package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.d.ts.map +1 -1
  87. package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.js +10 -0
  88. package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.js.map +1 -1
  89. package/lib/stores/fetch-structure/QueryBuilderFetchStructureState.d.ts +3 -20
  90. package/lib/stores/fetch-structure/QueryBuilderFetchStructureState.d.ts.map +1 -1
  91. package/lib/stores/fetch-structure/QueryBuilderFetchStructureState.js +31 -73
  92. package/lib/stores/fetch-structure/QueryBuilderFetchStructureState.js.map +1 -1
  93. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.d.ts +17 -4
  94. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.d.ts.map +1 -1
  95. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.js +110 -21
  96. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.js.map +1 -1
  97. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.d.ts +20 -0
  98. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.d.ts.map +1 -0
  99. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.js +62 -0
  100. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.js.map +1 -0
  101. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.d.ts +2 -1
  102. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.d.ts.map +1 -1
  103. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.js +3 -8
  104. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.js.map +1 -1
  105. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchValueSpecificationBuilder.d.ts +9 -2
  106. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchValueSpecificationBuilder.d.ts.map +1 -1
  107. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchValueSpecificationBuilder.js +28 -5
  108. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchValueSpecificationBuilder.js.map +1 -1
  109. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionColumnState.js +2 -2
  110. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionColumnState.js.map +1 -1
  111. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionState.d.ts +10 -2
  112. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionState.d.ts.map +1 -1
  113. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionState.js +102 -39
  114. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionState.js.map +1 -1
  115. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionStateBuilder.d.ts +25 -0
  116. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionStateBuilder.d.ts.map +1 -0
  117. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionStateBuilder.js +186 -0
  118. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionStateBuilder.js.map +1 -0
  119. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionValueSpecificationBuilder.d.ts +9 -4
  120. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionValueSpecificationBuilder.d.ts.map +1 -1
  121. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionValueSpecificationBuilder.js +129 -13
  122. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionValueSpecificationBuilder.js.map +1 -1
  123. package/lib/stores/fetch-structure/projection/aggregation/QueryBuilderAggregationStateBuilder.d.ts +20 -0
  124. package/lib/stores/fetch-structure/projection/aggregation/QueryBuilderAggregationStateBuilder.d.ts.map +1 -0
  125. package/lib/stores/fetch-structure/projection/aggregation/QueryBuilderAggregationStateBuilder.js +96 -0
  126. package/lib/stores/fetch-structure/projection/aggregation/QueryBuilderAggregationStateBuilder.js.map +1 -0
  127. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_DistinctCount.js +1 -1
  128. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_DistinctCount.js.map +1 -1
  129. package/lib/stores/fetch-structure/projection/post-filter/{QueryBuilderPostFilterValueSpecificationProcessor.d.ts → QueryBuilderPostFilterStateBuilder.d.ts} +4 -3
  130. package/lib/stores/fetch-structure/projection/post-filter/QueryBuilderPostFilterStateBuilder.d.ts.map +1 -0
  131. package/lib/stores/fetch-structure/projection/post-filter/{QueryBuilderPostFilterValueSpecificationProcessor.js → QueryBuilderPostFilterStateBuilder.js} +30 -21
  132. package/lib/stores/fetch-structure/projection/post-filter/QueryBuilderPostFilterStateBuilder.js.map +1 -0
  133. package/lib/stores/fetch-structure/projection/post-filter/QueryBuilderPostFilterValueSpecificationBuilder.d.ts.map +1 -1
  134. package/lib/stores/fetch-structure/projection/post-filter/QueryBuilderPostFilterValueSpecificationBuilder.js +1 -4
  135. package/lib/stores/fetch-structure/projection/post-filter/QueryBuilderPostFilterValueSpecificationBuilder.js.map +1 -1
  136. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_Contain.js +1 -1
  137. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_Contain.js.map +1 -1
  138. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.js +1 -1
  139. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.js.map +1 -1
  140. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_Equal.js +1 -1
  141. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_Equal.js.map +1 -1
  142. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.js +1 -1
  143. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.js.map +1 -1
  144. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThanEqual.js +1 -1
  145. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThanEqual.js.map +1 -1
  146. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_In.js +1 -1
  147. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_In.js.map +1 -1
  148. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_IsEmpty.js +1 -1
  149. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_IsEmpty.js.map +1 -1
  150. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.js +1 -1
  151. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.js.map +1 -1
  152. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_LessThanEqual.js +1 -1
  153. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_LessThanEqual.js.map +1 -1
  154. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.js +1 -1
  155. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.js.map +1 -1
  156. package/lib/stores/filter/QueryBuilderFilterStateBuilder.d.ts +19 -0
  157. package/lib/stores/filter/QueryBuilderFilterStateBuilder.d.ts.map +1 -0
  158. package/lib/stores/filter/QueryBuilderFilterStateBuilder.js +74 -0
  159. package/lib/stores/filter/QueryBuilderFilterStateBuilder.js.map +1 -0
  160. package/lib/stores/filter/{QueryBuilderValueSpecificationBuilder.d.ts → QueryBuilderFilterValueSpecificationBuilder.d.ts} +1 -1
  161. package/lib/stores/filter/QueryBuilderFilterValueSpecificationBuilder.d.ts.map +1 -0
  162. package/lib/stores/filter/{QueryBuilderValueSpecificationBuilder.js → QueryBuilderFilterValueSpecificationBuilder.js} +1 -1
  163. package/lib/stores/filter/QueryBuilderFilterValueSpecificationBuilder.js.map +1 -0
  164. package/lib/stores/filter/operators/QueryBuilderFilterOperatorHelper.d.ts.map +1 -1
  165. package/lib/stores/filter/operators/QueryBuilderFilterOperatorHelper.js +5 -5
  166. package/lib/stores/filter/operators/QueryBuilderFilterOperatorHelper.js.map +1 -1
  167. package/package.json +14 -14
  168. package/src/components/QueryBuilder.tsx +47 -28
  169. package/src/components/QueryBuilderResultPanel.tsx +21 -14
  170. package/src/components/QueryBuilderSetupPanel.tsx +1 -1
  171. package/src/components/explorer/QueryBuilderExplorerPanel.tsx +23 -38
  172. package/src/components/explorer/QueryBuilderPropertySearchPanel.tsx +2 -2
  173. package/src/components/fetch-structure/QueryBuilderFetchStructurePanel.tsx +41 -175
  174. package/src/components/fetch-structure/QueryBuilderGraphFetchTreePanel.tsx +9 -12
  175. package/src/components/fetch-structure/QueryBuilderPostFilterPanel.tsx +62 -28
  176. package/src/components/fetch-structure/QueryBuilderProjectionPanel.tsx +74 -48
  177. package/src/components/fetch-structure/QueryBuilderResultModifierPanel.tsx +33 -41
  178. package/src/components/filter/QueryBuilderFilterPanel.tsx +7 -7
  179. package/src/components/shared/QueryBuilderPanelIssueCountBadge.tsx +3 -1
  180. package/src/graphManager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.ts +5 -8
  181. package/src/stores/QueryBuilderPreviewDataHelper.ts +27 -18
  182. package/src/stores/QueryBuilderPropertyEditorState.ts +40 -31
  183. package/src/stores/QueryBuilderState.ts +26 -32
  184. package/src/stores/QueryBuilderStateBuilder.ts +584 -0
  185. package/src/stores/{QueryBuilderTestUtils.ts → QueryBuilderStateTestUtils.ts} +1 -1
  186. package/src/stores/QueryBuilderTypeaheadHelper.ts +23 -16
  187. package/src/stores/QueryBuilderValueSpecificationBuilder.ts +24 -584
  188. package/src/stores/QueryBuilderValueSpecificationBuilderHelper.ts +248 -0
  189. package/src/stores/QueryBuilderValueSpecificationHelper.ts +114 -0
  190. package/src/stores/explorer/QueryBuilderExplorerState.ts +73 -33
  191. package/src/stores/explorer/QueryBuilderPropertySearchPanelState.ts +3 -1
  192. package/src/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.ts +33 -2
  193. package/src/stores/fetch-structure/QueryBuilderFetchStructureState.ts +53 -118
  194. package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.ts +166 -26
  195. package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.ts +131 -0
  196. package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.ts +10 -19
  197. package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchValueSpecificationBuilder.ts +68 -4
  198. package/src/stores/fetch-structure/projection/QueryBuilderProjectionColumnState.ts +2 -2
  199. package/src/stores/fetch-structure/projection/QueryBuilderProjectionState.ts +172 -67
  200. package/src/stores/fetch-structure/projection/QueryBuilderProjectionStateBuilder.ts +426 -0
  201. package/src/stores/fetch-structure/projection/QueryBuilderProjectionValueSpecificationBuilder.ts +266 -21
  202. package/src/stores/fetch-structure/projection/aggregation/QueryBuilderAggregationStateBuilder.ts +228 -0
  203. package/src/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_DistinctCount.ts +1 -1
  204. package/src/stores/fetch-structure/projection/post-filter/{QueryBuilderPostFilterValueSpecificationProcessor.ts → QueryBuilderPostFilterStateBuilder.ts} +68 -48
  205. package/src/stores/fetch-structure/projection/post-filter/QueryBuilderPostFilterValueSpecificationBuilder.ts +1 -11
  206. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_Contain.ts +1 -1
  207. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.ts +1 -1
  208. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_Equal.ts +1 -1
  209. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.ts +1 -1
  210. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThanEqual.ts +1 -1
  211. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_In.ts +1 -1
  212. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_IsEmpty.ts +1 -1
  213. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.ts +1 -1
  214. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_LessThanEqual.ts +1 -1
  215. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.ts +1 -1
  216. package/src/stores/filter/QueryBuilderFilterStateBuilder.ts +155 -0
  217. package/src/stores/filter/{QueryBuilderValueSpecificationBuilder.ts → QueryBuilderFilterValueSpecificationBuilder.ts} +0 -0
  218. package/src/stores/filter/operators/QueryBuilderFilterOperatorHelper.ts +5 -5
  219. package/tsconfig.json +10 -5
  220. package/tsconfig.package.json +1 -1
  221. package/lib/stores/QueryBuilderTestUtils.d.ts.map +0 -1
  222. package/lib/stores/QueryBuilderTestUtils.js.map +0 -1
  223. package/lib/stores/QueryBuilderValueSpecificationProcessor.d.ts +0 -56
  224. package/lib/stores/QueryBuilderValueSpecificationProcessor.d.ts.map +0 -1
  225. package/lib/stores/QueryBuilderValueSpecificationProcessor.js +0 -548
  226. package/lib/stores/QueryBuilderValueSpecificationProcessor.js.map +0 -1
  227. package/lib/stores/fetch-structure/projection/post-filter/QueryBuilderPostFilterValueSpecificationProcessor.d.ts.map +0 -1
  228. package/lib/stores/fetch-structure/projection/post-filter/QueryBuilderPostFilterValueSpecificationProcessor.js.map +0 -1
  229. package/lib/stores/filter/QueryBuilderValueSpecificationBuilder.d.ts.map +0 -1
  230. package/lib/stores/filter/QueryBuilderValueSpecificationBuilder.js.map +0 -1
  231. package/src/stores/QueryBuilderValueSpecificationProcessor.ts +0 -1254
@@ -0,0 +1,248 @@
1
+ /**
2
+ * Copyright (c) 2020-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import {
18
+ functionExpression_setParametersValues,
19
+ propertyExpression_setParametersValue,
20
+ } from '@finos/legend-application';
21
+ import {
22
+ AbstractPropertyExpression,
23
+ Class,
24
+ DerivedProperty,
25
+ getMilestoneTemporalStereotype,
26
+ INTERNAL__PropagatedValue,
27
+ matchFunctionName,
28
+ MILESTONING_STEREOTYPE,
29
+ SimpleFunctionExpression,
30
+ TYPICAL_MULTIPLICITY_TYPE,
31
+ type ValueSpecification,
32
+ } from '@finos/legend-graph';
33
+ import {
34
+ getNullableFirstElement,
35
+ guaranteeNonNullable,
36
+ guaranteeType,
37
+ } from '@finos/legend-shared';
38
+ import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../QueryBuilder_Const.js';
39
+ import { getDerivedPropertyMilestoningSteoreotype } from './QueryBuilderPropertyEditorState.js';
40
+ import type { QueryBuilderState } from './QueryBuilderState.js';
41
+
42
+ /**
43
+ * Checks if the provided property expression match the criteria for default
44
+ * date propagation so we know whether we need to fill in values for the parameter
45
+ * or just propgate values from the parent's expression
46
+ *
47
+ * NOTE: this takes date propgation into account. See the table below for all
48
+ * the combination:
49
+ *
50
+ * | [source] | | | | |
51
+ * ----------------------------------------------------------------------
52
+ * [target] | | NONE | PR_TMP | BI_TMP | BU_TMP |
53
+ * ----------------------------------------------------------------------
54
+ * | NONE | N.A. | PRD | PRD,BUD | BUD |
55
+ * ----------------------------------------------------------------------
56
+ * | PR_TMP | N.A. | X | PRD,BUD | BUD |
57
+ * ----------------------------------------------------------------------
58
+ * | BI_TMP | N.A. | X | X | X |
59
+ * ----------------------------------------------------------------------
60
+ * | BU_TMP | N.A. | PRD | PRD,BUD | X |
61
+ * ----------------------------------------------------------------------
62
+ *
63
+ * Annotations:
64
+ *
65
+ * [source]: source temporal type
66
+ * [target]: target temporal type
67
+ *
68
+ * PR_TMP : processing temporal
69
+ * BI_TMP : bitemporal
70
+ * BU_TMP : business temporal
71
+ *
72
+ * X : no default date propagated
73
+ * PRD : default processing date is propagated
74
+ * BUD : default business date is propgated
75
+ */
76
+ const isDefaultDatePropagationSupported = (
77
+ currentPropertyExpression: AbstractPropertyExpression,
78
+ queryBuilderState: QueryBuilderState,
79
+ prevPropertyExpression?: AbstractPropertyExpression | undefined,
80
+ ): boolean => {
81
+ const property = currentPropertyExpression.func;
82
+ const graph = queryBuilderState.graphManagerState.graph;
83
+ // Default date propagation is not supported for current expression when the previous property expression is a derived property.
84
+ if (
85
+ prevPropertyExpression &&
86
+ prevPropertyExpression.func instanceof DerivedProperty &&
87
+ prevPropertyExpression.func._OWNER.derivedProperties.includes(
88
+ prevPropertyExpression.func,
89
+ )
90
+ ) {
91
+ return false;
92
+ }
93
+ // Default date propagation is not supported for current expression when the milestonedParameterValues of
94
+ // the previous property expression doesn't match with the global milestonedParameterValues
95
+ if (
96
+ prevPropertyExpression &&
97
+ prevPropertyExpression.func.genericType.value.rawType instanceof Class
98
+ ) {
99
+ const milestoningStereotype = getMilestoneTemporalStereotype(
100
+ prevPropertyExpression.func.genericType.value.rawType,
101
+ graph,
102
+ );
103
+ if (
104
+ milestoningStereotype &&
105
+ !prevPropertyExpression.parametersValues
106
+ .slice(1)
107
+ .every(
108
+ (parameterValue) =>
109
+ parameterValue instanceof INTERNAL__PropagatedValue,
110
+ )
111
+ ) {
112
+ return false;
113
+ }
114
+ }
115
+ if (property.genericType.value.rawType instanceof Class) {
116
+ // the stereotype of source class of current property expression.
117
+ const sourceStereotype =
118
+ property instanceof DerivedProperty
119
+ ? getDerivedPropertyMilestoningSteoreotype(property, graph)
120
+ : undefined;
121
+ // Default date propagation is always supported if the source is `bitemporal`
122
+ if (sourceStereotype === MILESTONING_STEREOTYPE.BITEMPORAL) {
123
+ return true;
124
+ }
125
+ // the stereotype (if exists) of the generic type of current property expression.
126
+ const targetStereotype = getMilestoneTemporalStereotype(
127
+ property.genericType.value.rawType,
128
+ graph,
129
+ );
130
+ // Default date propagation is supported when stereotype of both source and target matches
131
+ if (sourceStereotype && targetStereotype) {
132
+ return sourceStereotype === targetStereotype;
133
+ }
134
+ }
135
+ return false;
136
+ };
137
+
138
+ export const buildPropertyExpressionChain = (
139
+ propertyExpression: AbstractPropertyExpression,
140
+ queryBuilderState: QueryBuilderState,
141
+ ): ValueSpecification => {
142
+ const graph = queryBuilderState.graphManagerState.graph;
143
+ const newPropertyExpression = new AbstractPropertyExpression(
144
+ '',
145
+ graph.getTypicalMultiplicity(TYPICAL_MULTIPLICITY_TYPE.ONE),
146
+ );
147
+ newPropertyExpression.func = propertyExpression.func;
148
+ newPropertyExpression.parametersValues = propertyExpression.parametersValues;
149
+
150
+ let nextExpression: ValueSpecification | undefined;
151
+ let currentExpression: ValueSpecification | undefined = newPropertyExpression;
152
+ while (currentExpression instanceof AbstractPropertyExpression) {
153
+ nextExpression = getNullableFirstElement(
154
+ currentExpression.parametersValues,
155
+ );
156
+ if (nextExpression instanceof AbstractPropertyExpression) {
157
+ const parameterValue = new AbstractPropertyExpression(
158
+ '',
159
+ graph.getTypicalMultiplicity(TYPICAL_MULTIPLICITY_TYPE.ONE),
160
+ );
161
+ parameterValue.func = nextExpression.func;
162
+ parameterValue.parametersValues = nextExpression.parametersValues;
163
+ nextExpression = parameterValue;
164
+ currentExpression.parametersValues[0] = parameterValue;
165
+ }
166
+ if (currentExpression.func instanceof DerivedProperty) {
167
+ const parameterValues = currentExpression.parametersValues.slice(1);
168
+ parameterValues.forEach((parameterValue, index) => {
169
+ if (parameterValue instanceof INTERNAL__PropagatedValue) {
170
+ // Replace with argumentless derived property expression only when default date propagation is supported
171
+ if (
172
+ isDefaultDatePropagationSupported(
173
+ guaranteeType(currentExpression, AbstractPropertyExpression),
174
+ queryBuilderState,
175
+ nextExpression instanceof AbstractPropertyExpression
176
+ ? nextExpression
177
+ : undefined,
178
+ )
179
+ ) {
180
+ // NOTE: For `bitemporal` property check if the property expression has parameters which are not instance of
181
+ // `INTERNAL_PropagatedValue` then pass the parameters as user explicitly changed values of either of the parameters.
182
+ if (
183
+ (index === 1 &&
184
+ guaranteeType(currentExpression, AbstractPropertyExpression)
185
+ .parametersValues.length === 3) ||
186
+ (index === 0 &&
187
+ guaranteeType(currentExpression, AbstractPropertyExpression)
188
+ .parametersValues.length === 3 &&
189
+ !(
190
+ guaranteeType(currentExpression, AbstractPropertyExpression)
191
+ .parametersValues[2] instanceof INTERNAL__PropagatedValue
192
+ ))
193
+ ) {
194
+ propertyExpression_setParametersValue(
195
+ guaranteeType(currentExpression, AbstractPropertyExpression),
196
+ index + 1,
197
+ parameterValue.getValue(),
198
+ queryBuilderState.observableContext,
199
+ );
200
+ } else {
201
+ functionExpression_setParametersValues(
202
+ guaranteeType(currentExpression, AbstractPropertyExpression),
203
+ [
204
+ guaranteeNonNullable(
205
+ guaranteeType(currentExpression, AbstractPropertyExpression)
206
+ .parametersValues[0],
207
+ ),
208
+ ],
209
+ queryBuilderState.observableContext,
210
+ );
211
+ }
212
+ } else {
213
+ propertyExpression_setParametersValue(
214
+ guaranteeType(currentExpression, AbstractPropertyExpression),
215
+ index + 1,
216
+ parameterValue.getValue(),
217
+ queryBuilderState.observableContext,
218
+ );
219
+ }
220
+ }
221
+ });
222
+ }
223
+ currentExpression = nextExpression;
224
+ // Take care of chains of subtype (a pattern that is not useful, but we want to support and rectify)
225
+ // $x.employees->subType(@Person)->subType(@Staff)
226
+ while (
227
+ currentExpression instanceof SimpleFunctionExpression &&
228
+ matchFunctionName(
229
+ currentExpression.functionName,
230
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.SUBTYPE,
231
+ )
232
+ ) {
233
+ currentExpression = getNullableFirstElement(
234
+ currentExpression.parametersValues,
235
+ );
236
+ }
237
+ }
238
+ return newPropertyExpression;
239
+ };
240
+
241
+ export type LambdaFunctionBuilderOption = {
242
+ /**
243
+ * Set queryBuilderState to `true` when we construct query for execution within the app.
244
+ * queryBuilderState will make the lambda function building process overrides several query values, such as the row limit.
245
+ */
246
+ isBuildingExecutionQuery?: boolean | undefined;
247
+ keepSourceInformation?: boolean | undefined;
248
+ };
@@ -36,15 +36,22 @@ import {
36
36
  extractElementNameFromPath,
37
37
  AbstractPropertyExpression,
38
38
  isSuperType,
39
+ Class,
40
+ getMilestoneTemporalStereotype,
41
+ DerivedProperty,
42
+ MILESTONING_STEREOTYPE,
39
43
  } from '@finos/legend-graph';
40
44
  import {
41
45
  addUniqueEntry,
42
46
  guaranteeNonNullable,
43
47
  guaranteeType,
48
+ isNumber,
49
+ isString,
44
50
  UnsupportedOperationError,
45
51
  } from '@finos/legend-shared';
46
52
  import { format } from 'date-fns';
47
53
  import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../QueryBuilder_Const.js';
54
+ import { getDerivedPropertyMilestoningSteoreotype } from './QueryBuilderPropertyEditorState.js';
48
55
 
49
56
  export const getNonCollectionValueSpecificationType = (
50
57
  valueSpecification: ValueSpecification,
@@ -243,3 +250,110 @@ export const buildGenericLambdaFunctionInstanceValue = (
243
250
  functionInstanceValue.values.push(lambdaFunction);
244
251
  return functionInstanceValue;
245
252
  };
253
+
254
+ /**
255
+ * Checks if the milestoning property expression is valid in terms of number of parameter values provided
256
+ * in relation to its milestoning type.
257
+ *
258
+ * NOTE: this takes date propgation into account. See the table below for all
259
+ * the combination:
260
+ *
261
+ * | [source] | | | | |
262
+ * ----------------------------------------------------------------------
263
+ * [target] | | NONE | PR_TMP | BI_TMP | BU_TMP |
264
+ * ----------------------------------------------------------------------
265
+ * | NONE | N.A. | PRD | PRD,BUD | BUD |
266
+ * ----------------------------------------------------------------------
267
+ * | PR_TMP | N.A. | X | PRD,BUD | BUD |
268
+ * ----------------------------------------------------------------------
269
+ * | BI_TMP | N.A. | X | X | X |
270
+ * ----------------------------------------------------------------------
271
+ * | BU_TMP | N.A. | PRD | PRD,BUD | X |
272
+ * ----------------------------------------------------------------------
273
+ *
274
+ * Annotations:
275
+ *
276
+ * [source]: source temporal type
277
+ * [target]: target temporal type
278
+ *
279
+ * PR_TMP : processing temporal
280
+ * BI_TMP : bitemporal
281
+ * BU_TMP : business temporal
282
+ *
283
+ * X : no default date propagated
284
+ * PRD : default processing date is propagated
285
+ * BUD : default business date is propgated
286
+ */
287
+ export const validatePropertyExpressionChain = (
288
+ propertyExpression: AbstractPropertyExpression,
289
+ graph: PureModel,
290
+ ): void => {
291
+ if (
292
+ propertyExpression.func.genericType.value.rawType instanceof Class &&
293
+ propertyExpression.func._OWNER._generatedMilestonedProperties.length !== 0
294
+ ) {
295
+ const name = propertyExpression.func.name;
296
+ const func =
297
+ propertyExpression.func._OWNER._generatedMilestonedProperties.find(
298
+ (e) => e.name === name,
299
+ );
300
+ if (func) {
301
+ const targetStereotype = getMilestoneTemporalStereotype(
302
+ propertyExpression.func.genericType.value.rawType,
303
+ graph,
304
+ );
305
+
306
+ if (targetStereotype) {
307
+ const sourceStereotype = getDerivedPropertyMilestoningSteoreotype(
308
+ guaranteeType(func, DerivedProperty),
309
+ graph,
310
+ );
311
+ if (
312
+ sourceStereotype !== MILESTONING_STEREOTYPE.BITEMPORAL &&
313
+ targetStereotype !== sourceStereotype
314
+ ) {
315
+ if (targetStereotype === MILESTONING_STEREOTYPE.BITEMPORAL) {
316
+ if (
317
+ propertyExpression.parametersValues.length !== 3 &&
318
+ !sourceStereotype
319
+ ) {
320
+ throw new UnsupportedOperationError(
321
+ `Property of milestoning sterotype '${MILESTONING_STEREOTYPE.BITEMPORAL}' should have exactly two parameters`,
322
+ );
323
+ } else if (propertyExpression.parametersValues.length < 2) {
324
+ throw new UnsupportedOperationError(
325
+ `Property of milestoning sterotype '${MILESTONING_STEREOTYPE.BITEMPORAL}' should have at least one parameter`,
326
+ );
327
+ } else if (propertyExpression.parametersValues.length > 3) {
328
+ throw new UnsupportedOperationError(
329
+ `Property of milestoning sterotype '${MILESTONING_STEREOTYPE.BITEMPORAL}' should not have more than two parameters`,
330
+ );
331
+ }
332
+ } else if (propertyExpression.parametersValues.length !== 2) {
333
+ throw new UnsupportedOperationError(
334
+ `Property of milestoning sterotype '${targetStereotype}' should have exactly one parameter`,
335
+ );
336
+ }
337
+ }
338
+ }
339
+ }
340
+ }
341
+ };
342
+
343
+ export const extractNullableStringFromInstanceValue = (
344
+ value: ValueSpecification,
345
+ ): string | undefined => {
346
+ if (value instanceof PrimitiveInstanceValue && isString(value.values[0])) {
347
+ return value.values[0];
348
+ }
349
+ return undefined;
350
+ };
351
+
352
+ export const extractNullableNumberFromInstanceValue = (
353
+ value: ValueSpecification,
354
+ ): number | undefined => {
355
+ if (value instanceof PrimitiveInstanceValue && isNumber(value.values[0])) {
356
+ return value.values[0];
357
+ }
358
+ return undefined;
359
+ };
@@ -57,6 +57,7 @@ import {
57
57
  PRIMITIVE_TYPE,
58
58
  TdsExecutionResult,
59
59
  type ExecutionResult,
60
+ getAllSubclasses,
60
61
  } from '@finos/legend-graph';
61
62
  import type { QueryBuilderState } from '../QueryBuilderState.js';
62
63
  import {
@@ -76,7 +77,7 @@ import {
76
77
  buildNumericPreviewDataQuery,
77
78
  type QueryBuilderPreviewData,
78
79
  } from '../QueryBuilderPreviewDataHelper.js';
79
- import { QueryBuilderPropertySearchPanelState } from './QueryBuilderPropertySearchPanelState.js';
80
+ import { QueryBuilderPropertySearchState } from './QueryBuilderPropertySearchPanelState.js';
80
81
 
81
82
  export enum QUERY_BUILDER_EXPLORER_TREE_DND_TYPE {
82
83
  ROOT = 'ROOT',
@@ -85,18 +86,15 @@ export enum QUERY_BUILDER_EXPLORER_TREE_DND_TYPE {
85
86
  PRIMITIVE_PROPERTY = 'PRIMITIVE_PROPERTY',
86
87
  }
87
88
 
88
- export const getPropertyNodeId = (
89
+ export const generateExplorerTreePropertyNodeID = (
89
90
  parentId: string,
90
91
  propertyName: string,
91
- ): string => (parentId ? `${parentId}.${propertyName}` : propertyName);
92
+ ): string => `${parentId ? `${parentId}.` : ''}${propertyName}`;
92
93
 
93
- export const getPropertyNodeIdForSubType = (
94
+ export const generateExplorerTreeSubtypeNodeID = (
94
95
  parentId: string,
95
96
  subClassPath: string,
96
- ): string =>
97
- parentId
98
- ? `${parentId}${TYPE_CAST_TOKEN}${subClassPath}`
99
- : `${TYPE_CAST_TOKEN}${subClassPath}`;
97
+ ): string => `${parentId ? parentId : ''}${TYPE_CAST_TOKEN}${subClassPath}`;
100
98
 
101
99
  export interface QueryBuilderExplorerTreeDragSource {
102
100
  node: QueryBuilderExplorerTreePropertyNodeData;
@@ -111,7 +109,7 @@ export abstract class QueryBuilderExplorerTreeNodeData implements TreeNodeData {
111
109
  childrenIds: string[] = [];
112
110
  isPartOfDerivedPropertyBranch: boolean;
113
111
  type: Type;
114
- mappingData: QueryBuilderPropertyMappingData;
112
+ mappingData: QueryBuilderExplorerTreeNodeMappingData;
115
113
 
116
114
  constructor(
117
115
  id: string,
@@ -119,7 +117,7 @@ export abstract class QueryBuilderExplorerTreeNodeData implements TreeNodeData {
119
117
  dndText: string,
120
118
  isPartOfDerivedPropertyBranch: boolean,
121
119
  type: Type,
122
- mappingData: QueryBuilderPropertyMappingData,
120
+ mappingData: QueryBuilderExplorerTreeNodeMappingData,
123
121
  ) {
124
122
  makeObservable(this, {
125
123
  isSelected: observable,
@@ -139,7 +137,7 @@ export abstract class QueryBuilderExplorerTreeNodeData implements TreeNodeData {
139
137
  }
140
138
  }
141
139
 
142
- export type QueryBuilderPropertyMappingData = {
140
+ export type QueryBuilderExplorerTreeNodeMappingData = {
143
141
  mapped: boolean;
144
142
  mappedEntity?: MappedEntity | undefined;
145
143
  };
@@ -157,7 +155,7 @@ export class QueryBuilderExplorerTreePropertyNodeData extends QueryBuilderExplor
157
155
  property: AbstractProperty,
158
156
  parentId: string,
159
157
  isPartOfDerivedPropertyBranch: boolean,
160
- mappingData: QueryBuilderPropertyMappingData,
158
+ mappingData: QueryBuilderExplorerTreeNodeMappingData,
161
159
  ) {
162
160
  super(
163
161
  id,
@@ -184,7 +182,7 @@ export class QueryBuilderExplorerTreeSubTypeNodeData extends QueryBuilderExplore
184
182
  subclass: Class,
185
183
  parentId: string,
186
184
  isPartOfDerivedPropertyBranch: boolean,
187
- mappingData: QueryBuilderPropertyMappingData,
185
+ mappingData: QueryBuilderExplorerTreeNodeMappingData,
188
186
  multiplicity: Multiplicity,
189
187
  ) {
190
188
  super(
@@ -229,6 +227,16 @@ export const buildPropertyExpressionFromExplorerTreeNodeData = (
229
227
  parentNode instanceof QueryBuilderExplorerTreePropertyNodeData ||
230
228
  parentNode instanceof QueryBuilderExplorerTreeSubTypeNodeData
231
229
  ) {
230
+ // NOTE: here, we deliverately simplify subtypes chain
231
+ // $x.employees->subType(@Person)->subType(@Staff).department will be simplified to $x.employees->subType(@Staff).department
232
+ if (
233
+ parentNode instanceof QueryBuilderExplorerTreeSubTypeNodeData &&
234
+ currentNode instanceof QueryBuilderExplorerTreeSubTypeNodeData
235
+ ) {
236
+ parentNode = treeData.nodes.get(parentNode.parentId);
237
+ continue;
238
+ }
239
+
232
240
  let parentPropertyExpression;
233
241
  if (parentNode instanceof QueryBuilderExplorerTreeSubTypeNodeData) {
234
242
  parentPropertyExpression = new SimpleFunctionExpression(
@@ -285,11 +293,11 @@ export const buildPropertyExpressionFromExplorerTreeNodeData = (
285
293
 
286
294
  export const generatePropertyNodeMappingData = (
287
295
  property: AbstractProperty,
288
- parentMappingData: QueryBuilderPropertyMappingData,
296
+ parentMappingData: QueryBuilderExplorerTreeNodeMappingData,
289
297
  modelCoverageAnalysisResult: MappingModelCoverageAnalysisResult,
290
- ): QueryBuilderPropertyMappingData => {
291
- // If this property's owner has no corresponding entity, i.e. it means the parent is not mapped
292
- // Therefore, this property is not mapped either.
298
+ ): QueryBuilderExplorerTreeNodeMappingData => {
299
+ // If the property node's parent node does not have a mapped entity,
300
+ // it means the owner class is not mapped, i.e. this property is not mapped.
293
301
  if (parentMappingData.mappedEntity) {
294
302
  const mappedProp = parentMappingData.mappedEntity.__PROPERTIES_INDEX.get(
295
303
  property.name,
@@ -314,25 +322,57 @@ export const generatePropertyNodeMappingData = (
314
322
  return { mapped: false };
315
323
  };
316
324
 
317
- const generateSubtypeNodeMappingData = (
325
+ export const generateSubtypeNodeMappingData = (
318
326
  subclass: Class,
319
- parentMappingData: QueryBuilderPropertyMappingData,
327
+ parentMappingData: QueryBuilderExplorerTreeNodeMappingData,
320
328
  modelCoverageAnalysisResult: MappingModelCoverageAnalysisResult,
321
- ): QueryBuilderPropertyMappingData => {
322
- // If this property's owner has no corresponding entity, i.e. it means the parent is not mapped
323
- // Therefore, this property is not mapped either.
329
+ ): QueryBuilderExplorerTreeNodeMappingData => {
330
+ // NOTE: since we build subclass trees, there's a chance in a particular case,
331
+ // a _deep_ subclass is mapped, for example: A extends B extends C extends D ... extends Z
332
+ // and Z is mapped, when we build the mapping data for node A, B, C, we need to make sure
333
+ // we are aware of the fact that Z is mapped and pass the mapping data information properly
334
+ // until we process the node Z.
335
+ const allCompatibleTypePaths = getAllSubclasses(subclass)
336
+ .concat(subclass)
337
+ .map((_class) => _class.path);
338
+ // If the subtype node's parent node does not have a mapped entity,
339
+ // it means the superclass is not mapped, i.e. this subtype is not mapped
324
340
  if (parentMappingData.mappedEntity) {
325
- const mappedProperty = parentMappingData.mappedEntity.properties.filter(
326
- (p) => p instanceof EntityMappedProperty && p.subType === subclass.path,
341
+ const mappedSubtype = parentMappingData.mappedEntity.properties.find(
342
+ (mappedProperty): mappedProperty is EntityMappedProperty =>
343
+ Boolean(
344
+ // NOTE: if `subType` is specified in `EntityMappedProperty` it means
345
+ // that subtype is mapped
346
+ mappedProperty instanceof EntityMappedProperty &&
347
+ mappedProperty.subType &&
348
+ allCompatibleTypePaths.includes(mappedProperty.subType),
349
+ ),
327
350
  );
328
- if (mappedProperty.length > 0) {
351
+ if (mappedSubtype) {
329
352
  return {
330
353
  mapped: true,
331
354
  mappedEntity: modelCoverageAnalysisResult.__ENTITIES_INDEX.get(
332
- (mappedProperty[0] as EntityMappedProperty).entityPath,
355
+ mappedSubtype.entityPath,
333
356
  ),
334
357
  };
335
- } else if (parentMappingData.mappedEntity.path === subclass.path) {
358
+ } else if (
359
+ allCompatibleTypePaths.includes(parentMappingData.mappedEntity.path)
360
+ ) {
361
+ // This is to handle the case where the property mapping is pointing
362
+ // directly at the class mapping of a subtype of the type of that property
363
+ //
364
+ // For example: we have class `A` extends `B`, and we're looking at class `C` with property
365
+ // `b` of type B. However, the mapping we use has property mapping for `b` pointing at
366
+ // a class mapping for `A`.
367
+ //
368
+ // In this case, when building explorer tree node for property `b` of `C`, according to
369
+ // the mapping model coverage result, the mapped entity corresponding to this property
370
+ // will be mapped entity for `A`. However, as we build the explorer tree,
371
+ // so we will not immediately build the subtype node for `A`. As such, we have to propagate
372
+ // the mapped entity data downstream like the following. As a result, when building
373
+ // the mapping data for subtype node, we have to take this case into consideration
374
+ //
375
+ // See https://github.com/finos/legend-studio/issues/1437
336
376
  return {
337
377
  mapped: true,
338
378
  mappedEntity: parentMappingData.mappedEntity,
@@ -345,7 +385,7 @@ const generateSubtypeNodeMappingData = (
345
385
  export const getRootMappingData = (
346
386
  _class: Class,
347
387
  modelCoverageAnalysisResult: MappingModelCoverageAnalysisResult,
348
- ): QueryBuilderPropertyMappingData => ({
388
+ ): QueryBuilderExplorerTreeNodeMappingData => ({
349
389
  mapped: true,
350
390
  mappedEntity: modelCoverageAnalysisResult.__ENTITIES_INDEX.get(_class.path),
351
391
  });
@@ -398,7 +438,7 @@ export const getQueryBuilderPropertyNodeData = (
398
438
  return undefined;
399
439
  }
400
440
  const propertyNode = new QueryBuilderExplorerTreePropertyNodeData(
401
- getPropertyNodeId(
441
+ generateExplorerTreePropertyNodeID(
402
442
  parentNode instanceof QueryBuilderExplorerTreeRootNodeData
403
443
  ? ''
404
444
  : parentNode.id,
@@ -428,7 +468,7 @@ export const getQueryBuilderSubTypeNodeData = (
428
468
  modelCoverageAnalysisResult: MappingModelCoverageAnalysisResult,
429
469
  ): QueryBuilderExplorerTreeSubTypeNodeData => {
430
470
  const subTypeNode = new QueryBuilderExplorerTreeSubTypeNodeData(
431
- getPropertyNodeIdForSubType(
471
+ generateExplorerTreeSubtypeNodeID(
432
472
  parentNode instanceof QueryBuilderExplorerTreeRootNodeData
433
473
  ? ''
434
474
  : parentNode.id,
@@ -551,7 +591,7 @@ export class QueryBuilderExplorerState {
551
591
  humanizePropertyName = true;
552
592
  showUnmappedProperties = false;
553
593
  highlightUsedProperties = true;
554
- propertySearchPanelState: QueryBuilderPropertySearchPanelState;
594
+ propertySearchState: QueryBuilderPropertySearchState;
555
595
  mappingModelCoverageAnalysisResult?: MappingModelCoverageAnalysisResult;
556
596
  mappingModelCoverageAnalysisState = ActionState.create();
557
597
 
@@ -572,7 +612,7 @@ export class QueryBuilderExplorerState {
572
612
  });
573
613
 
574
614
  this.queryBuilderState = queryBuilderState;
575
- this.propertySearchPanelState = new QueryBuilderPropertySearchPanelState(
615
+ this.propertySearchState = new QueryBuilderPropertySearchState(
576
616
  this.queryBuilderState,
577
617
  );
578
618
  }
@@ -679,7 +719,7 @@ export class QueryBuilderExplorerState {
679
719
  this.queryBuilderState.explorerState.nonNullableTreeData,
680
720
  node,
681
721
  this.queryBuilderState.graphManagerState.graph,
682
- this.queryBuilderState.explorerState.propertySearchPanelState
722
+ this.queryBuilderState.explorerState.propertySearchState
683
723
  .allMappedPropertyNodes,
684
724
  );
685
725
  const propertyType = node.property.genericType.value.rawType;
@@ -42,8 +42,10 @@ import {
42
42
  } from './QueryBuilderExplorerState.js';
43
43
  import type { QueryBuilderState } from '../QueryBuilderState.js';
44
44
 
45
- export class QueryBuilderPropertySearchPanelState {
45
+ export class QueryBuilderPropertySearchState {
46
46
  queryBuilderState: QueryBuilderState;
47
+ // TODO: Check if we could clean this up as this seems quite complicated and its purpose is not clear to me
48
+ // See https://github.com/finos/legend-studio/pull/1212
47
49
  allMappedPropertyNodes: QueryBuilderExplorerTreeNodeData[] = [];
48
50
  searchedMappedPropertyNodes: QueryBuilderExplorerTreeNodeData[] = [];
49
51
  isSearchPanelOpen = false;
@@ -14,9 +14,22 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
+ import type {
18
+ Class,
19
+ CompilationError,
20
+ LambdaFunction,
21
+ } from '@finos/legend-graph';
22
+ import { computed, makeObservable } from 'mobx';
23
+ import type { QueryBuilderExplorerTreePropertyNodeData } from '../explorer/QueryBuilderExplorerState.js';
17
24
  import type { QueryBuilderState } from '../QueryBuilderState.js';
25
+ import type { LambdaFunctionBuilderOption } from '../QueryBuilderValueSpecificationBuilderHelper.js';
18
26
  import type { QueryBuilderFetchStructureState } from './QueryBuilderFetchStructureState.js';
19
27
 
28
+ export enum FETCH_STRUCTURE_IMPLEMENTATION {
29
+ PROJECTION = 'PROJECTION',
30
+ GRAPH_FETCH = 'GRAPH_FETCH',
31
+ }
32
+
20
33
  export abstract class QueryBuilderFetchStructureImplementationState {
21
34
  queryBuilderState: QueryBuilderState;
22
35
  fetchStructureState: QueryBuilderFetchStructureState;
@@ -25,10 +38,28 @@ export abstract class QueryBuilderFetchStructureImplementationState {
25
38
  queryBuilderState: QueryBuilderState,
26
39
  fetchStructureState: QueryBuilderFetchStructureState,
27
40
  ) {
41
+ makeObservable(this, {
42
+ usedExplorerTreePropertyNodeIDs: computed,
43
+ validationIssues: computed,
44
+ });
45
+
28
46
  this.queryBuilderState = queryBuilderState;
29
47
  this.fetchStructureState = fetchStructureState;
30
48
  }
31
49
 
32
- // abstract addProperty(node: QueryBuilderExplorerTreePropertyNodeData): void;
33
- // abstract addChildrenProperties(node: QueryBuilderExplorerTreePropertyNodeData): void;
50
+ abstract get type(): string;
51
+ abstract get usedExplorerTreePropertyNodeIDs(): string[];
52
+ abstract get validationIssues(): string[] | undefined;
53
+ abstract onClassChange(_class: Class | undefined): void;
54
+ abstract revealCompilationError(compilationError: CompilationError): boolean;
55
+ abstract clearCompilationError(): void;
56
+ abstract fetchProperty(node: QueryBuilderExplorerTreePropertyNodeData): void;
57
+ abstract fetchProperties(
58
+ nodes: QueryBuilderExplorerTreePropertyNodeData[],
59
+ ): void;
60
+ abstract checkBeforeChangingImplementation(onChange: () => void): void;
61
+ abstract appendFetchStructure(
62
+ lambdaFunction: LambdaFunction,
63
+ options?: LambdaFunctionBuilderOption,
64
+ ): void;
34
65
  }