@finos/legend-query-builder 0.2.3 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (261) hide show
  1. package/lib/components/QueryBuilder.d.ts.map +1 -1
  2. package/lib/components/QueryBuilder.js +42 -9
  3. package/lib/components/QueryBuilder.js.map +1 -1
  4. package/lib/components/QueryBuilderComponentTestUtils.d.ts.map +1 -1
  5. package/lib/components/QueryBuilderComponentTestUtils.js +2 -5
  6. package/lib/components/QueryBuilderComponentTestUtils.js.map +1 -1
  7. package/lib/components/QueryBuilderDiffPanel.js +2 -2
  8. package/lib/components/QueryBuilderDiffPanel.js.map +1 -1
  9. package/lib/components/QueryBuilderResultPanel.js +3 -3
  10. package/lib/components/QueryBuilderSideBar.d.ts.map +1 -1
  11. package/lib/components/QueryBuilderSideBar.js +2 -1
  12. package/lib/components/QueryBuilderSideBar.js.map +1 -1
  13. package/lib/components/QueryBuilder_TestID.d.ts +1 -0
  14. package/lib/components/QueryBuilder_TestID.d.ts.map +1 -1
  15. package/lib/components/QueryBuilder_TestID.js +1 -0
  16. package/lib/components/QueryBuilder_TestID.js.map +1 -1
  17. package/lib/components/explorer/QueryBuilderMilestoningEditor.d.ts.map +1 -1
  18. package/lib/components/explorer/QueryBuilderMilestoningEditor.js +2 -2
  19. package/lib/components/explorer/QueryBuilderMilestoningEditor.js.map +1 -1
  20. package/lib/components/fetch-structure/QueryBuilderOlapGroupByPanel.d.ts +23 -0
  21. package/lib/components/fetch-structure/QueryBuilderOlapGroupByPanel.d.ts.map +1 -0
  22. package/lib/components/fetch-structure/QueryBuilderOlapGroupByPanel.js +363 -0
  23. package/lib/components/fetch-structure/QueryBuilderOlapGroupByPanel.js.map +1 -0
  24. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.d.ts.map +1 -1
  25. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js +21 -53
  26. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js.map +1 -1
  27. package/lib/components/fetch-structure/QueryBuilderPostTDSPanel.d.ts +23 -0
  28. package/lib/components/fetch-structure/QueryBuilderPostTDSPanel.d.ts.map +1 -0
  29. package/lib/components/fetch-structure/QueryBuilderPostTDSPanel.js +32 -0
  30. package/lib/components/fetch-structure/QueryBuilderPostTDSPanel.js.map +1 -0
  31. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.d.ts.map +1 -1
  32. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js +2 -1
  33. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js.map +1 -1
  34. package/lib/components/fetch-structure/QueryBuilderTDSComponentHelper.d.ts +27 -0
  35. package/lib/components/fetch-structure/QueryBuilderTDSComponentHelper.d.ts.map +1 -0
  36. package/lib/components/fetch-structure/QueryBuilderTDSComponentHelper.js +61 -0
  37. package/lib/components/fetch-structure/QueryBuilderTDSComponentHelper.js.map +1 -0
  38. package/lib/components/fetch-structure/QueryBuilderTDSPanel.d.ts.map +1 -1
  39. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js +4 -13
  40. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js.map +1 -1
  41. package/lib/components/shared/LambdaEditor.d.ts.map +1 -1
  42. package/lib/components/shared/LambdaEditor.js +23 -7
  43. package/lib/components/shared/LambdaEditor.js.map +1 -1
  44. package/lib/components/workflows/ServiceQueryBuilder.d.ts.map +1 -1
  45. package/lib/components/workflows/ServiceQueryBuilder.js +5 -1
  46. package/lib/components/workflows/ServiceQueryBuilder.js.map +1 -1
  47. package/lib/graphManager/QueryBuilderHashUtils.d.ts +14 -0
  48. package/lib/graphManager/QueryBuilderHashUtils.d.ts.map +1 -1
  49. package/lib/graphManager/QueryBuilderHashUtils.js +15 -0
  50. package/lib/graphManager/QueryBuilderHashUtils.js.map +1 -1
  51. package/lib/graphManager/QueryBuilderSupportedFunctions.d.ts +7 -1
  52. package/lib/graphManager/QueryBuilderSupportedFunctions.d.ts.map +1 -1
  53. package/lib/graphManager/QueryBuilderSupportedFunctions.js +7 -0
  54. package/lib/graphManager/QueryBuilderSupportedFunctions.js.map +1 -1
  55. package/lib/graphManager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.d.ts.map +1 -1
  56. package/lib/graphManager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.js +4 -1
  57. package/lib/graphManager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.js.map +1 -1
  58. package/lib/graphManager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.d.ts +1 -0
  59. package/lib/graphManager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.d.ts.map +1 -1
  60. package/lib/graphManager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.js +50 -0
  61. package/lib/graphManager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.js.map +1 -1
  62. package/lib/index.css +2 -2
  63. package/lib/index.css.map +1 -1
  64. package/lib/package.json +6 -6
  65. package/lib/stores/QueryBuilderStateBuilder.d.ts.map +1 -1
  66. package/lib/stores/QueryBuilderStateBuilder.js +7 -1
  67. package/lib/stores/QueryBuilderStateBuilder.js.map +1 -1
  68. package/lib/stores/QueryBuilderStateTestUtils.d.ts.map +1 -1
  69. package/lib/stores/QueryBuilderStateTestUtils.js +2 -4
  70. package/lib/stores/QueryBuilderStateTestUtils.js.map +1 -1
  71. package/lib/stores/QueryBuilderTypeaheadHelper.js +2 -2
  72. package/lib/stores/explorer/QueryBuilderExplorerState.js +3 -3
  73. package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.d.ts +1 -0
  74. package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.d.ts.map +1 -1
  75. package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.js +3 -0
  76. package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.js.map +1 -1
  77. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.d.ts.map +1 -1
  78. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.js +2 -1
  79. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.js.map +1 -1
  80. package/lib/stores/fetch-structure/tds/QueryBuilderTDSColumnState_.d.ts +24 -0
  81. package/lib/stores/fetch-structure/tds/QueryBuilderTDSColumnState_.d.ts.map +1 -0
  82. package/lib/stores/fetch-structure/tds/QueryBuilderTDSColumnState_.js +20 -0
  83. package/lib/stores/fetch-structure/tds/QueryBuilderTDSColumnState_.js.map +1 -0
  84. package/lib/stores/fetch-structure/tds/QueryBuilderTDSHelper.d.ts +23 -0
  85. package/lib/stores/fetch-structure/tds/QueryBuilderTDSHelper.d.ts.map +1 -0
  86. package/lib/stores/fetch-structure/tds/QueryBuilderTDSHelper.js +41 -0
  87. package/lib/stores/fetch-structure/tds/QueryBuilderTDSHelper.js.map +1 -0
  88. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts +11 -0
  89. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts.map +1 -1
  90. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js +44 -1
  91. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js.map +1 -1
  92. package/lib/stores/fetch-structure/tds/QueryResultSetModifierState.d.ts +2 -2
  93. package/lib/stores/fetch-structure/tds/QueryResultSetModifierState.d.ts.map +1 -1
  94. package/lib/stores/fetch-structure/tds/QueryResultSetModifierState.js +2 -2
  95. package/lib/stores/fetch-structure/tds/QueryResultSetModifierState.js.map +1 -1
  96. package/lib/stores/fetch-structure/tds/aggregation/QueryBuilderAggregateOperator.js +1 -1
  97. package/lib/stores/fetch-structure/tds/aggregation/QueryBuilderAggregationState.d.ts +4 -4
  98. package/lib/stores/fetch-structure/tds/aggregation/QueryBuilderAggregationState.d.ts.map +1 -1
  99. package/lib/stores/fetch-structure/tds/aggregation/QueryBuilderAggregationState.js +8 -7
  100. package/lib/stores/fetch-structure/tds/aggregation/QueryBuilderAggregationState.js.map +1 -1
  101. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByOperatorLoader.d.ts +18 -0
  102. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByOperatorLoader.d.ts.map +1 -0
  103. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByOperatorLoader.js +36 -0
  104. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByOperatorLoader.js.map +1 -0
  105. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByState.d.ts +91 -0
  106. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByState.d.ts.map +1 -0
  107. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByState.js +272 -0
  108. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByState.js.map +1 -0
  109. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByStateBuilder.d.ts +19 -0
  110. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByStateBuilder.d.ts.map +1 -0
  111. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByStateBuilder.js +100 -0
  112. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByStateBuilder.js.map +1 -0
  113. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByValueSpecificationBuilder.d.ts +19 -0
  114. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByValueSpecificationBuilder.d.ts.map +1 -0
  115. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByValueSpecificationBuilder.js +83 -0
  116. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByValueSpecificationBuilder.js.map +1 -0
  117. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_.d.ts +29 -0
  118. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_.d.ts.map +1 -0
  119. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_.js +30 -0
  120. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_.js.map +1 -0
  121. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Average.d.ts +25 -0
  122. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Average.d.ts.map +1 -0
  123. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Average.js +50 -0
  124. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Average.js.map +1 -0
  125. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Count.d.ts +25 -0
  126. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Count.d.ts.map +1 -0
  127. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Count.js +51 -0
  128. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Count.js.map +1 -0
  129. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Max.d.ts +25 -0
  130. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Max.d.ts.map +1 -0
  131. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Max.js +50 -0
  132. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Max.js.map +1 -0
  133. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Min.d.ts +25 -0
  134. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Min.d.ts.map +1 -0
  135. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Min.js +50 -0
  136. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Min.js.map +1 -0
  137. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Sum.d.ts +25 -0
  138. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Sum.d.ts.map +1 -0
  139. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Sum.js +51 -0
  140. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Sum.js.map +1 -0
  141. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapRankOperator_AverageRank_.d.ts +24 -0
  142. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapRankOperator_AverageRank_.d.ts.map +1 -0
  143. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapRankOperator_AverageRank_.js +48 -0
  144. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapRankOperator_AverageRank_.js.map +1 -0
  145. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapRankOperator_DenseRank_.d.ts +24 -0
  146. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapRankOperator_DenseRank_.d.ts.map +1 -0
  147. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapRankOperator_DenseRank_.js +48 -0
  148. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapRankOperator_DenseRank_.js.map +1 -0
  149. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapRankOperator_Rank_.d.ts +24 -0
  150. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapRankOperator_Rank_.d.ts.map +1 -0
  151. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapRankOperator_Rank_.js +48 -0
  152. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapRankOperator_Rank_.js.map +1 -0
  153. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapRankOperator_RowNumber_.d.ts +24 -0
  154. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapRankOperator_RowNumber_.d.ts.map +1 -0
  155. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapRankOperator_RowNumber_.js +48 -0
  156. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapRankOperator_RowNumber_.js.map +1 -0
  157. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterOperator.d.ts +1 -1
  158. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterOperator.js +2 -2
  159. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.d.ts +6 -4
  160. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.d.ts.map +1 -1
  161. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.js +14 -3
  162. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.js.map +1 -1
  163. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.d.ts.map +1 -1
  164. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.js +8 -11
  165. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.js.map +1 -1
  166. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperatorHelper.d.ts +2 -2
  167. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperatorHelper.d.ts.map +1 -1
  168. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperatorHelper.js +5 -1
  169. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperatorHelper.js.map +1 -1
  170. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperatorValueSpecificationBuilder.js +4 -4
  171. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Contain.js +1 -1
  172. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.js +1 -1
  173. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Equal.js +3 -3
  174. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.js +3 -3
  175. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThanEqual.js +1 -1
  176. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_In.js +2 -2
  177. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_IsEmpty.d.ts +2 -2
  178. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_IsEmpty.js +3 -3
  179. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.js +3 -3
  180. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_LessThanEqual.js +1 -1
  181. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.js +1 -1
  182. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.d.ts +4 -6
  183. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.d.ts.map +1 -1
  184. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.js +6 -5
  185. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.js.map +1 -1
  186. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.d.ts.map +1 -1
  187. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.js +1 -0
  188. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.js.map +1 -1
  189. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.d.ts.map +1 -1
  190. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.js +6 -3
  191. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.js.map +1 -1
  192. package/lib/stores/filter/QueryBuilderFilterState.d.ts +2 -0
  193. package/lib/stores/filter/QueryBuilderFilterState.d.ts.map +1 -1
  194. package/lib/stores/filter/QueryBuilderFilterState.js +6 -0
  195. package/lib/stores/filter/QueryBuilderFilterState.js.map +1 -1
  196. package/package.json +13 -13
  197. package/src/components/QueryBuilder.tsx +110 -35
  198. package/src/components/QueryBuilderComponentTestUtils.tsx +9 -11
  199. package/src/components/QueryBuilderDiffPanel.tsx +2 -2
  200. package/src/components/QueryBuilderResultPanel.tsx +4 -4
  201. package/src/components/QueryBuilderSideBar.tsx +4 -1
  202. package/src/components/QueryBuilder_TestID.ts +1 -0
  203. package/src/components/explorer/QueryBuilderMilestoningEditor.tsx +2 -3
  204. package/src/components/fetch-structure/QueryBuilderOlapGroupByPanel.tsx +1140 -0
  205. package/src/components/fetch-structure/QueryBuilderPostFilterPanel.tsx +31 -106
  206. package/src/components/fetch-structure/QueryBuilderPostTDSPanel.tsx +69 -0
  207. package/src/components/fetch-structure/QueryBuilderResultModifierPanel.tsx +4 -1
  208. package/src/components/fetch-structure/QueryBuilderTDSComponentHelper.tsx +118 -0
  209. package/src/components/fetch-structure/QueryBuilderTDSPanel.tsx +4 -23
  210. package/src/components/shared/LambdaEditor.tsx +25 -22
  211. package/src/components/workflows/ServiceQueryBuilder.tsx +10 -2
  212. package/src/graphManager/QueryBuilderHashUtils.ts +16 -0
  213. package/src/graphManager/QueryBuilderSupportedFunctions.ts +7 -0
  214. package/src/graphManager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.ts +14 -0
  215. package/src/graphManager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.ts +129 -0
  216. package/src/stores/QueryBuilderStateBuilder.ts +14 -1
  217. package/src/stores/QueryBuilderStateTestUtils.ts +9 -13
  218. package/src/stores/QueryBuilderTypeaheadHelper.ts +2 -2
  219. package/src/stores/explorer/QueryBuilderExplorerState.ts +3 -3
  220. package/src/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.ts +4 -0
  221. package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.ts +2 -1
  222. package/src/stores/fetch-structure/tds/QueryBuilderTDSColumnState_.ts +28 -0
  223. package/src/stores/fetch-structure/tds/QueryBuilderTDSHelper.ts +79 -0
  224. package/src/stores/fetch-structure/tds/QueryBuilderTDSState.ts +68 -1
  225. package/src/stores/fetch-structure/tds/QueryResultSetModifierState.ts +2 -2
  226. package/src/stores/fetch-structure/tds/aggregation/QueryBuilderAggregateOperator.ts +1 -1
  227. package/src/stores/fetch-structure/tds/aggregation/QueryBuilderAggregationState.ts +11 -9
  228. package/src/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByOperatorLoader.ts +39 -0
  229. package/src/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByState.ts +377 -0
  230. package/src/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByStateBuilder.ts +237 -0
  231. package/src/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByValueSpecificationBuilder.ts +148 -0
  232. package/src/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_.ts +43 -0
  233. package/src/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Average.ts +56 -0
  234. package/src/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Count.ts +57 -0
  235. package/src/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Max.ts +56 -0
  236. package/src/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Min.ts +56 -0
  237. package/src/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Sum.ts +57 -0
  238. package/src/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapRankOperator_AverageRank_.ts +54 -0
  239. package/src/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapRankOperator_DenseRank_.ts +54 -0
  240. package/src/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapRankOperator_Rank_.ts +54 -0
  241. package/src/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapRankOperator_RowNumber_.ts +54 -0
  242. package/src/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterOperator.ts +2 -2
  243. package/src/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.ts +22 -10
  244. package/src/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.ts +11 -19
  245. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperatorHelper.ts +8 -7
  246. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperatorValueSpecificationBuilder.ts +4 -4
  247. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Contain.ts +1 -1
  248. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.ts +1 -1
  249. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Equal.ts +3 -3
  250. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.ts +3 -3
  251. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThanEqual.ts +1 -1
  252. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_In.ts +2 -2
  253. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_IsEmpty.ts +3 -3
  254. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.ts +3 -3
  255. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_LessThanEqual.ts +1 -1
  256. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.ts +1 -1
  257. package/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.ts +9 -11
  258. package/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.ts +1 -0
  259. package/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.ts +8 -4
  260. package/src/stores/filter/QueryBuilderFilterState.ts +7 -0
  261. package/tsconfig.json +19 -0
