@finos/legend-query-builder 4.17.99 → 4.18.0

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 (268) hide show
  1. package/lib/components/QueryBuilder.d.ts.map +1 -1
  2. package/lib/components/QueryBuilder.js +2 -1
  3. package/lib/components/QueryBuilder.js.map +1 -1
  4. package/lib/components/QueryBuilderSideBar.d.ts.map +1 -1
  5. package/lib/components/QueryBuilderSideBar.js +9 -8
  6. package/lib/components/QueryBuilderSideBar.js.map +1 -1
  7. package/lib/components/explorer/QueryBuilderExplorerPanel.d.ts.map +1 -1
  8. package/lib/components/explorer/QueryBuilderExplorerPanel.js +48 -5
  9. package/lib/components/explorer/QueryBuilderExplorerPanel.js.map +1 -1
  10. package/lib/components/explorer/QueryBuilderRelationExplorerPanel.d.ts +24 -0
  11. package/lib/components/explorer/QueryBuilderRelationExplorerPanel.d.ts.map +1 -0
  12. package/lib/components/explorer/QueryBuilderRelationExplorerPanel.js +202 -0
  13. package/lib/components/explorer/QueryBuilderRelationExplorerPanel.js.map +1 -0
  14. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.d.ts.map +1 -1
  15. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js.map +1 -1
  16. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js +3 -3
  17. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js.map +1 -1
  18. package/lib/components/fetch-structure/QueryBuilderTDSPanel.d.ts.map +1 -1
  19. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js +25 -6
  20. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js.map +1 -1
  21. package/lib/components/result/QueryBuilderResultPanel.d.ts.map +1 -1
  22. package/lib/components/result/QueryBuilderResultPanel.js +1 -1
  23. package/lib/components/result/QueryBuilderResultPanel.js.map +1 -1
  24. package/lib/components/result/tds/QueryBuilderTDSAsyncCellSelectionStats.d.ts +42 -0
  25. package/lib/components/result/tds/QueryBuilderTDSAsyncCellSelectionStats.d.ts.map +1 -0
  26. package/lib/components/result/tds/QueryBuilderTDSAsyncCellSelectionStats.js +212 -0
  27. package/lib/components/result/tds/QueryBuilderTDSAsyncCellSelectionStats.js.map +1 -0
  28. package/lib/components/result/tds/QueryBuilderTDSCellSelectionStats.d.ts +66 -0
  29. package/lib/components/result/tds/QueryBuilderTDSCellSelectionStats.d.ts.map +1 -0
  30. package/lib/components/result/tds/QueryBuilderTDSCellSelectionStats.js +265 -0
  31. package/lib/components/result/tds/QueryBuilderTDSCellSelectionStats.js.map +1 -0
  32. package/lib/components/result/tds/QueryBuilderTDSCellSelectionStatsBar.d.ts +28 -0
  33. package/lib/components/result/tds/QueryBuilderTDSCellSelectionStatsBar.d.ts.map +1 -0
  34. package/lib/components/result/tds/QueryBuilderTDSCellSelectionStatsBar.js +148 -0
  35. package/lib/components/result/tds/QueryBuilderTDSCellSelectionStatsBar.js.map +1 -0
  36. package/lib/components/result/tds/QueryBuilderTDSGridKeyboardShortcuts.d.ts +19 -0
  37. package/lib/components/result/tds/QueryBuilderTDSGridKeyboardShortcuts.d.ts.map +1 -0
  38. package/lib/components/result/tds/QueryBuilderTDSGridKeyboardShortcuts.js +196 -0
  39. package/lib/components/result/tds/QueryBuilderTDSGridKeyboardShortcuts.js.map +1 -0
  40. package/lib/components/result/tds/QueryBuilderTDSGridResult.d.ts +5 -0
  41. package/lib/components/result/tds/QueryBuilderTDSGridResult.d.ts.map +1 -1
  42. package/lib/components/result/tds/QueryBuilderTDSGridResult.js +64 -87
  43. package/lib/components/result/tds/QueryBuilderTDSGridResult.js.map +1 -1
  44. package/lib/components/result/tds/QueryBuilderTDSGridShared.d.ts +26 -0
  45. package/lib/components/result/tds/QueryBuilderTDSGridShared.d.ts.map +1 -0
  46. package/lib/components/result/tds/QueryBuilderTDSGridShared.js +51 -0
  47. package/lib/components/result/tds/QueryBuilderTDSGridShared.js.map +1 -0
  48. package/lib/components/result/tds/QueryBuilderTDSSimpleGridResult.d.ts +5 -0
  49. package/lib/components/result/tds/QueryBuilderTDSSimpleGridResult.d.ts.map +1 -1
  50. package/lib/components/result/tds/QueryBuilderTDSSimpleGridResult.js +169 -60
  51. package/lib/components/result/tds/QueryBuilderTDSSimpleGridResult.js.map +1 -1
  52. package/lib/components/workflows/AccessorQueryBuilder.d.ts +18 -0
  53. package/lib/components/workflows/AccessorQueryBuilder.d.ts.map +1 -0
  54. package/lib/components/workflows/AccessorQueryBuilder.js +87 -0
  55. package/lib/components/workflows/AccessorQueryBuilder.js.map +1 -0
  56. package/lib/components/workflows/ClassQueryBuilder.js +5 -5
  57. package/lib/components/workflows/ClassQueryBuilder.js.map +1 -1
  58. package/lib/data-access-overview.css +1 -1
  59. package/lib/graph/QueryBuilderMetaModelConst.d.ts +4 -0
  60. package/lib/graph/QueryBuilderMetaModelConst.d.ts.map +1 -1
  61. package/lib/graph/QueryBuilderMetaModelConst.js +4 -0
  62. package/lib/graph/QueryBuilderMetaModelConst.js.map +1 -1
  63. package/lib/graph-manager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.d.ts.map +1 -1
  64. package/lib/graph-manager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.js +7 -1
  65. package/lib/graph-manager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.js.map +1 -1
  66. package/lib/graph-manager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.d.ts +2 -0
  67. package/lib/graph-manager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.d.ts.map +1 -1
  68. package/lib/graph-manager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.js +93 -3
  69. package/lib/graph-manager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.js.map +1 -1
  70. package/lib/index.css +2 -2
  71. package/lib/index.css.map +1 -1
  72. package/lib/index.d.ts +2 -0
  73. package/lib/index.d.ts.map +1 -1
  74. package/lib/index.js +2 -0
  75. package/lib/index.js.map +1 -1
  76. package/lib/package.json +1 -1
  77. package/lib/stores/QueryBuilderConfig.d.ts +3 -0
  78. package/lib/stores/QueryBuilderConfig.d.ts.map +1 -1
  79. package/lib/stores/QueryBuilderConfig.js +3 -0
  80. package/lib/stores/QueryBuilderConfig.js.map +1 -1
  81. package/lib/stores/QueryBuilderResultState.d.ts.map +1 -1
  82. package/lib/stores/QueryBuilderResultState.js +13 -3
  83. package/lib/stores/QueryBuilderResultState.js.map +1 -1
  84. package/lib/stores/QueryBuilderState.d.ts +14 -4
  85. package/lib/stores/QueryBuilderState.d.ts.map +1 -1
  86. package/lib/stores/QueryBuilderState.js +41 -13
  87. package/lib/stores/QueryBuilderState.js.map +1 -1
  88. package/lib/stores/QueryBuilderStateBuilder.d.ts +2 -1
  89. package/lib/stores/QueryBuilderStateBuilder.d.ts.map +1 -1
  90. package/lib/stores/QueryBuilderStateBuilder.js +51 -20
  91. package/lib/stores/QueryBuilderStateBuilder.js.map +1 -1
  92. package/lib/stores/QueryBuilderStateHashUtils.d.ts +1 -0
  93. package/lib/stores/QueryBuilderStateHashUtils.d.ts.map +1 -1
  94. package/lib/stores/QueryBuilderStateHashUtils.js +1 -0
  95. package/lib/stores/QueryBuilderStateHashUtils.js.map +1 -1
  96. package/lib/stores/QueryBuilderTypeaheadHelper.js +2 -2
  97. package/lib/stores/QueryBuilderTypeaheadHelper.js.map +1 -1
  98. package/lib/stores/QueryBuilderValueSpecificationBuilder.d.ts +1 -1
  99. package/lib/stores/QueryBuilderValueSpecificationBuilder.d.ts.map +1 -1
  100. package/lib/stores/QueryBuilderValueSpecificationBuilder.js +54 -45
  101. package/lib/stores/QueryBuilderValueSpecificationBuilder.js.map +1 -1
  102. package/lib/stores/__test-utils__/QueryBuilderStateTestUtils.js +1 -1
  103. package/lib/stores/__test-utils__/QueryBuilderStateTestUtils.js.map +1 -1
  104. package/lib/stores/explorer/QueryBuilderExplorerState.d.ts +12 -2
  105. package/lib/stores/explorer/QueryBuilderExplorerState.d.ts.map +1 -1
  106. package/lib/stores/explorer/QueryBuilderExplorerState.js +12 -2
  107. package/lib/stores/explorer/QueryBuilderExplorerState.js.map +1 -1
  108. package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.d.ts +2 -2
  109. package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.d.ts.map +1 -1
  110. package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.js.map +1 -1
  111. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.d.ts +2 -2
  112. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.d.ts.map +1 -1
  113. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.js +4 -3
  114. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.js.map +1 -1
  115. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.js +1 -1
  116. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.js.map +1 -1
  117. package/lib/stores/fetch-structure/tds/QueryBuilderTDSHelper.d.ts +2 -0
  118. package/lib/stores/fetch-structure/tds/QueryBuilderTDSHelper.d.ts.map +1 -1
  119. package/lib/stores/fetch-structure/tds/QueryBuilderTDSHelper.js +19 -0
  120. package/lib/stores/fetch-structure/tds/QueryBuilderTDSHelper.js.map +1 -1
  121. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts +7 -4
  122. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts.map +1 -1
  123. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js +59 -12
  124. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js.map +1 -1
  125. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.d.ts +16 -3
  126. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.d.ts.map +1 -1
  127. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.js +102 -24
  128. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.js.map +1 -1
  129. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.d.ts +2 -1
  130. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.d.ts.map +1 -1
  131. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.js +16 -1
  132. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.js.map +1 -1
  133. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.js +3 -3
  134. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.js.map +1 -1
  135. package/lib/stores/fetch-structure/tds/projection/QueryBuilderRelationProjectValueSpecBuilder.d.ts.map +1 -1
  136. package/lib/stores/fetch-structure/tds/projection/QueryBuilderRelationProjectValueSpecBuilder.js +11 -2
  137. package/lib/stores/fetch-structure/tds/projection/QueryBuilderRelationProjectValueSpecBuilder.js.map +1 -1
  138. package/lib/stores/fetch-structure/tds/projection/QueryBuilderTypedProjectionStateBuilder.d.ts.map +1 -1
  139. package/lib/stores/fetch-structure/tds/projection/QueryBuilderTypedProjectionStateBuilder.js +16 -12
  140. package/lib/stores/fetch-structure/tds/projection/QueryBuilderTypedProjectionStateBuilder.js.map +1 -1
  141. package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowState.d.ts +4 -3
  142. package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowState.d.ts.map +1 -1
  143. package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowState.js +19 -9
  144. package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowState.js.map +1 -1
  145. package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowStateBuilder.d.ts +1 -0
  146. package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowStateBuilder.d.ts.map +1 -1
  147. package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowStateBuilder.js +57 -5
  148. package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowStateBuilder.js.map +1 -1
  149. package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowValueSpecificationBuilder.d.ts +4 -3
  150. package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowValueSpecificationBuilder.d.ts.map +1 -1
  151. package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowValueSpecificationBuilder.js +85 -6
  152. package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowValueSpecificationBuilder.js.map +1 -1
  153. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator.d.ts +1 -0
  154. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator.d.ts.map +1 -1
  155. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator.js.map +1 -1
  156. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Average.d.ts +1 -0
  157. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Average.d.ts.map +1 -1
  158. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Average.js +3 -0
  159. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Average.js.map +1 -1
  160. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Count.d.ts +1 -0
  161. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Count.d.ts.map +1 -1
  162. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Count.js +3 -0
  163. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Count.js.map +1 -1
  164. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Max.d.ts +1 -0
  165. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Max.d.ts.map +1 -1
  166. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Max.js +3 -0
  167. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Max.js.map +1 -1
  168. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Min.d.ts +1 -0
  169. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Min.d.ts.map +1 -1
  170. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Min.js +3 -0
  171. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Min.js.map +1 -1
  172. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Sum.d.ts +1 -0
  173. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Sum.d.ts.map +1 -1
  174. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Sum.js +3 -0
  175. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Sum.js.map +1 -1
  176. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_AverageRank.d.ts +1 -0
  177. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_AverageRank.d.ts.map +1 -1
  178. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_AverageRank.js +4 -0
  179. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_AverageRank.js.map +1 -1
  180. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_DenseRank.d.ts +1 -0
  181. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_DenseRank.d.ts.map +1 -1
  182. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_DenseRank.js +3 -0
  183. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_DenseRank.js.map +1 -1
  184. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_Rank.d.ts +1 -0
  185. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_Rank.d.ts.map +1 -1
  186. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_Rank.js +3 -0
  187. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_Rank.js.map +1 -1
  188. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_RowNumber.d.ts +1 -0
  189. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_RowNumber.d.ts.map +1 -1
  190. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_RowNumber.js +3 -0
  191. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_RowNumber.js.map +1 -1
  192. package/lib/stores/milestoning/QueryBuilderMilestoningState.js +4 -4
  193. package/lib/stores/milestoning/QueryBuilderMilestoningState.js.map +1 -1
  194. package/lib/stores/workflows/MappingQueryBuilderState.js +2 -2
  195. package/lib/stores/workflows/MappingQueryBuilderState.js.map +1 -1
  196. package/lib/stores/workflows/ServiceQueryBuilderState.js +2 -2
  197. package/lib/stores/workflows/ServiceQueryBuilderState.js.map +1 -1
  198. package/lib/stores/workflows/accessor/AccessorQueryBuilderHelper.d.ts +18 -0
  199. package/lib/stores/workflows/accessor/AccessorQueryBuilderHelper.d.ts.map +1 -0
  200. package/lib/stores/workflows/accessor/AccessorQueryBuilderHelper.js +32 -0
  201. package/lib/stores/workflows/accessor/AccessorQueryBuilderHelper.js.map +1 -0
  202. package/lib/stores/workflows/accessor/AccessorQueryBuilderState.d.ts +57 -0
  203. package/lib/stores/workflows/accessor/AccessorQueryBuilderState.d.ts.map +1 -0
  204. package/lib/stores/workflows/accessor/AccessorQueryBuilderState.js +125 -0
  205. package/lib/stores/workflows/accessor/AccessorQueryBuilderState.js.map +1 -0
  206. package/lib/stores/workflows/dataProduct/DataProductQueryBuilderState.js +4 -4
  207. package/lib/stores/workflows/dataProduct/DataProductQueryBuilderState.js.map +1 -1
  208. package/package.json +7 -7
  209. package/src/components/QueryBuilder.tsx +2 -1
  210. package/src/components/QueryBuilderSideBar.tsx +12 -8
  211. package/src/components/explorer/QueryBuilderExplorerPanel.tsx +77 -14
  212. package/src/components/explorer/QueryBuilderRelationExplorerPanel.tsx +536 -0
  213. package/src/components/fetch-structure/QueryBuilderPostFilterPanel.tsx +1 -0
  214. package/src/components/fetch-structure/QueryBuilderResultModifierPanel.tsx +3 -3
  215. package/src/components/fetch-structure/QueryBuilderTDSPanel.tsx +62 -4
  216. package/src/components/result/QueryBuilderResultPanel.tsx +6 -2
  217. package/src/components/result/tds/QueryBuilderTDSAsyncCellSelectionStats.ts +254 -0
  218. package/src/components/result/tds/QueryBuilderTDSCellSelectionStats.ts +397 -0
  219. package/src/components/result/tds/QueryBuilderTDSCellSelectionStatsBar.tsx +439 -0
  220. package/src/components/result/tds/QueryBuilderTDSGridKeyboardShortcuts.ts +270 -0
  221. package/src/components/result/tds/QueryBuilderTDSGridResult.tsx +107 -112
  222. package/src/components/result/tds/QueryBuilderTDSGridShared.ts +76 -0
  223. package/src/components/result/tds/QueryBuilderTDSSimpleGridResult.tsx +272 -99
  224. package/src/components/workflows/AccessorQueryBuilder.tsx +211 -0
  225. package/src/components/workflows/ClassQueryBuilder.tsx +5 -5
  226. package/src/graph/QueryBuilderMetaModelConst.ts +5 -0
  227. package/src/graph-manager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.ts +28 -0
  228. package/src/graph-manager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.ts +223 -4
  229. package/src/index.ts +2 -0
  230. package/src/stores/QueryBuilderConfig.ts +3 -0
  231. package/src/stores/QueryBuilderResultState.ts +22 -9
  232. package/src/stores/QueryBuilderState.ts +47 -12
  233. package/src/stores/QueryBuilderStateBuilder.ts +107 -43
  234. package/src/stores/QueryBuilderStateHashUtils.ts +1 -0
  235. package/src/stores/QueryBuilderTypeaheadHelper.ts +2 -2
  236. package/src/stores/QueryBuilderValueSpecificationBuilder.ts +72 -59
  237. package/src/stores/__test-utils__/QueryBuilderStateTestUtils.ts +1 -1
  238. package/src/stores/explorer/QueryBuilderExplorerState.ts +26 -2
  239. package/src/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.ts +1 -2
  240. package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.ts +4 -3
  241. package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.ts +1 -1
  242. package/src/stores/fetch-structure/tds/QueryBuilderTDSHelper.ts +42 -0
  243. package/src/stores/fetch-structure/tds/QueryBuilderTDSState.ts +135 -19
  244. package/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.ts +197 -38
  245. package/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.ts +30 -0
  246. package/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.ts +3 -3
  247. package/src/stores/fetch-structure/tds/projection/QueryBuilderRelationProjectValueSpecBuilder.ts +21 -0
  248. package/src/stores/fetch-structure/tds/projection/QueryBuilderTypedProjectionStateBuilder.ts +25 -16
  249. package/src/stores/fetch-structure/tds/window/QueryBuilderWindowState.ts +23 -9
  250. package/src/stores/fetch-structure/tds/window/QueryBuilderWindowStateBuilder.ts +146 -4
  251. package/src/stores/fetch-structure/tds/window/QueryBuilderWindowValueSpecificationBuilder.ts +145 -10
  252. package/src/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator.ts +2 -0
  253. package/src/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Average.ts +4 -0
  254. package/src/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Count.ts +4 -0
  255. package/src/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Max.ts +4 -0
  256. package/src/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Min.ts +4 -0
  257. package/src/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Sum.ts +4 -0
  258. package/src/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_AverageRank.ts +5 -0
  259. package/src/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_DenseRank.ts +4 -0
  260. package/src/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_Rank.ts +4 -0
  261. package/src/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_RowNumber.ts +4 -0
  262. package/src/stores/milestoning/QueryBuilderMilestoningState.ts +4 -4
  263. package/src/stores/workflows/MappingQueryBuilderState.ts +2 -2
  264. package/src/stores/workflows/ServiceQueryBuilderState.ts +2 -2
  265. package/src/stores/workflows/accessor/AccessorQueryBuilderHelper.ts +51 -0
  266. package/src/stores/workflows/accessor/AccessorQueryBuilderState.ts +195 -0
  267. package/src/stores/workflows/dataProduct/DataProductQueryBuilderState.ts +4 -4
  268. package/tsconfig.json +9 -0
