@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,584 @@
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
+ assertNonNullable,
19
+ assertTrue,
20
+ assertType,
21
+ guaranteeType,
22
+ UnsupportedOperationError,
23
+ } from '@finos/legend-shared';
24
+ import type { QueryBuilderState } from './QueryBuilderState.js';
25
+ import {
26
+ type AlloySerializationConfigInstanceValue,
27
+ type EnumValueInstanceValue,
28
+ type FunctionExpression,
29
+ type MappingInstanceValue,
30
+ type PairInstanceValue,
31
+ type PropertyGraphFetchTreeInstanceValue,
32
+ type PureListInstanceValue,
33
+ type RootGraphFetchTreeInstanceValue,
34
+ type RuntimeInstanceValue,
35
+ type ValueSpecificationVisitor,
36
+ type InstanceValue,
37
+ type INTERNAL__UnknownValueSpecification,
38
+ type LambdaFunction,
39
+ MILESTONING_STEREOTYPE,
40
+ matchFunctionName,
41
+ Class,
42
+ type CollectionInstanceValue,
43
+ type LambdaFunctionInstanceValue,
44
+ type PrimitiveInstanceValue,
45
+ SimpleFunctionExpression,
46
+ type VariableExpression,
47
+ type AbstractPropertyExpression,
48
+ getMilestoneTemporalStereotype,
49
+ type INTERNAL__PropagatedValue,
50
+ type ValueSpecification,
51
+ } from '@finos/legend-graph';
52
+ import { processTDSPostFilterExpression } from './fetch-structure/projection/post-filter/QueryBuilderPostFilterStateBuilder.js';
53
+ import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../QueryBuilder_Const.js';
54
+ import { LambdaParameterState } from '@finos/legend-application';
55
+ import { processFilterExpression } from './filter/QueryBuilderFilterStateBuilder.js';
56
+ import {
57
+ processTDSAggregateExpression,
58
+ processTDSGroupByExpression,
59
+ } from './fetch-structure/projection/aggregation/QueryBuilderAggregationStateBuilder.js';
60
+ import {
61
+ processGraphFetchExpression,
62
+ processGraphFetchSerializeExpression,
63
+ } from './fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.js';
64
+ import {
65
+ processTDSDistinctExpression,
66
+ processTDSProjectExpression,
67
+ processTDSProjectionColumnPropertyExpression,
68
+ processTDSProjectionDerivationExpression,
69
+ processTDSSortDirectionExpression,
70
+ processTDSSortExpression,
71
+ processTDSTakeExpression,
72
+ } from './fetch-structure/projection/QueryBuilderProjectionStateBuilder.js';
73
+
74
+ const processGetAllExpression = (
75
+ expression: SimpleFunctionExpression,
76
+ queryBuilderState: QueryBuilderState,
77
+ ): void => {
78
+ const _class = expression.genericType?.value.rawType;
79
+ assertType(
80
+ _class,
81
+ Class,
82
+ `Can't process getAll() expression: getAll() return type is missing`,
83
+ );
84
+ queryBuilderState.querySetupState.setClass(_class, true);
85
+ queryBuilderState.explorerState.refreshTreeData();
86
+
87
+ // check parameters (milestoning) and build state
88
+ let acceptedNoOfParameters = 1;
89
+ const stereotype = getMilestoneTemporalStereotype(
90
+ _class,
91
+ queryBuilderState.graphManagerState.graph,
92
+ );
93
+ switch (stereotype) {
94
+ case MILESTONING_STEREOTYPE.BITEMPORAL:
95
+ acceptedNoOfParameters = 3;
96
+ assertTrue(
97
+ expression.parametersValues.length === acceptedNoOfParameters,
98
+ `Can't process getAll() expression: when used with a bitemporal milestoned class getAll() expects two parameters`,
99
+ );
100
+ queryBuilderState.querySetupState.setProcessingDate(
101
+ expression.parametersValues[1],
102
+ );
103
+ queryBuilderState.querySetupState.setBusinessDate(
104
+ expression.parametersValues[2],
105
+ );
106
+ break;
107
+ case MILESTONING_STEREOTYPE.BUSINESS_TEMPORAL:
108
+ acceptedNoOfParameters = 2;
109
+ assertTrue(
110
+ expression.parametersValues.length === acceptedNoOfParameters,
111
+ `Can't process getAll() expression: when used with a milestoned class getAll() expects a parameter`,
112
+ );
113
+ queryBuilderState.querySetupState.setBusinessDate(
114
+ expression.parametersValues[1],
115
+ );
116
+ break;
117
+ case MILESTONING_STEREOTYPE.PROCESSING_TEMPORAL:
118
+ acceptedNoOfParameters = 2;
119
+ assertTrue(
120
+ expression.parametersValues.length === acceptedNoOfParameters,
121
+ `Can't process getAll() expression: when used with a milestoned class getAll() expects a parameter`,
122
+ );
123
+ queryBuilderState.querySetupState.setProcessingDate(
124
+ expression.parametersValues[1],
125
+ );
126
+ break;
127
+ default:
128
+ assertTrue(
129
+ expression.parametersValues.length === acceptedNoOfParameters,
130
+ `Can't process getAll() expression: getAll() expects no arguments`,
131
+ );
132
+ }
133
+ };
134
+
135
+ /**
136
+ * This is the value specification processor (a.k.a state builder) for query builder.
137
+ *
138
+ * Unlike value specification builder which takes care of transforming the value specification
139
+ * from `protocol` to `metamodel`, and doing some (naive) type-inferencing, the processor takes care
140
+ * of traversing the query, analyzing it to build the query builder state. The processor represents
141
+ * a particular way we want to look at the query, if the query is not like what the processor
142
+ * expects, or understands, query builder state could not be built, i.e. the query will be deemed
143
+ * unsupported by query builder
144
+ *
145
+ * NOTE: While traversing the expression, this processor also does a fair amount of
146
+ * validations and assertions--enough to properly build the state. Unlike the builder,
147
+ * the processor should NEVER modify the metamodel, just traversing it.
148
+ */
149
+ export class QueryBuilderValueSpecificationProcessor
150
+ implements ValueSpecificationVisitor<void>
151
+ {
152
+ readonly queryBuilderState: QueryBuilderState;
153
+ /**
154
+ * A value specification is a tree of value specifications.
155
+ *
156
+ * This structure may not intuitively correspond to how we write it in Pure
157
+ * For example, consider the following expression in Pure:
158
+ *
159
+ * | Person.all()->filter(x|$x.age > 0)->project([x|$x.name], ['Name'])->sort([desc('Name')]);
160
+ *
161
+ * which is equivalent to the more cryptic version:
162
+ *
163
+ * | sort(project(filter(all(Person), x|$x.age > 0), [x|$x.name], ['Name']), [desc('Name')]);
164
+ *
165
+ * Hence, the metamodel looks something like this (with some parts redacted)
166
+ * {
167
+ * "function": "sort",
168
+ * "parameters": [
169
+ * {
170
+ * "function": "project",
171
+ * "parameters": [
172
+ * {
173
+ * "function": "filter",
174
+ * "parameters": [
175
+ * {
176
+ * "function": "getAll",
177
+ * ...
178
+ * },
179
+ * ... // filter() expression
180
+ * ]
181
+ * },
182
+ * ... // project() expression column and alias
183
+ * ]
184
+ * },
185
+ * {
186
+ * "_type": "collection",
187
+ * "values": [
188
+ * {
189
+ * "function": "desc",
190
+ * ... // desc() expression
191
+ * }
192
+ * ]
193
+ * }
194
+ * ]
195
+ * }
196
+ *
197
+ * The first grammar form is farily declarative in nature and perhaps more intuitive.
198
+ * We tend to think, in terms of order of running:
199
+ * all() --> filter() --> project() --> sort()
200
+ *
201
+ * However, in reality, when the expression is used or read, the order of traversal is reversed:
202
+ * sort() --> project() --> filter() --> all()
203
+ *
204
+ * Now, in the context of the value specification processor, we need information about preceding
205
+ * expression in order to validate the usage context of functions, (for example, we want to only
206
+ * support project() after all() or filter()). In the case of function expression chain,
207
+ * we have to look at the function expression first parameter. There are some other context,
208
+ * such as what happens within the second parameter of the sort() expression
209
+ * in this case, we have the desc() expression, but it's not part of the main expression chain;
210
+ * however, we need to verify desc() is used within sort(), in this case, we have to record
211
+ * the parent expression. This is when the following attribute comes into use when processing
212
+ * value specification.
213
+ */
214
+ readonly parentExpression?: SimpleFunctionExpression | undefined;
215
+
216
+ private constructor(
217
+ queryBuilderState: QueryBuilderState,
218
+ parentExpression: SimpleFunctionExpression | undefined,
219
+ ) {
220
+ this.queryBuilderState = queryBuilderState;
221
+ this.parentExpression = parentExpression;
222
+ }
223
+
224
+ static process(
225
+ valueSpecification: ValueSpecification,
226
+ queryBuilderState: QueryBuilderState,
227
+ ): void {
228
+ valueSpecification.accept_ValueSpecificationVisitor(
229
+ new QueryBuilderValueSpecificationProcessor(queryBuilderState, undefined),
230
+ );
231
+ }
232
+
233
+ /**
234
+ * Process value specification with information about parent function expression
235
+ * in order to be used in some validation/assertion
236
+ */
237
+ static processChild(
238
+ valueSpecification: ValueSpecification,
239
+ parentExpression: SimpleFunctionExpression,
240
+ queryBuilderState: QueryBuilderState,
241
+ ): void {
242
+ valueSpecification.accept_ValueSpecificationVisitor(
243
+ new QueryBuilderValueSpecificationProcessor(
244
+ queryBuilderState,
245
+ parentExpression,
246
+ ),
247
+ );
248
+ }
249
+
250
+ visit_INTERNAL__UnknownValueSpecification(
251
+ valueSpecification: INTERNAL__UnknownValueSpecification,
252
+ ): void {
253
+ assertNonNullable(
254
+ this.parentExpression,
255
+ `Can't process unknown value: parent expression cannot be retrieved`,
256
+ );
257
+
258
+ if (
259
+ matchFunctionName(this.parentExpression.functionName, [
260
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_PROJECT,
261
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_GROUP_BY,
262
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_AGG,
263
+ ])
264
+ ) {
265
+ processTDSProjectionDerivationExpression(
266
+ valueSpecification,
267
+ this.parentExpression,
268
+ this.queryBuilderState,
269
+ );
270
+ return;
271
+ }
272
+
273
+ throw new UnsupportedOperationError(
274
+ `Can't process unknown value with parent expression of function ${this.parentExpression.functionName}()`,
275
+ );
276
+ }
277
+
278
+ visit_RootGraphFetchTreeInstanceValue(
279
+ valueSpecification: RootGraphFetchTreeInstanceValue,
280
+ ): void {
281
+ throw new UnsupportedOperationError();
282
+ }
283
+
284
+ visit_PropertyGraphFetchTreeInstanceValue(
285
+ valueSpecification: PropertyGraphFetchTreeInstanceValue,
286
+ ): void {
287
+ throw new UnsupportedOperationError();
288
+ }
289
+
290
+ visit_AlloySerializationConfigInstanceValue(
291
+ valueSpecification: AlloySerializationConfigInstanceValue,
292
+ ): void {
293
+ throw new UnsupportedOperationError();
294
+ }
295
+
296
+ visit_PrimitiveInstanceValue(
297
+ valueSpecification: PrimitiveInstanceValue,
298
+ ): void {
299
+ throw new UnsupportedOperationError();
300
+ }
301
+
302
+ visit_EnumValueInstanceValue(
303
+ valueSpecification: EnumValueInstanceValue,
304
+ ): void {
305
+ throw new UnsupportedOperationError();
306
+ }
307
+
308
+ visit_RuntimeInstanceValue(valueSpecification: RuntimeInstanceValue): void {
309
+ throw new UnsupportedOperationError();
310
+ }
311
+
312
+ visit_PairInstanceValue(valueSpecification: PairInstanceValue): void {
313
+ throw new UnsupportedOperationError();
314
+ }
315
+
316
+ visit_MappingInstanceValue(valueSpecification: MappingInstanceValue): void {
317
+ throw new UnsupportedOperationError();
318
+ }
319
+
320
+ visit_PureListInstanceValue(valueSpecification: PureListInstanceValue): void {
321
+ throw new UnsupportedOperationError();
322
+ }
323
+
324
+ visit_CollectionInstanceValue(
325
+ valueSpecification: CollectionInstanceValue,
326
+ ): void {
327
+ throw new UnsupportedOperationError();
328
+ }
329
+
330
+ visit_FunctionExpression(valueSpecification: FunctionExpression): void {
331
+ throw new UnsupportedOperationError();
332
+ }
333
+
334
+ visit_INTERNAL__PropagatedValue(
335
+ valueSpecification: INTERNAL__PropagatedValue,
336
+ ): void {
337
+ throw new UnsupportedOperationError();
338
+ }
339
+
340
+ visit_SimpleFunctionExpression(
341
+ valueSpecification: SimpleFunctionExpression,
342
+ ): void {
343
+ const functionName = valueSpecification.functionName;
344
+ if (
345
+ matchFunctionName(functionName, QUERY_BUILDER_SUPPORTED_FUNCTIONS.GET_ALL)
346
+ ) {
347
+ processGetAllExpression(valueSpecification, this.queryBuilderState);
348
+ return;
349
+ } else if (
350
+ matchFunctionName(functionName, [
351
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.FILTER,
352
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_FILTER,
353
+ ])
354
+ ) {
355
+ // NOTE: for filter, since it sometimes can be ambiguous
356
+ // whether meta::pure::functions::collection::filter() was used
357
+ // or meta::pure::tds::filter() was used, we have to have custom logic
358
+ // to determine
359
+
360
+ // check parameters
361
+ assertTrue(
362
+ valueSpecification.parametersValues.length === 2,
363
+ `Can't process filter() expression: filter() expects 1 argument`,
364
+ );
365
+
366
+ // check preceding expression
367
+ const precedingExpression = guaranteeType(
368
+ valueSpecification.parametersValues[0],
369
+ SimpleFunctionExpression,
370
+ `Can't process filter() expression: only support filter() immediately following an expression`,
371
+ );
372
+ QueryBuilderValueSpecificationProcessor.process(
373
+ precedingExpression,
374
+ this.queryBuilderState,
375
+ );
376
+
377
+ if (
378
+ matchFunctionName(
379
+ precedingExpression.functionName,
380
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.GET_ALL,
381
+ )
382
+ ) {
383
+ assertTrue(
384
+ matchFunctionName(
385
+ functionName,
386
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.FILTER,
387
+ ),
388
+ `Can't process filter() expression: only supports ${QUERY_BUILDER_SUPPORTED_FUNCTIONS.FILTER}() immediately following getAll() (got '${functionName}')`,
389
+ );
390
+ processFilterExpression(valueSpecification, this.queryBuilderState);
391
+ return;
392
+ } else if (
393
+ matchFunctionName(precedingExpression.functionName, [
394
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_PROJECT,
395
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_GROUP_BY,
396
+ ])
397
+ ) {
398
+ assertTrue(
399
+ matchFunctionName(
400
+ functionName,
401
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_FILTER,
402
+ ),
403
+ `Can't process post-filter expression: only supports ${QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_FILTER}() immediately following project()/groupBy() (got '${functionName}')`,
404
+ );
405
+ processTDSPostFilterExpression(
406
+ valueSpecification,
407
+ this.queryBuilderState,
408
+ );
409
+ return;
410
+ } else {
411
+ throw new UnsupportedOperationError(
412
+ `Can't process filter() expression: only support filter() immediately following getAll() or project()/groupBy()`,
413
+ );
414
+ }
415
+ } else if (
416
+ matchFunctionName(
417
+ functionName,
418
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_PROJECT,
419
+ )
420
+ ) {
421
+ processTDSProjectExpression(valueSpecification, this.queryBuilderState);
422
+ return;
423
+ } else if (
424
+ matchFunctionName(
425
+ functionName,
426
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_TAKE,
427
+ )
428
+ ) {
429
+ processTDSTakeExpression(valueSpecification, this.queryBuilderState);
430
+ return;
431
+ } else if (
432
+ matchFunctionName(
433
+ functionName,
434
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_DISTINCT,
435
+ )
436
+ ) {
437
+ processTDSDistinctExpression(valueSpecification, this.queryBuilderState);
438
+ return;
439
+ } else if (
440
+ matchFunctionName(
441
+ functionName,
442
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_SORT,
443
+ )
444
+ ) {
445
+ processTDSSortExpression(valueSpecification, this.queryBuilderState);
446
+ return;
447
+ } else if (
448
+ matchFunctionName(functionName, [
449
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_ASC,
450
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_DESC,
451
+ ])
452
+ ) {
453
+ processTDSSortDirectionExpression(
454
+ valueSpecification,
455
+ this.parentExpression,
456
+ this.queryBuilderState,
457
+ );
458
+ return;
459
+ } else if (
460
+ matchFunctionName(
461
+ functionName,
462
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_GROUP_BY,
463
+ )
464
+ ) {
465
+ processTDSGroupByExpression(valueSpecification, this.queryBuilderState);
466
+ return;
467
+ } else if (
468
+ matchFunctionName(functionName, QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_AGG)
469
+ ) {
470
+ processTDSAggregateExpression(
471
+ valueSpecification,
472
+ this.parentExpression,
473
+ this.queryBuilderState,
474
+ );
475
+ return;
476
+ } else if (
477
+ matchFunctionName(
478
+ functionName,
479
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.SERIALIZE,
480
+ )
481
+ ) {
482
+ processGraphFetchSerializeExpression(
483
+ valueSpecification,
484
+ this.queryBuilderState,
485
+ );
486
+ return;
487
+ } else if (
488
+ matchFunctionName(functionName, [
489
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.GRAPH_FETCH_CHECKED,
490
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.GRAPH_FETCH,
491
+ ])
492
+ ) {
493
+ processGraphFetchExpression(valueSpecification, this.queryBuilderState);
494
+ return;
495
+ }
496
+ throw new UnsupportedOperationError(
497
+ `Can't process expression of function ${functionName}()`,
498
+ );
499
+ }
500
+
501
+ visit_VariableExpression(valueSpecification: VariableExpression): void {
502
+ throw new UnsupportedOperationError();
503
+ }
504
+
505
+ visit_LambdaFunctionInstanceValue(
506
+ valueSpecification: LambdaFunctionInstanceValue,
507
+ ): void {
508
+ valueSpecification.values.forEach((value) =>
509
+ value.expressionSequence.forEach((expression) =>
510
+ expression.accept_ValueSpecificationVisitor(
511
+ new QueryBuilderValueSpecificationProcessor(
512
+ this.queryBuilderState,
513
+ this.parentExpression,
514
+ ),
515
+ ),
516
+ ),
517
+ );
518
+ }
519
+
520
+ visit_AbstractPropertyExpression(
521
+ valueSpecification: AbstractPropertyExpression,
522
+ ): void {
523
+ assertNonNullable(
524
+ this.parentExpression,
525
+ `Can't process property expression: parent expression cannot be retrieved`,
526
+ );
527
+
528
+ if (
529
+ matchFunctionName(this.parentExpression.functionName, [
530
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_PROJECT,
531
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_GROUP_BY,
532
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_AGG,
533
+ ])
534
+ ) {
535
+ processTDSProjectionColumnPropertyExpression(
536
+ valueSpecification,
537
+ this.queryBuilderState,
538
+ );
539
+ return;
540
+ }
541
+
542
+ throw new UnsupportedOperationError(
543
+ `Can't process property expression with parent expression of function ${this.parentExpression.functionName}()`,
544
+ );
545
+ }
546
+
547
+ visit_InstanceValue(valueSpecification: InstanceValue): void {
548
+ throw new UnsupportedOperationError();
549
+ }
550
+ }
551
+
552
+ export const processParameters = (
553
+ parameters: VariableExpression[],
554
+ queryBuilderState: QueryBuilderState,
555
+ ): void => {
556
+ const queryParameterState = queryBuilderState.queryParametersState;
557
+ parameters.forEach((parameter) => {
558
+ const parameterState = new LambdaParameterState(
559
+ parameter,
560
+ queryBuilderState.observableContext,
561
+ queryBuilderState.graphManagerState.graph,
562
+ );
563
+ parameterState.mockParameterValue();
564
+ queryParameterState.addParameter(parameterState);
565
+ });
566
+ };
567
+
568
+ export const processQueryLambdaFunction = (
569
+ lambdaFunction: LambdaFunction,
570
+ queryBuilderState: QueryBuilderState,
571
+ ): void => {
572
+ if (lambdaFunction.functionType.parameters.length) {
573
+ processParameters(
574
+ lambdaFunction.functionType.parameters,
575
+ queryBuilderState,
576
+ );
577
+ }
578
+ lambdaFunction.expressionSequence.map((expression) =>
579
+ QueryBuilderValueSpecificationProcessor.process(
580
+ expression,
581
+ queryBuilderState,
582
+ ),
583
+ );
584
+ };
@@ -32,7 +32,7 @@ import {
32
32
  } from './QueryBuilderState.js';