@@ -20,6 +20,7 @@ import {
20
20
  V1_buildFilterFunctionExpression,
21
21
  V1_buildGetAllFunctionExpression,
22
22
  V1_buildGroupByFunctionExpression,
23
+ V1_buildOlapGroupByFunctionExpression,
23
24
  V1_buildProjectFunctionExpression,
24
25
  V1_buildSubTypePropertyExpressionTypeInference,
25
26
  } from './v1/V1_QueryValueSpecificationBuilderHelper.js';
@@ -121,6 +122,19 @@ export class QueryBuilder_PureProtocolProcessorPlugin extends PureProtocolProces
121
122
  compileContext,
122
123
  processingContext,
123
124
  );
125
+ } else if (
126
+ matchFunctionName(
127
+ functionName,
128
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.OLAP_GROUPBY,
129
+ )
130
+ ) {
131
+ return V1_buildOlapGroupByFunctionExpression(
132
+ functionName,
133
+ parameters,
134
+ openVariables,
135
+ compileContext,
136
+ processingContext,
137
+ );
124
138
  } else if (
125
139
  matchFunctionName(
126
140
  functionName,
@@ -570,6 +570,135 @@ export const V1_buildGroupByFunctionExpression = (
570
570
  return [expression, processedParams];
571
571
  };
572
572
 
573
+ export const V1_buildOlapGroupByFunctionExpression = (
574
+ functionName: string,
575
+ parameters: V1_ValueSpecification[],
576
+ openVariables: string[],
577
+ compileContext: V1_GraphBuilderContext,
578
+ processingContext: V1_ProcessingContext,
579
+ ): [SimpleFunctionExpression, ValueSpecification[]] | undefined => {
580
+ const processedParams: ValueSpecification[] = [];
581
+ assertTrue(
582
+ parameters.length === 5 || parameters.length === 4,
583
+ `Can't build olapGroupBy() expression: olapGroupBy() expects 4 or 5 arguments`,
584
+ );
585
+ let paramIndex = 0;
586
+ const containsSortByExpression = parameters.length === 5;
587
+
588
+ // preceding expression
589
+ const precedingExperession = (
590
+ parameters[paramIndex] as V1_ValueSpecification
591
+ ).accept_ValueSpecificationVisitor(
592
+ new V1_ValueSpecificationBuilder(
593
+ compileContext,
594
+ processingContext,
595
+ openVariables,
596
+ ),
597
+ );
598
+ assertNonNullable(
599
+ precedingExperession.genericType,
600
+ `Can't build olapGroupBy() expression: preceding expression return type is missing`,
601
+ );
602
+ processedParams.push(precedingExperession);
603
+ paramIndex++;
604
+
605
+ // partition (window) columns
606
+ const columns = (
607
+ parameters[paramIndex] as V1_ValueSpecification
608
+ ).accept_ValueSpecificationVisitor(
609
+ new V1_ValueSpecificationBuilder(
610
+ compileContext,
611
+ processingContext,
612
+ openVariables,
613
+ ),
614
+ );
615
+ processedParams.push(columns);
616
+ paramIndex++;
617
+
618
+ // OLAP sortBy
619
+ if (containsSortByExpression) {
620
+ const sortBy = (
621
+ parameters[paramIndex] as V1_ValueSpecification
622
+ ).accept_ValueSpecificationVisitor(
623
+ new V1_ValueSpecificationBuilder(
624
+ compileContext,
625
+ processingContext,
626
+ openVariables,
627
+ ),
628
+ );
629
+ processedParams.push(sortBy);
630
+ paramIndex++;
631
+ }
632
+
633
+ // OLAP agg operation
634
+ const olapOperatorExp = parameters[paramIndex];
635
+ let olapOperationLambda: V1_Lambda;
636
+ if (olapOperatorExp instanceof V1_AppliedFunction) {
637
+ olapOperationLambda = guaranteeType(
638
+ olapOperatorExp.parameters[1],
639
+ V1_Lambda,
640
+ `Can't build olapGroupBy() expression: olap operation function expects argument ${
641
+ paramIndex + 1
642
+ } to be a lambda`,
643
+ );
644
+ } else {
645
+ olapOperationLambda = guaranteeType(
646
+ olapOperatorExp,
647
+ V1_Lambda,
648
+ `Can't build olapGroupBy() expression: olapGroupBy() expects argument ${
649
+ paramIndex + 1
650
+ } to be a lambda`,
651
+ );
652
+ }
653
+ const olapOperationParameters = olapOperationLambda.parameters;
654
+ const variables = new Set<string>();
655
+ olapOperationParameters.forEach((variable) => {
656
+ if (!variables.has(variable.name) && !variable.class) {
657
+ const variableExpression = new VariableExpression(
658
+ variable.name,
659
+ precedingExperession.multiplicity,
660
+ );
661
+ variableExpression.genericType = precedingExperession.genericType;
662
+ processingContext.addInferredVariables(variable.name, variableExpression);
663
+ }
664
+ });
665
+ const olapOperation = (
666
+ olapOperatorExp as V1_ValueSpecification
667
+ ).accept_ValueSpecificationVisitor(
668
+ new V1_ValueSpecificationBuilder(
669
+ compileContext,
670
+ processingContext,
671
+ openVariables,
672
+ ),
673
+ );
674
+ processedParams.push(olapOperation);
675
+ paramIndex++;
676
+
677
+ // OLAP column name
678
+ const olapColumnName = (
679
+ parameters[paramIndex] as V1_ValueSpecification
680
+ ).accept_ValueSpecificationVisitor(
681
+ new V1_ValueSpecificationBuilder(
682
+ compileContext,
683
+ processingContext,
684
+ openVariables,
685
+ ),
686
+ );
687
+ processedParams.push(olapColumnName);
688
+ paramIndex++;
689
+
690
+ // build final expression
691
+ const expression = V1_buildBaseSimpleFunctionExpression(
692
+ processedParams,
693
+ functionName,
694
+ compileContext,
695
+ );
696
+ expression.genericType = GenericTypeExplicitReference.create(
697
+ new GenericType(compileContext.resolveType(CORE_PURE_PATH.TDS_ROW).value),
698
+ );
699
+ return [expression, processedParams];
700
+ };
701
+
573
702
  export const V1_buildSubTypePropertyExpressionTypeInference = (
574
703
  inferredVariable: SimpleFunctionExpression,
575
704
  ): Type | undefined =>
@@ -70,6 +70,7 @@ import {
70
70
  } from './fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.js';
71
71
  import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../graphManager/QueryBuilderSupportedFunctions.js';
72
72
  import { LambdaParameterState } from './shared/LambdaParameterState.js';
73
+ import { processTDSOlapGroupByExpression } from './fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByStateBuilder.js';
73
74
 
74
75
  const processGetAllExpression = (
75
76
  expression: SimpleFunctionExpression,
@@ -394,6 +395,7 @@ export class QueryBuilderValueSpecificationProcessor
394
395
  matchFunctionName(precedingExpression.functionName, [
395
396
  QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_PROJECT,
396
397
  QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_GROUP_BY,
398
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.OLAP_GROUPBY,
397
399
  ])
398
400
  ) {
399
401
  assertTrue(
@@ -410,7 +412,7 @@ export class QueryBuilderValueSpecificationProcessor
410
412
  return;
411
413
  } else {
412
414
  throw new UnsupportedOperationError(
413
- `Can't process filter() expression: only support filter() immediately following getAll() or project()/groupBy()`,
415
+ `Can't process filter() expression: only support filter() immediately following getAll() or project()/groupBy()/olapGroupBy()`,
414
416
  );
415
417
  }
416
418
  } else if (
@@ -474,6 +476,17 @@ export class QueryBuilderValueSpecificationProcessor
474
476
  this.queryBuilderState,
475
477
  );
476
478
  return;
479
+ } else if (
480
+ matchFunctionName(
481
+ functionName,
482
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.OLAP_GROUPBY,
483
+ )
484
+ ) {
485
+ processTDSOlapGroupByExpression(
486
+ valueSpecification,
487
+ this.queryBuilderState,
488
+ );
489
+ return;
477
490
  } else if (
478
491
  matchFunctionName(
479
492
  functionName,
@@ -25,8 +25,8 @@ import {
25
25
  TEST__buildGraphWithEntities,
26
26
  TEST__getTestGraphManagerState,
27
27
  } from '@finos/legend-graph';
28
+ import { createSpy } from '@finos/legend-shared';
28
29
  import type { Entity } from '@finos/legend-storage';
29
- import { jest } from '@jest/globals';
30
30
  import { flowResult } from 'mobx';
31
31
  import { QueryBuilder_GraphManagerPreset } from '../graphManager/QueryBuilder_GraphManagerPreset.js';
32
32
  import {
@@ -75,18 +75,14 @@ export const TEST__setUpQueryBuilderState = async (
75
75
  }
76
76
 
77
77
  if (rawMappingModelCoverageAnalysisResult) {
78
- jest
79
- .spyOn(
80
- queryBuilderState.graphManagerState.graphManager,
81
- 'analyzeMappingModelCoverage',
82
- )
83
- .mockReturnValue(
84
- Promise.resolve(
85
- queryBuilderState.graphManagerState.graphManager.buildMappingModelCoverageAnalysisResult(
86
- rawMappingModelCoverageAnalysisResult,
87
- ),
88
- ),
89
- );
78
+ createSpy(
79
+ queryBuilderState.graphManagerState.graphManager,
80
+ 'analyzeMappingModelCoverage',
81
+ ).mockResolvedValue(
82
+ queryBuilderState.graphManagerState.graphManager.buildMappingModelCoverageAnalysisResult(
83
+ rawMappingModelCoverageAnalysisResult,
84
+ ),
85
+ );
90
86
  }
91
87
 
92
88
  if (rawMappingModelCoverageAnalysisResult) {
@@ -20,7 +20,7 @@ import {
20
20
  type ValueSpecification,
21
21
  PrimitiveInstanceValue,
22
22
  PRIMITIVE_TYPE,
23
- TdsExecutionResult,
23
+ TDSExecutionResult,
24
24
  type RawLambda,
25
25
  } from '@finos/legend-graph';
26
26
  import { guaranteeType, isNonNullable, isString } from '@finos/legend-shared';
@@ -120,7 +120,7 @@ export const buildProjectionColumnTypeaheadQuery = (
120
120
  export const buildTypeaheadOptions = (result: ExecutionResult): string[] => {
121
121
  const tdsResult = guaranteeType(
122
122
  result,
123
- TdsExecutionResult,
123
+ TDSExecutionResult,
124
124
  'Typeahead search is only supported for TDS result sets',
125
125
  );
126
126
  const options: string[] = [];
@@ -54,7 +54,7 @@ import {
54
54
  Property,
55
55
  Association,
56
56
  PRIMITIVE_TYPE,
57
- TdsExecutionResult,
57
+ TDSExecutionResult,
58
58
  type ExecutionResult,
59
59
  getAllSubclasses,
60
60
  PropertyExplicitReference,
@@ -741,7 +741,7 @@ export class QueryBuilderExplorerState {
741
741
  )) as ExecutionResult;
742
742
  assertType(
743
743
  previewResult,
744
- TdsExecutionResult,
744
+ TDSExecutionResult,
745
745
  `Unexpected preview data format`,
746
746
  );
747
747
  const previewResultData =
@@ -778,7 +778,7 @@ export class QueryBuilderExplorerState {
778
778
  )) as ExecutionResult;
779
779
  assertType(
780
780
  previewResult,
781
- TdsExecutionResult,
781
+ TDSExecutionResult,
782
782
  `Unexpected preview data format`,
783
783
  );
784
784
  this.previewDataState.setPreviewData(
@@ -67,4 +67,8 @@ export abstract class QueryBuilderFetchStructureImplementationState
67
67
  options?: LambdaFunctionBuilderOption,
68
68
  ): void;
69
69
  abstract get hashCode(): string;
70
+
71
+ get TEMPORARY__showPostFetchStructurePanel(): boolean {
72
+ return this.queryBuilderState.filterState.showPanel;
73
+ }
70
74
  }
@@ -15,7 +15,7 @@
15
15
  */
16
16
 
17
17
  import type { QueryBuilderState } from '../../QueryBuilderState.js';
18
- import { action, makeObservable, observable } from 'mobx';
18
+ import { action, computed, makeObservable, observable } from 'mobx';
19
19
  import {
20
20
  type CompilationError,
21
21
  PackageableElementExplicitReference,
@@ -73,6 +73,7 @@ export class QueryBuilderGraphFetchTreeState
73
73
  makeObservable(this, {
74
74
  treeData: observable.ref,
75
75
  isChecked: observable,
76
+ TEMPORARY__showPostFetchStructurePanel: computed,
76
77
  setGraphFetchTree: action,
77
78
  setChecked: action,
78
79
  });
@@ -0,0 +1,28 @@
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 { type Hashable, uuid } from '@finos/legend-shared';
18
+ import type { Type } from '@finos/legend-graph';
19
+
20
+ export abstract class QueryBuilderTDSColumnState implements Hashable {
21
+ readonly uuid = uuid();
22
+
23
+ abstract get columnName(): string;
24
+
25
+ abstract getColumnType(): Type | undefined;
26
+
27
+ abstract get hashCode(): string;
28
+ }
@@ -0,0 +1,79 @@
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
+ extractElementNameFromPath,
19
+ matchFunctionName,
20
+ } from '@finos/legend-graph';
21
+ import {
22
+ guaranteeNonNullable,
23
+ UnsupportedOperationError,
24
+ } from '@finos/legend-shared';
25
+ import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../../graphManager/QueryBuilderSupportedFunctions.js';
26
+ import type { QueryBuilderTDSState } from './QueryBuilderTDSState.js';
27
+ import type { QueryBuilderTDSColumnState } from './QueryBuilderTDSColumnState_.js';
28
+ import { COLUMN_SORT_TYPE } from './QueryResultSetModifierState.js';
29
+
30
+ export const findTDSColumnState = (
31
+ projectionState: QueryBuilderTDSState,
32
+ columnName: string,
33
+ ): QueryBuilderTDSColumnState | undefined =>
34
+ projectionState.tdsColumns.find((c) => c.columnName === columnName);
35
+
36
+ export const getTDSColumnState = (
37
+ projectionState: QueryBuilderTDSState,
38
+ columnName: string,
39
+ ): QueryBuilderTDSColumnState =>
40
+ guaranteeNonNullable(
41
+ findTDSColumnState(projectionState, columnName),
42
+ `Column ${columnName} not found in TDS`,
43
+ );
44
+
45
+ export const getTDSColSortTypeFromFunctionName = (
46
+ functionName: string,
47
+ ): COLUMN_SORT_TYPE => {
48
+ if (
49
+ matchFunctionName(functionName, QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_ASC)
50
+ ) {
51
+ return COLUMN_SORT_TYPE.ASC;
52
+ } else if (
53
+ matchFunctionName(functionName, QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_DESC)
54
+ ) {
55
+ return COLUMN_SORT_TYPE.DESC;
56
+ }
57
+ throw new UnsupportedOperationError(
58
+ `Unsupported TDS sort function: ${functionName}`,
59
+ );
60
+ };
61
+
62
+ export const getFunctionNameFromTDSSortColumn = (
63
+ columnSortType: COLUMN_SORT_TYPE,
64
+ ): string => {
65
+ switch (columnSortType) {
66
+ case COLUMN_SORT_TYPE.ASC:
67
+ return extractElementNameFromPath(
68
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_ASC,
69
+ );
70
+ case COLUMN_SORT_TYPE.DESC:
71
+ return extractElementNameFromPath(
72
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_DESC,
73
+ );
74
+ default:
75
+ throw new UnsupportedOperationError(
76
+ `Unsupported column sort type ${columnSortType}`,
77
+ );
78
+ }
79
+ };
@@ -56,7 +56,10 @@ import {
56
56
  DEFAULT_LAMBDA_VARIABLE_NAME,
57
57
  QUERY_BUILDER_SOURCE_ID_LABEL,
58
58
  } from '../../QueryBuilderConfig.js';
59
- import { QueryBuilderAggregationState } from './aggregation/QueryBuilderAggregationState.js';
59
+ import {
60
+ QueryBuilderAggregateColumnState,
61
+ QueryBuilderAggregationState,
62
+ } from './aggregation/QueryBuilderAggregationState.js';
60
63
  import { buildGenericLambdaFunctionInstanceValue } from '../../QueryBuilderValueSpecificationHelper.js';
61
64
  import {
62
65
  FETCH_STRUCTURE_IMPLEMENTATION,
@@ -88,6 +91,10 @@ import type { LambdaFunctionBuilderOption } from '../../QueryBuilderValueSpecifi
88
91
  import { appendProjection } from './projection/QueryBuilderProjectionValueSpecificationBuilder.js';
89
92
  import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../../graphManager/QueryBuilderSupportedFunctions.js';
90
93
  import { QUERY_BUILDER_HASH_STRUCTURE } from '../../../graphManager/QueryBuilderHashUtils.js';
94
+ import { QueryBuilderOlapGroupByState } from './olapGroupBy/QueryBuilderOlapGroupByState.js';
95
+ import type { QueryBuilderTDSOlapOperator } from './olapGroupBy/operators/QueryBuilderTDSOlapOperator_.js';
96
+ import { getQueryBuilderCoreOlapGroupByOperators } from './olapGroupBy/QueryBuilderOlapGroupByOperatorLoader.js';
97
+ import type { QueryBuilderTDSColumnState } from './QueryBuilderTDSColumnState_.js';
91
98
 
92
99
  export class QueryBuilderTDSState
93
100
  extends QueryBuilderFetchStructureImplementationState
@@ -95,15 +102,19 @@ export class QueryBuilderTDSState
95
102
  {
96
103
  readonly aggregationState: QueryBuilderAggregationState;
97
104
  readonly postFilterState: QueryBuilderPostFilterState;
105
+ readonly olapGroupByState: QueryBuilderOlapGroupByState;
98
106
  readonly resultSetModifierState: QueryResultSetModifierState;
99
107
  projectionColumns: QueryBuilderProjectionColumnState[] = [];
100
108
  isConvertDerivationProjectionObjects = false;
101
109
  showPostFilterPanel = false;
110
+ showOlapGroupByPanel = false;
102
111
 
103
112
  postFilterOperators: QueryBuilderPostFilterOperator[] =
104
113
  getQueryBuilderCorePostFilterOperators();
105
114
  aggregationOperators: QueryBuilderAggregateOperator[] =
106
115
  getQueryBuilderCoreAggregrationOperators();
116
+ olapGroupByOperators: QueryBuilderTDSOlapOperator[] =
117
+ getQueryBuilderCoreOlapGroupByOperators();
107
118
 
108
119
  constructor(
109
120
  queryBuilderState: QueryBuilderState,
@@ -115,12 +126,15 @@ export class QueryBuilderTDSState
115
126
  projectionColumns: observable,
116
127
  isConvertDerivationProjectionObjects: observable,
117
128
  showPostFilterPanel: observable,
129
+ showOlapGroupByPanel: observable,
130
+ TEMPORARY__showPostFetchStructurePanel: computed,
118
131
  derivations: computed,
119
132
  hasParserError: computed,
120
133
  addColumn: action,
121
134
  moveColumn: action,
122
135
  replaceColumn: action,
123
136
  setShowPostFilterPanel: action,
137
+ setShowOlapGroupByPanel: action,
124
138
  convertDerivationProjectionObjects: flow,
125
139
  });
126
140
 
@@ -133,6 +147,10 @@ export class QueryBuilderTDSState
133
147
  this,
134
148
  this.aggregationOperators,
135
149
  );
150
+ this.olapGroupByState = new QueryBuilderOlapGroupByState(
151
+ this,
152
+ this.olapGroupByOperators,
153
+ );
136
154
  }
137
155
 
138
156
  get type(): string {
@@ -151,6 +169,14 @@ export class QueryBuilderTDSState
151
169
  );
152
170
  }
153
171
 
172
+ override get TEMPORARY__showPostFetchStructurePanel(): boolean {
173
+ return (
174
+ this.queryBuilderState.filterState.showPanel ||
175
+ this.showOlapGroupByPanel ||
176
+ this.showPostFilterPanel
177
+ );
178
+ }
179
+
154
180
  get usedExplorerTreePropertyNodeIDs(): string[] {
155
181
  let nodeIDs: string[] = [];
156
182
  this.projectionColumns.forEach((column) => {
@@ -241,6 +267,43 @@ export class QueryBuilderTDSState
241
267
  return undefined;
242
268
  }
243
269
 
270
+ get tdsColumns(): QueryBuilderTDSColumnState[] {
271
+ const aggregationStateCols = this.aggregationState.columns.map(
272
+ (c) => c.projectionColumnState,
273
+ );
274
+ // remove projection columns in aggregation
275
+ const projectionColumns = this.projectionColumns.filter(
276
+ (c) => !aggregationStateCols.includes(c),
277
+ );
278
+ return [
279
+ ...this.aggregationState.columns,
280
+ ...projectionColumns,
281
+ ...this.olapGroupByState.olapColumns,
282
+ ];
283
+ }
284
+
285
+ isDuplicateColumn(col: QueryBuilderTDSColumnState): boolean {
286
+ return (
287
+ this.tdsColumns.filter((c) => c.columnName === col.columnName).length > 1
288
+ );
289
+ }
290
+
291
+ isColumnInUse(tdsCol: QueryBuilderTDSColumnState): boolean {
292
+ return Boolean(
293
+ [
294
+ ...this.postFilterState.referencedTDSColumns,
295
+ ...this.olapGroupByState.referencedTDSColumns,
296
+ ].find((col) => {
297
+ if (col instanceof QueryBuilderAggregateColumnState) {
298
+ return tdsCol instanceof QueryBuilderAggregateColumnState
299
+ ? tdsCol === col
300
+ : col.projectionColumnState === tdsCol;
301
+ }
302
+ return col === tdsCol;
303
+ }),
304
+ );
305
+ }
306
+
244
307
  onClassChange(_class: Class | undefined): void {
245
308
  return;
246
309
  }
@@ -256,6 +319,10 @@ export class QueryBuilderTDSState
256
319
  this.showPostFilterPanel = val;
257
320
  }
258
321
 
322
+ setShowOlapGroupByPanel(val: boolean): void {
323
+ this.showOlapGroupByPanel = val;
324
+ }
325
+
259
326
  *convertDerivationProjectionObjects(): GeneratorFn<void> {
260
327
  const lambdas = new Map<string, RawLambda>();
261
328
  const derivationProjectionColumnStateMap = new Map<
@@ -26,8 +26,8 @@ import {
26
26
  import { QUERY_BUILDER_HASH_STRUCTURE } from '../../../graphManager/QueryBuilderHashUtils.js';
27
27
 
28
28
  export enum COLUMN_SORT_TYPE {
29
- ASC,
30
- DESC,
29
+ ASC = 'ASC',
30
+ DESC = 'DESC',
31
31
  }
32
32
 
33
33
  export class SortColumnState implements Hashable {
@@ -84,7 +84,7 @@ export abstract class QueryBuilderAggregateOperator implements Hashable {
84
84
  */
85
85
  getReturnType(aggregateColumnState: QueryBuilderAggregateColumnState): Type {
86
86
  return guaranteeNonNullable(
87
- aggregateColumnState.projectionColumnState.getReturnType(),
87
+ aggregateColumnState.projectionColumnState.getColumnType(),
88
88
  );
89
89
  }
90
90
 
@@ -16,7 +16,6 @@
16
16
 
17
17
  import { action, computed, makeObservable, observable } from 'mobx';
18
18
  import {
19
- uuid,
20
19
  deleteEntry,
21
20
  addUniqueEntry,
22
21
  type Hashable,
@@ -28,9 +27,12 @@ import type { QueryBuilderTDSState } from '../QueryBuilderTDSState.js';
28
27
  import type { QueryBuilderAggregateOperator } from './QueryBuilderAggregateOperator.js';
29
28
  import type { QueryBuilderProjectionColumnState } from '../projection/QueryBuilderProjectionColumnState.js';
30
29
  import { QUERY_BUILDER_HASH_STRUCTURE } from '../../../../graphManager/QueryBuilderHashUtils.js';
30
+ import { QueryBuilderTDSColumnState } from '../QueryBuilderTDSColumnState_.js';
31
31
 
32
- export class QueryBuilderAggregateColumnState implements Hashable {
33
- readonly uuid = uuid();
32
+ export class QueryBuilderAggregateColumnState
33
+ extends QueryBuilderTDSColumnState
34
+ implements Hashable
35
+ {
34
36
  readonly aggregationState: QueryBuilderAggregationState;
35
37
  projectionColumnState: QueryBuilderProjectionColumnState;
36
38
  lambdaParameterName: string = DEFAULT_LAMBDA_VARIABLE_NAME;
@@ -41,6 +43,7 @@ export class QueryBuilderAggregateColumnState implements Hashable {
41
43
  projectionColumnState: QueryBuilderProjectionColumnState,
42
44
  operator: QueryBuilderAggregateOperator,
43
45
  ) {
46
+ super();
44
47
  makeObservable(this, {
45
48
  projectionColumnState: observable,
46
49
  lambdaParameterName: observable,
@@ -55,11 +58,6 @@ export class QueryBuilderAggregateColumnState implements Hashable {
55
58
  this.projectionColumnState = projectionColumnState;
56
59
  this.operator = operator;
57
60
  }
58
-
59
- get columnName(): string {
60
- return this.projectionColumnState.columnName;
61
- }
62
-
63
61
  setColumnState(val: QueryBuilderProjectionColumnState): void {
64
62
  this.projectionColumnState = val;
65
63
  }
@@ -72,7 +70,7 @@ export class QueryBuilderAggregateColumnState implements Hashable {
72
70
  this.operator = val;
73
71
  }
74
72
 
75
- getReturnType(): Type {
73
+ getColumnType(): Type {
76
74
  return this.operator.getReturnType(this);
77
75
  }
78
76
 
@@ -82,6 +80,10 @@ export class QueryBuilderAggregateColumnState implements Hashable {
82
80
  this.operator,
83
81
  ]);
84
82
  }
83
+
84
+ get columnName(): string {
85
+ return this.projectionColumnState.columnName;
86
+ }
85
87
  }
86
88
 
87
89
  export class QueryBuilderAggregationState implements Hashable {
@@ -0,0 +1,39 @@
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 type { QueryBuilderTDSOlapOperator } from './operators/QueryBuilderTDSOlapOperator_.js';
18
+ import { QueryBuilderTDSOlapRankOperator_AverageRank } from './operators/QueryBuilderTDSOlapRankOperator_AverageRank_.js';
19
+ import { QueryBuilderTDSOlapRankOperator_DenseRank } from './operators/QueryBuilderTDSOlapRankOperator_DenseRank_.js';
20
+ import { QueryBuilderTDSOlapRankOperator_Rank } from './operators/QueryBuilderTDSOlapRankOperator_Rank_.js';
21
+ import { QueryBuilderTDSOlapRankOperator_RowNumber } from './operators/QueryBuilderTDSOlapRankOperator_RowNumber_.js';
22
+ import { QueryBuilderTDSOlapOperator_Sum } from './operators/QueryBuilderTDSOlapOperator_Sum.js';
23
+ import { QueryBuilderTDSOlapOperator_Count } from './operators/QueryBuilderTDSOlapOperator_Count.js';
24
+ import { QueryBuilderTDSOlapOperator_Max } from './operators/QueryBuilderTDSOlapOperator_Max.js';
25
+ import { QueryBuilderTDSOlapOperator_Min } from './operators/QueryBuilderTDSOlapOperator_Min.js';
26
+ import { QueryBuilderTDSOlapOperator_Average } from './operators/QueryBuilderTDSOlapOperator_Average.js';
27
+
28
+ export const getQueryBuilderCoreOlapGroupByOperators =
29
+ (): QueryBuilderTDSOlapOperator[] => [
30
+ new QueryBuilderTDSOlapOperator_Sum(),
31
+ new QueryBuilderTDSOlapOperator_Count(),
32
+ new QueryBuilderTDSOlapOperator_Max(),
33
+ new QueryBuilderTDSOlapOperator_Min(),
34
+ new QueryBuilderTDSOlapOperator_Average(),
35
+ new QueryBuilderTDSOlapRankOperator_AverageRank(),
36
+ new QueryBuilderTDSOlapRankOperator_DenseRank(),
37
+ new QueryBuilderTDSOlapRankOperator_Rank(),
38
+ new QueryBuilderTDSOlapRankOperator_RowNumber(),
39
+ ];