@@ -19,9 +19,14 @@ import {
19
19
  SimpleFunctionExpression,
20
20
  matchFunctionName,
21
21
  ColSpecArrayInstance,
22
+ AccessorInstanceValue,
22
23
  } from '@finos/legend-graph';
23
24
  import { FETCH_STRUCTURE_IMPLEMENTATION } from '../../QueryBuilderFetchStructureImplementationState.js';
24
- import { assertTrue, assertType, guaranteeType } from '@finos/legend-shared';
25
+ import {
26
+ assertTrue,
27
+ assertType,
28
+ guaranteeNonNullable,
29
+ } from '@finos/legend-shared';
25
30
  import {
26
31
  QUERY_BUILDER_LAMBDA_WRITER_MODE,
27
32
  type QueryBuilderState,
@@ -47,24 +52,28 @@ export const processTypedTDSProjectExpression = (
47
52
  FETCH_STRUCTURE_IMPLEMENTATION.TABULAR_DATA_STRUCTURE,
48
53
  );
49
54
 
50
- // check preceding expression
51
- const precedingExpression = guaranteeType(
55
+ const _precedingExpression = guaranteeNonNullable(
52
56
  expression.parametersValues[0],
53
- SimpleFunctionExpression,
54
- `Can't process typed project() expression: only support typed project() immediately following an expression`,
55
- );
56
- assertTrue(
57
- matchFunctionName(precedingExpression.functionName, [
58
- QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS.GET_ALL,
59
- QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS.GET_ALL_VERSIONS,
60
- QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS.GET_ALL_VERSIONS_IN_RANGE,
61
- QUERY_BUILDER_SUPPORTED_FUNCTIONS.FILTER,
62
- QUERY_BUILDER_SUPPORTED_FUNCTIONS.WATERMARK,
63
- ]),
64
- `Can't process typed project() expression: only support typed project() immediately following either getAll(), filter(), or forWatermark()`,
57
+ `Can't process typed project() expression: missing preceding expression`,
65
58
  );
59
+ if (_precedingExpression instanceof SimpleFunctionExpression) {
60
+ assertTrue(
61
+ matchFunctionName(_precedingExpression.functionName, [
62
+ QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS.GET_ALL,
63
+ QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS.GET_ALL_VERSIONS,
64
+ QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS.GET_ALL_VERSIONS_IN_RANGE,
65
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.FILTER,
66
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.WATERMARK,
67
+ ]),
68
+ `Can't process typed project() expression: only support typed project() immediately following either getAll(), filter(), or forWatermark()`,
69
+ );
70
+ } else if (!(_precedingExpression instanceof AccessorInstanceValue)) {
71
+ throw new Error(
72
+ `Can't process typed project() expression: the first argument is expected to be either a function expression or a Accessor Instance Value`,
73
+ );
74
+ }
66
75
  QueryBuilderValueSpecificationProcessor.process(
67
- precedingExpression,
76
+ _precedingExpression,
68
77
  parentLambda,
69
78
  queryBuilderState,
70
79
  );
@@ -85,7 +85,7 @@ export class WindowGroupByColumnSortByState implements Hashable {
85
85
 
86
86
  export abstract class QueryBuilderTDS_WindowOperatorState implements Hashable {
87
87
  readonly windowState: QueryBuilderWindowState;
88
- lambdaParameterName: string = DEFAULT_LAMBDA_VARIABLE_NAME;
88
+ lambdaParameterNames: string[] = [DEFAULT_LAMBDA_VARIABLE_NAME];
89
89
  operator: QueryBuilderTDS_WindowOperator;
90
90
 
91
91
  constructor(
@@ -96,8 +96,12 @@ export abstract class QueryBuilderTDS_WindowOperatorState implements Hashable {
96
96
  this.operator = operator;
97
97
  }
98
98
 
99
- setLambdaParameterName(paramName: string): void {
100
- this.lambdaParameterName = paramName;
99
+ setLambdaParameterNames(paramNames: string[]): void {
100
+ this.lambdaParameterNames = paramNames;
101
+ }
102
+
103
+ addParameterName(paramName: string): void {
104
+ this.lambdaParameterNames.push(paramName);
101
105
  }
102
106
 
103
107
  setOperator(val: QueryBuilderTDS_WindowOperator): void {
@@ -107,7 +111,7 @@ export abstract class QueryBuilderTDS_WindowOperatorState implements Hashable {
107
111
  get hashCode(): string {
108
112
  return hashArray([
109
113
  QUERY_BUILDER_STATE_HASH_STRUCTURE.TDS_WINDOW_GROUPBY_OPERATION_STATE,
110
- this.lambdaParameterName,
114
+ hashArray(this.lambdaParameterNames),
111
115
  this.operator,
112
116
  ]);
113
117
  }
@@ -120,7 +124,7 @@ export class QueryBuilderTDS_WindowRankOperatorState extends QueryBuilderTDS_Win
120
124
  ) {
121
125
  super(windowState, operator);
122
126
  makeObservable(this, {
123
- setLambdaParameterName: action,
127
+ setLambdaParameterNames: action,
124
128
  });
125
129
  }
126
130
  }
@@ -136,7 +140,7 @@ export class QueryBuilderTDS_WindowAggreationOperatorState extends QueryBuilderT
136
140
  makeObservable(this, {
137
141
  columnState: observable,
138
142
  setColumnState: action,
139
- setLambdaParameterName: action,
143
+ setLambdaParameterNames: action,
140
144
  });
141
145
  this.columnState = columnState;
142
146
  }
@@ -148,7 +152,7 @@ export class QueryBuilderTDS_WindowAggreationOperatorState extends QueryBuilderT
148
152
  override get hashCode(): string {
149
153
  return hashArray([
150
154
  QUERY_BUILDER_STATE_HASH_STRUCTURE.TDS_WINDOW_GROUPBY_AGG_OPERATOR_STATE,
151
- this.lambdaParameterName,
155
+ hashArray(this.lambdaParameterNames),
152
156
  this.operator,
153
157
  this.columnState.columnName,
154
158
  ]);
@@ -446,8 +450,18 @@ export class QueryBuilderWindowState implements Hashable {
446
450
  this.editColumn = col;
447
451
  }
448
452
 
449
- findOperator(func: string): QueryBuilderTDS_WindowOperator | undefined {
450
- return this.operators.find((o) => matchFunctionName(func, o.pureFunc));
453
+ findOperator(
454
+ func: string,
455
+ typed?: boolean,
456
+ ): QueryBuilderTDS_WindowOperator | undefined {
457
+ return this.operators.find((operator) => {
458
+ const operatorFunction = typed
459
+ ? operator.relationFunc
460
+ : operator.pureFunc;
461
+ return operatorFunction
462
+ ? matchFunctionName(func, operatorFunction)
463
+ : undefined;
464
+ });
451
465
  }
452
466
 
453
467
  addWindowColumn(windowCol: QueryBuilderWindowColumnState): void {
@@ -16,6 +16,9 @@
16
16
 
17
17
  import {
18
18
  CollectionInstanceValue,
19
+ type ColSpec,
20
+ ColSpecArrayInstance,
21
+ ColSpecInstanceValue,
19
22
  LambdaFunction,
20
23
  LambdaFunctionInstanceValue,
21
24
  matchFunctionName,
@@ -29,6 +32,7 @@ import {
29
32
  guaranteeIsString,
30
33
  guaranteeNonNullable,
31
34
  guaranteeType,
35
+ UnsupportedOperationError,
32
36
  } from '@finos/legend-shared';
33
37
  import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../../../graph/QueryBuilderMetaModelConst.js';
34
38
  import type { QueryBuilderState } from '../../../QueryBuilderState.js';
@@ -36,6 +40,7 @@ import { QueryBuilderValueSpecificationProcessor } from '../../../QueryBuilderSt
36
40
  import {
37
41
  getTDSColumnState,
38
42
  getTDSColSortTypeFromFunctionName,
43
+ getRelationSortColumnFromFunctionName,
39
44
  } from '../QueryBuilderTDSHelper.js';
40
45
  import { QueryBuilderTDSState } from '../QueryBuilderTDSState.js';
41
46
  import {
@@ -45,6 +50,7 @@ import {
45
50
  QueryBuilderTDS_WindowAggreationOperatorState,
46
51
  QueryBuilderTDS_WindowRankOperatorState,
47
52
  } from './QueryBuilderWindowState.js';
53
+ import type { QueryBuilderTDSColumnState } from '../QueryBuilderTDSColumnState.js';
48
54
 
49
55
  export const processTDS_OLAPGroupByExpression = (
50
56
  expression: SimpleFunctionExpression,
@@ -179,13 +185,13 @@ export const processTDS_OLAPGroupByExpression = (
179
185
  operation,
180
186
  oppColumnState,
181
187
  );
182
- operatorState.setLambdaParameterName(
188
+ operatorState.setLambdaParameterNames([
183
189
  guaranteeType(
184
190
  operationLambda.functionType.parameters[0],
185
191
  VariableExpression,
186
192
  `Can't process olapGroupBy() operation lambda: only support olapGroupBy() operation lambda with 1 parameter of type 'VariableExpression'`,
187
193
  ).name,
188
- );
194
+ ]);
189
195
  } else {
190
196
  const operationLambda = guaranteeType(
191
197
  guaranteeType(olapOperationExpression, LambdaFunctionInstanceValue)
@@ -209,13 +215,13 @@ export const processTDS_OLAPGroupByExpression = (
209
215
  tdsState.windowState,
210
216
  operation,
211
217
  );
212
- operatorState.setLambdaParameterName(
218
+ operatorState.setLambdaParameterNames([
213
219
  guaranteeType(
214
220
  operationLambda.functionType.parameters[0],
215
221
  VariableExpression,
216
222
  `Can't process olapGroupBy() operation lambda: only support olapGroupBy() operation lambda with 1 parameter of type 'VariableExpression'`,
217
223
  ).name,
218
- );
224
+ ]);
219
225
  }
220
226
 
221
227
  // main col
@@ -237,3 +243,139 @@ export const processTDS_OLAPGroupByExpression = (
237
243
  tdsState.windowState.addWindowColumn(olapGroupByColumnState);
238
244
  tdsState.setShowWindowFuncPanel(true);
239
245
  };
246
+
247
+ const process_WindowOperatorState = (
248
+ colSpec: ColSpec,
249
+ tdsState: QueryBuilderTDSState,
250
+ ): QueryBuilderTDS_WindowOperatorState => {
251
+ //TODO: handle aggregation operators
252
+ const rankLambda = guaranteeType(
253
+ guaranteeType(colSpec.function1, LambdaFunctionInstanceValue).values[0],
254
+ LambdaFunction,
255
+ );
256
+ assertTrue(rankLambda.expressionSequence.length === 1);
257
+ const operationFunctionExp = guaranteeType(
258
+ rankLambda.expressionSequence[0],
259
+ SimpleFunctionExpression,
260
+ );
261
+
262
+ const operation = guaranteeNonNullable(
263
+ tdsState.windowState.findOperator(operationFunctionExp.functionName, true),
264
+ `Operator '${operationFunctionExp.functionName}' not supported yet for typed TDS`,
265
+ );
266
+
267
+ const operatorState = new QueryBuilderTDS_WindowRankOperatorState(
268
+ tdsState.windowState,
269
+ operation,
270
+ );
271
+
272
+ const operatorParameters: string[] = [];
273
+ rankLambda.functionType.parameters.forEach((param) => {
274
+ guaranteeType(param, VariableExpression);
275
+ operatorParameters.push(param.name);
276
+ });
277
+ operatorState.setLambdaParameterNames(operatorParameters);
278
+
279
+ return operatorState;
280
+ };
281
+
282
+ export const processTDS_ExtendExpression = (
283
+ expression: SimpleFunctionExpression,
284
+ queryBuilderState: QueryBuilderState,
285
+ parentLambda: LambdaFunction,
286
+ ): void => {
287
+ if (expression.parametersValues.length === 3) {
288
+ const relationExpression = guaranteeType(
289
+ expression.parametersValues[0],
290
+ SimpleFunctionExpression,
291
+ `Can't process extend() expression: only support extend() immediately following an expression`,
292
+ );
293
+ QueryBuilderValueSpecificationProcessor.process(
294
+ relationExpression,
295
+ parentLambda,
296
+ queryBuilderState,
297
+ );
298
+
299
+ const windowExpression = guaranteeType(
300
+ expression.parametersValues[1],
301
+ SimpleFunctionExpression,
302
+ `Can't process extend() expression: expects a window expression as the second parameter`,
303
+ );
304
+
305
+ const tdsState = guaranteeType(
306
+ queryBuilderState.fetchStructureState.implementation,
307
+ QueryBuilderTDSState,
308
+ );
309
+ //TODO: handle over() with ColSpec as the first parameter
310
+ const windowColumnsSpec = guaranteeType(
311
+ windowExpression.parametersValues[0],
312
+ ColSpecArrayInstance,
313
+ `Can't process over(): expects ColSpecArray for window columns`,
314
+ );
315
+
316
+ const windowColSpecArray = guaranteeNonNullable(
317
+ windowColumnsSpec.values[0],
318
+ );
319
+ const windowColumns: QueryBuilderTDSColumnState[] =
320
+ windowColSpecArray.colSpecs.map((colSpec) =>
321
+ getTDSColumnState(tdsState, colSpec.name),
322
+ );
323
+
324
+ let sortByState: WindowGroupByColumnSortByState | undefined;
325
+ if (
326
+ windowExpression.parametersValues[1] instanceof CollectionInstanceValue
327
+ ) {
328
+ const sortByExpression = guaranteeType(
329
+ windowExpression.parametersValues[1].values[0],
330
+ SimpleFunctionExpression,
331
+ `Can't process extend sortBy expression: only support function expression of 'ascending' or 'descending'`,
332
+ );
333
+
334
+ const sortByFunctionName = sortByExpression.functionName;
335
+ const colSortType =
336
+ getRelationSortColumnFromFunctionName(sortByFunctionName);
337
+ const colSortVal = guaranteeIsString(
338
+ guaranteeType(
339
+ sortByExpression.parametersValues[0],
340
+ ColSpecInstanceValue,
341
+ 'Can`t process extend sort column : extend sort column should be a colspec instance value',
342
+ ).values[0]?.name,
343
+ 'Can`t process extend sort column: extend sort column should be a string colspec instance value',
344
+ );
345
+ const sortColState = getTDSColumnState(tdsState, colSortVal);
346
+ sortByState = new WindowGroupByColumnSortByState(
347
+ sortColState,
348
+ colSortType,
349
+ );
350
+ }
351
+
352
+ //process third extend() parameter
353
+ const operatorColSpecInstance = guaranteeType(
354
+ expression.parametersValues[2],
355
+ ColSpecArrayInstance,
356
+ `Can't process extend(): expects ColSpecArrayInstance for aggregation columns`,
357
+ );
358
+ const operatorColSpecArray = guaranteeNonNullable(
359
+ operatorColSpecInstance.values[0],
360
+ );
361
+
362
+ operatorColSpecArray.colSpecs.forEach((colSpec) => {
363
+ const operatorState = process_WindowOperatorState(colSpec, tdsState);
364
+
365
+ const windowColumnState = new QueryBuilderWindowColumnState(
366
+ tdsState.windowState,
367
+ windowColumns,
368
+ sortByState,
369
+ operatorState,
370
+ colSpec.name,
371
+ );
372
+
373
+ tdsState.windowState.addWindowColumn(windowColumnState);
374
+ tdsState.setShowWindowFuncPanel(true);
375
+ });
376
+ } else {
377
+ throw new UnsupportedOperationError(
378
+ `Can't build relation extend() expression: extend() is not fully supported yet`,
379
+ );
380
+ }
381
+ };
@@ -25,16 +25,29 @@ import {
25
25
  VariableExpression,
26
26
  Multiplicity,
27
27
  PrimitiveType,
28
+ ColSpec,
29
+ ColSpecArray,
30
+ ColSpecArrayInstance,
31
+ ColSpecInstanceValue,
28
32
  } from '@finos/legend-graph';
29
33
  import { guaranteeNonNullable } from '@finos/legend-shared';
30
34
  import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../../../graph/QueryBuilderMetaModelConst.js';
31
35
  import { buildGenericLambdaFunctionInstanceValue } from '../../../QueryBuilderValueSpecificationHelper.js';
32
- import { getFunctionNameFromTDSSortColumn } from '../QueryBuilderTDSHelper.js';
36
+ import {
37
+ getFunctionNameFromTDSSortColumn,
38
+ getFunctionNameFromRelationSortColumn,
39
+ } from '../QueryBuilderTDSHelper.js';
33
40
  import {
34
41
  type QueryBuilderWindowColumnState,
35
42
  type QueryBuilderWindowState,
36
43
  QueryBuilderTDS_WindowAggreationOperatorState,
37
44
  } from './QueryBuilderWindowState.js';
45
+ import { DEFAULT_LAMBDA_VARIABLE_NAME } from '@finos/legend-data-cube';
46
+ import {
47
+ DEFAULT_WINDOW_FUNCTION_PARTITION_VAR_NAME,
48
+ DEFAULT_WINDOW_FUNCTION_ROW_VAR_NAME,
49
+ DEFAULT_WINDOW_FUNCTION_WINDOW_VAR_NAME,
50
+ } from '../../../QueryBuilderConfig.js';
38
51
 
39
52
  const appendOLAPGroupByColumnState = (
40
53
  olapGroupByColumnState: QueryBuilderWindowColumnState,
@@ -78,16 +91,15 @@ const appendOLAPGroupByColumnState = (
78
91
 
79
92
  // create olap operation expression
80
93
  const operationState = olapGroupByColumnState.operatorState;
94
+ const lambdaParameterName =
95
+ operationState.lambdaParameterNames[0] ?? DEFAULT_LAMBDA_VARIABLE_NAME;
81
96
  const olapFunc = extractElementNameFromPath(operationState.operator.pureFunc);
82
97
  const olapFuncExpression = new SimpleFunctionExpression(olapFunc);
83
98
  olapFuncExpression.parametersValues = [
84
- new VariableExpression(
85
- operationState.lambdaParameterName,
86
- Multiplicity.ONE,
87
- ),
99
+ new VariableExpression(lambdaParameterName, Multiplicity.ONE),
88
100
  ];
89
101
  const olapLambdaFuncInstance = buildGenericLambdaFunctionInstanceValue(
90
- operationState.lambdaParameterName,
102
+ lambdaParameterName,
91
103
  [olapFuncExpression],
92
104
  graph,
93
105
  );
@@ -132,12 +144,135 @@ const appendOLAPGroupByColumnState = (
132
144
  return lambda;
133
145
  };
134
146
 
135
- export const appendOLAPGroupByState = (
136
- olapGroupByState: QueryBuilderWindowState,
147
+ export const appendOverExpression = (
148
+ extendColumnState: QueryBuilderWindowColumnState,
149
+ ): SimpleFunctionExpression => {
150
+ const overExpression = new SimpleFunctionExpression(
151
+ extractElementNameFromPath(QUERY_BUILDER_SUPPORTED_FUNCTIONS.RELATION_OVER),
152
+ );
153
+
154
+ //TODO: handle over() where the first parameter is a ColSpec
155
+ const colSpecArrayInstance = new ColSpecArrayInstance(
156
+ Multiplicity.ONE,
157
+ undefined,
158
+ );
159
+ const colSpecArray = new ColSpecArray();
160
+ colSpecArrayInstance.values = [colSpecArray];
161
+
162
+ extendColumnState.windowColumns.forEach((column) => {
163
+ const colSpec = new ColSpec();
164
+ colSpec.name = column.columnName;
165
+ colSpecArray.colSpecs.push(colSpec);
166
+ });
167
+ overExpression.parametersValues.push(colSpecArrayInstance);
168
+
169
+ if (extendColumnState.sortByState) {
170
+ const sortByState = extendColumnState.sortByState;
171
+ const sortByFunction = new SimpleFunctionExpression(
172
+ getFunctionNameFromRelationSortColumn(sortByState.sortType),
173
+ );
174
+ const sortColSpec = new ColSpecInstanceValue(Multiplicity.ONE, undefined);
175
+ const sortCol = new ColSpec();
176
+ sortCol.name = sortByState.columnState.columnName;
177
+ sortColSpec.values = [sortCol];
178
+ sortByFunction.parametersValues[0] = sortColSpec;
179
+
180
+ const sortByCollection = new CollectionInstanceValue(Multiplicity.ONE);
181
+ sortByCollection.values = [sortByFunction];
182
+
183
+ overExpression.parametersValues.push(sortByCollection);
184
+ }
185
+
186
+ return overExpression;
187
+ };
188
+
189
+ const appendExtendColumnState = (
190
+ extendColumnState: QueryBuilderWindowColumnState,
137
191
  lambda: LambdaFunction,
138
192
  ): LambdaFunction => {
139
- olapGroupByState.windowColumns.forEach((c) =>
140
- appendOLAPGroupByColumnState(c, lambda),
193
+ const graph =
194
+ extendColumnState.windowState.tdsState.queryBuilderState.graphManagerState
195
+ .graph;
196
+
197
+ const overExpression = appendOverExpression(extendColumnState);
198
+
199
+ const operatorColSpecArrayInst = new ColSpecArrayInstance(
200
+ Multiplicity.ONE,
201
+ undefined,
202
+ );
203
+ const operatorColSpecArray = new ColSpecArray();
204
+ operatorColSpecArrayInst.values = [operatorColSpecArray];
205
+
206
+ const operatorColSpec = new ColSpec();
207
+ operatorColSpec.name = extendColumnState.columnName;
208
+
209
+ const operatorState = extendColumnState.operatorState;
210
+ if (operatorState.lambdaParameterNames.length === 1) {
211
+ //this was previously nontyped, so need to add window function parameters
212
+ operatorState.setLambdaParameterNames([
213
+ DEFAULT_WINDOW_FUNCTION_PARTITION_VAR_NAME,
214
+ DEFAULT_WINDOW_FUNCTION_WINDOW_VAR_NAME,
215
+ DEFAULT_WINDOW_FUNCTION_ROW_VAR_NAME,
216
+ ]);
217
+ }
218
+
219
+ //TODO: handle aggregation operators
220
+ const operatorFunc = extractElementNameFromPath(
221
+ operatorState.operator.pureFunc,
222
+ );
223
+ const operatorFuncExpression = new SimpleFunctionExpression(operatorFunc);
224
+
225
+ const lambdaParameters: VariableExpression[] = [];
226
+ operatorState.lambdaParameterNames.forEach((paramName) => {
227
+ lambdaParameters.push(new VariableExpression(paramName, Multiplicity.ONE));
228
+ });
229
+ operatorFuncExpression.parametersValues = lambdaParameters;
230
+
231
+ const rankLambda = buildGenericLambdaFunctionInstanceValue(
232
+ operatorState.lambdaParameterNames[0] ??
233
+ DEFAULT_WINDOW_FUNCTION_PARTITION_VAR_NAME,
234
+ [operatorFuncExpression],
235
+ graph,
141
236
  );
237
+
238
+ //skip over the first parameter since it was added in buildGenericLambdaFunctionInstanceValue()
239
+ lambdaParameters.slice(1).forEach((param) => {
240
+ rankLambda.values[0]?.functionType.parameters.push(param);
241
+ });
242
+ operatorColSpec.function1 = rankLambda;
243
+ operatorColSpecArray.colSpecs.push(operatorColSpec);
244
+
245
+ const extendExpression = new SimpleFunctionExpression(
246
+ extractElementNameFromPath(
247
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.RELATION_EXTEND,
248
+ ),
249
+ );
250
+
251
+ const currentExpression = guaranteeNonNullable(lambda.expressionSequence[0]);
252
+ extendExpression.parametersValues = [
253
+ currentExpression,
254
+ overExpression,
255
+ operatorColSpecArrayInst,
256
+ ];
257
+
258
+ lambda.expressionSequence[0] = extendExpression;
259
+ return lambda;
260
+ };
261
+
262
+ export const appendWindowFunctionState = (
263
+ olapGroupByState: QueryBuilderWindowState,
264
+ lambda: LambdaFunction,
265
+ ): LambdaFunction => {
266
+ const typedTds =
267
+ olapGroupByState.tdsState.queryBuilderState.isFetchStructureTyped;
268
+ if (typedTds) {
269
+ olapGroupByState.windowColumns.forEach((c) =>
270
+ appendExtendColumnState(c, lambda),
271
+ );
272
+ } else {
273
+ olapGroupByState.windowColumns.forEach((c) =>
274
+ appendOLAPGroupByColumnState(c, lambda),
275
+ );
276
+ }
142
277
  return lambda;
143
278
  };
@@ -27,6 +27,8 @@ export abstract class QueryBuilderTDS_WindowOperator implements Hashable {
27
27
 
28
28
  abstract get pureFunc(): string;
29
29
 
30
+ abstract get relationFunc(): string | undefined;
31
+
30
32
  abstract isCompatibleWithType(type: Type | undefined): boolean;
31
33
 
32
34
  isColumnAggregator(): boolean {
@@ -32,6 +32,10 @@ export class QueryBuilderTDS_WindowOperator_Average extends QueryBuilderTDS_Wind
32
32
  return QUERY_BUILDER_SUPPORTED_FUNCTIONS.AVERAGE;
33
33
  }
34
34
 
35
+ get relationFunc(): string | undefined {
36
+ return undefined;
37
+ }
38
+
35
39
  get hashCode(): string {
36
40
  return hashArray([
37
41
  QUERY_BUILDER_STATE_HASH_STRUCTURE.TDS_WINDOW_OPERATOR_AVERAGE,
@@ -32,6 +32,10 @@ export class QueryBuilderTDS_WindowOperator_Count extends QueryBuilderTDS_Window
32
32
  return QUERY_BUILDER_SUPPORTED_FUNCTIONS.COUNT;
33
33
  }
34
34
 
35
+ get relationFunc(): string | undefined {
36
+ return undefined;
37
+ }
38
+
35
39
  get hashCode(): string {
36
40
  return hashArray([
37
41
  QUERY_BUILDER_STATE_HASH_STRUCTURE.TDS_WINDOW_OPERATOR_COUNT,
@@ -32,6 +32,10 @@ export class QueryBuilderTDS_WindowOperator_Max extends QueryBuilderTDS_WindowOp
32
32
  return QUERY_BUILDER_SUPPORTED_FUNCTIONS.MAX;
33
33
  }
34
34
 
35
+ get relationFunc(): string | undefined {
36
+ return undefined;
37
+ }
38
+
35
39
  get hashCode(): string {
36
40
  return hashArray([
37
41
  QUERY_BUILDER_STATE_HASH_STRUCTURE.TDS_WINDOW_OPERATOR_MAX,
@@ -32,6 +32,10 @@ export class QueryBuilderTDS_WindowOperator_Min extends QueryBuilderTDS_WindowOp
32
32
  return QUERY_BUILDER_SUPPORTED_FUNCTIONS.MIN;
33
33
  }
34
34
 
35
+ get relationFunc(): string | undefined {
36
+ return undefined;
37
+ }
38
+
35
39
  get hashCode(): string {
36
40
  return hashArray([
37
41
  QUERY_BUILDER_STATE_HASH_STRUCTURE.TDS_WINDOW_OPERATOR_MIN,
@@ -32,6 +32,10 @@ export class QueryBuilderTDS_WindowOperator_Sum extends QueryBuilderTDS_WindowOp
32
32
  return QUERY_BUILDER_SUPPORTED_FUNCTIONS.SUM;
33
33
  }
34
34
 
35
+ get relationFunc(): string | undefined {
36
+ return undefined;
37
+ }
38
+
35
39
  get hashCode(): string {
36
40
  return hashArray([
37
41
  QUERY_BUILDER_STATE_HASH_STRUCTURE.TDS_WINDOW_OPERATOR_SUM,
@@ -29,6 +29,11 @@ export class QueryBuilderTDS_WindowRankOperator_AverageRank extends QueryBuilder
29
29
  return QUERY_BUILDER_SUPPORTED_FUNCTIONS.OLAP_AVERAGE_RANK;
30
30
  }
31
31
 
32
+ get relationFunc(): string | undefined {
33
+ //averageRank not supported for typed TDS
34
+ return undefined;
35
+ }
36
+
32
37
  get hashCode(): string {
33
38
  return hashArray([
34
39
  QUERY_BUILDER_STATE_HASH_STRUCTURE.TDS_WINDOW_OPERATOR_DENSE_RANK,
@@ -29,6 +29,10 @@ export class QueryBuilderTDS_WindowRankOperator_DenseRank extends QueryBuilderTD
29
29
  return QUERY_BUILDER_SUPPORTED_FUNCTIONS.OLAP_DENSE_RANK;
30
30
  }
31
31
 
32
+ get relationFunc(): string | undefined {
33
+ return QUERY_BUILDER_SUPPORTED_FUNCTIONS.RELATION_DENSE_RANK;
34
+ }
35
+
32
36
  get hashCode(): string {
33
37
  return hashArray([
34
38
  QUERY_BUILDER_STATE_HASH_STRUCTURE.TDS_WINDOW_OPERATOR_DENSE_RANK,
@@ -29,6 +29,10 @@ export class QueryBuilderTDS_WindowRankOperator_Rank extends QueryBuilderTDS_Win
29
29
  return QUERY_BUILDER_SUPPORTED_FUNCTIONS.OLAP_RANK;
30
30
  }
31
31
 
32
+ get relationFunc(): string | undefined {
33
+ return QUERY_BUILDER_SUPPORTED_FUNCTIONS.RELATION_RANK;
34
+ }
35
+
32
36
  get hashCode(): string {
33
37
  return hashArray([
34
38
  QUERY_BUILDER_STATE_HASH_STRUCTURE.TDS_WINDOW_OPERATOR_RANK,
@@ -29,6 +29,10 @@ export class QueryBuilderTDS_WindowRankOperator_RowNumber extends QueryBuilderTD
29
29
  return QUERY_BUILDER_SUPPORTED_FUNCTIONS.OLAP_ROW_NUMBER;
30
30
  }
31
31
 
32
+ get relationFunc(): string | undefined {
33
+ return undefined;
34
+ }
35
+
32
36
  get hashCode(): string {
33
37
  return hashArray([
34
38
  QUERY_BUILDER_STATE_HASH_STRUCTURE.TDS_WINDOW_OPERATOR_ROW_NUMBER,