33
33
  import { TEST__getTestLegendQueryApplicationConfig } from './QueryEditorStoreTestUtils.js';
34
34
 
35
- export const TEST_setUpQueryBuilderState = async (
35
+ export const TEST__setUpQueryBuilderState = async (
36
36
  entities: Entity[],
37
37
  rawLambda?: RawLambda | undefined,
38
38
  executionContext?:
@@ -35,6 +35,7 @@ import {
35
35
  QueryBuilderSimpleProjectionColumnState,
36
36
  } from './fetch-structure/projection/QueryBuilderProjectionColumnState.js';
37
37
  import type { QueryBuilderState } from './QueryBuilderState.js';
38
+ import { QueryBuilderProjectionState } from './fetch-structure/projection/QueryBuilderProjectionState.js';
38
39
 
39
40
  const TYPEAHEAD_TAKE_LIMIT = 10;
40
41
  const START_LENGTH = 3;
@@ -44,10 +45,12 @@ const createAndSetupQueryBuilderStateForTypeahead = (
44
45
  ): QueryBuilderState => {
45
46
  const builderState = queryBuilderState.cloneQueryBuilderState();
46
47
  builderState.querySetupState = queryBuilderState.querySetupState;
47
- builderState.fetchStructureState.projectionState.resultSetModifierState.distinct =
48
- true;
49
- builderState.fetchStructureState.projectionState.resultSetModifierState.limit =
50
- TYPEAHEAD_TAKE_LIMIT;
48
+ const projectionState = guaranteeType(
49
+ builderState.fetchStructureState.implementation,
50
+ QueryBuilderProjectionState,
51
+ );
52
+ projectionState.resultSetModifierState.distinct = true;
53
+ projectionState.resultSetModifierState.limit = TYPEAHEAD_TAKE_LIMIT;
51
54
  return builderState;
52
55
  };
53
56
 
@@ -58,18 +61,21 @@ const buildColumnTypeaheadQuery = (
58
61
  | QueryBuilderAggregateColumnState,
59
62
  value: ValueSpecification | undefined,
60
63
  ): RawLambda => {
61
- let projectionState;
64
+ const projectionState = guaranteeType(
65
+ builderState.fetchStructureState.implementation,
66
+ QueryBuilderProjectionState,
67
+ );
68
+ let projectionColumnState;
62
69
  if (columnState instanceof QueryBuilderProjectionColumnState) {
63
- projectionState = columnState;
70
+ projectionColumnState = columnState;
64
71
  } else {
65
- projectionState = columnState.projectionColumnState;
66
- const aggregationState =
67
- builderState.fetchStructureState.projectionState.aggregationState;
72
+ projectionColumnState = columnState.projectionColumnState;
73
+ const aggregationState = projectionState.aggregationState;
68
74
  aggregationState.columns = [columnState];
69
75
  }
70
- builderState.fetchStructureState.projectionState.columns = [projectionState];
76
+ projectionState.columns = [projectionColumnState];
71
77
  const postConditionState = new PostFilterConditionState(
72
- builderState.fetchStructureState.projectionState.postFilterState,
78
+ projectionState.postFilterState,
73
79
  columnState,
74
80
  value,
75
81
  new QueryBuilderPostFilterOperator_StartWith(),
@@ -78,10 +84,7 @@ const buildColumnTypeaheadQuery = (
78
84
  undefined,
79
85
  postConditionState,
80
86
  );
81
- builderState.fetchStructureState.projectionState.postFilterState.addNodeFromNode(
82
- postFilterNode,
83
- undefined,
84
- );
87
+ projectionState.postFilterState.addNodeFromNode(postFilterNode, undefined);
85
88
  return builderState.resultState.buildExecutionRawLambda();
86
89
  };
87
90
 
@@ -92,8 +95,12 @@ export const buildPropertyTypeaheadQuery = (
92
95
  ): RawLambda => {
93
96
  const builderState =
94
97
  createAndSetupQueryBuilderStateForTypeahead(queryBuilderState);
98
+ const projectionState = guaranteeType(
99
+ builderState.fetchStructureState.implementation,
100
+ QueryBuilderProjectionState,
101
+ );
95
102
  const columnState = new QueryBuilderSimpleProjectionColumnState(
96
- builderState.fetchStructureState.projectionState,
103
+ projectionState,
97
104
  propertyExpression,
98
105
  false,
99
106
  );